@backstage-community/plugin-github-actions 0.6.27 → 0.7.1
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 +12 -0
- package/dist/alpha/apis.esm.js.map +1 -1
- package/dist/alpha/entityCards.esm.js.map +1 -1
- package/dist/alpha/entityContent.esm.js.map +1 -1
- package/dist/alpha.d.ts +14 -14
- package/dist/alpha.esm.js.map +1 -1
- package/dist/api/GithubActionsApi.esm.js.map +1 -1
- package/dist/api/GithubActionsClient.esm.js.map +1 -1
- package/dist/api/types.esm.js.map +1 -1
- package/dist/components/Cards/Cards.esm.js.map +1 -1
- package/dist/components/Cards/RecentWorkflowRunsCard.esm.js.map +1 -1
- package/dist/components/Router.esm.js.map +1 -1
- package/dist/components/WorkflowRunDetails/WorkflowRunDetails.esm.js.map +1 -1
- package/dist/components/WorkflowRunDetails/useWorkflowRunJobs.esm.js.map +1 -1
- package/dist/components/WorkflowRunDetails/useWorkflowRunsDetails.esm.js.map +1 -1
- package/dist/components/WorkflowRunLogs/WorkflowRunLogs.esm.js.map +1 -1
- package/dist/components/WorkflowRunLogs/useDownloadWorkflowRunLogs.esm.js.map +1 -1
- package/dist/components/WorkflowRunStatus/WorkflowRunStatus.esm.js.map +1 -1
- package/dist/components/WorkflowRunsCard/WorkflowRunsCard.esm.js.map +1 -1
- package/dist/components/WorkflowRunsTable/WorkflowRunsTable.esm.js.map +1 -1
- package/dist/components/getHostnameFromEntity.esm.js.map +1 -1
- package/dist/components/getProjectNameFromEntity.esm.js.map +1 -1
- package/dist/components/useWorkflowRuns.esm.js.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/plugin.esm.js.map +1 -1
- package/dist/routes.esm.js.map +1 -1
- package/package.json +25 -16
- package/alpha/package.json +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @backstage-community/plugin-github-actions
|
|
2
2
|
|
|
3
|
+
## 0.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b11a62d: Backstage version bump to v1.35.0
|
|
8
|
+
|
|
9
|
+
## 0.7.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 73c104f: Backstage version bump to v1.34.1
|
|
14
|
+
|
|
3
15
|
## 0.6.27
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apis.esm.js","sources":["../../src/alpha/apis.ts"],"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 {\n configApiRef,\n ApiBlueprint,\n createApiFactory,\n} from '@backstage/frontend-plugin-api';\nimport { scmAuthApiRef } from '@backstage/integration-react';\nimport { githubActionsApiRef, GithubActionsClient } from '../api';\n\n/**\n * @alpha\n */\nexport const githubActionsApi = ApiBlueprint.make({\n params: {\n factory: createApiFactory({\n api: githubActionsApiRef,\n deps: { configApi: configApiRef, scmAuthApi: scmAuthApiRef },\n factory: ({ configApi, scmAuthApi }) =>\n new GithubActionsClient({ configApi, scmAuthApi }),\n }),\n },\n});\n"],"names":[],"mappings":";;;;;AA0Ba,MAAA,gBAAA,GAAmB,aAAa,IAAK,CAAA;AAAA,EAChD,MAAQ,EAAA;AAAA,IACN,SAAS,gBAAiB,CAAA;AAAA,MACxB,GAAK,EAAA,mBAAA;AAAA,MACL,IAAM,EAAA,EAAE,SAAW,EAAA,YAAA,EAAc,YAAY,aAAc,EAAA;AAAA,MAC3D,OAAA,EAAS,CAAC,EAAE,SAAW,EAAA,UAAA,EACrB,KAAA,IAAI,mBAAoB,CAAA,EAAE,SAAW,EAAA,UAAA,EAAY
|
|
1
|
+
{"version":3,"file":"apis.esm.js","sources":["../../src/alpha/apis.ts"],"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 {\n configApiRef,\n ApiBlueprint,\n createApiFactory,\n} from '@backstage/frontend-plugin-api';\nimport { scmAuthApiRef } from '@backstage/integration-react';\nimport { githubActionsApiRef, GithubActionsClient } from '../api';\n\n/**\n * @alpha\n */\nexport const githubActionsApi = ApiBlueprint.make({\n params: {\n factory: createApiFactory({\n api: githubActionsApiRef,\n deps: { configApi: configApiRef, scmAuthApi: scmAuthApiRef },\n factory: ({ configApi, scmAuthApi }) =>\n new GithubActionsClient({ configApi, scmAuthApi }),\n }),\n },\n});\n"],"names":[],"mappings":";;;;;AA0Ba,MAAA,gBAAA,GAAmB,aAAa,IAAK,CAAA;AAAA,EAChD,MAAQ,EAAA;AAAA,IACN,SAAS,gBAAiB,CAAA;AAAA,MACxB,GAAK,EAAA,mBAAA;AAAA,MACL,IAAM,EAAA,EAAE,SAAW,EAAA,YAAA,EAAc,YAAY,aAAc,EAAA;AAAA,MAC3D,OAAA,EAAS,CAAC,EAAE,SAAW,EAAA,UAAA,EACrB,KAAA,IAAI,mBAAoB,CAAA,EAAE,SAAW,EAAA,UAAA,EAAY;AAAA,KACpD;AAAA;AAEL,CAAC;;;;"}
|
|
@@ -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 React from 'react';\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":";;;;AAsBa,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,KAAA,CAAA,aAAA,CAAC,CAAE,CAAA,MAAA,EAAF,EAAS,IAAA,EAAK,SAAQ,CAAE
|
|
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 React from 'react';\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":";;;;AAsBa,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,KAAA,CAAA,aAAA,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,IACN,MA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C,IAAM,EAAA,sBAAA;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,KAAA,CAAA,aAAA,CAAA,CAAA,CAAE,sBAAF,EAAA,EAA0B,GAAG,MAAA,CAAO,OAAO,CAC7C;AAAA,KACJ,CAAA;AAAA;AAEL,CAAC;;;;"}
|
|
@@ -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 React from 'react';\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":";;;;;;AAwBa,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,KAAA,CAAA,aAAA,CAAC,CAAE,CAAA,MAAA,EAAF,EAAS,IAAA,EAAK,SAAQ,CAAE
|
|
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 React from 'react';\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":";;;;;;AAwBa,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,KAAA,CAAA,aAAA,CAAC,CAAE,CAAA,MAAA,EAAF,EAAS,IAAA,EAAK,SAAQ,CAAE;AAAA;AAExE,CAAC;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import * as
|
|
2
|
+
import * as _backstage_catalog_model_index from '@backstage/catalog-model/index';
|
|
3
3
|
import * as react from 'react';
|
|
4
|
-
import * as
|
|
4
|
+
import * as _backstage_core_plugin_api_index from '@backstage/core-plugin-api/index';
|
|
5
5
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -15,10 +15,10 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
15
15
|
name: undefined;
|
|
16
16
|
config: {};
|
|
17
17
|
configInput: {};
|
|
18
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
18
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_core_plugin_api_index.AnyApiFactory, "core.api.factory", {}>;
|
|
19
19
|
inputs: {};
|
|
20
20
|
params: {
|
|
21
|
-
factory:
|
|
21
|
+
factory: _backstage_core_plugin_api_index.AnyApiFactory;
|
|
22
22
|
};
|
|
23
23
|
}>;
|
|
24
24
|
"entity-card:github-actions/workflow-runs": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
@@ -30,7 +30,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
30
30
|
configInput: {
|
|
31
31
|
filter?: string | undefined;
|
|
32
32
|
};
|
|
33
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity:
|
|
33
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model_index.Entity) => boolean, "catalog.entity-filter-function", {
|
|
34
34
|
optional: true;
|
|
35
35
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
36
36
|
optional: true;
|
|
@@ -38,7 +38,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
38
38
|
inputs: {};
|
|
39
39
|
params: {
|
|
40
40
|
loader: () => Promise<JSX.Element>;
|
|
41
|
-
filter?: string | ((entity:
|
|
41
|
+
filter?: string | ((entity: _backstage_catalog_model_index.Entity) => boolean) | undefined;
|
|
42
42
|
};
|
|
43
43
|
}>;
|
|
44
44
|
"entity-card:github-actions/latest-workflow-run": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
@@ -56,7 +56,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
56
56
|
} & {
|
|
57
57
|
filter?: string | undefined;
|
|
58
58
|
};
|
|
59
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity:
|
|
59
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model_index.Entity) => boolean, "catalog.entity-filter-function", {
|
|
60
60
|
optional: true;
|
|
61
61
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
62
62
|
optional: true;
|
|
@@ -71,7 +71,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
71
71
|
name: "latest-workflow-run";
|
|
72
72
|
params: {
|
|
73
73
|
loader: () => Promise<JSX.Element>;
|
|
74
|
-
filter?: string | ((entity:
|
|
74
|
+
filter?: string | ((entity: _backstage_catalog_model_index.Entity) => boolean) | undefined;
|
|
75
75
|
};
|
|
76
76
|
}>;
|
|
77
77
|
"entity-card:github-actions/latest-branch-workflow-runs": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
@@ -89,7 +89,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
89
89
|
} & {
|
|
90
90
|
filter?: string | undefined;
|
|
91
91
|
};
|
|
92
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity:
|
|
92
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model_index.Entity) => boolean, "catalog.entity-filter-function", {
|
|
93
93
|
optional: true;
|
|
94
94
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
95
95
|
optional: true;
|
|
@@ -104,7 +104,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
104
104
|
name: "latest-branch-workflow-runs";
|
|
105
105
|
params: {
|
|
106
106
|
loader: () => Promise<JSX.Element>;
|
|
107
|
-
filter?: string | ((entity:
|
|
107
|
+
filter?: string | ((entity: _backstage_catalog_model_index.Entity) => boolean) | undefined;
|
|
108
108
|
};
|
|
109
109
|
}>;
|
|
110
110
|
"entity-card:github-actions/recent-workflow-runs": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
@@ -126,7 +126,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
126
126
|
} & {
|
|
127
127
|
filter?: string | undefined;
|
|
128
128
|
};
|
|
129
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity:
|
|
129
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model_index.Entity) => boolean, "catalog.entity-filter-function", {
|
|
130
130
|
optional: true;
|
|
131
131
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
132
132
|
optional: true;
|
|
@@ -141,7 +141,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
141
141
|
name: "recent-workflow-runs";
|
|
142
142
|
params: {
|
|
143
143
|
loader: () => Promise<JSX.Element>;
|
|
144
|
-
filter?: string | ((entity:
|
|
144
|
+
filter?: string | ((entity: _backstage_catalog_model_index.Entity) => boolean) | undefined;
|
|
145
145
|
};
|
|
146
146
|
}>;
|
|
147
147
|
"entity-content:github-actions/entity": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
@@ -159,7 +159,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
159
159
|
};
|
|
160
160
|
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
161
161
|
optional: true;
|
|
162
|
-
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity:
|
|
162
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model_index.Entity) => boolean, "catalog.entity-filter-function", {
|
|
163
163
|
optional: true;
|
|
164
164
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
165
165
|
optional: true;
|
|
@@ -170,7 +170,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
170
170
|
defaultPath: string;
|
|
171
171
|
defaultTitle: string;
|
|
172
172
|
routeRef?: _backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams> | undefined;
|
|
173
|
-
filter?: string | ((entity:
|
|
173
|
+
filter?: string | ((entity: _backstage_catalog_model_index.Entity) => boolean) | undefined;
|
|
174
174
|
};
|
|
175
175
|
}>;
|
|
176
176
|
}>;
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.ts"],"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 { convertLegacyRouteRefs } from '@backstage/core-compat-api';\nimport { createFrontendPlugin } from '@backstage/frontend-plugin-api';\nimport {\n entityGithubActionsCard,\n entityGithubActionsContent,\n entityLatestGithubActionRunCard,\n entityLatestGithubActionsForBranchCard,\n entityRecentGithubActionsRunsCard,\n githubActionsApi,\n} from './alpha/index';\nimport { rootRouteRef } from './routes';\n\n/**\n * @alpha\n */\nexport default createFrontendPlugin({\n id: 'github-actions',\n routes: convertLegacyRouteRefs({\n entityContent: rootRouteRef,\n }),\n extensions: [\n entityGithubActionsContent,\n entityGithubActionsCard,\n entityLatestGithubActionRunCard,\n entityLatestGithubActionsForBranchCard,\n entityRecentGithubActionsRunsCard,\n githubActionsApi,\n ],\n});\n"],"names":[],"mappings":";;;;;;;AA8BA,YAAe,oBAAqB,CAAA;AAAA,EAClC,EAAI,EAAA,gBAAA;AAAA,EACJ,QAAQ,sBAAuB,CAAA;AAAA,IAC7B,aAAe,EAAA
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.ts"],"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 { convertLegacyRouteRefs } from '@backstage/core-compat-api';\nimport { createFrontendPlugin } from '@backstage/frontend-plugin-api';\nimport {\n entityGithubActionsCard,\n entityGithubActionsContent,\n entityLatestGithubActionRunCard,\n entityLatestGithubActionsForBranchCard,\n entityRecentGithubActionsRunsCard,\n githubActionsApi,\n} from './alpha/index';\nimport { rootRouteRef } from './routes';\n\n/**\n * @alpha\n */\nexport default createFrontendPlugin({\n id: 'github-actions',\n routes: convertLegacyRouteRefs({\n entityContent: rootRouteRef,\n }),\n extensions: [\n entityGithubActionsContent,\n entityGithubActionsCard,\n entityLatestGithubActionRunCard,\n entityLatestGithubActionsForBranchCard,\n entityRecentGithubActionsRunsCard,\n githubActionsApi,\n ],\n});\n"],"names":[],"mappings":";;;;;;;AA8BA,YAAe,oBAAqB,CAAA;AAAA,EAClC,EAAI,EAAA,gBAAA;AAAA,EACJ,QAAQ,sBAAuB,CAAA;AAAA,IAC7B,aAAe,EAAA;AAAA,GAChB,CAAA;AAAA,EACD,UAAY,EAAA;AAAA,IACV,0BAAA;AAAA,IACA,uBAAA;AAAA,IACA,+BAAA;AAAA,IACA,sCAAA;AAAA,IACA,iCAAA;AAAA,IACA;AAAA;AAEJ,CAAC,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GithubActionsApi.esm.js","sources":["../../src/api/GithubActionsApi.ts"],"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 { createApiRef } from '@backstage/frontend-plugin-api';\nimport { RestEndpointMethodTypes } from '@octokit/rest';\n\n/** @public */\nexport const githubActionsApiRef = createApiRef<GithubActionsApi>({\n id: 'plugin.githubactions.service',\n});\n\n/**\n * A client for fetching information about GitHub actions.\n *\n * @public\n */\nexport type GithubActionsApi = {\n listWorkflowRuns: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n pageSize?: number;\n page?: number;\n branch?: string;\n }) => Promise<\n RestEndpointMethodTypes['actions']['listWorkflowRuns']['response']['data']\n >;\n\n getWorkflow: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n }) => Promise<\n RestEndpointMethodTypes['actions']['getWorkflow']['response']['data']\n >;\n\n getWorkflowRun: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n }) => Promise<\n RestEndpointMethodTypes['actions']['getWorkflowRun']['response']['data']\n >;\n\n reRunWorkflow: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n runId: number;\n }) => Promise<any>;\n\n listJobsForWorkflowRun: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n pageSize?: number;\n page?: number;\n }) => Promise<\n RestEndpointMethodTypes['actions']['listJobsForWorkflowRun']['response']['data']\n >;\n\n downloadJobLogsForWorkflowRun: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n runId: number;\n }) => Promise<\n RestEndpointMethodTypes['actions']['downloadJobLogsForWorkflowRun']['response']['data']\n >;\n\n listBranches: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n page: number;\n }) => Promise<\n RestEndpointMethodTypes['repos']['listBranches']['response']['data']\n >;\n\n getDefaultBranch: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n }) => Promise<\n RestEndpointMethodTypes['repos']['get']['response']['data']['default_branch']\n >;\n};\n"],"names":[],"mappings":";;AAoBO,MAAM,sBAAsB,YAA+B,CAAA;AAAA,EAChE,EAAI,EAAA
|
|
1
|
+
{"version":3,"file":"GithubActionsApi.esm.js","sources":["../../src/api/GithubActionsApi.ts"],"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 { createApiRef } from '@backstage/frontend-plugin-api';\nimport { RestEndpointMethodTypes } from '@octokit/rest';\n\n/** @public */\nexport const githubActionsApiRef = createApiRef<GithubActionsApi>({\n id: 'plugin.githubactions.service',\n});\n\n/**\n * A client for fetching information about GitHub actions.\n *\n * @public\n */\nexport type GithubActionsApi = {\n listWorkflowRuns: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n pageSize?: number;\n page?: number;\n branch?: string;\n }) => Promise<\n RestEndpointMethodTypes['actions']['listWorkflowRuns']['response']['data']\n >;\n\n getWorkflow: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n }) => Promise<\n RestEndpointMethodTypes['actions']['getWorkflow']['response']['data']\n >;\n\n getWorkflowRun: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n }) => Promise<\n RestEndpointMethodTypes['actions']['getWorkflowRun']['response']['data']\n >;\n\n reRunWorkflow: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n runId: number;\n }) => Promise<any>;\n\n listJobsForWorkflowRun: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n pageSize?: number;\n page?: number;\n }) => Promise<\n RestEndpointMethodTypes['actions']['listJobsForWorkflowRun']['response']['data']\n >;\n\n downloadJobLogsForWorkflowRun: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n runId: number;\n }) => Promise<\n RestEndpointMethodTypes['actions']['downloadJobLogsForWorkflowRun']['response']['data']\n >;\n\n listBranches: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n page: number;\n }) => Promise<\n RestEndpointMethodTypes['repos']['listBranches']['response']['data']\n >;\n\n getDefaultBranch: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n }) => Promise<\n RestEndpointMethodTypes['repos']['get']['response']['data']['default_branch']\n >;\n};\n"],"names":[],"mappings":";;AAoBO,MAAM,sBAAsB,YAA+B,CAAA;AAAA,EAChE,EAAI,EAAA;AACN,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GithubActionsClient.esm.js","sources":["../../src/api/GithubActionsClient.ts"],"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 { readGithubIntegrationConfigs } from '@backstage/integration';\nimport { ScmAuthApi } from '@backstage/integration-react';\nimport { GithubActionsApi } from './GithubActionsApi';\nimport { Octokit, RestEndpointMethodTypes } from '@octokit/rest';\nimport { ConfigApi } from '@backstage/core-plugin-api';\n\n/**\n * A client for fetching information about GitHub actions.\n *\n * @public\n */\nexport class GithubActionsClient implements GithubActionsApi {\n private readonly configApi: ConfigApi;\n private readonly scmAuthApi: ScmAuthApi;\n\n constructor(options: { configApi: ConfigApi; scmAuthApi: ScmAuthApi }) {\n this.configApi = options.configApi;\n this.scmAuthApi = options.scmAuthApi;\n }\n\n private async getOctokit(hostname: string = 'github.com'): Promise<Octokit> {\n const { token } = await this.scmAuthApi.getCredentials({\n url: `https://${hostname}/`,\n additionalScope: {\n customScopes: {\n github: ['repo'],\n },\n },\n });\n const configs = readGithubIntegrationConfigs(\n this.configApi.getOptionalConfigArray('integrations.github') ?? [],\n );\n const githubIntegrationConfig = configs.find(v => v.host === hostname);\n const baseUrl = githubIntegrationConfig?.apiBaseUrl;\n return new Octokit({ auth: token, baseUrl });\n }\n\n async reRunWorkflow(options: {\n hostname?: string;\n owner: string;\n repo: string;\n runId: number;\n }): Promise<any> {\n const { hostname, owner, repo, runId } = options;\n\n const octokit = await this.getOctokit(hostname);\n return octokit.actions.reRunWorkflow({\n owner,\n repo,\n run_id: runId,\n });\n }\n\n async listWorkflowRuns(options: {\n hostname?: string;\n owner: string;\n repo: string;\n pageSize?: number;\n page?: number;\n branch?: string;\n }): Promise<\n RestEndpointMethodTypes['actions']['listWorkflowRuns']['response']['data']\n > {\n const { hostname, owner, repo, pageSize = 100, page = 0, branch } = options;\n\n const octokit = await this.getOctokit(hostname);\n const workflowRuns = await octokit.actions.listWorkflowRunsForRepo({\n owner,\n repo,\n per_page: pageSize,\n page,\n ...(branch ? { branch } : {}),\n });\n\n return workflowRuns.data;\n }\n\n async getWorkflow(options: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n }): Promise<\n RestEndpointMethodTypes['actions']['getWorkflow']['response']['data']\n > {\n const { hostname, owner, repo, id } = options;\n\n const octokit = await this.getOctokit(hostname);\n const workflow = await octokit.actions.getWorkflow({\n owner,\n repo,\n workflow_id: id,\n });\n\n return workflow.data;\n }\n\n async getWorkflowRun(options: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n }): Promise<\n RestEndpointMethodTypes['actions']['getWorkflowRun']['response']['data']\n > {\n const { hostname, owner, repo, id } = options;\n\n const octokit = await this.getOctokit(hostname);\n const run = await octokit.actions.getWorkflowRun({\n owner,\n repo,\n run_id: id,\n });\n\n return run.data;\n }\n\n async listJobsForWorkflowRun(options: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n pageSize?: number;\n page?: number;\n }): Promise<\n RestEndpointMethodTypes['actions']['listJobsForWorkflowRun']['response']['data']\n > {\n const { hostname, owner, repo, id, pageSize = 100, page = 0 } = options;\n\n const octokit = await this.getOctokit(hostname);\n const jobs = await octokit.actions.listJobsForWorkflowRun({\n owner,\n repo,\n run_id: id,\n per_page: pageSize,\n page,\n });\n\n return jobs.data;\n }\n\n async downloadJobLogsForWorkflowRun(options: {\n hostname?: string;\n owner: string;\n repo: string;\n runId: number;\n }): Promise<\n RestEndpointMethodTypes['actions']['downloadJobLogsForWorkflowRun']['response']['data']\n > {\n const { hostname, owner, repo, runId } = options;\n\n const octokit = await this.getOctokit(hostname);\n const workflow = await octokit.actions.downloadJobLogsForWorkflowRun({\n owner,\n repo,\n job_id: runId,\n });\n\n return workflow.data;\n }\n\n async listBranches(options: {\n hostname?: string;\n owner: string;\n repo: string;\n page?: number;\n }): Promise<\n RestEndpointMethodTypes['repos']['listBranches']['response']['data']\n > {\n const { hostname, owner, repo, page = 0 } = options;\n const octokit = await this.getOctokit(hostname);\n const response = await octokit.rest.repos.listBranches({\n owner,\n repo,\n per_page: 100,\n page,\n });\n\n return response.data;\n }\n\n async getDefaultBranch(options: {\n hostname?: string;\n owner: string;\n repo: string;\n }): Promise<\n RestEndpointMethodTypes['repos']['get']['response']['data']['default_branch']\n > {\n const { hostname, owner, repo } = options;\n const octokit = await this.getOctokit(hostname);\n const response = await octokit.rest.repos.get({\n owner,\n repo,\n });\n\n return response.data.default_branch;\n }\n}\n"],"names":[],"mappings":";;;AA2BO,MAAM,mBAAgD,CAAA;AAAA,EAC1C,SAAA
|
|
1
|
+
{"version":3,"file":"GithubActionsClient.esm.js","sources":["../../src/api/GithubActionsClient.ts"],"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 { readGithubIntegrationConfigs } from '@backstage/integration';\nimport { ScmAuthApi } from '@backstage/integration-react';\nimport { GithubActionsApi } from './GithubActionsApi';\nimport { Octokit, RestEndpointMethodTypes } from '@octokit/rest';\nimport { ConfigApi } from '@backstage/core-plugin-api';\n\n/**\n * A client for fetching information about GitHub actions.\n *\n * @public\n */\nexport class GithubActionsClient implements GithubActionsApi {\n private readonly configApi: ConfigApi;\n private readonly scmAuthApi: ScmAuthApi;\n\n constructor(options: { configApi: ConfigApi; scmAuthApi: ScmAuthApi }) {\n this.configApi = options.configApi;\n this.scmAuthApi = options.scmAuthApi;\n }\n\n private async getOctokit(hostname: string = 'github.com'): Promise<Octokit> {\n const { token } = await this.scmAuthApi.getCredentials({\n url: `https://${hostname}/`,\n additionalScope: {\n customScopes: {\n github: ['repo'],\n },\n },\n });\n const configs = readGithubIntegrationConfigs(\n this.configApi.getOptionalConfigArray('integrations.github') ?? [],\n );\n const githubIntegrationConfig = configs.find(v => v.host === hostname);\n const baseUrl = githubIntegrationConfig?.apiBaseUrl;\n return new Octokit({ auth: token, baseUrl });\n }\n\n async reRunWorkflow(options: {\n hostname?: string;\n owner: string;\n repo: string;\n runId: number;\n }): Promise<any> {\n const { hostname, owner, repo, runId } = options;\n\n const octokit = await this.getOctokit(hostname);\n return octokit.actions.reRunWorkflow({\n owner,\n repo,\n run_id: runId,\n });\n }\n\n async listWorkflowRuns(options: {\n hostname?: string;\n owner: string;\n repo: string;\n pageSize?: number;\n page?: number;\n branch?: string;\n }): Promise<\n RestEndpointMethodTypes['actions']['listWorkflowRuns']['response']['data']\n > {\n const { hostname, owner, repo, pageSize = 100, page = 0, branch } = options;\n\n const octokit = await this.getOctokit(hostname);\n const workflowRuns = await octokit.actions.listWorkflowRunsForRepo({\n owner,\n repo,\n per_page: pageSize,\n page,\n ...(branch ? { branch } : {}),\n });\n\n return workflowRuns.data;\n }\n\n async getWorkflow(options: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n }): Promise<\n RestEndpointMethodTypes['actions']['getWorkflow']['response']['data']\n > {\n const { hostname, owner, repo, id } = options;\n\n const octokit = await this.getOctokit(hostname);\n const workflow = await octokit.actions.getWorkflow({\n owner,\n repo,\n workflow_id: id,\n });\n\n return workflow.data;\n }\n\n async getWorkflowRun(options: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n }): Promise<\n RestEndpointMethodTypes['actions']['getWorkflowRun']['response']['data']\n > {\n const { hostname, owner, repo, id } = options;\n\n const octokit = await this.getOctokit(hostname);\n const run = await octokit.actions.getWorkflowRun({\n owner,\n repo,\n run_id: id,\n });\n\n return run.data;\n }\n\n async listJobsForWorkflowRun(options: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n pageSize?: number;\n page?: number;\n }): Promise<\n RestEndpointMethodTypes['actions']['listJobsForWorkflowRun']['response']['data']\n > {\n const { hostname, owner, repo, id, pageSize = 100, page = 0 } = options;\n\n const octokit = await this.getOctokit(hostname);\n const jobs = await octokit.actions.listJobsForWorkflowRun({\n owner,\n repo,\n run_id: id,\n per_page: pageSize,\n page,\n });\n\n return jobs.data;\n }\n\n async downloadJobLogsForWorkflowRun(options: {\n hostname?: string;\n owner: string;\n repo: string;\n runId: number;\n }): Promise<\n RestEndpointMethodTypes['actions']['downloadJobLogsForWorkflowRun']['response']['data']\n > {\n const { hostname, owner, repo, runId } = options;\n\n const octokit = await this.getOctokit(hostname);\n const workflow = await octokit.actions.downloadJobLogsForWorkflowRun({\n owner,\n repo,\n job_id: runId,\n });\n\n return workflow.data;\n }\n\n async listBranches(options: {\n hostname?: string;\n owner: string;\n repo: string;\n page?: number;\n }): Promise<\n RestEndpointMethodTypes['repos']['listBranches']['response']['data']\n > {\n const { hostname, owner, repo, page = 0 } = options;\n const octokit = await this.getOctokit(hostname);\n const response = await octokit.rest.repos.listBranches({\n owner,\n repo,\n per_page: 100,\n page,\n });\n\n return response.data;\n }\n\n async getDefaultBranch(options: {\n hostname?: string;\n owner: string;\n repo: string;\n }): Promise<\n RestEndpointMethodTypes['repos']['get']['response']['data']['default_branch']\n > {\n const { hostname, owner, repo } = options;\n const octokit = await this.getOctokit(hostname);\n const response = await octokit.rest.repos.get({\n owner,\n repo,\n });\n\n return response.data.default_branch;\n }\n}\n"],"names":[],"mappings":";;;AA2BO,MAAM,mBAAgD,CAAA;AAAA,EAC1C,SAAA;AAAA,EACA,UAAA;AAAA,EAEjB,YAAY,OAA2D,EAAA;AACrE,IAAA,IAAA,CAAK,YAAY,OAAQ,CAAA,SAAA;A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MAAM,IAAK,CAAA,UAAA,CAAW,QAAQ,CAAA;AAC9C,IAAA,MAAM,QAAW,GAAA,MAAM,OAAQ,CAAA,IAAA,CAAK,MAAM,GAAI,CAAA;AAAA,MAC5C,KAAA;AAAA,MACA;AAAA,KACD,CAAA;AAED,IAAA,OAAO,SAAS,IAAK,CAAA,cAAA;AAAA;AAEzB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.esm.js","sources":["../../src/api/types.ts"],"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\n/** @public */\nexport type Step = {\n name: string;\n status: string;\n conclusion?: string;\n number: number; // starts from 1\n started_at?: string;\n completed_at?: string;\n};\n\n/** @public */\nexport type Job = {\n html_url?: string;\n status: string;\n conclusion?: string;\n started_at: string;\n completed_at?: string;\n id: number;\n name: string;\n steps?: Step[];\n};\n\n/** @public */\nexport type Jobs = {\n total_count: number;\n jobs: Job[];\n};\n\n/** @public */\nexport enum BuildStatus {\n 'success',\n 'failure',\n 'pending',\n 'running',\n}\n\n/** @public */\nexport type Branch = {\n name: string;\n};\n\n/** @public */\nexport type Branches = {\n default_branch: string;\n branches: Branch[];\n};\n\n/** @public */\nexport interface RouterProps {\n view?: 'cards' | 'table';\n}\n"],"names":["BuildStatus"],"mappings":"AA6CY,IAAA,WAAA,qBAAAA,YAAL,KAAA;AACL,EAAAA,YAAA,CAAA,YAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAA
|
|
1
|
+
{"version":3,"file":"types.esm.js","sources":["../../src/api/types.ts"],"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\n/** @public */\nexport type Step = {\n name: string;\n status: string;\n conclusion?: string;\n number: number; // starts from 1\n started_at?: string;\n completed_at?: string;\n};\n\n/** @public */\nexport type Job = {\n html_url?: string;\n status: string;\n conclusion?: string;\n started_at: string;\n completed_at?: string;\n id: number;\n name: string;\n steps?: Step[];\n};\n\n/** @public */\nexport type Jobs = {\n total_count: number;\n jobs: Job[];\n};\n\n/** @public */\nexport enum BuildStatus {\n 'success',\n 'failure',\n 'pending',\n 'running',\n}\n\n/** @public */\nexport type Branch = {\n name: string;\n};\n\n/** @public */\nexport type Branches = {\n default_branch: string;\n branches: Branch[];\n};\n\n/** @public */\nexport interface RouterProps {\n view?: 'cards' | 'table';\n}\n"],"names":["BuildStatus"],"mappings":"AA6CY,IAAA,WAAA,qBAAAA,YAAL,KAAA;AACL,EAAAA,YAAA,CAAA,YAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAA;AACA,EAAAA,YAAA,CAAA,YAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAA;AACA,EAAAA,YAAA,CAAA,YAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAA;AACA,EAAAA,YAAA,CAAA,YAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAA;AAJU,EAAAA,OAAAA,YAAAA;AAAA,CAAA,EAAA,WAAA,IAAA,EAAA;;;;"}
|
|
@@ -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 React, { 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
|
|
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 React, { 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,EAAA,IAAI,OAAc,uBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,IAAA,EAAA,wBAAA,EAAuB,QAAO,MAAI,CAAA;AAChE,EAAI,IAAA,OAAA,EAAgB,uBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,IAAA,CAAA;AAEpC,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,uBAAA;AAAA,IAAA;AAAA,MACC,QAAU,EAAA;AAAA,QACR,MACE,kBAAA,KAAA,CAAA,aAAA,CAAC,GAAI,EAAA,EAAA,OAAA,EAAQ,MACX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AAC,KAAO,EAAA,QAAQ,CAAC,CAAA;AAEpB,EAAA,2CACG,QAAS,EAAA,EAAA,KAAA,EAAO,CAAQ,KAAA,EAAA,MAAM,UAAU,OACvC,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,OAAA;AAAA,MACA,MAAA;AAAA,MACA;AAAA;AAAA,GAEJ,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,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,KAAA,EAAO,CAAQ,KAAA,EAAA,MAAM,CAAU,MAAA,CAAA,EAAA,OAAA,EAAA,kBACtC,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAkB,MAAgB,EAAA,MAAA,EAAgB,CACrD,CAAA;AAEJ;;;;"}
|
|
@@ -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 React, { 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 <WorkflowRunStatus {...p} />\n </Box>\n ),\n },\n ]}\n data={runs}\n />\n )}\n </InfoCard>\n );\n};\n"],"names":["RouterLink"],"mappings":";;;;;;;;;;;;;AAmCA,MAAM,YAAY,CAAC,OAAA,KAA4B,QAAQ,KAAM,CAAA,IAAI,EAAE,CAAC,CAAA
|
|
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 React, { 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 <WorkflowRunStatus {...p} />\n </Box>\n ),\n },\n ]}\n data={runs}\n />\n )}\n </InfoCard>\n );\n};\n"],"names":["RouterLink"],"mappings":";;;;;;;;;;;;;AAmCA,MAAM,YAAY,CAAC,OAAA,KAA4B,QAAQ,KAAM,CAAA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,EAAA,QAAA;AAAA,YACP,MAAA,EAAQ,CACN,CAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,GAAI,EAAA,EAAA,OAAA,EAAQ,0BACV,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAmB,GAAG,CAAA,EAAG,CAC5B;AAAA;AAEJ,SACF;AAAA,QACA,IAAM,EAAA;AAAA;AAAA;AACR,GAEJ;AAEJ;;;;"}
|
|
@@ -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 React from 'react';\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":";;;;;;;;;AA+Ba,MAAA,wBAAA,GAA2B,CAAC,MACvC,KAAA,OAAA,CAAQ,OAAO,QAAS,CAAA,WAAA,GAAc,yBAAyB,CAAC
|
|
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 React from 'react';\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":";;;;;;;;;AA+Ba,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,KAAA,CAAA,aAAA,CAAC,2BAA4B,EAAA,EAAA,UAAA,EAAY,yBAA2B,EAAA,CAAA;AAAA;AAIxE,EAAM,MAAA,qBAAA,GACJ,SAAS,OACP,mBAAA,KAAA,CAAA,aAAA,CAAC,oBAAiB,MAAgB,EAAA,CAAA,mBAEjC,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAkB,MAAgB,EAAA,CAAA;AAGvC,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,8BACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAM,MAAK,GAAI,EAAA,OAAA,EAAS,uBAAuB,CAChD,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAM,CAAG,EAAA,aAAA,CAAc,IAAI,CAAA,CAAA;AAAA,MAC3B,OAAA,kBAAU,KAAA,CAAA,aAAA,CAAA,kBAAA,EAAA,EAAmB,MAAgB,EAAA;AAAA;AAAA,GAEjD,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowRunDetails.esm.js","sources":["../../../src/components/WorkflowRunDetails/WorkflowRunDetails.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 Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Box from '@material-ui/core/Box';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Paper from '@material-ui/core/Paper';\nimport Table from '@material-ui/core/Table';\nimport TableBody from '@material-ui/core/TableBody';\nimport TableCell from '@material-ui/core/TableCell';\nimport TableContainer from '@material-ui/core/TableContainer';\nimport TableRow from '@material-ui/core/TableRow';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport ExternalLinkIcon from '@material-ui/icons/Launch';\nimport { DateTime } from 'luxon';\nimport React from 'react';\nimport { Job, Jobs, Step } from '../../api';\nimport { getProjectNameFromEntity } from '../getProjectNameFromEntity';\nimport { WorkflowRunStatus } from '../WorkflowRunStatus';\nimport { useWorkflowRunJobs } from './useWorkflowRunJobs';\nimport { useWorkflowRunsDetails } from './useWorkflowRunsDetails';\nimport { WorkflowRunLogs } from '../WorkflowRunLogs';\nimport { Breadcrumbs, Link } from '@backstage/core-components';\nimport { getHostnameFromEntity } from '../getHostnameFromEntity';\n\nconst useStyles = makeStyles<Theme>(theme => ({\n root: {\n maxWidth: 720,\n margin: theme.spacing(2),\n },\n title: {\n padding: theme.spacing(1, 0, 2, 0),\n },\n table: {\n padding: theme.spacing(1),\n },\n accordionDetails: {\n padding: 0,\n },\n button: {\n order: -1,\n marginRight: 0,\n marginLeft: '-20px',\n },\n externalLinkIcon: {\n fontSize: 'inherit',\n verticalAlign: 'bottom',\n },\n}));\n\nconst getElapsedTime = (start: string | undefined, end: string | undefined) => {\n if (!start || !end) {\n return '';\n }\n const startDate = DateTime.fromISO(start);\n const endDate = end ? DateTime.fromISO(end) : DateTime.now();\n const diff = endDate.diff(startDate);\n const timeElapsed = diff.toFormat(`m 'minutes' s 'seconds'`);\n return timeElapsed;\n};\n\nconst StepView = ({ step }: { step: Step }) => {\n return (\n <TableRow>\n <TableCell>\n <ListItemText\n primary={step.name}\n secondary={getElapsedTime(step.started_at, step.completed_at)}\n />\n </TableCell>\n <TableCell>\n <WorkflowRunStatus\n status={step.status.toLocaleUpperCase('en-US')}\n conclusion={step.conclusion?.toLocaleUpperCase('en-US')}\n />\n </TableCell>\n </TableRow>\n );\n};\n\nconst JobListItem = ({\n job,\n className,\n entity,\n}: {\n job: Job;\n className: string;\n entity: Entity;\n}) => {\n const classes = useStyles();\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} className={className}>\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n IconButtonProps={{\n className: classes.button,\n }}\n >\n <Typography variant=\"button\">\n {job.name} ({getElapsedTime(job.started_at, job.completed_at)})\n </Typography>\n </AccordionSummary>\n <AccordionDetails className={classes.accordionDetails}>\n <TableContainer>\n <Table>\n {job.steps?.map(step => (\n <StepView key={step.number} step={step} />\n ))}\n </Table>\n </TableContainer>\n </AccordionDetails>\n {job.status === 'queued' || job.status === 'in_progress' ? (\n <WorkflowRunLogs runId={job.id} inProgress entity={entity} />\n ) : (\n <WorkflowRunLogs runId={job.id} inProgress={false} entity={entity} />\n )}\n </Accordion>\n );\n};\n\nconst JobsList = ({ jobs, entity }: { jobs?: Jobs; entity: Entity }) => {\n const classes = useStyles();\n return (\n <Box>\n {jobs &&\n jobs.total_count > 0 &&\n jobs.jobs.map(job => (\n <JobListItem\n key={job.id}\n job={job}\n className={\n job.status !== 'success' ? classes.failed : classes.success\n }\n entity={entity}\n />\n ))}\n </Box>\n );\n};\n\nexport const WorkflowRunDetails = ({ entity }: { entity: Entity }) => {\n const projectName = getProjectNameFromEntity(entity);\n\n const hostname = getHostnameFromEntity(entity);\n const [owner, repo] = (projectName && projectName.split('/')) || [];\n const details = useWorkflowRunsDetails({ hostname, owner, repo });\n const jobs = useWorkflowRunJobs({ hostname, owner, repo });\n\n const classes = useStyles();\n\n if (details.error && details.error.message) {\n return (\n <Typography variant=\"h6\" color=\"error\">\n Failed to load build, {details.error.message}\n </Typography>\n );\n } else if (details.loading) {\n return <LinearProgress />;\n }\n return (\n <div className={classes.root}>\n <Box mb={3}>\n <Breadcrumbs aria-label=\"breadcrumb\">\n <Link to=\"..\">Workflow runs</Link>\n <Typography>Workflow run details</Typography>\n </Breadcrumbs>\n </Box>\n <TableContainer component={Paper} className={classes.table}>\n <Table>\n <TableBody>\n <TableRow>\n <TableCell>\n <Typography noWrap>Branch</Typography>\n </TableCell>\n <TableCell>{details.value?.head_branch}</TableCell>\n </TableRow>\n <TableRow>\n <TableCell>\n <Typography noWrap>Message</Typography>\n </TableCell>\n <TableCell>{details.value?.head_commit?.message}</TableCell>\n </TableRow>\n <TableRow>\n <TableCell>\n <Typography noWrap>Commit ID</Typography>\n </TableCell>\n <TableCell>{details.value?.head_commit?.id}</TableCell>\n </TableRow>\n <TableRow>\n <TableCell>\n <Typography noWrap>Workflow</Typography>\n </TableCell>\n <TableCell>{details.value?.name}</TableCell>\n </TableRow>\n <TableRow>\n <TableCell>\n <Typography noWrap>Status</Typography>\n </TableCell>\n <TableCell>\n <WorkflowRunStatus\n status={details.value?.status || undefined}\n conclusion={details.value?.conclusion || undefined}\n />\n </TableCell>\n </TableRow>\n <TableRow>\n <TableCell>\n <Typography noWrap>Author</Typography>\n </TableCell>\n <TableCell>{`${details.value?.head_commit?.author?.name} (${details.value?.head_commit?.author?.email})`}</TableCell>\n </TableRow>\n <TableRow>\n <TableCell>\n <Typography noWrap>Links</Typography>\n </TableCell>\n <TableCell>\n {details.value?.html_url && (\n <Link to={details.value.html_url}>\n Workflow runs on GitHub{' '}\n <ExternalLinkIcon className={classes.externalLinkIcon} />\n </Link>\n )}\n </TableCell>\n </TableRow>\n <TableRow>\n <TableCell colSpan={2}>\n <Typography noWrap>Jobs</Typography>\n {jobs.loading ? (\n <CircularProgress />\n ) : (\n <JobsList jobs={jobs.value} entity={entity} />\n )}\n </TableCell>\n </TableRow>\n </TableBody>\n </Table>\n </TableContainer>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,SAAA,GAAY,WAAkB,CAAU,KAAA,MAAA;AAAA,EAC5C,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA,GAAA;AAAA,IACV,MAAA,EAAQ,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,GACzB;AAAA,EACA,KAAO,EAAA;AAAA,IACL,SAAS,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC,CAAA;AAAA,GACnC;AAAA,EACA,KAAO,EAAA;AAAA,IACL,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,GAC1B;AAAA,EACA,gBAAkB,EAAA;AAAA,IAChB,OAAS,EAAA,CAAA;AAAA,GACX;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,CAAA,CAAA;AAAA,IACP,WAAa,EAAA,CAAA;AAAA,IACb,UAAY,EAAA,OAAA;AAAA,GACd;AAAA,EACA,gBAAkB,EAAA;AAAA,IAChB,QAAU,EAAA,SAAA;AAAA,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A,CAAA,aAAA,CAAC,gCACE,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,IAAA,sCACE,UAAW,EAAA,EAAA,MAAA,EAAM,QAAC,QAAM,CAC3B,mBACC,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,IAAA,EAAW,GAAG,OAAQ,CAAA,KAAA,EAAO,aAAa,MAAQ,EAAA,IAAI,KAAK,OAAQ,CAAA,KAAA,EAAO,aAAa,MAAQ,EAAA,KAAK,GAAI,CAC3G,CAAA,sCACC,QACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,iCACE,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,QAAM,IAAC,EAAA,EAAA,OAAK,CAC1B,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,iBACE,OAAQ,CAAA,KAAA,EAAO,4BACb,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,OAAQ,CAAA,KAAA,CAAM,YAAU,yBACR,EAAA,GAAA,sCACvB,gBAAiB,EAAA,EAAA,SAAA,EAAW,QAAQ,gBAAkB,EAAA,CACzD,CAEJ,CACF,CAAA,sCACC,QACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAU,OAAS,EAAA,CAAA,EAAA,sCACjB,UAAW,EAAA,EAAA,MAAA,EAAM,QAAC,MAAI,CAAA,EACtB,KAAK,OACJ,mBAAA,KAAA,CAAA,aAAA,CAAC,sBAAiB,CAElB,mBAAA,KAAA,CAAA,aAAA,CAAC,YAAS,IAAM,EAAA,IAAA,CAAK,OAAO,MAAgB,EAAA,CAEhD,CACF,CACF,CACF,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"WorkflowRunDetails.esm.js","sources":["../../../src/components/WorkflowRunDetails/WorkflowRunDetails.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 Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Box from '@material-ui/core/Box';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Paper from '@material-ui/core/Paper';\nimport Table from '@material-ui/core/Table';\nimport TableBody from '@material-ui/core/TableBody';\nimport TableCell from '@material-ui/core/TableCell';\nimport TableContainer from '@material-ui/core/TableContainer';\nimport TableRow from '@material-ui/core/TableRow';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport ExternalLinkIcon from '@material-ui/icons/Launch';\nimport { DateTime } from 'luxon';\nimport React from 'react';\nimport { Job, Jobs, Step } from '../../api';\nimport { getProjectNameFromEntity } from '../getProjectNameFromEntity';\nimport { WorkflowRunStatus } from '../WorkflowRunStatus';\nimport { useWorkflowRunJobs } from './useWorkflowRunJobs';\nimport { useWorkflowRunsDetails } from './useWorkflowRunsDetails';\nimport { WorkflowRunLogs } from '../WorkflowRunLogs';\nimport { Breadcrumbs, Link } from '@backstage/core-components';\nimport { getHostnameFromEntity } from '../getHostnameFromEntity';\n\nconst useStyles = makeStyles<Theme>(theme => ({\n root: {\n maxWidth: 720,\n margin: theme.spacing(2),\n },\n title: {\n padding: theme.spacing(1, 0, 2, 0),\n },\n table: {\n padding: theme.spacing(1),\n },\n accordionDetails: {\n padding: 0,\n },\n button: {\n order: -1,\n marginRight: 0,\n marginLeft: '-20px',\n },\n externalLinkIcon: {\n fontSize: 'inherit',\n verticalAlign: 'bottom',\n },\n}));\n\nconst getElapsedTime = (start: string | undefined, end: string | undefined) => {\n if (!start || !end) {\n return '';\n }\n const startDate = DateTime.fromISO(start);\n const endDate = end ? DateTime.fromISO(end) : DateTime.now();\n const diff = endDate.diff(startDate);\n const timeElapsed = diff.toFormat(`m 'minutes' s 'seconds'`);\n return timeElapsed;\n};\n\nconst StepView = ({ step }: { step: Step }) => {\n return (\n <TableRow>\n <TableCell>\n <ListItemText\n primary={step.name}\n secondary={getElapsedTime(step.started_at, step.completed_at)}\n />\n </TableCell>\n <TableCell>\n <WorkflowRunStatus\n status={step.status.toLocaleUpperCase('en-US')}\n conclusion={step.conclusion?.toLocaleUpperCase('en-US')}\n />\n </TableCell>\n </TableRow>\n );\n};\n\nconst JobListItem = ({\n job,\n className,\n entity,\n}: {\n job: Job;\n className: string;\n entity: Entity;\n}) => {\n const classes = useStyles();\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} className={className}>\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n IconButtonProps={{\n className: classes.button,\n }}\n >\n <Typography variant=\"button\">\n {job.name} ({getElapsedTime(job.started_at, job.completed_at)})\n </Typography>\n </AccordionSummary>\n <AccordionDetails className={classes.accordionDetails}>\n <TableContainer>\n <Table>\n {job.steps?.map(step => (\n <StepView key={step.number} step={step} />\n ))}\n </Table>\n </TableContainer>\n </AccordionDetails>\n {job.status === 'queued' || job.status === 'in_progress' ? (\n <WorkflowRunLogs runId={job.id} inProgress entity={entity} />\n ) : (\n <WorkflowRunLogs runId={job.id} inProgress={false} entity={entity} />\n )}\n </Accordion>\n );\n};\n\nconst JobsList = ({ jobs, entity }: { jobs?: Jobs; entity: Entity }) => {\n const classes = useStyles();\n return (\n <Box>\n {jobs &&\n jobs.total_count > 0 &&\n jobs.jobs.map(job => (\n <JobListItem\n key={job.id}\n job={job}\n className={\n job.status !== 'success' ? classes.failed : classes.success\n }\n entity={entity}\n />\n ))}\n </Box>\n );\n};\n\nexport const WorkflowRunDetails = ({ entity }: { entity: Entity }) => {\n const projectName = getProjectNameFromEntity(entity);\n\n const hostname = getHostnameFromEntity(entity);\n const [owner, repo] = (projectName && projectName.split('/')) || [];\n const details = useWorkflowRunsDetails({ hostname, owner, repo });\n const jobs = useWorkflowRunJobs({ hostname, owner, repo });\n\n const classes = useStyles();\n\n if (details.error && details.error.message) {\n return (\n <Typography variant=\"h6\" color=\"error\">\n Failed to load build, {details.error.message}\n </Typography>\n );\n } else if (details.loading) {\n return <LinearProgress />;\n }\n return (\n <div className={classes.root}>\n <Box mb={3}>\n <Breadcrumbs aria-label=\"breadcrumb\">\n <Link to=\"..\">Workflow runs</Link>\n <Typography>Workflow run details</Typography>\n </Breadcrumbs>\n </Box>\n <TableContainer component={Paper} className={classes.table}>\n <Table>\n <TableBody>\n <TableRow>\n <TableCell>\n <Typography noWrap>Branch</Typography>\n </TableCell>\n <TableCell>{details.value?.head_branch}</TableCell>\n </TableRow>\n <TableRow>\n <TableCell>\n <Typography noWrap>Message</Typography>\n </TableCell>\n <TableCell>{details.value?.head_commit?.message}</TableCell>\n </TableRow>\n <TableRow>\n <TableCell>\n <Typography noWrap>Commit ID</Typography>\n </TableCell>\n <TableCell>{details.value?.head_commit?.id}</TableCell>\n </TableRow>\n <TableRow>\n <TableCell>\n <Typography noWrap>Workflow</Typography>\n </TableCell>\n <TableCell>{details.value?.name}</TableCell>\n </TableRow>\n <TableRow>\n <TableCell>\n <Typography noWrap>Status</Typography>\n </TableCell>\n <TableCell>\n <WorkflowRunStatus\n status={details.value?.status || undefined}\n conclusion={details.value?.conclusion || undefined}\n />\n </TableCell>\n </TableRow>\n <TableRow>\n <TableCell>\n <Typography noWrap>Author</Typography>\n </TableCell>\n <TableCell>{`${details.value?.head_commit?.author?.name} (${details.value?.head_commit?.author?.email})`}</TableCell>\n </TableRow>\n <TableRow>\n <TableCell>\n <Typography noWrap>Links</Typography>\n </TableCell>\n <TableCell>\n {details.value?.html_url && (\n <Link to={details.value.html_url}>\n Workflow runs on GitHub{' '}\n <ExternalLinkIcon className={classes.externalLinkIcon} />\n </Link>\n )}\n </TableCell>\n </TableRow>\n <TableRow>\n <TableCell colSpan={2}>\n <Typography noWrap>Jobs</Typography>\n {jobs.loading ? (\n <CircularProgress />\n ) : (\n <JobsList jobs={jobs.value} entity={entity} />\n )}\n </TableCell>\n </TableRow>\n </TableBody>\n </Table>\n </TableContainer>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,SAAA,GAAY,WAAkB,CAAU,KAAA,MAAA;AAAA,EAC5C,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA,GAAA;AAAA,IACV,MAAA,EAAQ,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,GACzB;AAAA,EACA,KAAO,EAAA;AAAA,IACL,SAAS,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC;AAAA,GACnC;AAAA,EACA,KAAO,EAAA;AAAA,IACL,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,GAC1B;AAAA,EACA,gBAAkB,EAAA;AAAA,IAChB,OAAS,EAAA;AAAA,GACX;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,CAAA,CAAA;AAAA,IACP,WAAa,EAAA,CAAA;AAAA,IACb,UAAY,EAAA;AAAA,GACd;AAAA,EACA,gBAAkB,EAAA;AAAA,IAChB,QAAU,EAAA,SAAA;AAAA,IACV,aAAe,EAAA;AAAA;AAEnB,CAAE,CAAA,CAAA;AAEF,MAAM,cAAA,GAAiB,CAAC,KAAA,EAA2B,GAA4B,KAAA;AAC7E,EAAI,IAAA,CAAC,KAAS,IAAA,CAAC,GAAK,EAAA;AAClB,IAAO,OAAA,EAAA;AAAA;AAET,EAAM,MAAA,SAAA,GAAY,QAAS,CAAA,OAAA,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,aAAA,CAAC,iBACE,OAAQ,CAAA,KAAA,EAAO,4BACb,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,OAAQ,CAAA,KAAA,CAAM,YAAU,yBACR,EAAA,GAAA,sCACvB,gBAAiB,EAAA,EAAA,SAAA,EAAW,QAAQ,gBAAkB,EAAA,CACzD,CAEJ,CACF,CAAA,sCACC,QACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAU,OAAS,EAAA,CAAA,EAAA,sCACjB,UAAW,EAAA,EAAA,MAAA,EAAM,QAAC,MAAI,CAAA,EACtB,KAAK,OACJ,mBAAA,KAAA,CAAA,aAAA,CAAC,sBAAiB,CAElB,mBAAA,KAAA,CAAA,aAAA,CAAC,YAAS,IAAM,EAAA,IAAA,CAAK,OAAO,MAAgB,EAAA,CAEhD,CACF,CACF,CACF,CACF,CACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWorkflowRunJobs.esm.js","sources":["../../../src/components/WorkflowRunDetails/useWorkflowRunJobs.ts"],"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 useAsync, { AsyncState } from 'react-use/esm/useAsync';\nimport { githubActionsApiRef, Job, Jobs, Step } from '../../api';\nimport { buildRouteRef } from '../../routes';\nimport { useApi, useRouteRefParams } from '@backstage/core-plugin-api';\n\nexport const useWorkflowRunJobs = ({\n hostname,\n owner,\n repo,\n}: {\n hostname?: string;\n owner: string;\n repo: string;\n}): AsyncState<Jobs> => {\n const api = useApi(githubActionsApiRef);\n const { id } = useRouteRefParams(buildRouteRef);\n\n return useAsync(async () => {\n if (!repo || !owner) {\n throw new Error('No repo/owner provided');\n }\n\n const jobs = await api.listJobsForWorkflowRun({\n hostname,\n owner,\n repo,\n id: parseInt(id, 10),\n });\n\n return {\n total_count: jobs.total_count,\n jobs: jobs.jobs.map<Job>(job => ({\n html_url: job.html_url ?? undefined,\n status: job.status,\n conclusion: job.conclusion ?? undefined,\n started_at: job.started_at,\n completed_at: job.completed_at ?? undefined,\n id: job.id,\n name: job.name,\n steps: job.steps?.map<Step>(step => ({\n name: step.name,\n status: step.status,\n conclusion: step.conclusion ?? undefined,\n number: step.number,\n started_at: step.started_at ?? undefined,\n completed_at: step.completed_at ?? undefined,\n })),\n })),\n };\n }, [repo, owner, id]);\n};\n"],"names":[],"mappings":";;;;;;;AAoBO,MAAM,qBAAqB,CAAC;AAAA,EACjC,QAAA;AAAA,EACA,KAAA;AAAA,EACA
|
|
1
|
+
{"version":3,"file":"useWorkflowRunJobs.esm.js","sources":["../../../src/components/WorkflowRunDetails/useWorkflowRunJobs.ts"],"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 useAsync, { AsyncState } from 'react-use/esm/useAsync';\nimport { githubActionsApiRef, Job, Jobs, Step } from '../../api';\nimport { buildRouteRef } from '../../routes';\nimport { useApi, useRouteRefParams } from '@backstage/core-plugin-api';\n\nexport const useWorkflowRunJobs = ({\n hostname,\n owner,\n repo,\n}: {\n hostname?: string;\n owner: string;\n repo: string;\n}): AsyncState<Jobs> => {\n const api = useApi(githubActionsApiRef);\n const { id } = useRouteRefParams(buildRouteRef);\n\n return useAsync(async () => {\n if (!repo || !owner) {\n throw new Error('No repo/owner provided');\n }\n\n const jobs = await api.listJobsForWorkflowRun({\n hostname,\n owner,\n repo,\n id: parseInt(id, 10),\n });\n\n return {\n total_count: jobs.total_count,\n jobs: jobs.jobs.map<Job>(job => ({\n html_url: job.html_url ?? undefined,\n status: job.status,\n conclusion: job.conclusion ?? undefined,\n started_at: job.started_at,\n completed_at: job.completed_at ?? undefined,\n id: job.id,\n name: job.name,\n steps: job.steps?.map<Step>(step => ({\n name: step.name,\n status: step.status,\n conclusion: step.conclusion ?? undefined,\n number: step.number,\n started_at: step.started_at ?? undefined,\n completed_at: step.completed_at ?? undefined,\n })),\n })),\n };\n }, [repo, owner, id]);\n};\n"],"names":[],"mappings":";;;;;;;AAoBO,MAAM,qBAAqB,CAAC;AAAA,EACjC,QAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAIwB,KAAA;AACtB,EAAM,MAAA,GAAA,GAAM,OAAO,mBAAmB,CAAA;AACtC,EAAA,MAAM,EAAE,EAAA,EAAO,GAAA,iBAAA,CAAkB,aAAa,CAAA;AAE9C,EAAA,OAAO,SAAS,YAAY;AAC1B,IAAI,IAAA,CAAC,IAAQ,IAAA,CAAC,KAAO,EAAA;AACnB,MAAM,MAAA,IAAI,MAAM,wBAAwB,CAAA;AAAA;AAG1C,IAAM,MAAA,IAAA,GAAO,MAAM,GAAA,CAAI,sBAAuB,CAAA;AAAA,MAC5C,QAAA;AAAA,MACA,KAAA;AAAA,MACA,IAAA;AAAA,MACA,EAAA,EAAI,QAAS,CAAA,EAAA,EAAI,EAAE;AAAA,KACpB,CAAA;AAED,IAAO,OAAA;AAAA,MACL,aAAa,IAAK,CAAA,WAAA;AAAA,MAClB,IAAM,EAAA,IAAA,CAAK,IAAK,CAAA,GAAA,CAAS,CAAQ,GAAA,MAAA;AAAA,QAC/B,QAAA,EAAU,IAAI,QAAY,IAAA,KAAA,CAAA;AAAA,QAC1B,QAAQ,GAAI,CAAA,MAAA;AAAA,QACZ,UAAA,EAAY,IAAI,UAAc,IAAA,KAAA,CAAA;AAAA,QAC9B,YAAY,GAAI,CAAA,UAAA;AAAA,QAChB,YAAA,EAAc,IAAI,YAAgB,IAAA,KAAA,CAAA;AAAA,QAClC,IAAI,GAAI,CAAA,EAAA;AAAA,QACR,MAAM,GAAI,CAAA,IAAA;AAAA,QACV,KAAO,EAAA,GAAA,CAAI,KAAO,EAAA,GAAA,CAAU,CAAS,IAAA,MAAA;AAAA,UACnC,MAAM,IAAK,CAAA,IAAA;AAAA,UACX,QAAQ,IAAK,CAAA,MAAA;AAAA,UACb,UAAA,EAAY,KAAK,UAAc,IAAA,KAAA,CAAA;AAAA,UAC/B,QAAQ,IAAK,CAAA,MAAA;AAAA,UACb,UAAA,EAAY,KAAK,UAAc,IAAA,KAAA,CAAA;AAAA,UAC/B,YAAA,EAAc,KAAK,YAAgB,IAAA,KAAA;AAAA,SACnC,CAAA;AAAA,OACF,CAAA;AAAA,KACJ;AAAA,GACC,EAAA,CAAC,IAAM,EAAA,KAAA,EAAO,EAAE,CAAC,CAAA;AACtB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWorkflowRunsDetails.esm.js","sources":["../../../src/components/WorkflowRunDetails/useWorkflowRunsDetails.ts"],"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 useAsync from 'react-use/esm/useAsync';\nimport { githubActionsApiRef } from '../../api';\nimport { buildRouteRef } from '../../routes';\nimport { useApi, useRouteRefParams } from '@backstage/core-plugin-api';\n\nexport const useWorkflowRunsDetails = ({\n hostname,\n owner,\n repo,\n}: {\n hostname?: string;\n owner: string;\n repo: string;\n}) => {\n const api = useApi(githubActionsApiRef);\n const { id } = useRouteRefParams(buildRouteRef);\n const details = useAsync(async () => {\n return repo && owner\n ? api.getWorkflowRun({\n hostname,\n owner,\n repo,\n id: parseInt(id, 10),\n })\n : Promise.reject(new Error('No repo/owner provided'));\n }, [repo, owner, id]);\n return details;\n};\n"],"names":[],"mappings":";;;;;;;AAoBO,MAAM,yBAAyB,CAAC;AAAA,EACrC,QAAA;AAAA,EACA,KAAA;AAAA,EACA
|
|
1
|
+
{"version":3,"file":"useWorkflowRunsDetails.esm.js","sources":["../../../src/components/WorkflowRunDetails/useWorkflowRunsDetails.ts"],"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 useAsync from 'react-use/esm/useAsync';\nimport { githubActionsApiRef } from '../../api';\nimport { buildRouteRef } from '../../routes';\nimport { useApi, useRouteRefParams } from '@backstage/core-plugin-api';\n\nexport const useWorkflowRunsDetails = ({\n hostname,\n owner,\n repo,\n}: {\n hostname?: string;\n owner: string;\n repo: string;\n}) => {\n const api = useApi(githubActionsApiRef);\n const { id } = useRouteRefParams(buildRouteRef);\n const details = useAsync(async () => {\n return repo && owner\n ? api.getWorkflowRun({\n hostname,\n owner,\n repo,\n id: parseInt(id, 10),\n })\n : Promise.reject(new Error('No repo/owner provided'));\n }, [repo, owner, id]);\n return details;\n};\n"],"names":[],"mappings":";;;;;;;AAoBO,MAAM,yBAAyB,CAAC;AAAA,EACrC,QAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAIM,KAAA;AACJ,EAAM,MAAA,GAAA,GAAM,OAAO,mBAAmB,CAAA;AACtC,EAAA,MAAM,EAAE,EAAA,EAAO,GAAA,iBAAA,CAAkB,aAAa,CAAA;AAC9C,EAAM,MAAA,OAAA,GAAU,SAAS,YAAY;AACnC,IAAO,OAAA,IAAA,IAAQ,KACX,GAAA,GAAA,CAAI,cAAe,CAAA;AAAA,MACjB,QAAA;AAAA,MACA,KAAA;AAAA,MACA,IAAA;AAAA,MACA,EAAA,EAAI,QAAS,CAAA,EAAA,EAAI,EAAE;AAAA,KACpB,CACD,GAAA,OAAA,CAAQ,OAAO,IAAI,KAAA,CAAM,wBAAwB,CAAC,CAAA;AAAA,GACrD,EAAA,CAAC,IAAM,EAAA,KAAA,EAAO,EAAE,CAAC,CAAA;AACpB,EAAO,OAAA,OAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowRunLogs.esm.js","sources":["../../../src/components/WorkflowRunLogs/WorkflowRunLogs.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 { LogViewer } from '@backstage/core-components';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport Fade from '@material-ui/core/Fade';\nimport Modal from '@material-ui/core/Modal';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Typography from '@material-ui/core/Typography';\nimport Zoom from '@material-ui/core/Zoom';\nimport { makeStyles } from '@material-ui/core/styles';\nimport DescriptionIcon from '@material-ui/icons/Description';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport React from 'react';\nimport { getProjectNameFromEntity } from '../getProjectNameFromEntity';\nimport { useDownloadWorkflowRunLogs } from './useDownloadWorkflowRunLogs';\nimport { getHostnameFromEntity } from '../getHostnameFromEntity';\n\nconst useStyles = makeStyles(theme => ({\n button: {\n order: -1,\n marginRight: 0,\n marginLeft: '-20px',\n },\n modal: {\n display: 'flex',\n alignItems: 'center',\n width: '85%',\n height: '85%',\n justifyContent: 'center',\n margin: 'auto',\n },\n normalLogContainer: {\n height: '75vh',\n width: '100%',\n },\n modalLogContainer: {\n height: '100%',\n width: '100%',\n },\n log: {\n background: theme.palette.background.default,\n },\n}));\n\n/**\n * A component for Run Logs visualization.\n */\nexport const WorkflowRunLogs = ({\n entity,\n runId,\n inProgress,\n}: {\n entity: Entity;\n runId: number;\n inProgress: boolean;\n}) => {\n const classes = useStyles();\n const projectName = getProjectNameFromEntity(entity);\n\n const hostname = getHostnameFromEntity(entity);\n const [owner, repo] = (projectName && projectName.split('/')) || [];\n const jobLogs = useDownloadWorkflowRunLogs({\n hostname,\n owner,\n repo,\n id: runId,\n });\n const logText = jobLogs.value ? String(jobLogs.value) : undefined;\n const [open, setOpen] = React.useState(false);\n\n const handleOpen = () => {\n setOpen(true);\n };\n\n const handleClose = () => {\n setOpen(false);\n };\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} disabled={inProgress}>\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n IconButtonProps={{\n className: classes.button,\n }}\n >\n <Typography variant=\"button\">\n {jobLogs.loading ? <CircularProgress /> : 'Job Log'}\n </Typography>\n <Tooltip title=\"Open Log\" TransitionComponent={Zoom} arrow>\n <DescriptionIcon\n onClick={event => {\n event.stopPropagation();\n handleOpen();\n }}\n style={{ marginLeft: 'auto' }}\n />\n </Tooltip>\n <Modal\n className={classes.modal}\n onClick={event => event.stopPropagation()}\n open={open}\n onClose={handleClose}\n >\n <Fade in={open}>\n <div className={classes.modalLogContainer}>\n <LogViewer\n text={logText ?? 'No Values Found'}\n classes={{ root: classes.log }}\n />\n </div>\n </Fade>\n </Modal>\n </AccordionSummary>\n {logText && (\n <div className={classes.normalLogContainer}>\n <LogViewer text={logText} classes={{ root: classes.log }} />\n </div>\n )}\n </Accordion>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAkCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,CAAA,CAAA;AAAA,IACP,WAAa,EAAA,CAAA;AAAA,IACb,UAAY,EAAA
|
|
1
|
+
{"version":3,"file":"WorkflowRunLogs.esm.js","sources":["../../../src/components/WorkflowRunLogs/WorkflowRunLogs.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 { LogViewer } from '@backstage/core-components';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport Fade from '@material-ui/core/Fade';\nimport Modal from '@material-ui/core/Modal';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Typography from '@material-ui/core/Typography';\nimport Zoom from '@material-ui/core/Zoom';\nimport { makeStyles } from '@material-ui/core/styles';\nimport DescriptionIcon from '@material-ui/icons/Description';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport React from 'react';\nimport { getProjectNameFromEntity } from '../getProjectNameFromEntity';\nimport { useDownloadWorkflowRunLogs } from './useDownloadWorkflowRunLogs';\nimport { getHostnameFromEntity } from '../getHostnameFromEntity';\n\nconst useStyles = makeStyles(theme => ({\n button: {\n order: -1,\n marginRight: 0,\n marginLeft: '-20px',\n },\n modal: {\n display: 'flex',\n alignItems: 'center',\n width: '85%',\n height: '85%',\n justifyContent: 'center',\n margin: 'auto',\n },\n normalLogContainer: {\n height: '75vh',\n width: '100%',\n },\n modalLogContainer: {\n height: '100%',\n width: '100%',\n },\n log: {\n background: theme.palette.background.default,\n },\n}));\n\n/**\n * A component for Run Logs visualization.\n */\nexport const WorkflowRunLogs = ({\n entity,\n runId,\n inProgress,\n}: {\n entity: Entity;\n runId: number;\n inProgress: boolean;\n}) => {\n const classes = useStyles();\n const projectName = getProjectNameFromEntity(entity);\n\n const hostname = getHostnameFromEntity(entity);\n const [owner, repo] = (projectName && projectName.split('/')) || [];\n const jobLogs = useDownloadWorkflowRunLogs({\n hostname,\n owner,\n repo,\n id: runId,\n });\n const logText = jobLogs.value ? String(jobLogs.value) : undefined;\n const [open, setOpen] = React.useState(false);\n\n const handleOpen = () => {\n setOpen(true);\n };\n\n const handleClose = () => {\n setOpen(false);\n };\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} disabled={inProgress}>\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n IconButtonProps={{\n className: classes.button,\n }}\n >\n <Typography variant=\"button\">\n {jobLogs.loading ? <CircularProgress /> : 'Job Log'}\n </Typography>\n <Tooltip title=\"Open Log\" TransitionComponent={Zoom} arrow>\n <DescriptionIcon\n onClick={event => {\n event.stopPropagation();\n handleOpen();\n }}\n style={{ marginLeft: 'auto' }}\n />\n </Tooltip>\n <Modal\n className={classes.modal}\n onClick={event => event.stopPropagation()}\n open={open}\n onClose={handleClose}\n >\n <Fade in={open}>\n <div className={classes.modalLogContainer}>\n <LogViewer\n text={logText ?? 'No Values Found'}\n classes={{ root: classes.log }}\n />\n </div>\n </Fade>\n </Modal>\n </AccordionSummary>\n {logText && (\n <div className={classes.normalLogContainer}>\n <LogViewer text={logText} classes={{ root: classes.log }} />\n </div>\n )}\n </Accordion>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAkCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,CAAA,CAAA;AAAA,IACP,WAAa,EAAA,CAAA;AAAA,IACb,UAAY,EAAA;AAAA,GACd;AAAA,EACA,KAAO,EAAA;AAAA,IACL,OAAS,EAAA,MAAA;AAAA,IACT,UAAY,EAAA,QAAA;AAAA,IACZ,KAAO,EAAA,KAAA;AAAA,IACP,MAAQ,EAAA,KAAA;AAAA,IACR,cAAgB,EAAA,QAAA;AAAA,IAChB,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,kBAAoB,EAAA;AAAA,IAClB,MAAQ,EAAA,MAAA;AAAA,IACR,KAAO,EAAA;AAAA,GACT;AAAA,EACA,iBAAmB,EAAA;AAAA,IACjB,MAAQ,EAAA,MAAA;AAAA,IACR,KAAO,EAAA;AAAA,GACT;AAAA,EACA,GAAK,EAAA;AAAA,IACH,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,UAAW,CAAA;AAAA;AAEzC,CAAE,CAAA,CAAA;AAKK,MAAM,kBAAkB,CAAC;AAAA,EAC9B,MAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAIM,KAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,WAAA,GAAc,yBAAyB,MAAM,CAAA;AAEnD,EAAM,MAAA,QAAA,GAAW,sBAAsB,MAAM,CAAA;AAC7C,EAAM,MAAA,CAAC,OAAO,IAAI,CAAA,GAAK,eAAe,WAAY,CAAA,KAAA,CAAM,GAAG,CAAA,IAAM,EAAC;AAClE,EAAA,MAAM,UAAU,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AA;AAAA,oBACA,KAAA,CAAA,aAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,WAAW,OAAQ,CAAA,KAAA;AAAA,QACnB,OAAA,EAAS,CAAS,KAAA,KAAA,KAAA,CAAM,eAAgB,EAAA;AAAA,QACxC,IAAA;AAAA,QACA,OAAS,EAAA;AAAA,OAAA;AAAA,sBAET,KAAA,CAAA,aAAA,CAAC,QAAK,EAAI,EAAA,IAAA,EAAA,sCACP,KAAI,EAAA,EAAA,SAAA,EAAW,QAAQ,iBACtB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,SAAA;AAAA,QAAA;AAAA,UACC,MAAM,OAAW,IAAA,iBAAA;AAAA,UACjB,OAAS,EAAA,EAAE,IAAM,EAAA,OAAA,CAAQ,GAAI;AAAA;AAAA,OAEjC,CACF;AAAA;AACF,KAED,OACC,oBAAA,KAAA,CAAA,aAAA,CAAC,SAAI,SAAW,EAAA,OAAA,CAAQ,sCACrB,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,EAAU,IAAM,EAAA,OAAA,EAAS,SAAS,EAAE,IAAA,EAAM,QAAQ,GAAI,EAAA,EAAG,CAC5D,CAEJ,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDownloadWorkflowRunLogs.esm.js","sources":["../../../src/components/WorkflowRunLogs/useDownloadWorkflowRunLogs.ts"],"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 useAsync from 'react-use/esm/useAsync';\nimport { githubActionsApiRef } from '../../api';\nimport { useApi } from '@backstage/core-plugin-api';\n\nexport const useDownloadWorkflowRunLogs = ({\n hostname,\n owner,\n repo,\n id,\n}: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n}) => {\n const api = useApi(githubActionsApiRef);\n const details = useAsync(async () => {\n return repo && owner\n ? api.downloadJobLogsForWorkflowRun({\n hostname,\n owner,\n repo,\n runId: id,\n })\n : Promise.reject('No repo/owner provided');\n }, [repo, owner, id]);\n return details;\n};\n"],"names":[],"mappings":";;;;;;AAoBO,MAAM,6BAA6B,CAAC;AAAA,EACzC,QAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA
|
|
1
|
+
{"version":3,"file":"useDownloadWorkflowRunLogs.esm.js","sources":["../../../src/components/WorkflowRunLogs/useDownloadWorkflowRunLogs.ts"],"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 useAsync from 'react-use/esm/useAsync';\nimport { githubActionsApiRef } from '../../api';\nimport { useApi } from '@backstage/core-plugin-api';\n\nexport const useDownloadWorkflowRunLogs = ({\n hostname,\n owner,\n repo,\n id,\n}: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n}) => {\n const api = useApi(githubActionsApiRef);\n const details = useAsync(async () => {\n return repo && owner\n ? api.downloadJobLogsForWorkflowRun({\n hostname,\n owner,\n repo,\n runId: id,\n })\n : Promise.reject('No repo/owner provided');\n }, [repo, owner, id]);\n return details;\n};\n"],"names":[],"mappings":";;;;;;AAoBO,MAAM,6BAA6B,CAAC;AAAA,EACzC,QAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAKM,KAAA;AACJ,EAAM,MAAA,GAAA,GAAM,OAAO,mBAAmB,CAAA;AACtC,EAAM,MAAA,OAAA,GAAU,SAAS,YAAY;AACnC,IAAO,OAAA,IAAA,IAAQ,KACX,GAAA,GAAA,CAAI,6BAA8B,CAAA;AAAA,MAChC,QAAA;AAAA,MACA,KAAA;AAAA,MACA,IAAA;AAAA,MACA,KAAO,EAAA;AAAA,KACR,CAAA,GACD,OAAQ,CAAA,MAAA,CAAO,wBAAwB,CAAA;AAAA,GAC1C,EAAA,CAAC,IAAM,EAAA,KAAA,EAAO,EAAE,CAAC,CAAA;AACpB,EAAO,OAAA,OAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowRunStatus.esm.js","sources":["../../../src/components/WorkflowRunStatus/WorkflowRunStatus.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 React from 'react';\nimport {\n StatusPending,\n StatusRunning,\n StatusOK,\n StatusWarning,\n StatusAborted,\n StatusError,\n} from '@backstage/core-components';\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(() => ({\n statusIcon: {\n '& svg': {\n position: 'static',\n },\n },\n}));\n\nexport const WorkflowRunStatus = (props: {\n status?: string;\n conclusion?: string;\n}) => {\n const classes = useStyles();\n return (\n <Box display=\"flex\" justifyContent=\"center\" alignItems=\"center\">\n <Box className={classes.statusIcon}>\n <WorkflowIcon {...props} />\n </Box>\n <Typography variant=\"body2\">{getStatusDescription(props)}</Typography>\n </Box>\n );\n};\n\nexport function WorkflowIcon({\n status,\n conclusion,\n}: {\n status?: string;\n conclusion?: string;\n}) {\n if (status === undefined) return null;\n switch (status.toLocaleLowerCase('en-US')) {\n case 'queued':\n return <StatusPending />;\n\n case 'in_progress':\n return <StatusRunning />;\n case 'completed':\n switch (conclusion?.toLocaleLowerCase('en-US')) {\n case 'skipped':\n case 'cancelled':\n return <StatusAborted />;\n\n case 'timed_out':\n return <StatusWarning />;\n case 'failure':\n return <StatusError />;\n default:\n return <StatusOK />;\n }\n default:\n return <StatusPending />;\n }\n}\n\nexport function getStatusDescription({\n status,\n conclusion,\n}: {\n status?: string;\n conclusion?: string;\n}) {\n if (status === undefined) return '';\n switch (status.toLocaleLowerCase('en-US')) {\n case 'queued':\n return 'Queued';\n case 'in_progress':\n return 'In progress';\n case 'completed':\n switch (conclusion?.toLocaleLowerCase('en-US')) {\n case 'skipped':\n case 'cancelled':\n return 'Aborted';\n case 'timed_out':\n return 'Timed out';\n case 'failure':\n return 'Error';\n default:\n return 'Completed';\n }\n default:\n return 'Pending';\n }\n}\n"],"names":[],"mappings":";;;;;;AA6BA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,UAAY,EAAA;AAAA,IACV,OAAS,EAAA;AAAA,MACP,QAAU,EAAA
|
|
1
|
+
{"version":3,"file":"WorkflowRunStatus.esm.js","sources":["../../../src/components/WorkflowRunStatus/WorkflowRunStatus.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 React from 'react';\nimport {\n StatusPending,\n StatusRunning,\n StatusOK,\n StatusWarning,\n StatusAborted,\n StatusError,\n} from '@backstage/core-components';\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(() => ({\n statusIcon: {\n '& svg': {\n position: 'static',\n },\n },\n}));\n\nexport const WorkflowRunStatus = (props: {\n status?: string;\n conclusion?: string;\n}) => {\n const classes = useStyles();\n return (\n <Box display=\"flex\" justifyContent=\"center\" alignItems=\"center\">\n <Box className={classes.statusIcon}>\n <WorkflowIcon {...props} />\n </Box>\n <Typography variant=\"body2\">{getStatusDescription(props)}</Typography>\n </Box>\n );\n};\n\nexport function WorkflowIcon({\n status,\n conclusion,\n}: {\n status?: string;\n conclusion?: string;\n}) {\n if (status === undefined) return null;\n switch (status.toLocaleLowerCase('en-US')) {\n case 'queued':\n return <StatusPending />;\n\n case 'in_progress':\n return <StatusRunning />;\n case 'completed':\n switch (conclusion?.toLocaleLowerCase('en-US')) {\n case 'skipped':\n case 'cancelled':\n return <StatusAborted />;\n\n case 'timed_out':\n return <StatusWarning />;\n case 'failure':\n return <StatusError />;\n default:\n return <StatusOK />;\n }\n default:\n return <StatusPending />;\n }\n}\n\nexport function getStatusDescription({\n status,\n conclusion,\n}: {\n status?: string;\n conclusion?: string;\n}) {\n if (status === undefined) return '';\n switch (status.toLocaleLowerCase('en-US')) {\n case 'queued':\n return 'Queued';\n case 'in_progress':\n return 'In progress';\n case 'completed':\n switch (conclusion?.toLocaleLowerCase('en-US')) {\n case 'skipped':\n case 'cancelled':\n return 'Aborted';\n case 'timed_out':\n return 'Timed out';\n case 'failure':\n return 'Error';\n default:\n return 'Completed';\n }\n default:\n return 'Pending';\n }\n}\n"],"names":[],"mappings":";;;;;;AA6BA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,UAAY,EAAA;AAAA,IACV,OAAS,EAAA;AAAA,M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E,MAAA,2CAAQ,aAAc,EAAA,IAAA,CAAA;AAAA;AAE5B;AAEO,SAAS,oBAAqB,CAAA;AAAA,EACnC,MAAA;AAAA,EACA;AACF,CAGG,EAAA;AACD,EAAI,IAAA,MAAA,KAAW,QAAkB,OAAA,EAAA;AACjC,EAAQ,QAAA,MAAA,CAAO,iBAAkB,CAAA,OAAO,CAAG;AAAA,IACzC,KAAK,QAAA;AACH,MAAO,OAAA,QAAA;AAAA,IACT,KAAK,aAAA;AACH,MAAO,OAAA,aAAA;AAAA,IACT,KAAK,WAAA;AACH,MAAQ,QAAA,UAAA,EAAY,iBAAkB,CAAA,OAAO,CAAG;AAAA,QAC9C,KAAK,SAAA;AAAA,QACL,KAAK,WAAA;AACH,UAAO,OAAA,SAAA;AAAA,QACT,KAAK,WAAA;AACH,UAAO,OAAA,WAAA;AAAA,QACT,KAAK,SAAA;AACH,UAAO,OAAA,OAAA;AAAA,QACT;AACE,UAAO,OAAA,WAAA;AAAA;AACX,IACF;AACE,MAAO,OAAA,SAAA;AAAA;AAEb;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowRunsCard.esm.js","sources":["../../../src/components/WorkflowRunsCard/WorkflowRunsCard.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 React, { ChangeEvent, useEffect, useState } from 'react';\nimport Typography from '@material-ui/core/Typography';\nimport Box from '@material-ui/core/Box';\nimport IconButton from '@material-ui/core/IconButton';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport ButtonGroup from '@material-ui/core/ButtonGroup';\nimport Grid from '@material-ui/core/Grid';\nimport TablePagination from '@material-ui/core/TablePagination';\nimport Select from '@material-ui/core/Select';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport TextField from '@material-ui/core/TextField';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport { makeStyles, createStyles, Theme } from '@material-ui/core/styles';\nimport { LinkButton, Link, InfoCard } from '@backstage/core-components';\nimport GitHubIcon from '@material-ui/icons/GitHub';\nimport RetryIcon from '@material-ui/icons/Replay';\nimport SyncIcon from '@material-ui/icons/Sync';\nimport ExternalLinkIcon from '@material-ui/icons/Launch';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { useWorkflowRuns, WorkflowRun } from '../useWorkflowRuns';\nimport { WorkflowRunStatus } from '../WorkflowRunStatus';\nimport { buildRouteRef } from '../../routes';\nimport { getProjectNameFromEntity } from '../getProjectNameFromEntity';\nimport { getHostnameFromEntity } from '../getHostnameFromEntity';\n\nimport Alert, { Color } from '@material-ui/lab/Alert';\nimport { Entity } from '@backstage/catalog-model';\nimport Button from '@material-ui/core/Button';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n card: {\n border: `1px solid ${theme.palette.divider}`,\n boxShadow: theme.shadows[2],\n borderRadius: '4px',\n overflow: 'visible',\n position: 'relative',\n margin: theme.spacing(4, 1, 1),\n flex: '1',\n minWidth: '0px',\n },\n externalLinkIcon: {\n fontSize: 'inherit',\n verticalAlign: 'middle',\n },\n pagination: {\n width: '100%',\n },\n }),\n);\n\ntype WorkflowRunsCardViewProps = {\n runs?: WorkflowRun[];\n searchTerm: string;\n loading: boolean;\n onChangePageSize: (pageSize: number) => void;\n onChangePage: (page: number) => void;\n page: number;\n total: number;\n pageSize: number;\n projectName: string;\n};\n\nconst statusColors: Record<string, string> = {\n skipped: 'warning',\n canceled: 'info',\n timed_out: 'error',\n failure: 'error',\n success: 'success',\n};\n\nconst matchesSearchTerm = (run: WorkflowRun, searchTerm: string) => {\n const lowerCaseSearchTerm = searchTerm.toLocaleLowerCase();\n return (\n run.workflowName?.toLocaleLowerCase().includes(lowerCaseSearchTerm) ||\n run.source.branchName?.toLocaleLowerCase().includes(lowerCaseSearchTerm) ||\n run.status?.toLocaleLowerCase().includes(lowerCaseSearchTerm) ||\n run.id?.toLocaleLowerCase().includes(lowerCaseSearchTerm)\n );\n};\n\nexport const WorkflowRunsCardView = ({\n runs,\n searchTerm,\n loading,\n onChangePageSize,\n onChangePage,\n page,\n total,\n pageSize,\n}: WorkflowRunsCardViewProps) => {\n const classes = useStyles();\n const routeLink = useRouteRef(buildRouteRef);\n\n const filteredRuns = runs?.filter(run => matchesSearchTerm(run, searchTerm));\n\n return (\n <Grid container spacing={3}>\n {filteredRuns && runs?.length !== 0 ? (\n filteredRuns.map(run => (\n <Grid key={run.id} item container xs={12} lg={6} xl={4}>\n <Box className={classes.card}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n p={2}\n height=\"100%\"\n alignItems=\"center\"\n >\n <Box\n sx={{ width: '100%' }}\n textAlign=\"center\"\n display=\"flex\"\n flexDirection=\"column\"\n height=\"100%\"\n >\n <Tooltip\n title={run.status ?? 'No Status'}\n placement=\"top-start\"\n >\n <Alert\n variant=\"outlined\"\n severity={\n statusColors[\n run.conclusion as keyof typeof statusColors\n ] as Color\n }\n style={{ alignItems: 'center' }}\n >\n <Typography variant=\"h6\">\n <Link to={routeLink({ id: run.id })}>\n <Typography variant=\"h6\">\n {run.workflowName}\n </Typography>\n </Link>\n </Typography>\n </Alert>\n </Tooltip>\n <Tooltip title={run.message ?? 'No run message'}>\n <Box display=\"flex\" flexDirection=\"column\" marginY={1}>\n <Typography variant=\"subtitle2\" component=\"span\">\n Commit\n </Typography>\n <Typography\n variant=\"body2\"\n component=\"span\"\n style={{ overflowWrap: 'break-word' }}\n >\n {run.source.commit.hash!}\n </Typography>\n </Box>\n </Tooltip>\n\n {run.source.branchName && (\n <Box display=\"flex\" flexDirection=\"column\" marginY={1}>\n <Typography variant=\"subtitle2\" component=\"span\">\n Branch\n </Typography>\n <Typography\n variant=\"body2\"\n component=\"span\"\n style={{ overflowWrap: 'break-word' }}\n >\n {run.source.branchName}\n </Typography>\n </Box>\n )}\n <Box display=\"flex\" flexDirection=\"column\" marginY={1}>\n <Typography variant=\"subtitle2\" component=\"span\">\n Workflow ID\n </Typography>\n <Typography\n variant=\"body2\"\n component=\"span\"\n style={{ overflowWrap: 'break-word' }}\n >\n {run.id}\n </Typography>\n </Box>\n <WorkflowRunStatus\n status={run.status}\n conclusion={run.conclusion}\n />\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n mt=\"auto\"\n >\n <Box marginTop={2} marginBottom={1}>\n <Button\n endIcon={<RetryIcon />}\n onClick={run.onReRunClick}\n variant=\"outlined\"\n >\n Rerun workflow\n </Button>\n </Box>\n\n {run.githubUrl && (\n <Box>\n <LinkButton\n to={run.githubUrl}\n endIcon={<ExternalLinkIcon />}\n >\n View on GitHub\n </LinkButton>\n </Box>\n )}\n </Box>\n </Box>\n </Box>\n </Box>\n </Grid>\n ))\n ) : (\n <Box p={2}>\n {loading ? <CircularProgress /> : 'No matching runs found.'}\n </Box>\n )}\n <div className={classes.pagination}>\n <TablePagination\n component=\"div\"\n count={total}\n page={page}\n rowsPerPage={pageSize}\n onPageChange={(_, newPage) => onChangePage(newPage)}\n onRowsPerPageChange={event =>\n onChangePageSize(parseInt(event.target.value, 6))\n }\n labelRowsPerPage=\"Workflows per page\"\n rowsPerPageOptions={[6, 12, 18, { label: 'All', value: -1 }]}\n />\n </div>\n </Grid>\n );\n};\n\ntype WorkflowRunsCardProps = {\n entity: Entity;\n};\n\nconst WorkflowRunsCardSearch = ({\n searchTerm,\n handleSearch,\n retry,\n}: {\n searchTerm: string;\n handleSearch: (event: ChangeEvent<HTMLInputElement>) => void;\n retry: () => void;\n}) => {\n return (\n <>\n <Box flexGrow={1} />\n <TextField\n type=\"search\"\n label=\"Search\"\n value={searchTerm}\n onChange={handleSearch}\n data-testid=\"search-control\"\n style={{ marginRight: '20px' }}\n />\n <ButtonGroup>\n <Tooltip title=\"Reload workflow runs\">\n <IconButton onClick={retry}>\n <SyncIcon />\n </IconButton>\n </Tooltip>\n </ButtonGroup>\n </>\n );\n};\n\nexport const WorkflowRunsCard = ({ entity }: WorkflowRunsCardProps) => {\n const projectName = getProjectNameFromEntity(entity);\n const hostname = getHostnameFromEntity(entity);\n const [owner, repo] = (projectName ?? '/').split('/');\n const [branch, setBranch] = useState<string | undefined>('default');\n const [runs, setRuns] = useState<WorkflowRun[] | undefined>([]);\n const [searchTerm, setSearchTerm] = useState('');\n\n const handleSearch = (event: ChangeEvent<HTMLInputElement>) => {\n setSearchTerm(event.target.value);\n };\n\n const [\n { runs: runsData, branches, defaultBranch, ...cardProps },\n { retry, setPage, setPageSize },\n ] = useWorkflowRuns({\n hostname,\n owner,\n repo,\n branch: branch === 'all' ? undefined : branch,\n });\n\n const handleMenuChange = (\n event: ChangeEvent<{ name?: string; value: unknown }>,\n ) => {\n const selectedValue = event.target.value as string;\n setBranch(selectedValue);\n setPage(0);\n retry();\n };\n\n useEffect(() => {\n setRuns(runsData);\n }, [runsData, branch]);\n\n useEffect(() => {\n setBranch(defaultBranch);\n }, [defaultBranch]);\n\n return (\n <Grid item>\n <InfoCard\n title={\n <Box display=\"flex\" alignItems=\"center\">\n <GitHubIcon />\n <Box mr={1} />\n <Typography variant=\"h6\">{projectName}</Typography>\n\n <Select\n value={branch}\n key={branch}\n label=\"Branch\"\n onChange={handleMenuChange}\n data-testid=\"menu-control\"\n style={{\n marginLeft: '30px',\n marginRight: '20px',\n width: '230px',\n }}\n >\n {branches.map(branchItem => (\n <MenuItem key={branchItem.name} value={branchItem.name}>\n {branchItem.name === defaultBranch ? (\n <Typography variant=\"body2\" component=\"span\">\n {branchItem.name}{' '}\n <Typography\n variant=\"body2\"\n component=\"span\"\n style={{ color: 'lightgray', fontSize: 'x-small' }}\n >\n (default)\n </Typography>\n </Typography>\n ) : (\n branchItem.name\n )}\n </MenuItem>\n ))}\n\n <MenuItem\n value=\"all\"\n key=\"all\"\n style={{ color: 'lightGrey', fontSize: 'small' }}\n >\n select all branches\n </MenuItem>\n </Select>\n\n <WorkflowRunsCardSearch\n searchTerm={searchTerm}\n handleSearch={handleSearch}\n retry={retry}\n />\n </Box>\n }\n >\n <WorkflowRunsCardView\n runs={runs}\n loading={cardProps.loading}\n onChangePageSize={setPageSize}\n onChangePage={setPage}\n page={cardProps.page}\n total={cardProps.total}\n pageSize={cardProps.pageSize}\n searchTerm={searchTerm}\n projectName={projectName}\n />\n </InfoCard>\n </Grid>\n );\n};\n\nexport default WorkflowRunsCard;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAM,SAAY,GAAA,UAAA;AAAA,EAAW,CAAC,UAC5B,YAAa,CAAA;AAAA,IACX,IAAM,EAAA;AAAA,MACJ,MAAQ,EAAA,CAAA,UAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,OAAO,CAAA,CAAA;AAAA,MAC1C,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MAC1B,YAAc,EAAA,KAAA;AAAA,MACd,QAAU,EAAA,SAAA;AAAA,MACV,QAAU,EAAA,UAAA;AAAA,MACV,MAAQ,EAAA,KAAA,CAAM,OAAQ,CAAA,CAAA,EAAG,GAAG,CAAC,CAAA;AAAA,MAC7B,IAAM,EAAA,GAAA;AAAA,MACN,QAAU,EAAA,KAAA;AAAA,KACZ;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,QAAU,EAAA,SAAA;AAAA,MACV,aAAe,EAAA,QAAA;AAAA,KACjB;AAAA,IACA,UAAY,EAAA;AAAA,MACV,KAAO,EAAA,MAAA;AAAA,KACT;AAAA,GACD,CAAA;AACH,CAAA,CAAA;AAcA,MAAM,YAAuC,GAAA;AAAA,EAC3C,OAAS,EAAA,SAAA;AAAA,EACT,QAAU,EAAA,MAAA;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ACd,MAAM,SAAU,CAAA,IAAA;AAAA,QAChB,OAAO,SAAU,CAAA,KAAA;AAAA,QACjB,UAAU,SAAU,CAAA,QAAA;AAAA,QACpB,UAAA;AAAA,QACA,WAAA;AAAA,OAAA;AAAA,KACF;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"WorkflowRunsCard.esm.js","sources":["../../../src/components/WorkflowRunsCard/WorkflowRunsCard.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 React, { ChangeEvent, useEffect, useState } from 'react';\nimport Typography from '@material-ui/core/Typography';\nimport Box from '@material-ui/core/Box';\nimport IconButton from '@material-ui/core/IconButton';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport ButtonGroup from '@material-ui/core/ButtonGroup';\nimport Grid from '@material-ui/core/Grid';\nimport TablePagination from '@material-ui/core/TablePagination';\nimport Select from '@material-ui/core/Select';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport TextField from '@material-ui/core/TextField';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport { makeStyles, createStyles, Theme } from '@material-ui/core/styles';\nimport { LinkButton, Link, InfoCard } from '@backstage/core-components';\nimport GitHubIcon from '@material-ui/icons/GitHub';\nimport RetryIcon from '@material-ui/icons/Replay';\nimport SyncIcon from '@material-ui/icons/Sync';\nimport ExternalLinkIcon from '@material-ui/icons/Launch';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { useWorkflowRuns, WorkflowRun } from '../useWorkflowRuns';\nimport { WorkflowRunStatus } from '../WorkflowRunStatus';\nimport { buildRouteRef } from '../../routes';\nimport { getProjectNameFromEntity } from '../getProjectNameFromEntity';\nimport { getHostnameFromEntity } from '../getHostnameFromEntity';\n\nimport Alert, { Color } from '@material-ui/lab/Alert';\nimport { Entity } from '@backstage/catalog-model';\nimport Button from '@material-ui/core/Button';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n card: {\n border: `1px solid ${theme.palette.divider}`,\n boxShadow: theme.shadows[2],\n borderRadius: '4px',\n overflow: 'visible',\n position: 'relative',\n margin: theme.spacing(4, 1, 1),\n flex: '1',\n minWidth: '0px',\n },\n externalLinkIcon: {\n fontSize: 'inherit',\n verticalAlign: 'middle',\n },\n pagination: {\n width: '100%',\n },\n }),\n);\n\ntype WorkflowRunsCardViewProps = {\n runs?: WorkflowRun[];\n searchTerm: string;\n loading: boolean;\n onChangePageSize: (pageSize: number) => void;\n onChangePage: (page: number) => void;\n page: number;\n total: number;\n pageSize: number;\n projectName: string;\n};\n\nconst statusColors: Record<string, string> = {\n skipped: 'warning',\n canceled: 'info',\n timed_out: 'error',\n failure: 'error',\n success: 'success',\n};\n\nconst matchesSearchTerm = (run: WorkflowRun, searchTerm: string) => {\n const lowerCaseSearchTerm = searchTerm.toLocaleLowerCase();\n return (\n run.workflowName?.toLocaleLowerCase().includes(lowerCaseSearchTerm) ||\n run.source.branchName?.toLocaleLowerCase().includes(lowerCaseSearchTerm) ||\n run.status?.toLocaleLowerCase().includes(lowerCaseSearchTerm) ||\n run.id?.toLocaleLowerCase().includes(lowerCaseSearchTerm)\n );\n};\n\nexport const WorkflowRunsCardView = ({\n runs,\n searchTerm,\n loading,\n onChangePageSize,\n onChangePage,\n page,\n total,\n pageSize,\n}: WorkflowRunsCardViewProps) => {\n const classes = useStyles();\n const routeLink = useRouteRef(buildRouteRef);\n\n const filteredRuns = runs?.filter(run => matchesSearchTerm(run, searchTerm));\n\n return (\n <Grid container spacing={3}>\n {filteredRuns && runs?.length !== 0 ? (\n filteredRuns.map(run => (\n <Grid key={run.id} item container xs={12} lg={6} xl={4}>\n <Box className={classes.card}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n p={2}\n height=\"100%\"\n alignItems=\"center\"\n >\n <Box\n sx={{ width: '100%' }}\n textAlign=\"center\"\n display=\"flex\"\n flexDirection=\"column\"\n height=\"100%\"\n >\n <Tooltip\n title={run.status ?? 'No Status'}\n placement=\"top-start\"\n >\n <Alert\n variant=\"outlined\"\n severity={\n statusColors[\n run.conclusion as keyof typeof statusColors\n ] as Color\n }\n style={{ alignItems: 'center' }}\n >\n <Typography variant=\"h6\">\n <Link to={routeLink({ id: run.id })}>\n <Typography variant=\"h6\">\n {run.workflowName}\n </Typography>\n </Link>\n </Typography>\n </Alert>\n </Tooltip>\n <Tooltip title={run.message ?? 'No run message'}>\n <Box display=\"flex\" flexDirection=\"column\" marginY={1}>\n <Typography variant=\"subtitle2\" component=\"span\">\n Commit\n </Typography>\n <Typography\n variant=\"body2\"\n component=\"span\"\n style={{ overflowWrap: 'break-word' }}\n >\n {run.source.commit.hash!}\n </Typography>\n </Box>\n </Tooltip>\n\n {run.source.branchName && (\n <Box display=\"flex\" flexDirection=\"column\" marginY={1}>\n <Typography variant=\"subtitle2\" component=\"span\">\n Branch\n </Typography>\n <Typography\n variant=\"body2\"\n component=\"span\"\n style={{ overflowWrap: 'break-word' }}\n >\n {run.source.branchName}\n </Typography>\n </Box>\n )}\n <Box display=\"flex\" flexDirection=\"column\" marginY={1}>\n <Typography variant=\"subtitle2\" component=\"span\">\n Workflow ID\n </Typography>\n <Typography\n variant=\"body2\"\n component=\"span\"\n style={{ overflowWrap: 'break-word' }}\n >\n {run.id}\n </Typography>\n </Box>\n <WorkflowRunStatus\n status={run.status}\n conclusion={run.conclusion}\n />\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n mt=\"auto\"\n >\n <Box marginTop={2} marginBottom={1}>\n <Button\n endIcon={<RetryIcon />}\n onClick={run.onReRunClick}\n variant=\"outlined\"\n >\n Rerun workflow\n </Button>\n </Box>\n\n {run.githubUrl && (\n <Box>\n <LinkButton\n to={run.githubUrl}\n endIcon={<ExternalLinkIcon />}\n >\n View on GitHub\n </LinkButton>\n </Box>\n )}\n </Box>\n </Box>\n </Box>\n </Box>\n </Grid>\n ))\n ) : (\n <Box p={2}>\n {loading ? <CircularProgress /> : 'No matching runs found.'}\n </Box>\n )}\n <div className={classes.pagination}>\n <TablePagination\n component=\"div\"\n count={total}\n page={page}\n rowsPerPage={pageSize}\n onPageChange={(_, newPage) => onChangePage(newPage)}\n onRowsPerPageChange={event =>\n onChangePageSize(parseInt(event.target.value, 6))\n }\n labelRowsPerPage=\"Workflows per page\"\n rowsPerPageOptions={[6, 12, 18, { label: 'All', value: -1 }]}\n />\n </div>\n </Grid>\n );\n};\n\ntype WorkflowRunsCardProps = {\n entity: Entity;\n};\n\nconst WorkflowRunsCardSearch = ({\n searchTerm,\n handleSearch,\n retry,\n}: {\n searchTerm: string;\n handleSearch: (event: ChangeEvent<HTMLInputElement>) => void;\n retry: () => void;\n}) => {\n return (\n <>\n <Box flexGrow={1} />\n <TextField\n type=\"search\"\n label=\"Search\"\n value={searchTerm}\n onChange={handleSearch}\n data-testid=\"search-control\"\n style={{ marginRight: '20px' }}\n />\n <ButtonGroup>\n <Tooltip title=\"Reload workflow runs\">\n <IconButton onClick={retry}>\n <SyncIcon />\n </IconButton>\n </Tooltip>\n </ButtonGroup>\n </>\n );\n};\n\nexport const WorkflowRunsCard = ({ entity }: WorkflowRunsCardProps) => {\n const projectName = getProjectNameFromEntity(entity);\n const hostname = getHostnameFromEntity(entity);\n const [owner, repo] = (projectName ?? '/').split('/');\n const [branch, setBranch] = useState<string | undefined>('default');\n const [runs, setRuns] = useState<WorkflowRun[] | undefined>([]);\n const [searchTerm, setSearchTerm] = useState('');\n\n const handleSearch = (event: ChangeEvent<HTMLInputElement>) => {\n setSearchTerm(event.target.value);\n };\n\n const [\n { runs: runsData, branches, defaultBranch, ...cardProps },\n { retry, setPage, setPageSize },\n ] = useWorkflowRuns({\n hostname,\n owner,\n repo,\n branch: branch === 'all' ? undefined : branch,\n });\n\n const handleMenuChange = (\n event: ChangeEvent<{ name?: string; value: unknown }>,\n ) => {\n const selectedValue = event.target.value as string;\n setBranch(selectedValue);\n setPage(0);\n retry();\n };\n\n useEffect(() => {\n setRuns(runsData);\n }, [runsData, branch]);\n\n useEffect(() => {\n setBranch(defaultBranch);\n }, [defaultBranch]);\n\n return (\n <Grid item>\n <InfoCard\n title={\n <Box display=\"flex\" alignItems=\"center\">\n <GitHubIcon />\n <Box mr={1} />\n <Typography variant=\"h6\">{projectName}</Typography>\n\n <Select\n value={branch}\n key={branch}\n label=\"Branch\"\n onChange={handleMenuChange}\n data-testid=\"menu-control\"\n style={{\n marginLeft: '30px',\n marginRight: '20px',\n width: '230px',\n }}\n >\n {branches.map(branchItem => (\n <MenuItem key={branchItem.name} value={branchItem.name}>\n {branchItem.name === defaultBranch ? (\n <Typography variant=\"body2\" component=\"span\">\n {branchItem.name}{' '}\n <Typography\n variant=\"body2\"\n component=\"span\"\n style={{ color: 'lightgray', fontSize: 'x-small' }}\n >\n (default)\n </Typography>\n </Typography>\n ) : (\n branchItem.name\n )}\n </MenuItem>\n ))}\n\n <MenuItem\n value=\"all\"\n key=\"all\"\n style={{ color: 'lightGrey', fontSize: 'small' }}\n >\n select all branches\n </MenuItem>\n </Select>\n\n <WorkflowRunsCardSearch\n searchTerm={searchTerm}\n handleSearch={handleSearch}\n retry={retry}\n />\n </Box>\n }\n >\n <WorkflowRunsCardView\n runs={runs}\n loading={cardProps.loading}\n onChangePageSize={setPageSize}\n onChangePage={setPage}\n page={cardProps.page}\n total={cardProps.total}\n pageSize={cardProps.pageSize}\n searchTerm={searchTerm}\n projectName={projectName}\n />\n </InfoCard>\n </Grid>\n );\n};\n\nexport default WorkflowRunsCard;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,MA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AA,QAAC,sBAAA;AAAA,QAAA;AAAA,UACC,UAAA;AAAA,UACA,YAAA;AAAA,UACA;AAAA;AAAA,OAEJ;AAAA,KAAA;AAAA,oBAGF,KAAA,CAAA,aAAA;AAAA,MAAC,oBAAA;AAAA,MAAA;AAAA,QACC,IAAA;AAAA,QACA,SAAS,SAAU,CAAA,OAAA;AAAA,QACnB,gBAAkB,EAAA,WAAA;AAAA,QAClB,YAAc,EAAA,OAAA;AAAA,QACd,MAAM,SAAU,CAAA,IAAA;AAAA,QAChB,OAAO,SAAU,CAAA,KAAA;AAAA,QACjB,UAAU,SAAU,CAAA,QAAA;AAAA,QACpB,UAAA;AAAA,QACA;AAAA;AAAA;AACF,GAEJ,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowRunsTable.esm.js","sources":["../../../src/components/WorkflowRunsTable/WorkflowRunsTable.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 React from 'react';\nimport Typography from '@material-ui/core/Typography';\nimport Box from '@material-ui/core/Box';\nimport IconButton from '@material-ui/core/IconButton';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Button from '@material-ui/core/Button';\nimport RetryIcon from '@material-ui/icons/Replay';\nimport GitHubIcon from '@material-ui/icons/GitHub';\nimport { Link as RouterLink } from 'react-router-dom';\nimport { useWorkflowRuns, WorkflowRun } from '../useWorkflowRuns';\nimport { WorkflowRunStatus } from '../WorkflowRunStatus';\nimport SyncIcon from '@material-ui/icons/Sync';\nimport { buildRouteRef } from '../../routes';\nimport { getProjectNameFromEntity } from '../getProjectNameFromEntity';\nimport { Entity } from '@backstage/catalog-model';\n\nimport {\n EmptyState,\n Table,\n TableColumn,\n Link,\n} from '@backstage/core-components';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { getHostnameFromEntity } from '../getHostnameFromEntity';\nimport { getStatusDescription } from '../WorkflowRunStatus/WorkflowRunStatus';\n\n// Utility function to truncate string at the first newline character\nconst truncateAtNewline = (str: string) => {\n const newlineIndex = str.indexOf('\\n');\n return newlineIndex !== -1 ? str.substring(0, newlineIndex) : str;\n};\n\nconst generatedColumns: TableColumn<Partial<WorkflowRun>>[] = [\n {\n title: 'ID',\n field: 'id',\n type: 'numeric',\n width: '150px',\n },\n {\n title: 'Message',\n field: 'message',\n highlight: true,\n render: row => {\n const LinkWrapper = () => {\n const routeLink = useRouteRef(buildRouteRef);\n const truncatedMessage = truncateAtNewline(row.message!);\n return (\n <Link\n component={RouterLink}\n to={routeLink({ id: row.id! })}\n title={row.message} // display full message on hover\n >\n {truncatedMessage}\n </Link>\n );\n };\n\n return <LinkWrapper />;\n },\n },\n {\n title: 'Source',\n render: row => (\n <Typography variant=\"body2\" noWrap>\n <Typography paragraph variant=\"body2\">\n {row.source?.branchName}\n </Typography>\n <Typography paragraph variant=\"body2\">\n {row.source?.commit.hash}\n </Typography>\n </Typography>\n ),\n },\n {\n title: 'Workflow',\n field: 'workflowName',\n },\n {\n title: 'Status',\n customSort: (d1, d2) => {\n return getStatusDescription(d1).localeCompare(getStatusDescription(d2));\n },\n render: row => (\n <Box display=\"flex\" alignItems=\"center\">\n <WorkflowRunStatus status={row.status} conclusion={row.conclusion} />\n </Box>\n ),\n },\n {\n title: 'Actions',\n render: (row: Partial<WorkflowRun>) => (\n <Tooltip title=\"Rerun workflow\">\n <IconButton onClick={row.onReRunClick}>\n <RetryIcon />\n </IconButton>\n </Tooltip>\n ),\n width: '10%',\n },\n];\n\ntype Props = {\n loading: boolean;\n retry: () => void;\n runs?: WorkflowRun[];\n projectName: string;\n page: number;\n onChangePage: (page: number) => void;\n total: number;\n pageSize: number;\n onChangePageSize: (pageSize: number) => void;\n};\n\nexport const WorkflowRunsTableView = ({\n projectName,\n loading,\n pageSize,\n page,\n retry,\n runs,\n onChangePage,\n onChangePageSize,\n total,\n}: Props) => {\n return (\n <Table\n isLoading={loading}\n options={{ paging: true, pageSize, padding: 'dense' }}\n totalCount={total}\n page={page}\n actions={[\n {\n icon: () => <SyncIcon />,\n tooltip: 'Reload workflow runs',\n isFreeAction: true,\n onClick: () => retry(),\n },\n ]}\n data={runs ?? []}\n onPageChange={onChangePage}\n onRowsPerPageChange={onChangePageSize}\n style={{ width: '100%' }}\n title={\n <Box display=\"flex\" alignItems=\"center\">\n <GitHubIcon />\n <Box mr={1} />\n <Typography variant=\"h6\">{projectName}</Typography>\n </Box>\n }\n columns={generatedColumns}\n />\n );\n};\n\nexport const WorkflowRunsTable = ({\n entity,\n branch,\n}: {\n entity: Entity;\n branch?: string;\n}) => {\n const projectName = getProjectNameFromEntity(entity);\n const hostname = getHostnameFromEntity(entity);\n const [owner, repo] = (projectName ?? '/').split('/');\n const [{ runs, ...tableProps }, { retry, setPage, setPageSize }] =\n useWorkflowRuns({\n hostname,\n owner,\n repo,\n branch,\n });\n\n const githubHost = hostname || 'github.com';\n const hasNoRuns = !tableProps.loading && !runs;\n\n return hasNoRuns ? (\n <EmptyState\n missing=\"data\"\n title=\"No Workflow Data\"\n description=\"This component has GitHub Actions enabled, but no data was found. Have you created any Workflows? Click the button below to create a new Workflow.\"\n action={\n <Button\n variant=\"contained\"\n color=\"primary\"\n href={`https://${githubHost}/${projectName}/actions/new`}\n >\n Create new Workflow\n </Button>\n }\n />\n ) : (\n <WorkflowRunsTableView\n {...tableProps}\n runs={runs}\n loading={tableProps.loading}\n retry={retry}\n onChangePageSize={setPageSize}\n onChangePage={setPage}\n />\n );\n};\n"],"names":["RouterLink"],"mappings":";;;;;;;;;;;;;;;;;;AA0CA,MAAM,iBAAA,G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Table.esm.js","sources":["../../../src/components/WorkflowRunsTable/WorkflowRunsTable.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 React from 'react';\nimport Typography from '@material-ui/core/Typography';\nimport Box from '@material-ui/core/Box';\nimport IconButton from '@material-ui/core/IconButton';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Button from '@material-ui/core/Button';\nimport RetryIcon from '@material-ui/icons/Replay';\nimport GitHubIcon from '@material-ui/icons/GitHub';\nimport { Link as RouterLink } from 'react-router-dom';\nimport { useWorkflowRuns, WorkflowRun } from '../useWorkflowRuns';\nimport { WorkflowRunStatus } from '../WorkflowRunStatus';\nimport SyncIcon from '@material-ui/icons/Sync';\nimport { buildRouteRef } from '../../routes';\nimport { getProjectNameFromEntity } from '../getProjectNameFromEntity';\nimport { Entity } from '@backstage/catalog-model';\n\nimport {\n EmptyState,\n Table,\n TableColumn,\n Link,\n} from '@backstage/core-components';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { getHostnameFromEntity } from '../getHostnameFromEntity';\nimport { getStatusDescription } from '../WorkflowRunStatus/WorkflowRunStatus';\n\n// Utility function to truncate string at the first newline character\nconst truncateAtNewline = (str: string) => {\n const newlineIndex = str.indexOf('\\n');\n return newlineIndex !== -1 ? str.substring(0, newlineIndex) : str;\n};\n\nconst generatedColumns: TableColumn<Partial<WorkflowRun>>[] = [\n {\n title: 'ID',\n field: 'id',\n type: 'numeric',\n width: '150px',\n },\n {\n title: 'Message',\n field: 'message',\n highlight: true,\n render: row => {\n const LinkWrapper = () => {\n const routeLink = useRouteRef(buildRouteRef);\n const truncatedMessage = truncateAtNewline(row.message!);\n return (\n <Link\n component={RouterLink}\n to={routeLink({ id: row.id! })}\n title={row.message} // display full message on hover\n >\n {truncatedMessage}\n </Link>\n );\n };\n\n return <LinkWrapper />;\n },\n },\n {\n title: 'Source',\n render: row => (\n <Typography variant=\"body2\" noWrap>\n <Typography paragraph variant=\"body2\">\n {row.source?.branchName}\n </Typography>\n <Typography paragraph variant=\"body2\">\n {row.source?.commit.hash}\n </Typography>\n </Typography>\n ),\n },\n {\n title: 'Workflow',\n field: 'workflowName',\n },\n {\n title: 'Status',\n customSort: (d1, d2) => {\n return getStatusDescription(d1).localeCompare(getStatusDescription(d2));\n },\n render: row => (\n <Box display=\"flex\" alignItems=\"center\">\n <WorkflowRunStatus status={row.status} conclusion={row.conclusion} />\n </Box>\n ),\n },\n {\n title: 'Actions',\n render: (row: Partial<WorkflowRun>) => (\n <Tooltip title=\"Rerun workflow\">\n <IconButton onClick={row.onReRunClick}>\n <RetryIcon />\n </IconButton>\n </Tooltip>\n ),\n width: '10%',\n },\n];\n\ntype Props = {\n loading: boolean;\n retry: () => void;\n runs?: WorkflowRun[];\n projectName: string;\n page: number;\n onChangePage: (page: number) => void;\n total: number;\n pageSize: number;\n onChangePageSize: (pageSize: number) => void;\n};\n\nexport const WorkflowRunsTableView = ({\n projectName,\n loading,\n pageSize,\n page,\n retry,\n runs,\n onChangePage,\n onChangePageSize,\n total,\n}: Props) => {\n return (\n <Table\n isLoading={loading}\n options={{ paging: true, pageSize, padding: 'dense' }}\n totalCount={total}\n page={page}\n actions={[\n {\n icon: () => <SyncIcon />,\n tooltip: 'Reload workflow runs',\n isFreeAction: true,\n onClick: () => retry(),\n },\n ]}\n data={runs ?? []}\n onPageChange={onChangePage}\n onRowsPerPageChange={onChangePageSize}\n style={{ width: '100%' }}\n title={\n <Box display=\"flex\" alignItems=\"center\">\n <GitHubIcon />\n <Box mr={1} />\n <Typography variant=\"h6\">{projectName}</Typography>\n </Box>\n }\n columns={generatedColumns}\n />\n );\n};\n\nexport const WorkflowRunsTable = ({\n entity,\n branch,\n}: {\n entity: Entity;\n branch?: string;\n}) => {\n const projectName = getProjectNameFromEntity(entity);\n const hostname = getHostnameFromEntity(entity);\n const [owner, repo] = (projectName ?? '/').split('/');\n const [{ runs, ...tableProps }, { retry, setPage, setPageSize }] =\n useWorkflowRuns({\n hostname,\n owner,\n repo,\n branch,\n });\n\n const githubHost = hostname || 'github.com';\n const hasNoRuns = !tableProps.loading && !runs;\n\n return hasNoRuns ? (\n <EmptyState\n missing=\"data\"\n title=\"No Workflow Data\"\n description=\"This component has GitHub Actions enabled, but no data was found. Have you created any Workflows? Click the button below to create a new Workflow.\"\n action={\n <Button\n variant=\"contained\"\n color=\"primary\"\n href={`https://${githubHost}/${projectName}/actions/new`}\n >\n Create new Workflow\n </Button>\n }\n />\n ) : (\n <WorkflowRunsTableView\n {...tableProps}\n runs={runs}\n loading={tableProps.loading}\n retry={retry}\n onChangePageSize={setPageSize}\n onChangePage={setPage}\n />\n );\n};\n"],"names":["RouterLink"],"mappings":";;;;;;;;;;;;;;;;;;AA0CA,MAAM,iBAAA,GAAoB,CAAC,GAAgB,KAAA;AACzC,EAAM,MAAA,YAAA,GAAe,GAAI,CAAA,OAAA,CAAQ,IAAI,CAAA;AACrC,EAAA,OAAO,iBAAiB,CAAK,CAAA,GAAA,GAAA,CAAI,SAAU,CAAA,CAAA,EAAG,YAAY,CAAI,GAAA,GAAA;AAChE,CAAA;AAEA,MAAM,gBAAwD,GAAA;AAAA,EAC5D;AAAA,IACE,KAAO,EAAA,IAAA;AAAA,IACP,KAAO,EAAA,IAAA;AAAA,IACP,IAAM,EAAA,SAAA;AAAA,IACN,KAAO,EAAA;AAAA,GACT;AAAA,EACA;AAAA,IACE,KAAO,EAAA,SAAA;AAAA,IACP,KAAO,EAAA,SAAA;AAAA,IACP,SAAW,EAAA,IAAA;AAAA,IACX,QAAQ,CAAO,GAAA,KAAA;AACb,MAAA,MAA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AA;AAAA,UACC,OAAQ,EAAA,WAAA;AAAA,UACR,KAAM,EAAA,SAAA;AAAA,UACN,IAAM,EAAA,CAAA,QAAA,EAAW,UAAU,CAAA,CAAA,EAAI,WAAW,CAAA,YAAA;AAAA,SAAA;AAAA,QAC3C;AAAA;AAED;AAAA,GAIJ,mBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,qBAAA;AAAA,IAAA;AAAA,MACE,GAAG,UAAA;AAAA,MACJ,IAAA;AAAA,MACA,SAAS,UAAW,CAAA,OAAA;AAAA,MACpB,KAAA;AAAA,MACA,gBAAkB,EAAA,WAAA;AAAA,MAClB,YAAc,EAAA;AAAA;AAAA,GAChB;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getHostnameFromEntity.esm.js","sources":["../../src/components/getHostnameFromEntity.ts"],"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 {\n ANNOTATION_LOCATION,\n ANNOTATION_SOURCE_LOCATION,\n Entity,\n} from '@backstage/catalog-model';\nimport gitUrlParse from 'git-url-parse';\n\nexport const getHostnameFromEntity = (entity: Entity) => {\n const location =\n entity?.metadata.annotations?.[ANNOTATION_SOURCE_LOCATION] ??\n entity?.metadata.annotations?.[ANNOTATION_LOCATION];\n\n return location?.startsWith('url:')\n ? gitUrlParse(location.slice(4)).resource\n : undefined;\n};\n"],"names":[],"mappings":";;;AAuBa,MAAA,qBAAA,GAAwB,CAAC,MAAmB,KAAA;AACvD,EAAM,MAAA,QAAA,GACJ,QAAQ,QAAS,CAAA,WAAA,GAAc,0BAA0B,CACzD,IAAA,MAAA,EAAQ,QAAS,CAAA,WAAA,GAAc,mBAAmB,CAAA
|
|
1
|
+
{"version":3,"file":"getHostnameFromEntity.esm.js","sources":["../../src/components/getHostnameFromEntity.ts"],"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 {\n ANNOTATION_LOCATION,\n ANNOTATION_SOURCE_LOCATION,\n Entity,\n} from '@backstage/catalog-model';\nimport gitUrlParse from 'git-url-parse';\n\nexport const getHostnameFromEntity = (entity: Entity) => {\n const location =\n entity?.metadata.annotations?.[ANNOTATION_SOURCE_LOCATION] ??\n entity?.metadata.annotations?.[ANNOTATION_LOCATION];\n\n return location?.startsWith('url:')\n ? gitUrlParse(location.slice(4)).resource\n : undefined;\n};\n"],"names":[],"mappings":";;;AAuBa,MAAA,qBAAA,GAAwB,CAAC,MAAmB,KAAA;AACvD,EAAM,MAAA,QAAA,GACJ,QAAQ,QAAS,CAAA,WAAA,GAAc,0BAA0B,CACzD,IAAA,MAAA,EAAQ,QAAS,CAAA,WAAA,GAAc,mBAAmB,CAAA;AAEpD,EAAO,OAAA,QAAA,EAAU,UAAW,CAAA,MAAM,CAC9B,GAAA,WAAA,CAAY,SAAS,KAAM,CAAA,CAAC,CAAC,CAAA,CAAE,QAC/B,GAAA,KAAA,CAAA;AACN;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProjectNameFromEntity.esm.js","sources":["../../src/components/getProjectNameFromEntity.ts"],"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';\n\n/** @public */\nexport const GITHUB_ACTIONS_ANNOTATION = 'github.com/project-slug';\n\nexport const getProjectNameFromEntity = (entity: Entity) =>\n entity?.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION] ?? '';\n"],"names":[],"mappings":"AAmBO,MAAM,yBAA4B,GAAA
|
|
1
|
+
{"version":3,"file":"getProjectNameFromEntity.esm.js","sources":["../../src/components/getProjectNameFromEntity.ts"],"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';\n\n/** @public */\nexport const GITHUB_ACTIONS_ANNOTATION = 'github.com/project-slug';\n\nexport const getProjectNameFromEntity = (entity: Entity) =>\n entity?.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION] ?? '';\n"],"names":[],"mappings":"AAmBO,MAAM,yBAA4B,GAAA;AAElC,MAAM,2BAA2B,CAAC,MAAA,KACvC,QAAQ,QAAS,CAAA,WAAA,GAAc,yBAAyB,CAAK,IAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWorkflowRuns.esm.js","sources":["../../src/components/useWorkflowRuns.ts"],"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 { useState } from 'react';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { githubActionsApiRef } from '../api/GithubActionsApi';\nimport { useApi, errorApiRef } from '@backstage/core-plugin-api';\nimport { Branch } from '../api';\n\nexport type WorkflowRun = {\n workflowName?: string;\n id: string;\n message?: string;\n url?: string;\n githubUrl?: string;\n source: {\n branchName?: string;\n commit: {\n hash?: string;\n url?: string;\n };\n };\n status?: string;\n conclusion?: string;\n onReRunClick: () => void;\n};\n\nexport function useWorkflowRuns({\n hostname,\n owner,\n repo,\n branch,\n initialPageSize = 6,\n}: {\n hostname?: string;\n owner: string;\n repo: string;\n branch?: string | undefined;\n initialPageSize?: number;\n}) {\n const api = useApi(githubActionsApiRef);\n\n const errorApi = useApi(errorApiRef);\n\n const [total, setTotal] = useState(0);\n const [page, setPage] = useState(0);\n const [pageSize, setPageSize] = useState(initialPageSize);\n const [branches, setBranches] = useState<Branch[]>([]);\n const [defaultBranch, setDefaultBranch] = useState<string>('');\n\n const {\n loading,\n value: runs,\n retry,\n error,\n } = useAsyncRetry<WorkflowRun[]>(async () => {\n const fetchedDefaultBranch = await api.getDefaultBranch({\n hostname,\n owner,\n repo,\n });\n\n setDefaultBranch(fetchedDefaultBranch);\n let selectedBranch = branch;\n if (branch === 'default') {\n selectedBranch = fetchedDefaultBranch;\n }\n\n const fetchBranches = async () => {\n let next = true;\n let iteratePage = 0;\n const branchSet: Branch[] = [];\n\n while (next) {\n const branchesData = await api.listBranches({\n hostname,\n owner,\n repo,\n page: iteratePage,\n });\n if (branchesData.length === 0) {\n next = false;\n }\n iteratePage++;\n branchSet.push(...branchesData);\n }\n\n return branchSet;\n };\n\n const branchSet = await fetchBranches();\n setBranches(branchSet);\n\n // GitHub API pagination count starts from 1\n const workflowRunsData = await api.listWorkflowRuns({\n hostname,\n owner,\n repo,\n pageSize,\n page: page + 1,\n branch: selectedBranch,\n });\n setTotal(workflowRunsData.total_count);\n // Transformation here\n return workflowRunsData.workflow_runs.map(run => ({\n workflowName: run.name ?? undefined,\n message: run.head_commit?.message,\n id: `${run.id}`,\n onReRunClick: async () => {\n try {\n await api.reRunWorkflow({\n hostname,\n owner,\n repo,\n runId: run.id,\n });\n } catch (e) {\n errorApi.post(\n new Error(`Failed to rerun the workflow: ${(e as Error).message}`),\n );\n }\n },\n source: {\n branchName: run.head_branch ?? undefined,\n commit: {\n hash: run.head_commit?.id,\n url: run.head_repository?.branches_url?.replace(\n '{/branch}',\n run.head_branch ?? '',\n ),\n },\n },\n status: run.status ?? undefined,\n conclusion: run.conclusion ?? undefined,\n url: run.url,\n githubUrl: run.html_url,\n }));\n }, [page, pageSize, repo, owner]);\n\n return [\n {\n page,\n pageSize,\n loading,\n runs,\n branches,\n defaultBranch,\n projectName: `${owner}/${repo}`,\n total,\n error,\n },\n {\n runs,\n setPage,\n setPageSize,\n retry,\n },\n ] as const;\n}\n"],"names":["branchSet"],"mappings":";;;;;AAuCO,SAAS,eAAgB,CAAA;AAAA,EAC9B,QAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AAAA,EACA,eAAkB,GAAA
|
|
1
|
+
{"version":3,"file":"useWorkflowRuns.esm.js","sources":["../../src/components/useWorkflowRuns.ts"],"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 { useState } from 'react';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { githubActionsApiRef } from '../api/GithubActionsApi';\nimport { useApi, errorApiRef } from '@backstage/core-plugin-api';\nimport { Branch } from '../api';\n\nexport type WorkflowRun = {\n workflowName?: string;\n id: string;\n message?: string;\n url?: string;\n githubUrl?: string;\n source: {\n branchName?: string;\n commit: {\n hash?: string;\n url?: string;\n };\n };\n status?: string;\n conclusion?: string;\n onReRunClick: () => void;\n};\n\nexport function useWorkflowRuns({\n hostname,\n owner,\n repo,\n branch,\n initialPageSize = 6,\n}: {\n hostname?: string;\n owner: string;\n repo: string;\n branch?: string | undefined;\n initialPageSize?: number;\n}) {\n const api = useApi(githubActionsApiRef);\n\n const errorApi = useApi(errorApiRef);\n\n const [total, setTotal] = useState(0);\n const [page, setPage] = useState(0);\n const [pageSize, setPageSize] = useState(initialPageSize);\n const [branches, setBranches] = useState<Branch[]>([]);\n const [defaultBranch, setDefaultBranch] = useState<string>('');\n\n const {\n loading,\n value: runs,\n retry,\n error,\n } = useAsyncRetry<WorkflowRun[]>(async () => {\n const fetchedDefaultBranch = await api.getDefaultBranch({\n hostname,\n owner,\n repo,\n });\n\n setDefaultBranch(fetchedDefaultBranch);\n let selectedBranch = branch;\n if (branch === 'default') {\n selectedBranch = fetchedDefaultBranch;\n }\n\n const fetchBranches = async () => {\n let next = true;\n let iteratePage = 0;\n const branchSet: Branch[] = [];\n\n while (next) {\n const branchesData = await api.listBranches({\n hostname,\n owner,\n repo,\n page: iteratePage,\n });\n if (branchesData.length === 0) {\n next = false;\n }\n iteratePage++;\n branchSet.push(...branchesData);\n }\n\n return branchSet;\n };\n\n const branchSet = await fetchBranches();\n setBranches(branchSet);\n\n // GitHub API pagination count starts from 1\n const workflowRunsData = await api.listWorkflowRuns({\n hostname,\n owner,\n repo,\n pageSize,\n page: page + 1,\n branch: selectedBranch,\n });\n setTotal(workflowRunsData.total_count);\n // Transformation here\n return workflowRunsData.workflow_runs.map(run => ({\n workflowName: run.name ?? undefined,\n message: run.head_commit?.message,\n id: `${run.id}`,\n onReRunClick: async () => {\n try {\n await api.reRunWorkflow({\n hostname,\n owner,\n repo,\n runId: run.id,\n });\n } catch (e) {\n errorApi.post(\n new Error(`Failed to rerun the workflow: ${(e as Error).message}`),\n );\n }\n },\n source: {\n branchName: run.head_branch ?? undefined,\n commit: {\n hash: run.head_commit?.id,\n url: run.head_repository?.branches_url?.replace(\n '{/branch}',\n run.head_branch ?? '',\n ),\n },\n },\n status: run.status ?? undefined,\n conclusion: run.conclusion ?? undefined,\n url: run.url,\n githubUrl: run.html_url,\n }));\n }, [page, pageSize, repo, owner]);\n\n return [\n {\n page,\n pageSize,\n loading,\n runs,\n branches,\n defaultBranch,\n projectName: `${owner}/${repo}`,\n total,\n error,\n },\n {\n runs,\n setPage,\n setPageSize,\n retry,\n },\n ] as const;\n}\n"],"names":["branchSet"],"mappings":";;;;;AAuCO,SAAS,eAAgB,CAAA;AAAA,EAC9B,QAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AAAA,EACA,eAAkB,GAAA;AACpB,CAMG,EAAA;AACD,EAAM,MAAA,GAAA,GAAM,OAAO,mBAAmB,CAAA;AAEtC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AAEnC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,CAAC,CAAA;AACpC,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,CAAC,CAAA;AAClC,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAS,eAAe,CAAA;AACxD,EAAA,MAAM,CAAC,QAAU,EAAA,WAAW,CAAI,GAAA,QAAA,CAAmB,EAAE,CAAA;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,KAAK,CAAC,CAAA;AAEhC,EAAO,OAAA;AAAA,IACL;AAAA,MACE,IAAA;AAAA,MACA,QAAA;AAAA,MACA,OAAA;AAAA,MACA,IAAA;AAAA,MACA,QAAA;AAAA,MACA,aAAA;AAAA,MACA,WAAa,EAAA,CAAA,EAAG,KAAK,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAAA,MAC7B,KAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA;AAAA,MACE,IAAA;AAAA,MACA,OAAA;AAAA,MACA,WAAA;AAAA,MACA;AAAA;AACF,GACF;AACF;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import * as
|
|
3
|
-
import { InfoCardVariants } from '@backstage/core-components';
|
|
2
|
+
import * as _backstage_core_components_index from '@backstage/core-components/index';
|
|
4
3
|
import * as react from 'react';
|
|
5
4
|
import react__default from 'react';
|
|
6
5
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
7
6
|
import { ConfigApi } from '@backstage/core-plugin-api';
|
|
7
|
+
import * as _backstage_core_plugin_api_index from '@backstage/core-plugin-api/index';
|
|
8
8
|
import { RestEndpointMethodTypes } from '@octokit/rest';
|
|
9
9
|
import { ScmAuthApi } from '@backstage/integration-react';
|
|
10
10
|
import { Entity } from '@backstage/catalog-model';
|
|
11
|
+
import { InfoCardVariants } from '@backstage/core-components';
|
|
11
12
|
|
|
12
13
|
/** @public */
|
|
13
|
-
declare const githubActionsApiRef:
|
|
14
|
+
declare const githubActionsApiRef: _backstage_core_plugin_api_index.ApiRef<GithubActionsApi>;
|
|
14
15
|
/**
|
|
15
16
|
* A client for fetching information about GitHub actions.
|
|
16
17
|
*
|
|
@@ -191,19 +192,19 @@ declare const EntityGithubActionsContent: (props: RouterProps) => react.JSX.Elem
|
|
|
191
192
|
/** @public */
|
|
192
193
|
declare const EntityLatestGithubActionRunCard: (props: {
|
|
193
194
|
branch?: string | undefined;
|
|
194
|
-
variant?:
|
|
195
|
+
variant?: _backstage_core_components_index.InfoCardVariants | undefined;
|
|
195
196
|
}) => react.JSX.Element;
|
|
196
197
|
/** @public */
|
|
197
198
|
declare const EntityLatestGithubActionsForBranchCard: (props: {
|
|
198
199
|
branch?: string | undefined;
|
|
199
|
-
variant?:
|
|
200
|
+
variant?: _backstage_core_components_index.InfoCardVariants | undefined;
|
|
200
201
|
}) => react.JSX.Element;
|
|
201
202
|
/** @public */
|
|
202
203
|
declare const EntityRecentGithubActionsRunsCard: (props: {
|
|
203
204
|
branch?: string | undefined;
|
|
204
205
|
dense?: boolean | undefined;
|
|
205
206
|
limit?: number | undefined;
|
|
206
|
-
variant?:
|
|
207
|
+
variant?: _backstage_core_components_index.InfoCardVariants | undefined;
|
|
207
208
|
}) => react.JSX.Element;
|
|
208
209
|
|
|
209
210
|
/** @public */
|
package/dist/plugin.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"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 { githubActionsApiRef, GithubActionsClient } from './api';\nimport { rootRouteRef } from './routes';\nimport {\n configApiRef,\n createPlugin,\n createApiFactory,\n createRoutableExtension,\n createComponentExtension,\n} from '@backstage/core-plugin-api';\nimport { scmAuthApiRef } from '@backstage/integration-react';\n\n/** @public */\nexport const githubActionsPlugin = createPlugin({\n id: 'github-actions',\n apis: [\n createApiFactory({\n api: githubActionsApiRef,\n deps: { configApi: configApiRef, scmAuthApi: scmAuthApiRef },\n factory: ({ configApi, scmAuthApi }) =>\n new GithubActionsClient({ configApi, scmAuthApi }),\n }),\n ],\n routes: {\n entityContent: rootRouteRef,\n },\n});\n\n/** @public */\nexport const EntityGithubActionsContent = githubActionsPlugin.provide(\n createRoutableExtension({\n name: 'EntityGithubActionsContent',\n component: () => import('./components/Router').then(m => m.Router),\n mountPoint: rootRouteRef,\n }),\n);\n\n/** @public */\nexport const EntityLatestGithubActionRunCard = githubActionsPlugin.provide(\n createComponentExtension({\n name: 'EntityLatestGithubActionRunCard',\n component: {\n lazy: () =>\n import('./components/Cards').then(m => m.LatestWorkflowRunCard),\n },\n }),\n);\n\n/** @public */\nexport const EntityLatestGithubActionsForBranchCard =\n githubActionsPlugin.provide(\n createComponentExtension({\n name: 'EntityLatestGithubActionsForBranchCard',\n component: {\n lazy: () =>\n import('./components/Cards').then(\n m => m.LatestWorkflowsForBranchCard,\n ),\n },\n }),\n );\n\n/** @public */\nexport const EntityRecentGithubActionsRunsCard = githubActionsPlugin.provide(\n createComponentExtension({\n name: 'EntityRecentGithubActionsRunsCard',\n component: {\n lazy: () =>\n import('./components/Cards').then(m => m.RecentWorkflowRunsCard),\n },\n }),\n);\n"],"names":[],"mappings":";;;;;;AA4BO,MAAM,sBAAsB,YAAa,CAAA;AAAA,EAC9C,EAAI,EAAA,gBAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,mBAAA;AAAA,MACL,IAAM,EAAA,EAAE,SAAW,EAAA,YAAA,EAAc,YAAY,aAAc,EAAA;AAAA,MAC3D,OAAA,EAAS,CAAC,EAAE,SAAW,EAAA,UAAA,EACrB,KAAA,IAAI,mBAAoB,CAAA,EAAE,SAAW,EAAA,UAAA,EAAY
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"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 { githubActionsApiRef, GithubActionsClient } from './api';\nimport { rootRouteRef } from './routes';\nimport {\n configApiRef,\n createPlugin,\n createApiFactory,\n createRoutableExtension,\n createComponentExtension,\n} from '@backstage/core-plugin-api';\nimport { scmAuthApiRef } from '@backstage/integration-react';\n\n/** @public */\nexport const githubActionsPlugin = createPlugin({\n id: 'github-actions',\n apis: [\n createApiFactory({\n api: githubActionsApiRef,\n deps: { configApi: configApiRef, scmAuthApi: scmAuthApiRef },\n factory: ({ configApi, scmAuthApi }) =>\n new GithubActionsClient({ configApi, scmAuthApi }),\n }),\n ],\n routes: {\n entityContent: rootRouteRef,\n },\n});\n\n/** @public */\nexport const EntityGithubActionsContent = githubActionsPlugin.provide(\n createRoutableExtension({\n name: 'EntityGithubActionsContent',\n component: () => import('./components/Router').then(m => m.Router),\n mountPoint: rootRouteRef,\n }),\n);\n\n/** @public */\nexport const EntityLatestGithubActionRunCard = githubActionsPlugin.provide(\n createComponentExtension({\n name: 'EntityLatestGithubActionRunCard',\n component: {\n lazy: () =>\n import('./components/Cards').then(m => m.LatestWorkflowRunCard),\n },\n }),\n);\n\n/** @public */\nexport const EntityLatestGithubActionsForBranchCard =\n githubActionsPlugin.provide(\n createComponentExtension({\n name: 'EntityLatestGithubActionsForBranchCard',\n component: {\n lazy: () =>\n import('./components/Cards').then(\n m => m.LatestWorkflowsForBranchCard,\n ),\n },\n }),\n );\n\n/** @public */\nexport const EntityRecentGithubActionsRunsCard = githubActionsPlugin.provide(\n createComponentExtension({\n name: 'EntityRecentGithubActionsRunsCard',\n component: {\n lazy: () =>\n import('./components/Cards').then(m => m.RecentWorkflowRunsCard),\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,CAAA;AAAA,IACvB,IAAM,EAAA,mCAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,iCAAoB,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,sBAAsB;AAAA;AACnE,GACD;AACH;;;;"}
|
package/dist/routes.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"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 { createRouteRef, createSubRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'github-actions',\n});\n\nexport const buildRouteRef = createSubRouteRef({\n id: 'github-actions/build',\n path: '/:id',\n parent: rootRouteRef,\n});\n"],"names":[],"mappings":";;AAkBO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA
|
|
1
|
+
{"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"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 { createRouteRef, createSubRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'github-actions',\n});\n\nexport const buildRouteRef = createSubRouteRef({\n id: 'github-actions/build',\n path: '/:id',\n parent: rootRouteRef,\n});\n"],"names":[],"mappings":";;AAkBO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA;AACN,CAAC;AAEM,MAAM,gBAAgB,iBAAkB,CAAA;AAAA,EAC7C,EAAI,EAAA,sBAAA;AAAA,EACJ,IAAM,EAAA,MAAA;AAAA,EACN,MAAQ,EAAA;AACV,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-github-actions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "A Backstage plugin that integrates towards GitHub Actions",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -26,6 +26,16 @@
|
|
|
26
26
|
},
|
|
27
27
|
"./package.json": "./package.json"
|
|
28
28
|
},
|
|
29
|
+
"typesVersions": {
|
|
30
|
+
"*": {
|
|
31
|
+
"index": [
|
|
32
|
+
"dist/index.d.ts"
|
|
33
|
+
],
|
|
34
|
+
"alpha": [
|
|
35
|
+
"dist/alpha.d.ts"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
29
39
|
"keywords": [
|
|
30
40
|
"backstage",
|
|
31
41
|
"github",
|
|
@@ -42,8 +52,7 @@
|
|
|
42
52
|
"main": "./dist/index.esm.js",
|
|
43
53
|
"types": "./dist/index.d.ts",
|
|
44
54
|
"files": [
|
|
45
|
-
"dist"
|
|
46
|
-
"alpha"
|
|
55
|
+
"dist"
|
|
47
56
|
],
|
|
48
57
|
"scripts": {
|
|
49
58
|
"build": "backstage-cli package build",
|
|
@@ -55,14 +64,14 @@
|
|
|
55
64
|
"test": "backstage-cli package test"
|
|
56
65
|
},
|
|
57
66
|
"dependencies": {
|
|
58
|
-
"@backstage/catalog-model": "^1.7.
|
|
59
|
-
"@backstage/core-compat-api": "^0.3.
|
|
60
|
-
"@backstage/core-components": "^0.
|
|
61
|
-
"@backstage/core-plugin-api": "^1.10.
|
|
62
|
-
"@backstage/frontend-plugin-api": "^0.9.
|
|
63
|
-
"@backstage/integration": "^1.
|
|
64
|
-
"@backstage/integration-react": "^1.2.
|
|
65
|
-
"@backstage/plugin-catalog-react": "^1.
|
|
67
|
+
"@backstage/catalog-model": "^1.7.3",
|
|
68
|
+
"@backstage/core-compat-api": "^0.3.5",
|
|
69
|
+
"@backstage/core-components": "^0.16.3",
|
|
70
|
+
"@backstage/core-plugin-api": "^1.10.3",
|
|
71
|
+
"@backstage/frontend-plugin-api": "^0.9.4",
|
|
72
|
+
"@backstage/integration": "^1.16.1",
|
|
73
|
+
"@backstage/integration-react": "^1.2.3",
|
|
74
|
+
"@backstage/plugin-catalog-react": "^1.15.1",
|
|
66
75
|
"@material-ui/core": "^4.12.2",
|
|
67
76
|
"@material-ui/icons": "^4.9.1",
|
|
68
77
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
@@ -73,11 +82,11 @@
|
|
|
73
82
|
"react-use": "^17.2.4"
|
|
74
83
|
},
|
|
75
84
|
"devDependencies": {
|
|
76
|
-
"@backstage/cli": "^0.
|
|
77
|
-
"@backstage/core-app-api": "^1.15.
|
|
78
|
-
"@backstage/dev-utils": "^1.1.
|
|
79
|
-
"@backstage/frontend-test-utils": "^0.2.
|
|
80
|
-
"@backstage/test-utils": "^1.7.
|
|
85
|
+
"@backstage/cli": "^0.29.5",
|
|
86
|
+
"@backstage/core-app-api": "^1.15.4",
|
|
87
|
+
"@backstage/dev-utils": "^1.1.6",
|
|
88
|
+
"@backstage/frontend-test-utils": "^0.2.5",
|
|
89
|
+
"@backstage/test-utils": "^1.7.4",
|
|
81
90
|
"@testing-library/dom": "^10.0.0",
|
|
82
91
|
"@testing-library/jest-dom": "^6.0.0",
|
|
83
92
|
"@testing-library/react": "^15.0.0",
|