children: [
{ path: '', component: SmbClusterListComponent },
{
- path: 'clusters',
- data: { breadcrumbs: 'Clusters' },
+ path: 'cluster',
+ data: { breadcrumbs: 'Cluster' },
children: [
{ path: '', component: SmbClusterListComponent },
{
import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
import { SmbDomainSettingModalComponent } from '../smb-domain-setting-modal/smb-domain-setting-modal.component';
import { CephServicePlacement } from '~/app/shared/models/service.interface';
-import { USERSGROUPS_URL } from '../smb-usersgroups-list/smb-usersgroups-list.component';
import { UpperFirstPipe } from '~/app/shared/pipes/upper-first.pipe';
+import { CLUSTER_PATH } from '../smb-cluster-list/smb-cluster-list.component';
+import { USERSGROUPS_PATH } from '../smb-usersgroups-list/smb-usersgroups-list.component';
@Component({
selector: 'cd-smb-cluster-form',
ngOnInit() {
this.action = this.actionLabels.CREATE;
this.usersGroups$ = this.smbService.listUsersGroups();
- if (this.router.url.startsWith(`/cephfs/smb/${URLVerbs.EDIT}`)) {
+ if (this.router.url.startsWith(`/${CLUSTER_PATH}/${URLVerbs.EDIT}`)) {
this.isEdit = true;
}
this.smbService.modalData$.subscribe((data: DomainSettings) => {
handleTaskRequest(urlVerb: string) {
const requestModel = this.buildRequest();
- const BASE_URL = 'smb/cluster';
const component = this;
const cluster_id = this.smbForm.get('cluster_id').value;
this.taskWrapperService
.wrapTaskAroundCall({
- task: new FinishedTask(`${BASE_URL}/${urlVerb}`, { cluster_id }),
+ task: new FinishedTask(`${CLUSTER_PATH}/${urlVerb}`, { cluster_id }),
call: this.smbService.createCluster(requestModel)
})
.subscribe({
complete: () => {
- this.router.navigate([`cephfs/smb`]);
+ this.router.navigate([CLUSTER_PATH]);
},
error: () => {
component.smbForm.setErrors({ cdSubmitButton: true });
}
navigateCreateUsersGroups() {
- this.router.navigate([`${USERSGROUPS_URL}/${URLVerbs.CREATE}`]);
+ this.router.navigate([`${USERSGROUPS_PATH}/${URLVerbs.CREATE}`]);
}
addCustomDns() {
import _ from 'lodash';
-import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
+import { ActionLabelsI18n, URLVerbs } from '~/app/shared/constants/app.constants';
import { TableComponent } from '~/app/shared/datatable/table/table.component';
import { CdTableAction } from '~/app/shared/models/cd-table-action';
import { CdTableColumn } from '~/app/shared/models/cd-table-column';
import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
import { FinishedTask } from '~/app/shared/models/finished-task';
-const BASE_URL = 'cephfs/smb/clusters';
+export const CLUSTER_PATH = 'cephfs/smb/cluster';
+
@Component({
selector: 'cd-smb-cluster-list',
templateUrl: './smb-cluster-list.component.html',
styleUrls: ['./smb-cluster-list.component.scss'],
- providers: [{ provide: URLBuilderService, useValue: new URLBuilderService(BASE_URL) }]
+ providers: [{ provide: URLBuilderService, useValue: new URLBuilderService(CLUSTER_PATH) }]
})
export class SmbClusterListComponent extends ListWithDetails implements OnInit {
@ViewChild('table', { static: true })
permission: 'delete',
icon: Icons.destroy,
click: () => this.removeSMBClusterModal(),
- name: this.actionLabels.REMOVE
+ name: this.actionLabels.DELETE
}
];
this.modalService.show(DeleteConfirmationModalComponent, {
itemDescription: $localize`Cluster`,
itemNames: [cluster_id],
- actionDescription: $localize`remove`,
submitActionObservable: () =>
this.taskWrapper.wrapTaskAroundCall({
- task: new FinishedTask('smb/cluster/remove', {
+ task: new FinishedTask(`${CLUSTER_PATH}/${URLVerbs.DELETE}`, {
cluster_id: cluster_id
}),
call: this.smbService.removeCluster(cluster_id)
import { DomainSettings, JoinSource, SMBJoinAuth } from '../smb.model';
import { Observable } from 'rxjs';
import { Router } from '@angular/router';
-import { JOINAUTH_URL } from '../smb-join-auth-list/smb-join-auth-list.component';
+import { JOIN_AUTH_PATH } from '../smb-join-auth-list/smb-join-auth-list.component';
@Component({
selector: 'cd-smb-domain-setting-modal',
navigateCreateJoinSource() {
this.closeModal();
- this.router.navigate([`${JOINAUTH_URL}/${URLVerbs.CREATE}`]);
+ this.router.navigate([`${JOIN_AUTH_PATH}/${URLVerbs.CREATE}`]);
}
removeJoinSource(index: number) {
it('should get resource data and set form fields with it', () => {
expect(getJoinAuth).toHaveBeenCalled();
- expect(component.form.value).toEqual({
+ expect(component.form.getRawValue()).toEqual({
authId: 'foo',
username: 'user',
password: 'pass',
import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
import { JOIN_AUTH_RESOURCE, SMBCluster, SMBJoinAuth } from '../smb.model';
import { Observable } from 'rxjs';
-import { JOINAUTH_URL } from '../smb-join-auth-list/smb-join-auth-list.component';
+import { JOIN_AUTH_PATH } from '../smb-join-auth-list/smb-join-auth-list.component';
import { Location } from '@angular/common';
@Component({
private location: Location
) {
super();
- this.editing = this.router.url.startsWith(`${JOINAUTH_URL}/${URLVerbs.EDIT}`);
+ this.editing = this.router.url.startsWith(`/${JOIN_AUTH_PATH}/${URLVerbs.EDIT}`);
this.resource = $localize`Active directory (AD) access resource`;
}
if (this.editing) {
this.action = this.actionLabels.UPDATE;
+ this.form.get('authId').disable();
let editingAuthId: string;
this.route.params.subscribe((params: { authId: string }) => {
editingAuthId = params.authId;
const username = this.form.getValue('username');
const password = this.form.getValue('password');
const linkedToCluster = this.form.getValue('linkedToCluster');
- const BASE_URL = 'smb/ad/';
const joinAuth: SMBJoinAuth = {
resource_type: JOIN_AUTH_RESOURCE,
};
const self = this;
- let taskUrl = `${BASE_URL}${this.editing ? URLVerbs.EDIT : URLVerbs.CREATE}`;
+ let taskUrl = `${JOIN_AUTH_PATH}/${this.editing ? URLVerbs.EDIT : URLVerbs.CREATE}`;
this.taskWrapperService
.wrapTaskAroundCall({
task: new FinishedTask(taskUrl, {
import { Observable, BehaviorSubject, of } from 'rxjs';
import { switchMap, catchError } from 'rxjs/operators';
import { SmbService } from '~/app/shared/api/smb.service';
-import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
+import { ActionLabelsI18n, URLVerbs } from '~/app/shared/constants/app.constants';
import { CdTableAction } from '~/app/shared/models/cd-table-action';
import { CdTableColumn } from '~/app/shared/models/cd-table-column';
import { CdTableFetchDataContext } from '~/app/shared/models/cd-table-fetch-data-context';
import { FinishedTask } from '~/app/shared/models/finished-task';
import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
-export const JOINAUTH_URL = '/cephfs/smb/active-directory';
+export const JOIN_AUTH_PATH = 'cephfs/smb/active-directory';
@Component({
selector: 'cd-smb-join-auth-list',
templateUrl: './smb-join-auth-list.component.html',
styleUrls: ['./smb-join-auth-list.component.scss'],
- providers: [{ provide: URLBuilderService, useValue: new URLBuilderService(JOINAUTH_URL) }]
+ providers: [{ provide: URLBuilderService, useValue: new URLBuilderService(JOIN_AUTH_PATH) }]
})
export class SmbJoinAuthListComponent implements OnInit {
columns: CdTableColumn[];
itemNames: [authId],
submitActionObservable: () =>
this.taskWrapper.wrapTaskAroundCall({
- task: new FinishedTask('smb/ad/remove', {
+ task: new FinishedTask(`${JOIN_AUTH_PATH}/${URLVerbs.DELETE}`, {
authId: authId
}),
call: this.smbService.deleteJoinAuth(authId)
import { ActionLabelsI18n, URLVerbs } from '~/app/shared/constants/app.constants';
import { FinishedTask } from '~/app/shared/models/finished-task';
-import {
- Filesystem,
- PROVIDER,
- SHARE_RESOURCE,
- SHARE_URL,
- ShareRequestModel,
- SMBShare
-} from '../smb.model';
+import { Filesystem, PROVIDER, SHARE_RESOURCE, ShareRequestModel, SMBShare } from '../smb.model';
import { CephfsSubvolumeGroup } from '~/app/shared/models/cephfs-subvolume-group.model';
import { CephfsSubvolume } from '~/app/shared/models/cephfs-subvolume.model';
import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
import { CephfsSubvolumeGroupService } from '~/app/shared/api/cephfs-subvolume-group.service';
import { CephfsSubvolumeService } from '~/app/shared/api/cephfs-subvolume.service';
+import { CLUSTER_PATH } from '../smb-cluster-list/smb-cluster-list.component';
+import { SHARE_PATH } from '../smb-share-list/smb-share-list.component';
@Component({
selector: 'cd-smb-share-form',
) {
super();
this.resource = $localize`Share`;
- this.isEdit = this.router.url.startsWith(`${SHARE_URL}${URLVerbs.EDIT}`);
+ this.isEdit = this.router.url.startsWith(`/${SHARE_PATH}/${URLVerbs.EDIT}`);
this.action = this.isEdit ? this.actionLabels.EDIT : this.actionLabels.CREATE;
}
ngOnInit() {
handleTaskRequest(urlVerb: string) {
const requestModel = this.buildRequest();
- const BASE_URL = 'smb/share';
const component = this;
const share_id = this.smbShareForm.get('share_id').value;
this.taskWrapperService
.wrapTaskAroundCall({
- task: new FinishedTask(`${BASE_URL}/${urlVerb}`, { share_id }),
+ task: new FinishedTask(`${SHARE_PATH}/${urlVerb}`, { share_id }),
call: this.smbService.createShare(requestModel)
})
.subscribe({
complete: () => {
- this.router.navigate([`cephfs/smb`]);
+ this.router.navigate([CLUSTER_PATH]);
},
error: () => {
component.smbShareForm.setErrors({ cdSubmitButton: true });
import { CdTableColumn } from '~/app/shared/models/cd-table-column';
import { CdTableFetchDataContext } from '~/app/shared/models/cd-table-fetch-data-context';
import { Permission } from '~/app/shared/models/permissions';
-import { SHARE_URL, SMBShare } from '../smb.model';
+import { SMBShare } from '../smb.model';
import { SmbService } from '~/app/shared/api/smb.service';
import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
import { CdTableSelection } from '~/app/shared/models/cd-table-selection';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
+export const SHARE_PATH = 'cephfs/smb/share';
+
@Component({
selector: 'cd-smb-share-list',
templateUrl: './smb-share-list.component.html',
name: `${this.actionLabels.CREATE}`,
permission: 'create',
icon: Icons.add,
- routerLink: () => ['/cephfs/smb/share/create', this.clusterId],
+ routerLink: () => [`/${SHARE_PATH}/${URLVerbs.CREATE}`, this.clusterId],
canBePrimary: (selection: CdTableSelection) => !selection.hasSingleSelection
},
{
permission: 'update',
icon: Icons.edit,
routerLink: () => [
- `${SHARE_URL}${URLVerbs.EDIT}`,
+ `/${SHARE_PATH}/${URLVerbs.EDIT}`,
this.clusterId,
this.selection.first().name
]
itemNames: [`Share: ${share_id} (${name}) from cluster: ${cluster_id}`],
submitActionObservable: () =>
this.taskWrapper.wrapTaskAroundCall({
- task: new FinishedTask('smb/share/delete', {
+ task: new FinishedTask(`${SHARE_PATH}/${URLVerbs.DELETE}`, {
share_id: share_id
}),
call: this.smbService.deleteShare(cluster_id, share_id)
isNavigation="true"
[cacheActive]="false">
<cds-tab
- heading="Clusters"
+ heading="Cluster"
i18n-heading
- [active]="activeTab === Tabs.clusters"
- (selected)="onSelected(Tabs.clusters)">
+ [active]="activeTab === Tabs.cluster"
+ (selected)="onSelected(Tabs.cluster)">
</cds-tab>
<cds-tab
heading="Active Directory"
it('should display the heading text in the tab', () => {
const tabs = fixture.debugElement.queryAll(By.css('cds-tab'));
expect(tabs.length).toBe(4);
- expect(tabs[0].attributes['heading']).toBe('Clusters');
+ expect(tabs[0].attributes['heading']).toBe('Cluster');
expect(tabs[1].attributes['heading']).toBe('Active Directory');
expect(tabs[2].attributes['heading']).toBe('Standalone');
expect(tabs[3].attributes['heading']).toBe('Overview');
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
+const SMB_PATH = 'cephfs/smb';
+
enum TABS {
- clusters = 'clusters',
+ cluster = 'cluster',
activeDirectory = 'active-directory',
standalone = 'standalone',
overview = 'overview'
})
export class SmbTabsComponent implements OnInit {
selectedTab: TABS;
- activeTab: TABS = TABS.clusters;
+ activeTab: TABS = TABS.cluster;
constructor(private router: Router) {}
ngOnInit(): void {
const currentPath = this.router.url;
- this.activeTab = Object.values(TABS).find((tab) => currentPath.includes(tab)) || TABS.clusters;
+ this.activeTab = Object.values(TABS).find((tab) => currentPath.includes(tab)) || TABS.cluster;
}
onSelected(tab: TABS) {
this.selectedTab = tab;
- this.router.navigate([`/cephfs/smb/${tab}`]);
+ this.router.navigate([`${SMB_PATH}/${tab}`]);
}
public get Tabs(): typeof TABS {
it('should get resource data and set form fields with it', () => {
expect(getUsersGroups).toHaveBeenCalled();
- expect(component.form.value).toEqual({
+ expect(component.form.getRawValue()).toEqual({
usersGroupsId: 'foo',
users: [
{
import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
import { Group, SMBCluster, SMBUsersGroups, User, USERSGROUPS_RESOURCE } from '../smb.model';
import { Location } from '@angular/common';
-import { USERSGROUPS_URL } from '../smb-usersgroups-list/smb-usersgroups-list.component';
+import { USERSGROUPS_PATH } from '../smb-usersgroups-list/smb-usersgroups-list.component';
@Component({
selector: 'cd-smb-usersgroups-form',
private location: Location
) {
super();
- this.editing = this.router.url.startsWith(`${USERSGROUPS_URL}/${URLVerbs.EDIT}`);
+ this.editing = this.router.url.startsWith(`/${USERSGROUPS_PATH}/${URLVerbs.EDIT}`);
this.resource = $localize`users and groups access resource`;
effect(() => {
const formData = this.uploadedData();
this.createForm();
if (this.editing) {
this.action = this.actionLabels.UPDATE;
+ this.form.get('usersGroupsId').disable();
let editingUsersGroupId: string;
this.route.params.subscribe((params: { usersGroupsId: string }) => {
editingUsersGroupId = params.usersGroupsId;
};
const self = this;
- const BASE_URL = 'smb/standalone/';
- let taskUrl = `${BASE_URL}${this.editing ? URLVerbs.EDIT : URLVerbs.CREATE}`;
+ let taskUrl = `${USERSGROUPS_PATH}/${this.editing ? URLVerbs.EDIT : URLVerbs.CREATE}`;
this.taskWrapperService
.wrapTaskAroundCall({
task: new FinishedTask(taskUrl, {
import _ from 'lodash';
-import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
+import { ActionLabelsI18n, URLVerbs } from '~/app/shared/constants/app.constants';
import { CdTableAction } from '~/app/shared/models/cd-table-action';
import { CdTableColumn } from '~/app/shared/models/cd-table-column';
import { CdTableFetchDataContext } from '~/app/shared/models/cd-table-fetch-data-context';
import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
-export const USERSGROUPS_URL = '/cephfs/smb/standalone';
+export const USERSGROUPS_PATH = 'cephfs/smb/standalone';
@Component({
selector: 'cd-smb-users-list',
templateUrl: './smb-usersgroups-list.component.html',
styleUrls: ['./smb-usersgroups-list.component.scss'],
- providers: [{ provide: URLBuilderService, useValue: new URLBuilderService(USERSGROUPS_URL) }]
+ providers: [{ provide: URLBuilderService, useValue: new URLBuilderService(USERSGROUPS_PATH) }]
})
export class SmbUsersgroupsListComponent extends ListWithDetails implements OnInit {
@ViewChild('groupsNamesTpl', { static: true })
itemNames: [usersGroupsId],
submitActionObservable: () =>
this.taskWrapper.wrapTaskAroundCall({
- task: new FinishedTask('smb/standalone/remove', {
+ task: new FinishedTask(`${USERSGROUPS_PATH}/${URLVerbs.DELETE}`, {
usersGroupsId: usersGroupsId
}),
call: this.smbService.deleteUsersgroups(usersGroupsId)
export const PROVIDER = 'samba-vfs';
-export const SHARE_URL = '/cephfs/smb/share/';
-
type Clustering = 'default' | 'never' | 'always';
'nfs/delete': this.newTaskMessage(this.commonOperations.delete, (metadata) =>
this.nfs(metadata)
),
- // smb
- 'smb/cluster/remove': this.newTaskMessage(this.commonOperations.remove, (metadata) =>
- this.smbCluster(metadata)
- ),
- 'smb/ad/create': this.newTaskMessage(this.commonOperations.create, (metadata) =>
- this.smbJoinAuth(metadata)
- ),
- 'smb/ad/edit': this.newTaskMessage(this.commonOperations.update, (metadata) =>
- this.smbJoinAuth(metadata)
- ),
- 'smb/ad/remove': this.newTaskMessage(this.commonOperations.remove, (metadata) =>
- this.smbJoinAuth(metadata)
- ),
- 'smb/standalone/create': this.newTaskMessage(this.commonOperations.create, (metadata) =>
- this.smbUsersgroups(metadata)
- ),
- 'smb/standalone/edit': this.newTaskMessage(this.commonOperations.update, (metadata) =>
- this.smbUsersgroups(metadata)
- ),
- 'smb/standalone/remove': this.newTaskMessage(this.commonOperations.remove, (metadata) =>
- this.smbUsersgroups(metadata)
- ),
// Grafana tasks
'grafana/dashboards/update': this.newTaskMessage(
this.commonOperations.update,
(metadata) => this.snapshotSchedule(metadata)
),
// smb
- 'smb/cluster/create': this.newTaskMessage(this.commonOperations.create, (metadata) =>
- this.smbCluster(metadata)
+ 'cephfs/smb/cluster/create': this.newTaskMessage(
+ this.commonOperations.create,
+ (metadata: { cluster_id: string }) => this.smbCluster(metadata)
),
- 'smb/share/create': this.newTaskMessage(this.commonOperations.create, (metadata) =>
- this.smbShare(metadata)
+ 'cephfs/smb/cluster/edit': this.newTaskMessage(
+ this.commonOperations.update,
+ (metadata: { cluster_id: string }) => this.smbCluster(metadata)
+ ),
+ 'cephfs/smb/cluster/delete': this.newTaskMessage(
+ this.commonOperations.delete,
+ (metadata: { cluster_id: string }) => this.smbCluster(metadata)
),
- 'smb/share/edit': this.newTaskMessage(this.commonOperations.update, (metadata) =>
- this.smbCluster(metadata)
+ 'cephfs/smb/share/create': this.newTaskMessage(
+ this.commonOperations.create,
+ (metadata: Record<'share_id', string>) => this.smbShare(metadata)
),
- 'smb/share/delete': this.newTaskMessage(this.commonOperations.delete, (metadata) =>
- this.smbShare(metadata)
+ 'cephfs/smb/share/edit': this.newTaskMessage(
+ this.commonOperations.update,
+ (metadata: Record<'share_id', string>) => this.smbShare(metadata)
),
- 'cephfs/smb/joinauth/create': this.newTaskMessage(this.commonOperations.create, (metadata) =>
- this.smbJoinAuth(metadata)
+ 'cephfs/smb/share/delete': this.newTaskMessage(
+ this.commonOperations.delete,
+ (metadata: Record<'share_id', string>) => this.smbShare(metadata)
),
- 'cephfs/smb/standalone/create': this.newTaskMessage(this.commonOperations.create, (metadata) =>
- this.smbUsersgroups(metadata)
+ 'cephfs/smb/active-directory/create': this.newTaskMessage(
+ this.commonOperations.create,
+ (metadata: { authId: string }) => this.smbJoinAuth(metadata)
),
- 'smb/cluster/edit': this.newTaskMessage(this.commonOperations.update, (metadata) =>
- this.smbCluster(metadata)
+ 'cephfs/smb/active-directory/edit': this.newTaskMessage(
+ this.commonOperations.update,
+ (metadata: { authId: string }) => this.smbJoinAuth(metadata)
+ ),
+ 'cephfs/smb/active-directory/delete': this.newTaskMessage(
+ this.commonOperations.delete,
+ (metadata: { authId: string }) => this.smbJoinAuth(metadata)
+ ),
+ 'cephfs/smb/standalone/create': this.newTaskMessage(
+ this.commonOperations.create,
+ (metadata: { usersGroupsId: string }) => this.smbUsersgroups(metadata)
+ ),
+ 'cephfs/smb/standalone/edit': this.newTaskMessage(
+ this.commonOperations.update,
+ (metadata: { usersGroupsId: string }) => this.smbUsersgroups(metadata)
+ ),
+ 'cephfs/smb/standalone/delete': this.newTaskMessage(
+ this.commonOperations.delete,
+ (metadata: { usersGroupsId: string }) => this.smbUsersgroups(metadata)
)
};
}
smbCluster(metadata: { cluster_id: string }) {
- return $localize`SMB Cluster '${metadata.cluster_id}'`;
+ return $localize`SMB cluster '${metadata.cluster_id}'`;
+ }
+
+ smbShare(metadata: Record<'share_id', string>) {
+ return $localize`SMB share '${metadata?.share_id}'`;
}
smbJoinAuth(metadata: { authId: string }) {
return $localize`snapshot schedule for path '${metadata?.path}'`;
}
- smbShare(metadata: Record<'share_id', string>) {
- return $localize`SMB share '${metadata?.share_id}'`;
- }
-
crudMessageId(id: string) {
return $localize`${id}`;
}