// SPDX-License-Identifier: AGPL-3.0
import { Dispatch } from "redux";
-import { projectActions, getProjectList } from "../project/project-action";
+import { getProjectList, projectActions } from "../project/project-action";
import { push } from "react-router-redux";
- import { TreeItemStatus } from "../../components/tree/tree";
+ import { TreeItemStatus } from "~/components/tree/tree";
import { findTreeItem } from "../project/project-reducer";
import { RootState } from "../store";
- import { ResourceKind } from "../../models/resource";
+ import { Resource, ResourceKind } from "~/models/resource";
import { projectPanelActions } from "../project-panel/project-panel-action";
- import { getCollectionUrl } from "../../models/collection";
- import { getProjectUrl, ProjectResource } from "../../models/project";
- import { ProjectService } from "../../services/project-service/project-service";
- import { ServiceRepository } from "../../services/services";
+ import { getCollectionUrl } from "~/models/collection";
+ import { getProjectUrl, ProjectResource } from "~/models/project";
+ import { ProjectService } from "~/services/project-service/project-service";
+ import { ServiceRepository } from "~/services/services";
import { sidePanelActions } from "../side-panel/side-panel-action";
import { SidePanelIdentifiers } from "../side-panel/side-panel-reducer";
- import { getUuidObjectType, ObjectTypes } from "../../models/object-types";
+ import { getUuidObjectType, ObjectTypes } from "~/models/object-types";
-export const getResourceUrl = <T extends Resource>(resource: T): string => {
- switch (resource.kind) {
- case ResourceKind.PROJECT: return getProjectUrl(resource.uuid);
- case ResourceKind.COLLECTION: return getCollectionUrl(resource.uuid);
- default: return resource.href;
+export const getResourceUrl = (resourceKind: ResourceKind, resourceUuid: string): string => {
+ switch (resourceKind) {
+ case ResourceKind.PROJECT: return getProjectUrl(resourceUuid);
+ case ResourceKind.COLLECTION: return getCollectionUrl(resourceUuid);
+ default:
+ return '';
}
};
export const setProjectItem = (itemId: string, itemMode: ItemMode) =>
(dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ console.log("SetProjectItem!!", itemId);
+ debugger;
const { projects, router } = getState();
const treeItem = findTreeItem(projects.items, itemId);
if (treeItem) {
- const resourceUrl = getResourceUrl(treeItem.data);
+ const resourceUrl = getResourceUrl(treeItem.data.kind, treeItem.data.uuid);
if (itemMode === ItemMode.ACTIVE || itemMode === ItemMode.BOTH) {
if (router.location && !router.location.pathname.includes(resourceUrl)) {
dispatch(projectPanelActions.RESET_PAGINATION());
dispatch(projectPanelActions.REQUEST_ITEMS());
}));
-
} else {
const uuid = services.authService.getUuid();
if (itemId === uuid) {
import * as _ from "lodash";
import { sidePanelActions, SidePanelAction } from './side-panel-action';
- import { SidePanelItem } from '../../components/side-panel/side-panel';
- import { ProjectsIcon, ShareMeIcon, WorkflowIcon, RecentIcon, FavoriteIcon, TrashIcon } from "../../components/icon/icon";
+ import { SidePanelItem } from '~/components/side-panel/side-panel';
+ import { ProjectsIcon, ShareMeIcon, WorkflowIcon, RecentIcon, FavoriteIcon, TrashIcon } from "~/components/icon/icon";
import { Dispatch } from "redux";
import { push } from "react-router-redux";
import { favoritePanelActions } from "../favorite-panel/favorite-panel-action";
import { projectPanelActions } from "../project-panel/project-panel-action";
import { projectActions } from "../project/project-action";
import { getProjectUrl } from "../../models/project";
+import { columns as projectPanelColumns } from "../../views/project-panel/project-panel";
+import { columns as favoritePanelColumns } from "../../views/favorite-panel/favorite-panel";
export type SidePanelState = SidePanelItem[];
activeAction: (dispatch: Dispatch, uuid: string) => {
dispatch(projectActions.TOGGLE_PROJECT_TREE_ITEM_ACTIVE(uuid));
dispatch(push(getProjectUrl(uuid)));
+ dispatch(projectPanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
dispatch(projectPanelActions.RESET_PAGINATION());
- dispatch(projectPanelActions.REQUEST_ITEMS());
+ dispatch(projectPanelActions.REQUEST_ITEMS());
}
},
{
active: false,
activeAction: (dispatch: Dispatch) => {
dispatch(push("/favorites"));
+ dispatch(favoritePanelActions.SET_COLUMNS({ columns: favoritePanelColumns }));
dispatch(favoritePanelActions.RESET_PAGINATION());
dispatch(favoritePanelActions.REQUEST_ITEMS());
}