From 96799bd516a93053f55304f9529e2fd4d3029b56 Mon Sep 17 00:00:00 2001 From: Julian-Mueller-GIP <139366124+Julian-Mueller-GIP@users.noreply.github.com> Date: Fri, 13 Dec 2024 17:20:07 +0100 Subject: [PATCH] 134 show datatype level plugins in datatype view (#135) * added datatype plugin * added PluginTabItems to datatype-details * reworked tab interfaces --- .../datatype-details.component.ts | 90 +++++++++++-------- .../exceptiontype-details.component.ts | 7 +- .../member-variable-details.component.ts | 9 +- .../method-details.component.ts | 8 +- .../datatype/tabs/datatype-tab.component.ts | 25 +++--- .../datatype-plugin-tab.component.html | 5 ++ .../datatype-plugin-tab.component.scss | 25 ++++++ .../datatype/datatype-plugin-tab.component.ts | 53 +++++++++++ processmodeller.module.ts | 2 + version.ts | 2 +- xo/data-type.model.ts | 4 + 11 files changed, 170 insertions(+), 60 deletions(-) create mode 100644 document/datatype/tabs/datatype/datatype-plugin-tab.component.html create mode 100644 document/datatype/tabs/datatype/datatype-plugin-tab.component.scss create mode 100644 document/datatype/tabs/datatype/datatype-plugin-tab.component.ts diff --git a/document/datatype/datatype-details/datatype-details.component.ts b/document/datatype/datatype-details/datatype-details.component.ts index 05f45c2..4afde82 100644 --- a/document/datatype/datatype-details/datatype-details.component.ts +++ b/document/datatype/datatype-details/datatype-details.component.ts @@ -17,19 +17,22 @@ */ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Injector, Input, OnDestroy, Optional } from '@angular/core'; +import { PluginService } from '@pmod/document/plugin.service'; import { XoDataType } from '@pmod/xo/data-type.model'; import { XoDetailsItem } from '@pmod/xo/details-item.model'; import { I18nService } from '@zeta/i18n'; import { XcTabBarItem } from '@zeta/xc'; +import { XoBaseDefinition, XoDefinitionBundle } from '@zeta/xc/xc-form/definitions/xo/base-definition.model'; -import { BehaviorSubject, Subject } from 'rxjs'; +import { BehaviorSubject, combineLatest, map, Observable, of, Subject } from 'rxjs'; import { XoRuntimeContext } from '../../../xo/runtime-context.model'; import { ComponentMappingService } from '../../component-mapping.service'; import { DocumentService } from '../../document.service'; import { WorkflowDetailLevelService } from '../../workflow-detail-level.service'; import { ModellingItemComponent } from '../../workflow/shared/modelling-object.component'; -import { BaseTabData, DataTypeTabData, DocumentationTabData, DocumentTabData, MetaTabData } from '../tabs/datatype-tab.component'; +import { DocumentationTabData, DocumentTabData, MetaTabData, PluginTabData } from '../tabs/datatype-tab.component'; +import { DataTypePluginTabComponent } from '../tabs/datatype/datatype-plugin-tab.component'; import { DataTypeStorableTabComponent } from '../tabs/datatype/datatype-storable-tab.component'; import { DocumentationTabComponent } from '../tabs/shared/documentation-tab.component'; import { MetaTabComponent } from '../tabs/shared/meta-tab.component'; @@ -50,7 +53,6 @@ export class DataTypeDetailsComponent extends ModellingItemComponent implements set isStorable(value: boolean) { if (value !== this._isStorable) { this._isStorable = value; - this.updateTabBarItemList(); } } @@ -62,9 +64,9 @@ export class DataTypeDetailsComponent extends ModellingItemComponent implements set dataType(value: XoDataType) { this.setModel(value); if (value) { + this.updateTabBarItemList(); this.refreshTabs(); } - this.cdr.markForCheck(); } @Input() @@ -77,9 +79,7 @@ export class DataTypeDetailsComponent extends ModellingItemComponent implements private _isStorable = false; - docTabUpdate: Subject = new BehaviorSubject(this.buildDocTabData()); - metaTabUpdate: Subject = new BehaviorSubject(this.buildMetaTabData()); - dataTypeTabUpdate: Subject = new BehaviorSubject(this.buildDataTypeTabData()); + tabUpdate: Subject = new BehaviorSubject(this.dataType); readonly documentationTabItem: XcTabBarItem> = { closable: false, @@ -88,7 +88,8 @@ export class DataTypeDetailsComponent extends ModellingItemComponent implements data: >{ documentModel: this.documentModel, performAction: this.performAction.bind(this), - update: this.docTabUpdate.asObservable() + readonly: this.readonly, + update: this.tabUpdate.asObservable().pipe(map(dataType => this.buildDocTabData(dataType))) } }; @@ -99,42 +100,42 @@ export class DataTypeDetailsComponent extends ModellingItemComponent implements data: >{ documentModel: this.documentModel, performAction: this.performAction.bind(this), - update: this.metaTabUpdate.asObservable() + readonly: this.readonly, + update: this.tabUpdate.asObservable().pipe(map(dataType => this.buildMetaTabData(dataType))) } }; - readonly storableTabItem: XcTabBarItem> = { + readonly storableTabItem: XcTabBarItem> = { closable: false, component: DataTypeStorableTabComponent, name: 'ODS Information', - data: >{ + data: >{ documentModel: this.documentModel, performAction: this.performAction.bind(this), - update: this.dataTypeTabUpdate.asObservable() + readonly: this.readonly, + update: this.tabUpdate.asObservable() } }; - tabBarSelection: XcTabBarItem>; - tabBarItems: XcTabBarItem>[]; + tabBarSelection: XcTabBarItem>; + tabBarItems: XcTabBarItem>[]; constructor( elementRef: ElementRef, componentMappingService: ComponentMappingService, documentService: DocumentService, detailLevelService: WorkflowDetailLevelService, + private readonly pluginService: PluginService, private readonly i18nService: I18nService, private readonly cdr: ChangeDetectorRef, @Optional() injector: Injector ) { super(elementRef, componentMappingService, documentService, detailLevelService, injector); this.tabBarSelection = this.documentationTabItem; - this.updateTabBarItemList(); } ngOnDestroy() { - this.docTabUpdate.complete(); - this.metaTabUpdate.complete(); - this.dataTypeTabUpdate.complete(); + this.tabUpdate.complete(); super.ngOnDestroy(); } @@ -143,26 +144,17 @@ export class DataTypeDetailsComponent extends ModellingItemComponent implements } - private buildDocTabData(): DocumentationTabData { - return { - documentationArea: this.dataType?.documentationArea, - readonly: this.readonly + private buildDocTabData(dataType: XoDataType): DocumentationTabData { + return { + documentationArea: dataType.documentationArea }; } - private buildMetaTabData(): MetaTabData { - return { - metaTagArea: this.dataType?.metaTagArea, + private buildMetaTabData(dataType: XoDataType): MetaTabData { + return { + metaTagArea: dataType.metaTagArea, objectIdKey: '', - objectId: '', - readonly: this.readonly - }; - } - - private buildDataTypeTabData(): DataTypeTabData { - return { - dataType: this.dataType, - readonly: this.readonly + objectId: '' }; } @@ -171,12 +163,36 @@ export class DataTypeDetailsComponent extends ModellingItemComponent implements if (this._isStorable) { this.tabBarItems.push(this.storableTabItem); } + if (this.dataType.plugin?.guiDefiningWorkflow) { + combineLatest( + this.dataType.plugin?.guiDefiningWorkflow.data.map( + value => this.pluginService.getFromCacheOrCallWorkflow(value) + ) + ).subscribe(bundles => { + bundles.forEach(bundle => { + bundle.data.push(this.dataType.plugin.context); + this.tabBarItems.push(this.createPluginTabItem(bundle, (bundle.definition as XoBaseDefinition).label)); + }); + }); + } this.cdr.markForCheck(); } private refreshTabs() { - this.docTabUpdate.next(this.buildDocTabData()); - this.metaTabUpdate.next(this.buildMetaTabData()); - this.dataTypeTabUpdate.next(this.buildDataTypeTabData()); + this.tabUpdate.next(this.dataType); + } + + private createPluginTabItem(bundle: XoDefinitionBundle, tabName: string): XcTabBarItem { + return > { + closable: false, + component: DataTypePluginTabComponent, + name: tabName || 'Plugin', + data: { + documentModel: this.documentModel, + performAction: this.performAction.bind(this), + update: of() as Observable, + bundle: bundle + } + }; } } diff --git a/document/datatype/exceptiontype-details/exceptiontype-details.component.ts b/document/datatype/exceptiontype-details/exceptiontype-details.component.ts index 6b0ea0d..4b282b1 100644 --- a/document/datatype/exceptiontype-details/exceptiontype-details.component.ts +++ b/document/datatype/exceptiontype-details/exceptiontype-details.component.ts @@ -28,7 +28,7 @@ import { ComponentMappingService } from '../../component-mapping.service'; import { DocumentService } from '../../document.service'; import { WorkflowDetailLevelService } from '../../workflow-detail-level.service'; import { ModellingItemComponent } from '../../workflow/shared/modelling-object.component'; -import { BaseTabData, DocumentationTabData, DocumentTabData } from '../tabs/datatype-tab.component'; +import { DocumentationTabData, DocumentTabData } from '../tabs/datatype-tab.component'; import { DocumentationTabComponent } from '../tabs/shared/documentation-tab.component'; @@ -70,12 +70,13 @@ export class ExceptionTypeDetailsComponent extends ModellingItemComponent implem data: >{ documentModel: this.documentModel, performAction: this.performAction.bind(this), + readonly: this.readonly, update: this.docTabUpdate.asObservable() } }; - tabBarSelection: XcTabBarItem>; - tabBarItems: XcTabBarItem>[]; + tabBarSelection: XcTabBarItem>; + tabBarItems: XcTabBarItem>[]; constructor( elementRef: ElementRef, diff --git a/document/datatype/member-variable-details/member-variable-details.component.ts b/document/datatype/member-variable-details/member-variable-details.component.ts index 53752fb..a0b8ba9 100644 --- a/document/datatype/member-variable-details/member-variable-details.component.ts +++ b/document/datatype/member-variable-details/member-variable-details.component.ts @@ -27,7 +27,7 @@ import { XoRuntimeContext } from '../../../xo/runtime-context.model'; import { ComponentMappingService } from '../../component-mapping.service'; import { DocumentService } from '../../document.service'; import { ModellingItemComponent } from '../../workflow/shared/modelling-object.component'; -import { BaseTabData, DocumentTabData, MetaTabData, VariableTabData } from '../tabs/datatype-tab.component'; +import { DocumentTabData, MetaTabData, VariableTabData } from '../tabs/datatype-tab.component'; import { MemberVariableBaseTabComponent } from '../tabs/member-variable/member-variable-base-tab.component'; import { MemberVariableStorableTabComponent } from '../tabs/member-variable/member-variable-storable-tab.component'; import { MetaTabComponent } from '../tabs/shared/meta-tab.component'; @@ -78,6 +78,7 @@ export class MemberVariableDetailsComponent extends ModellingItemComponent imple data: >{ documentModel: this.documentModel, performAction: this.performAction.bind(this), + readonly: this.readonly, update: this.memberTabUpdate.asObservable() } }; @@ -89,6 +90,7 @@ export class MemberVariableDetailsComponent extends ModellingItemComponent imple data: >{ documentModel: this.documentModel, performAction: this.performAction.bind(this), + readonly: this.readonly, update: this.metaTabUpdate.asObservable() } }; @@ -100,12 +102,13 @@ export class MemberVariableDetailsComponent extends ModellingItemComponent imple data: >{ documentModel: this.documentModel, performAction: this.performAction.bind(this), + readonly: this.readonly, update: this.memberTabUpdate.asObservable() } }; - tabBarSelection: XcTabBarItem>; - tabBarItems: XcTabBarItem>[]; + tabBarSelection: XcTabBarItem>; + tabBarItems: XcTabBarItem>[]; constructor( elementRef: ElementRef, diff --git a/document/datatype/method-details/method-details.component.ts b/document/datatype/method-details/method-details.component.ts index 47f7aff..6a79ad1 100644 --- a/document/datatype/method-details/method-details.component.ts +++ b/document/datatype/method-details/method-details.component.ts @@ -27,7 +27,7 @@ import { XoMethod } from '../../../xo/method.model'; import { ComponentMappingService } from '../../component-mapping.service'; import { DocumentService } from '../../document.service'; import { ModellingItemComponent } from '../../workflow/shared/modelling-object.component'; -import { BaseTabData, DocumentTabData, MetaTabData, MethodTabData } from '../tabs/datatype-tab.component'; +import { DocumentTabData, MetaTabData, MethodTabData } from '../tabs/datatype-tab.component'; import { MethodBaseTabComponent } from '../tabs/method/method-base-tab.component'; import { MethodImplementationTabComponent } from '../tabs/method/method-implementation-tab.component'; import { MetaTabComponent } from '../tabs/shared/meta-tab.component'; @@ -66,6 +66,7 @@ export class MethodDetailsComponent extends ModellingItemComponent implements On data: >{ documentModel: this.documentModel, performAction: this.performAction.bind(this), + readonly: this.readonly, update: this.methodTabUpdate.asObservable() } }; @@ -77,6 +78,7 @@ export class MethodDetailsComponent extends ModellingItemComponent implements On data: >{ documentModel: this.documentModel, performAction: this.performAction.bind(this), + readonly: this.readonly, update: this.metaTabUpdate.asObservable() } }; @@ -92,8 +94,8 @@ export class MethodDetailsComponent extends ModellingItemComponent implements On } }; - tabBarSelection: XcTabBarItem>; - tabBarItems: XcTabBarItem>[]; + tabBarSelection: XcTabBarItem>; + tabBarItems: XcTabBarItem>[]; constructor( diff --git a/document/datatype/tabs/datatype-tab.component.ts b/document/datatype/tabs/datatype-tab.component.ts index 397c1a5..1d1a207 100644 --- a/document/datatype/tabs/datatype-tab.component.ts +++ b/document/datatype/tabs/datatype-tab.component.ts @@ -37,6 +37,7 @@ import { XoStaticMethod } from '@pmod/xo/static-method.model'; import { XoTextArea } from '@pmod/xo/text-area.model'; import { FullQualifiedName } from '@zeta/api'; import { XcTabComponent } from '@zeta/xc'; +import { XoDefinitionBundle } from '@zeta/xc/xc-form/definitions/xo/base-definition.model'; import { Observable, Subject, takeUntil } from 'rxjs'; @@ -44,33 +45,31 @@ import { Observable, Subject, takeUntil } from 'rxjs'; export interface DocumentTabData { documentModel: DocumentModel; performAction: (action: TriggeredAction) => void; + readonly: boolean; update: Observable; } -export interface BaseTabData { - readonly: boolean; -} -export interface DocumentationTabData extends BaseTabData { +export interface DocumentationTabData { documentationArea: XoTextArea; } -export interface MetaTabData extends BaseTabData { +export interface MetaTabData { metaTagArea: XoMetaTagArea; objectIdKey: string; objectId: string; } -export interface DataTypeTabData extends BaseTabData { - dataType: XoDataType; +export interface PluginTabData extends DocumentTabData { + bundle: XoDefinitionBundle; } -export interface VariableTabData extends BaseTabData { +export interface VariableTabData { variable: XoMemberVariable; dataTypeRTC: XoRuntimeContext; } -export interface MethodTabData extends BaseTabData { +export interface MethodTabData { method: XoMethod; } @@ -81,13 +80,13 @@ export interface MethodTabData extends BaseTabData { @Component({ template: '' }) -export abstract class DatatypeTabComponent extends XcTabComponent> implements OnDestroy { +export abstract class DatatypeTabComponent = DocumentTabData> extends XcTabComponent implements OnDestroy { private readonly destroySubject = new Subject(); protected tabData: D; get readonly(): boolean { - return this.tabData?.readonly; + return this.injectedData.readonly; } get documentModel(): DocumentModel { @@ -126,11 +125,11 @@ export abstract class DatatypeTabComponent extends XcTabC @Component({ template: '' }) -export abstract class DatatypeDetailsTabComponent extends DatatypeTabComponent { +export abstract class DatatypeDetailsTabComponent extends DatatypeTabComponent { get dataType(): XoDataType { - return this.tabData?.dataType; + return this.tabData; } } diff --git a/document/datatype/tabs/datatype/datatype-plugin-tab.component.html b/document/datatype/tabs/datatype/datatype-plugin-tab.component.html new file mode 100644 index 0000000..72ca9cc --- /dev/null +++ b/document/datatype/tabs/datatype/datatype-plugin-tab.component.html @@ -0,0 +1,5 @@ + diff --git a/document/datatype/tabs/datatype/datatype-plugin-tab.component.scss b/document/datatype/tabs/datatype/datatype-plugin-tab.component.scss new file mode 100644 index 0000000..06e60ef --- /dev/null +++ b/document/datatype/tabs/datatype/datatype-plugin-tab.component.scss @@ -0,0 +1,25 @@ +/* + * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * Copyright 2024 Xyna GmbH, Germany + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + */ + @import 'const'; + + :host { + display: flex; + flex-direction: column; + flex: 1 1 100%; + padding: 10px; + } diff --git a/document/datatype/tabs/datatype/datatype-plugin-tab.component.ts b/document/datatype/tabs/datatype/datatype-plugin-tab.component.ts new file mode 100644 index 0000000..41ae433 --- /dev/null +++ b/document/datatype/tabs/datatype/datatype-plugin-tab.component.ts @@ -0,0 +1,53 @@ +/* + * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * Copyright 2024 Xyna GmbH, Germany + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + */ +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Injector, Optional } from '@angular/core'; + +import { DocumentService } from '@pmod/document/document.service'; +import { PluginService } from '@pmod/document/plugin.service'; +import { XoDataType } from '@pmod/xo/data-type.model'; +import { Xo } from '@zeta/api'; +import { XoDefinition } from '@zeta/xc/xc-form/definitions/xo/base-definition.model'; + +import { DatatypeTabComponent, PluginTabData } from '../datatype-tab.component'; + + +@Component({ + templateUrl: './datatype-plugin-tab.component.html', + styleUrls: ['./datatype-plugin-tab.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class DataTypePluginTabComponent extends DatatypeTabComponent { + + constructor( + protected readonly documentService: DocumentService, + readonly pluginService: PluginService, + protected readonly cdr: ChangeDetectorRef, + @Optional() injector: Injector + ) { + super(documentService, cdr, injector); + } + + get definition(): XoDefinition { + return this.injectedData.bundle?.definition; + } + + get data(): Xo[] { + return this.injectedData.bundle?.data; + } +} + diff --git a/processmodeller.module.ts b/processmodeller.module.ts index a5eed17..b1c1e2a 100644 --- a/processmodeller.module.ts +++ b/processmodeller.module.ts @@ -44,6 +44,7 @@ import { MethodDetailsComponent } from './document/datatype/method-details/metho import { MethodImplementationComponent } from './document/datatype/method-implementation/method-implementation.component'; import { ServiceAreaComponent } from './document/datatype/service-area/service-area.component'; import { StorablePropertiesAreaComponent } from './document/datatype/storable-properties-area/storable-properties-area.component'; +import { DataTypePluginTabComponent } from './document/datatype/tabs/datatype/datatype-plugin-tab.component'; import { DataTypeStorableTabComponent } from './document/datatype/tabs/datatype/datatype-storable-tab.component'; import { MemberVariableBaseTabComponent } from './document/datatype/tabs/member-variable/member-variable-base-tab.component'; import { MemberVariableStorableTabComponent } from './document/datatype/tabs/member-variable/member-variable-storable-tab.component'; @@ -202,6 +203,7 @@ import { WorkflowDetailSettingsService } from './workflow-detail-settings.servic DataflowComponent, DataTypeComponent, DataTypeDetailsComponent, + DataTypePluginTabComponent, DataTypeStorableTabComponent, DetailsItemComponent, DetailsComponent, diff --git a/version.ts b/version.ts index 79efb63..78f0cf0 100644 --- a/version.ts +++ b/version.ts @@ -16,4 +16,4 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ export const ProcessModellerName = 'Process Modeller'; -export const ProcessModellerVersion = '2.6.6'; +export const ProcessModellerVersion = '2.6.7'; diff --git a/xo/data-type.model.ts b/xo/data-type.model.ts index ab33459..772b8d7 100644 --- a/xo/data-type.model.ts +++ b/xo/data-type.model.ts @@ -15,6 +15,7 @@ * limitations under the License. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +import { XoPlugin } from '@yggdrasil/plugin/plugin.model'; import { XoObjectClass, XoProperty, XoTransient } from '@zeta/api'; import { BehaviorSubject, Observable } from 'rxjs'; @@ -87,6 +88,9 @@ export class XoDataType extends XoXmomItem { @XoTransient() memberMethodsArea: XoMemberMethodArea; + @XoProperty(XoPlugin) + plugin: XoPlugin; + private readonly _revisionSubject = new BehaviorSubject(null); deploymentState: DeploymentState;