mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
fix(customtemplate): create from file (#4769)
* fix(customtemplate): receive File from api * fix(customtemplate): return custom template fix #4384
This commit is contained in:
parent
739dda1318
commit
45afe76bc7
3 changed files with 5 additions and 4 deletions
|
@ -251,7 +251,7 @@ func (payload *customTemplateFromFileUploadPayload) Validate(r *http.Request) er
|
||||||
}
|
}
|
||||||
payload.Type = templateType
|
payload.Type = templateType
|
||||||
|
|
||||||
composeFileContent, _, err := request.RetrieveMultiPartFormFile(r, "file")
|
composeFileContent, _, err := request.RetrieveMultiPartFormFile(r, "File")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("Invalid Compose file. Ensure that the Compose file is uploaded correctly")
|
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) {
|
service.createCustomTemplateFromFileUpload = async function createCustomTemplateFromFileUpload(payload) {
|
||||||
try {
|
try {
|
||||||
return await FileUploadService.createCustomTemplate(payload);
|
const { data } = await FileUploadService.createCustomTemplate(payload);
|
||||||
|
return data;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw { msg: 'Unable to create the customTemplate', err };
|
throw { msg: 'Unable to create the customTemplate', err };
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,12 +65,12 @@ class CreateCustomTemplateViewController {
|
||||||
|
|
||||||
this.state.actionInProgress = true;
|
this.state.actionInProgress = true;
|
||||||
try {
|
try {
|
||||||
const { ResourceControl } = await this.createCustomTemplateByMethod(method);
|
const customTemplate = await this.createCustomTemplateByMethod(method);
|
||||||
|
|
||||||
const accessControlData = this.formValues.AccessControlData;
|
const accessControlData = this.formValues.AccessControlData;
|
||||||
const userDetails = this.Authentication.getUserDetails();
|
const userDetails = this.Authentication.getUserDetails();
|
||||||
const userId = userDetails.ID;
|
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.Notifications.success('Custom template successfully created');
|
||||||
this.$state.go('docker.templates.custom');
|
this.$state.go('docker.templates.custom');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue