@dxos/plugin-github 0.13.0 → 0.16.0-next-60712ab191a99ba90316cc4be753e9e11b17100a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/GitHubCapabilities.mjs +1 -10
- package/dist/lib/GitHubEvents.mjs +1 -15
- package/dist/lib/GitHubOperation.mjs +1 -358
- package/dist/lib/GitHubPlugin.mjs +1 -16
- package/dist/lib/Walkthrough.mjs +1 -59
- package/dist/lib/capabilities.browser.mjs +1 -2
- package/dist/lib/capabilities.browser.mjs.map +1 -1
- package/dist/lib/capabilities.mjs +1 -2
- package/dist/lib/capabilities.mjs.map +1 -1
- package/dist/lib/capabilities.tauri.mjs +1 -2
- package/dist/lib/capabilities.tauri.mjs.map +1 -1
- package/dist/lib/chunk-Extensions.mjs +18 -0
- package/dist/lib/chunk-Extensions.mjs.map +1 -0
- package/dist/lib/chunk-GitHubCapabilities.mjs +10 -0
- package/dist/lib/chunk-GitHubCapabilities.mjs.map +1 -0
- package/dist/lib/chunk-GitHubEvents.mjs +15 -0
- package/dist/lib/chunk-GitHubEvents.mjs.map +1 -0
- package/dist/lib/chunk-GitHubOperation.mjs +386 -0
- package/dist/lib/chunk-GitHubOperation.mjs.map +1 -0
- package/dist/lib/chunk-GitHubPlugin.mjs +16 -0
- package/dist/lib/chunk-GitHubPlugin.mjs.map +1 -0
- package/dist/lib/chunk-ImportPullRequestDialog.mjs.map +1 -1
- package/dist/lib/chunk-PLUGIN.mjs +1 -1
- package/dist/lib/chunk-PullRequestArticle.mjs +64 -21
- package/dist/lib/chunk-PullRequestArticle.mjs.map +1 -1
- package/dist/lib/chunk-PullRequestArticle2.mjs +1 -2
- package/dist/lib/chunk-PullRequestCardMenu.mjs +1 -1
- package/dist/lib/chunk-PullRequestsArticle.mjs +3 -3
- package/dist/lib/chunk-PullRequestsArticle.mjs.map +1 -1
- package/dist/lib/chunk-Walkthrough.mjs +59 -0
- package/dist/lib/chunk-Walkthrough.mjs.map +1 -0
- package/dist/lib/chunk-WalkthroughArticle.mjs +1 -1
- package/dist/lib/chunk-add-pull-request-comment.mjs.map +1 -1
- package/dist/lib/chunk-add-pull-request-review-comment.mjs.map +1 -1
- package/dist/lib/chunk-connector.mjs.map +1 -1
- package/dist/lib/chunk-generate-walkthrough.mjs.map +1 -1
- package/dist/lib/chunk-get-pull-request-diff.mjs.map +1 -1
- package/dist/lib/chunk-get-pull-request-status.mjs.map +1 -1
- package/dist/lib/chunk-get-repositories.mjs.map +1 -1
- package/dist/lib/chunk-github-api.mjs +1 -0
- package/dist/lib/chunk-github-api.mjs.map +1 -1
- package/dist/lib/chunk-import-pull-request.mjs +78 -3
- package/dist/lib/chunk-import-pull-request.mjs.map +1 -1
- package/dist/lib/chunk-link-resolver.mjs.map +1 -1
- package/dist/lib/chunk-pull-request2.mjs +1 -0
- package/dist/lib/chunk-pull-request2.mjs.map +1 -1
- package/dist/lib/chunk-react-surface.mjs +4 -4
- package/dist/lib/chunk-react-surface.mjs.map +1 -1
- package/dist/lib/chunk-refresh-pull-requests.mjs +49 -0
- package/dist/lib/chunk-refresh-pull-requests.mjs.map +1 -0
- package/dist/lib/chunk-submit-pull-request-approval.mjs.map +1 -1
- package/dist/lib/chunk-sync-pull-request.mjs +11 -9
- package/dist/lib/chunk-sync-pull-request.mjs.map +1 -1
- package/dist/lib/chunk-sync.mjs.map +1 -1
- package/dist/lib/index.mjs +2 -2
- package/dist/lib/meta.mjs.map +1 -1
- package/dist/lib/ns/Extensions.mjs +2 -16
- package/dist/lib/operations.mjs +2 -1
- package/dist/lib/operations.mjs.map +1 -1
- package/dist/lib/types.mjs +4 -4
- package/dist/types/src/capabilities/gen/browser.d.ts.map +1 -1
- package/dist/types/src/capabilities/gen/tauri.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/cards/GitHubCard.d.ts.map +1 -1
- package/dist/types/src/components/PullRequestOverview/CheckRunList.d.ts +6 -3
- package/dist/types/src/components/PullRequestOverview/CheckRunList.d.ts.map +1 -1
- package/dist/types/src/components/PullRequestOverview/CheckRunList.test.d.ts +2 -0
- package/dist/types/src/components/PullRequestOverview/CheckRunList.test.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestOverview.d.ts.map +1 -1
- package/dist/types/src/components/PullRequestStatus/PullRequestStatus.d.ts.map +1 -1
- package/dist/types/src/operations/import-pull-request.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/pull-request.d.ts.map +1 -1
- package/dist/types/src/operations/refresh-pull-requests.d.ts +5 -0
- package/dist/types/src/operations/refresh-pull-requests.d.ts.map +1 -0
- package/dist/types/src/operations/refresh.d.ts +37 -0
- package/dist/types/src/operations/refresh.d.ts.map +1 -0
- package/dist/types/src/operations/refresh.test.d.ts +2 -0
- package/dist/types/src/operations/refresh.test.d.ts.map +1 -0
- package/dist/types/src/operations/sync-pull-request.d.ts.map +1 -1
- package/dist/types/src/services/github-api.d.ts +1 -0
- package/dist/types/src/services/github-api.d.ts.map +1 -1
- package/dist/types/src/stories/PullRequestOverview.stories.d.ts +2 -0
- package/dist/types/src/stories/PullRequestOverview.stories.d.ts.map +1 -1
- package/dist/types/src/types/GitHubOperation.d.ts +14 -0
- package/dist/types/src/types/GitHubOperation.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +47 -47
- package/src/capabilities/gen/browser.ts +1 -3
- package/src/capabilities/gen/tauri.ts +1 -3
- package/src/capabilities/index.ts +1 -4
- package/src/cards/GitHubCard.tsx +7 -3
- package/src/components/PullRequestOverview/ArtifactPill.tsx +1 -1
- package/src/components/PullRequestOverview/CheckRunList.test.ts +29 -0
- package/src/components/PullRequestOverview/CheckRunList.tsx +62 -13
- package/src/components/PullRequestOverview/PullRequestOverview.tsx +5 -1
- package/src/components/PullRequestStatus/PullRequestStatus.tsx +8 -5
- package/src/containers/PullRequestsArticle/PullRequestsArticle.tsx +12 -10
- package/src/operations/import-pull-request.ts +8 -0
- package/src/operations/index.ts +1 -0
- package/src/operations/pull-request.ts +1 -0
- package/src/operations/refresh-pull-requests.ts +69 -0
- package/src/operations/refresh.test.ts +112 -0
- package/src/operations/refresh.ts +111 -0
- package/src/operations/sync-pull-request.ts +10 -13
- package/src/services/github-api.ts +1 -0
- package/src/stories/PullRequestOverview.stories.tsx +22 -1
- package/src/types/GitHubOperation.ts +28 -0
- package/dist/lib/GitHubCapabilities.mjs.map +0 -1
- package/dist/lib/GitHubEvents.mjs.map +0 -1
- package/dist/lib/GitHubOperation.mjs.map +0 -1
- package/dist/lib/GitHubPlugin.mjs.map +0 -1
- package/dist/lib/Walkthrough.mjs.map +0 -1
- package/dist/lib/ns/Extensions.mjs.map +0 -1
|
@@ -14,11 +14,11 @@ import * as Schema from "effect/Schema";
|
|
|
14
14
|
import * as AppCapabilities from "@dxos/app-toolkit/AppCapabilities";
|
|
15
15
|
import * as LayoutOperation from "@dxos/app-toolkit/LayoutOperation";
|
|
16
16
|
import { log } from "@dxos/log";
|
|
17
|
+
import { useObject, useQuery } from "@dxos/echo-react";
|
|
17
18
|
import * as Card from "@dxos/react-ui/Card";
|
|
18
19
|
import * as Hooks from "@dxos/react-ui/Hooks";
|
|
19
20
|
import * as Layout from "@dxos/react-ui/Layout";
|
|
20
21
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
-
import { useObject, useQuery } from "@dxos/echo-react";
|
|
22
22
|
import * as Hooks$1 from "@dxos/app-framework/Hooks";
|
|
23
23
|
import * as ToolkitHooks from "@dxos/app-toolkit/Hooks";
|
|
24
24
|
import * as EffectEx from "@dxos/effect/EffectEx";
|
|
@@ -40,6 +40,7 @@ import { TextEditor } from "@dxos/react-ui-editor";
|
|
|
40
40
|
import { DxAnchor } from "@dxos/lit-ui/react";
|
|
41
41
|
import { MarkdownLink, MarkdownView } from "@dxos/react-ui-markdown";
|
|
42
42
|
import * as Icon from "@dxos/react-ui/Icon";
|
|
43
|
+
import * as Typography from "@dxos/react-ui/Typography";
|
|
43
44
|
import { Masonry } from "@dxos/react-ui-masonry";
|
|
44
45
|
//#region src/components/PullRequestFiles/files.ts
|
|
45
46
|
/** Id of the synthetic root the tree model anchors its top-level rows to; never rendered. */
|
|
@@ -575,7 +576,7 @@ var ArtifactPill = ({ artifact, children }) => {
|
|
|
575
576
|
size: "sm",
|
|
576
577
|
classNames: "bg-input-surface text-fg font-normal ring-inset ring ring-neutral-border hover:bg-hover-surface hover:ring-info-border align-baseline",
|
|
577
578
|
icon: artifactIcon[artifact.kind],
|
|
578
|
-
iconClassNames: artifact.kind === "video" ? "text-violet-
|
|
579
|
+
iconClassNames: artifact.kind === "video" ? "text-violet-text" : "text-sky-text",
|
|
579
580
|
label,
|
|
580
581
|
"data-testid": "pull-request.artifact.pill"
|
|
581
582
|
})
|
|
@@ -619,50 +620,85 @@ var outcomeOrder = [
|
|
|
619
620
|
"neutral",
|
|
620
621
|
"skipped"
|
|
621
622
|
];
|
|
622
|
-
/**
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
623
|
+
/**
|
|
624
|
+
* `4m 12s` from start to finish, or to `now` for a run still in progress;
|
|
625
|
+
* undefined for a run that has not started, or has not finished when no `now` is given.
|
|
626
|
+
*/
|
|
627
|
+
var formatDuration = (startedAt, completedAt, now) => {
|
|
628
|
+
const end = completedAt ? Date.parse(completedAt) : now;
|
|
629
|
+
if (!startedAt || end === void 0) return;
|
|
630
|
+
const seconds = Math.max(0, Math.round((end - Date.parse(startedAt)) / 1e3));
|
|
626
631
|
if (Number.isNaN(seconds)) return;
|
|
627
632
|
const minutes = Math.floor(seconds / 60);
|
|
628
633
|
return minutes > 0 ? `${minutes}m ${seconds % 60}s` : `${seconds}s`;
|
|
629
634
|
};
|
|
635
|
+
/** The current time, re-rendering once a second while `active` so elapsed times stay current. */
|
|
636
|
+
var useNow = (active) => {
|
|
637
|
+
const [now, setNow] = useState(() => Date.now());
|
|
638
|
+
useEffect(() => {
|
|
639
|
+
if (!active) return;
|
|
640
|
+
setNow(Date.now());
|
|
641
|
+
const interval = setInterval(() => setNow(Date.now()), 1e3);
|
|
642
|
+
return () => clearInterval(interval);
|
|
643
|
+
}, [active]);
|
|
644
|
+
return now;
|
|
645
|
+
};
|
|
646
|
+
/** The row's value: GitHub's run id, or its name and URL for a run recorded without one. */
|
|
647
|
+
var checkRunId = (run) => run.id !== void 0 ? String(run.id) : `${run.name}-${run.url ?? ""}`;
|
|
630
648
|
/** Sorts runs by what needs attention, then by name so shards read in order. */
|
|
631
649
|
var sortCheckRuns = (runs) => [...runs].sort((a, b) => outcomeOrder.indexOf(a.outcome) - outcomeOrder.indexOf(b.outcome) || a.name.localeCompare(b.name, void 0, { numeric: true }));
|
|
632
|
-
/** Every check on the head commit: its outcome, how long it took, and
|
|
650
|
+
/** Every check on the head commit: its outcome, how long it took, and a button to its logs. */
|
|
633
651
|
var CheckRunList = ({ runs }) => {
|
|
634
652
|
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
635
653
|
const sorted = useMemo(() => runs ? sortCheckRuns(runs) : void 0, [runs]);
|
|
636
654
|
const summary = useCheckSummary(runs);
|
|
655
|
+
const now = useNow(runs?.some((run) => run.outcome === "pending" && run.startedAt) ?? false);
|
|
656
|
+
const [current, setCurrent] = useState();
|
|
637
657
|
if (!sorted || sorted.length === 0) return /* @__PURE__ */ jsx(Status.Empty, { children: t(sorted ? "no-checks.message" : "checks-loading.message") });
|
|
638
658
|
return /* @__PURE__ */ jsx(Listbox.Root, {
|
|
639
659
|
items: sorted.map((run) => ({
|
|
640
|
-
value:
|
|
660
|
+
value: checkRunId(run),
|
|
641
661
|
label: run.name
|
|
642
662
|
})),
|
|
663
|
+
columns: "var(--dx-block-size) minmax(0, 1fr) max-content var(--dx-block-size)",
|
|
664
|
+
onHighlightChange: (value) => value && setCurrent(value),
|
|
643
665
|
children: /* @__PURE__ */ jsx(Listbox.Content, {
|
|
644
666
|
"aria-label": summary,
|
|
645
667
|
"data-testid": "pull-request.checks",
|
|
646
668
|
children: sorted.map((run) => {
|
|
647
669
|
const { icon, classNames } = outcomeIcon[run.outcome];
|
|
648
|
-
const duration = formatDuration(run.startedAt, run.completedAt);
|
|
670
|
+
const duration = formatDuration(run.startedAt, run.completedAt, run.outcome === "pending" ? now : void 0);
|
|
649
671
|
const detail = run.conclusion && run.conclusion !== run.outcome && run.conclusion !== "failure" ? run.conclusion.replace(/_/g, " ") : void 0;
|
|
650
|
-
const outcome = run.outcome === "skipped" ? t("check-outcome.skipped.label") : duration ?? t(`check-outcome.${run.outcome}.label`);
|
|
672
|
+
const outcome = run.outcome === "skipped" ? t("check-outcome.skipped.label") : run.outcome === "pending" ? [t("check-outcome.pending.label"), duration].filter(Boolean).join(" · ") : duration ?? t(`check-outcome.${run.outcome}.label`);
|
|
651
673
|
const url = run.url;
|
|
674
|
+
const id = checkRunId(run);
|
|
652
675
|
return /* @__PURE__ */ jsxs(Listbox.Item, {
|
|
653
|
-
id
|
|
676
|
+
id,
|
|
677
|
+
current: id === current,
|
|
678
|
+
highlightOnHover: false,
|
|
679
|
+
classNames: "dx-hover",
|
|
654
680
|
"data-outcome": run.outcome,
|
|
655
681
|
"data-testid": "pull-request.check",
|
|
656
|
-
onClick: url ? () => window.open(url, "_blank", "noopener,noreferrer") : void 0,
|
|
657
682
|
children: [
|
|
658
683
|
/* @__PURE__ */ jsx(Listbox.ItemIcon, {
|
|
659
684
|
icon,
|
|
660
685
|
classNames
|
|
661
686
|
}),
|
|
662
687
|
/* @__PURE__ */ jsx(Listbox.ItemText, { children: run.name }),
|
|
663
|
-
/* @__PURE__ */ jsx(Listbox.ItemDescription, {
|
|
688
|
+
/* @__PURE__ */ jsx(Listbox.ItemDescription, {
|
|
689
|
+
classNames: "text-right tabular-nums",
|
|
690
|
+
children: [detail, outcome].filter(Boolean).join(" · ")
|
|
691
|
+
}),
|
|
692
|
+
url ? /* @__PURE__ */ jsx(Button.Root, {
|
|
693
|
+
iconOnly: true,
|
|
694
|
+
variant: "ghost",
|
|
695
|
+
icon: "ph--arrow-square-out--regular",
|
|
696
|
+
label: t("open-link.label"),
|
|
697
|
+
"data-testid": "pull-request.check.open",
|
|
698
|
+
onClick: () => window.open(url, "_blank", "noopener,noreferrer")
|
|
699
|
+
}) : /* @__PURE__ */ jsx("span", {})
|
|
664
700
|
]
|
|
665
|
-
},
|
|
701
|
+
}, id);
|
|
666
702
|
})
|
|
667
703
|
})
|
|
668
704
|
});
|
|
@@ -944,9 +980,12 @@ var PullRequestOverview = ({ body, details, runs }) => {
|
|
|
944
980
|
label: t("related.label"),
|
|
945
981
|
children: /* @__PURE__ */ jsx(RelatedCards, { items: related })
|
|
946
982
|
}),
|
|
947
|
-
/* @__PURE__ */
|
|
948
|
-
label:
|
|
949
|
-
children: /* @__PURE__ */ jsx(
|
|
983
|
+
/* @__PURE__ */ jsxs(Form.FieldSet, {
|
|
984
|
+
label: t("checks.label"),
|
|
985
|
+
children: [runs && runs.length > 0 && /* @__PURE__ */ jsx(Typography.Text, {
|
|
986
|
+
"data-testid": "pull-request.checks.summary",
|
|
987
|
+
children: checkSummary
|
|
988
|
+
}), /* @__PURE__ */ jsx(CheckRunList, { runs })]
|
|
950
989
|
})
|
|
951
990
|
] })
|
|
952
991
|
})
|
|
@@ -1004,9 +1043,11 @@ var ciHue = {
|
|
|
1004
1043
|
/** One line answering where the pull request stands: open or merged, approved or not, CI green or red. */
|
|
1005
1044
|
var PullRequestStatus = ({ reference, title, state, review, ci }) => {
|
|
1006
1045
|
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
1007
|
-
return /* @__PURE__ */ jsxs(
|
|
1046
|
+
return /* @__PURE__ */ jsxs(Layout.Flex, {
|
|
1047
|
+
align: "center",
|
|
1048
|
+
gap: "sm",
|
|
1008
1049
|
role: "status",
|
|
1009
|
-
|
|
1050
|
+
classNames: "px-3 py-1.5 border-b border-separator-subtle text-sm min-w-0",
|
|
1010
1051
|
"data-testid": "pull-request.status",
|
|
1011
1052
|
children: [
|
|
1012
1053
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -1018,8 +1059,10 @@ var PullRequestStatus = ({ reference, title, state, review, ci }) => {
|
|
|
1018
1059
|
className: "truncate grow",
|
|
1019
1060
|
children: title
|
|
1020
1061
|
}),
|
|
1021
|
-
/* @__PURE__ */ jsxs(
|
|
1022
|
-
|
|
1062
|
+
/* @__PURE__ */ jsxs(Layout.Flex, {
|
|
1063
|
+
align: "center",
|
|
1064
|
+
gap: "sm",
|
|
1065
|
+
classNames: "shrink-0 ml-auto",
|
|
1023
1066
|
children: [
|
|
1024
1067
|
state && /* @__PURE__ */ jsx("span", {
|
|
1025
1068
|
className: "dx-tag dx-tag-inline",
|