Skip to content

Commit

Permalink
add status to getFlows
Browse files Browse the repository at this point in the history
  • Loading branch information
RODO94 committed Jan 10, 2025
1 parent a0cbda4 commit 97ddeb7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 9 additions & 7 deletions editor.planx.uk/src/pages/FlowEditor/lib/store/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { gql } from "@apollo/client";
import { getPathForNode, sortFlow } from "@opensystemslab/planx-core";
import {
ComponentType as TYPES,
flatFlags,
FlowGraph,
NodeId,
OrderedFlow,
flatFlags,
} from "@opensystemslab/planx-core/types";
import {
add,
Expand Down Expand Up @@ -136,6 +136,7 @@ export interface FlowSummary {
id: string;
name: string;
slug: string;
status: "online" | "offline";
updatedAt: string;
operations: {
createdAt: string;
Expand Down Expand Up @@ -189,7 +190,7 @@ export interface EditorStore extends Store.Store {
href: string;
}) => void;
getURLForNode: (nodeId: string) => string;
getFlowSchema: () => { nodes?: string[], options?: string[] } | undefined;
getFlowSchema: () => { nodes?: string[]; options?: string[] } | undefined;
}

export const editorStore: StateCreator<
Expand Down Expand Up @@ -382,6 +383,7 @@ export const editorStore: StateCreator<
id
name
slug
status
updatedAt: updated_at
operations(limit: 1, order_by: { created_at: desc }) {
createdAt: created_at
Expand Down Expand Up @@ -614,14 +616,14 @@ export const editorStore: StateCreator<
Object.entries(flow).map(([_id, node]) => {
if (node.data?.fn) {
// Exclude Filter fn value as not exposed to editors
if (node.data?.fn !== "flag") nodes.add(node.data.fn)
};
if (node.data?.fn !== "flag") nodes.add(node.data.fn);
}

if (node.data?.val) {
// Exclude Filter Option flag values as not exposed to editors
const flagVals = flatFlags.map((flag) => flag.value);
if (!flagVals.includes(node.data.val)) options.add(node.data.val)
};
if (!flagVals.includes(node.data.val)) options.add(node.data.val);
}
});

return {
Expand Down
1 change: 1 addition & 0 deletions editor.planx.uk/src/ui/editor/OrderingFlowsSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface SortObject {
const sortArray: SortObject[] = [
{ displayName: "Name", sortKey: "name" },
{ displayName: "Last update", sortKey: "updatedAt" },
{ displayName: "Status", sortKey: "status" },
];

const sortFlows = <K extends keyof FlowSummary>(
Expand Down

0 comments on commit 97ddeb7

Please sign in to comment.