From: Michal Klobukowski Date: Mon, 27 Aug 2018 06:53:59 +0000 (+0200) Subject: Delete code smells X-Git-Tag: 1.3.0~132^2~9 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/0c46a74e6c0397fa153c345857977f8654ec4471 Delete code smells Feature #14102 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- diff --git a/src/common/api/common-resource-service.ts b/src/common/api/common-resource-service.ts index fe7494b4..2c9bfb51 100644 --- a/src/common/api/common-resource-service.ts +++ b/src/common/api/common-resource-service.ts @@ -111,7 +111,6 @@ export class CommonResourceService { .put(this.resourceType + uuid, data && CommonResourceService.mapKeys(_.snakeCase)(data))); } - } export const getCommonResourceServiceError = (errorResponse: any) => { diff --git a/src/index.tsx b/src/index.tsx index ecc61662..ad771629 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -29,6 +29,7 @@ import { collectionActionSet } from './views-components/context-menu/action-sets import { collectionResourceActionSet } from './views-components/context-menu/action-sets/collection-resource-action-set'; import { addRouteChangeHandlers } from './routes/routes'; import { loadWorkbench } from './store/navigation/navigation-action'; +import { Routes } from '~/routes/routes'; const getBuildNumber = () => "BN-" + (process.env.REACT_APP_BUILD_NUMBER || "dev"); const getGitCommit = () => "GIT-" + (process.env.REACT_APP_GIT_COMMIT || "latest").substr(0, 7); @@ -48,7 +49,7 @@ addMenuActionSet(ContextMenuKind.COLLECTION, collectionActionSet); addMenuActionSet(ContextMenuKind.COLLECTION_RESOURCE, collectionResourceActionSet); fetchConfig() - .then(async (config) => { + .then((config) => { const history = createBrowserHistory(); const services = createServices(config); const store = configureStore(history, services); @@ -65,8 +66,8 @@ fetchConfig()
- - + +
diff --git a/src/routes/routes.ts b/src/routes/routes.ts index 2bdd17a5..7ad73899 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -12,6 +12,7 @@ import { loadProject, loadFavorites, loadCollection } from '../store/navigation/ export const Routes = { ROOT: '/', + TOKEN: '/token', PROJECTS: `/projects/:id(${RESOURCE_UUID_PATTERN})`, COLLECTIONS: `/collections/:id(${RESOURCE_UUID_PATTERN})`, FAVORITES: '/favorites', diff --git a/src/services/ancestors-service/ancestors-service.ts b/src/services/ancestors-service/ancestors-service.ts index 5eab8421..1cd42fb5 100644 --- a/src/services/ancestors-service/ancestors-service.ts +++ b/src/services/ancestors-service/ancestors-service.ts @@ -1,13 +1,13 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + import { GroupsService } from "~/services/groups-service/groups-service"; import { UserService } from '../user-service/user-service'; import { GroupResource } from '~/models/group'; -import { UserResource } from '../../models/user'; +import { UserResource } from '~/models/user'; import { extractUuidObjectType, ResourceObjectType } from "~/models/resource"; -// Copyright (C) The Arvados Authors. All rights reserved. -// -// SPDX-License-Identifier: AGPL-3.0 - export class AncestorService { constructor( private groupsService: GroupsService, diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts index 07426b75..ac2e0b7e 100644 --- a/src/store/auth/auth-action.ts +++ b/src/store/auth/auth-action.ts @@ -31,17 +31,16 @@ function removeAuthorizationHeader(client: AxiosInstance) { delete client.defaults.headers.common.Authorization; } -export const initAuth = () => - (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - const user = services.authService.getUser(); - const token = services.authService.getApiToken(); - if (token) { - setAuthorizationHeader(services, token); - } - if (token && user) { - dispatch(authActions.INIT({ user, token })); - } - }; +export const initAuth = () => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + const user = services.authService.getUser(); + const token = services.authService.getApiToken(); + if (token) { + setAuthorizationHeader(services, token); + } + if (token && user) { + dispatch(authActions.INIT({ user, token })); + } +}; export const saveApiToken = (token: string) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { services.authService.saveApiToken(token); diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index a4defc14..a3ee07ee 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -13,7 +13,6 @@ import { MainAppBar, MainAppBarActionProps, MainAppBarMenuItem } from '~/views-c import { Breadcrumb } from '~/components/breadcrumbs/breadcrumbs'; import { push } from 'react-router-redux'; import { TreeItem } from "~/components/tree/tree"; -import { getTreePath } from '~/store/project/project-reducer'; import { ProjectPanel } from "~/views/project-panel/project-panel"; import { DetailsPanel } from '~/views-components/details-panel/details-panel'; import { ArvadosTheme } from '~/common/custom-theme'; @@ -161,15 +160,6 @@ export const Workbench = withStyles(styles)( }; render() { - const path = getTreePath(this.props.projects, this.props.currentProjectId); - const breadcrumbs = path.map(item => ({ - label: item.data.name, - itemId: item.data.uuid, - status: item.status - })); - - const rootProjectUuid = this.props.authService.getUuid(); - const { classes, user } = this.props; return (