fix(customtemplate): create from file (#4769)

* fix(customtemplate): receive File from api

* fix(customtemplate): return custom template

fix #4384
pull/4413/head
Chaim Lev-Ari 4 years ago committed by GitHub
parent 739dda1318
commit 45afe76bc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -251,7 +251,7 @@ func (payload *customTemplateFromFileUploadPayload) Validate(r *http.Request) er
}
payload.Type = templateType
composeFileContent, _, err := request.RetrieveMultiPartFormFile(r, "file")
composeFileContent, _, err := request.RetrieveMultiPartFormFile(r, "File")
if err != nil {
return errors.New("Invalid Compose file. Ensure that the Compose file is uploaded correctly")
}

@ -41,7 +41,8 @@ function CustomTemplateServiceFactory(CustomTemplates, FileUploadService) {
service.createCustomTemplateFromFileUpload = async function createCustomTemplateFromFileUpload(payload) {
try {
return await FileUploadService.createCustomTemplate(payload);
const { data } = await FileUploadService.createCustomTemplate(payload);
return data;
} catch (err) {
throw { msg: 'Unable to create the customTemplate', err };
}

@ -65,12 +65,12 @@ class CreateCustomTemplateViewController {
this.state.actionInProgress = true;
try {
const { ResourceControl } = await this.createCustomTemplateByMethod(method);
const customTemplate = await this.createCustomTemplateByMethod(method);
const accessControlData = this.formValues.AccessControlData;
const userDetails = this.Authentication.getUserDetails();
const userId = userDetails.ID;
await this.ResourceControlService.applyResourceControl(userId, accessControlData, ResourceControl);
await this.ResourceControlService.applyResourceControl(userId, accessControlData, customTemplate.ResourceControl);
this.Notifications.success('Custom template successfully created');
this.$state.go('docker.templates.custom');

Loading…
Cancel
Save