From 0e7437ff0fbf8419cafb9252d62e35323ae33de5 Mon Sep 17 00:00:00 2001 From: rusikv Date: Wed, 6 Mar 2024 13:17:27 +0200 Subject: [PATCH 1/3] UI: add 'not' option to relation queries, redesign of relation queries --- .../alias/entity-alias-dialog.component.html | 49 +++++----- .../alias/entity-alias-dialog.component.scss | 15 ++- .../entity/entity-filter.component.html | 98 ++++++++----------- .../entity/entity-filter.component.ts | 3 +- .../relation/relation-filters.component.html | 6 +- .../relation/relation-filters.component.scss | 4 + .../entity/entity-select.component.html | 4 +- .../entity/entity-type-select.component.html | 3 +- ui-ngx/src/app/shared/models/alias.models.ts | 1 - .../assets/locale/locale.constant-en_US.json | 4 +- ui-ngx/src/form.scss | 3 + 11 files changed, 88 insertions(+), 102 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.html b/ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.html index e13a0c9fa6..d6edb9b4cd 100644 --- a/ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.html @@ -28,34 +28,31 @@
-
-
-
- - alias.name - - - {{ 'alias.name-required' | translate }} - - - {{ 'alias.duplicate-alias' | translate }} - - -
- - - -
+
+
+ + alias.name + + + {{ 'alias.name-required' | translate }} + + + {{ 'alias.duplicate-alias' | translate }} + + +
+ + {{ 'alias.resolve-multiple' | translate }} +
- - -
+ + +
diff --git a/ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.scss b/ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.scss index 51a25742b7..969729c373 100644 --- a/ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.scss +++ b/ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.scss @@ -13,16 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@import '../../../../../scss/constants'; + :host { .tb-resolve-multiple-switch { - padding-left: 10px; - - .resolve-multiple-switch { - margin: 0; - } - - .resolve-multiple-label { - margin: 5px 0; + padding: 18px 0 0 18px; + @media #{$mat-xs} { + padding: 0 0 18px 0; } } -} \ No newline at end of file +} diff --git a/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html b/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html index fc05985697..75bdcb43c8 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html +++ b/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html @@ -130,70 +130,56 @@ -
- -
- +
+
+
alias.root-entity
+ + {{ 'alias.root-state-entity' | translate }} - -
-
- + + alias.state-entity-parameter-name + + + + +
+ -
-
- - alias.state-entity-parameter-name - - -
- - - +
+ + relation.direction + + + {{ directionTypeTranslations.get(directionTypeEnum[type]) | translate }} + + + + + alias.max-relation-level + +
+ + {{ 'alias.last-level-relation' | translate }} +
-
-
- - - -
+
+
relation.relation-filters
+ +
-
- - relation.direction - - - {{ directionTypeTranslations.get(directionTypeEnum[type]) | translate }} - - - - - alias.max-relation-level - - -
- - {{ 'relation.negate-all-relations' | translate }} - -
relation.relation-filters
- -
+
{{ 'relation.relation-type' | translate }}
{{ 'entity.entity-types' | translate }}
-
+ + {{ 'relation.not' | translate}} + -
+
{{ 'entity.type' | translate }} - + {{ displayEntityTypeFn(type) }} diff --git a/ui-ngx/src/app/shared/models/alias.models.ts b/ui-ngx/src/app/shared/models/alias.models.ts index 9fa0d8a244..084646d290 100644 --- a/ui-ngx/src/app/shared/models/alias.models.ts +++ b/ui-ngx/src/app/shared/models/alias.models.ts @@ -130,7 +130,6 @@ export interface RelationsQueryFilter { filters?: Array; maxLevel?: number; fetchLastLevelOnly?: boolean; - negate?: boolean; } export interface EntitySearchQueryFilter { diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 83795384d5..46a4303626 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -637,6 +637,7 @@ "filter-type-edge-search-query-description": "Edges with types {{edgeTypes}} that have {{relationType}} relation {{direction}} {{rootEntity}}", "entity-filter": "Entity filter", "resolve-multiple": "Resolve as multiple entities", + "resolve-multiple-hint": "Enable to render data from all filtered entities simultaneously. \nIf disabled, the widget shows data from the selected entity only.", "filter-type": "Filter type", "filter-type-required": "Filter type is required.", "entity-filter-no-entity-matched": "No entities matching specified filter were found.", @@ -3708,8 +3709,7 @@ "additional-info": "Additional info (JSON)", "invalid-additional-info": "Unable to parse additional info json.", "no-relations-text": "No relations found", - "negate-all-relations": "Negate all relations (NOT condition)", - "negate-relation": "Negate this relation (NOT condition)" + "not": "Not" }, "resource": { "add": "Add resource", diff --git a/ui-ngx/src/form.scss b/ui-ngx/src/form.scss index 524a4e86ac..86f986dd7a 100644 --- a/ui-ngx/src/form.scss +++ b/ui-ngx/src/form.scss @@ -499,6 +499,9 @@ &.no-padding-right { padding-right: 0; } + &.align-start { + align-items: start; + } @media #{$mat-gt-md} { gap: 12px; padding-left: 12px; From e32634f5017f51cc5cd68c14818f8b60b1790b32 Mon Sep 17 00:00:00 2001 From: rusikv Date: Wed, 6 Mar 2024 14:17:33 +0200 Subject: [PATCH 2/3] UI: make 'Not' option in relation queries optional --- .../home/components/entity/entity-filter.component.html | 1 + .../home/components/relation/relation-filters.component.html | 4 ++-- .../home/components/relation/relation-filters.component.ts | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html b/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html index 75bdcb43c8..61d22dcff4 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html +++ b/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html @@ -176,6 +176,7 @@
relation.relation-filters
diff --git a/ui-ngx/src/app/modules/home/components/relation/relation-filters.component.html b/ui-ngx/src/app/modules/home/components/relation/relation-filters.component.html index 9df199be1e..055b5df22e 100644 --- a/ui-ngx/src/app/modules/home/components/relation/relation-filters.component.html +++ b/ui-ngx/src/app/modules/home/components/relation/relation-filters.component.html @@ -18,7 +18,7 @@
-
+
{{ 'relation.relation-type' | translate }}
{{ 'entity.entity-types' | translate }}
@@ -26,7 +26,7 @@
- + {{ 'relation.not' | translate}} ; + @Input() + @coerceBoolean() + enableNotOption = false; + relationFiltersFormGroup: UntypedFormGroup; private destroy$ = new Subject(); From bf6c67bc6a4a3a80a45c7aeca870a34b01dac2fa Mon Sep 17 00:00:00 2001 From: rusikv Date: Wed, 6 Mar 2024 15:44:09 +0200 Subject: [PATCH 3/3] UI: fixed unused form control in relation filters --- .../relation/relation-filters.component.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/relation/relation-filters.component.ts b/ui-ngx/src/app/modules/home/components/relation/relation-filters.component.ts index 12d2fa8306..3d438f30ad 100644 --- a/ui-ngx/src/app/modules/home/components/relation/relation-filters.component.ts +++ b/ui-ngx/src/app/modules/home/components/relation/relation-filters.component.ts @@ -117,18 +117,20 @@ export class RelationFiltersComponent extends PageComponent implements ControlVa public addFilter() { const filter: RelationEntityTypeFilter = { relationType: null, - entityTypes: [], - negate: false + entityTypes: [] }; this.relationFiltersFormArray.push(this.createRelationFilterFormGroup(filter)); } private createRelationFilterFormGroup(filter: RelationEntityTypeFilter): AbstractControl { - return this.fb.group({ + const formGroup = this.fb.group({ relationType: [filter ? filter.relationType : null], - entityTypes: [filter ? filter.entityTypes : []], - negate: [filter ? filter.negate : false], + entityTypes: [filter ? filter.entityTypes : []] }); + if (this.enableNotOption) { + formGroup.addControl('negate', this.fb.control(filter ? filter.negate : false)); + } + return formGroup; } private updateModel() {