This commit is contained in:
Michele Artini 2023-03-23 15:05:39 +01:00
parent ff908c7af3
commit 1a0bfe69a6
4 changed files with 45 additions and 22 deletions

View File

@ -21,6 +21,7 @@ const routes: Routes = [
{ path: "adv_resources/protocol", component: ProtocolsComponent }, { path: "adv_resources/protocol", component: ProtocolsComponent },
{ path: "adv_resources/email", component: EmailsComponent }, { path: "adv_resources/email", component: EmailsComponent },
{ path: "wfs/:section", component: WfConfsComponent }, { path: "wfs/:section", component: WfConfsComponent },
{ path: "wfs/conf/:conf", component: WfConfsComponent },
{ path: "wf_history", component: WfHistoryComponent }, { path: "wf_history", component: WfHistoryComponent },
{ path: "ctx_viewer", component: ContextViewerComponent }, { path: "ctx_viewer", component: ContextViewerComponent },
{ path: "voc_editor", component: VocabularyEditorComponent }, { path: "voc_editor", component: VocabularyEditorComponent },

View File

@ -24,10 +24,6 @@ export class ISService {
this.httpGet<ResourceType>("/ajax/resourceTypes/" + encodeURIComponent(id), onSuccess); this.httpGet<ResourceType>("/ajax/resourceTypes/" + encodeURIComponent(id), onSuccess);
} }
loadWfSections(onSuccess: Function) {
this.httpGet<WfSection[]>("/ajax/wfs/sections", onSuccess)
}
loadInfo(onSuccess: Function): void { loadInfo(onSuccess: Function): void {
this.httpGet<any[]>("/ajax/info/", onSuccess); this.httpGet<any[]>("/ajax/info/", onSuccess);
} }
@ -228,17 +224,18 @@ export class ISService {
deleteEmailTemplate(id: string, onSuccess: Function): void { deleteEmailTemplate(id: string, onSuccess: Function): void {
this.httpDelete('./ajax/templates/email/' + encodeURIComponent(id), onSuccess); this.httpDelete('./ajax/templates/email/' + encodeURIComponent(id), onSuccess);
} }
loadWfSections(onSuccess: Function) {
this.httpGet<WfSection[]>("/ajax/wfs/sections", onSuccess)
}
loadWfConfigurations(sectionId: string, onSuccess: Function): void { loadWfConfigurations(sectionId: string, onSuccess: Function): void {
this.httpGet<KeyValue[]>('./ajax/wfs/section/' + encodeURIComponent(sectionId), onSuccess); this.httpGet<KeyValue[]>('./ajax/wfs/sections/' + encodeURIComponent(sectionId), onSuccess);
} }
loadWfConfiguration(id: string, onSuccess: Function): void { loadWfConfiguration(id: string, onSuccess: Function): void {
this.httpGet<WfConf>('./ajax/wfs/conf/' + encodeURIComponent(id), onSuccess); this.httpGet<WfConf>('./ajax/wfs/conf/' + encodeURIComponent(id), onSuccess);
} }
saveWfConfiguration(conf: WfConf, onSuccess: Function, relatedForm?: FormGroup): void { saveWfConfiguration(conf: WfConf, onSuccess: Function, relatedForm?: FormGroup): void {
this.httpPost('./ajax/wfs/conf', conf, onSuccess, relatedForm); this.httpPost('./ajax/wfs/conf', conf, onSuccess, relatedForm);
} }

View File

@ -1,7 +1,16 @@
<h2>{{section?.name}}: Configured Workflows</h2> <h2>{{section?.name}}: Configured Workflows</h2>
{{confs}}
<nav mat-tab-nav-bar *ngIf="confs.length > 0">
<a mat-tab-link *ngFor="let c of confs" [routerLink]="['/wfs/conf', c.k]" routerLinkActive #rla="routerLinkActive"
[active]="rla.isActive">
{{c.v}}
</a>
</nav>
<mat-tab-group animationDuration="0ms"> <div *ngIf="conf">
<mat-tab label="First">Content 1</mat-tab> {{conf}}
<mat-tab label="Second">Content 2</mat-tab> </div>
<mat-tab label="Third">Content 3</mat-tab>
</mat-tab-group> <div *ngIf="!conf">
Workflow Configuration does not exist
</div>

View File

@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit, SecurityContext } from '@angular/core';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { KeyValue, WfSection } from '../common/is.model'; import { KeyValue, WfConf, WfSection } from '../common/is.model';
import { ISService } from '../common/is.service'; import { ISService } from '../common/is.service';
@Component({ @Component({
@ -13,19 +13,35 @@ export class WfConfsComponent implements OnInit {
section?: WfSection; section?: WfSection;
confs: KeyValue[] = []; confs: KeyValue[] = [];
conf?: WfConf;
constructor(public service: ISService, public route: ActivatedRoute, public dialog: MatDialog) { constructor(public service: ISService, public route: ActivatedRoute, public router: Router, public dialog: MatDialog) {
} }
ngOnInit() { ngOnInit() {
this.route.params.subscribe(params => { this.route.params.subscribe(params => {
let sectionId = params['section']; let sectionId = params['section'];
this.service.loadWfSections((data: WfSection[]) => this.section = data.find(s => s.id == sectionId)); let confId = params['conf'];
this.reload();
if (confId) {
this.service.loadWfConfiguration(confId, (conf: WfConf) => {
this.conf = conf;
if (conf.section) {
this.service.loadWfSections((data: WfSection[]) => this.section = data.find(s => s.id == conf?.section));
this.service.loadWfConfigurations(conf.section, (data: KeyValue[]) => this.confs = data);
}
});
} else if (sectionId) {
this.service.loadWfSections((data: WfSection[]) => this.section = data.find(s => s.id == sectionId));
this.service.loadWfConfigurations(sectionId, (data: KeyValue[]) => {
this.confs = data;
if (data.length > 0) {
this.router.navigate(['/wfs/conf', data[0].k]);
}
});
} else {
console.log("One of the following parameters is missing: sectionId or confId");
}
}); });
} }
reload() {
}
} }