);
});
+Then('I should see a table in the expanded row', () => {
+ cy.get('.datatable-row-detail').within(() => {
+ cy.get('cd-table').should('exist');
+ cy.get('datatable-scroller, .empty-row');
+ });
+});
+
Then('I should not see a row with {string} in the expanded row', (row: string) => {
cy.get('.datatable-row-detail').within(() => {
cy.get('cd-table .search input').first().clear().type(row);
});
}
});
+
+Then('I should see an alert {string} in the expanded row', (alert: string) => {
+ cy.get('.datatable-row-detail').within(() => {
+ cy.get('.alert-panel-text').contains(alert);
+ });
+});
--- /dev/null
+Feature: CephFS Snapshot Management
+
+ Goal: To test out the CephFS snapshot management features
+
+ Background: Login
+ Given I am logged in
+
+ Scenario: Create a CephFS Volume
+ Given I am on the "cephfs" page
+ And I click on "Create" button
+ And enter "name" "test_cephfs"
+ And I click on "Create File System" button
+ Then I should see a row with "test_cephfs"
+
+ Scenario: Snapshots tab without a subvolume
+ Given I am on the "cephfs" page
+ When I expand the row "test_cephfs"
+ And I go to the "Snapshots" tab
+ Then I should see an alert "No subvolumes are present" in the expanded row
+
+ Scenario: Create a CephFS Subvolume
+ Given I am on the "cephfs" page
+ When I expand the row "test_cephfs"
+ And I go to the "Subvolumes" tab
+ And I click on "Create" button from the expanded row
+ And enter "subvolumeName" "test_subvolume" in the modal
+ And I click on "Create Subvolume" button
+ Then I should see a row with "test_subvolume" in the expanded row
+
+ Scenario: Show the CephFS Snapshots view
+ Given I am on the "cephfs" page
+ When I expand the row "test_cephfs"
+ And I go to the "Snapshots" tab
+ Then I should see a table in the expanded row
+
+ Scenario: Remove a CephFS Subvolume
+ Given I am on the "cephfs" page
+ When I expand the row "test_cephfs"
+ And I go to the "Subvolumes" tab
+ When I select a row "test_subvolume" in the expanded row
+ And I click on "Remove" button from the table actions in the expanded row
+ And I check the tick box in modal
+ And I click on "Remove Subvolume" button
+ Then I should not see a row with "test_subvolume" in the expanded row
+
+ Scenario: Remove CephFS Volume
+ Given I am on the "cephfs" page
+ And I select a row "test_cephfs"
+ And I click on "Remove" button from the table actions
+ Then I should see the modal
+ And I check the tick box in modal
+ And I click on "Remove File System" button
+ Then I should not see a row with "test_cephfs"
And I click on "Create Subvolume group" button
Then I should see a row with "test_subvolume_group" in the expanded row
- Scenario: Edit a CephFS Subvolume
+ Scenario: Edit a CephFS Subvolume Group
Given I am on the "cephfs" page
When I expand the row "test_cephfs"
And I go to the "Subvolume groups" tab
And I click on "Edit Subvolume group" button
Then I should see row "test_subvolume_group" of the expanded row to have a usage bar
- Scenario: Remove a CephFS Subvolume
+ Scenario: Remove a CephFS Subvolume Group
Given I am on the "cephfs" page
When I expand the row "test_cephfs"
And I go to the "Subvolume groups" tab
-import { Component, Input, OnChanges, OnInit, ViewChild } from '@angular/core';
-import { Observable, ReplaySubject, of } from 'rxjs';
+import { Component, Input, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core';
+import { BehaviorSubject, Observable, of } from 'rxjs';
import { catchError, shareReplay, switchMap } from 'rxjs/operators';
import { CephfsSubvolumeGroupService } from '~/app/shared/api/cephfs-subvolume-group.service';
permissions: Permissions;
subvolumeGroup$: Observable<CephfsSubvolumeGroup[]>;
- subject = new ReplaySubject<CephfsSubvolumeGroup[]>();
+ subject = new BehaviorSubject<CephfsSubvolumeGroup[]>([]);
constructor(
private cephfsSubvolumeGroup: CephfsSubvolumeGroupService,
}
fetchData() {
- this.subject.next();
+ this.subject.next([]);
}
- ngOnChanges() {
- this.subject.next();
+ ngOnChanges(changes: SimpleChanges) {
+ if (changes.fsName) {
+ this.subject.next([]);
+ }
}
updateSelection(selection: CdTableSelection) {
-import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
-import { Observable, ReplaySubject, of } from 'rxjs';
-import { catchError, shareReplay, switchMap, tap } from 'rxjs/operators';
+import {
+ Component,
+ Input,
+ OnChanges,
+ OnInit,
+ SimpleChanges,
+ TemplateRef,
+ ViewChild
+} from '@angular/core';
+import { BehaviorSubject, Observable, of } from 'rxjs';
+import { catchError, switchMap, tap } from 'rxjs/operators';
import { CephfsSubvolumeService } from '~/app/shared/api/cephfs-subvolume.service';
import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
subVolumes$: Observable<CephfsSubvolume[]>;
subVolumeGroups$: Observable<CephfsSubvolumeGroup[]>;
- subject = new ReplaySubject<CephfsSubvolume[]>();
- groupsSubject = new ReplaySubject<CephfsSubvolume[]>();
+ subject = new BehaviorSubject<CephfsSubvolume[]>([]);
+ groupsSubject = new BehaviorSubject<CephfsSubvolume[]>([]);
subvolumeGroupList: string[] = [];
+ subVolumesList: CephfsSubvolume[] = [];
activeGroupName: string = '';
}
];
- this.getSubVolumes();
-
this.subVolumeGroups$ = this.groupsSubject.pipe(
switchMap(() =>
this.cephfsSubvolumeGroupService.get(this.fsName, false).pipe(
}
fetchData() {
- this.subject.next();
+ this.subject.next([]);
}
- ngOnChanges() {
- this.subject.next();
- this.groupsSubject.next();
+ ngOnChanges(changes: SimpleChanges) {
+ if (changes.fsName) {
+ this.subject.next([]);
+ this.groupsSubject.next([]);
+ }
}
updateSelection(selection: CdTableSelection) {
selectSubVolumeGroup(subVolumeGroupName: string) {
this.activeGroupName = subVolumeGroupName;
- this.getSubVolumes(subVolumeGroupName);
+ this.getSubVolumes();
}
- getSubVolumes(subVolumeGroupName = '') {
+ getSubVolumes() {
this.subVolumes$ = this.subject.pipe(
switchMap(() =>
- this.cephfsSubVolumeService.get(this.fsName, subVolumeGroupName).pipe(
+ this.cephfsSubVolumeService.get(this.fsName, this.activeGroupName).pipe(
catchError(() => {
this.context.error();
return of(null);
})
)
- ),
- shareReplay(1)
+ )
);
}
}
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
-import { Observable, ReplaySubject, forkJoin, of } from 'rxjs';
+import { BehaviorSubject, Observable, forkJoin, of } from 'rxjs';
import { catchError, shareReplay, switchMap, tap } from 'rxjs/operators';
import { CephfsSubvolumeGroupService } from '~/app/shared/api/cephfs-subvolume-group.service';
import { CephfsSubvolumeService } from '~/app/shared/api/cephfs-subvolume.service';
subVolumes$: Observable<CephfsSubvolume[]>;
snapshots$: Observable<any[]>;
- snapshotSubject = new ReplaySubject<SubvolumeSnapshot[]>();
- subVolumeSubject = new ReplaySubject<CephfsSubvolume[]>();
+ snapshotSubject = new BehaviorSubject<SubvolumeSnapshot[]>([]);
+ subVolumeSubject = new BehaviorSubject<CephfsSubvolume[]>([]);
subvolumeGroupList: string[] = [];
subVolumesList: string[];
.get(this.fsName)
.pipe(
switchMap((groups) => {
- // manually adding the group 'default' to the list.
+ // manually adding the group '_nogroup' to the list.
groups.unshift({ name: '' });
const observables = groups.map((group) =>
ngOnChanges(changes: SimpleChanges): void {
if (changes.fsName) {
- this.subVolumeSubject.next();
+ this.subVolumeSubject.next([]);
}
}
}
fetchData() {
- this.snapshotSubject.next();
+ this.snapshotSubject.next([]);
}
}
<a class="nav-link"
[class.active]="!activeItem"
(click)="selectItem()"
- *ngIf="item === ''">Default</a>
+ *ngIf="item === ''">_nogroup</a>
<a class="nav-link text-decoration-none text-break"
[class.active]="item === activeItem"
(click)="selectItem(item)"