From 5616886cc6ea4f5e1cf1909f4cd55f6f3b6875a6 Mon Sep 17 00:00:00 2001 From: infacc Date: Tue, 11 Jul 2023 10:14:30 +0200 Subject: [PATCH] refactor: improve filter editor usability --- src/app/app.module.ts | 2 + .../plugin-filter-editor.component.html | 77 ++++++++++--------- .../plugin-filter-editor.component.ts | 2 + .../plugin-filter-node.component.html | 19 +++-- 4 files changed, 59 insertions(+), 41 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 7fb620a..269c5e8 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -20,6 +20,7 @@ import { FormsModule } from '@angular/forms'; import { MatBadgeModule } from '@angular/material/badge'; import { MatButtonModule } from '@angular/material/button'; import { MatButtonToggleModule } from '@angular/material/button-toggle'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import { MatCardModule } from '@angular/material/card'; import { MatCheckboxModule } from '@angular/material/checkbox'; import { MatChipsModule } from '@angular/material/chips'; @@ -140,6 +141,7 @@ import { PluginFilterEditorComponent } from './components-small/plugin-filter-ed MatCardModule, MatButtonModule, MatButtonToggleModule, + MatSlideToggleModule, MatCommonModule, MatTabsModule, MatRippleModule, diff --git a/src/app/components-small/plugin-filter-editor/plugin-filter-editor.component.html b/src/app/components-small/plugin-filter-editor/plugin-filter-editor.component.html index 5e8fb51..8a2653e 100644 --- a/src/app/components-small/plugin-filter-editor/plugin-filter-editor.component.html +++ b/src/app/components-small/plugin-filter-editor/plugin-filter-editor.component.html @@ -1,52 +1,57 @@

Filter Editor

- -
- Filter String Info - - Enter a filter string as JSON object. Filter strings have the following keys: -
-
name
Represents the name of a plugin.
-
tag
Allows filtering elements by their assigned tags.
-
version
Uses PEP 440 version specifier to filter elements based on specific versions or version ranges.
-
not
Specifies a filter string to exclude certain elements.
-
and
Includes multiple filter strings, with elements passing all conditions included in the filtered results (intersection).
-
or
Includes multiple filter strings, with elements meeting at least one condition included in the filtered results (union).
-
- -

Examples:

+ + Editor Mode {{ showEditor ? '(UI)' : '(JSON)' }} + + + - + + +
+ Filter String Info + + Enter a filter string as JSON object. Filter strings have the following keys: +
+
name
Represents the name of a plugin.
+
tag
Allows filtering elements by their assigned tags.
+
version
Uses PEP 440 version specifier to filter elements based on specific versions or version ranges.
+
not
Specifies a filter string to exclude certain elements.
+
and
Includes multiple filter strings, with elements passing all conditions included in the filtered results (intersection).
+
or
Includes multiple filter strings, with elements meeting at least one condition included in the filtered results (union).
+
+ +

Examples:

+ + - - - + + + - - - + + + - -
- - Filter String: - - - + + +
+
diff --git a/src/app/components-small/plugin-filter-editor/plugin-filter-editor.component.ts b/src/app/components-small/plugin-filter-editor/plugin-filter-editor.component.ts index 5ca2aac..73438cb 100644 --- a/src/app/components-small/plugin-filter-editor/plugin-filter-editor.component.ts +++ b/src/app/components-small/plugin-filter-editor/plugin-filter-editor.component.ts @@ -17,6 +17,8 @@ export class PluginFilterEditorComponent implements OnInit { filterObject: any = {}; + showEditor: boolean = true; + constructor(private registry: PluginRegistryBaseService) { } ngOnInit(): void { diff --git a/src/app/components-small/plugin-filter-node/plugin-filter-node.component.html b/src/app/components-small/plugin-filter-node/plugin-filter-node.component.html index f630a11..88dc7c5 100644 --- a/src/app/components-small/plugin-filter-node/plugin-filter-node.component.html +++ b/src/app/components-small/plugin-filter-node/plugin-filter-node.component.html @@ -2,7 +2,11 @@
+ + -
@@ -39,6 +47,7 @@ [depth]="depth + 1" (childChange)="updateChild($event)">
+

Not:

Filter Type: @@ -52,11 +61,11 @@ -
- Invert + Invert - Negate this filter \ No newline at end of file