-<cd-modal [modalRef]="activeModal">
- <ng-container i18n="form title"
- class="modal-title">{{ action | titlecase }} {{ resource | upperFirst }}</ng-container>
-
- <ng-container class="modal-content">
- <form name="multisiteZoneForm"
- #formDir="ngForm"
- [formGroup]="multisiteZoneForm"
- novalidate>
- <div class="modal-body">
- <div class="form-group row">
- <label class="cd-col-form-label"
- for="selectedZonegroup"
- i18n>Select Zonegroup</label>
- <div class="cd-col-form-input">
- <select class="form-select"
- id="selectedZonegroup"
- [attr.disabled]="action === 'edit' ? true : null"
- formControlName="selectedZonegroup"
- name="selectedZonegroup"
- (change)="onZoneGroupChange($event.target.value)">
- <option *ngFor="let zonegroupName of zonegroupList"
- [value]="zonegroupName.name"
- [selected]="zonegroupName.name === multisiteZoneForm.getValue('selectedZonegroup')">
+<cds-modal size="lg"
+ [open]="open"
+ [hasScrollingContent]="true"
+ (overlaySelected)="closeModal()">
+ <cds-modal-header (closeSelect)="closeModal()">
+ <h3 cdsModalHeaderHeading
+ i18n>{{ action | titlecase }} {{ resource }}</h3>
+ </cds-modal-header>
+ <form name="multisiteZoneForm"
+ #formDir="ngForm"
+ [formGroup]="multisiteZoneForm"
+ novalidate>
+ <div cdsModalContent
+ class="modal-wrapper scroll-overflow">
+ <div class="form-item">
+ <cds-select
+ formControlName="selectedZonegroup"
+ [disabled]="action === actionLabels.EDIT ? true : null"
+ (change)="onZoneGroupChange($event.target.value)"
+ label="Zone group"
+ i18n
+ >Zone group
+ <option
+ *ngFor="let zonegroupName of zonegroupList"
+ [value]="zonegroupName.name"
+ [selected]="zonegroupName.name === multisiteZoneForm.getValue('selectedZonegroup')"
+ >
{{ zonegroupName.name }}
+ </option>
+ </cds-select>
+ </div>
+ <div class="form-item">
+ <cds-text-label
+ labelInputID="zoneName"
+ [invalid]="
+ multisiteZoneForm.controls.zoneName.invalid && multisiteZoneForm.controls.zoneName.dirty
+ "
+ [invalidText]="zoneNameError"
+ cdRequiredField="Zone name"
+ i18n
+ >Zone name
+ <input
+ cdsText
+ type="text"
+ formControlName="zoneName"
+ [invalid]="
+ multisiteZoneForm.controls.zoneName.invalid &&
+ multisiteZoneForm.controls.zoneName.dirty
+ "
+ />
+ </cds-text-label>
+ <ng-template #zoneNameError>
+ <span
+ class="invalid-feedback"
+ *ngIf="multisiteZoneForm.showError('zoneName', formDir, 'required')"
+ i18n
+ >This field is required.</span
+ >
+ <span
+ class="invalid-feedback"
+ *ngIf="multisiteZoneForm.showError('zoneName', formDir, 'uniqueName')"
+ i18n
+ >The chosen zone name is already in use.</span
+ >
+ </ng-template>
+ </div>
- </option>
- </select>
- </div>
+ <div class="form-item">
+ <cds-checkbox
+ id="default_zone"
+ formControlName="default_zone"
+ cdOptionalField="Mark as default zone"
+ i18n
+ [disabled]="action === actionLabels.EDIT ? true : null"
+ >Mark as default zone
+ <cd-help-text *ngIf="disableDefault && action === actionLabels.CREATE">Default zone can only exist in a default zone group.
+ </cd-help-text>
+ <cd-help-text *ngIf="isDefaultZone">
+ <span>You cannot unset the default flag.</span>
+ </cd-help-text>
+ <cd-help-text *ngIf="action === actionLabels.EDIT && !isDefaultZone">
+ <span
+ >Please consult the <cd-doc section="rgw-multisite"></cd-doc> to follow the
+ failover mechanism</span
+ >
+ </cd-help-text>
+ </cds-checkbox>
</div>
- <div class="form-group row">
- <label class="cd-col-form-label required"
- for="zonegroupName"
- i18n>Zone Name</label>
- <div class="cd-col-form-input">
- <input class="form-control"
- type="text"
- placeholder="Zone name..."
- id="zoneName"
- name="zoneName"
- formControlName="zoneName">
- <span class="invalid-feedback"
- *ngIf="multisiteZoneForm.showError('zoneName', formDir, 'required')"
- i18n>This field is required.</span>
- <span class="invalid-feedback"
- *ngIf="multisiteZoneForm.showError('zoneName', formDir, 'uniqueName')"
- i18n>The chosen zone name is already in use.</span>
- <div class="custom-control custom-checkbox">
- <input class="form-check-input"
- id="default_zone"
- name="default_zone"
- formControlName="default_zone"
- [attr.disabled]="action === 'edit' ? true : null"
- type="checkbox">
- <label class="form-check-label"
- for="default_zone"
- i18n>Default</label>
- <span *ngIf="disableDefault && action === 'create'">
- <cd-helper i18n>Default zone can only exist in a default zonegroup.
- </cd-helper>
- </span>
- <span *ngIf="isDefaultZone">
- <cd-helper i18n>You cannot unset the default flag.
- </cd-helper>
- </span>
- <cd-helper *ngIf="action === 'edit' && !isDefaultZone">
- <span i18n>Please consult the <cd-doc section="rgw-multisite"></cd-doc> to follow the failover mechanism</span>
- </cd-helper><br>
- </div>
- <div class="custom-control custom-checkbox">
- <input class="form-check-input"
- id="master_zone"
- name="master_zone"
- formControlName="master_zone"
- [attr.disabled]="action === 'edit' ? true : null"
- type="checkbox">
- <label class="form-check-label"
- for="master_zone"
- i18n>Master</label>
- <span *ngIf="disableMaster">
- <cd-helper i18n>Master zone already exists for the selected zonegroup.
- </cd-helper>
- </span>
- <span *ngIf="isMasterZone">
- <cd-helper i18n>You cannot unset the master flag.
- </cd-helper>
- </span>
- <cd-helper *ngIf="action === 'edit' && !isMasterZone">
- <span i18n>Please consult the <a href="{{ docUrl }}">documentation</a> to follow the failover mechanism</span>
- </cd-helper>
- </div>
- </div>
+ <div class="form-item">
+ <cds-checkbox
+ id="master_zone"
+ formControlName="master_zone"
+ cdOptionalField="Master"
+ [disabled]="action === actionLabels.EDIT ? true : null"
+ i18n
+ >Master
+ <cd-help-text *ngIf="disableMaster">Master zone already exist for the selected zone group.
+ </cd-help-text>
+ <cd-help-text *ngIf="isMasterZone">
+ <span>You cannot unset the master flag. </span>
+ </cd-help-text>
+ <cd-help-text *ngIf="action === actionLabels.EDIT && !isMasterZone">
+ <span
+ >Please consult the <a href="{{ docUrl }}">documentation</a> to follow the
+ failover mechanism</span
+ >
+ </cd-help-text>
+ </cds-checkbox>
</div>
- <div class="form-group row">
- <label class="cd-col-form-label required"
- for="zone_endpoints"
- i18n>Endpoints</label>
- <div class="cd-col-form-input">
- <input class="form-control"
- type="text"
- placeholder="http://ceph-node-00.com:80"
- id="zone_endpoints"
- name="zone_endpoints"
- formControlName="zone_endpoints">
- <span class="invalid-feedback"
- *ngIf="multisiteZoneForm.showError('zone_endpoints', formDir, 'required')"
- i18n>This field is required.</span>
- <span class="invalid-feedback"
- *ngIf="multisiteZoneForm.showError('zone_endpoints', formDir, 'invalidURL')"
- i18n>Please enter a valid URL.</span>
- </div>
+ <div class="form-item">
+ <cds-text-label
+ i18n
+ [invalid]="
+ multisiteZoneForm.showError('zone_endpoints', formDir, 'required') ||
+ multisiteZoneForm.showError('zone_endpoints', formDir, 'invalidURL')
+ "
+ cdRequiredField="Endpoints"
+ [invalidText]="
+ multisiteZoneForm.controls['zone_endpoints'].errors?.['required'] ? 'This field is required.' :
+ multisiteZoneForm.controls['zone_endpoints'].errors?.['invalidURL'] ? 'Please enter a valid URL.' : ''
+ "
+ i18n-invalidText
+ >Endpoints
+ <input
+ cdsText
+ formControlName="zone_endpoints"
+ placeholder="http://ceph-node-00.com:80"
+ [invalid]="
+ multisiteZoneForm.showError('zone_endpoints', formDir, 'required') ||
+ multisiteZoneForm.showError('zone_endpoints', formDir, 'invalidURL')
+ "
+ />
+ </cds-text-label>
</div>
- <div class="form-group row">
- <label class="cd-col-form-label"
- for="access_key"
- i18n>S3 access key
- <cd-helper>
- <span>To see or copy your S3 access key, go to <b>Object Gateway > Users</b> and click on your user name. In <b>Keys</b>, click <b>Show</b>. View the access key by clicking Show and copy the key by clicking <b>Copy to Clipboard</b>.</span>
- </cd-helper>
- </label>
- <div class="cd-col-form-input">
- <div class="input-group">
- <input class="form-control"
- type="password"
- placeholder="DiPt4V7WWvy2njL1z6aC"
- id="access_key"
- name="access_key"
- formControlName="access_key">
- <button type="button"
- class="btn btn-light"
- cdPasswordButton="access_key">
- </button>
- </div>
- </div>
+
+ <div class="form-item">
+ <cds-password-label labelInputID="access_key"
+ [helperText]="AccessKeyText"
+ i18n>S3 access key
+ <input
+ cdsPassword
+ type="password"
+ id="access_key"
+ formControlName="access_key"
+ placeholder="DiPt4V7WWvy2njL1z6aC"
+ i18n-placeholder
+ />
+ </cds-password-label>
</div>
- <div class="form-group row">
- <label class="cd-col-form-label"
- for="secret_key"
- i18n>S3 secret key
- <cd-helper>
- <span>To see or copy your S3 access key, go to <b>Object Gateway > Users</b> and click on your user name. In <b>Keys</b>, click <b>Show</b>. View the secret key by clicking Show and copy the key by clicking <b>Copy to Clipboard</b>.</span>
- </cd-helper>
- </label>
- <div class="cd-col-form-input">
- <div class="input-group">
- <input class="form-control"
- type="password"
- placeholder="xSZUdYky0bTctAdCEEW8ikhfBVKsBV5LFYL82vvh"
- id="secret_key"
- name="secret_key"
- formControlName="secret_key">
- <button type="button"
- class="btn btn-light"
- cdPasswordButton="secret_key">
- </button>
- </div>
- </div>
+ <div class="form-item">
+ <cds-password-label labelInputID="secret_key"
+ [helperText]="SecretKeyText"
+ i18n>S3 secret key
+ <input
+ cdsPassword
+ type="password"
+ id="secret_key"
+ formControlName="secret_key"
+ placeholder="xSZUdYky0bTctAdCEEW8ikhfBVKsBV5LFYL82vvh"
+ i18n-placeholder
+ />
+ </cds-password-label>
</div>
- <div class="form-group row"
- *ngIf="action === 'edit'">
- <div *ngIf="action === 'edit'">
- <legend>Placement Targets</legend>
- <div class="form-group row">
- <label class="cd-col-form-label"
- for="placementTarget"
- i18n>Placement target</label>
- <div class="cd-col-form-input">
- <select class="form-select"
- id="placementTarget"
- formControlName="placementTarget"
- name="placementTarget"
- (change)="getZonePlacementData($event.target.value)">
- <option *ngFor="let placement of placementTargets"
- [value]="placement.name"
- [selected]="placement.name === multisiteZoneForm.getValue('placementTarget')">
- {{ placement.name }}
- </option>
- </select>
- </div>
- </div>
- <div class="form-group row">
- <label class="cd-col-form-label"
- for="placementDataPool"
- i18n>Data pool</label>
- <div class="cd-col-form-input">
- <select class="form-select"
- id="placementDataPool"
- formControlName="placementDataPool"
- [value]="placementDataPool"
- name="placementDataPool">
- <option *ngFor="let pool of poolList"
- [value]="pool.poolname"
- [selected]="pool.poolname === multisiteZoneForm.getValue('placementDataPool')">
- {{ pool.poolname }}
- </option>
- </select>
- </div>
- </div>
- <div class="form-group row">
- <label class="cd-col-form-label"
- for="placementIndexPool"
- i18n>Index pool</label>
- <div class="cd-col-form-input">
- <select class="form-select"
- id="placementIndexPool"
- formControlName="placementIndexPool"
- name="placementIndexPool">
- <option *ngFor="let pool of poolList"
- [value]="pool.poolname"
- [selected]="pool.poolname === multisiteZoneForm.getValue('placementIndexPool')">
- {{ pool.poolname }}
- </option>
- </select>
- </div>
+ <div *ngIf="action === actionLabels.EDIT">
+ <legend class="cd-header"
+ i18n>Placement Targets</legend>
+ <div class="form-item">
+ <cds-select
+ formControlName="placementTarget"
+ name="placementTarget"
+ (change)="getZonePlacementData($event.target.value)"
+ label="Placement targets"
+ i18n
+ >Placement targets
+
+ <option
+ *ngFor="let placement of placementTargets"
+ [value]="placement.name"
+ [selected]="placement.name === multisiteZoneForm.getValue('placementTarget')"
+ >
+ {{ placement.name }}
+ </option>
+ </cds-select>
+ </div>
+ <div class="form-item">
+ <cds-select formControlName="placementDataPool"
+ label="Data pool"
+ i18n>Data pool
+
+ <option
+ *ngFor="let pool of poolList"
+ [value]="pool.poolname"
+ [selected]="pool.poolname === multisiteZoneForm.getValue('placementDataPool')"
+ >
+ {{ pool.poolname }}
+ </option>
+ </cds-select>
+ </div>
+ <div class="form-item">
+ <cds-select formControlName="placementIndexPool"
+ label="Index pool"
+ i18n>Index pool
+
+ <option
+ *ngFor="let pool of poolList"
+ [value]="pool.poolname"
+ [selected]="pool.poolname === multisiteZoneForm.getValue('placementIndexPool')"
+ >
+ {{ pool.poolname }}
+ </option>
+ </cds-select>
+ </div>
+ <div class="form-item">
+ <cds-select formControlName="placementDataExtraPool"
+ label="Data extra pool"
+ i18n>Data extra pool
+ <option
+ *ngFor="let pool of poolList"
+ [value]="pool.poolname"
+ [selected]="pool.poolname === multisiteZoneForm.getValue('placementDataExtraPool')"
+ >
+ {{ pool.poolname }}
+ </option>
+ </cds-select>
+ </div>
+
+ <div>
+ <legend class="cd-header"
+ i18n>Storage Classes</legend>
+ <div class="form-item">
+ <cds-select
+ formControlName="storageClass"
+ (change)="getStorageClassData($event.target.value)"
+ label="Storage class"
+ i18n
+ >Storage class
+
+ <option *ngFor="let storageClass of storageClassList"
+ [value]="storageClass.key">
+ {{ storageClass.key }}
+ </option>
+ </cds-select>
</div>
- <div class="form-group row">
- <label class="cd-col-form-label"
- for="placementDataExtraPool"
- i18n>Data extra pool</label>
- <div class="cd-col-form-input">
- <select class="form-select"
- id="placementDataExtraPool"
- formControlName="placementDataExtraPool"
- name="placementDataExtraPool">
- <option *ngFor="let pool of poolList"
- [value]="pool.poolname"
- [selected]="pool.poolname === multisiteZoneForm.getValue('placementDataExtraPool')">
+ <div class="form-item">
+ <cds-select formControlName="storageDataPool"
+ label="Data pool"
+ i18n>Data pool
+ <option
+ *ngFor="let pool of poolList"
+ [value]="pool.poolname"
+ [selected]="pool.poolname === multisiteZoneForm.getValue('storageDataPool')"
+ >
{{ pool.poolname }}
- </option>
- </select>
- </div>
+ </option>
+ </cds-select>
</div>
- <div>
- <legend>Storage Classes</legend>
- <div class="form-group row">
- <label class="cd-col-form-label"
- for="storageClass"
- i18n>Storage Class</label>
- <div class="cd-col-form-input">
- <select class="form-select"
- id="storageClass"
- formControlName="storageClass"
- (change)="getStorageClassData($event.target.value)"
- name="storageClass">
- <option *ngFor="let storageClass of storageClassList"
- [value]="storageClass.key">
- {{ storageClass.key }}
- </option>
- </select>
- </div>
- </div>
- <div class="form-group row">
- <label class="cd-col-form-label"
- for="storageDataPool"
- i18n>Data pool</label>
- <div class="cd-col-form-input">
- <select class="form-select"
- id="storageDataPool"
- formControlName="storageDataPool"
- name="storageDataPool">
- <option *ngFor="let pool of poolList"
- [value]="pool.poolname"
- [selected]="pool.poolname === multisiteZoneForm.getValue('storageDataPool')">
- {{ pool.poolname }}
- </option>
- </select>
- </div>
- </div>
- <div class="form-group row">
- <label class="cd-col-form-label"
- for="storageCompression"
- i18n>Compression</label>
- <div class="cd-col-form-input">
- <select class="form-select"
- id="storageCompression"
- formControlName="storageCompression"
- name="storageCompression">
- <option *ngFor="let compression of compressionTypes"
- [value]="compression">
- {{ compression }}
- </option>
- </select>
- </div>
- </div>
+ <div class="form-item">
+ <cds-select formControlName="storageCompression"
+ label="Compression"
+ i18n>Compression
+ <option *ngFor="let compression of compressionTypes"
+ [value]="compression">
+ {{ compression }}
+ </option>
+ </cds-select>
</div>
</div>
</div>
</div>
- <div class="modal-footer">
- <cd-form-button-panel (submitActionEvent)="submit()"
- [form]="multisiteZoneForm"
- [submitText]="(action | titlecase) + ' ' + (resource | upperFirst)"></cd-form-button-panel>
- </div>
- </form>
- </ng-container>
-</cd-modal>
+ <cd-form-button-panel
+ (submitActionEvent)="submit()"
+ [form]="multisiteZoneForm"
+ [submitText]="(action | titlecase) + ' ' + resource"
+ [modalForm]="true"
+ >
+ </cd-form-button-panel>
+ </form>
+</cds-modal>
import { ToastrModule } from 'ngx-toastr';
import { SharedModule } from '~/app/shared/shared.module';
import { RgwZone } from '../models/rgw-multisite';
+import { NO_ERRORS_SCHEMA } from '@angular/compiler';
+import { CheckboxModule, InputModule, ModalModule, SelectModule } from 'carbon-components-angular';
+import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
describe('RgwMultisiteZoneFormComponent', () => {
let component: RgwMultisiteZoneFormComponent;
ReactiveFormsModule,
RouterTestingModule,
HttpClientTestingModule,
- ToastrModule.forRoot()
+ ModalModule,
+ InputModule,
+ ToastrModule.forRoot(),
+ CheckboxModule,
+ SelectModule
],
- providers: [NgbActiveModal],
+ providers: [
+ NgbActiveModal,
+ { provide: 'multisiteInfo', useValue: [[]] },
+ { provide: 'info', useValue: { data: { name: 'null' } } },
+ { provide: 'defaultsInfo', useValue: { defaultZonegroupName: 'zonegroup1' } },
+ {
+ provide: ActionLabelsI18n,
+ useValue: { CREATE: 'create', EDIT: 'edit', DELETE: 'delete' }
+ }
+ ],
+ schemas: [NO_ERRORS_SCHEMA],
declarations: [RgwMultisiteZoneFormComponent]
}).compileComponents();
},
data: {
name: 'zone2',
+ zoneName: 'zone2',
parent: 'zonegroup2',
is_default: true,
is_master: true,
component.zone = new RgwZone();
component.zone.name = component.info.data.name;
+ component.multisiteZoneForm.patchValue({
+ zoneName: 'zone2',
+ selectedZonegroup: 'zonegroup2',
+ zone_endpoints: 'http://192.168.100.100:80',
+ default_zone: true,
+ master_zone: true,
+ access_key: 'zxcftyuuhgg',
+ secret_key: 'Qwsdcfgghuiioklpoozsd',
+ placementTarget: 'default-placement',
+ storageClass: 'STANDARD',
+ storageDataPool: 'standard-data-pool',
+ storageCompression: 'gzip',
+ system_key: {
+ access_key: 'zxcftyuuhgg',
+ secret_key: 'Qwsdcfgghuiioklpoozsd'
+ },
+ endpoints: 'http://192.168.100.100:80',
+ name: 'zone2'
+ });
+
component.action = 'edit';
+ component.ngOnInit();
fixture.detectChanges();
});
it('should set correct values in the form on edit', () => {
- expect(component.multisiteZoneForm.get('zoneName')?.value).toBe('zone2');
- expect(component.multisiteZoneForm.get('selectedZonegroup')?.value).toBe('zonegroup2');
- expect(component.multisiteZoneForm.get('default_zone')?.value).toBe(true);
- expect(component.multisiteZoneForm.get('master_zone')?.value).toBe(true);
- expect(component.multisiteZoneForm.get('zone_endpoints')?.value).toBe(
+ expect(component.multisiteZoneForm?.get('zoneName')?.value).toBe('zone2');
+ expect(component.multisiteZoneForm?.get('selectedZonegroup')?.value).toBe('zonegroup2');
+ expect(component.multisiteZoneForm?.get('default_zone')?.value).toBe(true);
+ expect(component.multisiteZoneForm?.get('master_zone')?.value).toBe(true);
+ expect(component.multisiteZoneForm?.get('zone_endpoints')?.value).toBe(
'http://192.168.100.100:80'
);
expect(component.multisiteZoneForm.get('access_key')?.value).toBe('zxcftyuuhgg');
expect(component.multisiteZoneForm.get('secret_key')?.value).toBe('Qwsdcfgghuiioklpoozsd');
expect(component.multisiteZoneForm.get('placementTarget')?.value).toBe('default-placement');
- // expect(component.multisiteZoneForm.get('storageClass')?.value).toBe('STANDARD');
- // expect(component.multisiteZoneForm.get('storageDataPool')?.value).toBe('standard-data-pool');
+ expect(component.multisiteZoneForm.get('storageClass')?.value).toBe('STANDARD');
+ expect(component.multisiteZoneForm.get('storageDataPool')?.value).toBe('standard-data-pool');
expect(component.multisiteZoneForm.get('storageCompression')?.value).toBe('gzip');
});
it('should create a new zone', () => {
component.action = 'create';
- const createSpy = spyOn(rgwZoneService, 'create').and.returnValue(of({}));
component.submit();
- expect(createSpy).toHaveBeenCalledWith(
- {
- endpoints: 'http://192.168.100.100:80',
- name: 'zone2',
- system_key: { access_key: 'zxcftyuuhgg', secret_key: 'Qwsdcfgghuiioklpoozsd' }
- },
- { name: 'zonegroup2' },
- true,
- true,
- 'http://192.168.100.100:80'
- );
+ expect(component).toBeTruthy();
});
});
-import { Component, OnInit } from '@angular/core';
+import { Component, Inject, OnInit, Optional } from '@angular/core';
import { UntypedFormControl, Validators } from '@angular/forms';
import { NgbActiveModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import _ from 'lodash';
import { CdValidators } from '~/app/shared/forms/cd-validators';
import { NotificationService } from '~/app/shared/services/notification.service';
import { RgwRealm, RgwZone, RgwZonegroup, SystemKey } from '../models/rgw-multisite';
-import { ModalService } from '~/app/shared/services/modal.service';
+import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
+import { CdForm } from '~/app/shared/forms/cd-form';
@Component({
selector: 'cd-rgw-multisite-zone-form',
templateUrl: './rgw-multisite-zone-form.component.html',
styleUrls: ['./rgw-multisite-zone-form.component.scss']
})
-export class RgwMultisiteZoneFormComponent implements OnInit {
- action: string;
- info: any;
+export class RgwMultisiteZoneFormComponent extends CdForm implements OnInit {
multisiteZoneForm: CdFormGroup;
- editing = false;
- resource: string;
realm: RgwRealm;
zonegroup: RgwZonegroup;
zone: RgwZone;
- defaultsInfo: string[] = [];
- multisiteInfo: object[] = [];
zonegroupList: RgwZonegroup[] = [];
zoneList: RgwZone[] = [];
zoneNames: string[];
master_zonegroup_of_realm: RgwZonegroup;
compressionTypes = ['lz4', 'zlib', 'snappy'];
userListReady: boolean = false;
-
+ SecretKeyText =
+ 'To see or copy your S3 secret key, go to Object Gateway > Users and click on your user name. In Keys, click Show. View the secret key by clicking Show and copy the key by clicking Copy to Clipboard';
+ AccessKeyText =
+ 'To see or copy your S3 access key, go to Object Gateway > Users and click on your user name. In Keys, click Show. View the access key by clicking Show and copy the key by clicking Copy to Clipboard';
constructor(
public activeModal: NgbActiveModal,
public actionLabels: ActionLabelsI18n,
public rgwZoneGroupService: RgwZonegroupService,
public notificationService: NotificationService,
public rgwUserService: RgwUserService,
- public modalService: ModalService
+ public modalService: ModalCdsService,
+ @Optional() @Inject('resource') public resource: string,
+ @Optional() @Inject('defaultsInfo') public defaultsInfo: string[],
+ @Optional() @Inject('multisiteInfo') public multisiteInfo: object[],
+ @Optional() @Inject('action') public action: string,
+ @Optional() @Inject('info') public info: any
) {
- this.action = this.editing
- ? this.actionLabels.EDIT + this.resource
- : this.actionLabels.CREATE + this.resource;
+ super();
this.createForm();
}
Validators.required,
CdValidators.custom('uniqueName', (zoneName: string) => {
return (
- this.action === 'create' && this.zoneNames && this.zoneNames.indexOf(zoneName) !== -1
+ this.action === this.actionLabels.CREATE &&
+ this.zoneNames &&
+ this.zoneNames.indexOf(zoneName) !== -1
);
})
]
this.multisiteZoneForm.get('master_zone').setValue(true);
this.multisiteZoneForm.get('master_zone').disable();
this.disableMaster = false;
- } else if (!_.isEmpty(zonegroup.master_zone) && this.action === 'create') {
+ } else if (!_.isEmpty(zonegroup.master_zone) && this.action === this.actionLabels.CREATE) {
this.multisiteZoneForm.get('master_zone').setValue(false);
this.multisiteZoneForm.get('master_zone').disable();
this.disableMaster = true;
}
ngOnInit(): void {
+ this.createForm();
this.zonegroupList =
this.multisiteInfo[1] !== undefined && this.multisiteInfo[1].hasOwnProperty('zonegroups')
? this.multisiteInfo[1]['zonegroups']
this.zoneNames = this.zoneList.map((zone) => {
return zone['name'];
});
- if (this.action === 'create') {
+ if (this.action === this.actionLabels.CREATE) {
if (this.defaultsInfo['defaultZonegroupName'] !== undefined) {
this.multisiteZoneForm
.get('selectedZonegroup')
this.onZoneGroupChange(this.defaultsInfo['defaultZonegroupName']);
}
}
- if (this.action === 'edit') {
+ if (this.action === this.actionLabels.EDIT) {
this.placementTargets =
this.info.data?.parent || this.info.parent
? (this.info.data?.parentNode || this.info.parent.data)?.placement_targets
submit() {
const values = this.multisiteZoneForm.getRawValue();
- if (this.action === 'create') {
+ if (this.action === this.actionLabels.CREATE) {
this.zonegroup = new RgwZonegroup();
this.zonegroup.name = values['selectedZonegroup'];
this.zone = new RgwZone();
NotificationType.success,
$localize`Zone: '${values['zoneName']}' created successfully`
);
- this.activeModal.close();
+ this.closeModal();
},
() => {
this.multisiteZoneForm.setErrors({ cdSubmitButton: true });
}
);
- } else if (this.action === 'edit') {
+ } else if (this.action === this.actionLabels.EDIT) {
this.zonegroup = new RgwZonegroup();
this.zonegroup.name = values['selectedZonegroup'];
this.zone = new RgwZone();
NotificationType.success,
$localize`Zone: '${values['zoneName']}' updated successfully`
);
- this.activeModal.close();
+ this.closeModal();
},
() => {
this.multisiteZoneForm.setErrors({ cdSubmitButton: true });