From 6d3a33635d05f469fdb91cb7b7409ad7f02ae58d Mon Sep 17 00:00:00 2001 From: Rex Wang <109048808+RexWangPT@users.noreply.github.com> Date: Wed, 27 Jul 2022 21:04:31 +0800 Subject: [PATCH] EE-3694 update UI of docker/custom template (#7345) --- .../git-form-auth-fieldset.html | 3 +- .../createCustomTemplateView.html | 42 +++++++++---------- .../createCustomTemplateViewController.js | 3 +- .../customTemplatesView.html | 42 +++++++++---------- .../customTemplatesViewController.js | 4 +- .../editCustomTemplateView.html | 39 ++++++++--------- .../editCustomTemplateViewController.js | 3 +- app/react/components/buttons/AddButton.tsx | 6 ++- .../form-components/InputList/InputList.tsx | 5 ++- 9 files changed, 71 insertions(+), 76 deletions(-) diff --git a/app/portainer/components/forms/git-form/git-form-auth-fieldset/git-form-auth-fieldset.html b/app/portainer/components/forms/git-form/git-form-auth-fieldset/git-form-auth-fieldset.html index 8d9b4dc35..b8ba415de 100644 --- a/app/portainer/components/forms/git-form/git-form-auth-fieldset/git-form-auth-fieldset.html +++ b/app/portainer/components/forms/git-form/git-form-auth-fieldset/git-form-auth-fieldset.html @@ -1,6 +1,7 @@
-
+
Enabling authentication will store the credentials and it is advisable to use a git service account
diff --git a/app/portainer/views/custom-templates/create-custom-template-view/createCustomTemplateView.html b/app/portainer/views/custom-templates/create-custom-template-view/createCustomTemplateView.html index 5ee02b659..eeed469e3 100644 --- a/app/portainer/views/custom-templates/create-custom-template-view/createCustomTemplateView.html +++ b/app/portainer/views/custom-templates/create-custom-template-view/createCustomTemplateView.html @@ -16,7 +16,7 @@
Build method
-
+
@@ -53,27 +53,23 @@
-
-
Web editor
-
- + + + You can get more information about Compose file format in the official documentation . -
-
-
- -
-
-
+ +
@@ -84,9 +80,11 @@
- + {{ $ctrl.formValues.File.name }} - + + +
@@ -98,7 +96,7 @@
- + Template is invalid.
@@ -133,7 +131,7 @@ Create custom template Creation in progress... - + {{ $ctrl.state.formValidationError }}
diff --git a/app/portainer/views/custom-templates/create-custom-template-view/createCustomTemplateViewController.js b/app/portainer/views/custom-templates/create-custom-template-view/createCustomTemplateViewController.js index e0971784a..97b5aca90 100644 --- a/app/portainer/views/custom-templates/create-custom-template-view/createCustomTemplateViewController.js +++ b/app/portainer/views/custom-templates/create-custom-template-view/createCustomTemplateViewController.js @@ -171,8 +171,7 @@ class CreateCustomTemplateViewController { return this.CustomTemplateService.createCustomTemplateFromGitRepository(this.formValues); } - editorUpdate(cm) { - const value = cm.getValue(); + editorUpdate(value) { this.formValues.FileContent = value; this.state.isEditorDirty = true; this.parseTemplate(value); diff --git a/app/portainer/views/custom-templates/custom-templates-view/customTemplatesView.html b/app/portainer/views/custom-templates/custom-templates-view/customTemplatesView.html index 98ae467d0..e99aeb03c 100644 --- a/app/portainer/views/custom-templates/custom-templates-view/customTemplatesView.html +++ b/app/portainer/views/custom-templates/custom-templates-view/customTemplatesView.html @@ -20,37 +20,33 @@ -
- -
Web editor
-
- + + + + You can get more information about Compose file format in the official documentation . -
-
-
- -
-
- -
+ + +
diff --git a/app/portainer/views/custom-templates/custom-templates-view/customTemplatesViewController.js b/app/portainer/views/custom-templates/custom-templates-view/customTemplatesViewController.js index 48ee28352..560f00fd1 100644 --- a/app/portainer/views/custom-templates/custom-templates-view/customTemplatesViewController.js +++ b/app/portainer/views/custom-templates/custom-templates-view/customTemplatesViewController.js @@ -259,8 +259,8 @@ class CustomTemplatesViewController { } } - editorUpdate(cm) { - this.formValues.fileContent = cm.getValue(); + editorUpdate(value) { + this.formValues.fileContent = value; } isDeployable(endpoint, templateType) { diff --git a/app/portainer/views/custom-templates/edit-custom-template-view/editCustomTemplateView.html b/app/portainer/views/custom-templates/edit-custom-template-view/editCustomTemplateView.html index 329abfec4..b285f093a 100644 --- a/app/portainer/views/custom-templates/edit-custom-template-view/editCustomTemplateView.html +++ b/app/portainer/views/custom-templates/edit-custom-template-view/editCustomTemplateView.html @@ -8,31 +8,28 @@ -
Web editor
-
- - You can get more information about Compose file format in the - official documentation - . - -
-
-
- -
-
+ + + + You can get more information about Compose file format in the + official documentation + . + + +
- + Template is invalid.
@@ -64,7 +61,7 @@ Update the template Update in progress... - + {{ $ctrl.state.formValidationError }}
diff --git a/app/portainer/views/custom-templates/edit-custom-template-view/editCustomTemplateViewController.js b/app/portainer/views/custom-templates/edit-custom-template-view/editCustomTemplateViewController.js index 829afe54a..5cf31592d 100644 --- a/app/portainer/views/custom-templates/edit-custom-template-view/editCustomTemplateViewController.js +++ b/app/portainer/views/custom-templates/edit-custom-template-view/editCustomTemplateViewController.js @@ -120,8 +120,7 @@ class EditCustomTemplateViewController { } } - editorUpdate(cm) { - const value = cm.getValue(); + editorUpdate(value) { if (this.formValues.FileContent.replace(/(\r\n|\n|\r)/gm, '') !== value.replace(/(\r\n|\n|\r)/gm, '')) { this.formValues.FileContent = value; this.parseTemplate(value); diff --git a/app/react/components/buttons/AddButton.tsx b/app/react/components/buttons/AddButton.tsx index d94ae2446..51f6024d7 100644 --- a/app/react/components/buttons/AddButton.tsx +++ b/app/react/components/buttons/AddButton.tsx @@ -1,5 +1,7 @@ import clsx from 'clsx'; +import { Icon } from '@/react/components/Icon'; + import styles from './AddButton.module.css'; export interface Props { @@ -17,13 +19,15 @@ export function AddButton({ label, onClick, className, disabled }: Props) { 'label', 'label-default', 'interactive', + 'vertical-center', styles.addButton )} type="button" onClick={onClick} disabled={disabled} > -