You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by pi...@apache.org on 2021/11/23 06:38:03 UTC

[submarine] branch master updated: SUBMARINE-1065. Fix Manager-User Cannot Submit Changes

This is an automated email from the ASF dual-hosted git repository.

pingsutw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new 2fac1a9  SUBMARINE-1065. Fix Manager-User Cannot Submit Changes
2fac1a9 is described below

commit 2fac1a927b9601378453a1eb09301bc32d52ceee
Author: atosystem <at...@hotmail.com>
AuthorDate: Tue Nov 23 13:07:38 2021 +0800

    SUBMARINE-1065. Fix Manager-User Cannot Submit Changes
    
    ### What is this PR for?
    1. Fix the bug that workbench manager-user cannot submit changes
    The error is that the password validator still working in edit mode, but the password value in edit mode is a hash value. Hence, the validation won't pass.
    2. Change the order of `Manager` and `Model` on the side menu of Workbench.
    
    ### What type of PR is it?
    [Bug Fix]
    
    ### Todos
    
    ### What is the Jira issue?
    [https://issues.apache.org/jira/browse/SUBMARINE-1065](https://issues.apache.org/jira/browse/SUBMARINE-1065)
    
    ### How should this be tested?
    
    ### Screenshots (if appropriate)
    
    ![bugfixed](https://user-images.githubusercontent.com/32225867/142971792-c55763a5-a605-40bc-9f8b-29997f0df9dc.gif)
    > This animation is recorded before the update of sidebar order.
    
    ### Questions:
    * Do the license files need updating? No
    * Are there breaking changes for older versions? No
    * Does this need new documentation? No
    
    Author: atosystem <at...@hotmail.com>
    
    Signed-off-by: Kevin <pi...@apache.org>
    
    Closes #809 from atosystem/SUBMARINE-1065 and squashes the following commits:
    
    3af32c87 [atosystem] SUBMARINE-1065. change order of 'Model' and 'Data' on workbench sidebarMenu
    e2132248 [atosystem] SUBMARINE-1065. Add: change validators conditionally
---
 .../workbench/manager/user-drawer/user-drawer.component.ts   |  9 ++++++++-
 .../src/app/pages/workbench/workbench.component.ts           | 12 ++++++------
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/submarine-workbench/workbench-web/src/app/pages/workbench/manager/user-drawer/user-drawer.component.ts b/submarine-workbench/workbench-web/src/app/pages/workbench/manager/user-drawer/user-drawer.component.ts
index a4fc3f2..21006de 100644
--- a/submarine-workbench/workbench-web/src/app/pages/workbench/manager/user-drawer/user-drawer.component.ts
+++ b/submarine-workbench/workbench-web/src/app/pages/workbench/manager/user-drawer/user-drawer.component.ts
@@ -97,6 +97,14 @@ export class UserDrawerComponent implements OnInit, OnChanges {
       const sysUser = this.sysUser;
       const readOnly = this.readonly;
 
+      // change validators for insert mode or edit mode
+      this.form.controls.password.clearValidators()
+      if (sysUser) {
+        this.form.controls.password.setValidators([Validators.required])
+      } else {
+        this.form.controls.password.setValidators([Validators.required, Validators.pattern(/^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,}$/)])
+      }
+
       this.form.reset({
         userName: sysUser ? sysUser.userName : '',
         password: sysUser ? sysUser.password : '',
@@ -134,7 +142,6 @@ export class UserDrawerComponent implements OnInit, OnChanges {
       this.form.controls[key].markAsDirty();
       this.form.controls[key].updateValueAndValidity();
     }
-
     this.form.statusChanges
       .pipe(
         startWith(this.form.status),
diff --git a/submarine-workbench/workbench-web/src/app/pages/workbench/workbench.component.ts b/submarine-workbench/workbench-web/src/app/pages/workbench/workbench.component.ts
index 026f794..f177201 100644
--- a/submarine-workbench/workbench-web/src/app/pages/workbench/workbench.component.ts
+++ b/submarine-workbench/workbench-web/src/app/pages/workbench/workbench.component.ts
@@ -99,18 +99,18 @@ export class WorkbenchComponent implements OnInit {
       ],
     },
     {
-      title: 'Data',
-      iconType: 'bar-chart',
-      routerLink: '/workbench/data',
-      disabled: true,
-    },
-    {
       title: 'Model',
       iconType: 'experiment',
       routerLink: '/workbench/model',
       disabled: false,
     },
     {
+      title: 'Data',
+      iconType: 'bar-chart',
+      routerLink: '/workbench/data',
+      disabled: true,
+    },
+    {
       title: 'Workspace',
       iconType: 'desktop',
       routerLink: '/workbench/workspace',

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org