@backstage-community/plugin-github-actions 0.9.2 → 0.10.0
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/CHANGELOG.md +6 -0
- package/dist/alpha/entityCards.esm.js +5 -5
- package/dist/alpha/entityCards.esm.js.map +1 -1
- package/dist/alpha/entityContent.esm.js +2 -2
- package/dist/alpha/entityContent.esm.js.map +1 -1
- package/dist/alpha.d.ts +4 -4
- package/dist/components/Cards/Cards.esm.js +19 -10
- package/dist/components/Cards/Cards.esm.js.map +1 -1
- package/dist/components/Cards/RecentWorkflowRunsCard.esm.js +34 -30
- package/dist/components/Cards/RecentWorkflowRunsCard.esm.js.map +1 -1
- package/dist/components/Router.esm.js +13 -10
- package/dist/components/Router.esm.js.map +1 -1
- package/dist/components/WorkflowRunDetails/WorkflowRunDetails.esm.js +94 -36
- package/dist/components/WorkflowRunDetails/WorkflowRunDetails.esm.js.map +1 -1
- package/dist/components/WorkflowRunLogs/WorkflowRunLogs.esm.js +41 -35
- package/dist/components/WorkflowRunLogs/WorkflowRunLogs.esm.js.map +1 -1
- package/dist/components/WorkflowRunStatus/WorkflowRunStatus.esm.js +12 -9
- package/dist/components/WorkflowRunStatus/WorkflowRunStatus.esm.js.map +1 -1
- package/dist/components/WorkflowRunsCard/WorkflowRunsCard.esm.js +198 -165
- package/dist/components/WorkflowRunsCard/WorkflowRunsCard.esm.js.map +1 -1
- package/dist/components/WorkflowRunsTable/WorkflowRunsTable.esm.js +25 -18
- package/dist/components/WorkflowRunsTable/WorkflowRunsTable.esm.js.map +1 -1
- package/dist/index.d.ts +15 -18
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
3
3
|
import { isGithubActionsAvailable } from '../components/Router.esm.js';
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ const entityGithubActionsCard = EntityCardBlueprint.make({
|
|
|
6
6
|
name: "workflow-runs",
|
|
7
7
|
params: {
|
|
8
8
|
filter: isGithubActionsAvailable,
|
|
9
|
-
loader: () => import('../components/Router.esm.js').then((m) => /* @__PURE__ */
|
|
9
|
+
loader: () => import('../components/Router.esm.js').then((m) => /* @__PURE__ */ jsx(m.Router, { view: "cards" }))
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
const entityLatestGithubActionRunCard = EntityCardBlueprint.makeWithOverrides({
|
|
@@ -21,7 +21,7 @@ const entityLatestGithubActionRunCard = EntityCardBlueprint.makeWithOverrides({
|
|
|
21
21
|
factory(originalFactory, { config }) {
|
|
22
22
|
return originalFactory({
|
|
23
23
|
filter: isGithubActionsAvailable,
|
|
24
|
-
loader: async () => import('../components/Cards/index.esm.js').then((m) => /* @__PURE__ */
|
|
24
|
+
loader: async () => import('../components/Cards/index.esm.js').then((m) => /* @__PURE__ */ jsx(m.LatestWorkflowRunCard, { ...config.props }))
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
});
|
|
@@ -37,7 +37,7 @@ const entityLatestGithubActionsForBranchCard = EntityCardBlueprint.makeWithOverr
|
|
|
37
37
|
factory(originalFactory, { config }) {
|
|
38
38
|
return originalFactory({
|
|
39
39
|
filter: isGithubActionsAvailable,
|
|
40
|
-
loader: async () => import('../components/Cards/index.esm.js').then((m) => /* @__PURE__ */
|
|
40
|
+
loader: async () => import('../components/Cards/index.esm.js').then((m) => /* @__PURE__ */ jsx(m.LatestWorkflowsForBranchCard, { ...config.props }))
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
});
|
|
@@ -55,7 +55,7 @@ const entityRecentGithubActionsRunsCard = EntityCardBlueprint.makeWithOverrides(
|
|
|
55
55
|
factory(originalFactory, { config }) {
|
|
56
56
|
return originalFactory({
|
|
57
57
|
filter: isGithubActionsAvailable,
|
|
58
|
-
loader: async () => import('../components/Cards/index.esm.js').then((m) => /* @__PURE__ */
|
|
58
|
+
loader: async () => import('../components/Cards/index.esm.js').then((m) => /* @__PURE__ */ jsx(m.RecentWorkflowRunsCard, { ...config.props }))
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entityCards.esm.js","sources":["../../src/alpha/entityCards.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport
|
|
1
|
+
{"version":3,"file":"entityCards.esm.js","sources":["../../src/alpha/entityCards.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';\nimport { isGithubActionsAvailable } from '../components/Router';\n\n/**\n * @alpha\n */\nexport const entityGithubActionsCard = EntityCardBlueprint.make({\n name: 'workflow-runs',\n params: {\n filter: isGithubActionsAvailable,\n loader: () =>\n import('../components/Router').then(m => <m.Router view=\"cards\" />),\n },\n});\n\n/**\n * @alpha\n */\nexport const entityLatestGithubActionRunCard =\n EntityCardBlueprint.makeWithOverrides({\n name: 'latest-workflow-run',\n config: {\n schema: {\n props: z =>\n z\n .object({\n branch: z.string().default('master'),\n })\n .default({}),\n },\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n filter: isGithubActionsAvailable,\n loader: async () =>\n import('../components/Cards').then(m => (\n <m.LatestWorkflowRunCard {...config.props} />\n )),\n });\n },\n });\n\n/**\n * @alpha\n */\nexport const entityLatestGithubActionsForBranchCard =\n EntityCardBlueprint.makeWithOverrides({\n name: 'latest-branch-workflow-runs',\n config: {\n schema: {\n props: z =>\n z\n .object({\n branch: z.string().default('master'),\n })\n .default({}),\n },\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n filter: isGithubActionsAvailable,\n loader: async () =>\n import('../components/Cards').then(m => (\n <m.LatestWorkflowsForBranchCard {...config.props} />\n )),\n });\n },\n });\n\n/**\n * @alpha\n */\nexport const entityRecentGithubActionsRunsCard =\n EntityCardBlueprint.makeWithOverrides({\n name: 'recent-workflow-runs',\n config: {\n schema: {\n props: z =>\n z\n .object({\n branch: z.string().default('master'),\n dense: z.boolean().default(false),\n limit: z.number().default(5).optional(),\n })\n .default({}),\n },\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n filter: isGithubActionsAvailable,\n loader: async () =>\n import('../components/Cards').then(m => (\n <m.RecentWorkflowRunsCard {...config.props} />\n )),\n });\n },\n });\n"],"names":[],"mappings":";;;;AAqBa,MAAA,uBAAA,GAA0B,oBAAoB,IAAK,CAAA;AAAA,EAC9D,IAAM,EAAA,eAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,wBAAA;AAAA,IACR,MAAQ,EAAA,MACN,OAAO,6BAAsB,CAAE,CAAA,IAAA,CAAK,CAAK,CAAA,qBAAA,GAAA,CAAC,CAAE,CAAA,MAAA,EAAF,EAAS,IAAA,EAAK,SAAQ,CAAE;AAAA;AAExE,CAAC;AAKY,MAAA,+BAAA,GACX,oBAAoB,iBAAkB,CAAA;AAAA,EACpC,IAAM,EAAA,qBAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IAC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A;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,KAAA,EAAO,CACL,CAAA,KAAA,CAAA,CACG,MAAO,CAAA;AAAA,QACN,MAAQ,EAAA,CAAA,CAAE,MAAO,EAAA,CAAE,QAAQ,QAAQ,CAAA;AAAA,QACnC,KAAO,EAAA,CAAA,CAAE,OAAQ,EAAA,CAAE,QAAQ,KAAK,CAAA;AAAA,QAChC,OAAO,CAAE,CAAA,MAAA,GAAS,OAAQ,CAAA,CAAC,EAAE,QAAS;AAAA,OACvC,CAAA,CACA,OAAQ,CAAA,EAAE;AAAA;AACjB,GACF;AAAA,EACA,OAAQ,CAAA,eAAA,EAAiB,EAAE,MAAA,EAAU,EAAA;AACnC,IAAA,OAAO,eAAgB,CAAA;AAAA,MACrB,MAAQ,EAAA,wBAAA;AAAA,MACR,MAAQ,EAAA,YACN,OAAO,kCAAqB,EAAE,IAAK,CAAA,CAAA,CAAA,qBAChC,GAAA,CAAA,CAAA,CAAE,sBAAF,EAAA,EAA0B,GAAG,MAAA,CAAO,OAAO,CAC7C;AAAA,KACJ,CAAA;AAAA;AAEL,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { convertLegacyRouteRef } from '@backstage/core-compat-api';
|
|
3
3
|
import { EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
4
4
|
import { isGithubActionsAvailable } from '../components/Router.esm.js';
|
|
@@ -11,7 +11,7 @@ const entityGithubActionsContent = EntityContentBlueprint.make({
|
|
|
11
11
|
defaultTitle: "GitHub Actions",
|
|
12
12
|
filter: isGithubActionsAvailable,
|
|
13
13
|
routeRef: convertLegacyRouteRef(rootRouteRef),
|
|
14
|
-
loader: () => import('../components/Router.esm.js').then((m) => /* @__PURE__ */
|
|
14
|
+
loader: () => import('../components/Router.esm.js').then((m) => /* @__PURE__ */ jsx(m.Router, { view: "table" }))
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entityContent.esm.js","sources":["../../src/alpha/entityContent.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport
|
|
1
|
+
{"version":3,"file":"entityContent.esm.js","sources":["../../src/alpha/entityContent.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { convertLegacyRouteRef } from '@backstage/core-compat-api';\nimport { EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';\nimport { isGithubActionsAvailable } from '../components/Router';\nimport { rootRouteRef } from '../routes';\n\n/**\n * @alpha\n */\nexport const entityGithubActionsContent = EntityContentBlueprint.make({\n name: 'entity',\n params: {\n defaultPath: 'github-actions',\n defaultTitle: 'GitHub Actions',\n filter: isGithubActionsAvailable,\n routeRef: convertLegacyRouteRef(rootRouteRef),\n loader: () =>\n import('../components/Router').then(m => <m.Router view=\"table\" />),\n },\n});\n"],"names":[],"mappings":";;;;;;AAuBa,MAAA,0BAAA,GAA6B,uBAAuB,IAAK,CAAA;AAAA,EACpE,IAAM,EAAA,QAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,WAAa,EAAA,gBAAA;AAAA,IACb,YAAc,EAAA,gBAAA;AAAA,IACd,MAAQ,EAAA,wBAAA;AAAA,IACR,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,IAC5C,MAAQ,EAAA,MACN,OAAO,6BAAsB,CAAE,CAAA,IAAA,CAAK,CAAK,CAAA,qBAAA,GAAA,CAAC,CAAE,CAAA,MAAA,EAAF,EAAS,IAAA,EAAK,SAAQ,CAAE;AAAA;AAExE,CAAC;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as _backstage_catalog_model_index from '@backstage/catalog-model/index';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import * as _backstage_plugin_catalog_react_alpha from '@backstage/plugin-catalog-react/alpha';
|
|
5
|
-
import * as
|
|
5
|
+
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
6
6
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -16,10 +16,10 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
16
16
|
name: undefined;
|
|
17
17
|
config: {};
|
|
18
18
|
configInput: {};
|
|
19
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
19
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_core_plugin_api.AnyApiFactory, "core.api.factory", {}>;
|
|
20
20
|
inputs: {};
|
|
21
21
|
params: {
|
|
22
|
-
factory:
|
|
22
|
+
factory: _backstage_core_plugin_api.AnyApiFactory;
|
|
23
23
|
};
|
|
24
24
|
}>;
|
|
25
25
|
"entity-card:github-actions/latest-branch-workflow-runs": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
@@ -194,7 +194,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
194
194
|
loader: () => Promise<JSX.Element>;
|
|
195
195
|
defaultPath: string;
|
|
196
196
|
defaultTitle: string;
|
|
197
|
-
defaultGroup?: (string & {}) | "development" | "deployment" | "documentation" | "observability" | undefined;
|
|
197
|
+
defaultGroup?: (string & {}) | "development" | "deployment" | "overview" | "documentation" | "operation" | "observability" | undefined;
|
|
198
198
|
routeRef?: _backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams> | undefined;
|
|
199
199
|
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | ((entity: _backstage_catalog_model_index.Entity) => boolean) | undefined;
|
|
200
200
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
2
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
2
3
|
import LinearProgress from '@material-ui/core/LinearProgress';
|
|
3
4
|
import Typography from '@material-ui/core/Typography';
|
|
4
5
|
import { makeStyles } from '@material-ui/core/styles';
|
|
5
6
|
import ExternalLinkIcon from '@material-ui/icons/Launch';
|
|
6
|
-
import
|
|
7
|
+
import { useEffect } from 'react';
|
|
7
8
|
import { GITHUB_ACTIONS_ANNOTATION } from '../getProjectNameFromEntity.esm.js';
|
|
8
9
|
import { useWorkflowRuns } from '../useWorkflowRuns.esm.js';
|
|
9
10
|
import { WorkflowRunsTable } from '../WorkflowRunsTable/WorkflowRunsTable.esm.js';
|
|
@@ -22,21 +23,29 @@ const useStyles = makeStyles({
|
|
|
22
23
|
const WidgetContent = (props) => {
|
|
23
24
|
const { error, loading, lastRun, branch } = props;
|
|
24
25
|
const classes = useStyles();
|
|
25
|
-
if (error) return /* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
if (error) return /* @__PURE__ */ jsxs(Typography, { children: [
|
|
27
|
+
"Couldn't fetch latest ",
|
|
28
|
+
branch,
|
|
29
|
+
" run"
|
|
30
|
+
] });
|
|
31
|
+
if (loading) return /* @__PURE__ */ jsx(LinearProgress, {});
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
28
33
|
StructuredMetadataTable,
|
|
29
34
|
{
|
|
30
35
|
metadata: {
|
|
31
|
-
status: /* @__PURE__ */
|
|
36
|
+
status: /* @__PURE__ */ jsx(Box, { display: "flex", children: /* @__PURE__ */ jsx(
|
|
32
37
|
WorkflowRunStatus,
|
|
33
38
|
{
|
|
34
39
|
status: lastRun.status,
|
|
35
40
|
conclusion: lastRun.conclusion
|
|
36
41
|
}
|
|
37
|
-
)),
|
|
42
|
+
) }),
|
|
38
43
|
message: lastRun.message,
|
|
39
|
-
url: /* @__PURE__ */
|
|
44
|
+
url: /* @__PURE__ */ jsxs(Link, { to: lastRun.githubUrl ?? "", children: [
|
|
45
|
+
"See more on GitHub",
|
|
46
|
+
" ",
|
|
47
|
+
/* @__PURE__ */ jsx(ExternalLinkIcon, { className: classes.externalLinkIcon })
|
|
48
|
+
] })
|
|
40
49
|
}
|
|
41
50
|
}
|
|
42
51
|
);
|
|
@@ -59,7 +68,7 @@ const LatestWorkflowRunCard = (props) => {
|
|
|
59
68
|
errorApi.post(error);
|
|
60
69
|
}
|
|
61
70
|
}, [error, errorApi]);
|
|
62
|
-
return /* @__PURE__ */
|
|
71
|
+
return /* @__PURE__ */ jsx(InfoCard, { title: `Last ${branch} build`, variant, children: /* @__PURE__ */ jsx(
|
|
63
72
|
WidgetContent,
|
|
64
73
|
{
|
|
65
74
|
error,
|
|
@@ -67,12 +76,12 @@ const LatestWorkflowRunCard = (props) => {
|
|
|
67
76
|
branch,
|
|
68
77
|
lastRun
|
|
69
78
|
}
|
|
70
|
-
));
|
|
79
|
+
) });
|
|
71
80
|
};
|
|
72
81
|
const LatestWorkflowsForBranchCard = (props) => {
|
|
73
82
|
const { branch = "master", variant } = props;
|
|
74
83
|
const { entity } = useEntity();
|
|
75
|
-
return /* @__PURE__ */
|
|
84
|
+
return /* @__PURE__ */ jsx(InfoCard, { title: `Last ${branch} build`, variant, children: /* @__PURE__ */ jsx(WorkflowRunsTable, { branch, entity }) });
|
|
76
85
|
};
|
|
77
86
|
|
|
78
87
|
export { LatestWorkflowRunCard, LatestWorkflowsForBranchCard };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cards.esm.js","sources":["../../../src/components/Cards/Cards.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ExternalLinkIcon from '@material-ui/icons/Launch';\nimport
|
|
1
|
+
{"version":3,"file":"Cards.esm.js","sources":["../../../src/components/Cards/Cards.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ExternalLinkIcon from '@material-ui/icons/Launch';\nimport { useEffect } from 'react';\nimport { GITHUB_ACTIONS_ANNOTATION } from '../getProjectNameFromEntity';\nimport { useWorkflowRuns, WorkflowRun } from '../useWorkflowRuns';\nimport { WorkflowRunsTable } from '../WorkflowRunsTable';\nimport { WorkflowRunStatus } from '../WorkflowRunStatus';\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport {\n InfoCard,\n InfoCardVariants,\n Link,\n StructuredMetadataTable,\n} from '@backstage/core-components';\nimport { getHostnameFromEntity } from '../getHostnameFromEntity';\nimport Box from '@material-ui/core/Box';\n\nconst useStyles = makeStyles({\n externalLinkIcon: {\n fontSize: 'inherit',\n verticalAlign: 'bottom',\n },\n});\n\nconst WidgetContent = (props: {\n error?: Error;\n loading?: boolean;\n lastRun: WorkflowRun;\n branch: string;\n}) => {\n const { error, loading, lastRun, branch } = props;\n const classes = useStyles();\n\n if (error) return <Typography>Couldn't fetch latest {branch} run</Typography>;\n if (loading) return <LinearProgress />;\n\n return (\n <StructuredMetadataTable\n metadata={{\n status: (\n <Box display=\"flex\">\n <WorkflowRunStatus\n status={lastRun.status}\n conclusion={lastRun.conclusion}\n />\n </Box>\n ),\n message: lastRun.message,\n url: (\n <Link to={lastRun.githubUrl ?? ''}>\n See more on GitHub{' '}\n <ExternalLinkIcon className={classes.externalLinkIcon} />\n </Link>\n ),\n }}\n />\n );\n};\n\n/** @public */\nexport const LatestWorkflowRunCard = (props: {\n branch?: string;\n variant?: InfoCardVariants;\n}) => {\n const { branch = 'master', variant } = props;\n const { entity } = useEntity();\n const errorApi = useApi(errorApiRef);\n const hostname = getHostnameFromEntity(entity);\n const [owner, repo] = (\n entity?.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION] ?? '/'\n ).split('/');\n const [{ runs, loading, error }] = useWorkflowRuns({\n hostname,\n owner,\n repo,\n branch,\n });\n const lastRun = runs?.[0] ?? ({} as WorkflowRun);\n useEffect(() => {\n if (error) {\n errorApi.post(error);\n }\n }, [error, errorApi]);\n\n return (\n <InfoCard title={`Last ${branch} build`} variant={variant}>\n <WidgetContent\n error={error}\n loading={loading}\n branch={branch}\n lastRun={lastRun}\n />\n </InfoCard>\n );\n};\n\n/** @public */\nexport const LatestWorkflowsForBranchCard = (props: {\n branch?: string;\n variant?: InfoCardVariants;\n}) => {\n const { branch = 'master', variant } = props;\n const { entity } = useEntity();\n\n return (\n <InfoCard title={`Last ${branch} build`} variant={variant}>\n <WorkflowRunsTable branch={branch} entity={entity} />\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAoCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,gBAAkB,EAAA;AAAA,IAChB,QAAU,EAAA,SAAA;AAAA,IACV,aAAe,EAAA;AAAA;AAEnB,CAAC,CAAA;AAED,MAAM,aAAA,GAAgB,CAAC,KAKjB,KAAA;AACJ,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,OAAA,EAAS,QAAW,GAAA,KAAA;AAC5C,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EAAI,IAAA,KAAA,EAAc,uBAAA,IAAA,CAAC,UAAW,EAAA,EAAA,QAAA,EAAA;AAAA,IAAA,wBAAA;AAAA,IAAuB,MAAA;AAAA,IAAO;AAAA,GAAI,EAAA,CAAA;AAChE,EAAI,IAAA,OAAA,EAAgB,uBAAA,GAAA,CAAC,cAAe,EAAA,EAAA,CAAA;AAEpC,EACE,uBAAA,GAAA;AAAA,IAAC,uBAAA;AAAA,IAAA;AAAA,MACC,QAAU,EAAA;AAAA,QACR,MACE,kBAAA,GAAA,CAAC,GAAI,EAAA,EAAA,OAAA,EAAQ,MACX,EAAA,QAAA,kBAAA,GAAA;AAAA,UAAC,iBAAA;AAAA,UAAA;AAAA,YACC,QAAQ,OAAQ,CAAA,MAAA;AAAA,YAChB,YAAY,OAAQ,CAAA;AAAA;AAAA,SAExB,EAAA,CAAA;AAAA,QAEF,SAAS,OAAQ,CAAA,OAAA;AAAA,QACjB,qBACG,IAAA,CAAA,IAAA,EAAA,EAAK,EAAI,EAAA,OAAA,CAAQ,aAAa,EAAI,EA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,CAAA;AAEJ;AAGa,MAAA,4BAAA,GAA+B,CAAC,KAGvC,KAAA;AACJ,EAAA,MAAM,EAAE,MAAA,GAAS,QAAU,EAAA,OAAA,EAAY,GAAA,KAAA;AACvC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAE7B,EACE,uBAAA,GAAA,CAAC,QAAS,EAAA,EAAA,KAAA,EAAO,CAAQ,KAAA,EAAA,MAAM,CAAU,MAAA,CAAA,EAAA,OAAA,EACvC,QAAC,kBAAA,GAAA,CAAA,iBAAA,EAAA,EAAkB,MAAgB,EAAA,MAAA,EAAgB,CACrD,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
2
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
2
|
-
import
|
|
3
|
+
import { useEffect } from 'react';
|
|
3
4
|
import { Link as Link$1 } from 'react-router-dom';
|
|
4
5
|
import { GITHUB_ACTIONS_ANNOTATION } from '../getProjectNameFromEntity.esm.js';
|
|
5
6
|
import { useWorkflowRuns } from '../useWorkflowRuns.esm.js';
|
|
@@ -33,42 +34,45 @@ const RecentWorkflowRunsCard = (props) => {
|
|
|
33
34
|
const githubHost = hostname || "github.com";
|
|
34
35
|
const routeLink = useRouteRef(buildRouteRef);
|
|
35
36
|
if (error) {
|
|
36
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ jsx(ErrorPanel, { title: error.message, error });
|
|
37
38
|
}
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
39
40
|
InfoCard,
|
|
40
41
|
{
|
|
41
42
|
title: "Recent Workflow Runs",
|
|
42
43
|
subheader: branch ? `Branch: ${branch}` : "All Branches",
|
|
43
44
|
noPadding: true,
|
|
44
|
-
variant
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
title: "Commit Message",
|
|
59
|
-
field: "message",
|
|
60
|
-
render: (data) => /* @__PURE__ */ React.createElement(Link, { component: Link$1, to: routeLink({ id: data.id }) }, firstLine(data.message ?? ""))
|
|
45
|
+
variant,
|
|
46
|
+
children: !runs.length ? /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
47
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: "This component has GitHub Actions enabled, but no workflows were found." }),
|
|
48
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: /* @__PURE__ */ jsx(Link, { to: `https://${githubHost}/${owner}/${repo}/actions/new`, children: "Create a new workflow" }) })
|
|
49
|
+
] }) : /* @__PURE__ */ jsx(
|
|
50
|
+
Table,
|
|
51
|
+
{
|
|
52
|
+
isLoading: loading,
|
|
53
|
+
options: {
|
|
54
|
+
search: false,
|
|
55
|
+
paging: false,
|
|
56
|
+
padding: dense ? "dense" : "default",
|
|
57
|
+
toolbar: false
|
|
61
58
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
59
|
+
columns: [
|
|
60
|
+
{
|
|
61
|
+
title: "Commit Message",
|
|
62
|
+
field: "message",
|
|
63
|
+
render: (data) => /* @__PURE__ */ jsx(Link, { component: Link$1, to: routeLink({ id: data.id }), children: firstLine(data.message ?? "") })
|
|
64
|
+
},
|
|
65
|
+
{ title: "Branch", field: "source.branchName" },
|
|
66
|
+
{
|
|
67
|
+
title: "Status",
|
|
68
|
+
field: "status",
|
|
69
|
+
render: (p) => /* @__PURE__ */ jsx(Box, { display: "flex", children: /* @__PURE__ */ jsx(WorkflowRunStatus, { ...p }) })
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
data: runs
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
}
|
|
72
76
|
);
|
|
73
77
|
};
|
|
74
78
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecentWorkflowRunsCard.esm.js","sources":["../../../src/components/Cards/RecentWorkflowRunsCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport
|
|
1
|
+
{"version":3,"file":"RecentWorkflowRunsCard.esm.js","sources":["../../../src/components/Cards/RecentWorkflowRunsCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { useEffect } from 'react';\nimport { Link as RouterLink } from 'react-router-dom';\nimport { GITHUB_ACTIONS_ANNOTATION } from '../getProjectNameFromEntity';\nimport { useWorkflowRuns, WorkflowRun } from '../useWorkflowRuns';\nimport { WorkflowRunStatus } from '../WorkflowRunStatus';\nimport Typography from '@material-ui/core/Typography';\n\nimport { errorApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n ErrorPanel,\n InfoCard,\n InfoCardVariants,\n Link,\n Table,\n} from '@backstage/core-components';\nimport { buildRouteRef } from '../../routes';\nimport { getHostnameFromEntity } from '../getHostnameFromEntity';\nimport Box from '@material-ui/core/Box';\n\nconst firstLine = (message: string): string => message.split('\\n')[0];\n\n/** @public */\nexport const RecentWorkflowRunsCard = (props: {\n branch?: string;\n dense?: boolean;\n limit?: number;\n variant?: InfoCardVariants;\n}) => {\n const { branch, dense = false, limit = 5, variant } = props;\n\n const { entity } = useEntity();\n const errorApi = useApi(errorApiRef);\n\n const hostname = getHostnameFromEntity(entity);\n\n const [owner, repo] = (\n entity?.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION] ?? '/'\n ).split('/');\n\n const [{ runs = [], loading, error }] = useWorkflowRuns({\n hostname,\n owner,\n repo,\n branch,\n initialPageSize: limit,\n });\n\n useEffect(() => {\n if (error) {\n errorApi.post(error);\n }\n }, [error, errorApi]);\n\n const githubHost = hostname || 'github.com';\n const routeLink = useRouteRef(buildRouteRef);\n\n if (error) {\n return <ErrorPanel title={error.message} error={error} />;\n }\n\n return (\n <InfoCard\n title=\"Recent Workflow Runs\"\n subheader={branch ? `Branch: ${branch}` : 'All Branches'}\n noPadding\n variant={variant}\n >\n {!runs.length ? (\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n This component has GitHub Actions enabled, but no workflows were\n found.\n </Typography>\n <Typography variant=\"body2\">\n <Link to={`https://${githubHost}/${owner}/${repo}/actions/new`}>\n Create a new workflow\n </Link>\n </Typography>\n </div>\n ) : (\n <Table<WorkflowRun>\n isLoading={loading}\n options={{\n search: false,\n paging: false,\n padding: dense ? 'dense' : 'default',\n toolbar: false,\n }}\n columns={[\n {\n title: 'Commit Message',\n field: 'message',\n render: data => (\n <Link component={RouterLink} to={routeLink({ id: data.id! })}>\n {firstLine(data.message ?? '')}\n </Link>\n ),\n },\n { title: 'Branch', field: 'source.branchName' },\n {\n title: 'Status',\n field: 'status',\n render: p => (\n <Box display=\"flex\">\n <Wor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J;AAAA,YACA,EAAE,KAAA,EAAO,QAAU,EAAA,KAAA,EAAO,mBAAoB,EAAA;AAAA,YAC9C;AAAA,cACE,KAAO,EAAA,QAAA;AAAA,cACP,KAAO,EAAA,QAAA;AAAA,cACP,MAAA,EAAQ,CACN,CAAA,qBAAA,GAAA,CAAC,GAAI,EAAA,EAAA,OAAA,EAAQ,QACX,QAAC,kBAAA,GAAA,CAAA,iBAAA,EAAA,EAAmB,GAAG,CAAA,EAAG,CAC5B,EAAA;AAAA;AAEJ,WACF;AAAA,UACA,IAAM,EAAA;AAAA;AAAA;AACR;AAAA,GAEJ;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
|
|
3
3
|
import { Routes, Route } from 'react-router-dom';
|
|
4
4
|
import { buildRouteRef } from '../routes.esm.js';
|
|
@@ -12,16 +12,19 @@ const Router = (props) => {
|
|
|
12
12
|
const { view = "table" } = props;
|
|
13
13
|
const { entity } = useEntity();
|
|
14
14
|
if (!isGithubActionsAvailable(entity)) {
|
|
15
|
-
return /* @__PURE__ */
|
|
15
|
+
return /* @__PURE__ */ jsx(MissingAnnotationEmptyState, { annotation: GITHUB_ACTIONS_ANNOTATION });
|
|
16
16
|
}
|
|
17
|
-
const workflowRunsComponent = view === "cards" ? /* @__PURE__ */
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
Route,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
const workflowRunsComponent = view === "cards" ? /* @__PURE__ */ jsx(WorkflowRunsCard, { entity }) : /* @__PURE__ */ jsx(WorkflowRunsTable, { entity });
|
|
18
|
+
return /* @__PURE__ */ jsxs(Routes, { children: [
|
|
19
|
+
/* @__PURE__ */ jsx(Route, { path: "/", element: workflowRunsComponent }),
|
|
20
|
+
/* @__PURE__ */ jsx(
|
|
21
|
+
Route,
|
|
22
|
+
{
|
|
23
|
+
path: `${buildRouteRef.path}`,
|
|
24
|
+
element: /* @__PURE__ */ jsx(WorkflowRunDetails, { entity })
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
] });
|
|
25
28
|
};
|
|
26
29
|
|
|
27
30
|
export { Router, isGithubActionsAvailable };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.esm.js","sources":["../../src/components/Router.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"Router.esm.js","sources":["../../src/components/Router.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport { Routes, Route } from 'react-router-dom';\nimport { buildRouteRef } from '../routes';\nimport { WorkflowRunDetails } from './WorkflowRunDetails';\nimport { WorkflowRunsCard } from './WorkflowRunsCard';\nimport { WorkflowRunsTable } from './WorkflowRunsTable';\nimport { GITHUB_ACTIONS_ANNOTATION } from './getProjectNameFromEntity';\nimport { RouterProps } from '../api/types';\n\n/** @public */\nexport const isGithubActionsAvailable = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION]);\n\n/** @public */\nexport const Router = (props: RouterProps) => {\n const { view = 'table' } = props;\n const { entity } = useEntity();\n\n if (!isGithubActionsAvailable(entity)) {\n return (\n <MissingAnnotationEmptyState annotation={GITHUB_ACTIONS_ANNOTATION} />\n );\n }\n\n const workflowRunsComponent =\n view === 'cards' ? (\n <WorkflowRunsCard entity={entity} />\n ) : (\n <WorkflowRunsTable entity={entity} />\n );\n\n return (\n <Routes>\n <Route path=\"/\" element={workflowRunsComponent} />\n <Route\n path={`${buildRouteRef.path}`}\n element={<WorkflowRunDetails entity={entity} />}\n />\n </Routes>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA8Ba,MAAA,wBAAA,GAA2B,CAAC,MACvC,KAAA,OAAA,CAAQ,OAAO,QAAS,CAAA,WAAA,GAAc,yBAAyB,CAAC;AAGrD,MAAA,MAAA,GAAS,CAAC,KAAuB,KAAA;AAC5C,EAAM,MAAA,EAAE,IAAO,GAAA,OAAA,EAAY,GAAA,KAAA;AAC3B,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAE7B,EAAI,IAAA,CAAC,wBAAyB,CAAA,MAAM,CAAG,EAAA;AACrC,IACE,uBAAA,GAAA,CAAC,2BAA4B,EAAA,EAAA,UAAA,EAAY,yBAA2B,EAAA,CAAA;AAAA;AAIxE,EAAM,MAAA,qBAAA,GACJ,SAAS,OACP,mBAAA,GAAA,CAAC,oBAAiB,MAAgB,EAAA,CAAA,mBAEjC,GAAA,CAAA,iBAAA,EAAA,EAAkB,MAAgB,EAAA,CAAA;AAGvC,EAAA,4BACG,MACC,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAK,GAAI,EAAA,OAAA,EAAS,qBAAuB,EAAA,CAAA;AAAA,oBAChD,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAM,CAAG,EAAA,aAAA,CAAc,IAAI,CAAA,CAAA;AAAA,QAC3B,OAAA,kBAAU,GAAA,CAAA,kBAAA,EAAA,EAAmB,MAAgB,EAAA;AAAA;AAAA;AAC/C,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import Accordion from '@material-ui/core/Accordion';
|
|
2
3
|
import AccordionDetails from '@material-ui/core/AccordionDetails';
|
|
3
4
|
import AccordionSummary from '@material-ui/core/AccordionSummary';
|
|
@@ -16,7 +17,6 @@ import { makeStyles } from '@material-ui/core/styles';
|
|
|
16
17
|
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
|
17
18
|
import ExternalLinkIcon from '@material-ui/icons/Launch';
|
|
18
19
|
import { DateTime } from 'luxon';
|
|
19
|
-
import React from 'react';
|
|
20
20
|
import { getProjectNameFromEntity } from '../getProjectNameFromEntity.esm.js';
|
|
21
21
|
import { WorkflowRunStatus } from '../WorkflowRunStatus/WorkflowRunStatus.esm.js';
|
|
22
22
|
import { useWorkflowRunJobs } from './useWorkflowRunJobs.esm.js';
|
|
@@ -60,19 +60,22 @@ const getElapsedTime = (start, end) => {
|
|
|
60
60
|
return timeElapsed;
|
|
61
61
|
};
|
|
62
62
|
const StepView = ({ step }) => {
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
return /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
64
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(
|
|
65
|
+
ListItemText,
|
|
66
|
+
{
|
|
67
|
+
primary: step.name,
|
|
68
|
+
secondary: getElapsedTime(step.started_at, step.completed_at)
|
|
69
|
+
}
|
|
70
|
+
) }),
|
|
71
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(
|
|
72
|
+
WorkflowRunStatus,
|
|
73
|
+
{
|
|
74
|
+
status: step.status.toLocaleUpperCase("en-US"),
|
|
75
|
+
conclusion: step.conclusion?.toLocaleUpperCase("en-US")
|
|
76
|
+
}
|
|
77
|
+
) })
|
|
78
|
+
] });
|
|
76
79
|
};
|
|
77
80
|
const JobListItem = ({
|
|
78
81
|
job,
|
|
@@ -80,28 +83,37 @@ const JobListItem = ({
|
|
|
80
83
|
entity
|
|
81
84
|
}) => {
|
|
82
85
|
const classes = useStyles();
|
|
83
|
-
return /* @__PURE__ */
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
return /* @__PURE__ */ jsxs(Accordion, { TransitionProps: { unmountOnExit: true }, className, children: [
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
AccordionSummary,
|
|
89
|
+
{
|
|
90
|
+
expandIcon: /* @__PURE__ */ jsx(ExpandMoreIcon, {}),
|
|
91
|
+
IconButtonProps: {
|
|
92
|
+
className: classes.button
|
|
93
|
+
},
|
|
94
|
+
children: /* @__PURE__ */ jsxs(Typography, { variant: "button", children: [
|
|
95
|
+
job.name,
|
|
96
|
+
" (",
|
|
97
|
+
getElapsedTime(job.started_at, job.completed_at),
|
|
98
|
+
")"
|
|
99
|
+
] })
|
|
89
100
|
}
|
|
90
|
-
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ jsx(AccordionDetails, { className: classes.accordionDetails, children: /* @__PURE__ */ jsx(TableContainer, { children: /* @__PURE__ */ jsx(Table, { children: job.steps?.map((step) => /* @__PURE__ */ jsx(StepView, { step }, step.number)) }) }) }),
|
|
103
|
+
job.status === "queued" || job.status === "in_progress" ? /* @__PURE__ */ jsx(WorkflowRunLogs, { runId: job.id, inProgress: true, entity }) : /* @__PURE__ */ jsx(WorkflowRunLogs, { runId: job.id, inProgress: false, entity })
|
|
104
|
+
] });
|
|
93
105
|
};
|
|
94
106
|
const JobsList = ({ jobs, entity }) => {
|
|
95
107
|
const classes = useStyles();
|
|
96
|
-
return /* @__PURE__ */
|
|
108
|
+
return /* @__PURE__ */ jsx(Box, { children: jobs && jobs.total_count > 0 && jobs.jobs.map((job) => /* @__PURE__ */ jsx(
|
|
97
109
|
JobListItem,
|
|
98
110
|
{
|
|
99
|
-
key: job.id,
|
|
100
111
|
job,
|
|
101
112
|
className: job.status !== "success" ? classes.failed : classes.success,
|
|
102
113
|
entity
|
|
103
|
-
}
|
|
104
|
-
|
|
114
|
+
},
|
|
115
|
+
job.id
|
|
116
|
+
)) });
|
|
105
117
|
};
|
|
106
118
|
const WorkflowRunDetails = ({ entity }) => {
|
|
107
119
|
const projectName = getProjectNameFromEntity(entity);
|
|
@@ -111,17 +123,63 @@ const WorkflowRunDetails = ({ entity }) => {
|
|
|
111
123
|
const jobs = useWorkflowRunJobs({ hostname, owner, repo });
|
|
112
124
|
const classes = useStyles();
|
|
113
125
|
if (details.error && details.error.message) {
|
|
114
|
-
return /* @__PURE__ */
|
|
126
|
+
return /* @__PURE__ */ jsxs(Typography, { variant: "h6", color: "error", children: [
|
|
127
|
+
"Failed to load build, ",
|
|
128
|
+
details.error.message
|
|
129
|
+
] });
|
|
115
130
|
} else if (details.loading) {
|
|
116
|
-
return /* @__PURE__ */
|
|
131
|
+
return /* @__PURE__ */ jsx(LinearProgress, {});
|
|
117
132
|
}
|
|
118
|
-
return /* @__PURE__ */
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
133
|
+
return /* @__PURE__ */ jsxs("div", { className: classes.root, children: [
|
|
134
|
+
/* @__PURE__ */ jsx(Box, { mb: 3, children: /* @__PURE__ */ jsxs(Breadcrumbs, { "aria-label": "breadcrumb", children: [
|
|
135
|
+
/* @__PURE__ */ jsx(Link, { to: "..", children: "Workflow runs" }),
|
|
136
|
+
/* @__PURE__ */ jsx(Typography, { children: "Workflow run details" })
|
|
137
|
+
] }) }),
|
|
138
|
+
/* @__PURE__ */ jsx(TableContainer, { component: Paper, className: classes.table, children: /* @__PURE__ */ jsx(Table, { children: /* @__PURE__ */ jsxs(TableBody, { children: [
|
|
139
|
+
/* @__PURE__ */ jsxs(TableRow, { children: [
|
|
140
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Typography, { noWrap: true, children: "Branch" }) }),
|
|
141
|
+
/* @__PURE__ */ jsx(TableCell, { children: details.value?.head_branch })
|
|
142
|
+
] }),
|
|
143
|
+
/* @__PURE__ */ jsxs(TableRow, { children: [
|
|
144
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Typography, { noWrap: true, children: "Message" }) }),
|
|
145
|
+
/* @__PURE__ */ jsx(TableCell, { children: details.value?.head_commit?.message })
|
|
146
|
+
] }),
|
|
147
|
+
/* @__PURE__ */ jsxs(TableRow, { children: [
|
|
148
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Typography, { noWrap: true, children: "Commit ID" }) }),
|
|
149
|
+
/* @__PURE__ */ jsx(TableCell, { children: details.value?.head_commit?.id })
|
|
150
|
+
] }),
|
|
151
|
+
/* @__PURE__ */ jsxs(TableRow, { children: [
|
|
152
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Typography, { noWrap: true, children: "Workflow" }) }),
|
|
153
|
+
/* @__PURE__ */ jsx(TableCell, { children: details.value?.name })
|
|
154
|
+
] }),
|
|
155
|
+
/* @__PURE__ */ jsxs(TableRow, { children: [
|
|
156
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Typography, { noWrap: true, children: "Status" }) }),
|
|
157
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(
|
|
158
|
+
WorkflowRunStatus,
|
|
159
|
+
{
|
|
160
|
+
status: details.value?.status || void 0,
|
|
161
|
+
conclusion: details.value?.conclusion || void 0
|
|
162
|
+
}
|
|
163
|
+
) })
|
|
164
|
+
] }),
|
|
165
|
+
/* @__PURE__ */ jsxs(TableRow, { children: [
|
|
166
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Typography, { noWrap: true, children: "Author" }) }),
|
|
167
|
+
/* @__PURE__ */ jsx(TableCell, { children: `${details.value?.head_commit?.author?.name} (${details.value?.head_commit?.author?.email})` })
|
|
168
|
+
] }),
|
|
169
|
+
/* @__PURE__ */ jsxs(TableRow, { children: [
|
|
170
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Typography, { noWrap: true, children: "Links" }) }),
|
|
171
|
+
/* @__PURE__ */ jsx(TableCell, { children: details.value?.html_url && /* @__PURE__ */ jsxs(Link, { to: details.value.html_url, children: [
|
|
172
|
+
"Workflow runs on GitHub",
|
|
173
|
+
" ",
|
|
174
|
+
/* @__PURE__ */ jsx(ExternalLinkIcon, { className: classes.externalLinkIcon })
|
|
175
|
+
] }) })
|
|
176
|
+
] }),
|
|
177
|
+
/* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsxs(TableCell, { colSpan: 2, children: [
|
|
178
|
+
/* @__PURE__ */ jsx(Typography, { noWrap: true, children: "Jobs" }),
|
|
179
|
+
jobs.loading ? /* @__PURE__ */ jsx(CircularProgress, {}) : /* @__PURE__ */ jsx(JobsList, { jobs: jobs.value, entity })
|
|
180
|
+
] }) })
|
|
181
|
+
] }) }) })
|
|
182
|
+
] });
|
|
125
183
|
};
|
|
126
184
|
|
|
127
185
|
export { WorkflowRunDetails };
|