1 import { TitleCasePipe } from '@angular/common';
2 import { Component, OnInit } from '@angular/core';
3 import { RgwMultisiteService } from '~/app/shared/api/rgw-multisite.service';
4 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
5 import { CdTableColumn } from '~/app/shared/models/cd-table-column';
8 selector: 'cd-rgw-multisite-sync-policy',
9 templateUrl: './rgw-multisite-sync-policy.component.html',
10 styleUrls: ['./rgw-multisite-sync-policy.component.scss']
12 export class RgwMultisiteSyncPolicyComponent implements OnInit {
13 columns: Array<CdTableColumn> = [];
14 syncPolicyData: any = [];
17 private rgwMultisiteService: RgwMultisiteService,
18 private titleCasePipe: TitleCasePipe
24 name: $localize`Group Name`,
29 name: $localize`Status`,
32 cellTransformation: CellTemplate.tooltip,
33 customTemplateConfig: {
35 Enabled: { class: 'badge-success', tooltip: 'sync is allowed and enabled' },
36 Allowed: { class: 'badge-info', tooltip: 'sync is allowed' },
38 class: 'badge-warning',
40 'sync (as defined by this group) is not allowed and can override other groups'
44 pipe: this.titleCasePipe
47 name: $localize`Zonegroup`,
52 name: $localize`Bucket`,
58 this.rgwMultisiteService
59 .getSyncPolicy('', '', true)
60 .subscribe((allSyncPolicyData: Array<Object>) => {
61 if (allSyncPolicyData && allSyncPolicyData.length > 0) {
62 allSyncPolicyData.forEach((policy) => {
63 this.syncPolicyData.push({
64 groupName: policy['id'],
65 status: policy['status'],
66 bucket: policy['bucketName'],
70 this.syncPolicyData = [...this.syncPolicyData];