// SPDX-License-Identifier: AGPL-3.0
import { RootState } from "store/store";
import { Dispatch } from 'redux';
-import { reset } from "redux-form";
+import { initialize, reset } from "redux-form";
import { ServiceRepository } from "services/services";
import { bindDataExplorerActions } from "store/data-explorer/data-explorer-action";
import { propertiesActions } from 'store/properties/properties-actions';
// Get user uuid from route or use current user uuid
const uuid = userUuid || getState().auth.user?.uuid;
if (uuid) {
+ await dispatch(propertiesActions.SET_PROPERTY({ key: USER_PROFILE_PANEL_ID, value: uuid }));
const user = await services.userService.get(uuid);
+ dispatch(initialize(USER_PROFILE_FORM, user));
dispatch(updateResources([user]));
- await dispatch(propertiesActions.SET_PROPERTY({ key: USER_PROFILE_PANEL_ID, value: uuid }));
dispatch(UserProfileGroupsActions.REQUEST_ITEMS());
}
}
render() {
const { value } = this.state;
return <Paper className={this.props.classes.root}>
- <Tabs value={value} onChange={this.handleChange} fullWidth>
+ <Tabs value={value} onChange={this.handleChange} variant={"fullWidth"}>
<Tab label="USERS" />
<Tab label="ACTIVITY" disabled />
</Tabs>
type UserProfilePanelRootProps = InjectedFormProps<{}> & UserProfilePanelRootActionProps & UserProfilePanelRootDataProps & WithStyles<CssRules>;
-// type LocalClusterProp = { localCluster: string };
-// const renderField: React.ComponentType<WrappedFieldProps & LocalClusterProp> = ({ input, localCluster }) => (
-// <span>{localCluster === input.value.substring(0, 5) ? "" : "federated"} user {input.value}</span>
-// );
-
export enum UserProfileGroupsColumnNames {
NAME = "Name",
PERMISSION = "Permission",
render() {
return <Paper className={this.props.classes.root}>
- {/* <Typography variant="title" className={this.props.classes.title}>
- Logged in as <Field name="uuid" component={renderField} localCluster={this.props.localCluster} />
- </Typography> */}
- <Tabs value={this.state.value} onChange={this.handleChange} fullWidth>
+ <Tabs value={this.state.value} onChange={this.handleChange} variant={"fullWidth"}>
<Tab label="PROFILE" />
<Tab label="GROUPS" />
<Tab label="ADMIN" />
id={USER_PROFILE_PANEL_ID}
onRowClick={noop}
onRowDoubleClick={noop}
- // onContextMenu={this.handleContextMenu}
contextMenuColumn={false}
hideColumnSelector
hideSearchInput
this.setState({ value });
}
- handleContextMenu = (event: React.MouseEvent<HTMLElement>, resourceUuid: string) => {
- // const resource = getResource<UserResource>(resourceUuid)(this.props.resources);
- // if (resource) {
- // this.props.onContextMenu(event, {
- // name: '',
- // uuid: resource.uuid,
- // ownerUuid: resource.ownerUuid,
- // kind: resource.kind,
- // menuKind: ContextMenuKind.USER
- // });
- // }
- }
}
);