]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: SMB - Edit Share.
authorDnyaneshwari <dnyaneshwari@li-9c9fbecc-2d5c-11b2-a85c-e2a7cc8a424f.ibm.com>
Thu, 20 Feb 2025 05:28:02 +0000 (10:58 +0530)
committerDnyaneshwari <dnyaneshwari@li-9c9fbecc-2d5c-11b2-a85c-e2a7cc8a424f.ibm.com>
Tue, 25 Feb 2025 04:20:18 +0000 (09:50 +0530)
Fixes: https://tracker.ceph.com/issues/70094
Signed-off-by: Dnyaneshwari Talwekar <dtalweka@redhat.com>
src/pybind/mgr/dashboard/controllers/smb.py
src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-share-form/smb-share-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-share-form/smb-share-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-share-list/smb-share-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb.model.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/smb.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.ts
src/pybind/mgr/dashboard/openapi.yaml

index 9020d4cbd194626c3e47ce5fc178b73a638f5af9..bc9323e9947c2c0f4043ad422bbf4e92461d70f8 100644 (file)
@@ -254,6 +254,19 @@ class SMBShare(RESTController):
         except RuntimeError as e:
             raise DashboardException(e, component='smb')
 
+    @ReadPermission
+    @EndpointDoc("Get an smb share",
+                 parameters={
+                     'cluster_id': (str, 'Unique identifier for the cluster'),
+                     'share_id': (str, 'Unique identifier for the share')
+                 },
+                 responses={200: SHARE_SCHEMA})
+    def get(self, cluster_id: str, share_id: str) -> Share:
+        """
+        Get an smb share by cluster and share id
+        """
+        return mgr.remote('smb', 'show', [f'{self._resource}.{cluster_id}.{share_id}'])
+
     @raise_on_failure
     @DeletePermission
     @EndpointDoc("Remove an smb share",
index c755dd4f871fe268356590b7b57c15b8004c8d4f..283d9e8f1a570d7b42023f05d2e1c9328d83c084 100644 (file)
@@ -477,7 +477,11 @@ const routes: Routes = [
               },
               {
                 path: `standalone/${URLVerbs.EDIT}/:usersGroupsId`,
-                component: SmbUsersgroupsFormComponent,
+                component: SmbUsersgroupsFormComponent
+              },
+              {
+                path: `share/${URLVerbs.EDIT}/:clusterId/:shareId`,
+                component: SmbShareFormComponent,
                 data: { breadcrumbs: ActionLabels.EDIT }
               }
             ]
index 3691116984d00b4426d75c13fcae71c8b438a32d..fb0ffee86072a8edac2df24f2ef404f81b3b9b7e 100644 (file)
 <div cdsCol
      [columnNumbers]="{ md: 4 }">
-  <form name="smbShareForm"
-        #formDir="ngForm"
-        [formGroup]="smbShareForm"
-        novalidate>
-    <div i18n="form title"
-         class="form-header">
-      {{ action | titlecase }} {{ resource | upperFirst }}
-    </div>
+  <ng-container *cdFormLoading="loading">
+    <form name="smbShareForm"
+          #formDir="ngForm"
+          [formGroup]="smbShareForm"
+          novalidate>
+      <div i18n="form title"
+           class="form-header">
+        {{ action | titlecase }} {{ resource | upperFirst }}
+      </div>
 
-    <!-- Share Id -->
-    <div class="form-item">
-      <cds-text-label
-        labelInputID="share_id"
-        i18n
-        helperText="Unique share identifier"
-        i18n-helperText
-        cdRequiredField="Share Name"
-        [invalid]="smbShareForm.controls.share_id.invalid && smbShareForm.controls.share_id.dirty"
-        [invalidText]="shareError"
-        >Share Name
-        <input
-          cdsText
-          type="text"
-          id="share_id"
-          formControlName="share_id"
-          [invalid]="smbShareForm.controls.share_id.invalid && smbShareForm.controls.share_id.dirty"
-        />
-      </cds-text-label>
-      <ng-template #shareError>
-        <span
-          class="invalid-feedback"
-          *ngIf="smbShareForm.showError('share_id', formDir, 'required')"
+      <!-- Share Id -->
+      <div class="form-item">
+        <cds-text-label
+          labelInputID="share_id"
           i18n
-          >This field is required.</span
-        >
-      </ng-template>
-    </div>
+          helperText="Unique share identifier"
+          i18n-helperText
+          cdRequiredField="Share Name"
+          [invalid]="smbShareForm.controls.share_id.invalid && smbShareForm.controls.share_id.dirty"
+          [invalidText]="shareError"
+          >Share Name
+          <input
+            cdsText
+            type="text"
+            id="share_id"
+            formControlName="share_id"
+            [invalid]="smbShareForm.controls.share_id.invalid && smbShareForm.controls.share_id.dirty"
+          />
+        </cds-text-label>
+        <ng-template #shareError>
+          <span
+            class="invalid-feedback"
+            *ngIf="smbShareForm.showError('share_id', formDir, 'required')"
+            i18n
+            >This field is required.</span
+          >
+        </ng-template>
+      </div>
 
-    <!-- Volume -->
-    <div class="form-item">
-      <cds-select
-        formControlName="volume"
-        label="Volume"
-        cdRequiredField="Volume"
-        id="volume"
-        (change)="volumeChangeHandler()"
-        [invalid]="smbShareForm.controls.volume.invalid && smbShareForm.controls.volume.dirty"
-        [invalidText]="volumeError"
-        i18n-label>
-        <option *ngIf="allFsNames?.length === 0"
-                value=""
-                i18n>
-          -- No filesystem available --
-        </option>
-        <option *ngIf="allFsNames !== null && allFsNames?.length > 0"
-                value=""
-                i18n>
-          -- Select the filesystem --
-        </option>
-        <option *ngFor="let filesystem of allFsNames"
-                [value]="filesystem.name"
-                i18n>
-          {{ filesystem.name }}
-        </option>
-      </cds-select>
-      <ng-template #volumeError>
-        <span
-          class="invalid-feedback"
-          *ngIf="smbShareForm.showError('volume', formDir, 'required')"
-          i18n
-          >This field is required.</span
-        >
-      </ng-template>
-    </div>
+      <!-- Volume -->
+      <div class="form-item">
+        <cds-select
+          formControlName="volume"
+          label="Volume"
+          cdRequiredField="Volume"
+          id="volume"
+          (change)="volumeChangeHandler()"
+          [invalid]="smbShareForm.controls.volume.invalid && smbShareForm.controls.volume.dirty"
+          [invalidText]="volumeError"
+          i18n-label>
+          <option *ngIf="allFsNames?.length === 0"
+                  value=""
+                  i18n>
+            -- No filesystem available --
+          </option>
+          <option *ngIf="allFsNames !== null && allFsNames?.length > 0"
+                  value=""
+                  i18n>
+            -- Select the filesystem --
+          </option>
+          <option *ngFor="let filesystem of allFsNames"
+                  [value]="filesystem.name"
+                  i18n>
+            {{ filesystem.name }}
+          </option>
+        </cds-select>
+        <ng-template #volumeError>
+          <span
+            class="invalid-feedback"
+            *ngIf="smbShareForm.showError('volume', formDir, 'required')"
+            i18n
+            >This field is required.</span
+          >
+        </ng-template>
+      </div>
 
-    <div class="form-item"
-         *ngIf="smbShareForm.getValue('volume')">
-      <cds-select
-        formControlName="subvolume_group"
-        label="Subvolume Group"
-        id="subvolume_group"
-        (change)="getSubVol()"
-        [skeleton]="allsubvolgrps === null"
-        i18n-label>
-        <option *ngIf="allsubvolgrps === null"
-                value=""
-                i18n>Loading...</option>
-        <option *ngIf="allsubvolgrps !== null && allsubvolgrps.length >= 0"
-                value=""
-                i18n>
-          -- Select the CephFS subvolume group --
-        </option>
-        <option
-          *ngFor="let subvol_grp of allsubvolgrps"
-          [value]="subvol_grp.name"
-          [selected]="subvol_grp.name === smbShareForm.get('subvolume_group').value"
-          i18n
-        >
-          {{ subvol_grp.name }}
-        </option>
-      </cds-select>
-    </div>
+      <div class="form-item"
+           *ngIf="smbShareForm.getValue('volume')">
+        <cds-select
+          formControlName="subvolume_group"
+          label="Subvolume Group"
+          id="subvolume_group"
+          (change)="getSubVol()"
+          [skeleton]="allsubvolgrps === null"
+          i18n-label>
+          <option *ngIf="allsubvolgrps === null"
+                  value=""
+                  i18n>Loading...</option>
+          <option *ngIf="allsubvolgrps !== null && allsubvolgrps.length >= 0"
+                  value=""
+                  i18n>
+            -- Select the CephFS subvolume group --
+          </option>
+          <option
+            *ngFor="let subvol_grp of allsubvolgrps"
+            [value]="subvol_grp.name"
+            [selected]="subvol_grp.name === smbShareForm.get('subvolume_group').value"
+            i18n
+          >
+            {{ subvol_grp.name }}
+          </option>
+        </cds-select>
+      </div>
 
-    <div class="form-group row"
-         *ngIf="smbShareForm.getValue('volume')">
-      <cds-select
-        formControlName="subvolume"
-        label="Subvolume"
-        id="subvolume"
-        (change)="setSubVolPath()"
-        [skeleton]="allsubvols === null"
-      >
-        <option *ngIf="allsubvols === null"
-                value=""
-                i18n>Loading...</option>
-        <option *ngIf="allsubvols !== null && allsubvols.length === 0"
-                value=""
-                i18n>
-          -- No SMB subvolume available --
-        </option>
-        <option *ngIf="allsubvols !== null && allsubvols.length > 0"
-                value=""
-                i18n>
-          -- Select the SMB subvolume --
-        </option>
-        <option
-          *ngFor="let subvolume of allsubvols"
-          [value]="subvolume.name"
-          [selected]="subvolume.name === smbShareForm.get('subvolume').value"
-          i18n
+      <div class="form-group row"
+           *ngIf="smbShareForm.getValue('volume')">
+        <cds-select
+          formControlName="subvolume"
+          label="Subvolume"
+          id="subvolume"
+          (change)="setSubVolPath()"
+          [skeleton]="allsubvols === null"
         >
-          {{ subvolume.name }}
-        </option>
-      </cds-select>
-    </div>
+          <option *ngIf="allsubvols === null"
+                  value=""
+                  i18n>Loading...</option>
+          <option *ngIf="allsubvols !== null && allsubvols.length === 0"
+                  value=""
+                  i18n>
+            -- No SMB subvolume available --
+          </option>
+          <option *ngIf="allsubvols !== null && allsubvols.length > 0"
+                  value=""
+                  i18n>
+            -- Select the SMB subvolume --
+          </option>
+          <option
+            *ngFor="let subvolume of allsubvols"
+            [value]="subvolume.name"
+            [selected]="subvolume.name === smbShareForm.get('subvolume').value"
+            i18n
+          >
+            {{ subvolume.name }}
+          </option>
+        </cds-select>
+      </div>
 
-  <!-- Path -->
-  <div class="form-item form-item-append"
-       cdsRow>
-    <div cdsCol>
-      <cds-text-label labelInputID="prefixedPath"
-                      i18n
-                      helperText="A path is a relative path.">Prefixed Path
-        <input cdsText
-               type="text"
-               id="prefixedPath"
-               formControlName="prefixedPath" />
-      </cds-text-label>
-    </div>
-    <div cdsCol>
-      <cds-text-label
-        labelInputID="inputPath"
-        i18n
-        [invalid]="
-          smbShareForm.controls.inputPath.invalid && smbShareForm.controls.inputPath.dirty
-        "
-        [invalidText]="pathError"
-        helperText="A relative path in a cephFS file system."
-        cdRequiredField="Path"
-        >Input Path
-        <input
-          cdsText
-          type="text"
-          id="inputPath"
-          formControlName="inputPath"
+    <!-- Path -->
+    <div class="form-item form-item-append"
+         cdsRow>
+      <div cdsCol>
+        <cds-text-label labelInputID="prefixedPath"
+                        i18n
+                        helperText="A path is a relative path.">Prefixed Path
+          <input cdsText
+                 type="text"
+                 id="prefixedPath"
+                 formControlName="prefixedPath" />
+        </cds-text-label>
+      </div>
+      <div cdsCol>
+        <cds-text-label
+          labelInputID="inputPath"
+          i18n
           [invalid]="
             smbShareForm.controls.inputPath.invalid && smbShareForm.controls.inputPath.dirty
           "
-        />
-      </cds-text-label>
-      <ng-template #pathError>
-        <span
-          class="invalid-feedback"
-          *ngIf="smbShareForm.showError('inputPath', formDir, 'required')"
-          i18n
-          >This field is required.</span
-        >
-        <span
-          class="invalid-feedback"
-          *ngIf="smbShareForm.showError('inputPath', formDir, 'pattern')"
-          i18n
-          >Path need to start with a '/' and can be followed by a word</span
-        >
-      </ng-template>
+          [invalidText]="pathError"
+          helperText="A relative path in a cephFS file system."
+          cdRequiredField="Path"
+          >Input Path
+          <input
+            cdsText
+            type="text"
+            id="inputPath"
+            formControlName="inputPath"
+            [invalid]="
+              smbShareForm.controls.inputPath.invalid && smbShareForm.controls.inputPath.dirty
+            "
+          />
+        </cds-text-label>
+        <ng-template #pathError>
+          <span
+            class="invalid-feedback"
+            *ngIf="smbShareForm.showError('inputPath', formDir, 'required')"
+            i18n
+            >This field is required.</span
+          >
+        </ng-template>
+      </div>
     </div>
-  </div>
 
-    <!-- Browseable -->
-    <div class="form-item">
-      <cds-checkbox id="browseable"
-                    formControlName="browseable"
-                    i18n>Browseable
-        <cd-help-text
-          >If selected the share will be included in share listings visible to
-          clients.</cd-help-text
-        >
-      </cds-checkbox>
-    </div>
+      <!-- Browseable -->
+      <div class="form-item">
+        <cds-checkbox id="browseable"
+                      formControlName="browseable"
+                      i18n>Browseable
+          <cd-help-text
+            >If selected the share will be included in share listings visible to
+            clients.</cd-help-text
+          >
+        </cds-checkbox>
+      </div>
 
-    <!-- Readonly -->
-    <div class="form-item">
-      <cds-checkbox id="readonly"
-                    formControlName="readonly"
-                    i18n>Readonly
-        <cd-help-text>If selected no clients are permitted to write to the share.</cd-help-text>
-      </cds-checkbox>
-    </div>
-    <cd-form-button-panel
-      (submitActionEvent)="submitAction()"
-      [form]="smbShareForm"
-      [submitText]="(action | titlecase) + ' ' + (resource | upperFirst)"
-      wrappingClass="text-right"
-    ></cd-form-button-panel>
-  </form>
+      <!-- Readonly -->
+      <div class="form-item">
+        <cds-checkbox id="readonly"
+                      formControlName="readonly"
+                      i18n>Readonly
+          <cd-help-text>If selected no clients are permitted to write to the share.</cd-help-text>
+        </cds-checkbox>
+      </div>
+      <cd-form-button-panel
+        (submitActionEvent)="submitAction()"
+        [form]="smbShareForm"
+        [submitText]="(action | titlecase) + ' ' + (resource | upperFirst)"
+        wrappingClass="text-right"
+      ></cd-form-button-panel>
+    </form>
+  </ng-container>
 </div>
index fce6e75b225e832492eb4345f6b88d348da8c01c..8c9ff5ea1089583b43cdbb9b5f212e3bda59d8c6 100644 (file)
@@ -11,7 +11,14 @@ import { map } from 'rxjs/operators';
 import { ActionLabelsI18n, URLVerbs } from '~/app/shared/constants/app.constants';
 import { FinishedTask } from '~/app/shared/models/finished-task';
 
-import { Filesystem, PROVIDER, SHARE_RESOURCE, ShareRequestModel } from '../smb.model';
+import {
+  Filesystem,
+  PROVIDER,
+  SHARE_RESOURCE,
+  SHARE_URL,
+  ShareRequestModel,
+  SMBShare
+} from '../smb.model';
 import { CephfsSubvolumeGroup } from '~/app/shared/models/cephfs-subvolume-group.model';
 import { CephfsSubvolume } from '~/app/shared/models/cephfs-subvolume.model';
 
@@ -34,6 +41,9 @@ export class SmbShareFormComponent extends CdForm implements OnInit {
   allsubvolgrps: CephfsSubvolumeGroup[] = [];
   allsubvols: CephfsSubvolume[] = [];
   clusterId: string;
+  isEdit = false;
+  share_id: string;
+  shareResponse: SMBShare;
 
   constructor(
     private formBuilder: CdFormBuilder,
@@ -48,16 +58,38 @@ export class SmbShareFormComponent extends CdForm implements OnInit {
   ) {
     super();
     this.resource = $localize`Share`;
+    this.isEdit = this.router.url.startsWith(`${SHARE_URL}${URLVerbs.EDIT}`);
+    this.action = this.isEdit ? this.actionLabels.EDIT : this.actionLabels.CREATE;
   }
   ngOnInit() {
-    this.action = this.actionLabels.CREATE;
-    this.route.params.subscribe((params: { clusterId: string }) => {
+    this.route.params.subscribe((params: any) => {
+      this.share_id = params.shareId;
       this.clusterId = params.clusterId;
     });
     this.nfsService.filesystems().subscribe((data: Filesystem[]) => {
       this.allFsNames = data;
     });
     this.createForm();
+    if (this.isEdit) {
+      this.smbService.getShare(this.clusterId, this.share_id).subscribe((resp: SMBShare) => {
+        this.shareResponse = resp;
+        this.smbShareForm.get('share_id').setValue(this.shareResponse.share_id);
+        this.smbShareForm.get('share_id').disable();
+        this.smbShareForm.get('volume').setValue(this.shareResponse.cephfs.volume);
+        this.smbShareForm.get('subvolume_group').setValue(this.shareResponse.cephfs.subvolumegroup);
+        this.smbShareForm.get('subvolume').setValue(this.shareResponse.cephfs.subvolume);
+        this.smbShareForm.get('inputPath').setValue(this.shareResponse.cephfs.path);
+        if (this.shareResponse.readonly) {
+          this.smbShareForm.get('readonly').setValue(this.shareResponse.readonly);
+        }
+        if (this.shareResponse.browseable) {
+          this.smbShareForm.get('browseable').setValue(this.shareResponse.browseable);
+        }
+
+        this.getSubVolGrp(this.shareResponse.cephfs.volume);
+      });
+    }
+    this.loadingReady();
   }
 
   createForm() {
@@ -100,6 +132,16 @@ export class SmbShareFormComponent extends CdForm implements OnInit {
     if (volume) {
       this.subvolgrpService.get(volume).subscribe((data: CephfsSubvolumeGroup[]) => {
         this.allsubvolgrps = data;
+        if (this.isEdit) {
+          const selectedSubVolGrp = this.shareResponse.cephfs.subvolumegroup;
+          if (selectedSubVolGrp && volume === this.shareResponse.cephfs.volume) {
+            const subvolGrp = this.allsubvolgrps.find((group) => group.name === selectedSubVolGrp);
+            if (subvolGrp) {
+              this.smbShareForm.get('subvolume_group').setValue(subvolGrp.name);
+              this.getSubVol();
+            }
+          }
+        }
       });
     }
   }
@@ -117,6 +159,16 @@ export class SmbShareFormComponent extends CdForm implements OnInit {
       await this.setSubVolPath();
       this.subvolService.get(volume, subvolgrp, false).subscribe((data: CephfsSubvolume[]) => {
         this.allsubvols = data;
+        if (this.isEdit) {
+          const selectedSubVol = this.shareResponse.cephfs.subvolume;
+          if (selectedSubVol && this.shareResponse.cephfs.subvolumegroup) {
+            const subvol = this.allsubvols.find((s) => s.name === selectedSubVol);
+            if (subvol) {
+              this.smbShareForm.get('subvolume').setValue(subvol.name);
+              this.setSubVolPath();
+            }
+          }
+        }
       });
     }
   }
@@ -147,11 +199,12 @@ export class SmbShareFormComponent extends CdForm implements OnInit {
   buildRequest() {
     const rawFormValue = _.cloneDeep(this.smbShareForm.value);
     const correctedPath = rawFormValue.inputPath;
+    const shareId = this.smbShareForm.get('share_id')?.value;
     const requestModel: ShareRequestModel = {
       share_resource: {
         resource_type: SHARE_RESOURCE,
         cluster_id: this.clusterId,
-        share_id: rawFormValue.share_id,
+        share_id: shareId,
         cephfs: {
           volume: rawFormValue.volume,
           path: correctedPath,
@@ -168,21 +221,29 @@ export class SmbShareFormComponent extends CdForm implements OnInit {
   }
 
   submitAction() {
-    const component = this;
+    if (this.isEdit) {
+      this.handleTaskRequest(URLVerbs.EDIT);
+    } else {
+      this.handleTaskRequest(URLVerbs.CREATE);
+    }
+  }
+
+  handleTaskRequest(urlVerb: string) {
     const requestModel = this.buildRequest();
     const BASE_URL = 'smb/share';
+    const component = this;
     const share_id = this.smbShareForm.get('share_id').value;
-    const taskUrl = `${BASE_URL}/${URLVerbs.CREATE}`;
+
     this.taskWrapperService
       .wrapTaskAroundCall({
-        task: new FinishedTask(taskUrl, { share_id }),
+        task: new FinishedTask(`${BASE_URL}/${urlVerb}`, { share_id }),
         call: this.smbService.createShare(requestModel)
       })
       .subscribe({
         complete: () => {
           this.router.navigate([`cephfs/smb`]);
         },
-        error() {
+        error: () => {
           component.smbShareForm.setErrors({ cdSubmitButton: true });
         }
       });
index 9b9aa86204a1eb7854e9ee84d9bc098ccec0c8c0..e37dd69ff042afdf231c4f966d990b94dabc5438 100644 (file)
@@ -6,13 +6,13 @@ 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 { Permission } from '~/app/shared/models/permissions';
-import { SMBShare } from '../smb.model';
+import { SHARE_URL, SMBShare } from '../smb.model';
 import { SmbService } from '~/app/shared/api/smb.service';
 import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
-import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
 import { CdTableSelection } from '~/app/shared/models/cd-table-selection';
-import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
+import { ActionLabelsI18n, URLVerbs } from '~/app/shared/constants/app.constants';
 import { Icons } from '~/app/shared/enum/icons.enum';
+import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
 import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { FinishedTask } from '~/app/shared/models/finished-task';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
@@ -96,6 +96,16 @@ export class SmbShareListComponent implements OnInit {
         routerLink: () => ['/cephfs/smb/share/create', this.clusterId],
         canBePrimary: (selection: CdTableSelection) => !selection.hasSingleSelection
       },
+      {
+        name: this.actionLabels.EDIT,
+        permission: 'update',
+        icon: Icons.edit,
+        routerLink: () => [
+          `${SHARE_URL}${URLVerbs.EDIT}`,
+          this.clusterId,
+          this.selection.first().name
+        ]
+      },
       {
         permission: 'delete',
         icon: Icons.destroy,
index 8f1ea56bbd504d061fee84cb5b5cf36808f6d5c3..58eb555b55a12fb08128596571412a0b2c5cadc3 100644 (file)
@@ -141,3 +141,5 @@ export const JOIN_AUTH_RESOURCE = 'ceph.smb.join.auth' as const;
 export const USERSGROUPS_RESOURCE = 'ceph.smb.usersgroups' as const;
 
 export const PROVIDER = 'samba-vfs';
+
+export const SHARE_URL = '/cephfs/smb/share/';
index d51196ced9cb9ed7d5969a94732f77d44879c8cd..960886ef55c807a6d74983e8aab7b3e79245c738 100644 (file)
@@ -56,6 +56,10 @@ export class SmbService {
     return this.http.post(`${this.baseURL}/share`, requestModel);
   }
 
+  getShare(cluster_id: string, share_id: string) {
+    return this.http.get(`${this.baseURL}/share/${cluster_id}/${share_id}`);
+  }
+
   deleteShare(clusterId: string, shareId: string): Observable<HttpResponse<null>> {
     return this.http.delete<null>(`${this.baseURL}/share/${clusterId}/${shareId}`, {
       observe: 'response'
index 281b3f714c981e2dd88894ba9e938c30fd54e798..6fb5a114821858d95258c0a59181c1de45b40152 100644 (file)
@@ -517,6 +517,9 @@ export class TaskMessageService {
     'smb/share/create': this.newTaskMessage(this.commonOperations.create, (metadata) =>
       this.smbShare(metadata)
     ),
+    'smb/share/edit': this.newTaskMessage(this.commonOperations.update, (metadata) =>
+      this.smbCluster(metadata)
+    ),
     'smb/share/delete': this.newTaskMessage(this.commonOperations.delete, (metadata) =>
       this.smbShare(metadata)
     ),
index 396efb70a7921d907c0bf42fa2f65e6cd328e24e..851f7d87cf9dc92419c99641cf82a3c29f8de277 100755 (executable)
@@ -15912,6 +15912,99 @@ paths:
       summary: Remove an smb share
       tags:
       - SMB
+    get:
+      description: "\n        Get an smb share by cluster and share id\n        "
+      parameters:
+      - description: Unique identifier for the cluster
+        in: path
+        name: cluster_id
+        required: true
+        schema:
+          type: string
+      - description: Unique identifier for the share
+        in: path
+        name: share_id
+        required: true
+        schema:
+          type: string
+      responses:
+        '200':
+          content:
+            application/vnd.ceph.api.v1.0+json:
+              schema:
+                properties:
+                  browseable:
+                    description: Indicates if the share is browseable
+                    type: boolean
+                  cephfs:
+                    description: Configuration for the CephFS share
+                    properties:
+                      path:
+                        description: Path within the CephFS file system
+                        type: string
+                      provider:
+                        description: Provider of the CephFS share, e.g., 'samba-vfs'
+                        type: string
+                      subvolume:
+                        description: Subvolume within the CephFS file system
+                        type: string
+                      subvolumegroup:
+                        description: Subvolume Group in CephFS file system
+                        type: string
+                      volume:
+                        description: Name of the CephFS file system
+                        type: string
+                    required:
+                    - volume
+                    - path
+                    - provider
+                    - subvolumegroup
+                    - subvolume
+                    type: object
+                  cluster_id:
+                    description: Unique identifier for the cluster
+                    type: string
+                  intent:
+                    description: Desired state of the resource, e.g., 'present' or
+                      'removed'
+                    type: string
+                  name:
+                    description: Name of the share
+                    type: string
+                  readonly:
+                    description: Indicates if the share is read-only
+                    type: boolean
+                  resource_type:
+                    description: ceph.smb.share
+                    type: string
+                  share_id:
+                    description: Unique identifier for the share
+                    type: string
+                required:
+                - resource_type
+                - cluster_id
+                - share_id
+                - intent
+                - name
+                - readonly
+                - browseable
+                - cephfs
+                type: object
+          description: OK
+        '400':
+          description: Operation exception. Please check the response body for details.
+        '401':
+          description: Unauthenticated access. Please login first.
+        '403':
+          description: Unauthorized access. Please check your permissions.
+        '500':
+          description: Unexpected error. Please check the response body for the stack
+            trace.
+      security:
+      - jwt: []
+      summary: Get an smb share
+      tags:
+      - SMB
   /api/smb/usersgroups:
     get:
       description: "\n        List all smb usersgroups resources\n\n        :return:\