From 6767226b46f9ce7706afa64b1ce56b293c6c3642 Mon Sep 17 00:00:00 2001 From: amentis Date: Fri, 10 May 2024 11:24:03 +0300 Subject: [PATCH 1/2] add status filter on description template type autocomplete lookup --- .../description-template-type.service.ts | 26 ++++++++++++++++++- ...description-template-editor.component.html | 2 +- .../description-template-editor.component.ts | 6 +++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/dmp-frontend/src/app/core/services/description-template-type/description-template-type.service.ts b/dmp-frontend/src/app/core/services/description-template-type/description-template-type.service.ts index 4b8666439..8788a96a9 100644 --- a/dmp-frontend/src/app/core/services/description-template-type/description-template-type.service.ts +++ b/dmp-frontend/src/app/core/services/description-template-type/description-template-type.service.ts @@ -12,6 +12,7 @@ import { catchError, map } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; import { ConfigurationService } from '../configuration/configuration.service'; import { BaseHttpV2Service } from '../http/base-http-v2.service'; +import { DescriptionTemplateTypeStatus } from '@app/core/common/enum/description-template-type-status'; @Injectable() export class DescriptionTemplateTypeService { @@ -69,6 +70,17 @@ export class DescriptionTemplateTypeService { valueAssign: (item: DescriptionTemplateType) => item.id, }; + public getSingleAutocompleteConfiguration(statuses?: DescriptionTemplateTypeStatus[]): SingleAutoCompleteConfiguration { + return { + initialItems: (data?: any) => this.query(this.buildAutocompleteLookup(null, null, null, statuses ? statuses: null)).pipe(map(x => x.items)), + filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteLookup(searchQuery, null, null, statuses ? statuses: null)).pipe(map(x => x.items)), + getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), + displayFn: (item: DescriptionTemplateType) => item.name, + titleFn: (item: DescriptionTemplateType) => item.name, + valueAssign: (item: DescriptionTemplateType) => item.id, + }; + } + // tslint:disable-next-line: member-ordering multipleAutocompleteConfiguration: MultipleAutoCompleteConfiguration = { initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteLookup(null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)), @@ -79,12 +91,24 @@ export class DescriptionTemplateTypeService { valueAssign: (item: DescriptionTemplateType) => item.id, }; - private buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): DescriptionTemplateTypeLookup { + public getMultipleAutoCompleteSearchConfiguration(statuses?: DescriptionTemplateTypeStatus[]): MultipleAutoCompleteConfiguration { + return { + initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteLookup(null, excludedItems ? excludedItems : null, null, statuses ? statuses: null)).pipe(map(x => x.items)), + filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteLookup(searchQuery, excludedItems, null, statuses ? statuses: null)).pipe(map(x => x.items)), + getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteLookup(null, null, selectedItems)).pipe(map(x => x.items)), + displayFn: (item: DescriptionTemplateType) => item.name, + titleFn: (item: DescriptionTemplateType) => item.name, + valueAssign: (item: DescriptionTemplateType) => item.id, + }; + } + + private buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[], statuses?: DescriptionTemplateTypeStatus[]): DescriptionTemplateTypeLookup { const lookup: DescriptionTemplateTypeLookup = new DescriptionTemplateTypeLookup(); lookup.page = { size: 100, offset: 0 }; if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; } if (ids && ids.length > 0) { lookup.ids = ids; } lookup.isActive = [IsActive.Active]; + lookup.statuses = statuses; lookup.project = { fields: [ nameof(x => x.id), diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.html index 54cceb530..5220ff6c9 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.html @@ -82,7 +82,7 @@
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-TYPE-HINT'| translate}}
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DESCRIPTION-TEMPLATE-SELECT-TYPE' | translate}} - + {{formGroup.get('type').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts index f3cb1c249..b0f972580 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts @@ -43,6 +43,8 @@ import { ConfigurationService } from '@app/core/services/configuration/configura import { LockService } from '@app/core/services/lock/lock.service'; import { LockTargetType } from '@app/core/common/enum/lock-target-type'; import { Title } from '@angular/platform-browser'; +import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; +import { DescriptionTemplateTypeStatus } from '@app/core/common/enum/description-template-type-status'; @Component({ @@ -76,6 +78,9 @@ export class DescriptionTemplateEditorComponent extends BaseEditor = new Map(); userFormControl = new FormControl(); + singleAutocompleteDescriptionTemplateTypeConfiguration: SingleAutoCompleteConfiguration; + + //Preview previewFieldSet: DescriptionTemplate = null; previewPropertiesFormGroup: UntypedFormGroup = null; @@ -137,6 +142,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor Date: Fri, 10 May 2024 11:49:36 +0300 Subject: [PATCH 2/2] Improving tenants doc page --- .../documentation/administration/tenants.md | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/docs/documentation/administration/tenants.md b/docs/docs/documentation/administration/tenants.md index c3946a690..231bedacd 100644 --- a/docs/docs/documentation/administration/tenants.md +++ b/docs/docs/documentation/administration/tenants.md @@ -39,4 +39,32 @@ There is a filtering option available for tenants. In order for the filters to apply, you have to click the `Apply filters` button. -You can also clear any filters already applied, by pressing the `clear all filters` option, located at the top of the popup. \ No newline at end of file +You can also clear any filters already applied, by pressing the `clear all filters` option, located at the top of the popup. + +--- + +## Edit form + +There are three options available for a tenant. + +- **Name**: The display name for the tenant. This name will appear on the UI. +- **Code**: The identifier for the tenant, used internally by the system. +- **Description**: A short description for the tenant.
*This is optional.* + +A tenant, once created can be configured on the [Tenant Configuration](/docs/documentation/administration/tenant-configuration) page. + +--- + +## Multitenancy + +There is always one tenant available on the platform and is called `Default`. It is the tenant assigned by default to all the entities (users, descriptions etc.), unless the tenant scope that is being selected is different. + +There are two ways a user can change the tenant scope. +- Select a tenant from the top toolbar, on the dropdown appearing next to the notifications icon. +- Select a tenant from the user profile page + +:::tip + +The options to change the tenant scope are only available when the logged in user belongs to one or more tenants. Otherwise, the user is attached only to the default tenant. Also, system administrators can select from all the available tenants. + +::: \ No newline at end of file