]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Simplified silence-form matchers list 46863/head
authorbryanmontalvan <68972382+bryanmontalvan@users.noreply.github.com>
Mon, 27 Jun 2022 19:43:58 +0000 (15:43 -0400)
committerbryanmontalvan <68972382+bryanmontalvan@users.noreply.github.com>
Tue, 2 Aug 2022 15:40:06 +0000 (11:40 -0400)
This commit removes unmeaning icons on the matchers-list component, and
now only displays the information/content needed when viewing and editing
matchers.

Fixes: https://tracker.ceph.com/issues/42306
Signed-off-by: Bryan Montalvan <bmontalv@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.ts

index 02f04a06a4bcdd9ad8a497000862ad312b7ae9de..0cfbf08235095ee17b15a9e4bc95f52144682270 100644 (file)
@@ -5,8 +5,10 @@
     <ng-container *ngFor="let config of matcherConfig">
       <div class="input-group-prepend">
         <span class="input-group-text"
+              *ngIf="config.attribute === 'isRegex'"
               [ngbTooltip]="config.tooltip">
-          <i [ngClass]="[config.icon]"></i>
+          <i *ngIf="matcher[config.attribute]">~</i>
+          <i *ngIf="!matcher[config.attribute]">=</i>
         </span>
       </div>
 
                disabled
                readonly>
       </ng-container>
-
-      <ng-container *ngIf="config.attribute === 'isRegex'">
-        <div class="input-group-append">
-          <div class="input-group-text">
-            <input type="checkbox"
-                   id="matcher-{{config.attribute}}-{{index}}"
-                   [checked]="matcher[config.attribute]"
-                   disabled
-                   readonly>
-          </div>
-        </div>
-      </ng-container>
     </ng-container>
 
     <!-- Matcher actions -->
index 41898315019c9e8dafe960dc0e2ebb15a4f5f6b6..e82bd2d274a15036957616a77ae05bb3a79be1e4 100644 (file)
@@ -404,13 +404,7 @@ describe('SilenceFormComponent', () => {
     it('should show added matcher', () => {
       addMatcher('job', 'someJob', true);
       fixtureH.expectIdElementsVisible(
-        [
-          'matcher-name-0',
-          'matcher-value-0',
-          'matcher-isRegex-0',
-          'matcher-edit-0',
-          'matcher-delete-0'
-        ],
+        ['matcher-name-0', 'matcher-value-0', 'matcher-edit-0', 'matcher-delete-0'],
         true
       );
       expectMatch(null);
@@ -423,12 +417,10 @@ describe('SilenceFormComponent', () => {
         [
           'matcher-name-0',
           'matcher-value-0',
-          'matcher-isRegex-0',
           'matcher-edit-0',
           'matcher-delete-0',
           'matcher-name-1',
           'matcher-value-1',
-          'matcher-isRegex-1',
           'matcher-edit-1',
           'matcher-delete-1'
         ],
@@ -443,8 +435,6 @@ describe('SilenceFormComponent', () => {
       fixture.detectChanges();
       fixtureH.expectFormFieldToBe('#matcher-name-0', 'alertname');
       fixtureH.expectFormFieldToBe('#matcher-value-0', 'alert.*');
-      fixtureH.expectFormFieldToBe('#matcher-isRegex-0', 'true');
-      fixtureH.expectFormFieldToBe('#matcher-isRegex-1', 'false');
       expectMatch(null);
     });
 
@@ -467,7 +457,6 @@ describe('SilenceFormComponent', () => {
 
       fixtureH.expectFormFieldToBe('#matcher-name-0', 'alertname');
       fixtureH.expectFormFieldToBe('#matcher-value-0', 'alert0');
-      fixtureH.expectFormFieldToBe('#matcher-isRegex-0', 'false');
       expectMatch('Matches 1 rule with 1 active alert.');
     });
 
index b698e4958eddacbdfb10716da42ad8c2b2b47be3..d573a68e148587943f4f87385fd88093d1dca4d9 100644 (file)
@@ -50,18 +50,15 @@ export class SilenceFormComponent {
   matcherConfig = [
     {
       tooltip: $localize`Attribute name`,
-      icon: this.icons.paragraph,
       attribute: 'name'
     },
-    {
-      tooltip: $localize`Value`,
-      icon: this.icons.terminal,
-      attribute: 'value'
-    },
     {
       tooltip: $localize`Regular expression`,
-      icon: this.icons.magic,
       attribute: 'isRegex'
+    },
+    {
+      tooltip: $localize`Value`,
+      attribute: 'value'
     }
   ];