<select class="form-control"
formControlName="access_type"
name="access_type"
- id="access_type">
+ id="access_type"
+ (change)="accessTypeChangeHandler()">
<option *ngIf="nfsAccessType === null"
value=""
i18n>Loading...</option>
*ngIf="nfsForm.getValue('access_type')">
{{ getAccessTypeHelp(nfsForm.getValue('access_type')) }}
</span>
+ <span class="text-warning"
+ *ngIf="nfsForm.getValue('access_type') === 'RW' && nfsForm.getValue('name') === 'RGW'"
+ i18n>The Object Gateway NFS backend has a number of
+ limitations which will seriously affect applications writing to
+ the share. Please consult the
+ <a href="{{docsUrl}}"
+ target="_blank"> documentation</a> for details before enabling write access.</span>
<span class="help-block"
*ngIf="nfsForm.showError('access_type', formDir, 'required')"
i18n>Required field</span>
import { ActivatedRouteStub } from '../../../../testing/activated-route-stub';
import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe';
import { SummaryService } from '../../../shared/services/summary.service';
import { SharedModule } from '../../../shared/shared.module';
import { NfsFormClientComponent } from '../nfs-form-client/nfs-form-client.component';
provide: ActivatedRoute,
useValue: new ActivatedRouteStub({ cluster_id: undefined, export_id: undefined })
},
- i18nProviders
+ i18nProviders,
+ SummaryService,
+ CephReleaseNamePipe
]
},
true
beforeEach(() => {
const summaryService = TestBed.get(SummaryService);
spyOn(summaryService, 'refresh').and.callFake(() => true);
+ spyOn(summaryService, 'getCurrentSummary').and.callFake(() => {
+ return {
+ version: 'master'
+ };
+ });
fixture = TestBed.createComponent(NfsFormComponent);
component = fixture.componentInstance;
import { CdValidators } from '../../../shared/forms/cd-validators';
import { FinishedTask } from '../../../shared/models/finished-task';
import { Permission } from '../../../shared/models/permissions';
+import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe';
import { AuthStorageService } from '../../../shared/services/auth-storage.service';
+import { SummaryService } from '../../../shared/services/summary.service';
import { TaskWrapperService } from '../../../shared/services/task-wrapper.service';
import { NfsFormClientComponent } from '../nfs-form-client/nfs-form-client.component';
allCephxClients: any[] = null;
allFsNames: any[] = null;
+ defaultAccessType = { RGW: 'RO' };
nfsAccessType: any[] = this.nfsService.nfsAccessType;
nfsSquash: any[] = this.nfsService.nfsSquash;
action: string;
resource: string;
+ docsUrl: string;
daemonsSelections: SelectOption[] = [];
daemonsMessages = new SelectMessages(
private router: Router,
private rgwUserService: RgwUserService,
private formBuilder: CdFormBuilder,
+ private summaryservice: SummaryService,
+ private cephReleaseNamePipe: CephReleaseNamePipe,
private taskWrapper: TaskWrapperService,
private cdRef: ChangeDetectorRef,
private i18n: I18n,
this.action = this.actionLabels.CREATE;
this.getData(promises);
}
+
+ const summary = this.summaryservice.getCurrentSummary();
+ const releaseName = this.cephReleaseNamePipe.transform(summary.version);
+ this.docsUrl = `http://docs.ceph.com/docs/${releaseName}/radosgw/nfs/`;
}
getData(promises) {
fsalChangeHandler() {
this.nfsForm.patchValue({
tag: this._generateTag(),
- pseudo: this._generatePseudo()
+ pseudo: this._generatePseudo(),
+ access_type: this._updateAccessType()
});
this.setPathValidation();
this.cdRef.detectChanges();
}
+ accessTypeChangeHandler() {
+ const name = this.nfsForm.getValue('name');
+ const accessType = this.nfsForm.getValue('access_type');
+ this.defaultAccessType[name] = accessType;
+ }
+
setPathValidation() {
if (this.nfsForm.getValue('name') === 'RGW') {
this.nfsForm
return newPseudo;
}
+ _updateAccessType() {
+ const name = this.nfsForm.getValue('name');
+ let accessType = this.defaultAccessType[name];
+
+ if (!accessType) {
+ accessType = 'RW';
+ }
+
+ return accessType;
+ }
+
onClusterChange() {
const cluster_id = this.nfsForm.getValue('cluster_id');
this.daemonsSelections = _.map(