& P>,
props: Partial
) => CancelablePromise;
+ component?: React.ReactNode | undefined;
};
export const DialogContext = React.createContext({
@@ -94,9 +86,7 @@ export const DialogProvider = ({ children }: { children: React.ReactNode }) => {
};
return (
-
- {Component && Component}
-
+
{children}
);
diff --git a/src/layout/page/Refetcher.tsx b/src/layout/page/Refetcher.tsx
new file mode 100644
index 0000000..0e92a05
--- /dev/null
+++ b/src/layout/page/Refetcher.tsx
@@ -0,0 +1,21 @@
+import { useState } from "react";
+import { BiRefresh } from "react-icons/bi";
+
+export const Refetcher = (props: { refetch: () => Promise }) => {
+ const [refetching, setRefetching] = useState(false);
+
+ const onClick = async () => {
+ setRefetching(true);
+ await props.refetch();
+ setRefetching(false);
+ };
+
+ return (
+
+ );
+};
diff --git a/src/linker.tsx b/src/linker.tsx
index 43a5c43..eff4a8a 100644
--- a/src/linker.tsx
+++ b/src/linker.tsx
@@ -1,15 +1,15 @@
import React from "react";
import { NavLink, NavLinkProps } from "react-router-dom";
+import { Identifier } from "./mates/types";
import { CommentableModels, LinkableModels } from "./mikro/api/graphql";
-import { Accept, Identifier } from "./rekuest/postman/mater/mater-context";
import {
ClassNameOptions,
SmartModel,
SmartModelProps,
} from "./rekuest/selection/SmartModel";
-export interface CreatedSmartSmartProps
- extends Omit, "accepts" | "identifier"> {
+export interface CreatedSmartSmartProps
+ extends Omit {
object: string;
dropClassName?: (props: ClassNameOptions) => string;
dragClassName?: (props: ClassNameOptions) => string;
@@ -18,18 +18,14 @@ export interface CreatedSmartSmartProps
children: React.ReactNode;
}
-export type CreatedSmartProps = Omit<
- SmartModelProps,
- "accepts" | "identifier"
->;
+export type CreatedSmartProps = Omit;
-export const buildSmartModel = (
- identifier: Identifier,
- accepts: T[]
-): React.FC> => {
+export const buildSmartModel = (
+ identifier: Identifier
+): React.FC => {
return ({ children, ...props }) => {
return (
-
+
{children}
);
@@ -92,14 +88,6 @@ const linkBuilder = (model: Identifier, to: string) => (object: string) => {
return `/user/${getModelBase(model)}/${to}/${object}`;
};
-const buildLinks = (model: Identifier, to: string) => {
- return [
- buildBaseLink(model, to),
- buildModelLink(model, to),
- linkBuilder(model, to),
- ];
-};
-
export const buildModuleLink = (module: string) => {
return ({ children, ...props }: OmitedNavLinkProps) => {
return (
@@ -129,404 +117,131 @@ export const GlobalLink = ({
);
};
-export const buildSmart = (
- model: Identifier,
- to: string,
- accepts: T[]
-) => {
+export const buildSmart = (model: Identifier, to: string) => {
x[model] = linkBuilder(model, to);
return {
DetailLink: buildModelLink(model, to),
ListLink: buildBaseLink(model, to),
linkBuilder: linkBuilder(model, to),
- Smart: buildSmartModel(model, accepts),
+ Smart: buildSmartModel(model),
};
};
export const Representation = buildSmart(
"@mikro/representation",
- "representations",
- [
- "list:@mikro/sample",
- "item:@mikro/sample",
- "list:@mikro/model",
- "item:@mikro/model",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
- ]
+ "representations"
+);
+
+export const Image = buildSmart("@mikronext/image", "images");
+
+export const History = buildSmart("@mikronext/history", "history");
+
+export const TransformationView = buildSmart(
+ "@mikronext/transformationview",
+ "transformationviews"
);
-export const Graph = buildSmart("@mikro/graph", "graphs", [
- "list:@mikro/graph",
- "item:@mikro/graph",
- "list:@mikro/model",
- "item:@mikro/model",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Label = buildSmart("@mikro/label", "labels", []);
-export const Feature = buildSmart("@mikro/feature", "features", []);
-
-export const Sample = buildSmart("@mikro/sample", "samples", [
- "list:@mikro/roi",
- "item:@mikro/roi",
- "list:@mikro/sample",
- "item:@mikro/sample",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Roi = buildSmart("@mikro/roi", "rois", [
- "list:@mikro/roi",
- "item:@mikro/roi",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Thumbnail = buildSmart("@mikro/thumbnail", "thumbnails", [
- "list:@mikro/thumbnail",
- "item:@mikro/thumbnail",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Context = buildSmart("@mikro/context", "contexts", [
- "list:@mikro/link",
- "item:@mikro/link",
- "list:@mikro/context",
- "item:@mikro/context",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Link = buildSmart("@mikro/link", "links", [
- "list:@mikro/link",
- "item:@mikro/link",
- "list:@mikro/context",
- "item:@mikro/context",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Model = buildSmart("@mikro/model", "models", [
- "list:@mikro/model",
- "item:@mikro/model",
- "list:@mikro/context",
- "item:@mikro/context",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Stage = buildSmart("@mikro/stage", "stages", [
- "list:@mikro/stage",
- "item:@mikro/stage",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Position = buildSmart("@mikro/position", "positions", [
- "list:@mikro/position",
- "item:@mikro/position",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Video = buildSmart("@mikro/video", "videos", [
- "list:@mikro/video",
- "item:@mikro/video",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const DimensionMap = buildSmart("@mikro/dimensionmap", "dimensionmaps", [
- "list:@mikro/dimensionmap",
- "item:@mikro/dimensionmap",
- "list:@mikro/position",
- "item:@mikro/position",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Channel = buildSmart("@mikro/channel", "channels", [
- "list:@mikro/channel",
- "item:@mikro/channel",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Objective = buildSmart("@mikro/objective", "objectives", [
- "list:@mikro/objective",
- "item:@mikro/objective",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Instrument = buildSmart("@mikro/instrument", "instruments", [
- "list:@mikro/instrument",
- "item:@mikro/instrument",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const MikroFile = buildSmart("@mikro/omerofile", "files", [
- "list:@mikro/sample",
- "item:@mikro/sample",
- "list:@mikro/omerofile",
- "item:@mikro/omerofile",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const View = buildSmart("@mikro/view", "views", [
- "list:@mikro/view",
- "item:@mikro/view",
- "list:@mikro/omerofile",
- "item:@mikro/omerofile",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Era = buildSmart("@mikro/era", "eras", [
- "list:@mikro/era",
- "item:@mikro/era",
- "list:@mikro/omerofile",
- "item:@mikro/omerofile",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Timepoint = buildSmart("@mikro/timepoint", "timepoints", [
- "list:@mikro/timepoint",
- "item:@mikro/timepoint",
- "list:@mikro/omerofile",
- "item:@mikro/omerofile",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Metric = buildSmart("@mikro/metric", "metrics", [
- "list:@mikro/sample",
- "item:@mikro/sample",
- "list:@mikro/metric",
- "item:@mikro/metric",
- "list:@mikro/omerofile",
- "item:@mikro/omerofile",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Table = buildSmart("@mikro/table", "tables", [
- "list:@mikro/roi",
- "item:@mikro/roi",
- "list:@mikro/table",
- "item:@mikro/table",
- "list:@mikro/sample",
- "item:@mikro/sample",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Plot = buildSmart("@mikro/plot", "plots", [
- "list:@mikro/plot",
- "item:@mikro/plot",
- "list:@mikro/table",
- "item:@mikro/table",
- "list:@mikro/sample",
- "item:@mikro/sample",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Experiment = buildSmart("@mikro/experiment", "experiments", [
- "list:@mikro/sample",
- "item:@mikro/sample",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-
-export const Dataset = buildSmart("@mikro/dataset", "datasets", [
- "list:@mikro/dataset",
- "item:@mikro/dataset",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-export const Node = buildSmart("@rekuest/node", "nodes", [
- "list:@rekuest/node",
- "item:@rekuest/node",
- "list:@rekuest/assignation",
- "item:@rekuest/assignation",
-]);
-
-export const Protocol = buildSmart("@rekuest/protocol", "protocols", [
- "list:@rekuest/protocol",
- "item:@rekuest/protocol",
- "list:@rekuest/assignation",
- "item:@rekuest/assignation",
-]);
-
-export const Collection = buildSmart("@rekuest/collection", "collections", [
- "list:@rekuest/collection",
- "item:@rekuest/collection",
-]);
-export const Reservation = buildSmart("@rekuest/reservation", "reservations", [
- "list:@rekuest/reservation",
- "item:@rekuest/reservation",
- "list:@rekuest/node",
- "item:@rekuest/node",
-]);
+export const LabelView = buildSmart("@mikronext/labelview", "labelviews");
+
+export const File = buildSmart("@mikronext/file", "files");
+
+export const ChannelView = buildSmart("@mikronext/channelview", "channelviews");
+
+export const OpticsView = buildSmart("@mikronext/opticsview", "opticsviews");
+
+export const Graph = buildSmart("@mikro/graph", "graphs");
+
+export const Label = buildSmart("@mikro/label", "labels");
+export const Feature = buildSmart("@mikro/feature", "features");
+
+export const Sample = buildSmart("@mikro/sample", "samples");
+
+export const Roi = buildSmart("@mikro/roi", "rois");
+
+export const Thumbnail = buildSmart("@mikro/thumbnail", "thumbnails");
+
+export const Context = buildSmart("@mikro/context", "contexts");
+
+export const Link = buildSmart("@mikro/link", "links");
+
+export const Model = buildSmart("@mikro/model", "models");
+
+export const Stage = buildSmart("@mikro/stage", "stages");
+
+export const Position = buildSmart("@mikro/position", "positions");
+
+export const Video = buildSmart("@mikro/video", "videos");
+
+export const DimensionMap = buildSmart("@mikro/dimensionmap", "dimensionmaps");
+
+export const Channel = buildSmart("@mikro/channel", "channels");
+
+export const Objective = buildSmart("@mikro/objective", "objectives");
+
+export const Instrument = buildSmart("@mikro/instrument", "instruments");
+
+export const MikroFile = buildSmart("@mikro/omerofile", "files");
+
+export const View = buildSmart("@mikro/view", "views");
+
+export const Era = buildSmart("@mikro/era", "eras");
+
+export const Timepoint = buildSmart("@mikro/timepoint", "timepoints");
+
+export const Metric = buildSmart("@mikro/metric", "metrics");
+
+export const Table = buildSmart("@mikro/table", "tables");
+
+export const Plot = buildSmart("@mikro/plot", "plots");
+
+export const Experiment = buildSmart("@mikro/experiment", "experiments");
+
+export const Dataset = buildSmart("@mikro/dataset", "datasets");
+export const Node = buildSmart("@rekuest/node", "nodes");
+
+export const Protocol = buildSmart("@rekuest/protocol", "protocols");
+
+export const Collection = buildSmart("@rekuest/collection", "collections");
+export const Reservation = buildSmart("@rekuest/reservation", "reservations");
export const MirrorRepository = buildSmart(
"@rekuest/mirrorrepository",
- "repositories",
- ["list:@rekuest/mirrorrepository", "item:@rekuest/mirrorrepository"]
+ "repositories"
);
export const AppRepository = buildSmart(
"@rekuest/apprepository",
- "repositories",
- ["list:@rekuest/apprepository", "item:@rekuest/apprepository"]
+ "repositories"
);
-export const Provision = buildSmart("@rekuest/provision", "provisions", [
- "list:@rekuest/provision",
- "item:@rekuest/provision",
-]);
-
-export const TestResult = buildSmart("@rekuest/testresult", "testresults", [
- "list:@rekuest/testresult",
- "item:@rekuest/testresult",
-]);
-
-export const TestCase = buildSmart("@rekuest/testcase", "testcases", [
- "list:@rekuest/testcase",
- "item:@rekuest/testcase",
-]);
-export const Agent = buildSmart("@rekuest/agent", "agents", [
- "list:@rekuest/agent",
- "item:@rekuest/agent",
- "item:@rekuest/assignation",
-]);
-export const Assignation = buildSmart("@rekuest/assignation", "assignations", [
- "list:@rekuest/assignation",
- "item:@rekuest/assignation",
-]);
-export const Template = buildSmart("@rekuest/template", "templates", [
- "list:@rekuest/template",
- "item:@rekuest/template",
-]);
-
-export const Workspace = buildSmart("@fluss/workspace", "workspaces", [
- "list:@fluss/workspace",
- "item:@fluss/workspace",
-]);
-export const Flow = buildSmart("@fluss/flow", "flows", [
- "list:@fluss/run",
- "item:@fluss/run",
-]);
-export const Run = buildSmart("@fluss/run", "runs", [
- "list:@fluss/run",
- "item:@fluss/run",
-]);
-export const Snapshot = buildSmart("@fluss/snapshot", "snapshots", [
- "list:@fluss/run",
- "item:@fluss/run",
-]);
-
-export const User = buildSmart("@lok/user", "users", [
- "list:@lok/user",
- "item:@lok/user",
- "list:@mikro/sample",
- "item:@mikro/sample",
- "list:@mikro/experiment",
- "item:@mikro/experiment",
- "item:@mikro/experiment",
- "list:@mikro/representation",
- "item:@mikro/representation",
-]);
-export const Team = buildSmart("@lok/team", "teams", [
- "list:@lok/user",
- "item:@lok/user",
- "list:@lok/team",
- "item:@lok/team",
-]);
-
-export const Client = buildSmart("@lok/client", "clients", [
- "list:@lok/client",
- "item:@lok/client",
-]);
-
-export const App = buildSmart("@lok/app", "apps", [
- "list:@lok/app",
- "item:@lok/app",
-]);
-
-export const Release = buildSmart("@lok/c", "releases", [
- "list:@lok/release",
- "item:@lok/release",
-]);
-
-export const Container = buildSmart("@port/container", "containers", [
- "list:@port/container",
- "item:@port/container",
-]);
-
-export const Whale = buildSmart("@port/whale", "whales", [
- "list:@port/whale",
- "item:@port/whale",
-]);
-
-export const GithubRepo = buildSmart("@port/githubrepo", "githubrepos", [
- "list:@port/githubrepo",
- "item:@port/githubrepo",
-]);
-
-export const Deployment = buildSmart("@port/deployment", "deployments", [
- "list:@port/deployment",
- "item:@port/deployment",
-]);
+export const Provision = buildSmart("@rekuest/provision", "provisions");
+
+export const TestResult = buildSmart("@rekuest/testresult", "testresults");
+
+export const TestCase = buildSmart("@rekuest/testcase", "testcases");
+export const Agent = buildSmart("@rekuest/agent", "agents");
+export const Assignation = buildSmart("@rekuest/assignation", "assignations");
+export const Template = buildSmart("@rekuest/template", "templates");
+
+export const Workspace = buildSmart("@fluss/workspace", "workspaces");
+export const Flow = buildSmart("@fluss/flow", "flows");
+export const Run = buildSmart("@fluss/run", "runs");
+export const Snapshot = buildSmart("@fluss/snapshot", "snapshots");
+
+export const User = buildSmart("@lok/user", "users");
+export const Team = buildSmart("@lok/team", "teams");
+
+export const Client = buildSmart("@lok/client", "clients");
+
+export const App = buildSmart("@lok/app", "apps");
+
+export const Release = buildSmart("@lok/c", "releases");
+
+export const Container = buildSmart("@port/container", "containers");
+
+export const Whale = buildSmart("@port/whale", "whales");
+
+export const GithubRepo = buildSmart("@port/githubrepo", "githubrepos");
+
+export const Deployment = buildSmart("@port/deployment", "deployments");
export const RekuestLink = buildModuleLink("rekuest");
export const FlussLink = buildModuleLink("fluss");
@@ -538,7 +253,7 @@ export const FakeSmartModel = {
DetailLink: buildModelLink("fake/fake", "fake"),
ListLink: buildBaseLink("fake/fake", "fake"),
linkBuilder: (object: string) => "fakelink",
- Smart: (props: CreatedSmartProps) => {props.children}
,
+ Smart: (props: CreatedSmartProps) => {props.children}
,
};
export const getDefaultSmartModel = (ident: Identifier) => {
diff --git a/src/lok/context.tsx b/src/lok/LokContext.tsx
similarity index 63%
rename from src/lok/context.tsx
rename to src/lok/LokContext.tsx
index ebc9ddf..b3b967f 100644
--- a/src/lok/context.tsx
+++ b/src/lok/LokContext.tsx
@@ -2,29 +2,29 @@ import { ApolloClient, NormalizedCacheObject, useQuery } from "@apollo/client";
import React, { useContext } from "react";
import { ManConfig } from "./types";
-export type ManContextType = {
+export type LokContextType = {
client?: ApolloClient;
configure: (config?: ManConfig) => void;
config?: ManConfig;
};
-export const ManContext = React.createContext({
+export const LokContext = React.createContext({
config: {} as ManConfig,
configure: () => {
throw Error("No Provider in context not configured");
},
});
-export const useMan = () => useContext(ManContext);
+export const useLok = () => useContext(LokContext);
-export const useManQuery = (query: any) => {
- const { client } = useMan();
+export const useLokQuery = (query: any) => {
+ const { client } = useLok();
return useQuery(query, { client: client });
};
-export function withMan any>(func: T): T {
+export function withLok any>(func: T): T {
const Wrapped = (nana: any) => {
- const { client } = useMan();
+ const { client } = useLok();
return func({ ...nana, client: client });
};
return Wrapped as T;
diff --git a/src/lok/guard.tsx b/src/lok/LokGuard.tsx
similarity index 70%
rename from src/lok/guard.tsx
rename to src/lok/LokGuard.tsx
index 4170dae..bfee575 100644
--- a/src/lok/guard.tsx
+++ b/src/lok/LokGuard.tsx
@@ -1,12 +1,12 @@
import React from "react";
-import { useMan } from "./context";
+import { useLok } from "./LokContext";
-export const ManGuard: React.FC<{
+export const LokGuard: React.FC<{
key?: string;
fallback?: React.ReactNode;
children: React.ReactNode;
}> = ({ key, children, fallback }) => {
- const { client } = useMan();
+ const { client } = useLok();
if (client) return <>{children}>;
@@ -18,8 +18,8 @@ export const manGuarded = (
fallback?: React.ReactNode
) => {
return (props: any) => (
-
+
-
+
);
};
diff --git a/src/lok/LokModule.tsx b/src/lok/LokModule.tsx
new file mode 100644
index 0000000..38dc0d1
--- /dev/null
+++ b/src/lok/LokModule.tsx
@@ -0,0 +1,50 @@
+import React from "react";
+import { Route, Routes } from "react-router";
+import { ModuleLayout } from "../layout/ModuleLayout";
+
+import { LokGuard } from "./LokGuard";
+import TeamHome from "./pages/TeamHome";
+import { LokApp } from "./pages/apps/LokApp";
+import { LokApps } from "./pages/apps/LokApps";
+import { LokClient } from "./pages/clients/LokClient";
+import { LokClients } from "./pages/clients/LokClients";
+import { LokRelease } from "./pages/releases/LokRelease";
+import { LokReleases } from "./pages/releases/LokReleases";
+import { ManTeam } from "./pages/teams/ManTeam";
+import { ManTeams } from "./pages/teams/ManTeams";
+import { ManUser } from "./pages/users/ManUser";
+import { ManUsers } from "./pages/users/ManUsers";
+import SidePane from "./panes/SidePane";
+interface Props {}
+
+export const MikroModule: React.FC = (props) => {
+ return (
+ Loading>}>
+ ,
+ },
+ ]}
+ >
+
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+
+
+
+ );
+};
+
+export default MikroModule;
diff --git a/src/lok/LokProvider.tsx b/src/lok/LokProvider.tsx
new file mode 100644
index 0000000..8141489
--- /dev/null
+++ b/src/lok/LokProvider.tsx
@@ -0,0 +1,41 @@
+import { ApolloClient, NormalizedCacheObject } from "@apollo/client";
+import React, { useState } from "react";
+import { LokContext } from "./LokContext";
+import { createManClient } from "./client";
+import { LokConfig } from "./types";
+
+export type LokProviderProps = {
+ register?: boolean;
+ children: React.ReactNode;
+};
+
+export const LokProvider: React.FC = ({
+ register = true,
+ children,
+}) => {
+ const [client, setClient] = useState<
+ ApolloClient | undefined
+ >();
+ const [config, setConfig] = useState();
+
+ const configure = (config?: LokConfig) => {
+ setConfig(config);
+ if (!config) {
+ setClient(undefined);
+ return;
+ }
+
+ setClient(createManClient(config));
+ };
+
+ return (
+
+ {children}
+
+ );
+};
diff --git a/src/lok/components/App.tsx b/src/lok/components/App.tsx
index 44306df..360a40e 100644
--- a/src/lok/components/App.tsx
+++ b/src/lok/components/App.tsx
@@ -6,7 +6,7 @@ import { SectionTitle } from "../../layout/SectionTitle";
import { Release } from "../../linker";
import { useMikro } from "../../mikro/MikroContext";
import { useAppQuery } from "../api/graphql";
-import { withMan } from "../man";
+import { withLok } from "../LokContext";
import { ChangeAppDialog } from "./dialogs/ChangeAppDialog";
export type AppProps = {
@@ -14,7 +14,7 @@ export type AppProps = {
};
export const App: React.FC = (props) => {
- const { data } = withMan(useAppQuery)({ variables: { id: props.id } });
+ const { data } = withLok(useAppQuery)({ variables: { id: props.id } });
const { s3resolve } = useMikro();
diff --git a/src/lok/components/AppImage.tsx b/src/lok/components/AppImage.tsx
index e833039..d5a386a 100644
--- a/src/lok/components/AppImage.tsx
+++ b/src/lok/components/AppImage.tsx
@@ -1,12 +1,12 @@
import { useMikro } from "../../mikro/MikroContext";
import { useAppQuery } from "../api/graphql";
-import { withMan } from "../man";
+import { withLok } from "../LokContext";
export const AppImage: React.FC<{
identifier: string;
className?: string;
}> = ({ identifier, ...props }) => {
- const { data, error } = withMan(useAppQuery)({
+ const { data, error } = withLok(useAppQuery)({
variables: { identifier },
});
diff --git a/src/lok/components/AppTag.tsx b/src/lok/components/AppTag.tsx
index 9b04f7d..5875a83 100644
--- a/src/lok/components/AppTag.tsx
+++ b/src/lok/components/AppTag.tsx
@@ -1,12 +1,12 @@
import { Release } from "../../linker";
import { useReleaseQuery } from "../api/graphql";
-import { withMan } from "../man";
+import { withLok } from "../LokContext";
export const ReleaseTag: React.FC<{ version: string; identifier: string }> = ({
version,
identifier,
}) => {
- const { data, error } = withMan(useReleaseQuery)({
+ const { data, error } = withLok(useReleaseQuery)({
variables: { identifier, version },
});
diff --git a/src/lok/components/Application.tsx b/src/lok/components/Application.tsx
index eba76ca..97aff8b 100644
--- a/src/lok/components/Application.tsx
+++ b/src/lok/components/Application.tsx
@@ -5,7 +5,7 @@ import {
} from "../../lok/api/graphql";
import { withRekuest } from "../../rekuest";
import { AgentStatus, useAgentsQuery } from "../../rekuest/api/graphql";
-import { withMan } from "../man";
+import { withLok } from "../LokContext";
export type IAppProps = {
clientId: string;
@@ -18,7 +18,7 @@ const isBackendApp = (
};
const Application: React.FC = ({ clientId }) => {
- const { data } = withMan(useDetailClientQuery)({
+ const { data } = withLok(useDetailClientQuery)({
variables: { clientId: clientId },
});
diff --git a/src/lok/components/Client.tsx b/src/lok/components/Client.tsx
index 8c5c996..f4da59e 100644
--- a/src/lok/components/Client.tsx
+++ b/src/lok/components/Client.tsx
@@ -1,18 +1,18 @@
import { useDatalayer } from "@jhnnsrs/datalayer";
import { PageLayout } from "../../layout/PageLayout";
import { useDialog } from "../../layout/dialog/DialogProvider";
+import { withLok } from "../LokContext";
import {
ApplicationAuthorizationGrantType,
useDetailClientQuery,
} from "../api/graphql";
-import { withMan } from "../man";
export type AppProps = {
id: string;
};
export const Client: React.FC = (props) => {
- const { data } = withMan(useDetailClientQuery)({
+ const { data } = withLok(useDetailClientQuery)({
variables: { id: props.id },
});
diff --git a/src/lok/components/LokSearch.tsx b/src/lok/components/LokSearch.tsx
index a0a193b..fc52e8e 100644
--- a/src/lok/components/LokSearch.tsx
+++ b/src/lok/components/LokSearch.tsx
@@ -1,12 +1,11 @@
import { Transition } from "@headlessui/react";
import { Field, Form, Formik } from "formik";
-import React, { useState } from "react";
+import { useState } from "react";
import { BiSearch } from "react-icons/bi";
import { FiArrowDown } from "react-icons/fi";
import { SwitchInputField } from "../../components/forms/fields/switch_input";
import { ChangeSubmitHelper } from "../../rekuest/ui/helpers/ChangeSubmitter";
import { LokGlobalSearchQueryVariables } from "../api/graphql";
-import { withMan } from "../context";
interface LokSearchProps {
onSearch: (variables: LokGlobalSearchQueryVariables) => void;
diff --git a/src/lok/components/MyPrivateFakts.tsx b/src/lok/components/MyPrivateFakts.tsx
index 496dedc..8d418d8 100644
--- a/src/lok/components/MyPrivateFakts.tsx
+++ b/src/lok/components/MyPrivateFakts.tsx
@@ -2,23 +2,23 @@ import React from "react";
import { useConfirm } from "../../components/confirmer/confirmer-context";
import { notEmpty } from "../../floating/utils";
import { Client } from "../../linker";
+import { withLok } from "../LokContext";
import {
MyPrivateClientsDocument,
MyPrivateClientsQuery,
useDeleteClientMutation,
useMyPrivateClientsQuery,
} from "../api/graphql";
-import { withMan } from "../man";
export type IAppProps = {
onAppClicked?: (clientID: string) => void;
};
const MyClients: React.FC = ({ onAppClicked }) => {
- const { data } = withMan(useMyPrivateClientsQuery)();
+ const { data } = withLok(useMyPrivateClientsQuery)();
const { confirm } = useConfirm();
- const [deletePrivateFakt] = withMan(useDeleteClientMutation)({
+ const [deletePrivateFakt] = withLok(useDeleteClientMutation)({
update(cache, result) {
const query = cache.readQuery({
query: MyPrivateClientsDocument,
diff --git a/src/lok/components/Release.tsx b/src/lok/components/Release.tsx
index a56db6a..3eb06fd 100644
--- a/src/lok/components/Release.tsx
+++ b/src/lok/components/Release.tsx
@@ -4,15 +4,15 @@ import { PageLayout } from "../../layout/PageLayout";
import { SectionTitle } from "../../layout/SectionTitle";
import { useDialog } from "../../layout/dialog/DialogProvider";
import { Client } from "../../linker";
+import { withLok } from "../LokContext";
import { useReleaseQuery } from "../api/graphql";
-import { withMan } from "../man";
export type AppProps = {
id: string;
};
export const Release: React.FC = (props) => {
- const { data } = withMan(useReleaseQuery)({ variables: { id: props.id } });
+ const { data } = withLok(useReleaseQuery)({ variables: { id: props.id } });
const { s3resolve } = useDatalayer();
diff --git a/src/lok/components/ReleaseEmblem.tsx b/src/lok/components/ReleaseEmblem.tsx
index eead013..a9d4379 100644
--- a/src/lok/components/ReleaseEmblem.tsx
+++ b/src/lok/components/ReleaseEmblem.tsx
@@ -1,12 +1,12 @@
import { Release } from "../../linker";
import { useReleaseQuery } from "../api/graphql";
-import { withMan } from "../man";
+import { withLok } from "../LokContext";
export const ReleaseEmblem: React.FC<{
version: string;
identifier: string;
}> = ({ version, identifier }) => {
- const { data, error } = withMan(useReleaseQuery)({
+ const { data, error } = withLok(useReleaseQuery)({
variables: { identifier, version },
});
diff --git a/src/lok/components/UserEmblem.tsx b/src/lok/components/UserEmblem.tsx
index 16e1bbd..3bde396 100644
--- a/src/lok/components/UserEmblem.tsx
+++ b/src/lok/components/UserEmblem.tsx
@@ -1,15 +1,14 @@
-import { Link } from "react-router-dom";
+import { useDatalayer } from "@jhnnsrs/datalayer";
import { User } from "../../linker";
-import { useMikro, withMikro } from "../../mikro/MikroContext";
+import { withLok } from "../LokContext";
import { useUserQuery } from "../api/graphql";
-import { withMan } from "../man";
export const UserEmblem: React.FC<{ sub: string }> = ({ sub }) => {
- const { data, error } = withMan(useUserQuery)({
+ const { data, error } = withLok(useUserQuery)({
variables: { id: sub },
});
- const { s3resolve } = useMikro();
+ const { s3resolve } = useDatalayer();
return (
{data?.user?.id && (
diff --git a/src/lok/components/UserTag.tsx b/src/lok/components/UserTag.tsx
index 8466e88..bf9d5b6 100644
--- a/src/lok/components/UserTag.tsx
+++ b/src/lok/components/UserTag.tsx
@@ -1,18 +1,17 @@
-import { Link } from "react-router-dom";
+import { useDatalayer } from "@jhnnsrs/datalayer";
import { User } from "../../linker";
-import { useMikro, withMikro } from "../../mikro/MikroContext";
+import { withLok } from "../LokContext";
import { useUserQuery } from "../api/graphql";
-import { withMan } from "../man";
export const UserTag: React.FC<{ sub: string; className?: string }> = ({
sub,
className,
}) => {
- const { data, error } = withMan(useUserQuery)({
+ const { data, error } = withLok(useUserQuery)({
variables: { id: sub },
});
- const { s3resolve } = useMikro();
+ const { s3resolve } = useDatalayer();
return (
{data?.user?.id ? (
diff --git a/src/lok/components/cards/AppCard.tsx b/src/lok/components/cards/AppCard.tsx
index 325ec7d..dac8df2 100644
--- a/src/lok/components/cards/AppCard.tsx
+++ b/src/lok/components/cards/AppCard.tsx
@@ -1,6 +1,5 @@
-import React from "react";
+import { useDatalayer } from "@jhnnsrs/datalayer";
import { App } from "../../../linker";
-import { useMikro } from "../../../mikro/MikroContext";
import { ListAppFragment } from "../../api/graphql";
interface AppCardProps {
@@ -8,7 +7,7 @@ interface AppCardProps {
}
export const AppCard = ({ app }: AppCardProps) => {
- const { s3resolve } = useMikro();
+ const { s3resolve } = useDatalayer();
return (
{
- const { s3resolve } = useMikro();
+ const { s3resolve } = useDatalayer();
return (
{
- const { s3resolve } = useMikro();
+ const { s3resolve } = useDatalayer();
return (
& { app: DetailAppFragment }
) => {
- const [updateApp] = withMan(useUpdateAppMutation)({
+ const [updateApp] = withLok(useUpdateAppMutation)({
update: (cache, { data }) => {
if (data?.updateApp) {
cache.modify({
diff --git a/src/lok/components/dialogs/ChangeGroupDialog.tsx b/src/lok/components/dialogs/ChangeGroupDialog.tsx
index 7ddb73b..fd67749 100644
--- a/src/lok/components/dialogs/ChangeGroupDialog.tsx
+++ b/src/lok/components/dialogs/ChangeGroupDialog.tsx
@@ -1,26 +1,21 @@
import { Form, Formik } from "formik";
-import { FileInputField } from "../../../components/forms/fields/file_input";
import { SubmitButton } from "../../../components/forms/fields/SubmitButton";
-import { SwitchInputField } from "../../../components/forms/fields/switch_input";
+import { FileInputField } from "../../../components/forms/fields/file_input";
import { TextInputField } from "../../../components/forms/fields/text_input";
import { Submit } from "../../../layout/dialog/DialogProvider";
import { TwDialog } from "../../../layout/dialog/TwDialog";
+import { withLok } from "../../LokContext";
import {
DetailGroupFragment,
- DetailUserFragment,
UpdateGroupMutation,
UpdateGroupMutationVariables,
- UpdateUserMutation,
- UpdateUserMutationVariables,
useUpdateGroupMutation,
- useUpdateUserMutation,
} from "../../api/graphql";
-import { withMan } from "../../man";
export const ChangeGroupDialog = (
props: Submit & { group: DetailGroupFragment }
) => {
- const [updateGroup] = withMan(useUpdateGroupMutation)({
+ const [updateGroup] = withLok(useUpdateGroupMutation)({
update: (cache, { data }) => {
if (data?.updateGroup) {
cache.modify({
diff --git a/src/lok/components/dialogs/ChangeMeModal.tsx b/src/lok/components/dialogs/ChangeMeModal.tsx
index 1402637..eb031e3 100644
--- a/src/lok/components/dialogs/ChangeMeModal.tsx
+++ b/src/lok/components/dialogs/ChangeMeModal.tsx
@@ -4,6 +4,7 @@ import React from "react";
import { SubmitButton } from "../../../components/forms/fields/SubmitButton";
import { TextInputField } from "../../../components/forms/fields/text_input";
import { useModal } from "../../../components/modals/modal-context";
+import { withLok } from "../../LokContext";
import {
ChangeMeMutationVariables,
MeUserFragment,
@@ -11,10 +12,9 @@ import {
ProfileQuery,
useChangeMeMutation,
} from "../../api/graphql";
-import { withMan } from "../../man";
const ChangeMeModal: React.FC<{ me: MeUserFragment }> = ({ me }) => {
- const [changeMe] = withMan(useChangeMeMutation)({
+ const [changeMe] = withLok(useChangeMeMutation)({
update(cache, result) {
cache.updateQuery(
{
diff --git a/src/lok/components/dialogs/ChangeUserDialog.tsx b/src/lok/components/dialogs/ChangeUserDialog.tsx
index 812f6c6..9e466bf 100644
--- a/src/lok/components/dialogs/ChangeUserDialog.tsx
+++ b/src/lok/components/dialogs/ChangeUserDialog.tsx
@@ -1,22 +1,22 @@
import { Form, Formik } from "formik";
-import { FileInputField } from "../../../components/forms/fields/file_input";
import { SubmitButton } from "../../../components/forms/fields/SubmitButton";
+import { FileInputField } from "../../../components/forms/fields/file_input";
import { SwitchInputField } from "../../../components/forms/fields/switch_input";
import { TextInputField } from "../../../components/forms/fields/text_input";
import { Submit } from "../../../layout/dialog/DialogProvider";
import { TwDialog } from "../../../layout/dialog/TwDialog";
+import { withLok } from "../../LokContext";
import {
DetailUserFragment,
UpdateUserMutation,
UpdateUserMutationVariables,
useUpdateUserMutation,
} from "../../api/graphql";
-import { withMan } from "../../man";
export const ChangeUserDialog = (
props: Submit & { user: DetailUserFragment }
) => {
- const [updateUser] = withMan(useUpdateUserMutation)({
+ const [updateUser] = withLok(useUpdateUserMutation)({
update: (cache, { data }) => {
if (data?.updateUser) {
cache.modify({
diff --git a/src/lok/components/dialogs/CreateApplicationModal.tsx b/src/lok/components/dialogs/CreateApplicationModal.tsx
index 36720c3..a15ef0a 100644
--- a/src/lok/components/dialogs/CreateApplicationModal.tsx
+++ b/src/lok/components/dialogs/CreateApplicationModal.tsx
@@ -2,9 +2,9 @@ import { Dialog } from "@headlessui/react";
import { Form, Formik } from "formik";
import React from "react";
import { Alert } from "../../../components/forms/Alert";
+import { SubmitButton } from "../../../components/forms/fields/SubmitButton";
import { CarouselInputField } from "../../../components/forms/fields/carousel_inputs";
import { ParagraphInputField } from "../../../components/forms/fields/paragraph_input";
-import { SubmitButton } from "../../../components/forms/fields/SubmitButton";
import { TextInputField } from "../../../components/forms/fields/text_input";
import { useModal } from "../../../components/modals/modal-context";
import {
@@ -13,7 +13,7 @@ import {
GrantType,
useCreateApplicationMutation,
} from "../../../lok/api/graphql";
-import { withMan } from "../../man";
+import { withLok } from "../../LokContext";
export type ICreateApplicationModalProps = {
onApplicationCreated?: (app: CreateApplicationMutation) => void;
@@ -33,7 +33,7 @@ export type CreateApplicationFormValues = {
const CreateApplicationModal: React.FC = ({
onApplicationCreated,
}) => {
- const [createApplication, data] = withMan(useCreateApplicationMutation)({
+ const [createApplication, data] = withLok(useCreateApplicationMutation)({
update(cache, result) {
const existingApps: any = cache.readQuery({
query: ApplicationsDocument,
diff --git a/src/lok/components/dialogs/CreatePublicClient.tsx b/src/lok/components/dialogs/CreatePublicClient.tsx
index fee58b0..88d4072 100644
--- a/src/lok/components/dialogs/CreatePublicClient.tsx
+++ b/src/lok/components/dialogs/CreatePublicClient.tsx
@@ -8,6 +8,7 @@ import { SwitchInputField } from "../../../components/forms/fields/switch_input"
import { TextInputField } from "../../../components/forms/fields/text_input";
import { Submit } from "../../../layout/dialog/DialogProvider";
import { TwDialog } from "../../../layout/dialog/TwDialog";
+import { withLok } from "../../LokContext";
import {
CreatePublicClientMutation,
CreatePublicClientMutationVariables,
@@ -15,14 +16,13 @@ import {
useCreatePublicClientMutation,
useScopesOptionsLazyQuery,
} from "../../api/graphql";
-import { withMan } from "../../man";
export const CreatePublicClientDialog = (
props: Submit
) => {
- const [createPublicFakt] = withMan(useCreatePublicClientMutation)();
+ const [createPublicFakt] = withLok(useCreatePublicClientMutation)();
- const [searchScopes] = withMan(useScopesOptionsLazyQuery)();
+ const [searchScopes] = withLok(useScopesOptionsLazyQuery)();
return (
diff --git a/src/lok/man.tsx b/src/lok/man.tsx
deleted file mode 100644
index 7564c60..0000000
--- a/src/lok/man.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import { useMan } from "./context";
-
-export function withMan any>(func: T): T {
- const Wrapped = (nana: any) => {
- const { client } = useMan();
-
- return func({ ...nana, client: client });
- };
- return Wrapped as T;
-}
diff --git a/src/pages/lok/TeamHome.tsx b/src/lok/pages/TeamHome.tsx
similarity index 100%
rename from src/pages/lok/TeamHome.tsx
rename to src/lok/pages/TeamHome.tsx
diff --git a/src/pages/lok/apps/LokApp.tsx b/src/lok/pages/apps/LokApp.tsx
similarity index 100%
rename from src/pages/lok/apps/LokApp.tsx
rename to src/lok/pages/apps/LokApp.tsx
diff --git a/src/pages/lok/apps/LokApps.tsx b/src/lok/pages/apps/LokApps.tsx
similarity index 89%
rename from src/pages/lok/apps/LokApps.tsx
rename to src/lok/pages/apps/LokApps.tsx
index d40708d..e947351 100644
--- a/src/pages/lok/apps/LokApps.tsx
+++ b/src/lok/pages/apps/LokApps.tsx
@@ -4,13 +4,13 @@ import { notEmpty } from "../../../floating/utils";
import { PageLayout } from "../../../layout/PageLayout";
import { SectionTitle } from "../../../layout/SectionTitle";
import { App } from "../../../linker";
+import { withLok } from "../../../lok/LokContext";
import { useAppsQuery } from "../../../lok/api/graphql";
-import { withMan } from "../../../lok/man";
export interface ManUserProps {}
export const LokApps: React.FC = (props) => {
- const { data } = withMan(useAppsQuery)();
+ const { data } = withLok(useAppsQuery)();
return (
diff --git a/src/pages/lok/clients/LokClient.tsx b/src/lok/pages/clients/LokClient.tsx
similarity index 100%
rename from src/pages/lok/clients/LokClient.tsx
rename to src/lok/pages/clients/LokClient.tsx
diff --git a/src/pages/lok/clients/LokClients.tsx b/src/lok/pages/clients/LokClients.tsx
similarity index 89%
rename from src/pages/lok/clients/LokClients.tsx
rename to src/lok/pages/clients/LokClients.tsx
index ca3a0d0..4f0747d 100644
--- a/src/pages/lok/clients/LokClients.tsx
+++ b/src/lok/pages/clients/LokClients.tsx
@@ -4,13 +4,13 @@ import { notEmpty } from "../../../floating/utils";
import { PageLayout } from "../../../layout/PageLayout";
import { SectionTitle } from "../../../layout/SectionTitle";
import { App } from "../../../linker";
+import { withLok } from "../../../lok/LokContext";
import { useMyPrivateClientsQuery } from "../../../lok/api/graphql";
-import { withMan } from "../../../lok/man";
export interface ManUserProps {}
export const LokClients: React.FC = (props) => {
- const { data } = withMan(useMyPrivateClientsQuery)();
+ const { data } = withLok(useMyPrivateClientsQuery)();
return (
diff --git a/src/pages/lok/releases/LokRelease.tsx b/src/lok/pages/releases/LokRelease.tsx
similarity index 100%
rename from src/pages/lok/releases/LokRelease.tsx
rename to src/lok/pages/releases/LokRelease.tsx
diff --git a/src/pages/lok/releases/LokReleases.tsx b/src/lok/pages/releases/LokReleases.tsx
similarity index 90%
rename from src/pages/lok/releases/LokReleases.tsx
rename to src/lok/pages/releases/LokReleases.tsx
index 00b7dac..7a6fb48 100644
--- a/src/pages/lok/releases/LokReleases.tsx
+++ b/src/lok/pages/releases/LokReleases.tsx
@@ -4,13 +4,13 @@ import { notEmpty } from "../../../floating/utils";
import { PageLayout } from "../../../layout/PageLayout";
import { SectionTitle } from "../../../layout/SectionTitle";
import { App } from "../../../linker";
+import { withLok } from "../../../lok/LokContext";
import { useReleasesQuery } from "../../../lok/api/graphql";
-import { withMan } from "../../../lok/man";
export interface ManUserProps {}
export const LokReleases: React.FC = (props) => {
- const { data } = withMan(useReleasesQuery)();
+ const { data } = withLok(useReleasesQuery)();
return (
diff --git a/src/lok/pages/teams/ManTeam.tsx b/src/lok/pages/teams/ManTeam.tsx
new file mode 100644
index 0000000..1b5b19f
--- /dev/null
+++ b/src/lok/pages/teams/ManTeam.tsx
@@ -0,0 +1,88 @@
+import { useDatalayer } from "@jhnnsrs/datalayer";
+import React from "react";
+import { useParams } from "react-router";
+import { DropZone } from "../../../components/layout/DropZone";
+import { ResponsiveContainerGrid } from "../../../components/layout/ResponsiveContainerGrid";
+import { notEmpty } from "../../../floating/utils";
+import { ActionButton } from "../../../layout/ActionButton";
+import { PageLayout } from "../../../layout/PageLayout";
+import { useDialog } from "../../../layout/dialog/DialogProvider";
+import { withLok } from "../../LokContext";
+import { useDetailGroupQuery } from "../../api/graphql";
+import { UserCard } from "../../components/cards/UserCard";
+import { ChangeGroupDialog } from "../../components/dialogs/ChangeGroupDialog";
+
+export interface ManTeamProps {}
+
+export const ManTeam: React.FC = (props) => {
+ const { team } = useParams<{ team: string }>();
+
+ if (!team) return <>>;
+
+ const { data } = withLok(useDetailGroupQuery)({
+ variables: { id: team },
+ });
+
+ const { s3resolve } = useDatalayer();
+ const { ask } = useDialog();
+ return (
+
+ {
+ if (data?.group) {
+ await ask(ChangeGroupDialog, { group: data?.group });
+ }
+ }}
+ />
+ >
+ }
+ >
+
+
+ {data?.group?.name}
+
+
{
+ console.log(e);
+ }}
+ />
+
+
+
Members of this Group
+
+ {data?.group?.userSet?.filter(notEmpty).map((u, index) => (
+
+ ))}
+
+
+ My Shared Data with this Team
+
+
+
+
+ );
+};
diff --git a/src/pages/lok/teams/ManTeams.tsx b/src/lok/pages/teams/ManTeams.tsx
similarity index 100%
rename from src/pages/lok/teams/ManTeams.tsx
rename to src/lok/pages/teams/ManTeams.tsx
diff --git a/src/lok/pages/users/ManUser.tsx b/src/lok/pages/users/ManUser.tsx
new file mode 100644
index 0000000..0189513
--- /dev/null
+++ b/src/lok/pages/users/ManUser.tsx
@@ -0,0 +1,90 @@
+import { useDatalayer } from "@jhnnsrs/datalayer";
+import React from "react";
+import { useParams } from "react-router";
+import { FittingResponsiveContainerGrid } from "../../../components/layout/ResponsiveContainerGrid";
+import { ActionButton } from "../../../layout/ActionButton";
+import { PageLayout } from "../../../layout/PageLayout";
+import { useDialog } from "../../../layout/dialog/DialogProvider";
+import { withLok } from "../../LokContext";
+import { useDetailUserQuery } from "../../api/graphql";
+import { TeamCard } from "../../components/cards/TeamCard";
+import { ChangeUserDialog } from "../../components/dialogs/ChangeUserDialog";
+
+export interface ManUserProps {}
+
+export const ManUser: React.FC = (props) => {
+ const { user } = useParams<{ user: string }>();
+
+ if (!user) return <>>;
+
+ const { data } = withLok(useDetailUserQuery)({
+ variables: { id: user },
+ });
+ const { s3resolve } = useDatalayer();
+
+ const { ask } = useDialog();
+
+ return (
+
+ {
+ window.open(`mailto:${data?.user?.email}`, "_blank");
+ }}
+ />
+ {
+ if (data?.user) {
+ await ask(ChangeUserDialog, { user: data?.user });
+ }
+ }}
+ />
+ >
+ }
+ >
+
+
+ {data?.user?.firstName ? (
+ <>
+ {data?.user.firstName} {data?.user.lastName}
+
{data?.user?.username}
+ >
+ ) : (
+ data?.user?.username
+ )}
+
+
+
Member of these Groups
+
+ {data?.user?.groups?.map((u, index) => (
+
+ ))}
+
+
+ My Shared Data with this User
+
+
+
+
+ );
+};
diff --git a/src/pages/lok/users/ManUsers.tsx b/src/lok/pages/users/ManUsers.tsx
similarity index 100%
rename from src/pages/lok/users/ManUsers.tsx
rename to src/lok/pages/users/ManUsers.tsx
diff --git a/src/pages/lok/LokSidebar.tsx b/src/lok/panes/SidePane.tsx
similarity index 81%
rename from src/pages/lok/LokSidebar.tsx
rename to src/lok/panes/SidePane.tsx
index d9bf6a1..8ffae1a 100644
--- a/src/pages/lok/LokSidebar.tsx
+++ b/src/lok/panes/SidePane.tsx
@@ -1,19 +1,15 @@
import React, { useEffect } from "react";
-import { NavLink } from "react-router-dom";
import { ResponsiveContainerGrid } from "../../components/layout/ResponsiveContainerGrid";
import { notEmpty } from "../../floating/utils";
-import { Team } from "../../linker";
+import { withLok } from "../LokContext";
import {
LokGlobalSearchQueryVariables,
- useLokGlobalSearchLazyQuery,
useLokGlobalSearchQuery,
- useMyGroupsQuery,
-} from "../../lok/api/graphql";
-import { AppCard } from "../../lok/components/cards/AppCard";
-import { TeamCard } from "../../lok/components/cards/TeamCard";
-import { UserCard } from "../../lok/components/cards/UserCard";
-import { LokSearch } from "../../lok/components/LokSearch";
-import { withMan } from "../../lok/man";
+} from "../api/graphql";
+import { LokSearch } from "../components/LokSearch";
+import { AppCard } from "../components/cards/AppCard";
+import { TeamCard } from "../components/cards/TeamCard";
+import { UserCard } from "../components/cards/UserCard";
export type IMyRepresentationsProps = {};
const limit = 20;
@@ -22,7 +18,7 @@ const LokSidebar: React.FC = () => {
const [filter, setFilter] = React.useState({
search: "",
});
- const { data, refetch } = withMan(useLokGlobalSearchQuery)({
+ const { data, refetch } = withLok(useLokGlobalSearchQuery)({
//pollInterval: 1000,
});
@@ -88,4 +84,4 @@ const LokSidebar: React.FC = () => {
);
};
-export { LokSidebar };
+export default LokSidebar;
diff --git a/src/lok/provider.tsx b/src/lok/provider.tsx
deleted file mode 100644
index 624e699..0000000
--- a/src/lok/provider.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import { ApolloClient, gql, NormalizedCacheObject } from "@apollo/client";
-import React, { useEffect, useState } from "react";
-import { useFakts } from "@jhnnsrs/fakts";
-import { useHerre } from "herre";
-import { createManClient } from "./client";
-import { ManContext } from "./context";
-import { ManConfig } from "./types";
-
-export type ManProviderProps = {
- register?: boolean;
- children: React.ReactNode;
-};
-
-export const ManProvider: React.FC = ({
- register = true,
- children,
-}) => {
- const [client, setClient] = useState<
- ApolloClient | undefined
- >();
- const [config, setConfig] = useState();
-
- const configure = (config?: ManConfig) => {
- setConfig(config);
- if (!config) {
- setClient(undefined);
- return;
- }
-
- setClient(createManClient(config));
- };
-
- return (
-
- {children}
-
- );
-};
diff --git a/src/lok/screens/Group.tsx b/src/lok/screens/Group.tsx
index b8ef20c..443fc17 100644
--- a/src/lok/screens/Group.tsx
+++ b/src/lok/screens/Group.tsx
@@ -1,19 +1,17 @@
import React from "react";
import { DropZone } from "../../components/layout/DropZone";
import { ResponsiveGrid } from "../../components/layout/ResponsiveGrid";
-import { Modal } from "../../components/modals/Modal";
import { notEmpty } from "../../floating/utils";
import { ActionButton } from "../../layout/ActionButton";
-import { useDialog } from "../../layout/dialog/DialogProvider";
import { PageLayout } from "../../layout/PageLayout";
-import { Representation, Team, User } from "../../linker";
-import { useRepresentationsForQuery } from "../../mikro/api/graphql";
+import { useDialog } from "../../layout/dialog/DialogProvider";
+import { Representation } from "../../linker";
import { useMikro, withMikro } from "../../mikro/MikroContext";
+import { useRepresentationsForQuery } from "../../mikro/api/graphql";
import { useDetailGroupQuery } from "../api/graphql";
import { UserCard } from "../components/cards/UserCard";
import { ChangeGroupDialog } from "../components/dialogs/ChangeGroupDialog";
-import { UserEmblem } from "../components/UserEmblem";
-import { withMan } from "../man";
+import { withLok } from "../LokContext";
export type GroupProps = {
id: string;
@@ -45,7 +43,7 @@ export const RepresentationsForGroup = ({ name }: { name: string }) => {
};
const Group: React.FC = ({ id }) => {
- const { data } = withMan(useDetailGroupQuery)({
+ const { data } = withLok(useDetailGroupQuery)({
variables: { id: id },
});
diff --git a/src/lok/screens/User.tsx b/src/lok/screens/User.tsx
index c5cb22b..56cb2f2 100644
--- a/src/lok/screens/User.tsx
+++ b/src/lok/screens/User.tsx
@@ -1,22 +1,14 @@
import React from "react";
-import {
- SharableModels,
- useUserQuery as useArkitektUserQuery,
-} from "../../rekuest/api/graphql";
import { ResponsiveGrid } from "../../components/layout/ResponsiveGrid";
-import { Modal } from "../../components/modals/Modal";
import { ActionButton } from "../../layout/ActionButton";
import { PageLayout } from "../../layout/PageLayout";
-import { Team } from "../../linker";
-import { useRepresentationsForUserQuery } from "../../mikro/api/graphql";
+import { useDialog } from "../../layout/dialog/DialogProvider";
import { useMikro, withMikro } from "../../mikro/MikroContext";
+import { useRepresentationsForUserQuery } from "../../mikro/api/graphql";
+import { withLok } from "../LokContext";
import { useDetailUserQuery } from "../api/graphql";
-import { withMan } from "../man";
-import { withRekuest } from "../../rekuest";
-import { useDialog } from "../../layout/dialog/DialogProvider";
-import { ChangeUserDialog } from "../components/dialogs/ChangeUserDialog";
-import { userInfo } from "os";
import { TeamCard } from "../components/cards/TeamCard";
+import { ChangeUserDialog } from "../components/dialogs/ChangeUserDialog";
export type UserProps = {
id: string;
@@ -46,7 +38,7 @@ export const ManageMikro = ({ email }: { email: string }) => {
};
const User: React.FC = ({ id }) => {
- const { data } = withMan(useDetailUserQuery)({
+ const { data } = withLok(useDetailUserQuery)({
variables: { id: id },
});
const { s3resolve } = useMikro();
diff --git a/src/lok/types.tsx b/src/lok/types.tsx
index 58fa32d..88ef5ab 100644
--- a/src/lok/types.tsx
+++ b/src/lok/types.tsx
@@ -1,6 +1,6 @@
import { PossibleTypesMap } from "@apollo/client";
-export type ManConfig = {
+export type LokConfig = {
endpointUrl: string;
wsEndpointUrl: string;
secure: boolean;
diff --git a/src/mates/agent/useBounceAgentMate.tsx b/src/mates/agent/useBounceAgentMate.tsx
index 9874132..936ab9e 100644
--- a/src/mates/agent/useBounceAgentMate.tsx
+++ b/src/mates/agent/useBounceAgentMate.tsx
@@ -12,11 +12,11 @@ export const useBounceAgentMate = (): AgentKickeMater => {
const { confirm } = useConfirm();
const [bounce] = withRekuest(useBounceAgentMutation)();
- return (agent: { id: string; __typename?: "Agent" }) => (type, isSelf) => {
- if (isSelf) {
+ return (agent: { id: string; __typename?: "Agent" }) => async (options) => {
+ if (options.partnersIncludeSelf) {
return [
{
- action: async (self, drops) => {
+ action: async (event) => {
await confirm({
message: "Bounce agent",
subtitle:
diff --git a/src/mates/agent/useKickAgentMate.tsx b/src/mates/agent/useKickAgentMate.tsx
index f99405e..7bb2076 100644
--- a/src/mates/agent/useKickAgentMate.tsx
+++ b/src/mates/agent/useKickAgentMate.tsx
@@ -12,11 +12,11 @@ export const useKickAgentMate = (): AgentKickeMater => {
const { confirm } = useConfirm();
const [kick] = withRekuest(useKickAgentMutation)();
- return (agent: { id: string; __typename?: "Agent" }) => (type, isSelf) => {
- if (isSelf) {
+ return (agent: { id: string; __typename?: "Agent" }) => async (options) => {
+ if (options.partnersIncludeSelf) {
return [
{
- action: async (self, drops) => {
+ action: async (event) => {
await confirm({
message: "Kick agent",
subtitle: "Are you sure you want to kick this agent?",
diff --git a/src/mates/assignation/useAssignationMates.tsx b/src/mates/assignation/useAssignationMates.tsx
index 0e71a11..21e9a31 100644
--- a/src/mates/assignation/useAssignationMates.tsx
+++ b/src/mates/assignation/useAssignationMates.tsx
@@ -1,9 +1,8 @@
import { useNavigate } from "react-router";
import { Assignation, Node } from "../../linker";
import { ListAssignationFragment } from "../../rekuest/api/graphql";
-import { usePostman } from "../../rekuest/postman/graphql/postman-context";
-import { AdditionalMate } from "../../rekuest/postman/mater/mater-context";
-import { MateFinder } from "../types";
+import { usePostman } from "../../rekuest/providers/postman/postman-context";
+import { Mate, MateFinder } from "../types";
export const useAssignationMate = (): ((
ass: ListAssignationFragment
@@ -11,10 +10,10 @@ export const useAssignationMate = (): ((
const navigate = useNavigate();
const { ack, unassign } = usePostman();
- return (ass) => (type, isSelf) => {
- let mates: AdditionalMate[] = [];
+ return (ass) => async (options) => {
+ let mates: Mate[] = [];
- if (!isSelf) {
+ if (!options.partnersIncludeSelf) {
return mates;
}
@@ -28,14 +27,14 @@ export const useAssignationMate = (): ((
mates.push({
action: async () => {
- await unassign({ variables: { assignation: ass?.id } });
+ await unassign({ assignation: ass?.id });
},
label: "Cancel",
});
mates.push({
action: async () => {
- await ack({ variables: { assignation: ass?.id } });
+ await ack({ assignation: ass?.id });
},
label: "Ack",
});
diff --git a/src/mates/compose.tsx b/src/mates/compose.tsx
index 491f1ac..87c80f9 100644
--- a/src/mates/compose.tsx
+++ b/src/mates/compose.tsx
@@ -1,5 +1,4 @@
-import { AdditionalMate, Mate } from "../rekuest/postman/mater/mater-context";
-import { MateFinder } from "./types";
+import { Mate, MateFinder } from "./types";
export type SingleMateFinder = (
type: T,
@@ -7,13 +6,20 @@ export type SingleMateFinder = (
) => Mate[] | undefined;
export function composeMates(mateFunctions: MateFinder[]): MateFinder {
- console.log("Reducing mates", mateFunctions);
- return (type: string, isSelf: boolean) =>
- mateFunctions.reduce((acc, f) => {
- const mates = f(type, isSelf);
+ return async (options) => {
+ let allmates: Mate[] = [];
+ console.log("Reducing mates", mateFunctions);
+
+ for (const f of mateFunctions) {
+ const mates = await f(options);
+ console.log("Got mates", mates);
if (mates) {
- acc.push(...mates);
+ allmates.push(...mates);
}
- return acc;
- }, [] as AdditionalMate[]);
+ }
+
+ console.log("Returning mates", allmates);
+
+ return allmates;
+ };
}
diff --git a/src/mates/container/useContainerLifecycleMate.tsx b/src/mates/container/useContainerLifecycleMate.tsx
index b4b76e2..a6dbb36 100644
--- a/src/mates/container/useContainerLifecycleMate.tsx
+++ b/src/mates/container/useContainerLifecycleMate.tsx
@@ -4,14 +4,11 @@ import { withPort } from "../../port/PortContext";
import {
ContainerStatus,
ListContainerFragment,
- usePullWhaleMutation,
useRemoveContainerMutation,
useRestartContainerMutation,
- useScanRepoMutation,
useStopContainerMutation,
} from "../../port/api/graphql";
-import { AdditionalMate } from "../../rekuest/postman/mater/mater-context";
-import { MateFinder } from "../types";
+import { Mate, MateFinder } from "../types";
export const useContainerLifecycleMate = (): ((
contianer: ListContainerFragment
@@ -22,28 +19,25 @@ export const useContainerLifecycleMate = (): ((
const [stop] = withPort(useStopContainerMutation)();
const [remove] = withPort(useRemoveContainerMutation)();
- const [scanRepo, _] = withPort(useScanRepoMutation)();
-
- const [pull] = withPort(usePullWhaleMutation)();
- return (container: ListContainerFragment) => (type, isSelf) => {
- let actions: AdditionalMate[] = [];
- if (isSelf) {
+ return (container: ListContainerFragment) => async (options) => {
+ let actions: Mate[] = [];
+ if (options.partnersIncludeSelf) {
actions = actions.concat([
{
- action: async (self, drops) => {
+ action: async (event) => {
await confirm({
message: "Do you really want to restart?",
subtitle: "Restarting will take some seconds!",
confirmLabel: "Yes restart!",
});
- await restart({ variables: { id: self.object } });
+ await restart({ variables: { id: event.self.id } });
},
label: "Restart",
description: "Delete Run",
},
{
- action: async (self, drops) => {
+ action: async (event) => {
await confirm({
message: "Do you really want to stop?",
subtitle:
@@ -51,7 +45,7 @@ export const useContainerLifecycleMate = (): ((
confirmLabel: "Yes stop!",
});
- await stop({ variables: { id: self.object } });
+ await stop({ variables: { id: event.self.id } });
},
label: "Stop",
description: "Delete Run",
@@ -59,18 +53,22 @@ export const useContainerLifecycleMate = (): ((
]);
}
- if (isSelf && container.status == ContainerStatus.Exited) {
+ if (
+ options.partnersIncludeSelf &&
+ container.status == ContainerStatus.Exited
+ ) {
actions = actions.concat([
{
- action: async (self, drops) => {
- await confirm({
- message: "Do you really want to delete?",
- subtitle:
- "Deletion is irreversible! You will have to deploy again!",
- confirmLabel: "Yes delete!",
- });
-
- await remove({ variables: { id: self.object } });
+ action: async (event) => {
+ for (const partner of event.partners) {
+ await confirm({
+ message: "Do you really want to delete?",
+ subtitle:
+ "Deletion is irreversible! You will have to deploy again!",
+ confirmLabel: "Yes delete!",
+ });
+ await remove({ variables: { id: partner.id } });
+ }
},
label: ,
description: "Delete Container",
diff --git a/src/mates/dataset/useExportDatasetMate.tsx b/src/mates/dataset/useExportDatasetMate.tsx
index d89a605..bc5b79f 100644
--- a/src/mates/dataset/useExportDatasetMate.tsx
+++ b/src/mates/dataset/useExportDatasetMate.tsx
@@ -4,16 +4,16 @@ import { MateFinder } from "../types";
export const useExportDatasetMate = (): MateFinder => {
const { confirm } = useConfirm();
- return (type, isSelf) => {
- if (isSelf || type == "list:@mikro/dataset") {
+ return async (options) => {
+ if (options.partnersIncludeSelf) {
return [
{
- action: async (self, partner, progress) => {
- await progress(0.1);
+ action: async (event) => {
+ await event.progress(0.1);
await confirm({
message: "Are you sure you want to export this dataset?",
});
- await progress(0.5);
+ await event.progress(0.5);
await new Promise((r) => setTimeout(r, 1000));
},
label: <>Export>,
diff --git a/src/mates/dataset/usePutDatasetsMate.tsx b/src/mates/dataset/usePutDatasetsMate.tsx
index 2b7eb1f..05c3a23 100644
--- a/src/mates/dataset/usePutDatasetsMate.tsx
+++ b/src/mates/dataset/usePutDatasetsMate.tsx
@@ -1,27 +1,17 @@
-import { BsTrash } from "react-icons/bs";
import { useConfirm } from "../../components/confirmer/confirmer-context";
-import {
- MyOmeroFilesDocument,
- MyOmeroFilesQuery,
- MyOmeroFilesQueryVariables,
- useDeleteOmeroFileMutation,
- usePutDatasetsMutation,
- useReleaseDatasetsMutation,
- useReleaseFilesMutation,
-} from "../../mikro/api/graphql";
import { withMikro } from "../../mikro/MikroContext";
-import { Mate } from "../../rekuest/postman/mater/mater-context";
+import { usePutDatasetsMutation } from "../../mikro/api/graphql";
import { MateFinder } from "../types";
export const usePutDatasetsMate = (datasetID: string): MateFinder => {
const { confirm } = useConfirm();
const [put] = withMikro(usePutDatasetsMutation)();
- return (type, isSelf) => {
- if (isSelf || type == "list:@mikro/dataset") {
+ return async (options) => {
+ if (options.partnersIncludeSelf) {
return [
{
- action: async (self, partner) => {
+ action: async (event) => {
await confirm({
message:
"Are you sure you want to puth these datasets in this dataset",
@@ -29,7 +19,7 @@ export const usePutDatasetsMate = (datasetID: string): MateFinder => {
put({
variables: {
- datasets: partner.map((p) => p.object),
+ datasets: event.partners.map((p) => p.id),
dataset: datasetID,
},
});
diff --git a/src/mates/dataset/useReleaseDatasetMate.tsx b/src/mates/dataset/useReleaseDatasetMate.tsx
index 112864c..9cf6cb6 100644
--- a/src/mates/dataset/useReleaseDatasetMate.tsx
+++ b/src/mates/dataset/useReleaseDatasetMate.tsx
@@ -1,26 +1,17 @@
-import { BsTrash } from "react-icons/bs";
import { useConfirm } from "../../components/confirmer/confirmer-context";
-import {
- MyOmeroFilesDocument,
- MyOmeroFilesQuery,
- MyOmeroFilesQueryVariables,
- useDeleteOmeroFileMutation,
- useReleaseDatasetsMutation,
- useReleaseFilesMutation,
-} from "../../mikro/api/graphql";
import { withMikro } from "../../mikro/MikroContext";
-import { Mate } from "../../rekuest/postman/mater/mater-context";
+import { useReleaseDatasetsMutation } from "../../mikro/api/graphql";
import { MateFinder } from "../types";
export const useReleaseDatasetMate = (datasetID: string): MateFinder => {
const { confirm } = useConfirm();
const [release] = withMikro(useReleaseDatasetsMutation)();
- return (type, isSelf) => {
- if (isSelf || type == "list:@mikro/dataset") {
+ return async (options) => {
+ if (options.partners == "list:@mikro/dataset") {
return [
{
- action: async (self, partner) => {
+ action: async (event) => {
await confirm({
message:
"Are you sure you want to release this datasets from this dataset",
@@ -28,7 +19,7 @@ export const useReleaseDatasetMate = (datasetID: string): MateFinder => {
release({
variables: {
- datasets: partner.map((p) => p.object),
+ datasets: event.partners.map((p) => p.id),
dataset: datasetID,
},
});
diff --git a/src/mates/file/useDownloadFileMate.tsx b/src/mates/file/useDownloadFileMate.tsx
index 56e25f3..98176de 100644
--- a/src/mates/file/useDownloadFileMate.tsx
+++ b/src/mates/file/useDownloadFileMate.tsx
@@ -7,11 +7,11 @@ export const useDownloadFileMate = (): ((
) => MateFinder) => {
const { s3resolve } = useDatalayer();
- return (filepath: string | undefined) => (type, isSelf) =>
- isSelf
+ return (filepath: string | undefined) => async (options) =>
+ options.partnersIncludeSelf
? [
{
- action: async (self, partner) => {
+ action: async (event) => {
filepath && window.open(s3resolve(filepath));
},
label: ,
diff --git a/src/mates/file/useReleaseFileMate.tsx b/src/mates/file/useReleaseFileMate.tsx
index 24c5333..3e8808b 100644
--- a/src/mates/file/useReleaseFileMate.tsx
+++ b/src/mates/file/useReleaseFileMate.tsx
@@ -1,33 +1,28 @@
-import { BsTrash } from "react-icons/bs";
import { useConfirm } from "../../components/confirmer/confirmer-context";
-import {
- MyOmeroFilesDocument,
- MyOmeroFilesQuery,
- MyOmeroFilesQueryVariables,
- useDeleteOmeroFileMutation,
- useReleaseFilesMutation,
-} from "../../mikro/api/graphql";
import { withMikro } from "../../mikro/MikroContext";
-import { Mate } from "../../rekuest/postman/mater/mater-context";
+import { useReleaseFilesMutation } from "../../mikro/api/graphql";
import { MateFinder } from "../types";
export const useReleaseFileMate = (datasetID: string): MateFinder => {
const { confirm } = useConfirm();
const [releaseFiles] = withMikro(useReleaseFilesMutation)();
- return (type, isSelf) => {
- if (isSelf || type == "list:@mikro/omerofile") {
+ return async (options) => {
+ if (
+ options.partnersIncludeSelf ||
+ options.partners == "list:@mikro/omerofile"
+ ) {
return [
{
- action: async (self, partner) => {
+ action: async (event) => {
await confirm({
message:
- "Are you sure you want to release this file from this dataset",
+ "Are you sure you want to release these file from this dataset",
});
releaseFiles({
variables: {
- files: partner.map((p) => p.object),
+ files: event.partners.map((p) => p.id),
dataset: datasetID,
},
});
diff --git a/src/mates/generics/buildDeleteMate.tsx b/src/mates/generics/buildDeleteMate.tsx
index ac75feb..fd19802 100644
--- a/src/mates/generics/buildDeleteMate.tsx
+++ b/src/mates/generics/buildDeleteMate.tsx
@@ -19,46 +19,18 @@ export function buildDeleteMate(
const [deleteItem] = xfunction({} as any);
- return (object: DeletableObject) => (type, isSelf) => {
- if (isSelf) {
+ return (object: DeletableObject) => async (options) => {
+ if (options.partnersIncludeSelf) {
return [
{
- action: async (self, partner) => {
- await confirm({
- message: `Are you sure you want to delete this ${object.__typename}?`,
- });
-
- deleteItem({
- variables: { id: partner[0].object },
- update(cache: any, result: any, options: any) {
- if (object.__typename) {
- const normalizedId = cache.identify(object);
- cache.evict({ id: normalizedId });
- cache.gc();
- }
- },
- });
- },
- label: (
- <>
-
- >
- ),
- description: `Delete this ${object.__typename}`,
- },
- ];
- }
- if (type == "list:@mikro/omerofile") {
- return [
- {
- action: async (self, partners) => {
- await confirm({
- message: "Are you sure you want to delete all these contexts?",
- });
+ action: async (event) => {
+ for (const partner of event.partners) {
+ await confirm({
+ message: `Are you sure you want to delete this ${object.__typename}?`,
+ });
- for (let partner of partners) {
- await deleteItem({
- variables: { id: partner.object },
+ deleteItem({
+ variables: { id: partner.id },
update(cache: any, result: any, options: any) {
if (object.__typename) {
const normalizedId = cache.identify(object);
@@ -71,10 +43,10 @@ export function buildDeleteMate(
},
label: (
<>
- Delete All
+
>
),
- description: "Delete all contexts",
+ description: `Delete this ${object.__typename}`,
},
];
}
diff --git a/src/mates/generics/buildPinMate.tsx b/src/mates/generics/buildPinMate.tsx
index 942d6b4..f2a5ce7 100644
--- a/src/mates/generics/buildPinMate.tsx
+++ b/src/mates/generics/buildPinMate.tsx
@@ -17,17 +17,19 @@ export function buildPinMate(xfunction: PinFunction): () => DeleteObjectFinder {
const [pinFunction] = xfunction({} as any);
- return (object: PinnableObject) => (type, isSelf) => {
- if (isSelf) {
+ return (object: PinnableObject) => async (options) => {
+ if (options.partnersIncludeSelf) {
return [
{
- action: async (self, partner) => {
- pinFunction({
- variables: {
- id: partner[0].object,
- pin: object.pinned == undefined ? true : !object.pinned,
- },
- });
+ action: async (event) => {
+ for (const partner of event.partners) {
+ pinFunction({
+ variables: {
+ id: partner.id,
+ pin: object.pinned == undefined ? true : !object.pinned,
+ },
+ });
+ }
},
label: <>{object.pinned != false ? : }>,
description: `Pin this ${object.__typename}`,
diff --git a/src/mates/generics/useLinkMate.tsx b/src/mates/generics/useLinkMate.tsx
index 05774fe..bc8f49d 100644
--- a/src/mates/generics/useLinkMate.tsx
+++ b/src/mates/generics/useLinkMate.tsx
@@ -11,42 +11,46 @@ export const useMikroLinkMate = (): MateFinder => {
const { alert } = useAlert();
const [link] = withMikro(useLinkMutation)({});
- return (type: string, isSelf: boolean) =>
- isSelf
+ return async (options) => {
+ return options.partnersIncludeSelf
? undefined
: [
{
- action: async (self, drops) => {
- let leftType = identifierToLinkableModel(self.identifier);
- let rightType = identifierToLinkableModel(drops[0].identifier);
+ action: async (event) => {
+ for (const partner of event.partners) {
+ let leftType = identifierToLinkableModel(event.self.identifier);
+ let rightType = identifierToLinkableModel(partner.identifier);
- if (!leftType || !rightType) {
- await alert({
- message: "Cannot relate these two objects",
- confirmLabel: "Ok, the developer should really fix this",
- });
- return;
- }
+ if (!leftType || !rightType) {
+ await alert({
+ message: "Cannot relate these two objects",
+ confirmLabel: "Ok, the developer should really fix this",
+ });
+ return;
+ }
- let x = await ask(AskRelationModal, {
- leftIdentifier: self.identifier,
- leftObject: self.object,
- rightIdentifier: drops[0].identifier,
- rightObject: drops[0].object,
- });
+ console.log(leftType, rightType);
+ let x = await ask(AskRelationModal, {
+ leftIdentifier: event.self.identifier,
+ leftObject: event.self.id,
+ rightIdentifier: partner.identifier,
+ rightObject: partner.id,
+ });
- await link({
- variables: {
- leftType: leftType,
- rightType: rightType,
- leftId: self.object,
- rightId: drops[0].object,
- ...x,
- },
- });
+ await link({
+ variables: {
+ leftType: leftType,
+ rightType: rightType,
+ leftId: event.self.id,
+ rightId: partner.id,
+ ...x,
+ },
+ });
+ }
},
label: "Relate",
description: "Relate to other",
},
];
+ };
};
diff --git a/src/mates/nodes/useNodeActionMate.tsx b/src/mates/nodes/useNodeActionMate.tsx
index 22253c2..2c321a0 100644
--- a/src/mates/nodes/useNodeActionMate.tsx
+++ b/src/mates/nodes/useNodeActionMate.tsx
@@ -3,41 +3,34 @@ import { useDialog } from "../../layout/dialog/DialogProvider";
import { Flow } from "../../linker";
import { NodeListItemFragment } from "../../rekuest/api/graphql";
import { ReserveDialog } from "../../rekuest/components/dialogs/ReserveDialog";
-import { AdditionalMate } from "../../rekuest/postman/mater/mater-context";
-import { useRequester } from "../../rekuest/postman/requester/requester-context";
-import { useReserver } from "../../rekuest/postman/reserver/reserver-context";
-import { MateFinder } from "../types";
+import { usePostman } from "../../rekuest/providers/postman/postman-context";
+import { useSettings } from "../../settings/settings-context";
+import { Mate, MateFinder } from "../types";
export const useNodeActionMate = (): ((
node: NodeListItemFragment
) => MateFinder) => {
- const { assign, unassign } = useRequester();
-
const { ask } = useDialog();
- const { reserve } = useReserver();
+ const { reserve } = usePostman();
+ const { settings } = useSettings();
const navigate = useNavigate();
- return (node) => (type, isSelf) => {
- let mates: AdditionalMate[] = [];
- if (!isSelf) {
+ return (node) => async (options) => {
+ let mates: Mate[] = [];
+ if (!options.partnersIncludeSelf) {
return mates;
}
mates.push({
action: async () => {
- await reserve({ node: node.id });
+ let res = await ask(ReserveDialog, {
+ initial: { node: node.id, instanceId: settings.instanceId },
+ });
+ await reserve(res);
},
label: "Reserve",
});
- mates.push({
- action: async () => {
- let res = await ask(ReserveDialog, { initial: { node: node.id } });
- console.log(res);
- },
- label: "Reserve New",
- });
-
if (node.interfaces?.includes("workflow") && node.meta?.flow) {
mates.push({
action: async () => {
diff --git a/src/mates/postman/usePostmanMates.tsx b/src/mates/postman/usePostmanMates.tsx
new file mode 100644
index 0000000..de1d606
--- /dev/null
+++ b/src/mates/postman/usePostmanMates.tsx
@@ -0,0 +1,59 @@
+import { withRekuest } from "../../rekuest";
+import {
+ PortKindInput,
+ useThisFilteredReservationsLazyQuery,
+} from "../../rekuest/api/graphql";
+import { useRequester } from "../../rekuest/providers/requester/requester-context";
+import { useSettings } from "../../settings/settings-context";
+import { MateFinder } from "../types";
+
+export const usePostmanMate: () => MateFinder = () => {
+ const { assign } = useRequester();
+ const { settings } = useSettings();
+
+ const [find] = withRekuest(useThisFilteredReservationsLazyQuery)();
+
+ return async (options) => {
+ if (options.justSelf) {
+ try {
+ let reservations = await find({
+ fetchPolicy: "network-only",
+ variables: {
+ instanceId: settings.instanceId,
+ inputPortDemands: [
+ {
+ at: 0,
+ kind: PortKindInput.Structure,
+ identifier: options.self.identifier,
+ },
+ ],
+ },
+ });
+
+ console.log("reservations", reservations);
+
+ if (reservations.data?.reservations) {
+ return reservations.data.reservations.map((r) => ({
+ action: async (event) => {
+ let key = r?.node?.args?.at(0)?.key;
+ console.log(key);
+
+ await assign({
+ reservation: r,
+ defaults: key ? { [key]: event.self.id } : {},
+ });
+ return "Assigned";
+ },
+ label: r?.title || r?.node.name,
+ }));
+ }
+ } catch (e) {
+ console.error(e);
+ }
+
+ return [];
+ }
+
+ return [];
+ };
+};
diff --git a/src/mates/provision/useLinkProvisionMate.tsx b/src/mates/provision/useLinkProvisionMate.tsx
index 6e9b994..34546e3 100644
--- a/src/mates/provision/useLinkProvisionMate.tsx
+++ b/src/mates/provision/useLinkProvisionMate.tsx
@@ -7,14 +7,14 @@ export const useLinkProvisionMate = (res: { id: string }): MateFinder => {
const { confirm } = useConfirm();
const [link] = withRekuest(useLinkMutation)();
- return (type, isSelf) => {
- if (isSelf) {
+ return async (options) => {
+ if (options.justSelf) {
return [
{
- action: async (self, drops) => {
+ action: async (event) => {
await link({
variables: {
- provision: self?.object,
+ provision: event.self.id,
reservation: res.id,
},
});
diff --git a/src/mates/provision/useUnlinkProvisionMate.tsx b/src/mates/provision/useUnlinkProvisionMate.tsx
index 70aac03..dce922e 100644
--- a/src/mates/provision/useUnlinkProvisionMate.tsx
+++ b/src/mates/provision/useUnlinkProvisionMate.tsx
@@ -7,14 +7,14 @@ export const useUnlinkProvisionMate = (res: { id: string }): MateFinder => {
const { confirm } = useConfirm();
const [unlink] = withRekuest(useUnlinkMutation)();
- return (type, isSelf) => {
- if (isSelf) {
+ return async (options) => {
+ if (options.justSelf) {
return [
{
- action: async (self, drops) => {
+ action: async (event) => {
await unlink({
variables: {
- provision: self?.object,
+ provision: event.self.id,
reservation: res.id,
},
});
diff --git a/src/mates/repo/useGithubRepoLifecycleMate.tsx b/src/mates/repo/useGithubRepoLifecycleMate.tsx
index f935f32..58cee60 100644
--- a/src/mates/repo/useGithubRepoLifecycleMate.tsx
+++ b/src/mates/repo/useGithubRepoLifecycleMate.tsx
@@ -1,38 +1,21 @@
-import { update } from "@react-spring/web";
-import { BsTrash } from "react-icons/bs";
-import { useConfirm } from "../../components/confirmer/confirmer-context";
-import {
- MyOmeroFilesDocument,
- MyOmeroFilesQuery,
- MyOmeroFilesQueryVariables,
- useDeleteOmeroFileMutation,
- useReleaseFilesMutation,
-} from "../../mikro/api/graphql";
-import { withMikro } from "../../mikro/MikroContext";
+import { withPort } from "../../port/PortContext";
import {
DeploymentsDocument,
- usePullWhaleMutation,
- useRunWhaleMutation,
useScanRepoMutation,
} from "../../port/api/graphql";
-import { withPort } from "../../port/PortContext";
-import { Mate } from "../../rekuest/postman/mater/mater-context";
import { MateFinder } from "../types";
export const useGithubRepoLifecycleMate = (): MateFinder => {
- const { confirm } = useConfirm();
-
const [scanRepo, _] = withPort(useScanRepoMutation)({
refetchQueries: [DeploymentsDocument],
});
- const [pull] = withPort(usePullWhaleMutation)();
- return (type, isSelf) => {
- if (type == "item:@port/githubrepo") {
+ return async (options) => {
+ if (options.justSelf) {
return [
{
- action: async (self, drops) => {
- await scanRepo({ variables: { id: self.object } });
+ action: async (event) => {
+ await scanRepo({ variables: { id: event.self.id } });
},
label: "Scan",
description: "Scan Repo",
diff --git a/src/mates/representation/useReleaseRepresentationMate.tsx b/src/mates/representation/useReleaseRepresentationMate.tsx
index 9640444..20bff2c 100644
--- a/src/mates/representation/useReleaseRepresentationMate.tsx
+++ b/src/mates/representation/useReleaseRepresentationMate.tsx
@@ -1,35 +1,30 @@
-import { BsTrash } from "react-icons/bs";
import { useConfirm } from "../../components/confirmer/confirmer-context";
-import {
- MyOmeroFilesDocument,
- MyOmeroFilesQuery,
- MyOmeroFilesQueryVariables,
- useDeleteOmeroFileMutation,
- useReleaseFilesMutation,
- useReleaseRepresentationsMutation,
- useReleaseSamplesMutation,
-} from "../../mikro/api/graphql";
import { withMikro } from "../../mikro/MikroContext";
-import { Mate } from "../../rekuest/postman/mater/mater-context";
+import { useReleaseRepresentationsMutation } from "../../mikro/api/graphql";
import { MateFinder } from "../types";
export const useReleaseRepresentationMate = (datasetID: string): MateFinder => {
const { confirm } = useConfirm();
- const [releaseFiles] = withMikro(useReleaseRepresentationsMutation)();
+ const [releaseRepresentations] = withMikro(
+ useReleaseRepresentationsMutation
+ )();
- return (type, isSelf) => {
- if (isSelf || type == "list:@mikro/representation") {
+ return async (options) => {
+ if (
+ options.partners == "list:@mikro/representation" ||
+ options.partners == "item:@mikro/representation"
+ ) {
return [
{
- action: async (self, partner) => {
+ action: async (event) => {
await confirm({
message:
- "Are you sure you want to release this file from this dataset",
+ "Are you sure you want to release these images from this dataset",
});
- releaseFiles({
+ releaseRepresentations({
variables: {
- representations: partner.map((p) => p.object),
+ representations: event.partners.map((p) => p.id),
dataset: datasetID,
},
});
diff --git a/src/mates/reservation/useRequesterMate.tsx b/src/mates/reservation/useRequesterMate.tsx
index 6899e48..4c666bb 100644
--- a/src/mates/reservation/useRequesterMate.tsx
+++ b/src/mates/reservation/useRequesterMate.tsx
@@ -1,24 +1,10 @@
-import { BsTrash } from "react-icons/bs";
-import { useConfirm } from "../../components/confirmer/confirmer-context";
-import {
- MyOmeroFilesDocument,
- MyOmeroFilesQuery,
- MyOmeroFilesQueryVariables,
- useDeleteOmeroFileMutation,
- useReleaseFilesMutation,
-} from "../../mikro/api/graphql";
-import { withMikro } from "../../mikro/MikroContext";
import {
ListReservationFragment,
ReservationStatus,
} from "../../rekuest/api/graphql";
-import { usePostman } from "../../rekuest/postman/graphql/postman-context";
-import {
- AdditionalMate,
- Mate,
-} from "../../rekuest/postman/mater/mater-context";
-import { useRequester } from "../../rekuest/postman/requester/requester-context";
-import { MateFinder } from "../types";
+import { usePostman } from "../../rekuest/providers/postman/postman-context";
+import { useRequester } from "../../rekuest/providers/requester/requester-context";
+import { Mate, MateFinder } from "../types";
export const useRequesterMate = (): ((
res: ListReservationFragment
@@ -26,8 +12,8 @@ export const useRequesterMate = (): ((
const { assign, unassign } = useRequester();
const { unreserve } = usePostman();
- return (res) => (type, isSelf) => {
- let mates: AdditionalMate[] = [];
+ return (res) => async (options) => {
+ let mates: Mate[] = [];
if (res.status === ReservationStatus.Active) {
mates.push({
@@ -41,7 +27,7 @@ export const useRequesterMate = (): ((
return mates.concat([
{
action: async () => {
- await unreserve({ variables: { reservation: res.id } });
+ await unreserve({ reservation: res.id });
},
label: "Unreserve",
},
diff --git a/src/mates/reservation/useReserveMate.tsx b/src/mates/reservation/useReserveMate.tsx
index 6899e48..4c666bb 100644
--- a/src/mates/reservation/useReserveMate.tsx
+++ b/src/mates/reservation/useReserveMate.tsx
@@ -1,24 +1,10 @@
-import { BsTrash } from "react-icons/bs";
-import { useConfirm } from "../../components/confirmer/confirmer-context";
-import {
- MyOmeroFilesDocument,
- MyOmeroFilesQuery,
- MyOmeroFilesQueryVariables,
- useDeleteOmeroFileMutation,
- useReleaseFilesMutation,
-} from "../../mikro/api/graphql";
-import { withMikro } from "../../mikro/MikroContext";
import {
ListReservationFragment,
ReservationStatus,
} from "../../rekuest/api/graphql";
-import { usePostman } from "../../rekuest/postman/graphql/postman-context";
-import {
- AdditionalMate,
- Mate,
-} from "../../rekuest/postman/mater/mater-context";
-import { useRequester } from "../../rekuest/postman/requester/requester-context";
-import { MateFinder } from "../types";
+import { usePostman } from "../../rekuest/providers/postman/postman-context";
+import { useRequester } from "../../rekuest/providers/requester/requester-context";
+import { Mate, MateFinder } from "../types";
export const useRequesterMate = (): ((
res: ListReservationFragment
@@ -26,8 +12,8 @@ export const useRequesterMate = (): ((
const { assign, unassign } = useRequester();
const { unreserve } = usePostman();
- return (res) => (type, isSelf) => {
- let mates: AdditionalMate[] = [];
+ return (res) => async (options) => {
+ let mates: Mate[] = [];
if (res.status === ReservationStatus.Active) {
mates.push({
@@ -41,7 +27,7 @@ export const useRequesterMate = (): ((
return mates.concat([
{
action: async () => {
- await unreserve({ variables: { reservation: res.id } });
+ await unreserve({ reservation: res.id });
},
label: "Unreserve",
},
diff --git a/src/mates/sample/useReleaseSampleMate.tsx b/src/mates/sample/useReleaseSampleMate.tsx
index 368ceca..cdc179d 100644
--- a/src/mates/sample/useReleaseSampleMate.tsx
+++ b/src/mates/sample/useReleaseSampleMate.tsx
@@ -1,34 +1,28 @@
-import { BsTrash } from "react-icons/bs";
import { useConfirm } from "../../components/confirmer/confirmer-context";
-import {
- MyOmeroFilesDocument,
- MyOmeroFilesQuery,
- MyOmeroFilesQueryVariables,
- useDeleteOmeroFileMutation,
- useReleaseFilesMutation,
- useReleaseSamplesMutation,
-} from "../../mikro/api/graphql";
import { withMikro } from "../../mikro/MikroContext";
-import { Mate } from "../../rekuest/postman/mater/mater-context";
+import { useReleaseSamplesMutation } from "../../mikro/api/graphql";
import { MateFinder } from "../types";
export const useReleaseSampleMate = (datasetID: string): MateFinder => {
const { confirm } = useConfirm();
const [releaseFiles] = withMikro(useReleaseSamplesMutation)();
- return (type, isSelf) => {
- if (isSelf || type == "list:@mikro/sample") {
+ return async (options) => {
+ if (
+ options.partners == "list:@mikro/sample" ||
+ options.partners == "item:@mikro/sample"
+ ) {
return [
{
- action: async (self, partner) => {
+ action: async (event) => {
await confirm({
message:
- "Are you sure you want to release this file from this dataset",
+ "Are you sure you want to release these samples from this dataset",
});
releaseFiles({
variables: {
- samples: partner.map((p) => p.object),
+ samples: event.partners.map((p) => p.id),
dataset: datasetID,
},
});
diff --git a/src/mates/scan/useDeployScanMate.tsx b/src/mates/scan/useDeployScanMate.tsx
index 3ca41f4..7fa5b03 100644
--- a/src/mates/scan/useDeployScanMate.tsx
+++ b/src/mates/scan/useDeployScanMate.tsx
@@ -5,12 +5,12 @@ import { MateFinder } from "../types";
export const useDeployScanMate = (): MateFinder => {
const { ask } = useDialog();
- return (type, isSelf) => {
- if (isSelf) {
+ return async (options) => {
+ if (options.justSelf) {
return [
{
- action: async (self, drops) => {
- let d = await ask(DeployDialog, { scan: self.object });
+ action: async (event) => {
+ let d = await ask(DeployDialog, { scan: event.self.id });
},
label: "Appify",
description: "Apiffy this scan",
diff --git a/src/mates/template/useLinkProvisionMate.tsx b/src/mates/template/useLinkProvisionMate.tsx
index b2a8480..2b1917c 100644
--- a/src/mates/template/useLinkProvisionMate.tsx
+++ b/src/mates/template/useLinkProvisionMate.tsx
@@ -8,14 +8,14 @@ export const useProvideMate = () => {
const [link] = withRekuest(useProvideMutation)();
return (res: { id: string }): MateFinder =>
- (type, isSelf) => {
- if (isSelf) {
+ async (options) => {
+ if (options.justSelf) {
return [
{
- action: async (self, drops) => {
+ action: async (event) => {
await link({
variables: {
- template: self?.object,
+ template: event.self.id,
},
});
},
diff --git a/src/mates/template/useTemplateActionsMate.tsx b/src/mates/template/useTemplateActionsMate.tsx
new file mode 100644
index 0000000..16b631b
--- /dev/null
+++ b/src/mates/template/useTemplateActionsMate.tsx
@@ -0,0 +1,49 @@
+import { useNavigate } from "react-router";
+import { keyInObject } from "../../floating/utils";
+import { useDialog } from "../../layout/dialog/DialogProvider";
+import { Flow } from "../../linker";
+import { ReserveDialog } from "../../rekuest/components/dialogs/ReserveDialog";
+import { useReserver } from "../../rekuest/providers/reserver/reserver-context";
+import { Mate, MateFinder } from "../types";
+
+export const useTemplateActionMate = (): ((template: {
+ id: string;
+ params?: { [key: string]: any };
+}) => MateFinder) => {
+ const { ask } = useDialog();
+ const { reserve } = useReserver();
+ const navigate = useNavigate();
+
+ return (template) => async (options) => {
+ let mates: Mate[] = [];
+ if (!options.justSelf) {
+ return mates;
+ }
+
+ mates.push({
+ action: async () => {
+ await reserve({ template: template.id });
+ },
+ label: "Reserve",
+ });
+
+ mates.push({
+ action: async () => {
+ let res = await ask(ReserveDialog, { initial: { node: template.id } });
+ console.log(res);
+ },
+ label: "Reserve New",
+ });
+
+ if (keyInObject("params", template)) {
+ mates.push({
+ action: async () => {
+ await navigate(Flow.linkBuilder(template.params?.flow));
+ },
+ label: "Show Flow",
+ });
+ }
+
+ return mates;
+ };
+};
diff --git a/src/mates/types.tsx b/src/mates/types.tsx
index ae927c1..edaec9d 100644
--- a/src/mates/types.tsx
+++ b/src/mates/types.tsx
@@ -1,6 +1,34 @@
-import { AdditionalMate } from "../rekuest/postman/mater/mater-context";
+export type Identifier = string;
-export type MateFinder = (
- type: string,
- isSelf: boolean
-) => AdditionalMate[] | undefined;
+export type Modifier = "list" | "item";
+
+export type Accept = `${Modifier}:${Identifier}`;
+
+export type Drop = {
+ identifier: Identifier;
+ id: string;
+};
+
+export type ActionEvent = {
+ self: Drop;
+ partners: Drop[];
+ progress: (x: number) => Promise;
+};
+
+export type MateOptions = {
+ partners?: Drop[];
+ self: Drop;
+ partnersIncludeSelf: boolean;
+ justSelf: boolean;
+};
+
+export type Mate = {
+ action: (event: ActionEvent) => Promise;
+ label: React.ReactNode;
+ className?: (options: { isOver: boolean }) => string | string;
+ description?:
+ | ((options: { self: Drop; drops: Drop[] }) => React.ReactNode)
+ | React.ReactNode;
+};
+
+export type MateFinder = (options: MateOptions) => Promise;
diff --git a/src/mates/whale/useWhaleLifecycleMate.tsx b/src/mates/whale/useWhaleLifecycleMate.tsx
index dd74c4f..e13faa1 100644
--- a/src/mates/whale/useWhaleLifecycleMate.tsx
+++ b/src/mates/whale/useWhaleLifecycleMate.tsx
@@ -20,12 +20,12 @@ export const useWhaleLifecycleMate = (): MateFinder => {
refetchQueries: ["ListWhales"],
});
- return (type, isSelf) => {
- if (type == "item:@port/whale") {
+ return async (options) => {
+ if (options.justSelf) {
return [
{
- action: async (self, drops) => {
- let x = await ask(RunWhaleDialog, { whale: self.object });
+ action: async (event) => {
+ let x = await ask(RunWhaleDialog, { whale: event.self.id });
await deploy({ variables: x });
},
@@ -33,26 +33,26 @@ export const useWhaleLifecycleMate = (): MateFinder => {
description: "Deploy Whale",
},
{
- action: async (self, drops) => {
+ action: async (event) => {
await confirm({
message: "Do you really want to update this whale?",
confirmLabel: "Yes deploy!",
});
- await pull({ variables: { id: self.object } });
+ await pull({ variables: { id: event.self.id } });
},
label: "Pull",
description: "Pull Update",
},
{
- action: async (self, drops) => {
+ action: async (event) => {
await confirm({
message:
"Do you really want to delete the downloaded image for this whale (you need to pull before deploying it!)?",
confirmLabel: "Yes deploy!",
});
- await purge({ variables: { id: self.object } });
+ await purge({ variables: { id: event.self.id } });
},
label: "Purge",
description: "Purge Image",
diff --git a/src/mikro/MikroContext.tsx b/src/mikro/MikroContext.tsx
index 669fa09..daff498 100644
--- a/src/mikro/MikroContext.tsx
+++ b/src/mikro/MikroContext.tsx
@@ -1,18 +1,14 @@
-import { MikroClient, MikroConfig } from "./types";
-import React, { useContext } from "react";
import { useQuery } from "@apollo/client";
+import React, { useContext } from "react";
+import { MikroClient, MikroConfig } from "./types";
export type MikroContextType = {
client?: MikroClient;
- configure: (config: MikroConfig) => void;
- s3resolve: (path?: string | null) => string;
+ configure: (config: MikroConfig | undefined) => void;
config?: MikroConfig;
};
export const MikroContext = React.createContext({
- s3resolve: () => {
- throw Error("No Provider in context not configured");
- },
configure: () => {
throw Error("No Provider in context not configured");
},
@@ -28,6 +24,8 @@ export const useMikroQuery = (query: any) => {
export function withMikro any>(func: T): T {
const Wrapped = (nana: any) => {
const { client } = useMikro();
+ if (!client) throw Error("No MikroClient in context");
+
return func({ ...nana, client: client });
};
return Wrapped as T;
diff --git a/src/mikro/MikroModule.tsx b/src/mikro/MikroModule.tsx
new file mode 100644
index 0000000..7a77fdc
--- /dev/null
+++ b/src/mikro/MikroModule.tsx
@@ -0,0 +1,153 @@
+import React from "react";
+import { Route, Routes } from "react-router";
+import { Live } from "../dashboard/Dashboard";
+import { ModuleLayout } from "../layout/ModuleLayout";
+import { MikroGuard } from "./MikroGuard";
+import { DataChannel } from "./pages/channels/DataChannel";
+import { DataDataset } from "./pages/datasets/DataDataset";
+import { DataDatasets } from "./pages/datasets/DataDatasets";
+import { DataEra } from "./pages/eras/DataEra";
+import { DataEras } from "./pages/eras/DataEras";
+import { DataFile } from "./pages/files/DataFile";
+import { DataFiles } from "./pages/files/DataFiles";
+import DataGraph from "./pages/graphs/DataGraph";
+import DataGraphs from "./pages/graphs/DataGraphs";
+import { DataInstrument } from "./pages/instruments/DataInstrument";
+import { DataInstruments } from "./pages/instruments/DataInstruments";
+import { DataLabel } from "./pages/labels/DataLabel";
+import { DataLabels } from "./pages/labels/DataLabels";
+import { DataLive } from "./pages/live/DataLive";
+import { DataLives } from "./pages/live/DataLives";
+import { DataMeta } from "./pages/metas/DataMeta";
+import { DataMetas } from "./pages/metas/DataMetas";
+import { DataMetric } from "./pages/metrics/DataMetric";
+import { DataMetrics } from "./pages/metrics/DataMetrics";
+import { DataObjective } from "./pages/objectives/DataObjective";
+import { DataObjectives } from "./pages/objectives/DataObjectives";
+import { DataPlot } from "./pages/plots/DataPlot";
+import { DataPlots } from "./pages/plots/DataPlots";
+import { DataPosition } from "./pages/positions/DataPosition";
+import { DataPositions } from "./pages/positions/DataPositions";
+import { DataProvenance } from "./pages/provenance/DataProvenance";
+import { DataRepresentation } from "./pages/representations/DataRepresentation";
+import { DataRepresentations } from "./pages/representations/DataRepresentations";
+import { DataRoi } from "./pages/rois/DataRoi";
+import { DataSample } from "./pages/samples/DataSample";
+import { DataSamples } from "./pages/samples/DataSamples";
+import { DataStage } from "./pages/stages/DataStage";
+import { DataStages } from "./pages/stages/DataStages";
+import { DataTable } from "./pages/tables/DataTable";
+import { DataTables } from "./pages/tables/DataTables";
+import DataThumbnail from "./pages/thumbnails/DataThumbnail";
+import DataThumbnails from "./pages/thumbnails/DataThumbnails";
+import { DataTimepoint } from "./pages/timepoints/DataTimepoint";
+import { DataTimepoints } from "./pages/timepoints/DataTimepoints";
+import DataVideo from "./pages/videos/DataVideo";
+import DataVideos from "./pages/videos/DataVideos";
+import DataSidePanel from "./sidepanels/DataSidePanel";
+export const DataHome = React.lazy(() => import("./pages/Home"));
+export const DataExperiments = React.lazy(
+ () => import("./pages/experiments/DataExperiments")
+);
+export const DataExperiment = React.lazy(
+ () => import("./pages/experiments/DataExperiment")
+);
+export const DataModels = React.lazy(() => import("./pages/models/DataModels"));
+export const DataModel = React.lazy(() => import("./pages/models/DataModel"));
+export const DataContexts = React.lazy(
+ () => import("./pages/contexts/DataContexts")
+);
+export const DataContext = React.lazy(
+ () => import("./pages/contexts/DataContext")
+);
+
+export const DataLink = React.lazy(() => import("./pages/links/DataLink"));
+export const DataLinks = React.lazy(() => import("./pages/links/DataLinks"));
+
+interface Props {}
+
+export const MikroModule: React.FC = (props) => {
+ return (
+ Loading>}>
+ ,
+ },
+ ]}
+ >
+
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+
+ } />
+ } />
+
+ } />
+ } />
+
+ } />
+ } />
+
+ } />
+ } />
+
+ } />
+ } />
+
+ } />
+ } />
+
+ } />
+ } />
+ }
+ />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+
+ } />
+
+
+
+ );
+};
+
+export default MikroModule;
diff --git a/src/mikro/MikroProvider.tsx b/src/mikro/MikroProvider.tsx
index 05ea2c2..28eba5b 100644
--- a/src/mikro/MikroProvider.tsx
+++ b/src/mikro/MikroProvider.tsx
@@ -1,41 +1,41 @@
import { ApolloClient, NormalizedCacheObject } from "@apollo/client";
import React, { useState } from "react";
-import { createMikroClient } from "./client";
import { MikroContext } from "./MikroContext";
+import { createMikroClient } from "./client";
import { MikroConfig } from "./types";
export type MikroProps = {
children: React.ReactNode;
};
-export const MikroProvider: React.FC = ({ children }) => {
- const [client, setClient] = useState<
- ApolloClient | undefined
- >();
- const [config, setConfig] = useState();
+export type ConfigState = {
+ config?: MikroConfig;
+ client?: ApolloClient;
+};
- const configure = (config: MikroConfig) => {
- setConfig(config);
- setClient(createMikroClient(config));
- };
+export const MikroProvider: React.FC = ({ children }) => {
+ const [config, setConfig] = useState({
+ config: undefined,
+ client: undefined,
+ });
- const s3resolve = (path?: string | null) => {
- if (config) {
- return config.s3resolve(path);
+ const configure = (config?: MikroConfig) => {
+ if (!config) {
+ setConfig({
+ config: undefined,
+ client: undefined,
+ });
+ return;
}
- return "fallback";
- };
-
-
+ setConfig({ config: config, client: createMikroClient(config) });
+ };
return (
{children}
diff --git a/src/mikro/api/graphql.ts b/src/mikro/api/graphql.ts
index e43c961..30d2051 100644
--- a/src/mikro/api/graphql.ts
+++ b/src/mikro/api/graphql.ts
@@ -175,7 +175,8 @@ export type Comment = {
parent?: Maybe;
resolved?: Maybe;
resolvedBy?: Maybe;
- text: Scalars['String'];
+ /** The text of the comment (without any formatting) */
+ text?: Maybe;
user: User;
};
@@ -2519,6 +2520,7 @@ export type OmeroViewsArgs = {
activeForY?: InputMaybe;
activeForZ?: InputMaybe;
ids?: InputMaybe>>;
+ isGlobal?: InputMaybe;
limit?: InputMaybe;
name?: InputMaybe;
offset?: InputMaybe;
@@ -3074,6 +3076,14 @@ export type Query = {
/** My samples return all of the users samples attached to the current user */
graphs?: Maybe>>;
hello?: Maybe;
+ /**
+ * Get a single Image by ID
+ *
+ * Returns a single Representation by ID. If the user does not have access
+ * to the Representation, an error will be raised.
+ *
+ */
+ image?: Maybe;
/**
* Get a single instrumes by ID
*
@@ -3783,6 +3793,12 @@ export type QueryGraphsArgs = {
};
+/** The root Query */
+export type QueryImageArgs = {
+ id: Scalars['ID'];
+};
+
+
/** The root Query */
export type QueryInstrumentArgs = {
id?: InputMaybe;
@@ -4535,6 +4551,7 @@ export type QueryViewsArgs = {
activeForY?: InputMaybe;
activeForZ?: InputMaybe;
ids?: InputMaybe>>;
+ isGlobal?: InputMaybe;
limit?: InputMaybe;
name?: InputMaybe;
offset?: InputMaybe;
@@ -4723,6 +4740,8 @@ export type Representation = {
variety: RepresentationVariety;
/** The rendered bioimages */
videos: Array