Checkbox readonly fix for input.jsx, name click for project,user, role management
authorLaurence Maultsby <laurence.maultsby@riftio.com>
Thu, 23 Mar 2017 17:54:43 +0000 (13:54 -0400)
committerLaurence Maultsby <laurence.maultsby@riftio.com>
Thu, 23 Mar 2017 17:54:43 +0000 (13:54 -0400)
Signed-off-by: Laurence Maultsby <laurence.maultsby@riftio.com>
skyquake/framework/widgets/form_controls/input.jsx
skyquake/plugins/project_management/src/dashboard/dashboard.jsx
skyquake/plugins/project_management/src/dashboard/projectMgmtStore.js
skyquake/plugins/user_management/src/dashboard/dashboard.jsx

index 4799dc1..1563f29 100644 (file)
@@ -71,7 +71,7 @@ export default class Input extends Component {
         } else {
             displayedValue = value.toString();
         }
-        if( props.readonly && props.type == "checkbox" ) {
+        if( props.readonly && props.type == "checkbox" && props.checked ) {
             displayedValue = <img src={CircleSVG} />
         }
         let html = (
index 4cbb1ef..6b613cc 100644 (file)
@@ -259,10 +259,10 @@ class ProjectManagementDashboard extends React.Component {
                                 platformRoles.push(<div>{`${role}: ${u.platformRoles[role]}`}</div>)
                             }
                             return (
-                                <div ref={(el) => this[`project-ref-${k}`] = el} className={`tableRow tableRow--data ${((self.state.activeIndex == k) && self.state.projectOpen) ? 'tableRow--data-active' : ''}`} key={k}>
+                                <div onClick={self.viewProject.bind(null, u, k)} ref={(el) => this[`project-ref-${k}`] = el} className={`tableRow tableRow--data ${((self.state.activeIndex == k) && self.state.projectOpen) ? 'tableRow--data-active' : ''}`} key={k}>
                                     <div
                                         className={`projectName projectName-header ${((self.state.activeIndex == k) && self.state.projectOpen) ? 'activeProject' : ''}`}
-                                        onClick={self.viewProject.bind(null, u, k)}>
+                                        >
                                         {u['name']}
                                     </div>
                                     <div>
@@ -310,9 +310,9 @@ class ProjectManagementDashboard extends React.Component {
                             <tbody>
                                 {
                             state.projectUsers.map((u,i)=> {
-                                let userRoles = u.role.map((r) => {
+                                let userRoles = u.role && u.role.map((r) => {
                                     return r.role;
-                                })
+                                }) || [];
                                 return (
                                     <tr key={i}>
                                         {!state.isReadOnly ? <td><span
@@ -327,7 +327,7 @@ class ProjectManagementDashboard extends React.Component {
                                         </td>
                                         {
                                             state.roles.map((r,j) => {
-                                                return <td key={j}><Input readonly={state.isReadOnly} type="checkbox" onChange={self.toggleUserRoleInProject.bind(self, i, j)} value={(userRoles.indexOf(r) > -1)} checked={(userRoles.indexOf(r) > -1)} /></td>
+                                                return <td key={j}><Input readonly={state.isReadOnly} type="checkbox" onChange={self.toggleUserRoleInProject.bind(self, i, j)} checked={(userRoles.indexOf(r) > -1)} /></td>
                                             })
                                         }
                                     </tr>
index d7d76b8..1cb2088 100644 (file)
@@ -170,6 +170,7 @@ export default class ProjectManagementStore {
         let selectedRole = self.roles[roleIndex];
         let keys = ',';
         if(checked) {
+            if(!projectUsers[userIndex].role) projectUsers[userIndex].role = [];
             projectUsers[userIndex].role.push({
                 role: self.roles[roleIndex],
                 keys: keys
index 2ff5f49..0275831 100644 (file)
@@ -233,10 +233,12 @@ class UserManagementDashboard extends React.Component {
                                     platformRoles.push(<div>{`${role}: ${u.platformRoles[role]}`}</div>)
                                 }
                                 return (
-                                    <div ref={(el) => this[`user-ref-${k}`] = el} className={`tableRow tableRow--data ${((self.state.activeIndex == k) && self.state.userOpen) ? 'tableRow--data-active' : ''}`} key={k}>
+                                    <div ref={(el) => this[`user-ref-${k}`] = el} className={`tableRow tableRow--data ${((self.state.activeIndex == k) && self.state.userOpen) ? 'tableRow--data-active' : ''}`}
+                                        key={k}
+                                        onClick={self.viewUser.bind(null, u, k)}>
                                         <div
                                             className={`userName userName-header ${((self.state.activeIndex == k) && self.state.userOpen) ? 'activeUser' : ''}`}
-                                            onClick={self.viewUser.bind(null, u, k)}>
+                                            >
                                             {u['user-name']}
                                         </div>
                                         <div>