UNPKG

@tduniec/backstage-plugin-time-saver

Version:

This plugin provides an implementation of charts and statistics related to your time savings that are coming from usage of your templates. Plugins is built from frontend and backend part. This part of plugin `frontend` is responsible of providing views wi

30 lines (27 loc) 1.41 kB
import { jsx, Fragment } from 'react/jsx-runtime'; import { useState, useEffect } from 'react'; import { useApi, configApiRef, fetchApiRef } from '@backstage/core-plugin-api'; import CircularProgress from '@material-ui/core/CircularProgress'; import { TableContainer, Paper, Table, TableBody, TableRow, TableCell } from '@material-ui/core'; function EmptyTimeSaver() { const configApi = useApi(configApiRef); const fetchApi = useApi(fetchApiRef); const [data, setData] = useState(null); useEffect(() => { const url = `${configApi.getString( "backend.baseUrl" )}/api/time-saver/templates`; fetchApi.fetch(url).then((response) => response.json()).then((dt) => setData(dt)).catch(); }, [configApi, fetchApi]); if (!data) { return /* @__PURE__ */ jsx(CircularProgress, {}); } const cellStyle = { color: "red", fontWeight: "bold", fontSize: "20px" }; return data && data.templates.length === 0 ? /* @__PURE__ */ jsx(TableContainer, { component: Paper, children: /* @__PURE__ */ jsx(Table, { children: /* @__PURE__ */ jsx(TableBody, { children: /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { style: cellStyle, children: "Please fill your templates with data, they will be displayed after their executions" }) }) }) }) }) : /* @__PURE__ */ jsx(Fragment, {}); } export { EmptyTimeSaver }; //# sourceMappingURL=EmptyDbContent.esm.js.map