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 { SidePanelId } from "../side-panel/side-panel-reducer";
import { getUuidObjectType, ObjectTypes } from "~/models/object-types";
export const getResourceUrl = (resourceKind: ResourceKind, resourceUuid: string): string => {
const ancestors = await loadProjectAncestors(itemId, services.projectService);
const uuids = ancestors.map(ancestor => ancestor.uuid);
await loadBranch(uuids, dispatch);
- dispatch(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_OPEN(SidePanelIdentifiers.PROJECTS));
+ dispatch(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_OPEN(SidePanelId.PROJECTS));
uuids.forEach(uuid => {
dispatch(projectActions.TOGGLE_PROJECT_TREE_ITEM_OPEN(uuid));
});
// SPDX-License-Identifier: AGPL-3.0
import { default as unionize, ofType, UnionOf } from "unionize";
+import { SidePanelId } from "~/store/side-panel/side-panel-reducer";
export const sidePanelActions = unionize({
- TOGGLE_SIDE_PANEL_ITEM_OPEN: ofType<string>()
+ TOGGLE_SIDE_PANEL_ITEM_OPEN: ofType<SidePanelId>()
}, {
tag: 'type',
value: 'payload'
export type SidePanelState = SidePanelItem[];
-export const sidePanelReducer = (state: SidePanelState = sidePanelData, action: SidePanelAction) => {
+export const sidePanelReducer = (state: SidePanelState = sidePanelItems, action: SidePanelAction) => {
return sidePanelActions.match(action, {
TOGGLE_SIDE_PANEL_ITEM_OPEN: itemId =>
state.map(it => ({...it, open: itemId === it.id && it.open === false})),
});
};
-export enum SidePanelIdentifiers {
+export enum SidePanelId {
PROJECTS = "Projects",
SHARED_WITH_ME = "SharedWithMe",
WORKFLOWS = "Workflows",
TRASH = "Trash"
}
-export const sidePanelData = [
+export const sidePanelItems = [
{
- id: SidePanelIdentifiers.PROJECTS,
+ id: SidePanelId.PROJECTS,
name: "Projects",
url: "/projects",
icon: ProjectsIcon,
}
},
{
- id: SidePanelIdentifiers.SHARED_WITH_ME,
+ id: SidePanelId.SHARED_WITH_ME,
name: "Shared with me",
url: "/shared",
icon: ShareMeIcon,
}
},
{
- id: SidePanelIdentifiers.WORKFLOWS,
+ id: SidePanelId.WORKFLOWS,
name: "Workflows",
url: "/workflows",
icon: WorkflowIcon,
}
},
{
- id: SidePanelIdentifiers.RECENT_OPEN,
+ id: SidePanelId.RECENT_OPEN,
name: "Recent open",
url: "/recent",
icon: RecentIcon,
}
},
{
- id: SidePanelIdentifiers.FAVORITES,
+ id: SidePanelId.FAVORITES,
name: "Favorites",
url: "/favorites",
icon: FavoriteIcon,
}
},
{
- id: SidePanelIdentifiers.TRASH,
+ id: SidePanelId.TRASH,
name: "Trash",
url: "/trash",
icon: TrashIcon,
import { detailsPanelActions, loadDetails } from "~/store/details-panel/details-panel-action";
import { contextMenuActions } from "~/store/context-menu/context-menu-actions";
-import { SidePanelIdentifiers } from '~/store/side-panel/side-panel-reducer';
import { ProjectResource } from '~/models/project';
import { ResourceKind } from '~/models/resource';
import { ContextMenu, ContextMenuKind } from "~/views-components/context-menu/context-menu";