lastName: string;
uuid: string;
ownerUuid: string;
+ identityUrl: string;
+ prefs: userPrefs;
+ isAdmin: boolean;
}
export const getUserFullname = (user?: User) => {
import { History, Location } from 'history';
import { RootStore } from '~/store/store';
+import { matchProcessRoute, matchProcessLogRoute, matchProjectRoute, matchCollectionRoute, matchFavoritesRoute, matchTrashRoute, matchRootRoute, matchSharedWithMeRoute, matchRunProcessRoute, matchWorkflowRoute, matchSearchResultsRoute, matchSshKeysRoute, matchRepositoriesRoute, matchMyAccountRoute } from './routes';
+import { loadProject, loadCollection, loadFavorites, loadTrash, loadProcess, loadProcessLog, loadSshKeys, loadRepositories, loadMyAccount } from '~/store/workbench/workbench-actions';
+ import { matchProcessRoute, matchProcessLogRoute, matchProjectRoute, matchCollectionRoute, matchFavoritesRoute, matchTrashRoute, matchRootRoute, matchSharedWithMeRoute, matchRunProcessRoute, matchWorkflowRoute, matchSearchResultsRoute, matchSshKeysRoute, matchRepositoriesRoute, matchVirtualMachineRoute } from './routes';
+ import { loadProject, loadCollection, loadFavorites, loadTrash, loadProcess, loadProcessLog, loadSshKeys, loadRepositories, loadVirtualMachines } from '~/store/workbench/workbench-actions';
import { navigateToRootProject } from '~/store/navigation/navigation-action';
import { loadSharedWithMe, loadRunProcess, loadWorkflow, loadSearchResults } from '~//store/workbench/workbench-actions';
const searchResultsMatch = matchSearchResultsRoute(pathname);
const sharedWithMeMatch = matchSharedWithMeRoute(pathname);
const runProcessMatch = matchRunProcessRoute(pathname);
+ const virtualMachineMatch = matchVirtualMachineRoute(pathname);
const workflowMatch = matchWorkflowRoute(pathname);
const sshKeysMatch = matchSshKeysRoute(pathname);
+ const myAccountMatch = matchMyAccountRoute(pathname);
if (projectMatch) {
store.dispatch(loadProject(projectMatch.params.id));
REPOSITORIES: '/repositories',
SHARED_WITH_ME: '/shared-with-me',
RUN_PROCESS: '/run-process',
+ VIRTUAL_MACHINES: '/virtual-machines',
WORKFLOWS: '/workflows',
SEARCH_RESULTS: '/search-results',
- SSH_KEYS: `/ssh-keys`
+ SSH_KEYS: `/ssh-keys`,
+ MY_ACCOUNT: '/my-account'
};
export const getResourceUrl = (uuid: string) => {
export const USER_LAST_NAME_KEY = 'userLastName';
export const USER_UUID_KEY = 'userUuid';
export const USER_OWNER_UUID_KEY = 'userOwnerUuid';
+ export const USER_IS_ADMIN = 'isAdmin';
+export const USER_IDENTITY_URL = 'identityUrl';
+export const USER_PREFS = 'prefs';
export interface UserDetailsResponse {
email: string;
const email = localStorage.getItem(USER_EMAIL_KEY);
const firstName = localStorage.getItem(USER_FIRST_NAME_KEY);
const lastName = localStorage.getItem(USER_LAST_NAME_KEY);
- const uuid = localStorage.getItem(USER_UUID_KEY);
- const ownerUuid = localStorage.getItem(USER_OWNER_UUID_KEY);
+ const uuid = this.getUuid();
+ const ownerUuid = this.getOwnerUuid();
+ const isAdmin = this.getIsAdmin();
+ const identityUrl = localStorage.getItem(USER_IDENTITY_URL);
+ const prefs = JSON.parse(localStorage.getItem(USER_PREFS) || '{"profile": {}}');
+
- return email && firstName && lastName && uuid && ownerUuid
- ? { email, firstName, lastName, uuid, ownerUuid, isAdmin }
+ return email && firstName && lastName && uuid && ownerUuid && identityUrl && prefs
- ? { email, firstName, lastName, uuid, ownerUuid, identityUrl, prefs }
++ ? { email, firstName, lastName, uuid, ownerUuid, isAdmin, identityUrl, prefs }
: undefined;
}
localStorage.setItem(USER_LAST_NAME_KEY, user.lastName);
localStorage.setItem(USER_UUID_KEY, user.uuid);
localStorage.setItem(USER_OWNER_UUID_KEY, user.ownerUuid);
+ localStorage.setItem(USER_IS_ADMIN, JSON.stringify(user.isAdmin));
+ localStorage.setItem(USER_IDENTITY_URL, user.identityUrl);
+ localStorage.setItem(USER_PREFS, JSON.stringify(user.prefs));
}
public removeUser() {
localStorage.removeItem(USER_LAST_NAME_KEY);
localStorage.removeItem(USER_UUID_KEY);
localStorage.removeItem(USER_OWNER_UUID_KEY);
+ localStorage.removeItem(USER_IS_ADMIN);
+ localStorage.removeItem(USER_IDENTITY_URL);
+ localStorage.removeItem(USER_PREFS);
}
public login() {
lastName: resp.data.last_name,
uuid: resp.data.uuid,
ownerUuid: resp.data.owner_uuid,
- isAdmin: resp.data.is_admin
++ isAdmin: resp.data.is_admin,
+ identityUrl: resp.data.identity_url,
+ prefs
};
})
.catch(e => {
lastName: "Doe",
uuid: "uuid",
ownerUuid: "ownerUuid",
- prefs: {}
+ identityUrl: "identityUrl",
++ prefs: {},
+ isAdmin: false
};
const state = reducer(initialState, authActions.INIT({ user, token: "token" }));
expect(state).toEqual({
lastName: "Doe",
uuid: "uuid",
ownerUuid: "ownerUuid",
- prefs: {}
+ identityUrl: "identityUrl",
++ prefs: {},
+ isAdmin: false
};
const state = reducer(initialState, authActions.USER_DETAILS_SUCCESS(user));
import { RootState } from "~/store/store";
import { openCurrentTokenDialog } from '~/store/current-token-dialog/current-token-dialog-actions';
import { openRepositoriesPanel } from "~/store/repositories/repositories-actions";
-import { navigateToSshKeys } from '~/store/navigation/navigation-action';
+import { navigateToSshKeys, navigateToMyAccount } from '~/store/navigation/navigation-action';
+ import { openVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions";
interface AccountMenuProps {
user?: User;
<Route path={Routes.RUN_PROCESS} component={RunProcessPanel} />
<Route path={Routes.WORKFLOWS} component={WorkflowPanel} />
<Route path={Routes.SEARCH_RESULTS} component={SearchResultsPanel} />
+ <Route path={Routes.VIRTUAL_MACHINES} component={VirtualMachinePanel} />
<Route path={Routes.REPOSITORIES} component={RepositoriesPanel} />
<Route path={Routes.SSH_KEYS} component={SshKeyPanel} />
+ <Route path={Routes.MY_ACCOUNT} component={MyAccountPanel} />
</Switch>
</Grid>
</Grid>