From 964d069771639e7549b7ce2a107d152c59ae3ee6 Mon Sep 17 00:00:00 2001 From: martinkranec Date: Wed, 3 Jan 2024 15:46:52 +0100 Subject: [PATCH 1/3] [NAE-1936] Disable create case button using menu items - added check to new-case-injection-data to check if create case button is shown - declare constnat i group-navigation-constants - added resolving of filter param show_create_case_button in default-tabbed-case-view and default-tab-view --- .../src/lib/navigation/model/group-navigation-constants.ts | 5 +++++ .../new-case/model/new-case-injection-data.ts | 2 ++ .../default-tab-view/default-tab-view.component.ts | 4 +++- .../default-tabbed-case-view.component.html | 2 +- .../default-tabbed-case-view.component.ts | 2 ++ 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/projects/netgrif-components-core/src/lib/navigation/model/group-navigation-constants.ts b/projects/netgrif-components-core/src/lib/navigation/model/group-navigation-constants.ts index 0951504f3..c3264b8b0 100644 --- a/projects/netgrif-components-core/src/lib/navigation/model/group-navigation-constants.ts +++ b/projects/netgrif-components-core/src/lib/navigation/model/group-navigation-constants.ts @@ -35,6 +35,11 @@ export enum GroupNavigationConstants { * */ ITEM_FIELD_ID_CREATE_CASE_BUTTON_ICON = 'create_case_button_icon', + /** + * Boolean field, that is true if the create case button is shown in case view + * */ + ITEM_FIELD_ID_SHOW_CREATE_CASE_BUTTON = "show_create_case_button", + /** * EnumerationMap field, that contains selected search type for case view * */ diff --git a/projects/netgrif-components-core/src/lib/side-menu/content-components/new-case/model/new-case-injection-data.ts b/projects/netgrif-components-core/src/lib/side-menu/content-components/new-case/model/new-case-injection-data.ts index c2f046671..017ce6efa 100644 --- a/projects/netgrif-components-core/src/lib/side-menu/content-components/new-case/model/new-case-injection-data.ts +++ b/projects/netgrif-components-core/src/lib/side-menu/content-components/new-case/model/new-case-injection-data.ts @@ -30,4 +30,6 @@ export interface NewCaseButtonConfiguration { createCaseButtonIcon?: string; + showCreateCaseButton?: boolean; + } diff --git a/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tab-view/default-tab-view.component.ts b/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tab-view/default-tab-view.component.ts index 450ccb1a6..cd204dd9e 100644 --- a/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tab-view/default-tab-view.component.ts +++ b/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tab-view/default-tab-view.component.ts @@ -61,12 +61,14 @@ export class DefaultTabViewComponent { const createCaseButtonTitle: string = extractFieldValueFromData(this._navigationItemTaskData, GroupNavigationConstants.ITEM_FIELD_ID_CREATE_CASE_BUTTON_TITLE); const createCaseButtonIcon: string = extractFieldValueFromData(this._navigationItemTaskData, GroupNavigationConstants.ITEM_FIELD_ID_CREATE_CASE_BUTTON_ICON); const requireTitle: boolean = extractFieldValueFromData(this._navigationItemTaskData, GroupNavigationConstants.ITEM_FIELD_ID_CASE_TITLE_IN_CREATION); + const showCreateCaseButton: boolean = extractFieldValueFromData(this._navigationItemTaskData, GroupNavigationConstants.ITEM_FIELD_ID_SHOW_CREATE_CASE_BUTTON); const newCaseButtonConfig: NewCaseCreationConfigurationData = { enableCaseTitle: requireTitle, isCaseTitleRequired: requireTitle, newCaseButtonConfig: { createCaseButtonTitle, - createCaseButtonIcon + createCaseButtonIcon, + showCreateCaseButton: showCreateCaseButton, }, blockNets: blockNets }; diff --git a/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tabbed-case-view/default-tabbed-case-view.component.html b/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tabbed-case-view/default-tabbed-case-view.component.html index 259595c6f..e38f3e013 100644 --- a/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tabbed-case-view/default-tabbed-case-view.component.html +++ b/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tabbed-case-view/default-tabbed-case-view.component.html @@ -7,7 +7,7 @@ -
+
diff --git a/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tabbed-case-view/default-tabbed-case-view.component.ts b/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tabbed-case-view/default-tabbed-case-view.component.ts index 5ed099d96..6b4ad82ce 100644 --- a/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tabbed-case-view/default-tabbed-case-view.component.ts +++ b/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tabbed-case-view/default-tabbed-case-view.component.ts @@ -78,6 +78,7 @@ export class DefaultTabbedCaseViewComponent extends AbstractTabbedCaseViewCompon initialSearchMode: SearchMode; showToggleButton: boolean; enableSearch: boolean; + showCreateCaseButton: boolean; showDeleteMenu: boolean; headersChangeable: boolean; headersMode: string[]; @@ -94,6 +95,7 @@ export class DefaultTabbedCaseViewComponent extends AbstractTabbedCaseViewCompon this.initialSearchMode = _injectedTabData.caseViewSearchTypeConfiguration.initialSearchMode; this.showToggleButton = _injectedTabData.caseViewSearchTypeConfiguration.showSearchToggleButton; this.enableSearch = _injectedTabData.caseViewSearchTypeConfiguration.initialSearchMode !== undefined; + this.showCreateCaseButton = _injectedTabData.newCaseButtonConfiguration.newCaseButtonConfig.showCreateCaseButton; this.showDeleteMenu = _injectedTabData.caseViewShowMoreMenu; this.headersChangeable = _injectedTabData.caseViewHeadersChangeable; this.headersMode = _injectedTabData.caseViewHeadersMode ? _injectedTabData.caseViewHeadersMode : []; From 372bb20e4044af7b9c0cb9d6a022d9f008797b67 Mon Sep 17 00:00:00 2001 From: martinkranec Date: Wed, 3 Jan 2024 17:00:58 +0100 Subject: [PATCH 2/3] [NAE-1936] Disable create case button using menu items - fix tests --- .../default-tab-view/default-tab-view.component.spec.ts | 4 ++++ .../default-tabbed-case-view.component.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tab-view/default-tab-view.component.spec.ts b/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tab-view/default-tab-view.component.spec.ts index e4ec4b90e..0bbb46bf6 100644 --- a/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tab-view/default-tab-view.component.spec.ts +++ b/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tab-view/default-tab-view.component.spec.ts @@ -135,6 +135,10 @@ describe('DefaultTabViewComponent', () => { GroupNavigationConstants.ITEM_FIELD_ID_ADDITIONAL_FILTER_TASKREF, '',[],{visible: true} ), + new BooleanField( + GroupNavigationConstants.ITEM_FIELD_ID_SHOW_CREATE_CASE_BUTTON, + '',true,{visible: true} + ), ] }, { diff --git a/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tabbed-case-view/default-tabbed-case-view.component.ts b/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tabbed-case-view/default-tabbed-case-view.component.ts index 6b4ad82ce..ee536cf95 100644 --- a/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tabbed-case-view/default-tabbed-case-view.component.ts +++ b/projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/default-tabbed-case-view/default-tabbed-case-view.component.ts @@ -95,7 +95,7 @@ export class DefaultTabbedCaseViewComponent extends AbstractTabbedCaseViewCompon this.initialSearchMode = _injectedTabData.caseViewSearchTypeConfiguration.initialSearchMode; this.showToggleButton = _injectedTabData.caseViewSearchTypeConfiguration.showSearchToggleButton; this.enableSearch = _injectedTabData.caseViewSearchTypeConfiguration.initialSearchMode !== undefined; - this.showCreateCaseButton = _injectedTabData.newCaseButtonConfiguration.newCaseButtonConfig.showCreateCaseButton; + this.showCreateCaseButton = _injectedTabData.newCaseButtonConfiguration?.newCaseButtonConfig?.showCreateCaseButton; this.showDeleteMenu = _injectedTabData.caseViewShowMoreMenu; this.headersChangeable = _injectedTabData.caseViewHeadersChangeable; this.headersMode = _injectedTabData.caseViewHeadersMode ? _injectedTabData.caseViewHeadersMode : []; From c62a771435f57dc820b98d6565732f6a73faad7b Mon Sep 17 00:00:00 2001 From: martinkranec Date: Wed, 10 Jan 2024 13:09:51 +0100 Subject: [PATCH 3/3] [NAE-1936] Disable create case button using menu items - added documentation --- docs/_sidebar.md | 1 + docs/views/default-tabbed-case-view.md | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 docs/views/default-tabbed-case-view.md diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 9f26e3e04..dcd633295 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -2,6 +2,7 @@ * [Get Started](get_started.md) * [Configuration](configuration/configuration.md) * [Tree case view](views/tree_case_view.md) +* [Default tabbed case view](views/default-tabbed-case-view.md) * Compodoc * [Components](https://components.netgrif.com/compodoc/components) * Typedoc diff --git a/docs/views/default-tabbed-case-view.md b/docs/views/default-tabbed-case-view.md new file mode 100644 index 000000000..81b17cf6c --- /dev/null +++ b/docs/views/default-tabbed-case-view.md @@ -0,0 +1,6 @@ +# Default Tabbed Case View +Default Tabbed Case View is used by the menu items. Case View shows cases by injected filter from process preference_item stored in database. + +## Configuration +**showCreateCaseButton** (boolean) field that decide whether to show the create case button. +The value comes from the preference_item case instance and is in the field with id *"show_create_case_button"*.