describe('fields check', () => {
it('should check that title & table appears', () => {
// Check that title (CRUSH map viewer) appears
- crushmap.getPageTitle().should('equal', 'CRUSH map viewer');
+ crushmap.getPageTitle().should('contain.text', 'CRUSH map viewer');
// Check that title appears once OSD is clicked
crushmap.getCrushNode(0).click();
pages = { index: { url: '#/crush-map', id: 'cd-crushmap' } };
getPageTitle() {
- return cy.get('cd-crushmap .card-header').text();
+ return cy.get('cd-crushmap .card-header');
}
getCrushNode(idx: number) {
});
describe('should have all host details', () => {
- it('should have hostname'),
+ (it('should have hostname'),
() => {
cy.get('[data-testid="hostname"]').should('not.be.empty');
- };
- it('should have IP address'),
+ });
+ (it('should have IP address'),
() => {
cy.get('[data-testid="ip-address"]').should('not.be.empty');
- };
+ });
});
// rgw is needed for testing the force maintenance
@PageHelper.restrictTo(pages.topology.url)
topologyViewerExist() {
cy.get(pages.topology.id).should('be.visible');
- cy.get('[data-testid=rgw-multisite-details-header]').should('have.text', 'Topology Viewer');
+ cy.get('[data-testid=rgw-multisite-details-header]').should('contain.text', 'Topology Viewer');
}
@PageHelper.restrictTo(pages.wizard.url)
replicationWizardExist() {
cy.get('cds-modal').then(() => {
cy.get('[data-testid=rgw-multisite-wizard-header]').should(
- 'have.text',
+ 'contain.text',
'Set up Multi-site Replication'
);
});
cy.get('#tenant').type(tenant).should('have.class', 'ng-invalid');
cy.get('cds-text-label[for=tenant]')
.find('.invalid-feedback')
- .should('have.text', 'The chosen user ID exists in this tenant.');
+ .should('contain.text', 'The chosen user ID exists in this tenant.');
// check that username field is marked invalid if username has been cleared off
cy.get('#user_id').clear().blur().should('have.class', 'ng-invalid');
cy.get('cds-text-label[for=user_id]')
.find('.invalid-feedback')
- .should('have.text', 'This field is required.');
+ .should('contain.text', 'This field is required.');
// Full name
cy.get('#display_name')
.should('have.class', 'ng-invalid');
cy.get('cds-text-label[for=display_name]')
.find('.invalid-feedback')
- .should('have.text', 'This field is required.');
+ .should('contain.text', 'This field is required.');
// put invalid email to make field invalid
cy.get('#email').type('a').blur().should('have.class', 'ng-invalid');
cy.get('cds-text-label[for=email]')
.find('.invalid-feedback')
- .should('have.text', 'This is not a valid email address.');
+ .should('contain.text', 'This is not a valid email address.');
// put negative max buckets to make field invalid
this.expectSelectOption('max_buckets_mode', 'Custom');
cy.get('#max_buckets').should('have.class', 'ng-invalid');
cy.get('cds-number[for=max_buckets]')
.find('.invalid-feedback')
- .should('have.text', 'The entered value must be >= 1.');
+ .should('contain.text', 'The entered value must be >= 1.');
this.navigateTo();
this.delete(tenant + '$' + uname, null, null, true, false, false, true);
cy.get('cds-text-label[for=email]')
.find('.invalid-feedback')
- .should('have.text', 'This is not a valid email address.');
+ .should('contain.text', 'This is not a valid email address.');
// empty the display name field making it invalid
cy.get('#display_name').clear({ force: true }).blur().should('have.class', 'ng-invalid');
cy.get('cds-text-label[for=display_name]')
.find('.invalid-feedback')
- .should('have.text', 'This field is required.');
+ .should('contain.text', 'This field is required.');
// put negative max buckets to make field invalid
this.selectOption('max_buckets_mode', 'Disabled');
cy.get('#max_buckets').should('have.class', 'ng-invalid');
cy.get('cds-number[for=max_buckets]')
.find('.invalid-feedback')
- .should('have.text', 'The entered value must be >= 1.');
+ .should('contain.text', 'The entered value must be >= 1.');
this.navigateTo();
this.delete(tenant + '$' + uname, null, null, true, false, false, true);
cy.get(`select[id=${selection_name}]`).should('exist');
cy.get(`select[id=${selection_name}]`).select(account_id);
cy.get(`select[id=${selection_name}] option:checked`).should(
- 'have.text',
+ 'contain.text',
`${account_name} - ${tenant}`
);
cy.contains('button', 'Edit User').click();
this.getTableRow(tenant + '$' + user_id).as('AccountUser');
- cy.get('@AccountUser').find('td').eq(3).should('have.text', `${account_name}`);
+ cy.get('@AccountUser').find('td').eq(3).should('contain.text', `${account_name}`);
// check table details if we have all the details there
this.getExpandCollapseElement(username).should('be.visible').click();
.eq(0)
.within(() => {
cy.wait(500);
- cy.get('td').eq(0).should('have.text', 'Account ID');
- cy.get('td').eq(1).should('have.text', account_id);
+ cy.get('td').eq(0).should('contain.text', 'Account ID');
+ cy.get('td').eq(1).should('contain.text', account_id);
});
cy.get('tr')
.eq(1)
.within(() => {
cy.wait(500);
- cy.get('td').eq(0).should('have.text', 'Name');
- cy.get('td').eq(1).should('have.text', account_name);
+ cy.get('td').eq(0).should('contain.text', 'Name');
+ cy.get('td').eq(1).should('contain.text', account_name);
});
cy.get('tr')
.eq(2)
.within(() => {
cy.wait(500);
- cy.get('td').eq(0).should('have.text', 'Tenant');
- cy.get('td').eq(1).should('have.text', tenant);
+ cy.get('td').eq(0).should('contain.text', 'Tenant');
+ cy.get('td').eq(1).should('contain.text', tenant);
});
cy.get('tr')
.eq(3)
.within(() => {
cy.wait(500);
- cy.get('td').eq(0).should('have.text', 'User type');
- cy.get('td').eq(1).should('have.text', 'rgw user');
+ cy.get('td').eq(0).should('contain.text', 'User type');
+ cy.get('td').eq(1).should('contain.text', 'rgw user');
});
});
}
this.navigateEdit(username);
cy.get(`select[id=${selection_name}]`).should('exist').should('be.disabled');
cy.get(`select[id=${selection_name}] option:checked`).should(
- 'have.text',
+ 'contain.text',
`${account_name} - ${tenant}`
);
cy.get('input#account_root_user_input').check({ force: true });
.eq(3)
.within(() => {
cy.wait(500);
- cy.get('td').eq(0).should('have.text', 'User type');
- cy.get('td').eq(1).should('have.text', 'Account root user');
+ cy.get('td').eq(0).should('contain.text', 'User type');
+ cy.get('td').eq(1).should('contain.text', 'Account root user');
});
});
}
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
- ...tseslint.configs.recommendedTypeChecked,
...angular.configs.tsRecommended
],
processor: angular.processInlineTemplates,
createDefaultProgram: true
}
},
+ linterOptions: {
+ reportUnusedDisableDirectives: false
+ }
+ },
+ {
+ files: ['**/*.ts'],
rules: {
- 'no-multiple-empty-lines': [
- 'error',
- {
- max: 2,
- maxEOF: 1
- }
- ],
- 'spaced-comment': [
- 'error',
- 'always',
- {
- exceptions: ['-', '+', '*']
- }
- ],
- curly: ['error', 'multi-line'],
+ 'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1 }],
+ 'spaced-comment': ['error', 'always', { exceptions: ['-', '+', '*'] }],
+ 'curly': ['error', 'multi-line'],
'guard-for-in': 'error',
'no-restricted-imports': [
'error',
{
- paths: [
- 'rxjs/Rx',
- {
- name: '@angular/core/testing',
- importNames: ['async']
- }
- ],
+ paths: ['rxjs/Rx', { name: '@angular/core/testing', importNames: ['async'] }],
patterns: ['(\\.{1,2}/){2,}']
}
],
- 'no-console': [
- 'error',
- {
- allow: ['debug', 'info', 'time', 'timeEnd', 'trace']
- }
- ],
+ 'no-console': ['error', { allow: ['debug', 'info', 'time', 'timeEnd', 'trace'] }],
'no-trailing-spaces': 'error',
'no-caller': 'error',
'no-bitwise': 'error',
'no-duplicate-imports': 'error',
'no-eval': 'error',
- '@angular-eslint/directive-selector': [
- 'error',
- {
- type: 'attribute',
- prefix: 'cd',
- style: 'camelCase'
- }
- ],
- '@angular-eslint/component-selector': [
- 'error',
- {
- type: 'element',
- prefix: 'cd',
- style: 'kebab-case'
- }
- ]
+ '@angular-eslint/directive-selector': ['error', { type: 'attribute', prefix: 'cd', style: 'camelCase' }],
+ '@angular-eslint/component-selector': ['error', { type: 'element', prefix: 'cd', style: 'kebab-case' }],
+
+ // @TODO: revisit and remove them by fixing the respective errors in ts files
+ '@angular-eslint/prefer-standalone': 'off',
+ '@typescript-eslint/no-explicit-any': 'off',
+ '@typescript-eslint/no-unused-vars': 'off',
+ '@typescript-eslint/no-unsafe-function-type': 'off',
+ '@typescript-eslint/no-this-alias': 'off',
+ '@typescript-eslint/no-wrapper-object-types': 'off',
+ '@typescript-eslint/no-unused-expressions': 'off',
+ '@typescript-eslint/no-empty-object-type': 'off',
+ '@typescript-eslint/no-require-imports': 'off',
+ '@typescript-eslint/no-array-constructor': 'off',
+ '@typescript-eslint/no-duplicate-enum-values': 'off',
+ '@typescript-eslint/ban-ts-comment': 'off',
+ '@typescript-eslint/unbound-method': 'off',
+ 'no-useless-escape': 'off',
+ 'no-empty': 'off',
+ 'prefer-const': 'off',
+ 'no-prototype-builtins': 'off',
+ 'no-case-declarations': 'off',
+ 'no-extra-boolean-cast': 'off',
+ 'prefer-spread': 'off',
+ 'prefer-rest-params': 'off',
+ 'no-constant-binary-expression': 'off',
+ 'no-sparse-arrays': 'off',
+ 'no-var': 'off'
}
},
{
'@angular-eslint/template/interactive-supports-focus': 'error',
'@angular-eslint/template/click-events-have-key-events': 'error',
'@angular-eslint/template/label-has-associated-control': 'error',
- '@angular-eslint/template/elements-content': 'error'
+ '@angular-eslint/template/elements-content': 'error',
}
}
);
type="button"
class="btn btn-light"
cdPasswordButton="password"
+ aria-label="Toggle visibility"
+ i18n-aria-label
></button>
<cd-copy-2-clipboard-button source="password"> </cd-copy-2-clipboard-button>
</div>
type="button"
class="btn btn-light"
cdPasswordButton="mutual_password"
+ aria-label="Toggle visibility"
+ i18n-aria-label
></button>
<cd-copy-2-clipboard-button source="mutual_password"> </cd-copy-2-clipboard-button>
</div>
type="button"
class="btn btn-light"
cdPasswordButton="target_password"
+ aria-label="Toggle visibility"
+ i18n-aria-label
></button>
<cd-copy-2-clipboard-button source="target_password"> </cd-copy-2-clipboard-button>
</div>
type="button"
class="btn btn-light"
cdPasswordButton="target_mutual_password"
+ aria-label="Toggle visibility"
+ i18n-aria-label
></button>
<cd-copy-2-clipboard-button source="target_mutual_password">
</cd-copy-2-clipboard-button>
type="button"
class="btn-close float-end"
(click)="removeInitiator(ii)"
+ aria-label="Remove initiator"
+ i18n-aria-label
></button>
</div>
<div class="card-body">
type="button"
class="btn btn-light"
[cdPasswordButton]="'password' + ii"
+ aria-label="Toggle visibility"
+ i18n-aria-label
></button>
<cd-copy-2-clipboard-button [source]="'password' + ii">
</cd-copy-2-clipboard-button>
type="button"
class="btn btn-light"
[cdPasswordButton]="'mutual_password' + ii"
+ aria-label="Toggle visibility"
+ i18n-aria-label
></button>
<cd-copy-2-clipboard-button [source]="'mutual_password' + ii">
</cd-copy-2-clipboard-button>
type="button"
class="btn-close float-end"
(click)="removeGroup(gi)"
+ aria-label="Remove group"
+ i18n-aria-label
></button>
</div>
<div class="card-body">
})
export class BootstrapCreateModalComponent
extends BaseModal
- implements OnDestroy, OnInit, AfterViewInit {
+ implements OnDestroy, OnInit, AfterViewInit
+{
pools: any[] = [];
token: string;
let component: NvmeGatewayViewComponent;
let fixture: ComponentFixture<NvmeGatewayViewComponent>;
- beforeEach(
- waitForAsync(() => {
- TestBed.configureTestingModule({
- declarations: [NvmeGatewayViewComponent],
- imports: [RouterTestingModule, SideNavModule, ThemeModule],
- schemas: [CUSTOM_ELEMENTS_SCHEMA]
- }).compileComponents();
- })
- );
+ beforeEach(waitForAsync(() => {
+ TestBed.configureTestingModule({
+ declarations: [NvmeGatewayViewComponent],
+ imports: [RouterTestingModule, SideNavModule, ThemeModule],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
+ }).compileComponents();
+ }));
beforeEach(() => {
fixture = TestBed.createComponent(NvmeGatewayViewComponent);
queryParams: of(mockQueryParams)
};
- beforeEach(
- waitForAsync(() => {
- TestBed.configureTestingModule({
- declarations: [NvmeSubsystemViewComponent],
- imports: [RouterTestingModule, HttpClientTestingModule],
- providers: [{ provide: ActivatedRoute, useValue: mockActivatedRoute }],
- schemas: [CUSTOM_ELEMENTS_SCHEMA]
- }).compileComponents();
- })
- );
+ beforeEach(waitForAsync(() => {
+ TestBed.configureTestingModule({
+ declarations: [NvmeSubsystemViewComponent],
+ imports: [RouterTestingModule, HttpClientTestingModule],
+ providers: [{ provide: ActivatedRoute, useValue: mockActivatedRoute }],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
+ }).compileComponents();
+ }));
beforeEach(() => {
fixture = TestBed.createComponent(NvmeSubsystemViewComponent);
describe('NvmeofEditAuthenticationComponent', () => {
let component: NvmeofEditAuthenticationComponent;
let fixture: ComponentFixture<NvmeofEditAuthenticationComponent>;
- let nvmeofService: jest.Mocked<Pick<
- NvmeofService,
- 'getInitiators' | 'getSubsystem' | 'updateAuthenticationKey'
- >>;
+ let nvmeofService: jest.Mocked<
+ Pick<NvmeofService, 'getInitiators' | 'getSubsystem' | 'updateAuthenticationKey'>
+ >;
let notificationService: { show: jest.Mock };
let modalService: { dismissAll: jest.Mock };
];
const mockHostsWithKey = [{ nqn: 'nqn.2014-08.org.nvmexpress:uuid:host-1', use_dhchap: true }];
- beforeEach(
- waitForAsync(() => {
- nvmeofService = {
- getInitiators: jest.fn().mockReturnValue(of([])),
- getSubsystem: jest.fn().mockReturnValue(of({ has_dhchap_key: false })),
- updateAuthenticationKey: jest.fn().mockReturnValue(of(undefined))
- };
- notificationService = { show: jest.fn() };
- modalService = { dismissAll: jest.fn() };
-
- TestBed.configureTestingModule({
- declarations: [NvmeofEditAuthenticationComponent, NvmeofSubsystemsStepThreeComponent],
- imports: [
- ReactiveFormsModule,
- HttpClientTestingModule,
- RouterTestingModule,
- SharedModule,
- GridModule,
- InputModule,
- RadioModule,
- TagModule
- ],
- providers: [
- { provide: NvmeofService, useValue: nvmeofService },
- { provide: NotificationService, useValue: notificationService },
- { provide: ModalCdsService, useValue: modalService },
- { provide: SUBSYSTEM_NQN_TOKEN, useValue: mockSubsystemNQN },
- { provide: GROUP_NAME_TOKEN, useValue: mockGroupName }
- ]
- }).compileComponents();
- })
- );
+ beforeEach(waitForAsync(() => {
+ nvmeofService = {
+ getInitiators: jest.fn().mockReturnValue(of([])),
+ getSubsystem: jest.fn().mockReturnValue(of({ has_dhchap_key: false })),
+ updateAuthenticationKey: jest.fn().mockReturnValue(of(undefined))
+ };
+ notificationService = { show: jest.fn() };
+ modalService = { dismissAll: jest.fn() };
+
+ TestBed.configureTestingModule({
+ declarations: [NvmeofEditAuthenticationComponent, NvmeofSubsystemsStepThreeComponent],
+ imports: [
+ ReactiveFormsModule,
+ HttpClientTestingModule,
+ RouterTestingModule,
+ SharedModule,
+ GridModule,
+ InputModule,
+ RadioModule,
+ TagModule
+ ],
+ providers: [
+ { provide: NvmeofService, useValue: nvmeofService },
+ { provide: NotificationService, useValue: notificationService },
+ { provide: ModalCdsService, useValue: modalService },
+ { provide: SUBSYSTEM_NQN_TOKEN, useValue: mockSubsystemNQN },
+ { provide: GROUP_NAME_TOKEN, useValue: mockGroupName }
+ ]
+ }).compileComponents();
+ }));
beforeEach(() => {
fixture = TestBed.createComponent(NvmeofEditAuthenticationComponent);
wrapTaskAroundCall: jasmine.createSpy('wrapTaskAroundCall').and.callFake(({ call }) => call)
};
- beforeEach(
- waitForAsync(() => {
- TestBed.configureTestingModule({
- declarations: [NvmeofEditHostKeyModalComponent],
- imports: [ReactiveFormsModule, HttpClientTestingModule, RouterTestingModule, SharedModule],
- providers: [
- { provide: NvmeofService, useValue: nvmeofServiceSpy },
- { provide: TaskWrapperService, useValue: taskWrapperServiceSpy },
- { provide: 'subsystemNQN', useValue: mockSubsystemNQN },
- { provide: 'hostNQN', useValue: mockHostNQN },
- { provide: 'group', useValue: mockGroup },
- { provide: 'dhchapKey', useValue: '' }
- ]
- }).compileComponents();
- })
- );
+ beforeEach(waitForAsync(() => {
+ TestBed.configureTestingModule({
+ declarations: [NvmeofEditHostKeyModalComponent],
+ imports: [ReactiveFormsModule, HttpClientTestingModule, RouterTestingModule, SharedModule],
+ providers: [
+ { provide: NvmeofService, useValue: nvmeofServiceSpy },
+ { provide: TaskWrapperService, useValue: taskWrapperServiceSpy },
+ { provide: 'subsystemNQN', useValue: mockSubsystemNQN },
+ { provide: 'hostNQN', useValue: mockHostNQN },
+ { provide: 'group', useValue: mockGroup },
+ { provide: 'dhchapKey', useValue: '' }
+ ]
+ }).compileComponents();
+ }));
beforeEach(() => {
fixture = TestBed.createComponent(NvmeofEditHostKeyModalComponent);
authType = NvmeofSubsystemAuthType;
emptyStateImage = EMPTY_STATE_IMAGE;
- constructor(private nvmeofService: NvmeofService, private route: ActivatedRoute) {}
+ constructor(
+ private nvmeofService: NvmeofService,
+ private route: ActivatedRoute
+ ) {}
ngOnInit(): void {
this.columns = [
this.tearsheet?.getStepIndexByLabel(STEP_LABELS.HOSTS) ?? 0,
0
);
- const hostStepForm = this.tearsheet?.stepContents?.toArray()?.[hostStepIndex]?.stepComponent
- ?.formGroup;
+ const hostStepForm =
+ this.tearsheet?.stepContents?.toArray()?.[hostStepIndex]?.stepComponent?.formGroup;
hostStepForm?.markAllAsTouched();
hostStepForm?.get('hostname')?.markAsTouched();
this.nvmeofService.listNamespaces(this.group).subscribe((response: any) => {
const namespaces: NvmeofSubsystemNamespace[] = Array.isArray(response)
? response
- : response?.namespaces ?? [];
+ : (response?.namespaces ?? []);
this.usedRbdImages = namespaces.reduce((map, ns) => {
if (!map.has(ns.rbd_pool_name)) {
map.set(ns.rbd_pool_name, new Set<string>());
</a>
</div>
</div>
-
} @else if (detail.type === 'listeners') {
<div
cdsCol
</div>
<span class="cds--type-label-02">{{ detail.value }}</span>
</div>
-
} @else if (detail.type === 'host-access') {
<div
cdsCol
}).subscribe(({ subsystem, initiators }) => {
this.subsystem = subsystem as NvmeofSubsystem;
const initiatorList = initiators as
- | NvmeofSubsystemInitiator[]
- | { hosts?: NvmeofSubsystemInitiator[] };
+ NvmeofSubsystemInitiator[] | { hosts?: NvmeofSubsystemInitiator[] };
this.buildDetails(getSubsystemAuthStatus(this.subsystem, initiatorList));
});
}
groupName: string;
permissions: Permissions;
- constructor(private route: ActivatedRoute, private authStorageService: AuthStorageService) {
+ constructor(
+ private route: ActivatedRoute,
+ private authStorageService: AuthStorageService
+ ) {
this.permissions = this.authStorageService.getPermissions();
}
) {}
DEFAULT_NQN = 'nqn.2001-07.com.ceph:' + Date.now();
- NQN_REGEX = /^nqn\.(19|20)\d\d-(0[1-9]|1[0-2])\.\D{2,3}(\.[A-Za-z0-9-]+)+(:[A-Za-z0-9-\.]+(:[A-Za-z0-9-\.]+)*)$/;
- NQN_REGEX_UUID = /^nqn\.2014-08\.org\.nvmexpress:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
+ NQN_REGEX =
+ /^nqn\.(19|20)\d\d-(0[1-9]|1[0-2])\.\D{2,3}(\.[A-Za-z0-9-]+)+(:[A-Za-z0-9-\.]+(:[A-Za-z0-9-\.]+)*)$/;
+ NQN_REGEX_UUID =
+ /^nqn\.2014-08\.org\.nvmexpress:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
customNQNValidator = CdValidators.custom(
'nqnPattern',
addedHostsLength: number = 0;
csvUploadError = '';
csvDropText: string = $localize`Drag and drop files here or click to upload`;
- NQN_REGEX = /^nqn\.(19|20)\d\d-(0[1-9]|1[0-2])\.\D{2,3}(\.[A-Za-z0-9-]+)+(:[A-Za-z0-9-\.]+(:[A-Za-z0-9-\.]+)*)$/;
- NQN_REGEX_UUID = /^nqn\.2014-08\.org\.nvmexpress:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
+ NQN_REGEX =
+ /^nqn\.(19|20)\d\d-(0[1-9]|1[0-2])\.\D{2,3}(\.[A-Za-z0-9-]+)+(:[A-Za-z0-9-\.]+(:[A-Za-z0-9-\.]+)*)$/;
+ NQN_REGEX_UUID =
+ /^nqn\.2014-08\.org\.nvmexpress:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
uploadedHosts = new Set<string>();
constructor(
HOST_TYPE = HOST_TYPE;
AUTHENTICATION = AUTHENTICATION;
- constructor(public actionLabels: ActionLabelsI18n, public activeModal: NgbActiveModal) {}
+ constructor(
+ public actionLabels: ActionLabelsI18n,
+ public activeModal: NgbActiveModal
+ ) {}
ngOnInit() {
this.formGroup = new CdFormGroup({});
flags_names,
application_metadata,
type
- } as Pool);
+ }) as Pool;
beforeEach(() => {
createAction = spyOn(component, 'createAction').and.returnValue(of(null));
];
spyOn(TestBed.inject(PoolService), 'list').and.callFake(() => of(mock.pools));
rbdServiceGetSpy = spyOn(TestBed.inject(RbdService), 'get');
- mock.rbd = ({ pool_name: 'foo', pool_image: 'bar' } as any) as RbdFormResponseModel;
+ mock.rbd = { pool_name: 'foo', pool_image: 'bar' } as any as RbdFormResponseModel;
rbdServiceGetSpy.and.returnValue(of(mock.rbd));
component.mode = undefined;
});
const journal = fixture.debugElement.query(By.css('#journal')).nativeElement;
journal.click();
fixture.detectChanges();
- const exclusiveLocks = fixture.debugElement.query(By.css('#exclusive-lock_input'))
- .nativeElement;
+ const exclusiveLocks = fixture.debugElement.query(
+ By.css('#exclusive-lock_input')
+ ).nativeElement;
expect(exclusiveLocks.checked).toBe(true);
expect(exclusiveLocks.disabled).toBe(true);
});
fixture.detectChanges();
const header = fixture.debugElement.nativeElement.querySelector('cds-modal-header h3');
- expect(header.textContent).toBe('Create RBD Snapshot');
+ expect(header.textContent.trim()).toBe('Create RBD Snapshot');
const button = fixture.debugElement.nativeElement.querySelector('cd-submit-button');
- expect(button.textContent).toBe('Create RBD Snapshot');
+ expect(button.textContent.trim()).toBe('Create RBD Snapshot');
});
it('should show "Rename" text', () => {
fixture.detectChanges();
const header = fixture.debugElement.nativeElement.querySelector('cds-modal-header h3');
- expect(header.textContent).toBe('Rename RBD Snapshot');
+ expect(header.textContent.trim()).toBe('Rename RBD Snapshot');
const button = fixture.debugElement.nativeElement.querySelector('cd-submit-button');
- expect(button.textContent).toBe('Rename RBD Snapshot');
+ expect(button.textContent.trim()).toBe('Rename RBD Snapshot');
});
it('should enable the mirror image snapshot creation when peer is configured', () => {
objectValues = Object.values;
- constructor(private dimlessBinary: DimlessBinaryPipe, private dimless: DimlessPipe) {}
+ constructor(
+ private dimlessBinary: DimlessBinaryPipe,
+ private dimless: DimlessPipe
+ ) {}
ngOnChanges() {
this.setStandbys();
this.selectedDir.quotas[key] === 0
? this.actionLabels.SET
: values[key] === 0
- ? this.actionLabels.UNSET
- : $localize`Updated`;
+ ? this.actionLabels.UNSET
+ : $localize`Updated`;
this.cephfsService.quota(this.id, path, values).subscribe(() => {
if (onSuccess) {
onSuccess();
if (!listResponse?.length) {
return of([]);
}
- const detailRequests = listResponse.map(
- (fs): Observable<CephfsDetail | null> =>
- this.cephfsService.getCephfs(fs.id).pipe(catchError(() => of(null)))
+ const detailRequests = listResponse.map((fs): Observable<CephfsDetail | null> =>
+ this.cephfsService.getCephfs(fs.id).pipe(catchError(() => of(null)))
);
return forkJoin(detailRequests).pipe(
map((details: Array<CephfsDetail | null>) =>
];
beforeEach(async () => {
- wizardStepsService = ({
+ wizardStepsService = {
setTotalSteps: jest.fn(),
setCurrentStep: jest.fn(),
steps$: new BehaviorSubject<WizardStepModel[]>(mockSteps)
- } as unknown) as jest.Mocked<WizardStepsService>;
+ } as unknown as jest.Mocked<WizardStepsService>;
- router = ({
+ router = {
navigate: jest.fn()
- } as unknown) as jest.Mocked<Router>;
+ } as unknown as jest.Mocked<Router>;
await TestBed.configureTestingModule({
imports: [ReactiveFormsModule, RadioModule],
// retention policies
schedule.retention &&
Object.entries(schedule.retention).forEach(([frequency, interval], idx) => {
- const freqKey = Object.keys(RetentionFrequency)[
- Object.values(RetentionFrequency).indexOf(frequency as any)
- ];
+ const freqKey =
+ Object.keys(RetentionFrequency)[
+ Object.values(RetentionFrequency).indexOf(frequency as any)
+ ];
this.retentionPolicies.push(
new FormGroup({
retentionInterval: new FormControl(interval),
const values = this.snapScheduleForm.value as SnapshotScheduleFormValue;
if (this.isEdit) {
- const retentionPoliciesToAdd = (this.snapScheduleForm.get(
- 'retentionPolicies'
- ) as FormArray).controls
+ const retentionPoliciesToAdd = (
+ this.snapScheduleForm.get('retentionPolicies') as FormArray
+ ).controls
?.filter(
(ctrl) =>
!ctrl.get('retentionInterval').disabled && !ctrl.get('retentionFrequency').disabled
})
export class CephfsSnapshotscheduleListComponent
extends CdForm
- implements OnInit, OnChanges, OnDestroy {
+ implements OnInit, OnChanges, OnDestroy
+{
@Input() fsName!: string;
@Input() id!: number;
private isSnapshotVisibilityEnabled(option?: ConfigFormModel) {
const values = option?.value ?? [];
- const clientValue = values.find((entry) => entry.section === SNAPSHOT_VISIBILITY_CONFIG_SECTION)
- ?.value;
+ const clientValue = values.find(
+ (entry) => entry.section === SNAPSHOT_VISIBILITY_CONFIG_SECTION
+ )?.value;
return String(clientValue).toLowerCase() === 'true';
}
</div>
</div>
</div>
-
} @else {
<cd-tearsheet
type="full"
stepFixture.detectChanges();
const skipBtn = stepFixture.debugElement.query(By.css('#skipStepBtn')).nativeElement;
expect(skipBtn).not.toBe(null);
- expect(skipBtn.innerHTML).toBe('Skip');
+ expect(skipBtn.textContent.trim()).toBe('Skip');
});
it('should skip the Create OSDs step', () => {
it('should display right title', () => {
const span = debugElement.nativeElement.querySelector('.card-header');
- expect(span.textContent).toBe('CRUSH map viewer');
+ expect(span.textContent.trim()).toBe('CRUSH map viewer');
});
it('should display "No nodes!" if ceph tree nodes is empty array', fakeAsync(() => {
metadataKeyMap: { [key: number]: any } = {};
data$: Observable<object>;
- constructor(private crushRuleService: CrushRuleService, private timerService: TimerService) {}
+ constructor(
+ private crushRuleService: CrushRuleService,
+ private timerService: TimerService
+ ) {}
ngOnInit() {
this.sub = this.timerService
hostname = '';
sidebarItems: SidebarItem[] = [];
- constructor(private route: ActivatedRoute, private authStorageService: AuthStorageService) {}
+ constructor(
+ private route: ActivatedRoute,
+ private authStorageService: AuthStorageService
+ ) {}
ngOnInit(): void {
const permissions = this.authStorageService.getPermissions();
(errorEntry) => errorEntry.url === clusterDetails.url
);
if (errorIndex !== -1) {
- this.prometheusConnectionErrors[
- errorIndex
- ].reconnectionError = reconnectionError;
+ this.prometheusConnectionErrors[errorIndex].reconnectionError =
+ reconnectionError;
}
},
next: (response: any) => {
};
grafanaPermission: Permission;
- constructor(private osdService: OsdService, private authStorageService: AuthStorageService) {
+ constructor(
+ private osdService: OsdService,
+ private authStorageService: AuthStorageService
+ ) {
this.grafanaPermission = this.authStorageService.getPermissions().grafana;
}
const expectOsdServiceMethodCalled = (
actionName: string,
osdServiceMethodName:
- | 'markOut'
- | 'markIn'
- | 'markDown'
- | 'markLost'
- | 'purge'
- | 'destroy'
- | 'delete'
+ 'markOut' | 'markIn' | 'markDown' | 'markLost' | 'purge' | 'destroy' | 'delete'
): void => {
const osdServiceSpy = spyOn(osdService, osdServiceMethodName).and.callFake(() => EMPTY);
openActionModal(actionName);
readonly SNMP_ENGINE_ID_PATTERN = /^[0-9A-Fa-f]{10,64}/g;
readonly INGRESS_SUPPORTED_SERVICE_TYPES = ['rgw', 'nfs'];
readonly SMB_CONFIG_URI_PATTERN = /^(http:|https:|rados:|rados:mon-config-key:)/;
- readonly OAUTH2_ISSUER_URL_PATTERN = /^(https?:\/\/)?([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+)(:[0-9]{1,5})?(\/.*)?$/;
+ readonly OAUTH2_ISSUER_URL_PATTERN =
+ /^(https?:\/\/)?([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+)(:[0-9]{1,5})?(\/.*)?$/;
readonly SSL_CIPHERS_PATTERN = /^[a-zA-Z0-9\-:]+$/;
readonly DEFAULT_SSL_PROTOCOL_ITEM = [{ content: 'TLSv1.3', selected: true }];
@ViewChild(NgbTypeahead, { static: false })
upgradeInfoSpy.and.returnValue(of(upgradeInfoPayload));
component.ngOnInit();
fixture.detectChanges();
- const noUpgradesSpan = fixture.debugElement.nativeElement.querySelector(
- '#no-upgrades-available'
- );
+ const noUpgradesSpan =
+ fixture.debugElement.nativeElement.querySelector('#no-upgrades-available');
expect(noUpgradesSpan.textContent).toBe(' Cluster is up-to-date ');
});
}
];
- constructor(private cssHelper: CssHelper, private dimlessBinary: DimlessBinaryPipe) {
+ constructor(
+ private cssHelper: CssHelper,
+ private dimlessBinary: DimlessBinaryPipe
+ ) {
this.chartConfig = {
chartType: 'doughnut',
labels: [],
describe('pathExistence', () => {
beforeEach(() => {
- component['nfsService']['lsDir'] = jest.fn(
- (): Observable<Directory> => of({ paths: ['/path1'] })
+ component['nfsService']['lsDir'] = jest.fn((): Observable<Directory> =>
+ of({ paths: ['/path1'] })
);
component.nfsForm.get('name').setValue('CEPH');
component.setPathValidation();
)
.subscribe({
error: (error) => {
- const fsalDescr = this.nfsService.nfsFsal.find((f) => f.value === this.storageBackend)
- .descr;
+ const fsalDescr = this.nfsService.nfsFsal.find(
+ (f) => f.value === this.storageBackend
+ ).descr;
this.storageBackendError = $localize`${fsalDescr} backend is not available. ${error}`;
}
});
const icon = !hasAlerts
? AlertIcon.success
: hasCritical
- ? AlertIcon.error
- : AlertIcon.warning;
+ ? AlertIcon.error
+ : AlertIcon.warning;
const statusText = hasAlerts ? $localize`Need attention` : $localize`No active alerts`;
*/
nodes: [
// Root node
- Mocks.getCrushNode('default', -1, 'root', 11, [
- -2,
- -3,
- -6,
- -7,
- -8,
- -9,
- -10,
- -11,
- -12,
- -13,
- -14,
- -15
- ]),
+ Mocks.getCrushNode(
+ 'default',
+ -1,
+ 'root',
+ 11,
+ [-2, -3, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15]
+ ),
// SSD host
Mocks.getCrushNode('ssd-host', -2, 'host', 1, [1, 0, 2]),
Mocks.getCrushNode('osd.0', 0, 'osd', 0, undefined, 'ssd'),
})
export class ErasureCodeProfileFormModalComponent
extends CrushNodeSelectionClass
- implements OnInit {
+ implements OnInit
+{
@ViewChild(FormGroupDirective)
formDir: FormGroupDirective;
form.get(controlName).markAsPristine();
beforeEach(() => {
- [
- 'algorithm',
- 'maxBlobSize',
- 'minBlobSize',
- 'mode',
- 'pgNum',
- 'ratio',
- 'name'
- ].forEach((name) => markControlAsPreviouslySet(name));
+ ['algorithm', 'maxBlobSize', 'minBlobSize', 'mode', 'pgNum', 'ratio', 'name'].forEach(
+ (name) => markControlAsPreviouslySet(name)
+ );
fixture.detectChanges();
});
currentKeyTags: string[];
storedKey: string;
- constructor(private formBuilder: CdFormBuilder, public actionLabels: ActionLabelsI18n) {
+ constructor(
+ private formBuilder: CdFormBuilder,
+ public actionLabels: ActionLabelsI18n
+ ) {
super();
this.createForm();
}
})
export class RgwMultisiteZonegroupDeletionFormComponent
extends CdForm
- implements OnInit, AfterViewInit {
+ implements OnInit, AfterViewInit
+{
zonegroupData$: any;
poolList$: any;
zonesPools: Array<any> = [];
export const DEFAULT_PLACEMENT = 'default-placement';
-export type TIER_TYPE = typeof TIER_TYPE[keyof typeof TIER_TYPE];
+export type TIER_TYPE = (typeof TIER_TYPE)[keyof typeof TIER_TYPE];
export const TIER_TYPE_DISPLAY = {
LOCAL: 'Local',
replicationData: RgwBucketReplication;
bucketRateLimit: RgwRateLimitConfig;
- constructor(private rgwBucketService: RgwBucketService, private cd: ChangeDetectorRef) {}
+ constructor(
+ private rgwBucketService: RgwBucketService,
+ private cd: ChangeDetectorRef
+ ) {}
ngOnChanges() {
this.updateBucketDetails(this.extraxtDetailsfromResponse.bind(this));
expect(component.zonegroup).toBe(payload.zonegroup);
const placementTargets = [];
for (const placementTarget of payload['placement_targets']) {
- placementTarget[
- 'description'
- ] = `${placementTarget['name']} (pool: ${placementTarget['data_pool']})`;
+ placementTarget['description'] =
+ `${placementTarget['name']} (pool: ${placementTarget['data_pool']})`;
placementTargets.push(placementTarget);
}
expect(component.placementTargets).toEqual(placementTargets);
});
fixture.detectChanges();
fixture.whenStable().then(() => {
- const mfaTokenSerial = fixture.debugElement.nativeElement.querySelector(
- '#mfa-token-serial'
- );
+ const mfaTokenSerial =
+ fixture.debugElement.nativeElement.querySelector('#mfa-token-serial');
const mfaTokenPin = fixture.debugElement.nativeElement.querySelector('#mfa-token-pin');
if (expectedVisibility) {
expect(mfaTokenSerial).toBeTruthy();
beforeEach(() => {
component.loading = LoadingStatus.Ready;
fixture.detectChanges();
- childComponent = fixture.debugElement.query(By.directive(RgwRateLimitComponent))
- .componentInstance;
+ childComponent = fixture.debugElement.query(
+ By.directive(RgwRateLimitComponent)
+ ).componentInstance;
});
it('Scenario 1: tenanted owner with tenanted bucket name', () => {
const rateLimitSpy = spyOn(rgwBucketService, 'updateBucketRateLimit').and.returnValue(
fixture = TestBed.createComponent(RgwBucketTieringFormComponent);
component = fixture.componentInstance;
fixture.detectChanges();
- rgwBucketService = (TestBed.inject(RgwBucketService) as unknown) as MockRgwBucketService;
+ rgwBucketService = TestBed.inject(RgwBucketService) as unknown as MockRgwBucketService;
});
it('should create', () => {
})
export class RgwMultisiteImportComponent implements OnInit {
readonly endpoints = /^((https?:\/\/)|(www.))(?:([a-zA-Z]+)|(\d+\.\d+.\d+.\d+)):\d{2,4}$/;
- readonly ipv4Rgx = /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i;
+ readonly ipv4Rgx =
+ /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i;
readonly ipv6Rgx = /^(?:[a-f0-9]{1,4}:){7}[a-f0-9]{1,4}$/i;
@ViewChild(NgbTypeahead, { static: false })
typeahead: NgbTypeahead;
}).compileComponents();
fixture = TestBed.createComponent(RgwMultisiteSyncFlowModalComponent);
- multisiteServiceMock = (TestBed.inject(RgwMultisiteService) as unknown) as MultisiteServiceMock;
+ multisiteServiceMock = TestBed.inject(RgwMultisiteService) as unknown as MultisiteServiceMock;
component = fixture.componentInstance;
component.groupType = FlowType.symmetrical;
component.groupExpandedRow = { groupName: 'new', bucket: 'bucket1' };
}).compileComponents();
fixture = TestBed.createComponent(RgwMultisiteSyncPipeModalComponent);
- multisiteServiceMock = (TestBed.inject(RgwMultisiteService) as unknown) as MultisiteServiceMock;
+ multisiteServiceMock = TestBed.inject(RgwMultisiteService) as unknown as MultisiteServiceMock;
component = fixture.componentInstance;
fixture.detectChanges();
});
.flat()
.filter((cluster) => cluster['url'] !== currentUrl);
this.isMultiClusterConfigured = this.clusterDetailsArray.length > 0;
- this.stepTitles = (this.isMultiClusterConfigured
- ? STEP_TITLES_MULTI_CLUSTER_CONFIGURED
- : STEP_TITLES_SINGLE_CLUSTER
+ this.stepTitles = (
+ this.isMultiClusterConfigured
+ ? STEP_TITLES_MULTI_CLUSTER_CONFIGURED
+ : STEP_TITLES_SINGLE_CLUSTER
).map((label, index) => ({
label,
onClick: () => (this.currentStep.stepIndex = index)
fixture = TestBed.createComponent(RgwNotificationFormComponent);
component = fixture.componentInstance;
- rgwBucketService = (TestBed.inject(RgwBucketService) as unknown) as MockRgwBucketService;
+ rgwBucketService = TestBed.inject(RgwBucketService) as unknown as MockRgwBucketService;
fixture.detectChanges();
});
expect(component).toBeTruthy();
});
it('should call setNotification when submitting form', () => {
- rgwBucketService = (TestBed.inject(RgwBucketService) as unknown) as MockRgwBucketService;
+ rgwBucketService = TestBed.inject(RgwBucketService) as unknown as MockRgwBucketService;
component['notificationList'] = [];
component.notificationForm.patchValue({
id: 'notif-1',
});
it('should render all cards', () => {
- const productiveCards = fixture.debugElement.nativeElement.querySelectorAll(
- 'cd-productive-card'
- );
+ const productiveCards =
+ fixture.debugElement.nativeElement.querySelectorAll('cd-productive-card');
expect(productiveCards.length).toBe(3);
});
const defaults: typeof this.topicForm.value = _.clone(this.topicForm.value);
const keys = Object.keys(this.topicForm.value) as (keyof typeof topic)[];
- let value: Pick<typeof topic, typeof keys[number]> = _.pick(topic, keys);
+ let value: Pick<typeof topic, (typeof keys)[number]> = _.pick(topic, keys);
value = _.merge(defaults, value);
if (!this.owners.includes(value['owner'])) {
urlObj.protocol === UrlProtocol.HTTPS
? URLPort.HTTPS
: urlObj.protocol === UrlProtocol.HTTP
- ? URLPort.HTTP
- : '';
+ ? URLPort.HTTP
+ : '';
}
return port;
}
}).compileComponents();
fixture = TestBed.createComponent(RgwUserAccountsFormComponent);
- rgwUserAccountsService = (TestBed.inject(
+ rgwUserAccountsService = TestBed.inject(
RgwUserAccountsService
- ) as unknown) as MockRgwUserAccountsService;
+ ) as unknown as MockRgwUserAccountsService;
component = fixture.componentInstance;
fixture.detectChanges();
});
resource: string;
action: string;
- constructor(private formBuilder: CdFormBuilder, public actionLabels: ActionLabelsI18n) {
+ constructor(
+ private formBuilder: CdFormBuilder,
+ public actionLabels: ActionLabelsI18n
+ ) {
super();
this.resource = $localize`capability`;
this.createForm();
const detailsTab = fixture.debugElement.nativeElement.querySelectorAll(
'.cds--data-table--sort.cds--data-table--no-border tr td'
);
- expect(detailsTab[10].textContent).toEqual('System user');
- expect(detailsTab[11].textContent).toEqual('Yes');
+ expect(detailsTab[10].textContent.trim()).toEqual('System user');
+ expect(detailsTab[11].textContent.trim()).toEqual('Yes');
component.selection.system = false;
component.ngOnChanges();
fixture.detectChanges();
- expect(detailsTab[11].textContent).toEqual('No');
+ expect(detailsTab[11].textContent.trim()).toEqual('No');
});
it('should show mfa ids only if length > 0', () => {
const detailsTab = fixture.debugElement.nativeElement.querySelectorAll(
'.cds--data-table--sort.cds--data-table--no-border tr td'
);
- expect(detailsTab[16].textContent).toEqual('MFAs(Id)');
- expect(detailsTab[17].textContent).toEqual('testMFA1, testMFA2');
+ expect(detailsTab[16].textContent.trim()).toEqual('MFAs(Id)');
+ expect(detailsTab[17].textContent.trim()).toEqual('testMFA1, testMFA2');
});
it('should test updateKeysSelection', () => {
component.selection = {
icons = Icons;
- constructor(private rgwUserService: RgwUserService, private cdsModalService: ModalCdsService) {}
+ constructor(
+ private rgwUserService: RgwUserService,
+ private cdsModalService: ModalCdsService
+ ) {}
ngOnInit() {
this.keysColumns = [
beforeEach(() => {
component.loading = LoadingStatus.Ready;
fixture.detectChanges();
- childComponent = fixture.debugElement.query(By.directive(RgwRateLimitComponent))
- .componentInstance;
+ childComponent = fixture.debugElement.query(
+ By.directive(RgwRateLimitComponent)
+ ).componentInstance;
});
it('disable creation (create)', () => {
spyOn(rgwUserService, 'create');
notificationService = TestBed.inject(NotificationService);
spyOn(notificationService, 'show');
fixture.detectChanges();
- let childComponent = fixture.debugElement.query(By.directive(RgwRateLimitComponent))
- .componentInstance;
+ let childComponent = fixture.debugElement.query(
+ By.directive(RgwRateLimitComponent)
+ ).componentInstance;
jest.spyOn(childComponent, 'getRateLimitFormValue');
});
beforeEach(() => {
component.loading = LoadingStatus.Ready;
fixture.detectChanges();
- childComponent = fixture.debugElement.query(By.directive(RgwRateLimitComponent))
- .componentInstance;
+ childComponent = fixture.debugElement.query(
+ By.directive(RgwRateLimitComponent)
+ ).componentInstance;
});
it('create with account id & account root user', () => {
spyOn(rgwUserService, 'create');
resource: string;
action: string;
- constructor(private formBuilder: CdFormBuilder, public actionLabels: ActionLabelsI18n) {
+ constructor(
+ private formBuilder: CdFormBuilder,
+ public actionLabels: ActionLabelsI18n
+ ) {
super();
this.resource = $localize`S3 Key`;
this.createForm();
resource: string;
action: string;
- constructor(private formBuilder: CdFormBuilder, private actionLabels: ActionLabelsI18n) {
+ constructor(
+ private formBuilder: CdFormBuilder,
+ private actionLabels: ActionLabelsI18n
+ ) {
super();
this.resource = $localize`Subuser`;
this.createForm();
isEmpty = _.isEmpty;
- constructor(private osdService: OsdService, private hostService: HostService) {}
+ constructor(
+ private osdService: OsdService,
+ private hostService: HostService
+ ) {}
isSmartError(data: any): data is SmartError {
return _.get(data, 'error') !== undefined;
export interface SMBCluster {
resource_type: typeof CLUSTER_RESOURCE;
cluster_id: string;
- auth_mode: typeof AUTHMODE[keyof typeof AUTHMODE];
+ auth_mode: (typeof AUTHMODE)[keyof typeof AUTHMODE];
domain_settings?: DomainSettings;
user_group_settings?: JoinSource[];
custom_dns?: string[];
class="btn btn-outline-light btn-password"
cdPasswordButton="oldpassword"
type="button"
+ aria-label="Toggle visibility"
+ i18n-aria-label
></button>
</div>
<span
type="button"
class="btn btn-outline-light btn-password"
cdPasswordButton="newpassword"
+ aria-label="Toggle visibility"
+ i18n-aria-label
></button>
</div>
<div class="password-strength-level">
class="btn btn-outline-light btn-password"
cdPasswordButton="confirmnewpassword"
type="button"
+ aria-label="Toggle visibility"
+ i18n-aria-label
></button>
</div>
<span
this.userService,
() => this.userForm.getValue('username'),
(_valid: boolean, credits: number, valuation: string) => {
- this.passwordStrengthLevelClass = this.passwordPolicyService.mapCreditsToCssClass(
- credits
- );
+ this.passwordStrengthLevelClass =
+ this.passwordPolicyService.mapCreditsToCssClass(credits);
this.passwordValuation = _.defaultTo(valuation, '');
}
)
* These values are not needed in this component after carbonization.
* @TODO: Need to remove once the LoginPasswordFormComponent is carbonized.
*/
- this.passwordStrengthLevelClass = this.passwordPolicyService.mapCreditsToCssClass(
- credits
- );
+ this.passwordStrengthLevelClass =
+ this.passwordPolicyService.mapCreditsToCssClass(credits);
this.passwordValuation = _.defaultTo(valuation, '');
this.INVALID_TEXTS['passwordPolicy'] = _.defaultTo(valuation, '');
route = route.firstChild;
}
const pageHeader = route?.routeConfig?.data?.['pageHeader'] as
- | { title?: string; description?: string }
- | undefined;
+ { title?: string; description?: string } | undefined;
this.pageHeaderTitle = pageHeader?.title ?? null;
this.pageHeaderDescription = pageHeader?.description ?? null;
}
docsUrl: string;
icons = Icons;
- constructor(private docService: DocService, private modalCdsService: ModalCdsService) {}
+ constructor(
+ private docService: DocService,
+ private modalCdsService: ModalCdsService
+ ) {}
ngOnInit() {
this.docService.subscribeOnce('dashboard', (url: string) => {
username: string;
icons = Icons;
- constructor(private authStorageService: AuthStorageService, private authService: AuthService) {}
+ constructor(
+ private authStorageService: AuthStorageService,
+ private authService: AuthService
+ ) {}
ngOnInit() {
this.username = this.authStorageService.getUsername();
predefinedLabels = ['mon', 'mgr', 'osd', 'mds', 'rgw', 'nfs', 'iscsi', 'rbd', 'grafana'];
- constructor(private http: HttpClient, private deviceService: DeviceService) {
+ constructor(
+ private http: HttpClient,
+ private deviceService: DeviceService
+ ) {
super();
}
]
};
- constructor(private http: HttpClient, private deviceService: DeviceService) {}
+ constructor(
+ private http: HttpClient,
+ private deviceService: DeviceService
+ ) {}
create(driveGroups: Object[], trackingId: string, method = 'drive_groups') {
const request = {
}
};
- constructor(private http: HttpClient, private rbdConfigurationService: RbdConfigurationService) {}
+ constructor(
+ private http: HttpClient,
+ private rbdConfigurationService: RbdConfigurationService
+ ) {}
create(pool: any) {
return this.http.post(this.apiPath, pool, { observe: 'response' });
// Observable streams
summaryData$ = this.summaryDataSource.asObservable();
- constructor(private http: HttpClient, private timerService: TimerService) {}
+ constructor(
+ private http: HttpClient,
+ private timerService: TimerService
+ ) {}
startPolling(): Subscription {
return this.timerService
providedIn: 'root'
})
export class RbdService extends ApiClient {
- constructor(private http: HttpClient, private rbdConfigurationService: RbdConfigurationService) {
+ constructor(
+ private http: HttpClient,
+ private rbdConfigurationService: RbdConfigurationService
+ ) {
super();
}
totalUsedCapacity$ = this.totalUsedCapacitySubject.asObservable();
averageObjectSize$ = this.averageObjectSizeSubject.asObservable();
- constructor(private http: HttpClient, private rgwDaemonService: RgwDaemonService) {
+ constructor(
+ private http: HttpClient,
+ private rgwDaemonService: RgwDaemonService
+ ) {
super();
}
export class RgwRealmService {
private url = 'api/rgw/realm';
- constructor(private http: HttpClient, public rgwDaemonService: RgwDaemonService) {}
+ constructor(
+ private http: HttpClient,
+ public rgwDaemonService: RgwDaemonService
+ ) {}
create(realm: RgwRealm, defaultRealm: boolean) {
let requestBody = {
export class RgwSiteService {
private url = 'api/rgw/site';
- constructor(private http: HttpClient, private rgwDaemonService: RgwDaemonService) {}
+ constructor(
+ private http: HttpClient,
+ private rgwDaemonService: RgwDaemonService
+ ) {}
get(query?: string) {
return this.rgwDaemonService.request((params: HttpParams) => {
export class RgwTopicService extends ApiClient {
baseURL = 'api/rgw/topic';
- constructor(private http: HttpClient, private rgwDaemonService: RgwDaemonService) {
+ constructor(
+ private http: HttpClient,
+ private rgwDaemonService: RgwDaemonService
+ ) {
super();
}
export class RgwUserAccountsService {
private url = 'api/rgw/accounts';
- constructor(private http: HttpClient, private rgwDaemonService: RgwDaemonService) {}
+ constructor(
+ private http: HttpClient,
+ private rgwDaemonService: RgwDaemonService
+ ) {}
list(detailed?: boolean): Observable<any> {
return this.rgwDaemonService.request((params: HttpParams) => {
export class RgwUserService {
private url = 'api/rgw/user';
- constructor(private http: HttpClient, private rgwDaemonService: RgwDaemonService) {}
+ constructor(
+ private http: HttpClient,
+ private rgwDaemonService: RgwDaemonService
+ ) {}
/**
* Get the list of users.
modalData$ = this.modalDataSubject.asObservable();
dataUploader = signal<SMBResource | null>(null);
- constructor(private http: HttpClient, private notificationService: NotificationService) {}
+ constructor(
+ private http: HttpClient,
+ private notificationService: NotificationService
+ ) {}
passData(data: DomainSettings) {
this.modalDataSubject.next(data);
name: 'osd_debug_deep_scrub_sleep',
type: 'float',
level: 'dev',
- desc:
- 'Inject an expensive sleep during deep scrub IO to make it easier to induce preemption',
+ desc: 'Inject an expensive sleep during deep scrub IO to make it easier to induce preemption',
long_desc: '',
default: 0,
daemon_default: '',
@Component({
template: `
- <button type="button" class="btn btn-danger" (click)="openCtrlDriven()">
+ <button
+ type="button"
+ class="btn btn-danger"
+ (click)="openCtrlDriven()"
+ >
<i class="fa fa-times"></i>Deletion Ctrl-Test
<ng-template #ctrlDescription>
The spinner is handled by the controller if you have use the modal as ViewChild in order to
</ng-template>
</button>
- <button type="button" class="btn btn-danger" (click)="openModalDriven()">
+ <button
+ type="button"
+ class="btn btn-danger"
+ (click)="openModalDriven()"
+ >
<i class="fa fa-times"></i>Deletion Modal-Test
<ng-template #modalDescription>
The spinner is handled by the modal if your given deletion function returns a Observable.
}
get forceDeleteAckSatisfied(): boolean {
- if (
- !(this.impact === this.impactEnum.high && this.bodyContext?.forceDeleteAcknowledgementMessage)
- ) {
+ if (!(
+ this.impact === this.impactEnum.high && this.bodyContext?.forceDeleteAcknowledgementMessage
+ )) {
return true;
}
const c = this.deletionForm?.get('forceDeleteAck');
@Input()
scrollable: string = 'yes';
- constructor(private sanitizer: DomSanitizer, private settingsService: SettingsService) {
+ constructor(
+ private sanitizer: DomSanitizer,
+ private settingsService: SettingsService
+ ) {
this.grafanaTimes = [
{
name: $localize`Last 5 minutes`,
// When adding a new supported language make sure to add a test for it in:
// language-selector.component.spec.ts
export enum SupportedLanguages {
- 'cs' = 'Čeština',
- 'de' = 'Deutsch',
+ cs = 'Čeština',
+ de = 'Deutsch',
'en-US' = 'English',
- 'es' = 'Español',
- 'fr' = 'Français',
- 'id' = 'Bahasa Indonesia',
- 'it' = 'Italiano',
- 'ja' = '日本語',
- 'ko' = '한국어',
- 'pl' = 'Polski',
- 'pt' = 'Português (brasileiro)',
+ es = 'Español',
+ fr = 'Français',
+ id = 'Bahasa Indonesia',
+ it = 'Italiano',
+ ja = '日本語',
+ ko = '한국어',
+ pl = 'Polski',
+ pt = 'Português (brasileiro)',
'zh-Hans' = '中文 (简体)',
'zh-Hant' = '中文 (繁體)'
}
// cyan left edge
radial-gradient(120% 60% at -15% 100%, rgba(colors.$cyan-60, 0.13) 0%, transparent 65%),
/* cyan right edge*/
- radial-gradient(120% 60% at 115% 100%, rgba(colors.$cyan-60, 0.1) 0%, transparent 65%),
+ radial-gradient(120% 60% at 115% 100%, rgba(colors.$cyan-60, 0.1) 0%, transparent 65%),
/* pink center*/
- radial-gradient(120% 60% at 50% 100%, rgba(colors.$magenta-60, 0.11) 0%, transparent 70%);
- box-shadow: var(--cds-ai-drop-shadow), inset 0 0 0 1px var(--cds-ai-inner-shadow);
+ radial-gradient(120% 60% at 50% 100%, rgba(colors.$magenta-60, 0.11) 0%, transparent 70%);
+ box-shadow:
+ var(--cds-ai-drop-shadow),
+ inset 0 0 0 1px var(--cds-ai-inner-shadow);
}
}
component.title = 'testTitle';
fixture.detectChanges();
const title = fixture.debugElement.query(By.css('h3'));
- expect(title.nativeElement.textContent).toEqual('testTitle');
+ expect(title.nativeElement.textContent.trim()).toEqual('testTitle');
});
it('should select the first item as active if no item is selected', () => {
owner: ['read', 'execute'],
group: ['write']
});
- component.onClickHeaderCheckbox('scope', ({
+ component.onClickHeaderCheckbox('scope', {
target: { checked: false }
- } as unknown) as Event);
+ } as unknown as Event);
const scopes_permissions = form.getValue('scopes_permissions');
expect(scopes_permissions).toEqual({});
});
import { configureTestBed } from '~/testing/unit-test-helper';
import { AuthStorageDirective } from './auth-storage.directive';
@Component({
- template: `<div id="permitted" *cdScope="condition; matchAll: matchAll"></div>`,
+ template: `<div
+ id="permitted"
+ *cdScope="condition; matchAll: matchAll"
+ ></div>`,
standalone: false
})
export class AuthStorageDirectiveTestComponent {
@Component({
template: `
<form>
- <input id="x" type="text" />
- <input id="y" type="password" autofocus />
+ <input
+ id="x"
+ type="text"
+ />
+ <input
+ id="y"
+ type="password"
+ autofocus
+ />
</form>
`,
standalone: false
@Component({
template: `
<form>
- <input id="x" type="checkbox" [autofocus]="edit" />
- <input id="y" type="text" />
+ <input
+ id="x"
+ type="checkbox"
+ [autofocus]="edit"
+ />
+ <input
+ id="y"
+ type="text"
+ />
</form>
`,
standalone: false
@Component({
template: `
<form>
- <input id="x" type="text" [autofocus]="foo" />
+ <input
+ id="x"
+ type="text"
+ [autofocus]="foo"
+ />
</form>
`,
standalone: false
});
it('should focus the password form field', () => {
- const fixture: ComponentFixture<PasswordFormComponent> = TestBed.createComponent(
- PasswordFormComponent
- );
+ const fixture: ComponentFixture<PasswordFormComponent> =
+ TestBed.createComponent(PasswordFormComponent);
fixture.detectChanges();
const focused = fixture.debugElement.query(By.css(':focus'));
expect(focused.attributes.id).toBe('y');
});
it('should focus the checkbox form field', () => {
- const fixture: ComponentFixture<CheckboxFormComponent> = TestBed.createComponent(
- CheckboxFormComponent
- );
+ const fixture: ComponentFixture<CheckboxFormComponent> =
+ TestBed.createComponent(CheckboxFormComponent);
fixture.detectChanges();
const focused = fixture.debugElement.query(By.css(':focus'));
expect(focused.attributes.id).toBe('x');
import { ComboBoxItem } from '../models/combo-box.model';
@Component({
- template: `<div cdDynamicInputCombobox [items]="[]"></div>`,
+ template: `<div
+ cdDynamicInputCombobox
+ [items]="[]"
+ ></div>`,
standalone: false
})
class MockComponent {
standalone: false
})
export class FormLoadingDirective {
- constructor(private templateRef: TemplateRef<any>, private viewContainer: ViewContainerRef) {}
+ constructor(
+ private templateRef: TemplateRef<any>,
+ private viewContainer: ViewContainerRef
+ ) {}
@Input() set cdFormLoading(condition: LoadingStatus) {
let content: any;
@Input()
ngDataReady: EventEmitter<any>;
- constructor(private formatter: FormatterService, private ngControl: NgControl) {}
+ constructor(
+ private formatter: FormatterService,
+ private ngControl: NgControl
+ ) {}
setValue(value: string): void {
const iops = this.formatter.toIops(value);
@Input()
ngDataReady: EventEmitter<any>;
- constructor(private control: NgControl, private formatter: FormatterService) {}
+ constructor(
+ private control: NgControl,
+ private formatter: FormatterService
+ ) {}
setValue(value: string): void {
const ms = this.formatter.toMilliseconds(value);
export class OptionalFieldDirective implements AfterViewInit {
@Input('cdOptionalField') label: string;
@Input() skeleton: boolean;
- constructor(private elementRef: ElementRef, private renderer: Renderer2) {}
+ constructor(
+ private elementRef: ElementRef,
+ private renderer: Renderer2
+ ) {}
ngAfterViewInit() {
if (!this.label || this.skeleton) return;
@Input()
private cdPasswordButton: string;
- constructor(private elementRef: ElementRef, private renderer: Renderer2) {}
+ constructor(
+ private elementRef: ElementRef,
+ private renderer: Renderer2
+ ) {}
ngOnInit() {
this.renderer.setAttribute(this.elementRef.nativeElement, 'tabindex', '-1');
export class RequiredFieldDirective implements AfterViewInit {
@Input('cdRequiredField') label: string;
@Input() skeleton: boolean;
- constructor(private elementRef: ElementRef, private renderer: Renderer2) {}
+ constructor(
+ private elementRef: ElementRef,
+ private renderer: Renderer2
+ ) {}
ngAfterViewInit() {
if (!this.label || this.skeleton) return;
@Component({
template: `
<form [formGroup]="trimForm">
- <input type="text" formControlName="trimInput" cdTrim />
+ <input
+ type="text"
+ formControlName="trimInput"
+ cdTrim
+ />
</form>
`,
standalone: false
it('should trim', () => {
const fixture: ComponentFixture<TrimComponent> = TestBed.createComponent(TrimComponent);
const component: TrimComponent = fixture.componentInstance;
- const inputElement: HTMLInputElement = fixture.debugElement.query(By.css('input'))
- .nativeElement;
+ const inputElement: HTMLInputElement = fixture.debugElement.query(
+ By.css('input')
+ ).nativeElement;
fixture.detectChanges();
inputElement.value = ' a b ';
// A test host component to simulate directive usage with a Reactive Form
@Component({
template: `
- <form [formGroup]="form" (ngSubmit)="onSubmit()">
- <input formControlName="testField" cdValidate #cdValidateRef="cdValidate" />
+ <form
+ [formGroup]="form"
+ (ngSubmit)="onSubmit()"
+ >
+ <input
+ formControlName="testField"
+ cdValidate
+ #cdValidateRef="cdValidate"
+ />
<button type="submit">Submit</button>
</form>
`,
) {
conditionalValidators = conditionalValidators.concat(permanentValidators);
- formControl.setValidators((control: AbstractControl): {
- [key: string]: any;
- } => {
- const value = condition.call(this);
- if (value) {
- return Validators.compose(conditionalValidators)(control);
- }
- if (permanentValidators.length > 0) {
- return Validators.compose(permanentValidators)(control);
+ formControl.setValidators(
+ (
+ control: AbstractControl
+ ): {
+ [key: string]: any;
+ } => {
+ const value = condition.call(this);
+ if (value) {
+ return Validators.compose(conditionalValidators)(control);
+ }
+ if (permanentValidators.length > 0) {
+ return Validators.compose(permanentValidators)(control);
+ }
+ return null;
}
- return null;
- });
+ );
watchControls.forEach((control: AbstractControl) => {
control.valueChanges.subscribe(() => {
let errorName: string;
// - Bucket names cannot be formatted as IP address.
constraints.push(() => {
- const ipv4Rgx = /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i;
+ const ipv4Rgx =
+ /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i;
const ipv6Rgx = /^(?:[a-f0-9]{1,4}:){7}[a-f0-9]{1,4}$/i;
const name = control.value;
let notIP = true;
static oauthAddressTest(): ValidatorFn {
// Pattern matches: IPv4 addresses or hostnames (with or without dots, like 'localhost')
- const OAUTH2_HTTPS_ADDRESS_PATTERN = /^((\d{1,3}\.){3}\d{1,3}|([a-zA-Z0-9-_]+\.)*[a-zA-Z0-9-_]+)$/;
+ const OAUTH2_HTTPS_ADDRESS_PATTERN =
+ /^((\d{1,3}\.){3}\d{1,3}|([a-zA-Z0-9-_]+\.)*[a-zA-Z0-9-_]+)$/;
return (control: AbstractControl): Record<string, boolean> | null => {
if (!control.value) {
return null;
@Component({
template: ` <form [formGroup]="form">
- <formly-form [model]="{}" [fields]="fields" [options]="{}" [form]="form"></formly-form>
+ <formly-form
+ [model]="{}"
+ [fields]="fields"
+ [options]="{}"
+ [form]="form"
+ ></formly-form>
</form>`
})
class MockFormComponent {
@Component({
template: ` <form [formGroup]="form">
- <formly-form [model]="{}" [fields]="fields" [options]="{}" [form]="form"></formly-form>
+ <formly-form
+ [model]="{}"
+ [fields]="fields"
+ [options]="{}"
+ [form]="form"
+ ></formly-form>
</form>`
})
class MockFormComponent {
@Component({
template: ` <form [formGroup]="form">
- <formly-form [model]="{}" [fields]="fields" [options]="{}" [form]="form"></formly-form>
+ <formly-form
+ [model]="{}"
+ [fields]="fields"
+ [options]="{}"
+ [form]="form"
+ ></formly-form>
</form>`
})
class MockFormComponent {
@Component({
template: ` <form [formGroup]="form">
- <formly-form [model]="{}" [fields]="fields" [options]="{}" [form]="form"></formly-form>
+ <formly-form
+ [model]="{}"
+ [fields]="fields"
+ [options]="{}"
+ [form]="form"
+ ></formly-form>
</form>`
})
class MockFormComponent {
@Component({
template: ` <form [formGroup]="form">
- <formly-form [model]="{}" [fields]="fields" [options]="{}" [form]="form"></formly-form>
+ <formly-form
+ [model]="{}"
+ [fields]="fields"
+ [options]="{}"
+ [form]="form"
+ ></formly-form>
</form>`
})
class MockFormComponent {
return new this(poolName, namespace, imageName);
}
- constructor(public poolName: string, public namespace: string, public imageName: string) {}
+ constructor(
+ public poolName: string,
+ public namespace: string,
+ public imageName: string
+ ) {}
private getNameSpace() {
return this.namespace ? `${this.namespace}/` : '';
}
export type NvmeofNamespaceListResponse =
- | NvmeofSubsystemNamespace[]
- | { namespaces: NvmeofSubsystemNamespace[] };
+ NvmeofSubsystemNamespace[] | { namespaces: NvmeofSubsystemNamespace[] };
export type NvmeofInitiatorCandidate = {
content: string;
severity: ResiliencyState;
};
-type ResiliencyState = typeof DATA_RESILIENCY_STATE[keyof typeof DATA_RESILIENCY_STATE];
+type ResiliencyState = (typeof DATA_RESILIENCY_STATE)[keyof typeof DATA_RESILIENCY_STATE];
-type PG_STATES = typeof PG_STATES[number];
+type PG_STATES = (typeof PG_STATES)[number];
-type SCRUBBING_STATES = typeof SCRUBBING_STATES[number];
+type SCRUBBING_STATES = (typeof SCRUBBING_STATES)[number];
export type TrendPoint = {
timestamp: Date;
(Math.floor(num / 10) === 1
? 'th'
: num % 10 === 1
- ? 'st'
- : num % 10 === 2
- ? 'nd'
- : num % 10 === 3
- ? 'rd'
- : 'th')
+ ? 'st'
+ : num % 10 === 2
+ ? 'nd'
+ : num % 10 === 3
+ ? 'rd'
+ : 'th')
);
}
}
it('should use different application icon (default Ceph) in error message', fakeAsync(() => {
const msg = 'Cannot connect to Alertmanager';
httpError(undefined, { status: 500 }, (resp) => {
- (resp.application = 'Prometheus'), (resp.message = msg);
+ ((resp.application = 'Prometheus'), (resp.message = msg));
});
expectSaveToHaveBeenCalled(true);
flush();
providedIn: 'root'
})
export class AuthGuardService {
- constructor(private router: Router, private authStorageService: AuthStorageService) {}
+ constructor(
+ private router: Router,
+ private authStorageService: AuthStorageService
+ ) {}
canActivate(_route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
if (this.authStorageService.isLoggedIn()) {
providedIn: 'root'
})
export class ChangePasswordGuardService {
- constructor(private router: Router, private authStorageService: AuthStorageService) {}
+ constructor(
+ private router: Router,
+ private authStorageService: AuthStorageService
+ ) {}
canActivate(_route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
// Redirect to '/login-change-password' when the following constraints
cache: { [keys: string]: Observable<any> } = {};
selected: any;
- constructor(private http: HttpClient, private crudFormAdapater: CrudFormAdapterService) {}
+ constructor(
+ private http: HttpClient,
+ private crudFormAdapater: CrudFormAdapterService
+ ) {}
list(dataPath: string): Observable<any> {
const cacheable = this.getCacheable(dataPath, 'get');
readonly REFRESH_INTERVAL: number = 30000;
private featureToggleMap$: FeatureTogglesMap$;
- constructor(private http: HttpClient, private timerService: TimerService) {
+ constructor(
+ private http: HttpClient,
+ private timerService: TimerService
+ ) {
this.featureToggleMap$ = this.timerService.get(
() => this.http.get<FeatureTogglesMap>(this.API_URL),
this.REFRESH_INTERVAL
@Injectable()
export class JsErrorHandler implements ErrorHandler {
- constructor(private injector: Injector, private router: Router) {}
+ constructor(
+ private injector: Injector,
+ private router: Router
+ ) {}
handleError(error: any) {
const loggingService = this.injector.get(LoggingService);
providedIn: 'root'
})
export class LanguageService {
- constructor(private http: HttpClient, @Inject(LOCALE_ID) protected localeId: string) {}
+ constructor(
+ private http: HttpClient,
+ @Inject(LOCALE_ID) protected localeId: string
+ ) {}
getLocale(): string {
return this.localeId || environment.default_lang;
providedIn: 'root'
})
export class NgZoneSchedulerService {
- constructor(public leave: LeaveNgZoneScheduler, public enter: EnterNgZoneScheduler) {}
+ constructor(
+ public leave: LeaveNgZoneScheduler,
+ public enter: EnterNgZoneScheduler
+ ) {}
}
// Observable streams
summaryData$ = this.summaryDataSource.asObservable();
- constructor(private http: HttpClient, private timerService: TimerService) {}
+ constructor(
+ private http: HttpClient,
+ private timerService: TimerService
+ ) {}
startPolling(): Subscription {
return this.timerService
@use '@carbon/styles/scss/config' with (
$font-path: '~@ibm/plex',
$flex-grid-columns: 16,
- $use-flexbox-grid: true,
+ $use-flexbox-grid: true
);
@use '@carbon/layout';
@use '@carbon/colors';
@use '@carbon/styles/scss/themes';
@use '@carbon/styles/scss/theme' with (
$theme: default.$theme,
- $fallback: compat.$g90,
- );
+ $fallback: compat.$g90
+);
/******************************************
Component token overrides should go here