Skip to content

Commit d23984e

Browse files
fix(rule-management): removing view rule button, and added that functionality on click a rule
1 parent 17bcc30 commit d23984e

3 files changed

Lines changed: 15 additions & 10 deletions

File tree

frontend/src/app/rule-management/app-rule/components/rule-list/rule-list.component.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<ng-container *ngIf="rules$ | async as rules; else empty">
3232
<tr *ngFor="let rule of rules; trackBy: trackByFn" class="cursor-pointer">
3333
<ng-container *ngFor="let field of fields">
34-
<td [ngStyle]="{'width': field.width}" *ngIf="(field.visible)">
34+
<td [ngStyle]="{'width': field.width}" *ngIf="(field.visible)" (click)="visualizeRule(rule)">
3535
<app-rule-field
3636
[rule] = "rule"
3737
[column] = "field">
@@ -41,19 +41,20 @@
4141
<td class="td-action">
4242
<div class="d-flex justify-content-end align-items-center medium-icon">
4343

44-
<i (click)="visualizeRule(rule)"
45-
class="icon-eye cursor-pointer ml-2"
46-
ngbTooltip="View Rule"
47-
container="body"
48-
placement="left"></i>
4944

5045
<i (click)="activeRule(rule)"
5146
class="cursor-pointer ml-2"
5247
[ngClass]="{'icon-blocked': rule.ruleActive, 'icon-check2': !rule.ruleActive}"
5348
ngbTooltip="{{ !rule.ruleActive ? 'Active' : 'Deactivate' }}"
5449
container="body"
50+
*ngIf="!loadingRules.includes(rule.id);else spinner"
5551
placement="left"></i>
5652

53+
54+
<ng-template #spinner >
55+
<i class="icon-spinner2 spinner"></i>
56+
</ng-template>
57+
5758
<i *ngIf="!rule.systemOwner"
5859
(click)="editRule(rule)" class="icon-pencil3 cursor-pointer ml-2"
5960
ngbTooltip="Edit"

frontend/src/app/rule-management/app-rule/components/rule-list/rule-list.component.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {ActivatedRoute, Router} from '@angular/router';
44
import {NgbModal, NgbModalRef} from '@ng-bootstrap/ng-bootstrap';
55
import {NgxSpinnerService} from 'ngx-spinner';
66
import {merge, Observable, of, Subject} from 'rxjs';
7-
import {catchError, filter, map, switchMap, takeUntil, tap} from 'rxjs/operators';
7+
import {catchError, filter, map, switchMap, takeUntil, tap, finalize} from 'rxjs/operators';
88
import { SortEvent } from 'src/app/shared/directives/sortable/type/sort-event';
99
import {UtmToastService} from '../../../../shared/alert/utm-toast.service';
1010
import {
@@ -50,6 +50,7 @@ export class RuleListComponent implements OnInit, OnDestroy {
5050
isInitialized = false;
5151
request = RULE_REQUEST;
5252
destroy$: Subject<void> = new Subject<void>();
53+
loadingRules=[]
5354

5455
constructor(private route: ActivatedRoute,
5556
private filterService: FilterService,
@@ -153,8 +154,11 @@ export class RuleListComponent implements OnInit, OnDestroy {
153154
id: rule.id,
154155
active: !rule.ruleActive
155156
};
156-
157-
this.ruleService.activeRule(params)
157+
this.loadingRules.push(rule.id)
158+
const index = this.loadingRules.length-1
159+
this.ruleService.activeRule(params).pipe(
160+
finalize(()=>this.loadingRules.splice(index,1))
161+
)
158162
.subscribe(() => this.ruleService.notifyRefresh(true),
159163
() => {
160164
this.utmToast.showError('Error', 'Error changing rule status');

frontend/src/app/rule-management/share/generic-filter/generic-filter.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
[infiniteScrollDistance]="1"
1919
[infiniteScrollThrottle]="80"
2020
[scrollWindow]="false"
21-
class="filter-value-field-container h-100 m-h-0 overflow-auto"
21+
class="filter-value-field-container h-100 m-h-0 overflow-scroll"
2222
infiniteScroll>
2323
<app-filter [list]="items">
2424
<ng-template appTemplateSelector let-item let-i>

0 commit comments

Comments
 (0)