Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/components/AddPipeline/AddPipeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import { SpinContainer } from "../Common";
import Pipelines from "../PipelinesCopy";
import { PipelineContext, Types } from "../PipelinesCopy/context";

const AddPipeline = ({
addNodeLocally,
}: {
type Props = {
addNodeLocally: (instance: PluginInstance | PluginInstance[]) => void;
}) => {
isStaff: boolean;
};
export default (props: Props) => {
const { addNodeLocally, isStaff } = props;
const { state, dispatch } = useContext(PipelineContext);
const { pipelineToAdd, selectedPipeline, computeInfo, titleInfo } = state;
const reactDispatch = useAppDispatch();
Expand Down Expand Up @@ -155,7 +156,7 @@ const AddPipeline = ({
</Fragment>,
]}
>
<Pipelines />
<Pipelines isStaff={isStaff} />
{mutation.isError || mutation.isSuccess || mutation.isPending ? (
<div id="indicators">
{mutation.isError && (
Expand All @@ -170,5 +171,3 @@ const AddPipeline = ({
</Modal>
);
};

export default AddPipeline;
12 changes: 10 additions & 2 deletions src/components/ComputePage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ThunkModuleToFunc, UseThunk } from "@chhsiao1981/use-thunk";
import { PageSection } from "@patternfly/react-core";
import { useEffect } from "react";
import type * as DoDrawer from "../../reducers/drawer";
import type * as DoUI from "../../reducers/ui";
import type * as DoUser from "../../reducers/user";
import Wrapper from "../Wrapper";
Expand All @@ -9,21 +10,28 @@ import Title from "./Title";

type TDoUI = ThunkModuleToFunc<typeof DoUI>;
type TDoUser = ThunkModuleToFunc<typeof DoUser>;
type TDoDrawer = ThunkModuleToFunc<typeof DoDrawer>;

type Props = {
useUI: UseThunk<DoUI.State, TDoUI>;
useUser: UseThunk<DoUser.State, TDoUser>;
useDrawer: UseThunk<DoDrawer.State, TDoDrawer>;
};

export default (props: Props) => {
const { useUI, useUser } = props;
const { useUI, useUser, useDrawer } = props;

useEffect(() => {
document.title = "Compute Catalog";
}, []);

return (
<Wrapper useUI={useUI} useUser={useUser} titleComponent={Title}>
<Wrapper
useUI={useUI}
useUser={useUser}
useDrawer={useDrawer}
title={Title}
>
<PageSection>
<ComputeCatalog />
</PageSection>
Expand Down
16 changes: 5 additions & 11 deletions src/components/CreateFeed/utils.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
import type {
Pipeline,
PluginInstance,
PluginMeta,
Tag,
} from "@fnndsc/chrisapi";
import type { Pipeline, PluginMeta, Tag } from "@fnndsc/chrisapi";
import type { EventDataNode } from "rc-tree/lib/interface";
import ChrisAPIClient from "../../api/chrisapiclient";
import { fetchResource, fetchResources } from "../../api/common";
import { fetchFolders } from "../NewLibrary";
import type { ChRISFeed, DataBreadcrumb } from "./types/feed";

import constants from "../../datasets/constants";

import type {
NodeInfo,
PipelineDefaultParameters,
Piping,
} from "../../api/types";

import constants from "../../datasets/constants";
import fetchFolders from "../NewLibrary/utils/fetchFolders";
import type { ChRISFeed, DataBreadcrumb } from "./types/feed";

export const computeWorkflowNodesInfo = (
pipings: Piping[],
params: PipelineDefaultParameters[],
Expand Down
8 changes: 4 additions & 4 deletions src/components/DarkTheme/useTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
useReducer,
} from "react";

interface ThemeContextType {
type ThemeContextType = {
isDarkTheme: boolean;
toggleTheme: () => void;
}
};

const THEME_STORAGE_KEY = "themePreference";

Expand Down Expand Up @@ -40,10 +40,10 @@ const themeReducer = (
}
};

type ThemeContextProviderProps = {
type Props = {
children: ReactNode;
};
const ThemeContextProvider = (props: ThemeContextProviderProps) => {
const ThemeContextProvider = (props: Props) => {
const { children } = props;
const [themeState, dispatch] = useReducer(themeReducer, {
isDarkTheme: localStorage.getItem(THEME_STORAGE_KEY) !== "light",
Expand Down
14 changes: 10 additions & 4 deletions src/components/Dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {
PageSection,
} from "@patternfly/react-core";
import { useEffect } from "react";
import BUILD_VERSION from "../../getBuildVersion";
import { InfoSection } from "../Common";
import Wrapper from "../Wrapper";
import FeedGraph from "./FeedGraph";
import "./dashboard.css";
Expand All @@ -22,6 +20,7 @@ import {
type UseThunk,
} from "@chhsiao1981/use-thunk";
import { useNavigate } from "react-router";
import type * as DoDrawer from "../../reducers/drawer";
import type * as DoUI from "../../reducers/ui";
import * as DoUser from "../../reducers/user";
import Title from "./Title";
Expand All @@ -33,14 +32,16 @@ import {

type TDoUI = ThunkModuleToFunc<typeof DoUI>;
type TDoUser = ThunkModuleToFunc<typeof DoUser>;
type TDoDrawer = ThunkModuleToFunc<typeof DoDrawer>;

type Props = {
useUI: UseThunk<DoUI.State, TDoUI>;
useUser: UseThunk<DoUser.State, TDoUser>;
useDrawer: UseThunk<DoDrawer.State, TDoDrawer>;
};

export default (props: Props) => {
const { useUI, useUser } = props;
const { useUI, useUser, useDrawer } = props;
const [classStateUser, _] = useUser;
const user = getState(classStateUser) || DoUser.defaultState;
const { isLoggedIn } = user;
Expand All @@ -57,7 +58,12 @@ export default (props: Props) => {
}, [isLoggedIn]);

return (
<Wrapper titleComponent={Title} useUI={useUI} useUser={useUser}>
<Wrapper
title={Title}
useUI={useUI}
useUser={useUser}
useDrawer={useDrawer}
>
<PageSection>
<Grid hasGutter>
<GridItem span={12}>
Expand Down
39 changes: 39 additions & 0 deletions src/components/FeedDetails/ButtonContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {
getRootID,
type ThunkModuleToFunc,
type UseThunk,
} from "@chhsiao1981/use-thunk";
import type { ReactNode } from "react";
import type * as DoDrawer from "../../reducers/drawer";
import type { ActionType } from "../../reducers/drawer";
import { ButtonWithTooltip } from "../Feeds/DrawerUtils";

type TDoDrawer = ThunkModuleToFunc<typeof DoDrawer>;

type Props = {
actionType: ActionType;
icon: ReactNode;
title: string;
isDisabled: boolean;

useDrawer: UseThunk<DoDrawer.State, TDoDrawer>;
};

export default (props: Props) => {
const { actionType, icon, title, isDisabled, useDrawer } = props;
const [classStateDrawer, doDrawer] = useDrawer;
const drawerID = getRootID(classStateDrawer);
return (
<ButtonWithTooltip
position="bottom"
className="button-style large-button"
content={<span>{title}</span>}
Icon={icon}
variant="primary"
onClick={() => {
doDrawer.toggle(drawerID, actionType);
}}
isDisabled={isDisabled}
/>
);
};
Loading