18559: Add uuid with copy and action menu to user profile panel
[arvados-workbench2.git] / src / views / user-profile-panel / user-profile-panel.tsx
index e23b8bcea5af56bee2e7d8b7c271d0608cf30d4b..7a55faf3300c2f5e6f218c010f429b34d7e95d0e 100644 (file)
@@ -6,35 +6,34 @@ import { RootState } from 'store/store';
 import { compose, Dispatch } from 'redux';
 import { reduxForm, isPristine, isValid } from 'redux-form';
 import { connect } from 'react-redux';
+import { UserResource } from 'models/user';
 import { saveEditedUser } from 'store/user-profile/user-profile-actions';
 import { UserProfilePanelRoot, UserProfilePanelRootDataProps } from 'views/user-profile-panel/user-profile-panel-root';
 import { openSetupDialog, openDeactivateDialog, USER_PROFILE_FORM } from "store/user-profile/user-profile-actions";
 import { matchUserProfileRoute } from 'routes/routes';
-import { UserResource } from 'models/user';
-import { getResource } from 'store/resources/resources';
 import { loginAs } from 'store/users/users-actions';
+import { openUserContextMenu } from 'store/context-menu/context-menu-actions';
 
 const mapStateToProps = (state: RootState): UserProfilePanelRootDataProps => {
   const pathname = state.router.location ? state.router.location.pathname : '';
   const match = matchUserProfileRoute(pathname);
   const uuid = match ? match.params.id : state.auth.user?.uuid || '';
-  // get user resource
-  const user = getResource<UserResource>(uuid)(state.resources);
-  // const subprocesses = getSubprocesses(uuid)(resources);
 
   return {
     isAdmin: state.auth.user!.isAdmin,
     isSelf: state.auth.user!.uuid === uuid,
     isPristine: isPristine(USER_PROFILE_FORM)(state),
     isValid: isValid(USER_PROFILE_FORM)(state),
-    initialValues: user,
-    localCluster: state.auth.localCluster
+    localCluster: state.auth.localCluster,
+    userUuid: uuid,
+    resources: state.resources,
 }};
 
 const mapDispatchToProps = (dispatch: Dispatch) => ({
     openSetupDialog: (uuid: string) => dispatch<any>(openSetupDialog(uuid)),
     loginAs: (uuid: string) => dispatch<any>(loginAs(uuid)),
     openDeactivateDialog: (uuid: string) => dispatch<any>(openDeactivateDialog(uuid)),
+    handleContextMenu: (event, resource: UserResource) => dispatch<any>(openUserContextMenu(event, resource)),
 });
 
 export const UserProfilePanel = compose(