Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-8098: Add Manage workflows entry to issue properties (#9352)
Bohan Jiang4be54d1b2691
diff --git a/apps/desktop/src/renderer/src/platform/issue-window-navigation.test.tsx b/apps/desktop/src/renderer/src/platform/issue-window-navigation.test.tsxindex 2f912121fe..aaf05fec3f 100644--- a/apps/desktop/src/renderer/src/platform/issue-window-navigation.test.tsx+++ b/apps/desktop/src/renderer/src/platform/issue-window-navigation.test.tsx@@ -102,6 +102,76 @@ describe("IssueWindowNavigationProvider content links", () => {});});+/**+ * MUL-8098 — the issue workflow card's "Manage workflows" button calls the+ * adapter's push with a settings path. This window cannot host it, so it must+ * go to the browser rather than being dropped (which only closed the card).+ */+describe("IssueWindowNavigationProvider adapter push/replace", () => {+ function renderWithAdapter(): () => NavigationAdapter {+ let adapter: NavigationAdapter | null = null;+ function Probe() {+ adapter = useNavigation();+ return <CurrentPath />;+ }+ render(+ <MemoryRouter initialEntries={["/acme/issues/MUL-1"]}>+ <Routes>+ <Route+ path=":workspaceSlug/issues/:id"+ element={+ <IssueWindowNavigationProvider>+ <Probe />+ </IssueWindowNavigationProvider>+ }+ />+ </Routes>+ </MemoryRouter>,+ );+ return () => adapter!;+ }++ it("opens a settings page in the browser on push", () => {+ const adapter = renderWithAdapter();++ act(() => adapter().push("/acme/settings?tab=workflows"));++ expect(screen.getByTestId("path")).toHaveTextContent("/acme/issues/MUL-1");+ expect(openExternal).toHaveBeenCalledTimes(1);+ expect(openExternal).toHaveBeenCalledWith(+ `${APP_URL}/acme/settings?tab=workflows`,+ );+ });++ it("opens a non-issue page in the browser on replace", () => {+ const adapter = renderWithAdapter();++ act(() => adapter().replace("/acme/chat"));++ expect(screen.getByTestId("path")).toHaveTextContent("/acme/issues/MUL-1");+ expect(openExternal).toHaveBeenCalledWith(`${APP_URL}/acme/chat`);+ });++ it("still opens another issue in place on push", () => {+ const adapter = renderWithAdapter();++ act(() => adapter().push("/acme/issues/MUL-2"));++ expect(screen.getByTestId("path")).toHaveTextContent("/acme/issues/MUL-2");+ expect(openExternal).not.toHaveBeenCalled();+ });++ it("does nothing for a non-issue page when runtime config is unavailable", () => {+ window.desktopAPI.runtimeConfig = { ok: false } as never;+ const adapter = renderWithAdapter();++ act(() => adapter().push("/acme/settings?tab=workflows"));++ expect(screen.getByTestId("path")).toHaveTextContent("/acme/issues/MUL-1");+ expect(openExternal).not.toHaveBeenCalled();+ });+});+/*** MUL-6784 — an issue window is a MemoryRouter over the packaged file:// page,* so `window.location` knows nothing about the route. A report or share linkdiff --git a/apps/desktop/src/renderer/src/platform/issue-window-navigation.tsx b/apps/desktop/src/renderer/src/platform/issue-window-navigation.tsxindex b19d641d3f..67311b739b 100644--- a/apps/desktop/src/renderer/src/platform/issue-window-navigation.tsx+++ b/apps/desktop/src/renderer/src/platform/issue-window-navigation.tsx@@ -11,6 +11,21 @@ import {} from "@multica/views/navigation";import { parseIssueWindowPath } from "../../../shared/issue-window";+/**+ * Hand an app page this single-route window cannot host to the browser.+ *+ * Shared by content links and the adapter's push/replace, so a non-issue+ * destination (e.g. workspace settings from the issue workflow card, MUL-8098)+ * is never silently dropped.+ */+function openInBrowser(+ path: string,+ runtimeConfig: typeof window.desktopAPI.runtimeConfig,+) {+ if (!runtimeConfig.ok) return;+ void window.desktopAPI.openExternal(`${runtimeConfig.config.appUrl}${path}`);+}+/*** Answer the `multica:navigate` event inside a dedicated issue window (MUL-5208).*@@ -50,10 +65,7 @@ function useContentLinkHandler(void navigate(issuePath.path);return;}- if (!runtimeConfig.ok) return;- void window.desktopAPI.openExternal(- `${runtimeConfig.config.appUrl}${path}`,- );+ openInBrowser(path, runtimeConfig);};window.addEventListener("multica:navigate", handler);return () => window.removeEventListener("multica:navigate", handler);@@ -62,8 +74,8 @@ function useContentLinkHandler(/*** Navigation bridge for a dedicated issue window. Unlike the main Desktop- * shell, this window owns a tiny MemoryRouter and intentionally accepts only- * issue-detail routes. Keeping the bridge in the platform layer preserves the+ * shell, this window owns a tiny MemoryRouter and hosts only issue-detail+ * routes; every other destination is opened in the browser. Keeping the bridge in the platform layer preserves the* MUL-4741 boundary around direct router navigation.*/export function IssueWindowNavigationProvider({@@ -93,9 +105,14 @@ export function IssueWindowNavigationProvider({useContentLinkHandler(navigate, runtimeConfig);const adapter = useMemo<NavigationAdapter>(() => {+ // Another issue opens in place; any other page goes to the browser, the+ // same split the content-link handler applies.const navigateToIssue = (path: string, replace = false) => {const issuePath = parseIssueWindowPath(path);- if (!issuePath) return;+ if (!issuePath) {+ openInBrowser(path, runtimeConfig);+ return;+ }void navigate(issuePath.path, { replace });};diff --git a/packages/views/workflows/issue-flow-card.tsx b/packages/views/workflows/issue-flow-card.tsxindex f1e509d0f1..0908481c34 100644--- a/packages/views/workflows/issue-flow-card.tsx+++ b/packages/views/workflows/issue-flow-card.tsx@@ -1,15 +1,22 @@"use client";-import { Workflow } from "lucide-react";+import { useState } from "react";+import { Settings, Workflow } from "lucide-react";+import { useFeatureEnabled } from "@multica/core/config";+import { PROJECT_WORKFLOWS_V1_FLAG } from "@multica/core/feature-flags";import { useWorkspaceId } from "@multica/core/hooks";import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";import { useProjectWithWorkflow } from "@multica/core/issue-workflows";+import { useWorkspacePaths } from "@multica/core/paths";+import { Button } from "@multica/ui/components/ui/button";import { Popover, PopoverContent, PopoverTrigger } from "@multica/ui/components/ui/popover";import { cn } from "@multica/ui/lib/utils";import { ActorAvatar } from "../common/actor-avatar";import { StatusIcon } from "../issues/components/status-icon";import { useStatusLabel } from "../issues/utils/status-label";import { useT } from "../i18n";+import { useNavigation } from "../navigation";+import { useWorkflowPermissions } from "./permissions";import { stepHandlerActor, useStepHandlerLabel } from "./step-handler";/**@@ -20,14 +27,19 @@ import { stepHandlerActor, useStepHandlerLabel } from "./step-handler";export function IssueFlowCard({ projectId, currentStatus }: { projectId: string | null; currentStatus: string }) {const { t } = useT("issues");const wsId = useWorkspaceId();+ const navigation = useNavigation();+ const paths = useWorkspacePaths();+ const enabled = useFeatureEnabled(PROJECT_WORKFLOWS_V1_FLAG, false);const catalog = useIssueStatuses(wsId);const labelOf = useStatusLabel(wsId);const { project, workflow } = useProjectWithWorkflow(wsId, projectId);+ const { isAdmin } = useWorkflowPermissions(project);const handlerLabel = useStepHandlerLabel(project);+ const [open, setOpen] = useState(false);if (!workflow || !project) return null;return (- <Popover>+ <Popover open={open} onOpenChange={setOpen}><PopoverTriggerrender={<button@@ -76,6 +88,22 @@ export function IssueFlowCard({ projectId, currentStatus }: { projectId: string})}</ol><p className="mt-2 text-caption text-muted-foreground">{t(($) => $.workflows.detail.card_hint)}</p>+ {isAdmin && enabled && (+ <div className="-mx-3 -mb-3 mt-1 border-t border-surface-border p-1">+ <Button+ variant="ghost"+ size="sm"+ className="w-full justify-start"+ onClick={() => {+ setOpen(false);+ navigation.push(`${paths.settings()}?tab=workflows`);+ }}+ >+ <Settings aria-hidden className="size-3.5" />+ {t(($) => $.workflows.project.manage)}+ </Button>+ </div>+ )}</PopoverContent></Popover>);