describe('Pools page', () => {
const pools = new PoolPageHelper();
- const poolName = 'pool_e2e_pool/test';
+ const poolName = 'pool_e2e_pool-test';
beforeEach(() => {
cy.login();
it('should create a pool', () => {
pools.exist(poolName, false);
pools.navigateTo('create');
- pools.create(poolName, 8);
+ pools.create(poolName, 8, 'rbd');
pools.exist(poolName, true);
});
pools.edit_pool_pg(poolName, 32);
});
+ it('should show updated configuration field values', () => {
+ pools.exist(poolName, true);
+ const bpsLimit = '4 B/s';
+ pools.edit_pool_configuration(poolName, bpsLimit);
+ });
+
it('should delete a pool', () => {
pools.delete(poolName);
});
}
}
+ edit_pool_configuration(name: string, bpsLimit: string) {
+ this.navigateEdit(name);
+
+ cy.get('.collapsible').click();
+ cy.get('cd-rbd-configuration-form')
+ .get('input[name=rbd_qos_bps_limit]')
+ .clear()
+ .type(`${bpsLimit}`);
+ cy.get('cd-submit-button').click();
+
+ this.navigateEdit(name);
+
+ cy.get('.collapsible').click();
+ cy.get('cd-rbd-configuration-form')
+ .get('input[name=rbd_qos_bps_limit]')
+ .should('have.value', bpsLimit);
+ }
+
private setApplications(apps: string[]) {
if (!apps || apps.length === 0) {
return;
-import { EventEmitter } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ReactiveFormsModule } from '@angular/forms';
import { By } from '@angular/platform-browser';
+import { ReplaySubject } from 'rxjs';
+
import { DirectivesModule } from '~/app/shared/directives/directives.module';
import { CdFormGroup } from '~/app/shared/forms/cd-form-group';
import { RbdConfigurationSourceField } from '~/app/shared/models/configuration';
describe('test loading of initial data for editing', () => {
beforeEach(() => {
- component.initializeData = new EventEmitter<any>();
+ component.initializeData = new ReplaySubject<any>(1);
fixture.detectChanges();
component.ngOnInit();
});
});
it('should load initial data into forms', () => {
- component.initializeData.emit({
+ component.initializeData.next({
initialData: [
{
name: 'rbd_qos_bps_limit',
});
it('should not load initial data if the source is not the pool itself', () => {
- component.initializeData.emit({
+ component.initializeData.next({
initialData: [
{
name: 'rbd_qos_bps_limit',
});
it('should not load initial data if the source is not the image itself', () => {
- component.initializeData.emit({
+ component.initializeData.next({
initialData: [
{
name: 'rbd_qos_bps_limit',
});
it('should always have formatted results', () => {
- component.initializeData.emit({
+ component.initializeData.next({
initialData: [
{
name: 'rbd_qos_bps_limit',
let data: any;
beforeEach(() => {
- component.initializeData = new EventEmitter<any>();
+ component.initializeData = new ReplaySubject<any>(1);
fixture.detectChanges();
component.ngOnInit();
data = {
],
sourceType: RbdConfigurationSourceField.image
};
- component.initializeData.emit(data);
+ component.initializeData.next(data);
});
it('should return an empty object', () => {
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
+import _ from 'lodash';
+import { ReplaySubject } from 'rxjs';
+
import { Icons } from '~/app/shared/enum/icons.enum';
import { CdFormGroup } from '~/app/shared/forms/cd-form-group';
import {
@Input()
form: CdFormGroup;
@Input()
- initializeData: EventEmitter<{
+ initializeData = new ReplaySubject<{
initialData: RbdConfigurationEntry[];
sourceType: RbdConfigurationSourceField;
- }>;
+ }>(1);
@Output()
changes = new EventEmitter<any>();
this.initializeData.subscribe((data: Record<string, any>) => {
this.initialData = data.initialData;
const dataType = data.sourceType;
-
this.rbdConfigurationService.getWritableOptionFields().forEach((option) => {
const optionData = data.initialData
.filter((entry: Record<string, any>) => entry.name === option.name)
c.type === RbdConfigurationType.iops ||
c.type === RbdConfigurationType.bps
) {
- control = new FormControl(0, Validators.min(0));
+ let initialValue = 0;
+ _.forEach(this.initialData, (configList) => {
+ if (configList['name'] === c.name) {
+ initialValue = configList['value'];
+ }
+ });
+ control = new FormControl(initialValue, Validators.min(0));
} else {
throw new Error(
`Type ${c.type} is unknown, you may need to add it to RbdConfiguration class`
-import { Component, EventEmitter, OnInit } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
import { FormControl, ValidatorFn, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
allDataPools: Array<Pool> = [];
features: { [key: string]: RbdImageFeature };
featuresList: RbdImageFeature[] = [];
- initializeConfigData = new EventEmitter<{
+ initializeConfigData = new ReplaySubject<{
initialData: RbdConfigurationEntry[];
sourceType: RbdConfigurationSourceField;
- }>();
+ }>(1);
pool: string;
.setValue(this.dimlessBinaryPipe.transform(response.stripe_unit));
this.rbdForm.get('stripingCount').setValue(response.stripe_count);
/* Configuration */
- this.initializeConfigData.emit({
+ this.initializeConfigData.next({
initialData: this.response.configuration,
sourceType: RbdConfigurationSourceField.image
});
-import { Component, EventEmitter, OnInit, Type, ViewChild } from '@angular/core';
+import { Component, OnInit, Type, ViewChild } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { NgbNav, NgbTooltip } from '@ng-bootstrap/ng-bootstrap';
import _ from 'lodash';
-import { Observable, Subscription } from 'rxjs';
+import { Observable, ReplaySubject, Subscription } from 'rxjs';
import { CrushRuleService } from '~/app/shared/api/crush-rule.service';
import { ErasureCodeProfileService } from '~/app/shared/api/erasure-code-profile.service';
current: Record<string, any> = {
rules: []
};
- initializeConfigData = new EventEmitter<{
+ initializeConfigData = new ReplaySubject<{
initialData: RbdConfigurationEntry[];
sourceType: RbdConfigurationSourceField;
- }>();
+ }>(1);
currentConfigurationValues: { [configKey: string]: any } = {};
action: string;
resource: string;
}
private initEditFormData(pool: Pool) {
- this.initializeConfigData.emit({
+ this.initializeConfigData.next({
initialData: pool.configuration,
sourceType: RbdConfigurationSourceField.pool
});