UNPKG

@digital-ai/plugin-dai-deploy

Version:

Frontend functionalities for the dai-deploy backstage plugin

52 lines (49 loc) 2.43 kB
import { makeStyles, Paper, Box } from '@material-ui/core'; import { TabbedCard, CardTab } from '@backstage/core-components'; import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react'; import { useApi, appThemeApiRef } from '@backstage/core-plugin-api'; import { DAI_DEPLOY_CI_ID_ANNOTATION } from '@digital-ai/plugin-dai-deploy-common'; import { DeploymentsHistoryTable } from '../DeploymentsHistoryTable/DeploymentsHistoryTable.esm.js'; import { DeploymentsTable } from '../DeploymentsTable/DeploymentsTable.esm.js'; import React from 'react'; import deployLogoBlack from '../../assets/deployLogoBlack.svg'; import deployLogoWhite from '../../assets/deployLogoWhite.svg'; import { isCiCdAvailable } from '../isCiCdAvailable.esm.js'; import { useObservable } from 'react-use'; const useStyles = makeStyles((theme) => ({ cardTabHeaderSpacing: { paddingLeft: theme.spacing(10), paddingRight: theme.spacing(10) } })); const DaiDeployEntityDeploymentsContent = () => { const { entity } = useEntity(); const classes = useStyles(); const appThemeApi = useApi(appThemeApiRef); const themeId = useObservable( appThemeApi.activeThemeId$(), appThemeApi.getActiveThemeId() ); if (isCiCdAvailable(entity)) { return /* @__PURE__ */ React.createElement(Paper, { elevation: 1 }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement( Box, { display: "inline-flex", alignItems: "center", paddingTop: 3, paddingLeft: 2, paddingBottom: 2 }, /* @__PURE__ */ React.createElement( "img", { src: themeId === "dark" ? deployLogoWhite : deployLogoBlack, alt: "Deploy logo" } ) ), /* @__PURE__ */ React.createElement(TabbedCard, { title: "" }, /* @__PURE__ */ React.createElement(CardTab, { label: "Active", className: classes.cardTabHeaderSpacing }, /* @__PURE__ */ React.createElement(DeploymentsTable, null)), /* @__PURE__ */ React.createElement(CardTab, { label: "Archived", className: classes.cardTabHeaderSpacing }, /* @__PURE__ */ React.createElement(DeploymentsHistoryTable, null))))); } return /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, { annotation: DAI_DEPLOY_CI_ID_ANNOTATION }); }; export { DaiDeployEntityDeploymentsContent }; //# sourceMappingURL=DaiDeployEntityDeploymentsContent.esm.js.map