User Management: Create and delete. Styling and enter key
authorLaurence Maultsby <laurence.maultsby@riftio.com>
Wed, 8 Mar 2017 14:41:23 +0000 (09:41 -0500)
committerLaurence Maultsby <laurence.maultsby@riftio.com>
Wed, 8 Mar 2017 14:41:23 +0000 (09:41 -0500)
Signed-off-by: Laurence Maultsby <laurence.maultsby@riftio.com>
skyquake/framework/style/_colors.scss
skyquake/framework/widgets/button/button.scss
skyquake/framework/widgets/panel/panel.jsx
skyquake/plugins/user-management/src/dashboard/dashboard.jsx
skyquake/plugins/user-management/src/dashboard/userMgmt.scss
skyquake/plugins/user-management/src/dashboard/userMgmtStore.js

index 353a103..24a4475 100644 (file)
@@ -66,8 +66,8 @@ $neutral-light-3: hsl(360, 100%, 50%);
 $neutral-light-4: hsl(360, 100%, 50%);
 $neutral-light-5: hsl(360, 100%, 50%);
 
-$neutral-dark-1: hsl(360, 100%, 50%);
-$neutral-dark-2: hsl(360, 100%, 50%);
+$neutral-dark-1: hsl(0, 0%, 63.7%);
+$neutral-dark-2: hsl(0, 0%, 56.7%);
 $neutral-dark-3: hsl(0, 0%, 49.7%);
 $neutral-dark-4: hsl(0, 0%, 42.7%);
 $neutral-dark-5: hsl(0, 0%, 35.7%);
index e4eb7a4..043a769 100644 (file)
@@ -111,7 +111,8 @@ button{
   /* Focus */
   &:focus {
     /* box-shadow: $focus-shadow;*/
-    border: 1px solid red;
+    border: 1px solid;
+    border-color: darken($normalHoverBackground, 10%);
   }
 
   /* SIZES
index b26b1b1..c078069 100644 (file)
@@ -59,8 +59,13 @@ Panel.defaultProps = {
 
 export class PanelWrapper extends Component {
     render() {
+        let wrapperClass = 'skyquakePanelWrapper';
+        let {className, ...props} = this.props;
+        if(className) {
+            wrapperClass = `${wrapperClass} ${className}`
+        }
         return (
-        <div className={'skyquakePanelWrapper ' + this.props.className} style={this.props.style}>
+        <div className={wrapperClass} {...props}>
             {this.props.children}
         </div>)
     }
index b5924ae..2f3bf5b 100644 (file)
@@ -100,7 +100,17 @@ class UserManagementDashboard extends React.Component {
             });
         }
     }
-
+     evaluateSubmit = (e) => {
+        if (e.keyCode == 13) {
+            if (this.props.isEdit) {
+                this.updateUser(e);
+            } else {
+                this.createUser(e);
+            }
+            e.preventDefault();
+            e.stopPropagation();
+        }
+    }
     onTransitionEnd = (e) => {
         this.actions.handleHideColumns(e);
         console.log('transition end')
@@ -122,13 +132,13 @@ class UserManagementDashboard extends React.Component {
                                 Domain
                             </div>
                         </div>
-                        {state.users.map((u, k) => {
+                        {state.users && state.users.map((u, k) => {
                             let platformRoles = [];
                             for(let role in u.platformRoles) {
                                 platformRoles.push(<div>{`${role}: ${u.platformRoles[role]}`}</div>)
                             }
                             return (
-                                <div className={`tableRow tableRow--data ${((self.state.activeIndex == k) && !self.state.userOpen) ? 'tableRow--data-active' : ''}`} key={k}>
+                                <div className={`tableRow tableRow--data ${((self.state.activeIndex == k) && self.state.userOpen) ? 'tableRow--data-active' : ''}`} key={k}>
                                     <div
                                         className={`userName userName-header ${((self.state.activeIndex == k) && self.state.userOpen) ? 'activeUser' : ''}`}
                                         onClick={self.viewUser.bind(null, u, k)}>
@@ -147,7 +157,7 @@ class UserManagementDashboard extends React.Component {
                         <Button label="Add User" onClick={this.addUser} />
                     </ButtonGroup>
                 </PanelWrapper>
-                <PanelWrapper
+                <PanelWrapper onKeyUp={this.evaluateSubmit}
                     className={`userAdmin column`}>
                     <Panel
                         title={state.isEdit ? state['user-name'] : 'Create User'}
@@ -201,17 +211,16 @@ class UserManagementDashboard extends React.Component {
                             state.isEdit ?
                             (
                                 <ButtonGroup className="buttonGroup">
-                                    <Button label="Update" onClick={this.updateUser} />
+                                    <Button label="Update" type="submit" onClick={this.updateUser} />
                                     <Button label="Delete" onClick={this.deleteUser} />
                                 </ButtonGroup>
                             )
                             : (
                                 <ButtonGroup className="buttonGroup">
-                                    <Button label="Create" onClick={this.createUser}  />
+                                    <Button label="Create" type="submit" onClick={this.createUser}  />
                                 </ButtonGroup>
                             )
                         }
-
                 </PanelWrapper>
 
             </PanelWrapper>
index 1271729..f107686 100644 (file)
     display:-ms-flexbox;
     display:flex;
     -ms-flex-wrap: nowrap;
-        flex-wrap: nowrap;
+    flex-wrap: nowrap;
+    padding: 0.25rem;
+    margin: .125rem 0;
     >div {
         padding:0.25rem 1rem 0.25rem 0;
         -ms-flex: 1 1 33%;
         font-weight:bold;
     }
     &--data {
-        &:hover, .activeUser{
+        &:hover, .activeUser, &-active{
             cursor:pointer;
-            background:$neutral-dark-3;
+            background:$neutral-dark-1;
             color:white;
         }
+
     }
 }
 
index 2293aca..407d9d2 100644 (file)
@@ -164,7 +164,7 @@ export default class UserManagementStore {
     }
     updateUserSuccess() {
         this.alt.actions.global.hideScreenLoader.defer();
-        let users = this.users;
+        let users = this.users || [];
         users[this.activeIndex] = {
             'user-name': this['user-name'],
             'user-domain': this['user-domain'],
@@ -182,7 +182,7 @@ export default class UserManagementStore {
     }
     createUserSuccess() {
         this.alt.actions.global.hideScreenLoader.defer();
-        let users = this.users;
+        let users = this.users || [];
         users.push({
             'user-name': this['user-name'],
             'user-domain': this['user-domain'],