Skip to content

Commit aa4d6b5

Browse files
Naman MunetNaman Munet
authored andcommitted
mgr/dashboard: Expand Cluster improvements
worked on expand cluster screen hide/show and persisting osd form values Fixes: https://tracker.ceph.com/issues/66344 Signed-off-by: Naman Munet <[email protected]>
1 parent 98c986f commit aa4d6b5

File tree

17 files changed

+140
-33
lines changed

17 files changed

+140
-33
lines changed

src/pybind/mgr/dashboard/frontend/cypress/e2e/cluster/create-cluster.po.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { HostsPageHelper } from './hosts.po';
44
import { ServicesPageHelper } from './services.po';
55

66
const pages = {
7-
index: { url: '#/expand-cluster', id: 'cd-create-cluster' }
7+
index: { url: '#/expand-cluster?welcome=true', id: 'cd-create-cluster' }
88
};
99
export class CreateClusterWizardHelper extends PageHelper {
1010
pages = pages;
@@ -28,7 +28,7 @@ export class CreateClusterWizardHelper extends PageHelper {
2828

2929
export class CreateClusterHostPageHelper extends HostsPageHelper {
3030
pages = {
31-
index: { url: '#/expand-cluster', id: 'cd-wizard' },
31+
index: { url: '#/expand-cluster?welcome=true', id: 'cd-wizard' },
3232
add: { url: '', id: 'cd-host-form' }
3333
};
3434

@@ -42,7 +42,7 @@ export class CreateClusterHostPageHelper extends HostsPageHelper {
4242

4343
export class CreateClusterServicePageHelper extends ServicesPageHelper {
4444
pages = {
45-
index: { url: '#/expand-cluster', id: 'cd-wizard' },
45+
index: { url: '#/expand-cluster?welcome=true', id: 'cd-wizard' },
4646
create: { url: '', id: 'cd-service-form' }
4747
};
4848

src/pybind/mgr/dashboard/frontend/cypress/e2e/cluster/osds.po.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ export class OSDsPageHelper extends PageHelper {
1515

1616
create(deviceType: 'hdd' | 'ssd', hostname?: string, expandCluster = false) {
1717
cy.get('[aria-label="toggle advanced mode"]').click();
18+
cy.get('[aria-label="toggle advanced mode"]').then(($button) => {
19+
if ($button.hasClass('collapsed')) {
20+
cy.wrap($button).click();
21+
}
22+
});
1823
// Click Primary devices Add button
1924
cy.get('cd-osd-devices-selection-groups[name="Primary"]').as('primaryGroups');
2025
cy.get('@primaryGroups').find('button').click();

src/pybind/mgr/dashboard/frontend/cypress/e2e/common/urls.po.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { PageHelper } from '../page-helper.po';
33
export class UrlsCollection extends PageHelper {
44
pages = {
55
// Cluster expansion
6-
welcome: { url: '#/expand-cluster', id: 'cd-create-cluster' },
6+
welcome: { url: '#/expand-cluster?welcome=true', id: 'cd-create-cluster' },
77

88
// Landing page
99
dashboard: { url: '#/dashboard', id: 'cd-dashboard' },

src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/create-cluster/create-cluster-review.component.html

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@
99
class="bold">Hosts</td>
1010
<td>{{ hostsCount }}</td>
1111
</tr>
12-
<tr>
12+
<tr *ngIf="!isSimpleDeployment; else simpleDeploymentTextTpl">
1313
<td>
14-
<dl>
15-
<dt>
16-
<p i18n>Storage Capacity</p>
17-
</dt>
18-
<dd>
19-
<p i18n>Number of devices</p>
20-
</dd>
21-
<dd>
22-
<p i18n>Raw capacity</p>
23-
</dd>
24-
</dl>
25-
</td>
14+
<dl>
15+
<dt>
16+
<p i18n>Storage Capacity</p>
17+
</dt>
18+
<dd>
19+
<p i18n>Number of devices</p>
20+
</dd>
21+
<dd>
22+
<p i18n>Raw capacity</p>
23+
</dd>
24+
</dl>
25+
</td>
2626
<td class="pt-5"><p>{{ totalDevices }}</p><p>
2727
{{ totalCapacity | dimlessBinary }}</p></td>
2828
</tr>
@@ -40,13 +40,28 @@
4040
</fieldset>
4141
</div>
4242

43-
<div class="col-lg-9">
43+
<div class="col-lg-9">
4444
<legend i18n
4545
class="cd-header">Host Details</legend>
4646
<cd-hosts [hiddenColumns]="['services', 'status']"
4747
[hideToolHeader]="true"
4848
[hasTableDetails]="false"
49-
[showGeneralActionsOnly]="true">
50-
</cd-hosts>
51-
</div>
49+
[showGeneralActionsOnly]="true"
50+
[showExpandClusterBtn]="false">
51+
</cd-hosts>
52+
</div>
5253
</div>
54+
<ng-template #simpleDeploymentTextTpl>
55+
<tr>
56+
<td>
57+
<dl>
58+
<dt>
59+
<p i18n>Storage Capacity</p>
60+
</dt>
61+
<dd>
62+
<p i18n>{{deploymentDescText}}</p>
63+
</dd>
64+
</dl>
65+
</td>
66+
</tr>
67+
</ng-template>

src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/create-cluster/create-cluster-review.component.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export class CreateClusterReviewComponent implements OnInit {
2323
services: Array<CephServiceSpec> = [];
2424
totalCPUs = 0;
2525
totalMemory = 0;
26+
deploymentDescText: string;
27+
isSimpleDeployment = true;
2628

2729
constructor(
2830
public wizardStepsService: WizardStepsService,
@@ -40,6 +42,7 @@ export class CreateClusterReviewComponent implements OnInit {
4042
let dbDevices = 0;
4143
let dbDeviceCapacity = 0;
4244

45+
this.isSimpleDeployment = this.osdService.isDeployementModeSimple;
4346
const hostContext = new CdTableFetchDataContext(() => undefined);
4447
this.hostService.list(hostContext.toParams(), 'true').subscribe((resp: object[]) => {
4548
this.hosts = resp;
@@ -67,6 +70,21 @@ export class CreateClusterReviewComponent implements OnInit {
6770
dbDeviceCapacity = this.osdService.osdDevices['db']['capacity'];
6871
}
6972

73+
if (this.isSimpleDeployment) {
74+
this.osdService.getDeploymentOptions().subscribe((optionsObj) => {
75+
if (!_.isEmpty(optionsObj)) {
76+
Object.keys(optionsObj.options).forEach((option) => {
77+
if (
78+
this.osdService.selectedFormValues &&
79+
this.osdService.selectedFormValues.get('deploymentOption').value === option
80+
) {
81+
this.deploymentDescText = optionsObj.options[option].desc;
82+
}
83+
});
84+
}
85+
});
86+
}
87+
7088
this.totalDevices = dataDevices + walDevices + dbDevices;
7189
this.osdService.osdDevices['totalDevices'] = this.totalDevices;
7290
this.totalCapacity = dataDeviceCapacity + walDeviceCapacity + dbDeviceCapacity;

src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/create-cluster/create-cluster.component.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="container h-75"
2-
*ngIf="!startClusterCreation">
2+
*ngIf="startClusterCreation">
33
<div class="row h-100 justify-content-center align-items-center">
44
<div class="blank-page">
55
<!-- htmllint img-req-src="false" -->
@@ -30,7 +30,7 @@
3030
</div>
3131

3232
<div class="card"
33-
*ngIf="startClusterCreation">
33+
*ngIf="!startClusterCreation">
3434
<div class="card-header"
3535
i18n>Expand Cluster</div>
3636
<div class="container-fluid">
@@ -45,7 +45,8 @@
4545
<cd-hosts [hiddenColumns]="['services']"
4646
[hideMaintenance]="true"
4747
[hasTableDetails]="false"
48-
[showGeneralActionsOnly]="true"></cd-hosts>
48+
[showGeneralActionsOnly]="true"
49+
[showExpandClusterBtn]="false"></cd-hosts>
4950
</div>
5051
<div *ngSwitchCase="'2'"
5152
class="ms-5">

src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/create-cluster/create-cluster.component.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ describe('CreateClusterComponent', () => {
5959
});
6060

6161
it('should have project name as heading in welcome screen', () => {
62+
component.startClusterCreation = true;
63+
fixture.detectChanges();
6264
const heading = fixture.debugElement.query(By.css('h3')).nativeElement;
6365
expect(heading.innerHTML).toBe(`Welcome to ${projectConstants.projectName}`);
6466
});

src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/create-cluster/create-cluster.component.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
TemplateRef,
88
ViewChild
99
} from '@angular/core';
10-
import { Router } from '@angular/router';
10+
import { ActivatedRoute, Router } from '@angular/router';
1111

1212
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
1313
import _ from 'lodash';
@@ -68,7 +68,8 @@ export class CreateClusterComponent implements OnInit, OnDestroy {
6868
private clusterService: ClusterService,
6969
private modalService: ModalService,
7070
private taskWrapper: TaskWrapperService,
71-
private osdService: OsdService
71+
private osdService: OsdService,
72+
private route: ActivatedRoute
7273
) {
7374
this.permissions = this.authStorageService.getPermissions();
7475
this.currentStepSub = this.wizardStepsService
@@ -80,6 +81,14 @@ export class CreateClusterComponent implements OnInit, OnDestroy {
8081
}
8182

8283
ngOnInit(): void {
84+
this.route.queryParams.subscribe((params) => {
85+
// reading 'welcome' value true/false to toggle expand-cluster wizand view and welcome view
86+
const showWelcomeScreen = params['welcome'];
87+
if (showWelcomeScreen) {
88+
this.startClusterCreation = showWelcomeScreen;
89+
}
90+
});
91+
8392
this.osdService.getDeploymentOptions().subscribe((options) => {
8493
this.deploymentOption = options;
8594
this.selectedOption = { option: options.recommended_option, encrypted: false };
@@ -91,7 +100,7 @@ export class CreateClusterComponent implements OnInit, OnDestroy {
91100
}
92101

93102
createCluster() {
94-
this.startClusterCreation = true;
103+
this.startClusterCreation = false;
95104
}
96105

97106
skipClusterCreation() {
@@ -244,5 +253,6 @@ export class CreateClusterComponent implements OnInit, OnDestroy {
244253

245254
ngOnDestroy(): void {
246255
this.currentStepSub.unsubscribe();
256+
this.osdService.selectedFormValues = null;
247257
}
248258
}

src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
id="host-actions"
2727
[tableActions]="tableActions">
2828
</cd-table-actions>
29+
<cd-table-actions [permission]="permissions.hosts"
30+
[selection]="selection"
31+
btnColor="light"
32+
class="btn-group"
33+
[tableActions]="expandClusterActions">
34+
</cd-table-actions>
2935
</div>
3036
<cd-host-details cdTableDetail
3137
[permissions]="permissions"

src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,16 @@ export class HostsComponent extends ListWithDetails implements OnDestroy, OnInit
7878
@Input()
7979
showGeneralActionsOnly = false;
8080

81+
@Input()
82+
showExpandClusterBtn = true;
83+
8184
permissions: Permissions;
8285
columns: Array<CdTableColumn> = [];
8386
hosts: Array<object> = [];
8487
isLoadingHosts = false;
8588
cdParams = { fromLink: '/hosts' };
8689
tableActions: CdTableAction[];
90+
expandClusterActions: CdTableAction[];
8791
selection = new CdTableSelection();
8892
modalRef: NgbModalRef;
8993
isExecuting = false;
@@ -125,6 +129,16 @@ export class HostsComponent extends ListWithDetails implements OnDestroy, OnInit
125129
) {
126130
super();
127131
this.permissions = this.authStorageService.getPermissions();
132+
this.expandClusterActions = [
133+
{
134+
name: this.actionLabels.EXPAND_CLUSTER,
135+
permission: 'create',
136+
icon: Icons.expand,
137+
routerLink: '/expand-cluster',
138+
disable: (selection: CdTableSelection) => this.getDisable('add', selection),
139+
visible: () => this.showExpandClusterBtn
140+
}
141+
];
128142
this.tableActions = [
129143
{
130144
name: this.actionLabels.ADD,

0 commit comments

Comments
 (0)