@backstage/plugin-catalog 2.0.6-next.1 → 2.0.6
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 +26 -0
- package/dist/alpha/plugin.esm.js +1 -1
- package/dist/alpha/plugin.esm.js.map +1 -1
- package/dist/alpha.d.ts +6 -6
- package/dist/components/CatalogExportButton/CatalogExportButton.esm.js +12 -3
- package/dist/components/CatalogExportButton/CatalogExportButton.esm.js.map +1 -1
- package/dist/components/CatalogPage/DefaultCatalogPage.esm.js +16 -11
- package/dist/components/CatalogPage/DefaultCatalogPage.esm.js.map +1 -1
- package/dist/components/CatalogPage/DefaultCatalogPage.module.css.esm.js +8 -0
- package/dist/components/CatalogPage/DefaultCatalogPage.module.css.esm.js.map +1 -0
- package/dist/components/EntityContextMenu/EntityContextMenu.esm.js +2 -2
- package/dist/components/EntityContextMenu/EntityContextMenu.esm.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js +29 -0
- package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js.map +1 -0
- package/dist/{package.json.esm.js → plugins/catalog/package.json.esm.js} +1 -1
- package/package.json +26 -26
- /package/dist/{package.json.esm.js.map → plugins/catalog/package.json.esm.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @backstage/plugin-catalog
|
|
2
2
|
|
|
3
|
+
## 2.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7172386: Updated the new frontend system Catalog index page to use the current Backstage UI page header and content container.
|
|
8
|
+
- d8757b1: The entity list provider now fetches the entity list and the total count as two separate parallel requests when using cursor or offset pagination. The list query skips the expensive count computation (using `totalItems: 'exclude'`), so the table populates immediately. The count arrives asynchronously and updates the title. A new `totalItemsLoading` field is exposed on `EntityListContextProps` so consumers can distinguish a stale count from a fresh one.
|
|
9
|
+
|
|
10
|
+
The catalog table now keeps stale rows visible during filter changes and page navigation instead of replacing the entire table body with a spinner. The full-table spinner is only shown on the very first load when no data exists yet. The entity count in the title is dimmed while the count is refreshing, and a small spinner appears next to the title while rows are loading.
|
|
11
|
+
|
|
12
|
+
- 82cf16f: Added `CatalogExportButton`, which adds CSV and JSON export support to the `CatalogIndexPage`.
|
|
13
|
+
- d7c1dcf: Fixed a missing React key warning for context menu items on the entity page.
|
|
14
|
+
- a07e6a3: Added the correctly-spelled `RelatedEntitiesCard.domainEntityColumns` static property and deprecated the previous typoed `RelatedEntitiesCard.domainEntityColums` property. Existing references to the old property continue to work; switch to `domainEntityColumns` to avoid future removal.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
- @backstage/catalog-client@1.16.0
|
|
17
|
+
- @backstage/plugin-catalog-react@3.1.0
|
|
18
|
+
- @backstage/core-components@0.18.11
|
|
19
|
+
- @backstage/plugin-search-react@1.11.5
|
|
20
|
+
- @backstage/frontend-plugin-api@0.17.2
|
|
21
|
+
- @backstage/ui@0.16.0
|
|
22
|
+
- @backstage/plugin-scaffolder-common@2.2.1
|
|
23
|
+
- @backstage/core-compat-api@0.5.12
|
|
24
|
+
- @backstage/core-plugin-api@1.12.7
|
|
25
|
+
- @backstage/integration-react@1.2.19
|
|
26
|
+
- @backstage/plugin-permission-react@0.5.2
|
|
27
|
+
- @backstage/plugin-techdocs-react@1.3.12
|
|
28
|
+
|
|
3
29
|
## 2.0.6-next.1
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/alpha/plugin.esm.js
CHANGED
|
@@ -17,7 +17,7 @@ var plugin = createFrontendPlugin({
|
|
|
17
17
|
title: "Catalog",
|
|
18
18
|
icon: /* @__PURE__ */ jsx(CategoryIcon, { fontSize: "inherit" }),
|
|
19
19
|
info: {
|
|
20
|
-
packageJson: () => import('../package.json.esm.js')
|
|
20
|
+
packageJson: () => import('../plugins/catalog/package.json.esm.js')
|
|
21
21
|
},
|
|
22
22
|
routes: {
|
|
23
23
|
catalogIndex: rootRouteRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../../src/alpha/plugin.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { createFrontendPlugin } from '@backstage/frontend-plugin-api';\nimport { entityRouteRef } from '@backstage/plugin-catalog-react';\nimport CategoryIcon from '@material-ui/icons/Category';\n\nimport {\n createComponentRouteRef,\n createFromTemplateRouteRef,\n rootRouteRef,\n unregisterRedirectRouteRef,\n viewTechDocRouteRef,\n} from '../routes';\n\nimport apis from './apis';\nimport pages from './pages';\nimport filters from './filters';\nimport entityCards from './entityCards';\nimport entityContents from './entityContents';\nimport entityIconLinks from './entityIconLinks';\nimport searchResultItems from './searchResultItems';\nimport contextMenuItems from './contextMenuItems';\n\n/** @alpha */\nexport default createFrontendPlugin({\n pluginId: 'catalog',\n title: 'Catalog',\n icon: <CategoryIcon fontSize=\"inherit\" />,\n info: {\n packageJson: () => import('../../package.json'),\n },\n routes: {\n catalogIndex: rootRouteRef,\n catalogEntity: entityRouteRef,\n },\n externalRoutes: {\n viewTechDoc: viewTechDocRouteRef,\n createComponent: createComponentRouteRef,\n createFromTemplate: createFromTemplateRouteRef,\n unregisterRedirect: unregisterRedirectRouteRef,\n },\n extensions: [\n ...apis,\n ...pages,\n ...filters,\n ...entityCards,\n ...entityContents,\n ...entityIconLinks,\n ...contextMenuItems,\n ...searchResultItems,\n ],\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAsCA,aAAe,oBAAA,CAAqB;AAAA,EAClC,QAAA,EAAU,SAAA;AAAA,EACV,KAAA,EAAO,SAAA;AAAA,EACP,IAAA,kBAAM,GAAA,CAAC,YAAA,EAAA,EAAa,QAAA,EAAS,SAAA,EAAU,CAAA;AAAA,EACvC,IAAA,EAAM;AAAA,IACJ,WAAA,EAAa,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../../src/alpha/plugin.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { createFrontendPlugin } from '@backstage/frontend-plugin-api';\nimport { entityRouteRef } from '@backstage/plugin-catalog-react';\nimport CategoryIcon from '@material-ui/icons/Category';\n\nimport {\n createComponentRouteRef,\n createFromTemplateRouteRef,\n rootRouteRef,\n unregisterRedirectRouteRef,\n viewTechDocRouteRef,\n} from '../routes';\n\nimport apis from './apis';\nimport pages from './pages';\nimport filters from './filters';\nimport entityCards from './entityCards';\nimport entityContents from './entityContents';\nimport entityIconLinks from './entityIconLinks';\nimport searchResultItems from './searchResultItems';\nimport contextMenuItems from './contextMenuItems';\n\n/** @alpha */\nexport default createFrontendPlugin({\n pluginId: 'catalog',\n title: 'Catalog',\n icon: <CategoryIcon fontSize=\"inherit\" />,\n info: {\n packageJson: () => import('../../package.json'),\n },\n routes: {\n catalogIndex: rootRouteRef,\n catalogEntity: entityRouteRef,\n },\n externalRoutes: {\n viewTechDoc: viewTechDocRouteRef,\n createComponent: createComponentRouteRef,\n createFromTemplate: createFromTemplateRouteRef,\n unregisterRedirect: unregisterRedirectRouteRef,\n },\n extensions: [\n ...apis,\n ...pages,\n ...filters,\n ...entityCards,\n ...entityContents,\n ...entityIconLinks,\n ...contextMenuItems,\n ...searchResultItems,\n ],\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAsCA,aAAe,oBAAA,CAAqB;AAAA,EAClC,QAAA,EAAU,SAAA;AAAA,EACV,KAAA,EAAO,SAAA;AAAA,EACP,IAAA,kBAAM,GAAA,CAAC,YAAA,EAAA,EAAa,QAAA,EAAS,SAAA,EAAU,CAAA;AAAA,EACvC,IAAA,EAAM;AAAA,IACJ,WAAA,EAAa,MAAM,OAAO,wCAAoB;AAAA,GAChD;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,YAAA,EAAc,YAAA;AAAA,IACd,aAAA,EAAe;AAAA,GACjB;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,WAAA,EAAa,mBAAA;AAAA,IACb,eAAA,EAAiB,uBAAA;AAAA,IACjB,kBAAA,EAAoB,0BAAA;AAAA,IACpB,kBAAA,EAAoB;AAAA,GACtB;AAAA,EACA,UAAA,EAAY;AAAA,IACV,GAAG,IAAA;AAAA,IACH,GAAG,KAAA;AAAA,IACH,GAAG,OAAA;AAAA,IACH,GAAG,WAAA;AAAA,IACH,GAAG,cAAA;AAAA,IACH,GAAG,eAAA;AAAA,IACH,GAAG,gBAAA;AAAA,IACH,GAAG;AAAA;AAEP,CAAC,CAAA;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -767,13 +767,9 @@ declare const catalogTranslationRef: _backstage_frontend_plugin_api.TranslationR
|
|
|
767
767
|
readonly "deleteEntity.deleteButtonTitle": "Delete";
|
|
768
768
|
readonly "deleteEntity.dialogTitle": "Are you sure you want to delete this entity?";
|
|
769
769
|
readonly "deleteEntity.actionButtonTitle": "Delete entity";
|
|
770
|
-
readonly "indexPage.title": "{{orgName}} Catalog";
|
|
771
|
-
readonly "indexPage.createButtonTitle": "Create";
|
|
772
|
-
readonly "indexPage.supportButtonContent": "All your software catalog entities";
|
|
773
|
-
readonly "entityPage.notFoundMessage": "There is no {{kind}} with the requested {{link}}.";
|
|
774
|
-
readonly "entityPage.notFoundLinkText": "kind, namespace, and name";
|
|
775
770
|
readonly "aboutCard.title": "About";
|
|
776
771
|
readonly "aboutCard.unknown": "unknown";
|
|
772
|
+
readonly "aboutCard.viewTechdocs": "View TechDocs";
|
|
777
773
|
readonly "aboutCard.refreshButtonTitle": "Schedule entity refresh";
|
|
778
774
|
readonly "aboutCard.editButtonTitle": "Edit Metadata";
|
|
779
775
|
readonly "aboutCard.editButtonAriaLabel": "Edit";
|
|
@@ -781,7 +777,6 @@ declare const catalogTranslationRef: _backstage_frontend_plugin_api.TranslationR
|
|
|
781
777
|
readonly "aboutCard.refreshScheduledMessage": "Refresh scheduled";
|
|
782
778
|
readonly "aboutCard.refreshButtonAriaLabel": "Refresh";
|
|
783
779
|
readonly "aboutCard.launchTemplate": "Launch Template";
|
|
784
|
-
readonly "aboutCard.viewTechdocs": "View TechDocs";
|
|
785
780
|
readonly "aboutCard.viewSource": "View Source";
|
|
786
781
|
readonly "aboutCard.descriptionField.value": "No description";
|
|
787
782
|
readonly "aboutCard.descriptionField.label": "Description";
|
|
@@ -799,6 +794,11 @@ declare const catalogTranslationRef: _backstage_frontend_plugin_api.TranslationR
|
|
|
799
794
|
readonly "aboutCard.tagsField.value": "No Tags";
|
|
800
795
|
readonly "aboutCard.tagsField.label": "Tags";
|
|
801
796
|
readonly "aboutCard.targetsField.label": "Targets";
|
|
797
|
+
readonly "indexPage.title": "{{orgName}} Catalog";
|
|
798
|
+
readonly "indexPage.createButtonTitle": "Create";
|
|
799
|
+
readonly "indexPage.supportButtonContent": "All your software catalog entities";
|
|
800
|
+
readonly "entityPage.notFoundMessage": "There is no {{kind}} with the requested {{link}}.";
|
|
801
|
+
readonly "entityPage.notFoundLinkText": "kind, namespace, and name";
|
|
802
802
|
readonly "searchResultItem.type": "Type";
|
|
803
803
|
readonly "searchResultItem.kind": "Kind";
|
|
804
804
|
readonly "searchResultItem.owner": "Owner";
|
|
@@ -4,7 +4,7 @@ import { RiDownloadLine } from '@remixicon/react';
|
|
|
4
4
|
import { useApiHolder } from '@backstage/core-plugin-api';
|
|
5
5
|
import { useTranslationRef, toastApiRef } from '@backstage/frontend-plugin-api';
|
|
6
6
|
import { catalogTranslationRef } from '../../alpha/translation.esm.js';
|
|
7
|
-
import { Button, Dialog, DialogHeader, DialogBody, Flex, Select, Text, Checkbox, DialogFooter } from '@backstage/ui';
|
|
7
|
+
import { ButtonIcon, Button, Dialog, DialogHeader, DialogBody, Flex, Select, Text, Checkbox, DialogFooter } from '@backstage/ui';
|
|
8
8
|
import { useStreamingExport } from './file-download/useStreamingExport.esm.js';
|
|
9
9
|
import { getColumnTitle } from './file-download/serializeEntities.esm.js';
|
|
10
10
|
|
|
@@ -20,7 +20,8 @@ const DEFAULT_EXPORT_COLUMNS = [
|
|
|
20
20
|
{ entityFilterKey: "metadata.description", title: "Description" }
|
|
21
21
|
];
|
|
22
22
|
const CatalogExportButton = ({
|
|
23
|
-
settings
|
|
23
|
+
settings,
|
|
24
|
+
iconOnly = false
|
|
24
25
|
}) => {
|
|
25
26
|
const { t } = useTranslationRef(catalogTranslationRef);
|
|
26
27
|
const { exportStream, loading, error } = useStreamingExport();
|
|
@@ -107,7 +108,15 @@ const CatalogExportButton = ({
|
|
|
107
108
|
});
|
|
108
109
|
}, [exportFormat, exportStream, selectedColumns, exporters]);
|
|
109
110
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
110
|
-
/* @__PURE__ */ jsx(
|
|
111
|
+
iconOnly ? /* @__PURE__ */ jsx(
|
|
112
|
+
ButtonIcon,
|
|
113
|
+
{
|
|
114
|
+
variant: "secondary",
|
|
115
|
+
icon: /* @__PURE__ */ jsx(RiDownloadLine, {}),
|
|
116
|
+
"aria-label": t("catalogExportButton.triggerButtonTitle"),
|
|
117
|
+
onPress: handleOpenDialog
|
|
118
|
+
}
|
|
119
|
+
) : /* @__PURE__ */ jsx(
|
|
111
120
|
Button,
|
|
112
121
|
{
|
|
113
122
|
variant: "secondary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CatalogExportButton.esm.js","sources":["../../../src/components/CatalogExportButton/CatalogExportButton.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 { useCallback, useEffect, useState } from 'react';\nimport { RiDownloadLine } from '@remixicon/react';\nimport { useApiHolder } from '@backstage/core-plugin-api';\nimport { useTranslationRef, toastApiRef } from '@backstage/frontend-plugin-api';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport {\n Button,\n Checkbox,\n Dialog,\n DialogBody,\n DialogFooter,\n DialogHeader,\n Flex,\n Select,\n Text,\n} from '@backstage/ui';\nimport { useStreamingExport } from './file-download';\nimport type { CatalogExportSettingsColumn } from './file-download/serializeEntities';\nimport { getColumnTitle } from './file-download/serializeEntities';\nimport type { CatalogExporter } from './file-download/useStreamingExport';\n\n/**\n * Custom exporter configuration for a catalog export format.\n * @public\n */\nexport interface CatalogExporterConfig {\n /** The exporter function that generates the export content. */\n exporter: CatalogExporter;\n /** Optional display label shown in the format selector. Defaults to the format key in uppercase. */\n label?: string;\n}\n\n/**\n * Settings for configuring the catalog export functionality.\n *\n * @public\n */\nexport interface CatalogExportSettings {\n /**\n * When true, displays the export button in the catalog interface.\n * Defaults to false if not specified.\n */\n enabled?: boolean;\n\n /**\n * Custom columns to include in the export.\n * Each column specifies an entity field path and a display title.\n * If not specified, uses default columns: Name, Type, Owner, Description.\n */\n columns?: CatalogExportSettingsColumn[];\n\n /**\n * Map of custom export format handlers beyond the built-in CSV and JSON formats.\n * Key is the format name (e.g., 'xml', 'yaml'), value is the exporter configuration.\n * Custom formats will appear as options in the export dialog.\n */\n exporters?: Record<string, CatalogExporterConfig>;\n\n /**\n * When true, hides the built-in CSV and JSON export options from the dialog.\n * Useful when only custom exporters should be available.\n */\n disableBuiltinExporters?: boolean;\n\n /**\n * Callback function invoked when the export completes successfully.\n * Useful for showing notifications or performing post-export actions.\n */\n onSuccess?: () => void;\n\n /**\n * Callback function invoked when the export fails.\n * Receives an object containing the error for custom error handling.\n */\n onError?: (options: { error: Error }) => void;\n}\n\n/**\n * The available export formats for the catalog export.\n * Currently supports CSV and JSON.\n *\n * @public\n */\nexport enum CatalogExportType {\n CSV = 'csv',\n JSON = 'json',\n}\n\n/**\n * The available default export columns for the catalog export.\n * These can be overridden by providing custom columns in the export button options.\n *\n * @private\n */\nconst DEFAULT_EXPORT_COLUMNS = [\n { entityFilterKey: 'metadata.name', title: 'Name' },\n { entityFilterKey: 'spec.type', title: 'Type' },\n { entityFilterKey: 'spec.owner', title: 'Owner' },\n { entityFilterKey: 'metadata.description', title: 'Description' },\n];\n\n/**\n * A button that opens a dialog to export the current catalog selection.\n *\n * @param settings - Optional export configuration settings including columns, custom exporters, and callbacks\n * @public\n */\nexport const CatalogExportButton = ({\n settings,\n}: {\n settings?: CatalogExportSettings;\n}) => {\n const { t } = useTranslationRef(catalogTranslationRef);\n const { exportStream, loading, error } = useStreamingExport();\n const [open, setOpen] = useState(false);\n const exporters = settings?.exporters;\n const disableBuiltinExporters = settings?.disableBuiltinExporters;\n const onSuccess = settings?.onSuccess;\n const onError = settings?.onError;\n const apis = useApiHolder();\n const toastApi = apis.get(toastApiRef)!;\n const [isExporting, setIsExporting] = useState(false);\n\n const effectiveColumns = settings?.columns ?? DEFAULT_EXPORT_COLUMNS;\n\n const allExportOptions = [\n ...(disableBuiltinExporters\n ? []\n : Object.values(CatalogExportType).map(format => ({\n value: format,\n label: format.toUpperCase(),\n }))),\n ...Object.entries(exporters ?? {}).map(([key, exporter]) => ({\n value: key,\n label: exporter.label ?? key.toUpperCase(),\n })),\n ];\n\n const [exportFormat, setExportFormat] = useState<string>(\n allExportOptions[0]?.value ?? '',\n );\n const [selectedColumnTitles, setSelectedColumnTitles] = useState<Set<string>>(\n () => new Set(effectiveColumns.map(c => getColumnTitle(c))),\n );\n const selectedColumns = effectiveColumns.filter(c =>\n selectedColumnTitles.has(getColumnTitle(c)),\n );\n\n const handleOpenDialog = () => {\n setSelectedColumnTitles(\n new Set(effectiveColumns.map(c => getColumnTitle(c))),\n );\n setOpen(true);\n };\n\n const toggleColumn = (title: string) => {\n setSelectedColumnTitles(prev => {\n const next = new Set(prev);\n if (next.has(title)) {\n next.delete(title);\n } else {\n next.add(title);\n }\n return next;\n });\n };\n\n useEffect(() => {\n if (isExporting && !loading) {\n if (error) {\n if (onError) {\n onError({ error });\n } else {\n toastApi.post({\n title: t('catalogExportButton.errorMessage', {\n errorMessage: error.message,\n }),\n status: 'danger',\n });\n }\n } else {\n if (onSuccess) {\n onSuccess();\n } else {\n toastApi.post({\n title: t('catalogExportButton.successMessage'),\n status: 'success',\n });\n }\n }\n setOpen(false);\n setIsExporting(false);\n }\n }, [isExporting, loading, error, toastApi, onSuccess, onError, t]);\n\n const handleExport = useCallback(async () => {\n setIsExporting(true);\n const exporterFn = exporters?.[exportFormat];\n await exportStream({\n exportFormat,\n filename: `catalog-export.${exportFormat}`,\n columns: selectedColumns,\n exporter: exporterFn?.exporter,\n });\n }, [exportFormat, exportStream, selectedColumns, exporters]);\n\n return (\n <>\n <Button\n variant=\"secondary\"\n iconStart={<RiDownloadLine />}\n onPress={handleOpenDialog}\n >\n {t('catalogExportButton.triggerButtonTitle')}\n </Button>\n\n <Dialog isOpen={open} onOpenChange={isOpen => !isOpen && setOpen(false)}>\n <DialogHeader>{t('catalogExportButton.dialogTitle')}</DialogHeader>\n <DialogBody>\n <Flex direction=\"column\" gap=\"4\">\n <Select\n data-testid=\"format-select\"\n label={t('catalogExportButton.formatLabel')}\n options={allExportOptions}\n value={exportFormat}\n onChange={key => setExportFormat(key as string)}\n />\n <Flex direction=\"column\" gap=\"1\">\n <Text variant=\"body-small\" weight=\"bold\">\n {t('catalogExportButton.columnsLabel')}\n </Text>\n {effectiveColumns.map(col => (\n <Checkbox\n key={col.entityFilterKey}\n isSelected={selectedColumnTitles.has(getColumnTitle(col))}\n onChange={() => toggleColumn(getColumnTitle(col))}\n >\n {getColumnTitle(col)}\n </Checkbox>\n ))}\n </Flex>\n </Flex>\n </DialogBody>\n <DialogFooter>\n <Button variant=\"secondary\" onPress={() => setOpen(false)}>\n {t('catalogExportButton.cancelButtonTitle')}\n </Button>\n <Button\n variant=\"primary\"\n onPress={() => handleExport()}\n isDisabled={\n !exportFormat || loading || selectedColumns.length === 0\n }\n loading={loading}\n >\n {loading\n ? t('catalogExportButton.exportingButtonTitle')\n : t('catalogExportButton.confirmButtonTitle')}\n </Button>\n </DialogFooter>\n </Dialog>\n </>\n );\n};\n"],"names":["CatalogExportType"],"mappings":";;;;;;;;;;AAkGO,IAAK,iBAAA,qBAAAA,kBAAAA,KAAL;AACL,EAAAA,mBAAA,KAAA,CAAA,GAAM,KAAA;AACN,EAAAA,mBAAA,MAAA,CAAA,GAAO,MAAA;AAFG,EAAA,OAAAA,kBAAAA;AAAA,CAAA,EAAA,iBAAA,IAAA,EAAA;AAWZ,MAAM,sBAAA,GAAyB;AAAA,EAC7B,EAAE,eAAA,EAAiB,eAAA,EAAiB,KAAA,EAAO,MAAA,EAAO;AAAA,EAClD,EAAE,eAAA,EAAiB,WAAA,EAAa,KAAA,EAAO,MAAA,EAAO;AAAA,EAC9C,EAAE,eAAA,EAAiB,YAAA,EAAc,KAAA,EAAO,OAAA,EAAQ;AAAA,EAChD,EAAE,eAAA,EAAiB,sBAAA,EAAwB,KAAA,EAAO,aAAA;AACpD,CAAA;AAQO,MAAM,sBAAsB,CAAC;AAAA,EAClC;AACF,CAAA,KAEM;AACJ,EAAA,MAA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,WAAA,EAAY,OAAA,EAAS,MAAM,QAAQ,KAAK,CAAA,EACrD,QAAA,EAAA,CAAA,CAAE,uCAAuC,CAAA,EAC5C,CAAA;AAAA,wBACA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,OAAA,EAAQ,SAAA;AAAA,YACR,OAAA,EAAS,MAAM,YAAA,EAAa;AAAA,YAC5B,UAAA,EACE,CAAC,YAAA,IAAgB,OAAA,IAAW,gBAAgB,MAAA,KAAW,CAAA;AAAA,YAEzD,OAAA;AAAA,YAEC,QAAA,EAAA,OAAA,GACG,CAAA,CAAE,0CAA0C,CAAA,GAC5C,EAAE,wCAAwC;AAAA;AAAA;AAChD,OAAA,EACF;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"CatalogExportButton.esm.js","sources":["../../../src/components/CatalogExportButton/CatalogExportButton.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 { useCallback, useEffect, useState } from 'react';\nimport { RiDownloadLine } from '@remixicon/react';\nimport { useApiHolder } from '@backstage/core-plugin-api';\nimport { useTranslationRef, toastApiRef } from '@backstage/frontend-plugin-api';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport {\n Button,\n ButtonIcon,\n Checkbox,\n Dialog,\n DialogBody,\n DialogFooter,\n DialogHeader,\n Flex,\n Select,\n Text,\n} from '@backstage/ui';\nimport { useStreamingExport } from './file-download';\nimport type { CatalogExportSettingsColumn } from './file-download/serializeEntities';\nimport { getColumnTitle } from './file-download/serializeEntities';\nimport type { CatalogExporter } from './file-download/useStreamingExport';\n\n/**\n * Custom exporter configuration for a catalog export format.\n * @public\n */\nexport interface CatalogExporterConfig {\n /** The exporter function that generates the export content. */\n exporter: CatalogExporter;\n /** Optional display label shown in the format selector. Defaults to the format key in uppercase. */\n label?: string;\n}\n\n/**\n * Settings for configuring the catalog export functionality.\n *\n * @public\n */\nexport interface CatalogExportSettings {\n /**\n * When true, displays the export button in the catalog interface.\n * Defaults to false if not specified.\n */\n enabled?: boolean;\n\n /**\n * Custom columns to include in the export.\n * Each column specifies an entity field path and a display title.\n * If not specified, uses default columns: Name, Type, Owner, Description.\n */\n columns?: CatalogExportSettingsColumn[];\n\n /**\n * Map of custom export format handlers beyond the built-in CSV and JSON formats.\n * Key is the format name (e.g., 'xml', 'yaml'), value is the exporter configuration.\n * Custom formats will appear as options in the export dialog.\n */\n exporters?: Record<string, CatalogExporterConfig>;\n\n /**\n * When true, hides the built-in CSV and JSON export options from the dialog.\n * Useful when only custom exporters should be available.\n */\n disableBuiltinExporters?: boolean;\n\n /**\n * Callback function invoked when the export completes successfully.\n * Useful for showing notifications or performing post-export actions.\n */\n onSuccess?: () => void;\n\n /**\n * Callback function invoked when the export fails.\n * Receives an object containing the error for custom error handling.\n */\n onError?: (options: { error: Error }) => void;\n}\n\n/**\n * The available export formats for the catalog export.\n * Currently supports CSV and JSON.\n *\n * @public\n */\nexport enum CatalogExportType {\n CSV = 'csv',\n JSON = 'json',\n}\n\n/**\n * The available default export columns for the catalog export.\n * These can be overridden by providing custom columns in the export button options.\n *\n * @private\n */\nconst DEFAULT_EXPORT_COLUMNS = [\n { entityFilterKey: 'metadata.name', title: 'Name' },\n { entityFilterKey: 'spec.type', title: 'Type' },\n { entityFilterKey: 'spec.owner', title: 'Owner' },\n { entityFilterKey: 'metadata.description', title: 'Description' },\n];\n\n/**\n * A button that opens a dialog to export the current catalog selection.\n *\n * @param settings - Optional export configuration settings including columns, custom exporters, and callbacks\n * @public\n */\nexport const CatalogExportButton = ({\n settings,\n iconOnly = false,\n}: {\n settings?: CatalogExportSettings;\n iconOnly?: boolean;\n}) => {\n const { t } = useTranslationRef(catalogTranslationRef);\n const { exportStream, loading, error } = useStreamingExport();\n const [open, setOpen] = useState(false);\n const exporters = settings?.exporters;\n const disableBuiltinExporters = settings?.disableBuiltinExporters;\n const onSuccess = settings?.onSuccess;\n const onError = settings?.onError;\n const apis = useApiHolder();\n const toastApi = apis.get(toastApiRef)!;\n const [isExporting, setIsExporting] = useState(false);\n\n const effectiveColumns = settings?.columns ?? DEFAULT_EXPORT_COLUMNS;\n\n const allExportOptions = [\n ...(disableBuiltinExporters\n ? []\n : Object.values(CatalogExportType).map(format => ({\n value: format,\n label: format.toUpperCase(),\n }))),\n ...Object.entries(exporters ?? {}).map(([key, exporter]) => ({\n value: key,\n label: exporter.label ?? key.toUpperCase(),\n })),\n ];\n\n const [exportFormat, setExportFormat] = useState<string>(\n allExportOptions[0]?.value ?? '',\n );\n const [selectedColumnTitles, setSelectedColumnTitles] = useState<Set<string>>(\n () => new Set(effectiveColumns.map(c => getColumnTitle(c))),\n );\n const selectedColumns = effectiveColumns.filter(c =>\n selectedColumnTitles.has(getColumnTitle(c)),\n );\n\n const handleOpenDialog = () => {\n setSelectedColumnTitles(\n new Set(effectiveColumns.map(c => getColumnTitle(c))),\n );\n setOpen(true);\n };\n\n const toggleColumn = (title: string) => {\n setSelectedColumnTitles(prev => {\n const next = new Set(prev);\n if (next.has(title)) {\n next.delete(title);\n } else {\n next.add(title);\n }\n return next;\n });\n };\n\n useEffect(() => {\n if (isExporting && !loading) {\n if (error) {\n if (onError) {\n onError({ error });\n } else {\n toastApi.post({\n title: t('catalogExportButton.errorMessage', {\n errorMessage: error.message,\n }),\n status: 'danger',\n });\n }\n } else {\n if (onSuccess) {\n onSuccess();\n } else {\n toastApi.post({\n title: t('catalogExportButton.successMessage'),\n status: 'success',\n });\n }\n }\n setOpen(false);\n setIsExporting(false);\n }\n }, [isExporting, loading, error, toastApi, onSuccess, onError, t]);\n\n const handleExport = useCallback(async () => {\n setIsExporting(true);\n const exporterFn = exporters?.[exportFormat];\n await exportStream({\n exportFormat,\n filename: `catalog-export.${exportFormat}`,\n columns: selectedColumns,\n exporter: exporterFn?.exporter,\n });\n }, [exportFormat, exportStream, selectedColumns, exporters]);\n\n return (\n <>\n {iconOnly ? (\n <ButtonIcon\n variant=\"secondary\"\n icon={<RiDownloadLine />}\n aria-label={t('catalogExportButton.triggerButtonTitle')}\n onPress={handleOpenDialog}\n />\n ) : (\n <Button\n variant=\"secondary\"\n iconStart={<RiDownloadLine />}\n onPress={handleOpenDialog}\n >\n {t('catalogExportButton.triggerButtonTitle')}\n </Button>\n )}\n\n <Dialog isOpen={open} onOpenChange={isOpen => !isOpen && setOpen(false)}>\n <DialogHeader>{t('catalogExportButton.dialogTitle')}</DialogHeader>\n <DialogBody>\n <Flex direction=\"column\" gap=\"4\">\n <Select\n data-testid=\"format-select\"\n label={t('catalogExportButton.formatLabel')}\n options={allExportOptions}\n value={exportFormat}\n onChange={key => setExportFormat(key as string)}\n />\n <Flex direction=\"column\" gap=\"1\">\n <Text variant=\"body-small\" weight=\"bold\">\n {t('catalogExportButton.columnsLabel')}\n </Text>\n {effectiveColumns.map(col => (\n <Checkbox\n key={col.entityFilterKey}\n isSelected={selectedColumnTitles.has(getColumnTitle(col))}\n onChange={() => toggleColumn(getColumnTitle(col))}\n >\n {getColumnTitle(col)}\n </Checkbox>\n ))}\n </Flex>\n </Flex>\n </DialogBody>\n <DialogFooter>\n <Button variant=\"secondary\" onPress={() => setOpen(false)}>\n {t('catalogExportButton.cancelButtonTitle')}\n </Button>\n <Button\n variant=\"primary\"\n onPress={() => handleExport()}\n isDisabled={\n !exportFormat || loading || selectedColumns.length === 0\n }\n loading={loading}\n >\n {loading\n ? t('catalogExportButton.exportingButtonTitle')\n : t('catalogExportButton.confirmButtonTitle')}\n </Button>\n </DialogFooter>\n </Dialog>\n </>\n );\n};\n"],"names":["CatalogExportType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,GAC5C,EAAE,wCAAwC;AAAA;AAAA;AAChD,OAAA,EACF;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { CreateButton,
|
|
2
|
+
import { SupportButton, CreateButton, PageWithHeader, Content, ContentHeader } from '@backstage/core-components';
|
|
3
3
|
import { useApi, configApiRef, useRouteRef } from '@backstage/core-plugin-api';
|
|
4
|
-
import {
|
|
4
|
+
import { Header, ButtonLink, Container } from '@backstage/ui';
|
|
5
|
+
import { RiAddLine } from '@remixicon/react';
|
|
5
6
|
import { DefaultFilters, EntityListProvider, CatalogFilterLayout } from '@backstage/plugin-catalog-react';
|
|
6
7
|
import { createComponentRouteRef } from '../../routes.esm.js';
|
|
7
8
|
import { CatalogTable } from '../CatalogTable/CatalogTable.esm.js';
|
|
@@ -11,6 +12,7 @@ import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/
|
|
|
11
12
|
import { usePermission } from '@backstage/plugin-permission-react';
|
|
12
13
|
import { CatalogExportButton } from '../CatalogExportButton/CatalogExportButton.esm.js';
|
|
13
14
|
import Box from '@material-ui/core/Box';
|
|
15
|
+
import styles from './DefaultCatalogPage.module.css.esm.js';
|
|
14
16
|
|
|
15
17
|
function CatalogPageContent(props) {
|
|
16
18
|
const { filters, content = /* @__PURE__ */ jsx(CatalogTable, {}) } = props;
|
|
@@ -47,29 +49,32 @@ function NfsBaseCatalogPage(props) {
|
|
|
47
49
|
const { pagination, exportSettings } = props;
|
|
48
50
|
const orgName = useApi(configApiRef).getOptionalString("organization.name") ?? "Backstage";
|
|
49
51
|
const createComponentLink = useRouteRef(createComponentRouteRef);
|
|
52
|
+
const createComponentHref = createComponentLink?.();
|
|
50
53
|
const { t } = useTranslationRef(catalogTranslationRef);
|
|
51
54
|
const { allowed } = usePermission({
|
|
52
55
|
permission: catalogEntityCreatePermission
|
|
53
56
|
});
|
|
54
57
|
return /* @__PURE__ */ jsxs(EntityListProvider, { pagination, children: [
|
|
55
58
|
/* @__PURE__ */ jsx(
|
|
56
|
-
|
|
59
|
+
Header,
|
|
57
60
|
{
|
|
58
61
|
title: t("indexPage.title", { orgName }),
|
|
59
62
|
customActions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
60
|
-
allowed && /* @__PURE__ */ jsx(
|
|
61
|
-
|
|
63
|
+
allowed && createComponentHref && /* @__PURE__ */ jsx(
|
|
64
|
+
ButtonLink,
|
|
62
65
|
{
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
variant: "primary",
|
|
67
|
+
href: createComponentHref,
|
|
68
|
+
iconStart: /* @__PURE__ */ jsx(RiAddLine, {}),
|
|
69
|
+
children: t("indexPage.createButtonTitle")
|
|
65
70
|
}
|
|
66
71
|
),
|
|
67
|
-
exportSettings?.enabled && /* @__PURE__ */ jsx(
|
|
68
|
-
/* @__PURE__ */ jsx(SupportButton, { children: t("indexPage.supportButtonContent") })
|
|
72
|
+
exportSettings?.enabled && /* @__PURE__ */ jsx(CatalogExportButton, { settings: exportSettings, iconOnly: true }),
|
|
73
|
+
/* @__PURE__ */ jsx("div", { className: styles.supportButton, children: /* @__PURE__ */ jsx(SupportButton, { children: t("indexPage.supportButtonContent") }) })
|
|
69
74
|
] })
|
|
70
75
|
}
|
|
71
76
|
),
|
|
72
|
-
/* @__PURE__ */ jsx(
|
|
77
|
+
/* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(CatalogPageContent, { ...props }) })
|
|
73
78
|
] });
|
|
74
79
|
}
|
|
75
80
|
function DefaultCatalogPage(props) {
|
|
@@ -153,5 +158,5 @@ function NfsDefaultCatalogPage(props) {
|
|
|
153
158
|
);
|
|
154
159
|
}
|
|
155
160
|
|
|
156
|
-
export { BaseCatalogPage, DefaultCatalogPage, NfsDefaultCatalogPage };
|
|
161
|
+
export { BaseCatalogPage, DefaultCatalogPage, NfsBaseCatalogPage, NfsDefaultCatalogPage };
|
|
157
162
|
//# sourceMappingURL=DefaultCatalogPage.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultCatalogPage.esm.js","sources":["../../../src/components/CatalogPage/DefaultCatalogPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 Content,\n ContentHeader,\n CreateButton,\n PageWithHeader,\n SupportButton,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { HeaderPage } from '@backstage/ui';\nimport {\n CatalogFilterLayout,\n DefaultFilters,\n EntityListPagination,\n EntityListProvider,\n EntityOwnerPickerProps,\n UserListFilterKind,\n} from '@backstage/plugin-catalog-react';\nimport { ReactNode } from 'react';\nimport { createComponentRouteRef } from '../../routes';\nimport { CatalogTable, CatalogTableRow } from '../CatalogTable';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { CatalogTableColumnsFunc } from '../CatalogTable/types';\nimport { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { CatalogExportButton } from '../CatalogExportButton/CatalogExportButton';\nimport type { CatalogExportSettings } from '../CatalogExportButton';\nimport Box from '@material-ui/core/Box';\n\n/** @internal */\nexport type BaseCatalogPageProps = {\n filters: ReactNode;\n content?: ReactNode;\n pagination?: EntityListPagination;\n exportSettings?: CatalogExportSettings;\n};\n\nfunction CatalogPageContent(props: BaseCatalogPageProps) {\n const { filters, content = <CatalogTable /> } = props;\n\n return (\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>{filters}</CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>{content}</CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n );\n}\n\n/** @internal */\nexport function BaseCatalogPage(props: BaseCatalogPageProps) {\n const { pagination, exportSettings } = props;\n const orgName =\n useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';\n const createComponentLink = useRouteRef(createComponentRouteRef);\n const { t } = useTranslationRef(catalogTranslationRef);\n const { allowed } = usePermission({\n permission: catalogEntityCreatePermission,\n });\n const headerActions = (\n <>\n {allowed && (\n <CreateButton\n title={t('indexPage.createButtonTitle')}\n to={createComponentLink && createComponentLink()}\n />\n )}\n {exportSettings?.enabled && (\n <Box ml={2}>\n <CatalogExportButton settings={exportSettings} />\n </Box>\n )}\n <SupportButton>{t('indexPage.supportButtonContent')}</SupportButton>\n </>\n );\n\n return (\n <EntityListProvider pagination={pagination}>\n <PageWithHeader title={t('indexPage.title', { orgName })} themeId=\"home\">\n <Content>\n <ContentHeader title=\"\">{headerActions}</ContentHeader>\n <CatalogPageContent {...props} />\n </Content>\n </PageWithHeader>\n </EntityListProvider>\n );\n}\n\nfunction NfsBaseCatalogPage(props: BaseCatalogPageProps) {\n const { pagination, exportSettings } = props;\n const orgName =\n useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';\n const createComponentLink = useRouteRef(createComponentRouteRef);\n const { t } = useTranslationRef(catalogTranslationRef);\n const { allowed } = usePermission({\n permission: catalogEntityCreatePermission,\n });\n\n return (\n <EntityListProvider pagination={pagination}>\n <HeaderPage\n title={t('indexPage.title', { orgName })}\n customActions={\n <>\n {allowed && (\n <CreateButton\n title={t('indexPage.createButtonTitle')}\n to={createComponentLink && createComponentLink()}\n />\n )}\n {exportSettings?.enabled && (\n <Box ml={2}>\n <CatalogExportButton settings={exportSettings} />\n </Box>\n )}\n <SupportButton>{t('indexPage.supportButtonContent')}</SupportButton>\n </>\n }\n />\n <Content>\n <CatalogPageContent {...props} />\n </Content>\n </EntityListProvider>\n );\n}\n\n/**\n * Props for root catalog pages.\n *\n * @public\n */\nexport interface DefaultCatalogPageProps {\n initiallySelectedFilter?: UserListFilterKind;\n columns?: TableColumn<CatalogTableRow>[] | CatalogTableColumnsFunc;\n actions?: TableProps<CatalogTableRow>['actions'];\n initialKind?: string;\n tableOptions?: TableProps<CatalogTableRow>['options'];\n emptyContent?: ReactNode;\n ownerPickerMode?: EntityOwnerPickerProps['mode'];\n filters?: ReactNode;\n initiallySelectedNamespaces?: string[];\n pagination?: EntityListPagination;\n exportSettings?: CatalogExportSettings;\n}\n\nexport function DefaultCatalogPage(props: DefaultCatalogPageProps) {\n const {\n columns,\n actions,\n initiallySelectedFilter = 'owned',\n initialKind = 'component',\n tableOptions = {},\n emptyContent,\n pagination,\n ownerPickerMode,\n filters,\n initiallySelectedNamespaces,\n exportSettings,\n } = props;\n\n return (\n <BaseCatalogPage\n filters={\n filters ?? (\n <DefaultFilters\n initialKind={initialKind}\n initiallySelectedFilter={initiallySelectedFilter}\n ownerPickerMode={ownerPickerMode}\n initiallySelectedNamespaces={initiallySelectedNamespaces}\n />\n )\n }\n content={\n <CatalogTable\n columns={columns}\n actions={actions}\n tableOptions={tableOptions}\n emptyContent={emptyContent}\n />\n }\n pagination={pagination}\n exportSettings={exportSettings}\n />\n );\n}\n\n/** @public */\nexport function NfsDefaultCatalogPage(props: DefaultCatalogPageProps) {\n const {\n columns,\n actions,\n initiallySelectedFilter = 'owned',\n initialKind = 'component',\n tableOptions = {},\n emptyContent,\n pagination,\n ownerPickerMode,\n filters,\n initiallySelectedNamespaces,\n exportSettings,\n } = props;\n\n return (\n <NfsBaseCatalogPage\n filters={\n filters ?? (\n <DefaultFilters\n initialKind={initialKind}\n initiallySelectedFilter={initiallySelectedFilter}\n ownerPickerMode={ownerPickerMode}\n initiallySelectedNamespaces={initiallySelectedNamespaces}\n />\n )\n }\n content={\n <CatalogTable\n columns={columns}\n actions={actions}\n tableOptions={tableOptions}\n emptyContent={emptyContent}\n />\n }\n pagination={pagination}\n exportSettings={exportSettings}\n />\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAuDA,SAAS,mBAAmB,KAAA,EAA6B;AACvD,EAAA,MAAM,EAAE,OAAA,EAAS,OAAA,mBAAU,GAAA,CAAC,YAAA,EAAA,EAAa,GAAG,GAAI,KAAA;AAEhD,EAAA,4BACG,mBAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,mBAAA,CAAoB,OAAA,EAApB,EAA6B,QAAA,EAAA,OAAA,EAAQ,CAAA;AAAA,oBACtC,GAAA,CAAC,mBAAA,CAAoB,OAAA,EAApB,EAA6B,QAAA,EAAA,OAAA,EAAQ;AAAA,GAAA,EACxC,CAAA;AAEJ;AAGO,SAAS,gBAAgB,KAAA,EAA6B;AAC3D,EAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAe,GAAI,KAAA;AACvC,EAAA,MAAM,UACJ,MAAA,CAAO,YAAY,CAAA,CAAE,iBAAA,CAAkB,mBAAmB,CAAA,IAAK,WAAA;AACjE,EAAA,MAAM,mBAAA,GAAsB,YAAY,uBAAuB,CAAA;AAC/D,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,qBAAqB,CAAA;AACrD,EAAA,MAAM,EAAE,OAAA,EAAQ,GAAI,aAAA,CAAc;AAAA,IAChC,UAAA,EAAY;AAAA,GACb,CAAA;AACD,EAAA,MAAM,gCACJ,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,IAAA,OAAA,oBACC,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,EAAE,6BAA6B,CAAA;AAAA,QACtC,EAAA,EAAI,uBAAuB,mBAAA;AAAoB;AAAA,KACjD;AAAA,IAED,cAAA,EAAgB,OAAA,oBACf,GAAA,CAAC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OAAA;AAAA,UACA,OAAA;AAAA,UACA,YAAA;AAAA,UACA;AAAA;AAAA,OACF;AAAA,MAEF,UAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;AAGO,SAAS,sBAAsB,KAAA,EAAgC;AACpE,EAAA,MAAM;AAAA,IACJ,OAAA;AAAA,IACA,OAAA;AAAA,IACA,uBAAA,GAA0B,OAAA;AAAA,IAC1B,WAAA,GAAc,WAAA;AAAA,IACd,eAAe,EAAC;AAAA,IAChB,YAAA;AAAA,IACA,UAAA;AAAA,IACA,eAAA;AAAA,IACA,OAAA;AAAA,IACA,2BAAA;AAAA,IACA;AAAA,GACF,GAAI,KAAA;AAEJ,EAAA,uBACE,GAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,SACE,OAAA,oBACE,GAAA;AAAA,QAAC,cAAA;AAAA,QAAA;AAAA,UACC,WAAA;AAAA,UACA,uBAAA;AAAA,UACA,eAAA;AAAA,UACA;AAAA;AAAA,OACF;AAAA,MAGJ,OAAA,kBACE,GAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UACC,OAAA;AAAA,UACA,OAAA;AAAA,UACA,YAAA;AAAA,UACA;AAAA;AAAA,OACF;AAAA,MAEF,UAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"DefaultCatalogPage.esm.js","sources":["../../../src/components/CatalogPage/DefaultCatalogPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 Content,\n ContentHeader,\n CreateButton,\n PageWithHeader,\n SupportButton,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { ButtonLink, Container, Header } from '@backstage/ui';\nimport { RiAddLine } from '@remixicon/react';\nimport {\n CatalogFilterLayout,\n DefaultFilters,\n EntityListPagination,\n EntityListProvider,\n EntityOwnerPickerProps,\n UserListFilterKind,\n} from '@backstage/plugin-catalog-react';\nimport { ReactNode } from 'react';\nimport { createComponentRouteRef } from '../../routes';\nimport { CatalogTable, CatalogTableRow } from '../CatalogTable';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { CatalogTableColumnsFunc } from '../CatalogTable/types';\nimport { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { CatalogExportButton } from '../CatalogExportButton/CatalogExportButton';\nimport type { CatalogExportSettings } from '../CatalogExportButton';\nimport Box from '@material-ui/core/Box';\nimport styles from './DefaultCatalogPage.module.css';\n\n/** @internal */\nexport type BaseCatalogPageProps = {\n filters: ReactNode;\n content?: ReactNode;\n pagination?: EntityListPagination;\n exportSettings?: CatalogExportSettings;\n};\n\nfunction CatalogPageContent(props: BaseCatalogPageProps) {\n const { filters, content = <CatalogTable /> } = props;\n\n return (\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>{filters}</CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>{content}</CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n );\n}\n\n/** @internal */\nexport function BaseCatalogPage(props: BaseCatalogPageProps) {\n const { pagination, exportSettings } = props;\n const orgName =\n useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';\n const createComponentLink = useRouteRef(createComponentRouteRef);\n const { t } = useTranslationRef(catalogTranslationRef);\n const { allowed } = usePermission({\n permission: catalogEntityCreatePermission,\n });\n const headerActions = (\n <>\n {allowed && (\n <CreateButton\n title={t('indexPage.createButtonTitle')}\n to={createComponentLink && createComponentLink()}\n />\n )}\n {exportSettings?.enabled && (\n <Box ml={2}>\n <CatalogExportButton settings={exportSettings} />\n </Box>\n )}\n <SupportButton>{t('indexPage.supportButtonContent')}</SupportButton>\n </>\n );\n\n return (\n <EntityListProvider pagination={pagination}>\n <PageWithHeader title={t('indexPage.title', { orgName })} themeId=\"home\">\n <Content>\n <ContentHeader title=\"\">{headerActions}</ContentHeader>\n <CatalogPageContent {...props} />\n </Content>\n </PageWithHeader>\n </EntityListProvider>\n );\n}\n\n/** @internal */\nexport function NfsBaseCatalogPage(props: BaseCatalogPageProps) {\n const { pagination, exportSettings } = props;\n const orgName =\n useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';\n const createComponentLink = useRouteRef(createComponentRouteRef);\n const createComponentHref = createComponentLink?.();\n const { t } = useTranslationRef(catalogTranslationRef);\n const { allowed } = usePermission({\n permission: catalogEntityCreatePermission,\n });\n\n return (\n <EntityListProvider pagination={pagination}>\n <Header\n title={t('indexPage.title', { orgName })}\n customActions={\n <>\n {allowed && createComponentHref && (\n <ButtonLink\n variant=\"primary\"\n href={createComponentHref}\n iconStart={<RiAddLine />}\n >\n {t('indexPage.createButtonTitle')}\n </ButtonLink>\n )}\n {exportSettings?.enabled && (\n <CatalogExportButton settings={exportSettings} iconOnly />\n )}\n <div className={styles.supportButton}>\n <SupportButton>\n {t('indexPage.supportButtonContent')}\n </SupportButton>\n </div>\n </>\n }\n />\n <Container>\n <CatalogPageContent {...props} />\n </Container>\n </EntityListProvider>\n );\n}\n\n/**\n * Props for root catalog pages.\n *\n * @public\n */\nexport interface DefaultCatalogPageProps {\n initiallySelectedFilter?: UserListFilterKind;\n columns?: TableColumn<CatalogTableRow>[] | CatalogTableColumnsFunc;\n actions?: TableProps<CatalogTableRow>['actions'];\n initialKind?: string;\n tableOptions?: TableProps<CatalogTableRow>['options'];\n emptyContent?: ReactNode;\n ownerPickerMode?: EntityOwnerPickerProps['mode'];\n filters?: ReactNode;\n initiallySelectedNamespaces?: string[];\n pagination?: EntityListPagination;\n exportSettings?: CatalogExportSettings;\n}\n\nexport function DefaultCatalogPage(props: DefaultCatalogPageProps) {\n const {\n columns,\n actions,\n initiallySelectedFilter = 'owned',\n initialKind = 'component',\n tableOptions = {},\n emptyContent,\n pagination,\n ownerPickerMode,\n filters,\n initiallySelectedNamespaces,\n exportSettings,\n } = props;\n\n return (\n <BaseCatalogPage\n filters={\n filters ?? (\n <DefaultFilters\n initialKind={initialKind}\n initiallySelectedFilter={initiallySelectedFilter}\n ownerPickerMode={ownerPickerMode}\n initiallySelectedNamespaces={initiallySelectedNamespaces}\n />\n )\n }\n content={\n <CatalogTable\n columns={columns}\n actions={actions}\n tableOptions={tableOptions}\n emptyContent={emptyContent}\n />\n }\n pagination={pagination}\n exportSettings={exportSettings}\n />\n );\n}\n\n/** @public */\nexport function NfsDefaultCatalogPage(props: DefaultCatalogPageProps) {\n const {\n columns,\n actions,\n initiallySelectedFilter = 'owned',\n initialKind = 'component',\n tableOptions = {},\n emptyContent,\n pagination,\n ownerPickerMode,\n filters,\n initiallySelectedNamespaces,\n exportSettings,\n } = props;\n\n return (\n <NfsBaseCatalogPage\n filters={\n filters ?? (\n <DefaultFilters\n initialKind={initialKind}\n initiallySelectedFilter={initiallySelectedFilter}\n ownerPickerMode={ownerPickerMode}\n initiallySelectedNamespaces={initiallySelectedNamespaces}\n />\n )\n }\n content={\n <CatalogTable\n columns={columns}\n actions={actions}\n tableOptions={tableOptions}\n emptyContent={emptyContent}\n />\n }\n pagination={pagination}\n exportSettings={exportSettings}\n />\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAyDA,SAAS,mBAAmB,KAAA,EAA6B;AACvD,EAAA,MAAM,EAAE,OAAA,EAAS,OAAA,mBAAU,GAAA,CAAC,YAAA,EAAA,EAAa,GAAG,GAAI,KAAA;AAEhD,EAAA,4BACG,mBAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAA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,WAAA,GAAc,WAAA;AAAA,IACd,eAAe,EAAC;AAAA,IAChB,YAAA;AAAA,IACA,UAAA;AAAA,IACA,eAAA;AAAA,IACA,OAAA;AAAA,IACA,2BAAA;AAAA,IACA;AAAA,GACF,GAAI,KAAA;AAEJ,EAAA,uBACE,GAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,SACE,OAAA,oBACE,GAAA;AAAA,QAAC,cAAA;AAAA,QAAA;AAAA,UACC,WAAA;AAAA,UACA,uBAAA;AAAA,UACA,eAAA;AAAA,UACA;AAAA;AAAA,OACF;AAAA,MAGJ,OAAA,kBACE,GAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UACC,OAAA;AAAA,UACA,OAAA;AAAA,UACA,YAAA;AAAA,UACA;AAAA;AAAA,OACF;AAAA,MAEF,UAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = "/*\n * Copyright 2026 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.DefaultCatalogPage_supportButton__f58e164d93 > .MuiBox-root {\n /* Header already provides the spacing that SupportButton adds internally. */\n margin-left: 0;\n}\n";
|
|
4
|
+
var styles = {"supportButton":"DefaultCatalogPage_supportButton__f58e164d93"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { styles as default };
|
|
8
|
+
//# sourceMappingURL=DefaultCatalogPage.module.css.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultCatalogPage.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -11,7 +11,7 @@ import Tooltip from '@material-ui/core/Tooltip';
|
|
|
11
11
|
import { makeStyles } from '@material-ui/core/styles';
|
|
12
12
|
import BugReportIcon from '@material-ui/icons/BugReport';
|
|
13
13
|
import MoreVert from '@material-ui/icons/MoreVert';
|
|
14
|
-
import { useState, useEffect } from 'react';
|
|
14
|
+
import { useState, useEffect, Fragment as Fragment$1 } from 'react';
|
|
15
15
|
import { useEntityPermission } from '@backstage/plugin-catalog-react/alpha';
|
|
16
16
|
import { catalogEntityDeletePermission } from '@backstage/plugin-catalog-common/alpha';
|
|
17
17
|
import { UnregisterEntity } from './UnregisterEntity.esm.js';
|
|
@@ -150,7 +150,7 @@ function EntityContextMenu(props) {
|
|
|
150
150
|
},
|
|
151
151
|
children: /* @__PURE__ */ jsxs(MenuList, { autoFocusItem: Boolean(anchorEl), children: [
|
|
152
152
|
extraItems,
|
|
153
|
-
contextMenuItems === void 0 ? defaultMenuItems : /* @__PURE__ */ jsx(EntityContextMenuProvider, { onMenuClose: onClose, children: contextMenuItems })
|
|
153
|
+
contextMenuItems === void 0 ? defaultMenuItems : /* @__PURE__ */ jsx(EntityContextMenuProvider, { onMenuClose: onClose, children: contextMenuItems.map((item, index) => /* @__PURE__ */ jsx(Fragment$1, { children: item }, index)) })
|
|
154
154
|
] })
|
|
155
155
|
}
|
|
156
156
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityContextMenu.esm.js","sources":["../../../src/components/EntityContextMenu/EntityContextMenu.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 Divider from '@material-ui/core/Divider';\nimport FileCopyTwoToneIcon from '@material-ui/icons/FileCopyTwoTone';\nimport IconButton from '@material-ui/core/IconButton';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport MenuList from '@material-ui/core/MenuList';\nimport Popover from '@material-ui/core/Popover';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { Theme, makeStyles } from '@material-ui/core/styles';\nimport BugReportIcon from '@material-ui/icons/BugReport';\nimport MoreVert from '@material-ui/icons/MoreVert';\nimport { SyntheticEvent, useEffect, useState } from 'react';\nimport { IconComponent } from '@backstage/core-plugin-api';\nimport { useEntityPermission } from '@backstage/plugin-catalog-react/alpha';\nimport { catalogEntityDeletePermission } from '@backstage/plugin-catalog-common/alpha';\nimport { UnregisterEntity, UnregisterEntityOptions } from './UnregisterEntity';\nimport { useApi, alertApiRef } from '@backstage/core-plugin-api';\nimport useCopyToClipboard from 'react-use/esm/useCopyToClipboard';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { EntityContextMenuProvider } from '../../context';\n\n/** @public */\nexport type EntityContextMenuClassKey = 'button';\n\nconst useStyles = makeStyles(\n (theme: Theme) => {\n return {\n button: {\n color: theme.page.fontColor,\n },\n };\n },\n { name: 'PluginCatalogEntityContextMenu' },\n);\n\n// NOTE(freben): Intentionally not exported at this point, since it's part of\n// the unstable extra context menu items concept below\ninterface ExtraContextMenuItem {\n title: string;\n Icon: IconComponent;\n onClick: () => void;\n}\n\ninterface EntityContextMenuProps {\n UNSTABLE_extraContextMenuItems?: ExtraContextMenuItem[];\n UNSTABLE_contextMenuOptions?: UnregisterEntityOptions;\n contextMenuItems?: React.JSX.Element[];\n onUnregisterEntity: () => void;\n onInspectEntity: () => void;\n}\n\nexport function EntityContextMenu(props: EntityContextMenuProps) {\n const {\n UNSTABLE_extraContextMenuItems,\n UNSTABLE_contextMenuOptions,\n contextMenuItems,\n onUnregisterEntity,\n onInspectEntity,\n } = props;\n const { t } = useTranslationRef(catalogTranslationRef);\n const [anchorEl, setAnchorEl] = useState<HTMLButtonElement>();\n const classes = useStyles();\n const unregisterPermission = useEntityPermission(\n catalogEntityDeletePermission,\n );\n const isAllowed = unregisterPermission.allowed;\n\n const onOpen = (event: SyntheticEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const onClose = () => {\n setAnchorEl(undefined);\n };\n\n const alertApi = useApi(alertApiRef);\n const [copyState, copyToClipboard] = useCopyToClipboard();\n useEffect(() => {\n if (!copyState.error && copyState.value) {\n alertApi.post({\n message: t('entityContextMenu.copiedMessage'),\n severity: 'info',\n display: 'transient',\n });\n }\n }, [copyState, alertApi, t]);\n\n const extraItems = UNSTABLE_extraContextMenuItems?.length\n ? [\n ...UNSTABLE_extraContextMenuItems.map(item => (\n <MenuItem\n key={item.title}\n onClick={() => {\n onClose();\n item.onClick();\n }}\n >\n <ListItemIcon>\n <item.Icon fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText primary={item.title} />\n </MenuItem>\n )),\n <Divider key=\"the divider is here!\" />,\n ]\n : null;\n\n const defaultMenuItems = [\n <UnregisterEntity\n unregisterEntityOptions={UNSTABLE_contextMenuOptions}\n isUnregisterAllowed={isAllowed}\n onUnregisterEntity={onUnregisterEntity}\n onClose={onClose}\n key=\"unregister-entity\"\n />,\n <MenuItem\n onClick={() => {\n onClose();\n onInspectEntity();\n }}\n key=\"inspect-entity\"\n >\n <ListItemIcon>\n <BugReportIcon fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText primary={t('entityContextMenu.inspectMenuTitle')} />\n </MenuItem>,\n <MenuItem\n onClick={() => {\n onClose();\n copyToClipboard(window.location.toString());\n }}\n key=\"copy-url\"\n >\n <ListItemIcon>\n <FileCopyTwoToneIcon fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText primary={t('entityContextMenu.copyURLMenuTitle')} />\n </MenuItem>,\n ];\n\n return (\n <>\n <Tooltip title={t('entityContextMenu.moreButtonTitle')} arrow>\n <IconButton\n aria-label={t('entityContextMenu.moreButtonAriaLabel')}\n aria-controls=\"long-menu\"\n aria-haspopup=\"true\"\n aria-expanded={!!anchorEl}\n role=\"button\"\n onClick={onOpen}\n data-testid=\"menu-button\"\n className={classes.button}\n id=\"long-menu\"\n >\n <MoreVert />\n </IconButton>\n </Tooltip>\n <Popover\n open={Boolean(anchorEl)}\n onClose={onClose}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n transformOrigin={{ vertical: 'top', horizontal: 'right' }}\n aria-labelledby=\"long-menu\"\n PaperProps={{\n style: { minWidth: 200 },\n }}\n >\n <MenuList autoFocusItem={Boolean(anchorEl)}>\n {extraItems}\n {contextMenuItems === undefined ? (\n defaultMenuItems\n ) : (\n <EntityContextMenuProvider onMenuClose={onClose}>\n {contextMenuItems}\n </EntityContextMenuProvider>\n )}\n </MenuList>\n </Popover>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB,CAAC,KAAA,KAAiB;AAChB,IAAA,OAAO;AAAA,MACL,MAAA,EAAQ;AAAA,QACN,KAAA,EAAO,MAAM,IAAA,CAAK;AAAA;AACpB,KACF;AAAA,EACF,CAAA;AAAA,EACA,EAAE,MAAM,gCAAA;AACV,CAAA;AAkBO,SAAS,kBAAkB,KAAA,EAA+B;AAC/D,EAAA,MAAM;AAAA,IACJ,8BAAA;AAAA,IACA,2BAAA;AAAA,IACA,gBAAA;AAAA,IACA,kBAAA;AAAA,IACA;AAAA,GACF,GAAI,KAAA;AACJ,EAAA,MAAM,EAAE,CAAA,E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AAA,GACpB,gBAAA,uBAEC,yBAAA,EAAA,EAA0B,WAAA,EAAa,SACrC,QAAA,EAAA,gBAAA,EACH;AAAA,SAAA,EAEJ;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"EntityContextMenu.esm.js","sources":["../../../src/components/EntityContextMenu/EntityContextMenu.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 Divider from '@material-ui/core/Divider';\nimport FileCopyTwoToneIcon from '@material-ui/icons/FileCopyTwoTone';\nimport IconButton from '@material-ui/core/IconButton';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport MenuList from '@material-ui/core/MenuList';\nimport Popover from '@material-ui/core/Popover';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { Theme, makeStyles } from '@material-ui/core/styles';\nimport BugReportIcon from '@material-ui/icons/BugReport';\nimport MoreVert from '@material-ui/icons/MoreVert';\nimport { Fragment, SyntheticEvent, useEffect, useState } from 'react';\nimport { IconComponent } from '@backstage/core-plugin-api';\nimport { useEntityPermission } from '@backstage/plugin-catalog-react/alpha';\nimport { catalogEntityDeletePermission } from '@backstage/plugin-catalog-common/alpha';\nimport { UnregisterEntity, UnregisterEntityOptions } from './UnregisterEntity';\nimport { useApi, alertApiRef } from '@backstage/core-plugin-api';\nimport useCopyToClipboard from 'react-use/esm/useCopyToClipboard';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { EntityContextMenuProvider } from '../../context';\n\n/** @public */\nexport type EntityContextMenuClassKey = 'button';\n\nconst useStyles = makeStyles(\n (theme: Theme) => {\n return {\n button: {\n color: theme.page.fontColor,\n },\n };\n },\n { name: 'PluginCatalogEntityContextMenu' },\n);\n\n// NOTE(freben): Intentionally not exported at this point, since it's part of\n// the unstable extra context menu items concept below\ninterface ExtraContextMenuItem {\n title: string;\n Icon: IconComponent;\n onClick: () => void;\n}\n\ninterface EntityContextMenuProps {\n UNSTABLE_extraContextMenuItems?: ExtraContextMenuItem[];\n UNSTABLE_contextMenuOptions?: UnregisterEntityOptions;\n contextMenuItems?: React.JSX.Element[];\n onUnregisterEntity: () => void;\n onInspectEntity: () => void;\n}\n\nexport function EntityContextMenu(props: EntityContextMenuProps) {\n const {\n UNSTABLE_extraContextMenuItems,\n UNSTABLE_contextMenuOptions,\n contextMenuItems,\n onUnregisterEntity,\n onInspectEntity,\n } = props;\n const { t } = useTranslationRef(catalogTranslationRef);\n const [anchorEl, setAnchorEl] = useState<HTMLButtonElement>();\n const classes = useStyles();\n const unregisterPermission = useEntityPermission(\n catalogEntityDeletePermission,\n );\n const isAllowed = unregisterPermission.allowed;\n\n const onOpen = (event: SyntheticEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const onClose = () => {\n setAnchorEl(undefined);\n };\n\n const alertApi = useApi(alertApiRef);\n const [copyState, copyToClipboard] = useCopyToClipboard();\n useEffect(() => {\n if (!copyState.error && copyState.value) {\n alertApi.post({\n message: t('entityContextMenu.copiedMessage'),\n severity: 'info',\n display: 'transient',\n });\n }\n }, [copyState, alertApi, t]);\n\n const extraItems = UNSTABLE_extraContextMenuItems?.length\n ? [\n ...UNSTABLE_extraContextMenuItems.map(item => (\n <MenuItem\n key={item.title}\n onClick={() => {\n onClose();\n item.onClick();\n }}\n >\n <ListItemIcon>\n <item.Icon fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText primary={item.title} />\n </MenuItem>\n )),\n <Divider key=\"the divider is here!\" />,\n ]\n : null;\n\n const defaultMenuItems = [\n <UnregisterEntity\n unregisterEntityOptions={UNSTABLE_contextMenuOptions}\n isUnregisterAllowed={isAllowed}\n onUnregisterEntity={onUnregisterEntity}\n onClose={onClose}\n key=\"unregister-entity\"\n />,\n <MenuItem\n onClick={() => {\n onClose();\n onInspectEntity();\n }}\n key=\"inspect-entity\"\n >\n <ListItemIcon>\n <BugReportIcon fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText primary={t('entityContextMenu.inspectMenuTitle')} />\n </MenuItem>,\n <MenuItem\n onClick={() => {\n onClose();\n copyToClipboard(window.location.toString());\n }}\n key=\"copy-url\"\n >\n <ListItemIcon>\n <FileCopyTwoToneIcon fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText primary={t('entityContextMenu.copyURLMenuTitle')} />\n </MenuItem>,\n ];\n\n return (\n <>\n <Tooltip title={t('entityContextMenu.moreButtonTitle')} arrow>\n <IconButton\n aria-label={t('entityContextMenu.moreButtonAriaLabel')}\n aria-controls=\"long-menu\"\n aria-haspopup=\"true\"\n aria-expanded={!!anchorEl}\n role=\"button\"\n onClick={onOpen}\n data-testid=\"menu-button\"\n className={classes.button}\n id=\"long-menu\"\n >\n <MoreVert />\n </IconButton>\n </Tooltip>\n <Popover\n open={Boolean(anchorEl)}\n onClose={onClose}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n transformOrigin={{ vertical: 'top', horizontal: 'right' }}\n aria-labelledby=\"long-menu\"\n PaperProps={{\n style: { minWidth: 200 },\n }}\n >\n <MenuList autoFocusItem={Boolean(anchorEl)}>\n {extraItems}\n {contextMenuItems === undefined ? (\n defaultMenuItems\n ) : (\n <EntityContextMenuProvider onMenuClose={onClose}>\n {contextMenuItems.map((item, index) => (\n <Fragment key={index}>{item}</Fragment>\n ))}\n </EntityContextMenuProvider>\n )}\n </MenuList>\n </Popover>\n </>\n );\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AQ,QAAQ,CAAA;AAAA,QACtB,OAAA;AAAA,QACA,QAAA;AAAA,QACA,YAAA,EAAc,EAAE,QAAA,EAAU,QAAA,EAAU,YAAY,OAAA,EAAQ;AAAA,QACxD,eAAA,EAAiB,EAAE,QAAA,EAAU,KAAA,EAAO,YAAY,OAAA,EAAQ;AAAA,QACxD,iBAAA,EAAgB,WAAA;AAAA,QAChB,UAAA,EAAY;AAAA,UACV,KAAA,EAAO,EAAE,QAAA,EAAU,GAAA;AAAI,SACzB;AAAA,QAEA,QAAA,kBAAA,IAAA,CAAC,QAAA,EAAA,EAAS,aAAA,EAAe,OAAA,CAAQ,QAAQ,CAAA,EACtC,QAAA,EAAA;AAAA,UAAA,UAAA;AAAA,UACA,qBAAqB,MAAA,GACpB,gBAAA,uBAEC,yBAAA,EAAA,EAA0B,WAAA,EAAa,SACrC,QAAA,EAAA,gBAAA,CAAiB,GAAA,CAAI,CAAC,IAAA,EAAM,0BAC3B,GAAA,CAACA,UAAAA,EAAA,EAAsB,QAAA,EAAA,IAAA,EAAA,EAAR,KAAa,CAC7B,CAAA,EACH;AAAA,SAAA,EAEJ;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -768,13 +768,9 @@ declare const catalogTranslationRef: _backstage_frontend_plugin_api.TranslationR
|
|
|
768
768
|
readonly "deleteEntity.deleteButtonTitle": "Delete";
|
|
769
769
|
readonly "deleteEntity.dialogTitle": "Are you sure you want to delete this entity?";
|
|
770
770
|
readonly "deleteEntity.actionButtonTitle": "Delete entity";
|
|
771
|
-
readonly "indexPage.title": "{{orgName}} Catalog";
|
|
772
|
-
readonly "indexPage.createButtonTitle": "Create";
|
|
773
|
-
readonly "indexPage.supportButtonContent": "All your software catalog entities";
|
|
774
|
-
readonly "entityPage.notFoundMessage": "There is no {{kind}} with the requested {{link}}.";
|
|
775
|
-
readonly "entityPage.notFoundLinkText": "kind, namespace, and name";
|
|
776
771
|
readonly "aboutCard.title": "About";
|
|
777
772
|
readonly "aboutCard.unknown": "unknown";
|
|
773
|
+
readonly "aboutCard.viewTechdocs": "View TechDocs";
|
|
778
774
|
readonly "aboutCard.refreshButtonTitle": "Schedule entity refresh";
|
|
779
775
|
readonly "aboutCard.editButtonTitle": "Edit Metadata";
|
|
780
776
|
readonly "aboutCard.editButtonAriaLabel": "Edit";
|
|
@@ -782,7 +778,6 @@ declare const catalogTranslationRef: _backstage_frontend_plugin_api.TranslationR
|
|
|
782
778
|
readonly "aboutCard.refreshScheduledMessage": "Refresh scheduled";
|
|
783
779
|
readonly "aboutCard.refreshButtonAriaLabel": "Refresh";
|
|
784
780
|
readonly "aboutCard.launchTemplate": "Launch Template";
|
|
785
|
-
readonly "aboutCard.viewTechdocs": "View TechDocs";
|
|
786
781
|
readonly "aboutCard.viewSource": "View Source";
|
|
787
782
|
readonly "aboutCard.descriptionField.value": "No description";
|
|
788
783
|
readonly "aboutCard.descriptionField.label": "Description";
|
|
@@ -800,6 +795,11 @@ declare const catalogTranslationRef: _backstage_frontend_plugin_api.TranslationR
|
|
|
800
795
|
readonly "aboutCard.tagsField.value": "No Tags";
|
|
801
796
|
readonly "aboutCard.tagsField.label": "Tags";
|
|
802
797
|
readonly "aboutCard.targetsField.label": "Targets";
|
|
798
|
+
readonly "indexPage.title": "{{orgName}} Catalog";
|
|
799
|
+
readonly "indexPage.createButtonTitle": "Create";
|
|
800
|
+
readonly "indexPage.supportButtonContent": "All your software catalog entities";
|
|
801
|
+
readonly "entityPage.notFoundMessage": "There is no {{kind}} with the requested {{link}}.";
|
|
802
|
+
readonly "entityPage.notFoundLinkText": "kind, namespace, and name";
|
|
803
803
|
readonly "searchResultItem.type": "Type";
|
|
804
804
|
readonly "searchResultItem.kind": "Kind";
|
|
805
805
|
readonly "searchResultItem.owner": "Owner";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function styleInject(css, ref) {
|
|
2
|
+
if ( ref === void 0 ) ref = {};
|
|
3
|
+
var insertAt = ref.insertAt;
|
|
4
|
+
|
|
5
|
+
if (typeof document === 'undefined') { return; }
|
|
6
|
+
|
|
7
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
8
|
+
var style = document.createElement('style');
|
|
9
|
+
style.type = 'text/css';
|
|
10
|
+
|
|
11
|
+
if (insertAt === 'top') {
|
|
12
|
+
if (head.firstChild) {
|
|
13
|
+
head.insertBefore(style, head.firstChild);
|
|
14
|
+
} else {
|
|
15
|
+
head.appendChild(style);
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
head.appendChild(style);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (style.styleSheet) {
|
|
22
|
+
style.styleSheet.cssText = css;
|
|
23
|
+
} else {
|
|
24
|
+
style.appendChild(document.createTextNode(css));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { styleInject as default };
|
|
29
|
+
//# sourceMappingURL=style-inject.es.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-inject.es.esm.js","sources":["../../../../../../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":[],"mappings":"AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG,EAAE;AAChC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ;;AAE7B,EAAE,IAAY,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,CAAC;;AAEzD,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AAC7C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU;;AAEzB,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC;AAC/C,IAAI,CAAC,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC7B,IAAI;AACJ,EAAE,CAAC,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC3B,EAAE;;AAEF,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;AACxB,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG;AAClC,EAAE,CAAC,MAAM;AACT,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACnD,EAAE;AACF;;;;","x_google_ignoreList":[0]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog",
|
|
3
|
-
"version": "2.0.6
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "The Backstage plugin for browsing the Backstage catalog",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -70,25 +70,25 @@
|
|
|
70
70
|
"test": "backstage-cli package test"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@backstage/catalog-client": "1.16.0
|
|
74
|
-
"@backstage/catalog-model": "1.9.0",
|
|
75
|
-
"@backstage/core-compat-api": "0.5.12
|
|
76
|
-
"@backstage/core-components": "0.18.11
|
|
77
|
-
"@backstage/core-plugin-api": "1.12.7
|
|
78
|
-
"@backstage/errors": "1.3.1",
|
|
79
|
-
"@backstage/frontend-plugin-api": "0.17.2
|
|
80
|
-
"@backstage/integration-react": "1.2.19
|
|
81
|
-
"@backstage/plugin-catalog-common": "1.1.10",
|
|
82
|
-
"@backstage/plugin-catalog-react": "3.
|
|
83
|
-
"@backstage/plugin-permission-react": "0.5.2
|
|
84
|
-
"@backstage/plugin-scaffolder-common": "2.2.1
|
|
85
|
-
"@backstage/plugin-search-common": "1.2.24",
|
|
86
|
-
"@backstage/plugin-search-react": "1.11.5
|
|
87
|
-
"@backstage/plugin-techdocs-common": "0.1.1",
|
|
88
|
-
"@backstage/plugin-techdocs-react": "1.3.12
|
|
89
|
-
"@backstage/types": "1.2.2",
|
|
90
|
-
"@backstage/ui": "0.
|
|
91
|
-
"@backstage/version-bridge": "1.0.12",
|
|
73
|
+
"@backstage/catalog-client": "^1.16.0",
|
|
74
|
+
"@backstage/catalog-model": "^1.9.0",
|
|
75
|
+
"@backstage/core-compat-api": "^0.5.12",
|
|
76
|
+
"@backstage/core-components": "^0.18.11",
|
|
77
|
+
"@backstage/core-plugin-api": "^1.12.7",
|
|
78
|
+
"@backstage/errors": "^1.3.1",
|
|
79
|
+
"@backstage/frontend-plugin-api": "^0.17.2",
|
|
80
|
+
"@backstage/integration-react": "^1.2.19",
|
|
81
|
+
"@backstage/plugin-catalog-common": "^1.1.10",
|
|
82
|
+
"@backstage/plugin-catalog-react": "^3.1.0",
|
|
83
|
+
"@backstage/plugin-permission-react": "^0.5.2",
|
|
84
|
+
"@backstage/plugin-scaffolder-common": "^2.2.1",
|
|
85
|
+
"@backstage/plugin-search-common": "^1.2.24",
|
|
86
|
+
"@backstage/plugin-search-react": "^1.11.5",
|
|
87
|
+
"@backstage/plugin-techdocs-common": "^0.1.1",
|
|
88
|
+
"@backstage/plugin-techdocs-react": "^1.3.12",
|
|
89
|
+
"@backstage/types": "^1.2.2",
|
|
90
|
+
"@backstage/ui": "^0.16.0",
|
|
91
|
+
"@backstage/version-bridge": "^1.0.12",
|
|
92
92
|
"@material-ui/core": "^4.12.2",
|
|
93
93
|
"@material-ui/icons": "^4.9.1",
|
|
94
94
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
@@ -105,12 +105,12 @@
|
|
|
105
105
|
"zod": "^4.0.0"
|
|
106
106
|
},
|
|
107
107
|
"devDependencies": {
|
|
108
|
-
"@backstage/cli": "0.36.3
|
|
109
|
-
"@backstage/core-app-api": "1.20.2
|
|
110
|
-
"@backstage/dev-utils": "1.1.24
|
|
111
|
-
"@backstage/frontend-test-utils": "0.6.1
|
|
112
|
-
"@backstage/plugin-permission-common": "0.9.9",
|
|
113
|
-
"@backstage/test-utils": "1.7.19
|
|
108
|
+
"@backstage/cli": "^0.36.3",
|
|
109
|
+
"@backstage/core-app-api": "^1.20.2",
|
|
110
|
+
"@backstage/dev-utils": "^1.1.24",
|
|
111
|
+
"@backstage/frontend-test-utils": "^0.6.1",
|
|
112
|
+
"@backstage/plugin-permission-common": "^0.9.9",
|
|
113
|
+
"@backstage/test-utils": "^1.7.19",
|
|
114
114
|
"@testing-library/dom": "^10.0.0",
|
|
115
115
|
"@testing-library/jest-dom": "^6.0.0",
|
|
116
116
|
"@testing-library/react": "^16.0.0",
|
|
File without changes
|