mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 13:55:21 +02:00
feat(react): add FileUploadField and FileUploadForm components [EE-2336] (#6350)
This commit is contained in:
parent
07e7fbd270
commit
8dbb802fb1
14 changed files with 235 additions and 15 deletions
|
@ -213,6 +213,11 @@ export default class CreateEdgeStackViewController {
|
|||
}
|
||||
|
||||
formIsInvalid() {
|
||||
return this.form.$invalid || !this.formValues.Groups.length || (['template', 'editor'].includes(this.state.Method) && !this.formValues.StackFileContent);
|
||||
return (
|
||||
this.form.$invalid ||
|
||||
!this.formValues.Groups.length ||
|
||||
(['template', 'editor'].includes(this.state.Method) && !this.formValues.StackFileContent) ||
|
||||
('upload' === this.state.Method && !this.formValues.StackFile)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,9 @@ class DockerComposeFormController {
|
|||
}
|
||||
|
||||
onChangeFile(value) {
|
||||
this.formValues.StackFile = value;
|
||||
return this.$async(async () => {
|
||||
this.formValues.StackFile = value;
|
||||
});
|
||||
}
|
||||
|
||||
async $onInit() {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
class KubeManifestFormController {
|
||||
/* @ngInject */
|
||||
constructor() {
|
||||
constructor($async) {
|
||||
Object.assign(this, { $async });
|
||||
|
||||
this.methodOptions = [
|
||||
{ id: 'method_editor', icon: 'fa fa-edit', label: 'Web editor', description: 'Use our Web editor', value: 'editor' },
|
||||
{ id: 'method_upload', icon: 'fa fa-upload', label: 'Upload', description: 'Upload from your computer', value: 'upload' },
|
||||
|
@ -23,7 +25,9 @@ class KubeManifestFormController {
|
|||
}
|
||||
|
||||
onChangeFile(value) {
|
||||
this.formValues.StackFile = value;
|
||||
return this.$async(async () => {
|
||||
this.formValues.StackFile = value;
|
||||
});
|
||||
}
|
||||
|
||||
onChangeMethod(method) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue