UNPKG

@veecode-platform/plugin-kong-service-manager

Version:

63 lines (60 loc) 3.58 kB
import React from 'react'; import { BoxComponent } from '../shared/BoxComponent/BoxComponent.esm.js'; import '../shared/SelectComponent/Select.esm.js'; import { EmptyStateComponent } from '../shared/EmptyStateComponent/EmptyStateComponent.esm.js'; import '../shared/HtmlTooltip/HtmlTooltip.esm.js'; import { Box } from '@material-ui/core'; import '../shared/ButtonComponent/styles.esm.js'; import '../shared/LoadingComponent/styles.esm.js'; import '../shared/MissingAnnotation/styles.esm.js'; import '@backstage/plugin-catalog-react'; import '../shared/Fields/Fields.esm.js'; import '@material-ui/lab'; import '../shared/SkeletonComponent/styles.esm.js'; import '@material-ui/icons/OpenInNew'; import '@material-ui/icons/RemoveRedEye'; import '@material-ui/icons/VisibilityOff'; import '@material-ui/icons/Close'; import '@material-ui/icons/Info'; import '@material-ui/icons/ArrowDropDown'; import '@material-ui/icons/ArrowDropUp'; import '@material-ui/icons/AccountCircle'; import '@material-ui/icons/Add'; import '@material-ui/icons/Remove'; import '@material-ui/icons/Undo'; import { PluginsCards } from './PluginsCards/PluginsCards.esm.js'; import useAsync from 'react-use/lib/useAsync'; import { TabbedCard, CardTab } from '@backstage/core-components'; import ErrorBoundary from '../ErrorBoundary/ErrorBondary.esm.js'; import { usePluginListStyles } from './styles.esm.js'; import '../../context/KongServiceManagerContext.esm.js'; import { useKongServiceManagerContext } from '../../context/KongServiceManagerProvider.esm.js'; import { PluginListSkeleton } from './PluginListSkeleton/PluginListSkeleton.esm.js'; const PluginsList = (props) => { const { listAllPlugins, listAssociatedPlugins, associatedPluginsState, associatedPluginsName } = props; const { wrapper, emptyContent } = usePluginListStyles(); const { pluginsPerCategoryState } = useKongServiceManagerContext(); const getPluginsEnabled = async () => { await listAllPlugins(); }; const { loading, error } = useAsync(async () => { await Promise.all([ Promise.all([listAllPlugins(), listAssociatedPlugins()]) ]); }, []); React.useEffect(() => { getPluginsEnabled(); }, [associatedPluginsState]); if (error) return /* @__PURE__ */ React.createElement(EmptyStateComponent, null); return /* @__PURE__ */ React.createElement(ErrorBoundary, null, /* @__PURE__ */ React.createElement(BoxComponent, { title: "Kong Plugins", searchBar: true }, /* @__PURE__ */ React.createElement(Box, { className: wrapper }, /* @__PURE__ */ React.createElement(TabbedCard, { title: "" }, /* @__PURE__ */ React.createElement(CardTab, { label: "All Plugins" }, loading && /* @__PURE__ */ React.createElement(PluginListSkeleton, null), pluginsPerCategoryState && pluginsPerCategoryState.length >= 1 ? /* @__PURE__ */ React.createElement(PluginsCards, { listAllPlugins, associatedPluginsName }) : /* @__PURE__ */ React.createElement("div", { className: emptyContent }, " No data to display ...")), /* @__PURE__ */ React.createElement( CardTab, { label: "Associated Plugins" }, loading && /* @__PURE__ */ React.createElement(PluginListSkeleton, null), associatedPluginsState && associatedPluginsState.length >= 1 ? /* @__PURE__ */ React.createElement(PluginsCards, { filterByAssociated: true, listAllPlugins, associatedPluginsName }) : /* @__PURE__ */ React.createElement("div", { className: emptyContent }, " No data to display ...") ))))); }; var PluginsList$1 = React.memo(PluginsList); export { PluginsList$1 as default }; //# sourceMappingURL=PluginsList.esm.js.map