Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NAE-1936] Disable create case button using menu items #228

Merged
merged 4 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions docs/views/default-tabbed-case-view.md
Original file line number Diff line number Diff line change
@@ -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"*.
Original file line number Diff line number Diff line change
Expand Up @@ -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
* */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ export interface NewCaseButtonConfiguration {

createCaseButtonIcon?: string;

showCreateCaseButton?: boolean;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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}
),
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ export class DefaultTabViewComponent {
const createCaseButtonTitle: string = extractFieldValueFromData<string>(this._navigationItemTaskData, GroupNavigationConstants.ITEM_FIELD_ID_CREATE_CASE_BUTTON_TITLE);
const createCaseButtonIcon: string = extractFieldValueFromData<string>(this._navigationItemTaskData, GroupNavigationConstants.ITEM_FIELD_ID_CREATE_CASE_BUTTON_ICON);
const requireTitle: boolean = extractFieldValueFromData<boolean>(this._navigationItemTaskData, GroupNavigationConstants.ITEM_FIELD_ID_CASE_TITLE_IN_CREATION);
const showCreateCaseButton: boolean = extractFieldValueFromData<boolean>(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
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<nc-search class="search-width search-fix" *ngIf="(enableSearch)" [showSearchToggleButton]="showToggleButton"
[initialSearchMode]="initialSearchMode" (filterLoaded)="loadFilter($event)"></nc-search>
</div>
<div fxLayoutAlign="end center">
<div fxLayoutAlign="end center" *ngIf="showCreateCaseButton">
<nc-create-case-button [newCaseCreationConfig]="newCaseCreationConfig" (caseCreatedEvent)="handleCaseClick($event)"></nc-create-case-button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export class DefaultTabbedCaseViewComponent extends AbstractTabbedCaseViewCompon
initialSearchMode: SearchMode;
showToggleButton: boolean;
enableSearch: boolean;
showCreateCaseButton: boolean;
showDeleteMenu: boolean;
headersChangeable: boolean;
headersMode: string[];
Expand All @@ -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 : [];
Expand Down