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

29 lines (26 loc) 1.53 kB
import React__default, { 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__ */ React__default.createElement(CircularProgress, null); } const cellStyle = { color: "red", fontWeight: "bold", fontSize: "20px" }; return data && data.templates.length === 0 ? /* @__PURE__ */ React__default.createElement(TableContainer, { component: Paper }, /* @__PURE__ */ React__default.createElement(Table, null, /* @__PURE__ */ React__default.createElement(TableBody, null, /* @__PURE__ */ React__default.createElement(TableRow, null, /* @__PURE__ */ React__default.createElement(TableCell, { style: cellStyle }, "Please fill your templates with data, they will be displayed after their executions"))))) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null); } export { EmptyTimeSaver }; //# sourceMappingURL=EmptyDbContent.esm.js.map