[ARVADOS-WORKBENCH2] updated: 1.4.1-99-g72c6b63b
Git user
git at public.curoverse.com
Thu Nov 14 21:54:19 UTC 2019
Summary of changes:
src/common/getuser.ts | 10 +++++
src/models/tree.ts | 3 ++
src/services/auth-service/auth-service.ts | 52 +---------------------
src/store/auth/auth-action-ssh.ts | 12 +++--
src/store/auth/auth-action.ts | 11 +++--
src/store/auth/auth-middleware.ts | 34 +++++++-------
src/store/auth/auth-reducer.ts | 2 +-
src/store/breadcrumbs/breadcrumbs-actions.ts | 5 ++-
...llections-content-address-middleware-service.ts | 13 +++---
src/store/collections/collection-create-actions.ts | 3 +-
.../favorite-panel-middleware-service.ts | 5 ++-
src/store/favorites/favorites-actions.ts | 11 ++++-
.../link-account-panel-actions.ts | 5 ++-
src/store/my-account/my-account-panel-actions.ts | 5 +--
.../project-tree-picker-actions.ts | 11 ++---
src/store/projects/project-create-actions.ts | 11 ++---
src/store/projects/project-move-actions.ts | 6 ++-
src/store/repositories/repositories-actions.ts | 5 ++-
.../run-process-panel/run-process-panel-actions.ts | 3 +-
src/store/search-bar/search-bar-tree-actions.ts | 10 +++--
.../side-panel-tree/side-panel-tree-actions.ts | 18 +++++---
src/store/store.ts | 1 -
.../trash-panel/trash-panel-middleware-service.ts | 7 ++-
src/store/tree-picker/tree-picker-actions.ts | 16 ++++---
src/store/users/users-actions.ts | 5 ++-
src/store/workbench/workbench-actions.ts | 5 ++-
.../project-tree-picker/project-tree-picker.tsx | 7 +--
.../link-account-panel/link-account-panel.tsx | 2 +-
28 files changed, 142 insertions(+), 136 deletions(-)
create mode 100644 src/common/getuser.ts
via 72c6b63b58e7b583c6e9f638c1a4be8e8ce69e89 (commit)
via 6bdb4758d981aa05c19700761d3ace0db7af324a (commit)
from db4b8c25a0a3418df5645060ccfa9406d20fce62 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 72c6b63b58e7b583c6e9f638c1a4be8e8ce69e89
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date: Thu Nov 14 16:53:45 2019 -0500
15803: Display loading screen during "get user info" and "self activate"
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts
index 62f4a0fa..41245751 100644
--- a/src/store/auth/auth-action.ts
+++ b/src/store/auth/auth-action.ts
@@ -13,6 +13,8 @@ import { Config } from '~/common/config';
import { matchTokenRoute, matchFedTokenRoute } from '~/routes/routes';
import { createServices, setAuthorizationHeader } from "~/services/services";
import { cancelLinking } from '~/store/link-account-panel/link-account-panel-actions';
+import { progressIndicatorActions } from "~/store/progress-indicator/progress-indicator-actions";
+import { WORKBENCH_LOADING_SCREEN } from '~/store/workbench/workbench-actions';
export const authActions = unionize({
LOGIN: {},
@@ -56,7 +58,10 @@ const init = (config: Config) => (dispatch: Dispatch, getState: () => RootState,
dispatch(authActions.SET_HOME_CLUSTER(config.loginCluster || homeCluster || config.uuidPrefix));
if (token && token !== "undefined") {
- dispatch<any>(saveApiToken(token));
+ dispatch(progressIndicatorActions.START_WORKING(WORKBENCH_LOADING_SCREEN));
+ dispatch<any>(saveApiToken(token)).finally(() => {
+ dispatch(progressIndicatorActions.STOP_WORKING(WORKBENCH_LOADING_SCREEN));
+ });
}
};
diff --git a/src/store/auth/auth-middleware.ts b/src/store/auth/auth-middleware.ts
index 59ce18a2..817ddd2e 100644
--- a/src/store/auth/auth-middleware.ts
+++ b/src/store/auth/auth-middleware.ts
@@ -8,6 +8,8 @@ import { ServiceRepository, setAuthorizationHeader, removeAuthorizationHeader }
import { initSessions } from "~/store/auth/auth-action-session";
import { User } from "~/models/user";
import { RootState } from '~/store/store';
+import { progressIndicatorActions } from "~/store/progress-indicator/progress-indicator-actions";
+import { WORKBENCH_LOADING_SCREEN } from '~/store/workbench/workbench-actions';
export const authMiddleware = (services: ServiceRepository): Middleware => store => next => action => {
authActions.match(action, {
@@ -25,8 +27,12 @@ export const authMiddleware = (services: ServiceRepository): Middleware => store
store.dispatch<any>(initSessions(services.authService, state.auth.remoteHostsConfig[state.auth.localCluster], user));
if (!user.isActive) {
+ store.dispatch(progressIndicatorActions.START_WORKING(WORKBENCH_LOADING_SCREEN));
services.userService.activate(user.uuid).then((user: User) => {
- store.getState().dispatch(authActions.INIT({ user, token }));
+ store.dispatch(authActions.INIT({ user, token }));
+ store.dispatch(progressIndicatorActions.STOP_WORKING(WORKBENCH_LOADING_SCREEN));
+ }).catch(() => {
+ store.dispatch(progressIndicatorActions.STOP_WORKING(WORKBENCH_LOADING_SCREEN));
});
}
},
commit 6bdb4758d981aa05c19700761d3ace0db7af324a
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date: Thu Nov 14 13:32:50 2019 -0500
15803: use getUserUuid instead of getting from local store
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/src/common/getuser.ts b/src/common/getuser.ts
new file mode 100644
index 00000000..dc96f929
--- /dev/null
+++ b/src/common/getuser.ts
@@ -0,0 +1,10 @@
+import { RootState } from '~/store/store';
+
+export const getUserUuid = (state: RootState) => {
+ const user = state.auth.user;
+ if (user) {
+ return user.uuid;
+ } else {
+ return undefined;
+ }
+};
diff --git a/src/models/tree.ts b/src/models/tree.ts
index 60a95342..de2f7b71 100644
--- a/src/models/tree.ts
+++ b/src/models/tree.ts
@@ -238,6 +238,9 @@ const getRootNodeChildrenIds = <T>(tree: Tree<T>) =>
const addChild = (parentId: string, childId: string) => <T>(tree: Tree<T>): Tree<T> => {
+ if (childId === "") {
+ return tree;
+ }
const node = getNode(parentId)(tree);
if (node) {
const children = node.children.some(id => id === childId)
diff --git a/src/services/auth-service/auth-service.ts b/src/services/auth-service/auth-service.ts
index 2a939acd..2562dc6a 100644
--- a/src/services/auth-service/auth-service.ts
+++ b/src/services/auth-service/auth-service.ts
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { getUserFullname, User, UserPrefs, UserResource } from '~/models/user';
+import { getUserFullname, User, UserPrefs } from '~/models/user';
import { AxiosInstance } from "axios";
import { ApiActions } from "~/services/api/api-actions";
import * as uuid from "uuid/v4";
@@ -58,50 +58,6 @@ export class AuthService {
return localStorage.getItem(HOME_CLUSTER) || undefined;
}
- public getUuid() {
- return localStorage.getItem(USER_UUID_KEY) || undefined;
- }
-
- public getOwnerUuid() {
- return localStorage.getItem(USER_OWNER_UUID_KEY) || undefined;
- }
-
- public getIsAdmin(): boolean {
- return localStorage.getItem(USER_IS_ADMIN) === 'true';
- }
-
- public getIsActive(): boolean {
- return localStorage.getItem(USER_IS_ACTIVE) === 'true';
- }
-
- public getUser(): User | undefined {
- 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 = this.getUuid();
- const ownerUuid = this.getOwnerUuid();
- const isAdmin = this.getIsAdmin();
- const isActive = this.getIsActive();
- const username = localStorage.getItem(USER_USERNAME);
- const prefs = JSON.parse(localStorage.getItem(USER_PREFS) || '{"profile": {}}');
-
- return email && firstName && lastName && uuid && ownerUuid && username && prefs
- ? { email, firstName, lastName, uuid, ownerUuid, isAdmin, isActive, username, prefs }
- : undefined;
- }
-
- public saveUser(user: User | UserResource) {
- localStorage.setItem(USER_EMAIL_KEY, user.email);
- localStorage.setItem(USER_FIRST_NAME_KEY, user.firstName);
- 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_IS_ACTIVE, JSON.stringify(user.isActive));
- localStorage.setItem(USER_USERNAME, user.username);
- localStorage.setItem(USER_PREFS, JSON.stringify(user.prefs));
- }
-
public removeUser() {
localStorage.removeItem(USER_EMAIL_KEY);
localStorage.removeItem(USER_FIRST_NAME_KEY);
@@ -151,12 +107,6 @@ export class AuthService {
throw e;
});
}
-
- public getRootUuid() {
- const uuid = this.getOwnerUuid();
- const uuidParts = uuid ? uuid.split('-') : [];
- return uuidParts.length > 1 ? `${uuidParts[0]}-${uuidParts[1]}` : undefined;
- }
public getSessions(): Session[] {
try {
diff --git a/src/store/auth/auth-action-ssh.ts b/src/store/auth/auth-action-ssh.ts
index 1fbdfdfa..27a5c52d 100644
--- a/src/store/auth/auth-action-ssh.ts
+++ b/src/store/auth/auth-action-ssh.ts
@@ -5,8 +5,9 @@
import { dialogActions } from "~/store/dialog/dialog-actions";
import { Dispatch } from "redux";
import { RootState } from "~/store/store";
+import { getUserUuid } from "~/common/getuser";
import { ServiceRepository } from "~/services/services";
-import {snackbarActions, SnackbarKind} from "~/store/snackbar/snackbar-actions";
+import { snackbarActions, SnackbarKind } from "~/store/snackbar/snackbar-actions";
import { FormErrors, reset, startSubmit, stopSubmit } from "redux-form";
import { KeyType } from "~/models/ssh-key";
import {
@@ -14,9 +15,7 @@ import {
getAuthorizedKeysServiceError
} from "~/services/authorized-keys-service/authorized-keys-service";
import { setBreadcrumbs } from "~/store/breadcrumbs/breadcrumbs-actions";
-import {
- authActions,
-} from "~/store/auth/auth-action";
+import { authActions } from "~/store/auth/auth-action";
export const SSH_KEY_CREATE_FORM_NAME = 'sshKeyCreateFormName';
export const SSH_KEY_PUBLIC_KEY_DIALOG = 'sshKeyPublicKeyDialog';
@@ -62,7 +61,7 @@ export const removeSshKey = (uuid: string) =>
export const createSshKey = (data: SshKeyCreateFormDialogData) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const userUuid = getState().auth.user!.uuid;
+ const userUuid = getUserUuid(getState());
const { name, publicKey } = data;
dispatch(startSubmit(SSH_KEY_CREATE_FORM_NAME));
try {
@@ -93,11 +92,10 @@ export const createSshKey = (data: SshKeyCreateFormDialogData) =>
export const loadSshKeysPanel = () =>
async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
try {
- dispatch(setBreadcrumbs([{ label: 'SSH Keys'}]));
+ dispatch(setBreadcrumbs([{ label: 'SSH Keys' }]));
const response = await services.authorizedKeysService.list();
dispatch(authActions.SET_SSH_KEYS(response.items));
} catch (e) {
return;
}
};
-
diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts
index 5fbfce48..62f4a0fa 100644
--- a/src/store/auth/auth-action.ts
+++ b/src/store/auth/auth-action.ts
@@ -10,9 +10,9 @@ import { SshKeyResource } from '~/models/ssh-key';
import { User } from "~/models/user";
import { Session } from "~/models/session";
import { Config } from '~/common/config';
-import { cancelLinking } from '~/store/link-account-panel/link-account-panel-actions';
import { matchTokenRoute, matchFedTokenRoute } from '~/routes/routes';
-import { createServices, setAuthorizationHeader, removeAuthorizationHeader } from "~/services/services";
+import { createServices, setAuthorizationHeader } from "~/services/services";
+import { cancelLinking } from '~/store/link-account-panel/link-account-panel-actions';
export const authActions = unionize({
LOGIN: {},
diff --git a/src/store/auth/auth-middleware.ts b/src/store/auth/auth-middleware.ts
index d37ef08c..59ce18a2 100644
--- a/src/store/auth/auth-middleware.ts
+++ b/src/store/auth/auth-middleware.ts
@@ -14,11 +14,7 @@ export const authMiddleware = (services: ServiceRepository): Middleware => store
INIT: ({ user, token }) => {
next(action);
const state: RootState = store.getState();
- if (state.auth.user) {
- services.authService.saveUser(state.auth.user);
- } else {
- services.authService.removeUser();
- }
+
if (state.auth.apiToken) {
services.authService.saveApiToken(state.auth.apiToken);
setAuthorizationHeader(services, state.auth.apiToken);
@@ -38,16 +34,16 @@ export const authMiddleware = (services: ServiceRepository): Middleware => store
document.title = `Arvados Workbench (${config.uuidPrefix})`;
next(action);
},
- LOGOUT: ({deleteLinkData}) => {
- next(action)
- if (deleteLinkData) {
- services.linkAccountService.removeAccountToLink();
- }
- services.authService.removeApiToken();
- services.authService.removeUser();
- removeAuthorizationHeader(services);
- services.authService.logout();
- },
+ LOGOUT: ({ deleteLinkData }) => {
+ next(action);
+ if (deleteLinkData) {
+ services.linkAccountService.removeAccountToLink();
+ }
+ services.authService.removeApiToken();
+ services.authService.removeUser();
+ removeAuthorizationHeader(services);
+ services.authService.logout();
+ },
default: () => next(action)
});
};
diff --git a/src/store/auth/auth-reducer.ts b/src/store/auth/auth-reducer.ts
index 0bc85591..da3c223f 100644
--- a/src/store/auth/auth-reducer.ts
+++ b/src/store/auth/auth-reducer.ts
@@ -61,7 +61,7 @@ export const authReducer = (services: ServiceRepository) => (state = initialStat
return { ...state, apiToken: undefined };
},
USER_DETAILS_SUCCESS: (user: User) => {
- return { ...state, user };
+ return { ...state, user, homeCluster: user.uuid.substr(0, 5) };
},
SET_SSH_KEYS: (sshKeys: SshKeyResource[]) => {
return { ...state, sshKeys };
diff --git a/src/store/breadcrumbs/breadcrumbs-actions.ts b/src/store/breadcrumbs/breadcrumbs-actions.ts
index 04b5689c..90af2c2f 100644
--- a/src/store/breadcrumbs/breadcrumbs-actions.ts
+++ b/src/store/breadcrumbs/breadcrumbs-actions.ts
@@ -4,6 +4,7 @@
import { Dispatch } from 'redux';
import { RootState } from '~/store/store';
+import { getUserUuid } from "~/common/getuser";
import { Breadcrumb } from '~/components/breadcrumbs/breadcrumbs';
import { getResource } from '~/store/resources/resources';
import { TreePicker } from '../tree-picker/tree-picker';
@@ -47,7 +48,7 @@ export const setSidePanelBreadcrumbs = (uuid: string) =>
const path = getState().router.location!.pathname;
const currentUuid = path.split('/')[2];
const uuidKind = extractUuidKind(currentUuid);
-
+
if (uuidKind === ResourceKind.COLLECTION) {
const collectionItem = await services.collectionService.get(currentUuid);
dispatch(setBreadcrumbs(breadcrumbs, collectionItem));
@@ -92,7 +93,7 @@ export const setCategoryBreadcrumbs = (uuid: string, category: SidePanelTreeCate
export const setProjectBreadcrumbs = (uuid: string) =>
(dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
const ancestors = getSidePanelTreeNodeAncestorsIds(uuid)(getState().treePicker);
- const rootUuid = services.authService.getUuid();
+ const rootUuid = getUserUuid(getState());
if (uuid === rootUuid || ancestors.find(uuid => uuid === rootUuid)) {
dispatch(setSidePanelBreadcrumbs(uuid));
} else {
diff --git a/src/store/collections-content-address-panel/collections-content-address-middleware-service.ts b/src/store/collections-content-address-panel/collections-content-address-middleware-service.ts
index 642e7b82..57d09bf4 100644
--- a/src/store/collections-content-address-panel/collections-content-address-middleware-service.ts
+++ b/src/store/collections-content-address-panel/collections-content-address-middleware-service.ts
@@ -6,6 +6,7 @@ import { ServiceRepository } from '~/services/services';
import { MiddlewareAPI, Dispatch } from 'redux';
import { DataExplorerMiddlewareService } from '~/store/data-explorer/data-explorer-middleware-service';
import { RootState } from '~/store/store';
+import { getUserUuid } from "~/common/getuser";
import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
import { getDataExplorer } from '~/store/data-explorer/data-explorer-reducer';
import { resourcesActions } from '~/store/resources/resources-actions';
@@ -48,7 +49,7 @@ export class CollectionsWithSameContentAddressMiddlewareService extends DataExpl
}
try {
api.dispatch(progressIndicatorActions.START_WORKING(this.getId()));
- const userUuid = api.getState().auth.user!.uuid;
+ const userUuid = getUserUuid(api.getState());
const pathname = api.getState().router.location!.pathname;
const contentAddress = pathname.split('/')[2];
const response = await this.services.collectionService.list({
@@ -88,11 +89,11 @@ export class CollectionsWithSameContentAddressMiddlewareService extends DataExpl
.addIn('uuid', groupUuids)
.getFilters()
});
- responseUsers.items.map(it=>{
- api.dispatch<any>(ownerNameActions.SET_OWNER_NAME({name: it.uuid === userUuid ? 'User: Me' : `User: ${it.firstName} ${it.lastName}`, uuid: it.uuid}));
+ responseUsers.items.map(it => {
+ api.dispatch<any>(ownerNameActions.SET_OWNER_NAME({ name: it.uuid === userUuid ? 'User: Me' : `User: ${it.firstName} ${it.lastName}`, uuid: it.uuid }));
});
- responseGroups.items.map(it=>{
- api.dispatch<any>(ownerNameActions.SET_OWNER_NAME({name: `Project: ${it.name}`, uuid: it.uuid}));
+ responseGroups.items.map(it => {
+ api.dispatch<any>(ownerNameActions.SET_OWNER_NAME({ name: `Project: ${it.name}`, uuid: it.uuid }));
});
api.dispatch<any>(setBreadcrumbs([{ label: 'Projects', uuid: userUuid }]));
api.dispatch<any>(updateFavorites(response.items.map(item => item.uuid)));
@@ -134,4 +135,4 @@ const couldNotFetchCollections = () =>
snackbarActions.OPEN_SNACKBAR({
message: 'Could not fetch collection with this content address.',
kind: SnackbarKind.ERROR
- });
\ No newline at end of file
+ });
diff --git a/src/store/collections/collection-create-actions.ts b/src/store/collections/collection-create-actions.ts
index 8d1e9ba5..1b4e86da 100644
--- a/src/store/collections/collection-create-actions.ts
+++ b/src/store/collections/collection-create-actions.ts
@@ -5,6 +5,7 @@
import { Dispatch } from "redux";
import { reset, startSubmit, stopSubmit, initialize, FormErrors } from 'redux-form';
import { RootState } from '~/store/store';
+import { getUserUuid } from "~/common/getuser";
import { dialogActions } from "~/store/dialog/dialog-actions";
import { ServiceRepository } from '~/services/services';
import { getCommonResourceServiceError, CommonResourceServiceError } from "~/services/common-service/common-resource-service";
@@ -28,7 +29,7 @@ export const openCollectionCreateDialog = (ownerUuid: string) =>
const router = getState();
const properties = getState().properties;
if (isItemNotInProject(properties) || !isProjectOrRunProcessRoute(router)) {
- const userUuid = getState().auth.user!.uuid;
+ const userUuid = getUserUuid(getState());
dispatch(initialize(COLLECTION_CREATE_FORM_NAME, { userUuid }));
} else {
dispatch(initialize(COLLECTION_CREATE_FORM_NAME, { ownerUuid }));
diff --git a/src/store/favorite-panel/favorite-panel-middleware-service.ts b/src/store/favorite-panel/favorite-panel-middleware-service.ts
index 868d7b05..b242366d 100644
--- a/src/store/favorite-panel/favorite-panel-middleware-service.ts
+++ b/src/store/favorite-panel/favorite-panel-middleware-service.ts
@@ -5,6 +5,7 @@
import { DataExplorerMiddlewareService } from "~/store/data-explorer/data-explorer-middleware-service";
import { FavoritePanelColumnNames } from "~/views/favorite-panel/favorite-panel";
import { RootState } from "../store";
+import { getUserUuid } from "~/common/getuser";
import { DataColumns } from "~/components/data-table/data-table";
import { ServiceRepository } from "~/services/services";
import { SortDirection } from "~/components/data-table/data-column";
@@ -59,7 +60,7 @@ export class FavoritePanelMiddlewareService extends DataExplorerMiddlewareServic
const responseLinks = await this.services.linkService.list({
filters: new FilterBuilder()
.addEqual("linkClass", 'star')
- .addEqual('tailUuid', this.services.authService.getUuid()!)
+ .addEqual('tailUuid', getUserUuid(api.getState()))
.addEqual('tailKind', ResourceKind.USER)
.getFilters()
}).then(results => results);
@@ -94,7 +95,7 @@ export class FavoritePanelMiddlewareService extends DataExplorerMiddlewareServic
response.itemsAvailable++;
response.items.push(it);
});
-
+
api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId()));
api.dispatch(resourcesActions.SET_RESOURCES(response.items));
await api.dispatch<any>(loadMissingProcessesInformation(response.items));
diff --git a/src/store/favorites/favorites-actions.ts b/src/store/favorites/favorites-actions.ts
index dfa2740e..3221d17a 100644
--- a/src/store/favorites/favorites-actions.ts
+++ b/src/store/favorites/favorites-actions.ts
@@ -5,6 +5,7 @@
import { unionize, ofType, UnionOf } from "~/common/unionize";
import { Dispatch } from "redux";
import { RootState } from "../store";
+import { getUserUuid } from "~/common/getuser";
import { checkFavorite } from "./favorites-reducer";
import { snackbarActions, SnackbarKind } from "../snackbar/snackbar-actions";
import { ServiceRepository } from "~/services/services";
@@ -20,8 +21,11 @@ export type FavoritesAction = UnionOf<typeof favoritesActions>;
export const toggleFavorite = (resource: { uuid: string; name: string }) =>
(dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<any> => {
+ const userUuid = getUserUuid(getState());
+ if (!userUuid) {
+ return Promise.reject("No user");
+ }
dispatch(progressIndicatorActions.START_WORKING("toggleFavorite"));
- const userUuid = getState().auth.user!.uuid;
dispatch(favoritesActions.TOGGLE_FAVORITE({ resourceUuid: resource.uuid }));
const isFavorite = checkFavorite(resource.uuid, getState().favorites);
dispatch(snackbarActions.OPEN_SNACKBAR({
@@ -56,7 +60,10 @@ export const toggleFavorite = (resource: { uuid: string; name: string }) =>
export const updateFavorites = (resourceUuids: string[]) =>
(dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const userUuid = getState().auth.user!.uuid;
+ const userUuid = getUserUuid(getState());
+ if (!userUuid) {
+ return;
+ }
dispatch(favoritesActions.CHECK_PRESENCE_IN_FAVORITES(resourceUuids));
services.favoriteService
.checkPresenceInFavorites(userUuid, resourceUuids)
diff --git a/src/store/link-account-panel/link-account-panel-actions.ts b/src/store/link-account-panel/link-account-panel-actions.ts
index 43d01ca0..108b7747 100644
--- a/src/store/link-account-panel/link-account-panel-actions.ts
+++ b/src/store/link-account-panel/link-account-panel-actions.ts
@@ -4,6 +4,7 @@
import { Dispatch } from "redux";
import { RootState } from "~/store/store";
+import { getUserUuid } from "~/common/getuser";
import { ServiceRepository, createServices, setAuthorizationHeader } from "~/services/services";
import { setBreadcrumbs } from "~/store/breadcrumbs/breadcrumbs-actions";
import { snackbarActions, SnackbarKind } from "~/store/snackbar/snackbar-actions";
@@ -63,7 +64,7 @@ const newServices = (dispatch: Dispatch<any>, token: string) => {
const svc = createServices(config, { progressFn: () => { }, errorFn: () => { } });
setAuthorizationHeader(svc, token);
return svc;
-}
+};
export const checkForLinkStatus = () =>
(dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
@@ -203,7 +204,7 @@ export const loadLinkAccountPanel = () =>
export const startLinking = (t: LinkAccountType) =>
(dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
- const accountToLink = { type: t, userUuid: services.authService.getUuid(), token: services.authService.getApiToken() } as AccountToLink;
+ const accountToLink = { type: t, userUuid: getUserUuid(getState()), token: services.authService.getApiToken() } as AccountToLink;
services.linkAccountService.saveAccountToLink(accountToLink);
const auth = getState().auth;
diff --git a/src/store/my-account/my-account-panel-actions.ts b/src/store/my-account/my-account-panel-actions.ts
index 34bb2693..d36430a2 100644
--- a/src/store/my-account/my-account-panel-actions.ts
+++ b/src/store/my-account/my-account-panel-actions.ts
@@ -14,18 +14,17 @@ export const MY_ACCOUNT_FORM = 'myAccountForm';
export const loadMyAccountPanel = () =>
(dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
- dispatch(setBreadcrumbs([{ label: 'User profile'}]));
+ dispatch(setBreadcrumbs([{ label: 'User profile' }]));
};
export const saveEditedUser = (resource: any) =>
async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
try {
await services.userService.update(resource.uuid, resource);
- services.authService.saveUser(resource);
dispatch(authActions.USER_DETAILS_SUCCESS(resource));
dispatch(initialize(MY_ACCOUNT_FORM, resource));
dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Profile has been updated.", hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
- } catch(e) {
+ } catch (e) {
return;
}
};
diff --git a/src/store/project-tree-picker/project-tree-picker-actions.ts b/src/store/project-tree-picker/project-tree-picker-actions.ts
index 31110175..6ec13bfe 100644
--- a/src/store/project-tree-picker/project-tree-picker-actions.ts
+++ b/src/store/project-tree-picker/project-tree-picker-actions.ts
@@ -4,21 +4,22 @@
import { Dispatch } from "redux";
import { RootState } from "~/store/store";
+import { getUserUuid } from "~/common/getuser";
import { ServiceRepository } from "~/services/services";
import { mockProjectResource } from "~/models/test-utils";
import { treePickerActions, receiveTreePickerProjectsData } from "~/store/tree-picker/tree-picker-actions";
import { TreePickerId } from '~/models/tree';
export const resetPickerProjectTree = () => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- dispatch<any>(treePickerActions.RESET_TREE_PICKER({pickerId: TreePickerId.PROJECTS}));
- dispatch<any>(treePickerActions.RESET_TREE_PICKER({pickerId: TreePickerId.SHARED_WITH_ME}));
- dispatch<any>(treePickerActions.RESET_TREE_PICKER({pickerId: TreePickerId.FAVORITES}));
+ dispatch<any>(treePickerActions.RESET_TREE_PICKER({ pickerId: TreePickerId.PROJECTS }));
+ dispatch<any>(treePickerActions.RESET_TREE_PICKER({ pickerId: TreePickerId.SHARED_WITH_ME }));
+ dispatch<any>(treePickerActions.RESET_TREE_PICKER({ pickerId: TreePickerId.FAVORITES }));
dispatch<any>(initPickerProjectTree());
};
export const initPickerProjectTree = () => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const uuid = services.authService.getUuid();
+ const uuid = getUserUuid(getState());
dispatch<any>(getPickerTreeProjects(uuid));
dispatch<any>(getSharedWithMeProjectsPickerTree(uuid));
@@ -43,4 +44,4 @@ const getProjectsPickerTree = (uuid: string, kind: string) => {
[mockProjectResource({ uuid, name: kind })],
kind
);
-};
\ No newline at end of file
+};
diff --git a/src/store/projects/project-create-actions.ts b/src/store/projects/project-create-actions.ts
index ddcd233f..fe1aeda7 100644
--- a/src/store/projects/project-create-actions.ts
+++ b/src/store/projects/project-create-actions.ts
@@ -5,6 +5,7 @@
import { Dispatch } from "redux";
import { reset, startSubmit, stopSubmit, initialize, FormErrors, formValueSelector, change } from 'redux-form';
import { RootState } from '~/store/store';
+import { getUserUuid } from "~/common/getuser";
import { dialogActions } from "~/store/dialog/dialog-actions";
import { getCommonResourceServiceError, CommonResourceServiceError } from '~/services/common-service/common-resource-service';
import { ProjectResource } from '~/models/project';
@@ -38,7 +39,7 @@ export const isItemNotInProject = (properties: any) => {
if (properties.breadcrumbs) {
return Boolean(properties.breadcrumbs[0].label !== 'Projects');
} else {
- return ;
+ return;
}
};
@@ -47,7 +48,7 @@ export const openProjectCreateDialog = (ownerUuid: string) =>
const router = getState();
const properties = getState().properties;
if (isItemNotInProject(properties) || !isProjectOrRunProcessRoute(router)) {
- const userUuid = getState().auth.user!.uuid;
+ const userUuid = getUserUuid(getState());
dispatch(initialize(PROJECT_CREATE_FORM_NAME, { userUuid }));
} else {
dispatch(initialize(PROJECT_CREATE_FORM_NAME, { ownerUuid }));
@@ -76,12 +77,12 @@ export const addPropertyToCreateProjectForm = (data: ResourcePropertiesFormData)
(dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
const properties = { ...PROJECT_CREATE_FORM_SELECTOR(getState(), 'properties') };
properties[data.key] = data.value;
- dispatch(change(PROJECT_CREATE_FORM_NAME, 'properties', properties ));
+ dispatch(change(PROJECT_CREATE_FORM_NAME, 'properties', properties));
};
export const removePropertyFromCreateProjectForm = (key: string) =>
(dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
const properties = { ...PROJECT_CREATE_FORM_SELECTOR(getState(), 'properties') };
delete properties[key];
- dispatch(change(PROJECT_CREATE_FORM_NAME, 'properties', properties ));
- };
\ No newline at end of file
+ dispatch(change(PROJECT_CREATE_FORM_NAME, 'properties', properties));
+ };
diff --git a/src/store/projects/project-move-actions.ts b/src/store/projects/project-move-actions.ts
index 441b8a6c..fb34fa6e 100644
--- a/src/store/projects/project-move-actions.ts
+++ b/src/store/projects/project-move-actions.ts
@@ -7,6 +7,7 @@ import { dialogActions } from "~/store/dialog/dialog-actions";
import { startSubmit, stopSubmit, initialize, FormErrors } from 'redux-form';
import { ServiceRepository } from '~/services/services';
import { RootState } from '~/store/store';
+import { getUserUuid } from "~/common/getuser";
import { getCommonResourceServiceError, CommonResourceServiceError } from "~/services/common-service/common-resource-service";
import { MoveToFormDialogData } from '~/store/move-to-dialog/move-to-dialog';
import { resetPickerProjectTree } from '~/store/project-tree-picker/project-tree-picker-actions';
@@ -26,7 +27,10 @@ export const openMoveProjectDialog = (resource: { name: string, uuid: string })
export const moveProject = (resource: MoveToFormDialogData) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const userUuid = getState().auth.user!.uuid;
+ const userUuid = getUserUuid(getState());
+ if (!userUuid) {
+ return;
+ }
dispatch(startSubmit(PROJECT_MOVE_FORM_NAME));
try {
const newProject = await services.projectService.update(resource.uuid, { ownerUuid: resource.ownerUuid });
diff --git a/src/store/repositories/repositories-actions.ts b/src/store/repositories/repositories-actions.ts
index 3b77defe..263262f7 100644
--- a/src/store/repositories/repositories-actions.ts
+++ b/src/store/repositories/repositories-actions.ts
@@ -5,6 +5,7 @@
import { Dispatch } from "redux";
import { bindDataExplorerActions } from '~/store/data-explorer/data-explorer-action';
import { RootState } from '~/store/store';
+import { getUserUuid } from "~/common/getuser";
import { ServiceRepository } from "~/services/services";
import { navigateToRepositories } from "~/store/navigation/navigation-action";
import { unionize, ofType, UnionOf } from "~/common/unionize";
@@ -40,7 +41,7 @@ export const openRepositoryAttributes = (uuid: string) =>
export const openRepositoryCreateDialog = () =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const userUuid = await services.authService.getUuid();
+ const userUuid = getUserUuid(getState());
const user = await services.userService.get(userUuid!);
dispatch(reset(REPOSITORY_CREATE_FORM_NAME));
dispatch(dialogActions.OPEN_DIALOG({ id: REPOSITORY_CREATE_FORM_NAME, data: { user } }));
@@ -48,7 +49,7 @@ export const openRepositoryCreateDialog = () =>
export const createRepository = (repository: RepositoryResource) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const userUuid = await services.authService.getUuid();
+ const userUuid = getUserUuid(getState());
const user = await services.userService.get(userUuid!);
dispatch(startSubmit(REPOSITORY_CREATE_FORM_NAME));
try {
diff --git a/src/store/run-process-panel/run-process-panel-actions.ts b/src/store/run-process-panel/run-process-panel-actions.ts
index b543b160..c5fbd532 100644
--- a/src/store/run-process-panel/run-process-panel-actions.ts
+++ b/src/store/run-process-panel/run-process-panel-actions.ts
@@ -6,6 +6,7 @@ import { Dispatch } from 'redux';
import { unionize, ofType, UnionOf } from "~/common/unionize";
import { ServiceRepository } from "~/services/services";
import { RootState } from '~/store/store';
+import { getUserUuid } from "~/common/getuser";
import { WorkflowResource, getWorkflowInputs, parseWorkflowDefinition } from '~/models/workflow';
import { getFormValues, initialize } from 'redux-form';
import { RUN_PROCESS_BASIC_FORM, RunProcessBasicFormData } from '~/views/run-process-panel/run-process-basic-form';
@@ -118,7 +119,7 @@ export const runProcess = async (dispatch: Dispatch<any>, getState: () => RootSt
const basicForm = getFormValues(RUN_PROCESS_BASIC_FORM)(state) as RunProcessBasicFormData;
const inputsForm = getFormValues(RUN_PROCESS_INPUTS_FORM)(state) as WorkflowInputsData;
const advancedForm = getFormValues(RUN_PROCESS_ADVANCED_FORM)(state) as RunProcessAdvancedFormData || DEFAULT_ADVANCED_FORM_VALUES;
- const userUuid = getState().auth.user!.uuid;
+ const userUuid = getUserUuid(getState());
const pathname = getState().runProcessPanel.processPathname;
const { processOwnerUuid, selectedWorkflow } = state.runProcessPanel;
if (selectedWorkflow) {
diff --git a/src/store/search-bar/search-bar-tree-actions.ts b/src/store/search-bar/search-bar-tree-actions.ts
index 5101055a..dadd8771 100644
--- a/src/store/search-bar/search-bar-tree-actions.ts
+++ b/src/store/search-bar/search-bar-tree-actions.ts
@@ -6,6 +6,7 @@ import { getTreePicker, TreePicker } from "~/store/tree-picker/tree-picker";
import { getNode, getNodeAncestorsIds, initTreeNode, TreeNodeStatus } from "~/models/tree";
import { Dispatch } from "redux";
import { RootState } from "~/store/store";
+import { getUserUuid } from "~/common/getuser";
import { ServiceRepository } from "~/services/services";
import { treePickerActions } from "~/store/tree-picker/tree-picker-actions";
import { FilterBuilder } from "~/services/api/filter-builder";
@@ -38,8 +39,12 @@ export const getSearchBarTreeNodeAncestorsIds = (id: string) => (treePicker: Tre
};
export const activateSearchBarTreeBranch = (id: string) =>
- async (dispatch: Dispatch, _: void, services: ServiceRepository) => {
- const ancestors = await services.ancestorsService.ancestors(id, services.authService.getUuid() || '');
+ async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ const userUuid = getUserUuid(getState());
+ if (!userUuid) {
+ return;
+ }
+ const ancestors = await services.ancestorsService.ancestors(id, userUuid);
for (const ancestor of ancestors) {
await dispatch<any>(loadSearchBarTreeProjects(ancestor.uuid));
@@ -98,4 +103,3 @@ const loadSearchBarProject = (projectUuid: string) =>
}));
dispatch(resourcesActions.SET_RESOURCES(items));
};
-
diff --git a/src/store/side-panel-tree/side-panel-tree-actions.ts b/src/store/side-panel-tree/side-panel-tree-actions.ts
index 6ad71391..4aa5e26e 100644
--- a/src/store/side-panel-tree/side-panel-tree-actions.ts
+++ b/src/store/side-panel-tree/side-panel-tree-actions.ts
@@ -5,6 +5,7 @@
import { Dispatch } from 'redux';
import { treePickerActions } from "~/store/tree-picker/tree-picker-actions";
import { RootState } from '~/store/store';
+import { getUserUuid } from "~/common/getuser";
import { ServiceRepository } from '~/services/services';
import { FilterBuilder } from '~/services/api/filter-builder';
import { resourcesActions } from '~/store/resources/resources-actions';
@@ -52,8 +53,11 @@ const SIDE_PANEL_CATEGORIES = [
export const isSidePanelTreeCategory = (id: string) => SIDE_PANEL_CATEGORIES.some(category => category === id);
export const initSidePanelTree = () =>
- (dispatch: Dispatch, _: () => RootState, { authService }: ServiceRepository) => {
- const rootProjectUuid = authService.getUuid() || '';
+ (dispatch: Dispatch, getState: () => RootState, { authService }: ServiceRepository) => {
+ const rootProjectUuid = getUserUuid(getState());
+ if (!rootProjectUuid) {
+ return;
+ }
const nodes = SIDE_PANEL_CATEGORIES.map(id => initTreeNode({ id, value: id }));
const projectsNode = initTreeNode({ id: rootProjectUuid, value: SidePanelTreeCategory.PROJECTS });
const sharedNode = initTreeNode({ id: SidePanelTreeCategory.SHARED_WITH_ME, value: SidePanelTreeCategory.SHARED_WITH_ME });
@@ -155,9 +159,13 @@ export const activateSidePanelTreeProject = (id: string) =>
};
export const activateSidePanelTreeBranch = (id: string) =>
- async (dispatch: Dispatch, _: void, services: ServiceRepository) => {
- const ancestors = await services.ancestorsService.ancestors(id, services.authService.getUuid() || '');
- const isShared = ancestors.every(({ uuid }) => uuid !== services.authService.getUuid());
+ async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ const userUuid = getUserUuid(getState());
+ if (!userUuid) {
+ return;
+ }
+ const ancestors = await services.ancestorsService.ancestors(id, userUuid);
+ const isShared = ancestors.every(({ uuid }) => uuid !== userUuid);
if (isShared) {
await dispatch<any>(loadSidePanelTreeProjects(SidePanelTreeCategory.SHARED_WITH_ME));
}
diff --git a/src/store/store.ts b/src/store/store.ts
index f2eeefaa..1b7173fd 100644
--- a/src/store/store.ts
+++ b/src/store/store.ts
@@ -28,7 +28,6 @@ import { ServiceRepository } from "~/services/services";
import { treePickerReducer } from './tree-picker/tree-picker-reducer';
import { resourcesReducer } from '~/store/resources/resources-reducer';
import { propertiesReducer } from './properties/properties-reducer';
-import { RootState } from './store';
import { fileUploaderReducer } from './file-uploader/file-uploader-reducer';
import { TrashPanelMiddlewareService } from "~/store/trash-panel/trash-panel-middleware-service";
import { TRASH_PANEL_ID } from "~/store/trash-panel/trash-panel-action";
diff --git a/src/store/trash-panel/trash-panel-middleware-service.ts b/src/store/trash-panel/trash-panel-middleware-service.ts
index f5173fc9..c9a6b93d 100644
--- a/src/store/trash-panel/trash-panel-middleware-service.ts
+++ b/src/store/trash-panel/trash-panel-middleware-service.ts
@@ -7,6 +7,7 @@ import {
listResultsToDataExplorerItemsMeta
} from "../data-explorer/data-explorer-middleware-service";
import { RootState } from "../store";
+import { getUserUuid } from "~/common/getuser";
import { DataColumns } from "~/components/data-table/data-table";
import { ServiceRepository } from "~/services/services";
import { SortDirection } from "~/components/data-table/data-column";
@@ -64,9 +65,12 @@ export class TrashPanelMiddlewareService extends DataExplorerMiddlewareService {
.addOrder(sortDirection, columnName, GroupContentsResourcePrefix.PROJECT);
}
+ const userUuid = getUserUuid(api.getState());
+ if (!userUuid) {
+ return;
+ }
try {
api.dispatch(progressIndicatorActions.START_WORKING(this.getId()));
- const userUuid = this.services.authService.getUuid()!;
const listResults = await this.services.groupsService
.contents(userUuid, {
...dataExplorerToListParams(dataExplorer),
@@ -104,4 +108,3 @@ const couldNotFetchTrashContents = () =>
message: 'Could not fetch trash contents.',
kind: SnackbarKind.ERROR
});
-
diff --git a/src/store/tree-picker/tree-picker-actions.ts b/src/store/tree-picker/tree-picker-actions.ts
index e4d6d933..d1eef8fb 100644
--- a/src/store/tree-picker/tree-picker-actions.ts
+++ b/src/store/tree-picker/tree-picker-actions.ts
@@ -6,6 +6,7 @@ import { unionize, ofType, UnionOf } from "~/common/unionize";
import { TreeNode, initTreeNode, getNodeDescendants, TreeNodeStatus, getNode, TreePickerId, Tree } from '~/models/tree';
import { Dispatch } from 'redux';
import { RootState } from '~/store/store';
+import { getUserUuid } from "~/common/getuser";
import { ServiceRepository } from '~/services/services';
import { FilterBuilder } from '~/services/api/filter-builder';
import { pipe, values } from 'lodash/fp';
@@ -156,7 +157,7 @@ export const loadCollection = (id: string, pickerId: string) =>
export const initUserProject = (pickerId: string) =>
async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
- const uuid = services.authService.getUuid();
+ const uuid = getUserUuid(getState());
if (uuid) {
dispatch(receiveTreePickerData({
id: '',
@@ -172,7 +173,7 @@ export const initUserProject = (pickerId: string) =>
};
export const loadUserProject = (pickerId: string, includeCollections = false, includeFiles = false) =>
async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
- const uuid = services.authService.getUuid();
+ const uuid = getUserUuid(getState());
if (uuid) {
dispatch(loadProject({ id: uuid, pickerId, includeCollections, includeFiles }));
}
@@ -232,7 +233,7 @@ interface LoadFavoritesProjectParams {
export const loadFavoritesProject = (params: LoadFavoritesProjectParams) =>
async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
const { pickerId, includeCollections = false, includeFiles = false } = params;
- const uuid = services.authService.getUuid();
+ const uuid = getUserUuid(getState());
if (uuid) {
const filters = pipe(
@@ -313,7 +314,8 @@ export const loadProjectTreePickerProjects = (id: string) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id, pickerId: TreePickerId.PROJECTS }));
- const ownerUuid = id.length === 0 ? services.authService.getUuid() || '' : id;
+
+ const ownerUuid = id.length === 0 ? getUserUuid(getState()) || '' : id;
const { items } = await services.projectService.list(buildParams(ownerUuid));
dispatch<any>(receiveTreePickerProjectsData(id, items, TreePickerId.PROJECTS));
@@ -321,7 +323,7 @@ export const loadProjectTreePickerProjects = (id: string) =>
export const loadFavoriteTreePickerProjects = (id: string) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const parentId = services.authService.getUuid() || '';
+ const parentId = getUserUuid(getState()) || '';
if (id === '') {
dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id: parentId, pickerId: TreePickerId.FAVORITES }));
@@ -337,7 +339,7 @@ export const loadFavoriteTreePickerProjects = (id: string) =>
export const loadPublicFavoriteTreePickerProjects = (id: string) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const parentId = services.authService.getUuid() || '';
+ const parentId = getUserUuid(getState()) || '';
if (id === '') {
dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id: parentId, pickerId: TreePickerId.PUBLIC_FAVORITES }));
@@ -360,4 +362,4 @@ const buildParams = (ownerUuid: string) => {
.addAsc('name')
.getOrder()
};
-};
\ No newline at end of file
+};
diff --git a/src/store/users/users-actions.ts b/src/store/users/users-actions.ts
index fc27b569..05cdc9b6 100644
--- a/src/store/users/users-actions.ts
+++ b/src/store/users/users-actions.ts
@@ -5,6 +5,7 @@
import { Dispatch } from "redux";
import { bindDataExplorerActions } from '~/store/data-explorer/data-explorer-action';
import { RootState } from '~/store/store';
+import { getUserUuid } from "~/common/getuser";
import { ServiceRepository } from "~/services/services";
import { dialogActions } from '~/store/dialog/dialog-actions';
import { startSubmit, reset } from "redux-form";
@@ -58,12 +59,12 @@ export const loginAs = (uuid: string) =>
dispatch<any>(authActions.INIT({ user: data, token: `v2/${client.uuid}/${client.apiToken}` }));
location.reload();
dispatch<any>(navigateToRootProject);
- }
+ }
};
export const openUserCreateDialog = () =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const userUuid = await services.authService.getUuid();
+ const userUuid = getUserUuid(getState());
const user = await services.userService.get(userUuid!);
const virtualMachines = await services.virtualMachineService.list();
dispatch(reset(USER_CREATE_FORM_NAME));
diff --git a/src/store/workbench/workbench-actions.ts b/src/store/workbench/workbench-actions.ts
index dc638387..4f331756 100644
--- a/src/store/workbench/workbench-actions.ts
+++ b/src/store/workbench/workbench-actions.ts
@@ -4,6 +4,7 @@
import { Dispatch } from 'redux';
import { RootState } from "~/store/store";
+import { getUserUuid } from "~/common/getuser";
import { loadDetailsPanel } from '~/store/details-panel/details-panel-action';
import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
import { favoritePanelActions, loadFavoritePanel } from '~/store/favorite-panel/favorite-panel-action';
@@ -177,7 +178,7 @@ export const loadTrash = () =>
export const loadProject = (uuid: string) =>
handleFirstTimeLoad(
async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
- const userUuid = services.authService.getUuid();
+ const userUuid = getUserUuid(getState());
dispatch(setIsProjectPanelTrashed(false));
if (userUuid) {
if (extractUuidKind(uuid) === ResourceKind.USER && userUuid !== uuid) {
@@ -260,7 +261,7 @@ export const updateProject = (data: projectUpdateActions.ProjectUpdateFormDialog
export const loadCollection = (uuid: string) =>
handleFirstTimeLoad(
async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
- const userUuid = services.authService.getUuid();
+ const userUuid = getUserUuid(getState());
if (userUuid) {
const match = await loadGroupContentsResource({ uuid, userUuid, services });
match({
diff --git a/src/views-components/project-tree-picker/project-tree-picker.tsx b/src/views-components/project-tree-picker/project-tree-picker.tsx
index 215c31b7..b9a2bd56 100644
--- a/src/views-components/project-tree-picker/project-tree-picker.tsx
+++ b/src/views-components/project-tree-picker/project-tree-picker.tsx
@@ -13,6 +13,7 @@ import { treePickerActions, loadProjectTreePickerProjects, loadFavoriteTreePicke
import { ListItemTextIcon } from "~/components/list-item-text-icon/list-item-text-icon";
import { ProjectIcon, FavoriteIcon, ProjectsIcon, ShareMeIcon, PublicFavoriteIcon } from '~/components/icon/icon';
import { RootState } from "~/store/store";
+import { getUserUuid } from "~/common/getuser";
import { ServiceRepository } from "~/services/services";
import { WrappedFieldProps } from 'redux-form';
import { TreePickerId } from '~/models/tree';
@@ -45,9 +46,9 @@ const toggleItemOpen = (id: string, status: TreeItemStatus, pickerId: string) =>
if (pickerId === TreePickerId.PROJECTS) {
dispatch<any>(loadProjectTreePickerProjects(id));
} else if (pickerId === TreePickerId.FAVORITES) {
- dispatch<any>(loadFavoriteTreePickerProjects(id === services.authService.getUuid() ? '' : id));
+ dispatch<any>(loadFavoriteTreePickerProjects(id === getUserUuid(getState()) ? '' : id));
} else if (pickerId === TreePickerId.PUBLIC_FAVORITES) {
- dispatch<any>(loadPublicFavoriteTreePickerProjects(id === services.authService.getUuid() ? '' : id));
+ dispatch<any>(loadPublicFavoriteTreePickerProjects(id === getUserUuid(getState()) ? '' : id));
// TODO: load sharedWithMe
}
} else {
@@ -119,4 +120,4 @@ export const CollectionTreePickerField = (props: WrappedFieldProps & PickerIdPro
<Typography variant='caption' color='error'>
{props.meta.error}
</Typography>}
- </div>;
\ No newline at end of file
+ </div>;
diff --git a/src/views/link-account-panel/link-account-panel.tsx b/src/views/link-account-panel/link-account-panel.tsx
index 60166cda..78b7efd2 100644
--- a/src/views/link-account-panel/link-account-panel.tsx
+++ b/src/views/link-account-panel/link-account-panel.tsx
@@ -5,7 +5,7 @@
import { RootState } from '~/store/store';
import { Dispatch } from 'redux';
import { connect } from 'react-redux';
-import { startLinking, cancelLinking, linkAccount, linkAccountPanelActions } from '~/store/link-account-panel/link-account-panel-actions';
+import { startLinking, linkAccount, linkAccountPanelActions, cancelLinking } from '~/store/link-account-panel/link-account-panel-actions';
import { LinkAccountType } from '~/models/link-account';
import {
LinkAccountPanelRoot,
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list