@backstage-community/plugin-lighthouse 0.8.1 → 0.9.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../src/components/AuditView/index.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 Button from '@material-ui/core/Button';\nimport Grid from '@material-ui/core/Grid';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Alert from '@material-ui/lab/Alert';\nimport React, { ReactNode, useEffect, useState } from 'react';\nimport {\n generatePath,\n Link,\n resolvePath,\n useNavigate,\n useParams,\n} from 'react-router-dom';\nimport useAsync from 'react-use/esm/useAsync';\nimport { Audit, Website } from '@backstage-community/plugin-lighthouse-common';\nimport { lighthouseApiRef } from '../../api';\nimport { formatTime } from '../../utils';\nimport AuditStatusIcon from '../AuditStatusIcon';\nimport LighthouseSupportButton from '../SupportButton';\n\nimport {\n Content,\n ContentHeader,\n Header,\n HeaderLabel,\n InfoCard,\n Page,\n Progress,\n} from '@backstage/core-components';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { rootRouteRef } from '../../plugin';\n\n// TODO(freben): move all of this out of index\n\nconst useStyles = makeStyles({\n contentGrid: {\n height: '100%',\n },\n iframe: {\n border: '0',\n width: '100%',\n height: '100%',\n },\n errorOutput: { whiteSpace: 'pre' },\n});\n\ninterface AuditLinkListProps {\n audits?: Audit[];\n selectedId: string;\n}\nconst AuditLinkList = ({ audits = [], selectedId }: AuditLinkListProps) => {\n const fromPath = useRouteRef(rootRouteRef)?.() ?? '../';\n return (\n <List\n data-testid=\"audit-sidebar\"\n component=\"nav\"\n aria-label=\"lighthouse audit history\"\n >\n {audits.map(audit => (\n <ListItem\n key={audit.id}\n selected={audit.id === selectedId}\n button\n component={Link}\n replace\n to={resolvePath(\n generatePath('audit/:id', { id: audit.id }),\n fromPath,\n )}\n >\n <ListItemIcon>\n <AuditStatusIcon audit={audit} />\n </ListItemIcon>\n <ListItemText primary={formatTime(audit.timeCreated)} />\n </ListItem>\n ))}\n </List>\n );\n};\n\nconst AuditView = ({ audit }: { audit?: Audit }) => {\n const classes = useStyles();\n const params = useParams() as { id: string };\n const { url: lighthouseUrl } = useApi(lighthouseApiRef);\n\n if (audit?.status === 'RUNNING') return <Progress />;\n if (audit?.status === 'FAILED')\n return (\n <Alert severity=\"error\">\n This audit failed when attempting to run after several retries. Check\n that your instance of lighthouse-audit-service can successfully connect\n to your website and try again.\n </Alert>\n );\n\n return (\n <InfoCard variant=\"fullHeight\">\n <iframe\n className={classes.iframe}\n title={`Lighthouse audit${audit?.url ? ` for ${audit.url}` : ''}`}\n src={`${lighthouseUrl}/v1/audits/${encodeURIComponent(params.id)}`}\n />\n </InfoCard>\n );\n};\n\nexport const AuditViewContent = () => {\n const lighthouseApi = useApi(lighthouseApiRef);\n const fromPath = useRouteRef(rootRouteRef)?.() ?? '../';\n const params = useParams() as { id: string };\n const classes = useStyles();\n const navigate = useNavigate();\n\n const {\n loading,\n error,\n value: nextValue,\n } = useAsync(\n async () => await lighthouseApi.getWebsiteForAuditId(params.id),\n [params.id],\n );\n const [value, setValue] = useState<Website>();\n useEffect(() => {\n if (!!nextValue && nextValue.url !== value?.url) {\n setValue(nextValue);\n }\n }, [value, nextValue, setValue]);\n\n let content: ReactNode = null;\n if (value) {\n content = (\n <Grid container alignItems=\"stretch\" className={classes.contentGrid}>\n <Grid item xs={3}>\n <AuditLinkList audits={value?.audits} selectedId={params.id} />\n </Grid>\n <Grid item xs={9}>\n <AuditView audit={value?.audits.find(a => a.id === params.id)} />\n </Grid>\n </Grid>\n );\n } else if (loading) {\n content = <Progress />;\n } else if (error) {\n content = (\n <Alert\n data-testid=\"error-message\"\n severity=\"error\"\n className={classes.errorOutput}\n >\n {error.message}\n </Alert>\n );\n }\n\n let createAuditButtonUrl = 'create-audit';\n if (value?.url) {\n createAuditButtonUrl += `?url=${encodeURIComponent(value.url)}`;\n }\n\n return (\n <>\n <ContentHeader\n title={value?.url || 'Audit'}\n description=\"See a history of all Lighthouse audits for your website run through Backstage.\"\n >\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={() => navigate(resolvePath(createAuditButtonUrl, fromPath))}\n >\n Create New Audit\n </Button>\n <LighthouseSupportButton />\n </ContentHeader>\n {content}\n </>\n );\n};\n\nconst ConnectedAuditView = () => (\n <Page themeId=\"tool\">\n <Header title=\"Lighthouse\" subtitle=\"Website audits powered by Lighthouse\">\n <HeaderLabel label=\"Owner\" value=\"Spotify\" />\n <HeaderLabel label=\"Lifecycle\" value=\"Alpha\" />\n </Header>\n <Content stretch>\n <AuditViewContent />\n </Content>\n </Page>\n);\n\nexport default ConnectedAuditView;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAqDA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,WAAa,EAAA;AAAA,IACX,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,GAAA;AAAA,IACR,KAAO,EAAA,MAAA;AAAA,IACP,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,WAAA,EAAa,EAAE,UAAA,EAAY,KAAM;AACnC,CAAC,CAAA;AAMD,MAAM,gBAAgB,CAAC,EAAE,SAAS,EAAC,EAAG,YAAqC,KAAA;AACzE,EAAA,MAAM,QAAW,G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AO,GAAO,IAAA,OAAA;AAAA,MACrB,WAAY,EAAA;AAAA,KAAA;AAAA,oBAEZ,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,WAAA;AAAA,QACR,KAAM,EAAA,SAAA;AAAA,QACN,SAAS,MAAM,QAAA,CAAS,WAAY,CAAA,oBAAA,EAAsB,QAAQ,CAAC;AAAA,OAAA;AAAA,MACpE;AAAA,KAED;AAAA,wCACC,uBAAwB,EAAA,IAAA;AAAA,KAE1B,OACH,CAAA;AAEJ;AAEA,MAAM,kBAAqB,GAAA,sBACxB,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,SAAQ,MACZ,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,MAAO,EAAA,EAAA,KAAA,EAAM,cAAa,QAAS,EAAA,sCAAA,EAAA,kBACjC,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,EAAY,OAAM,OAAQ,EAAA,KAAA,EAAM,SAAU,EAAA,CAAA,kBAC1C,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,EAAY,KAAM,EAAA,WAAA,EAAY,OAAM,OAAQ,EAAA,CAC/C,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,OAAO,EAAA,IAAA,EAAA,kBACb,KAAA,CAAA,aAAA,CAAA,gBAAA,EAAA,IAAiB,CACpB,CACF;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../../src/components/AuditView/index.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 Button from '@material-ui/core/Button';\nimport Grid from '@material-ui/core/Grid';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Alert from '@material-ui/lab/Alert';\nimport { ReactNode, useEffect, useState } from 'react';\nimport {\n generatePath,\n Link,\n resolvePath,\n useNavigate,\n useParams,\n} from 'react-router-dom';\nimport useAsync from 'react-use/esm/useAsync';\nimport { Audit, Website } from '@backstage-community/plugin-lighthouse-common';\nimport { lighthouseApiRef } from '../../api';\nimport { formatTime } from '../../utils';\nimport AuditStatusIcon from '../AuditStatusIcon';\nimport LighthouseSupportButton from '../SupportButton';\n\nimport {\n Content,\n ContentHeader,\n Header,\n HeaderLabel,\n InfoCard,\n Page,\n Progress,\n} from '@backstage/core-components';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { rootRouteRef } from '../../plugin';\n\n// TODO(freben): move all of this out of index\n\nconst useStyles = makeStyles({\n contentGrid: {\n height: '100%',\n },\n iframe: {\n border: '0',\n width: '100%',\n height: '100%',\n },\n errorOutput: { whiteSpace: 'pre' },\n});\n\ninterface AuditLinkListProps {\n audits?: Audit[];\n selectedId: string;\n}\nconst AuditLinkList = ({ audits = [], selectedId }: AuditLinkListProps) => {\n const fromPath = useRouteRef(rootRouteRef)?.() ?? '../';\n return (\n <List\n data-testid=\"audit-sidebar\"\n component=\"nav\"\n aria-label=\"lighthouse audit history\"\n >\n {audits.map(audit => (\n <ListItem\n key={audit.id}\n selected={audit.id === selectedId}\n button\n component={Link}\n replace\n to={resolvePath(\n generatePath('audit/:id', { id: audit.id }),\n fromPath,\n )}\n >\n <ListItemIcon>\n <AuditStatusIcon audit={audit} />\n </ListItemIcon>\n <ListItemText primary={formatTime(audit.timeCreated)} />\n </ListItem>\n ))}\n </List>\n );\n};\n\nconst AuditView = ({ audit }: { audit?: Audit }) => {\n const classes = useStyles();\n const params = useParams() as { id: string };\n const { url: lighthouseUrl } = useApi(lighthouseApiRef);\n\n if (audit?.status === 'RUNNING') return <Progress />;\n if (audit?.status === 'FAILED')\n return (\n <Alert severity=\"error\">\n This audit failed when attempting to run after several retries. Check\n that your instance of lighthouse-audit-service can successfully connect\n to your website and try again.\n </Alert>\n );\n\n return (\n <InfoCard variant=\"fullHeight\">\n <iframe\n className={classes.iframe}\n title={`Lighthouse audit${audit?.url ? ` for ${audit.url}` : ''}`}\n src={`${lighthouseUrl}/v1/audits/${encodeURIComponent(params.id)}`}\n />\n </InfoCard>\n );\n};\n\nexport const AuditViewContent = () => {\n const lighthouseApi = useApi(lighthouseApiRef);\n const fromPath = useRouteRef(rootRouteRef)?.() ?? '../';\n const params = useParams() as { id: string };\n const classes = useStyles();\n const navigate = useNavigate();\n\n const {\n loading,\n error,\n value: nextValue,\n } = useAsync(\n async () => await lighthouseApi.getWebsiteForAuditId(params.id),\n [params.id],\n );\n const [value, setValue] = useState<Website>();\n useEffect(() => {\n if (!!nextValue && nextValue.url !== value?.url) {\n setValue(nextValue);\n }\n }, [value, nextValue, setValue]);\n\n let content: ReactNode = null;\n if (value) {\n content = (\n <Grid container alignItems=\"stretch\" className={classes.contentGrid}>\n <Grid item xs={3}>\n <AuditLinkList audits={value?.audits} selectedId={params.id} />\n </Grid>\n <Grid item xs={9}>\n <AuditView audit={value?.audits.find(a => a.id === params.id)} />\n </Grid>\n </Grid>\n );\n } else if (loading) {\n content = <Progress />;\n } else if (error) {\n content = (\n <Alert\n data-testid=\"error-message\"\n severity=\"error\"\n className={classes.errorOutput}\n >\n {error.message}\n </Alert>\n );\n }\n\n let createAuditButtonUrl = 'create-audit';\n if (value?.url) {\n createAuditButtonUrl += `?url=${encodeURIComponent(value.url)}`;\n }\n\n return (\n <>\n <ContentHeader\n title={value?.url || 'Audit'}\n description=\"See a history of all Lighthouse audits for your website run through Backstage.\"\n >\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={() => navigate(resolvePath(createAuditButtonUrl, fromPath))}\n >\n Create New Audit\n </Button>\n <LighthouseSupportButton />\n </ContentHeader>\n {content}\n </>\n );\n};\n\nconst ConnectedAuditView = () => (\n <Page themeId=\"tool\">\n <Header title=\"Lighthouse\" subtitle=\"Website audits powered by Lighthouse\">\n <HeaderLabel label=\"Owner\" value=\"Spotify\" />\n <HeaderLabel label=\"Lifecycle\" value=\"Alpha\" />\n </Header>\n <Content stretch>\n <AuditViewContent />\n </Content>\n </Page>\n);\n\nexport default ConnectedAuditView;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAqDA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,WAAa,EAAA;AAAA,IACX,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,GAAA;AAAA,IACR,KAAO,EAAA,MAAA;AAAA,IACP,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,WAAA,EAAa,EAAE,UAAA,EAAY,KAAM;AACnC,CAAC,CAAA;AAMD,MAAM,gBAAgB,CAAC,EAAE,SAAS,EAAC,EAAG,YAAqC,KAAA;AACzE,EAAA,MAAM,QAAW,GAAA,WAAA,CAAY,YAAY,CAAA,IAAS,IAAA,KAAA;AAClD,EACE,uBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,aAAY,EAAA,eAAA;AAAA,MACZ,SAAU,EAAA,KAAA;AAAA,MACV,YAAW,EAAA,0BAAA;AAAA,MAEV,QAAA,EAAA,MAAA,CAAO,IAAI,CACV,KAAA,qBAAA,IAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UAEC,QAAA,EAAU,MAAM,EAAO,KAAA,UAAA;AAAA,UACvB,MAAM,EAAA,IAAA;AAAA,UACN,SAAW,EAAA,IAAA;AAAA,UACX,OAAO,EAAA,IAAA;AAAA,UACP,EAAI,EAAA,WAAA;AAAA,YACF,aAAa,WAAa,EAAA,EAAE,EAAI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AA,EAAA,EAAK,SAAQ,MACZ,EAAA,QAAA,EAAA;AAAA,kBAAA,IAAA,CAAC,MAAO,EAAA,EAAA,KAAA,EAAM,YAAa,EAAA,QAAA,EAAS,sCAClC,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,WAAY,EAAA,EAAA,KAAA,EAAM,OAAQ,EAAA,KAAA,EAAM,SAAU,EAAA,CAAA;AAAA,oBAC1C,GAAA,CAAA,WAAA,EAAA,EAAY,KAAM,EAAA,WAAA,EAAY,OAAM,OAAQ,EAAA;AAAA,GAC/C,EAAA,CAAA;AAAA,sBACC,OAAQ,EAAA,EAAA,OAAA,EAAO,IACd,EAAA,QAAA,kBAAA,GAAA,CAAC,oBAAiB,CACpB,EAAA;AAAA,CACF,EAAA;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import Typography from '@material-ui/core/Typography';
3
3
  import { useWebsiteForEntity } from '../../hooks/useWebsiteForEntity.esm.js';
4
4
  import AuditStatusIcon from '../AuditStatusIcon/index.esm.js';
@@ -8,16 +8,31 @@ const LighthouseCategoryScoreStatus = (props) => {
8
8
  const scoreAsPercentage = Math.round(props.score * 100);
9
9
  switch (true) {
10
10
  case scoreAsPercentage >= 90:
11
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(StatusOK, null), scoreAsPercentage, "%");
11
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
12
+ /* @__PURE__ */ jsx(StatusOK, {}),
13
+ scoreAsPercentage,
14
+ "%"
15
+ ] });
12
16
  case (scoreAsPercentage >= 50 && scoreAsPercentage < 90):
13
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(StatusWarning, null), scoreAsPercentage, "%");
17
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
18
+ /* @__PURE__ */ jsx(StatusWarning, {}),
19
+ scoreAsPercentage,
20
+ "%"
21
+ ] });
14
22
  case scoreAsPercentage < 50:
15
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(StatusError, null), scoreAsPercentage, "%");
23
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
24
+ /* @__PURE__ */ jsx(StatusError, {}),
25
+ scoreAsPercentage,
26
+ "%"
27
+ ] });
16
28
  default:
17
- return /* @__PURE__ */ React.createElement(Typography, { component: "span" }, "N/A");
29
+ return /* @__PURE__ */ jsx(Typography, { component: "span", children: "N/A" });
18
30
  }
19
31
  };
20
- const LighthouseAuditStatus = (props) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(AuditStatusIcon, { audit: props.audit }), props.audit.status.toLocaleUpperCase("en-US"));
32
+ const LighthouseAuditStatus = (props) => /* @__PURE__ */ jsxs(Fragment, { children: [
33
+ /* @__PURE__ */ jsx(AuditStatusIcon, { audit: props.audit }),
34
+ props.audit.status.toLocaleUpperCase("en-US")
35
+ ] });
21
36
  const LighthouseAuditSummary = (props) => {
22
37
  const { audit, dense = false } = props;
23
38
  const { url } = audit;
@@ -27,30 +42,30 @@ const LighthouseAuditSummary = (props) => {
27
42
  const categoryIds = Object.keys(categories);
28
43
  categoryIds.forEach((id) => {
29
44
  const { title, score } = categories[id];
30
- flattenedCategoryData[title] = /* @__PURE__ */ React.createElement(LighthouseCategoryScoreStatus, { score });
45
+ flattenedCategoryData[title] = /* @__PURE__ */ jsx(LighthouseCategoryScoreStatus, { score });
31
46
  });
32
47
  }
33
48
  const tableData = {
34
49
  url,
35
- status: /* @__PURE__ */ React.createElement(LighthouseAuditStatus, { audit }),
50
+ status: /* @__PURE__ */ jsx(LighthouseAuditStatus, { audit }),
36
51
  ...flattenedCategoryData
37
52
  };
38
- return /* @__PURE__ */ React.createElement(StructuredMetadataTable, { metadata: tableData, dense });
53
+ return /* @__PURE__ */ jsx(StructuredMetadataTable, { metadata: tableData, dense });
39
54
  };
40
55
  const LastLighthouseAuditCard = (props) => {
41
56
  const { dense = false, variant } = props;
42
57
  const { value: website, loading, error } = useWebsiteForEntity();
43
58
  let content;
44
59
  if (loading) {
45
- content = /* @__PURE__ */ React.createElement(Progress, null);
60
+ content = /* @__PURE__ */ jsx(Progress, {});
46
61
  }
47
62
  if (error) {
48
- content = error.message.includes("no audited website found for url") ? /* @__PURE__ */ React.createElement(EmptyState, { title: "No Audits Found", missing: "data" }) : /* @__PURE__ */ React.createElement(WarningPanel, { severity: "error", title: "Could not load audit list." }, error.message);
63
+ content = error.message.includes("no audited website found for url") ? /* @__PURE__ */ jsx(EmptyState, { title: "No Audits Found", missing: "data" }) : /* @__PURE__ */ jsx(WarningPanel, { severity: "error", title: "Could not load audit list.", children: error.message });
49
64
  }
50
65
  if (website) {
51
- content = /* @__PURE__ */ React.createElement(LighthouseAuditSummary, { audit: website.lastAudit, dense });
66
+ content = /* @__PURE__ */ jsx(LighthouseAuditSummary, { audit: website.lastAudit, dense });
52
67
  }
53
- return /* @__PURE__ */ React.createElement(InfoCard, { title: "Lighthouse Audit", variant }, content);
68
+ return /* @__PURE__ */ jsx(InfoCard, { title: "Lighthouse Audit", variant, children: content });
54
69
  };
55
70
 
56
71
  export { LastLighthouseAuditCard };
@@ -1 +1 @@
1
- {"version":3,"file":"LastLighthouseAuditCard.esm.js","sources":["../../../src/components/Cards/LastLighthouseAuditCard.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 */\nimport React from 'react';\nimport Typography from '@material-ui/core/Typography';\nimport {\n Audit,\n AuditCompleted,\n LighthouseCategoryId,\n} from '@backstage-community/plugin-lighthouse-common';\nimport { useWebsiteForEntity } from '../../hooks/useWebsiteForEntity';\nimport AuditStatusIcon from '../AuditStatusIcon';\nimport {\n EmptyState,\n InfoCard,\n InfoCardVariants,\n Progress,\n StatusError,\n StatusOK,\n StatusWarning,\n StructuredMetadataTable,\n WarningPanel,\n} from '@backstage/core-components';\n\nconst LighthouseCategoryScoreStatus = (props: { score: number }) => {\n const scoreAsPercentage = Math.round(props.score * 100);\n switch (true) {\n case scoreAsPercentage >= 90:\n return (\n <>\n <StatusOK />\n {scoreAsPercentage}%\n </>\n );\n case scoreAsPercentage >= 50 && scoreAsPercentage < 90:\n return (\n <>\n <StatusWarning />\n {scoreAsPercentage}%\n </>\n );\n case scoreAsPercentage < 50:\n return (\n <>\n <StatusError />\n {scoreAsPercentage}%\n </>\n );\n default:\n return <Typography component=\"span\">N/A</Typography>;\n }\n};\n\nconst LighthouseAuditStatus = (props: { audit: Audit }) => (\n <>\n <AuditStatusIcon audit={props.audit} />\n {props.audit.status.toLocaleUpperCase('en-US')}\n </>\n);\n\nconst LighthouseAuditSummary = (props: { audit: Audit; dense?: boolean }) => {\n const { audit, dense = false } = props;\n const { url } = audit;\n const flattenedCategoryData: Record<string, React.ReactNode> = {};\n if (audit.status === 'COMPLETED') {\n const categories = (audit as AuditCompleted).categories;\n const categoryIds = Object.keys(categories) as LighthouseCategoryId[];\n categoryIds.forEach((id: LighthouseCategoryId) => {\n const { title, score } = categories[id];\n\n flattenedCategoryData[title] = (\n <LighthouseCategoryScoreStatus score={score} />\n );\n });\n }\n const tableData = {\n url,\n status: <LighthouseAuditStatus audit={audit} />,\n ...flattenedCategoryData,\n };\n\n return <StructuredMetadataTable metadata={tableData} dense={dense} />;\n};\n\n/** @public */\nexport const LastLighthouseAuditCard = (props: {\n dense?: boolean;\n variant?: InfoCardVariants;\n}) => {\n const { dense = false, variant } = props;\n const { value: website, loading, error } = useWebsiteForEntity();\n\n let content;\n if (loading) {\n content = <Progress />;\n }\n if (error) {\n // We only want to display this warning panel when its caused by an error other than no audits being found for the website\n content = error.message.includes('no audited website found for url') ? (\n <EmptyState title=\"No Audits Found\" missing=\"data\" />\n ) : (\n <WarningPanel severity=\"error\" title=\"Could not load audit list.\">\n {error.message}\n </WarningPanel>\n );\n }\n if (website) {\n content = (\n <LighthouseAuditSummary audit={website.lastAudit} dense={dense} />\n );\n }\n return (\n <InfoCard title=\"Lighthouse Audit\" variant={variant}>\n {content}\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;AAoCA,MAAM,6BAAA,GAAgC,CAAC,KAA6B,KAAA;AAClE,EAAA,MAAM,iBAAoB,GAAA,IAAA,CAAK,KAAM,CAAA,KAAA,CAAM,QAAQ,GAAG,CAAA;AACtD,EAAA,QAAQ,IAAM;AAAA,IACZ,KAAK,iBAAqB,IAAA,EAAA;AACxB,MAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,IAAA,CAAA,EACT,mBAAkB,GACrB,CAAA;AAAA,IAEJ,MAAK,iBAAqB,IAAA,EAAA,IAAM,iBAAoB,GAAA,EAAA;AAClD,MAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,IAAA,CAAA,EACd,mBAAkB,GACrB,CAAA;AAAA,IAEJ,KAAK,iBAAoB,GAAA,EAAA;AACvB,MAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAY,EAAA,IAAA,CAAA,EACZ,mBAAkB,GACrB,CAAA;AAAA,IAEJ;AACE,MAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAU,EAAA,MAAA,EAAA,EAAO,KAAG,CAAA;AAAA;AAE7C,CAAA;AAEA,MAAM,qBA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,GAAA,KAAA;AACnC,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,OAAS,EAAA,KAAA,KAAU,mBAAoB,EAAA;AAE/D,EAAI,IAAA,OAAA;AACJ,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,OAAA,uCAAW,QAAS,EAAA,IAAA,CAAA;AAAA;AAEtB,EAAA,IAAI,KAAO,EAAA;AAET,IAAA,OAAA,GAAU,MAAM,OAAQ,CAAA,QAAA,CAAS,kCAAkC,CACjE,mBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,KAAM,EAAA,iBAAA,EAAkB,SAAQ,MAAO,EAAA,CAAA,uCAElD,YAAa,EAAA,EAAA,QAAA,EAAS,SAAQ,KAAM,EAAA,4BAAA,EAAA,EAClC,MAAM,OACT,CAAA;AAAA;AAGJ,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,OAAA,mBACG,KAAA,CAAA,aAAA,CAAA,sBAAA,EAAA,EAAuB,KAAO,EAAA,OAAA,CAAQ,WAAW,KAAc,EAAA,CAAA;AAAA;AAGpE,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,KAAM,EAAA,kBAAA,EAAmB,WAChC,OACH,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"LastLighthouseAuditCard.esm.js","sources":["../../../src/components/Cards/LastLighthouseAuditCard.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 */\nimport type { ReactNode } from 'react';\nimport Typography from '@material-ui/core/Typography';\nimport {\n Audit,\n AuditCompleted,\n LighthouseCategoryId,\n} from '@backstage-community/plugin-lighthouse-common';\nimport { useWebsiteForEntity } from '../../hooks/useWebsiteForEntity';\nimport AuditStatusIcon from '../AuditStatusIcon';\nimport {\n EmptyState,\n InfoCard,\n InfoCardVariants,\n Progress,\n StatusError,\n StatusOK,\n StatusWarning,\n StructuredMetadataTable,\n WarningPanel,\n} from '@backstage/core-components';\n\nconst LighthouseCategoryScoreStatus = (props: { score: number }) => {\n const scoreAsPercentage = Math.round(props.score * 100);\n switch (true) {\n case scoreAsPercentage >= 90:\n return (\n <>\n <StatusOK />\n {scoreAsPercentage}%\n </>\n );\n case scoreAsPercentage >= 50 && scoreAsPercentage < 90:\n return (\n <>\n <StatusWarning />\n {scoreAsPercentage}%\n </>\n );\n case scoreAsPercentage < 50:\n return (\n <>\n <StatusError />\n {scoreAsPercentage}%\n </>\n );\n default:\n return <Typography component=\"span\">N/A</Typography>;\n }\n};\n\nconst LighthouseAuditStatus = (props: { audit: Audit }) => (\n <>\n <AuditStatusIcon audit={props.audit} />\n {props.audit.status.toLocaleUpperCase('en-US')}\n </>\n);\n\nconst LighthouseAuditSummary = (props: { audit: Audit; dense?: boolean }) => {\n const { audit, dense = false } = props;\n const { url } = audit;\n const flattenedCategoryData: Record<string, ReactNode> = {};\n if (audit.status === 'COMPLETED') {\n const categories = (audit as AuditCompleted).categories;\n const categoryIds = Object.keys(categories) as LighthouseCategoryId[];\n categoryIds.forEach((id: LighthouseCategoryId) => {\n const { title, score } = categories[id];\n\n flattenedCategoryData[title] = (\n <LighthouseCategoryScoreStatus score={score} />\n );\n });\n }\n const tableData = {\n url,\n status: <LighthouseAuditStatus audit={audit} />,\n ...flattenedCategoryData,\n };\n\n return <StructuredMetadataTable metadata={tableData} dense={dense} />;\n};\n\n/** @public */\nexport const LastLighthouseAuditCard = (props: {\n dense?: boolean;\n variant?: InfoCardVariants;\n}) => {\n const { dense = false, variant } = props;\n const { value: website, loading, error } = useWebsiteForEntity();\n\n let content;\n if (loading) {\n content = <Progress />;\n }\n if (error) {\n // We only want to display this warning panel when its caused by an error other than no audits being found for the website\n content = error.message.includes('no audited website found for url') ? (\n <EmptyState title=\"No Audits Found\" missing=\"data\" />\n ) : (\n <WarningPanel severity=\"error\" title=\"Could not load audit list.\">\n {error.message}\n </WarningPanel>\n );\n }\n if (website) {\n content = (\n <LighthouseAuditSummary audit={website.lastAudit} dense={dense} />\n );\n }\n return (\n <InfoCard title=\"Lighthouse Audit\" variant={variant}>\n {content}\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;AAoCA,MAAM,6BAAA,GAAgC,CAAC,KAA6B,KAAA;AAClE,EAAA,MAAM,iBAAoB,GAAA,IAAA,CAAK,KAAM,CAAA,KAAA,CAAM,QAAQ,GAAG,CAAA;AACtD,EAAA,QAAQ,IAAM;AAAA,IACZ,KAAK,iBAAqB,IAAA,EAAA;AACxB,MAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,QAAS,EAAA,EAAA,CAAA;AAAA,QACT,iBAAA;AAAA,QAAkB;AAAA,OACrB,EAAA,CAAA;AAAA,IAEJ,MAAK,iBAAqB,IAAA,EAAA,IAAM,iBAAoB,GAAA,EAAA;AAClD,MAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,aAAc,EAAA,EAAA,CAAA;AAAA,QACd,iBAAA;AAAA,QAAkB;AAAA,OACrB,EAAA,CAAA;AAAA,IAEJ,KAAK,iBAAoB,GAAA,EAAA;AACvB,MAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,WAAY,EAAA,EAAA,CAAA;AAAA,QACZ,iBAAA;AAAA,QAAkB;AAAA,OACrB,EAAA,CAAA;AAAA,IAEJ;AACE,MAAA,uBAAQ,GAAA,CAAA,UAAA,EAAA,EAAW,SAAU,EAAA,MAAA,EAAO,QAAG,EAAA,KAAA,E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EAAE,KAAA,GAAQ,KAAO,EAAA,OAAA,EAAY,GAAA,KAAA;AACnC,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,OAAS,EAAA,KAAA,KAAU,mBAAoB,EAAA;AAE/D,EAAI,IAAA,OAAA;AACJ,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,OAAA,uBAAW,QAAS,EAAA,EAAA,CAAA;AAAA;AAEtB,EAAA,IAAI,KAAO,EAAA;AAET,IAAA,OAAA,GAAU,MAAM,OAAQ,CAAA,QAAA,CAAS,kCAAkC,CACjE,mBAAA,GAAA,CAAC,cAAW,KAAM,EAAA,iBAAA,EAAkB,SAAQ,MAAO,EAAA,CAAA,uBAElD,YAAa,EAAA,EAAA,QAAA,EAAS,SAAQ,KAAM,EAAA,4BAAA,EAClC,gBAAM,OACT,EAAA,CAAA;AAAA;AAGJ,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,OAAA,mBACG,GAAA,CAAA,sBAAA,EAAA,EAAuB,KAAO,EAAA,OAAA,CAAQ,WAAW,KAAc,EAAA,CAAA;AAAA;AAGpE,EAAA,uBACG,GAAA,CAAA,QAAA,EAAA,EAAS,KAAM,EAAA,kBAAA,EAAmB,SAChC,QACH,EAAA,OAAA,EAAA,CAAA;AAEJ;;;;"}
@@ -1,3 +1,4 @@
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
1
2
  import Button from '@material-ui/core/Button';
2
3
  import Grid from '@material-ui/core/Grid';
3
4
  import List from '@material-ui/core/List';
@@ -5,7 +6,7 @@ import ListItem from '@material-ui/core/ListItem';
5
6
  import MenuItem from '@material-ui/core/MenuItem';
6
7
  import TextField from '@material-ui/core/TextField';
7
8
  import { makeStyles } from '@material-ui/core/styles';
8
- import React, { useState, useCallback } from 'react';
9
+ import { useState, useCallback } from 'react';
9
10
  import { useNavigate } from 'react-router-dom';
10
11
  import { lighthouseApiRef } from '../../api.esm.js';
11
12
  import { useQuery } from '../../utils.esm.js';
@@ -80,73 +81,91 @@ const CreateAuditContent = () => {
80
81
  setSubmitting(false);
81
82
  }
82
83
  }, [url, formFactor, lighthouseApi, setSubmitting, errorApi, navigate]);
83
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
84
- ContentHeader,
85
- {
86
- title: "Trigger a new audit",
87
- description: "Submitting this form will immediately trigger and store a new Lighthouse audit. Trigger audits to track your website's accessibility, performance, SEO, and best practices over time."
88
- },
89
- /* @__PURE__ */ React.createElement(LighthouseSupportButton, null)
90
- ), /* @__PURE__ */ React.createElement(Grid, { container: true, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, sm: 6 }, /* @__PURE__ */ React.createElement(InfoCard, null, /* @__PURE__ */ React.createElement(
91
- "form",
92
- {
93
- onSubmit: (ev) => {
94
- ev.preventDefault();
95
- triggerAudit();
96
- }
97
- },
98
- /* @__PURE__ */ React.createElement(List, null, /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(
99
- TextField,
84
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
85
+ /* @__PURE__ */ jsx(
86
+ ContentHeader,
100
87
  {
101
- name: "lighthouse-create-audit-url-tf",
102
- className: classes.input,
103
- label: "URL",
104
- placeholder: "https://spotify.com",
105
- helperText: "The target URL for Lighthouse to use.",
106
- required: true,
107
- disabled: submitting,
108
- onChange: (ev) => setUrl(ev.target.value),
109
- value: url,
110
- inputProps: { "aria-label": "URL" }
88
+ title: "Trigger a new audit",
89
+ description: "Submitting this form will immediately trigger and store a new Lighthouse audit. Trigger audits to track your website's accessibility, performance, SEO, and best practices over time.",
90
+ children: /* @__PURE__ */ jsx(LighthouseSupportButton, {})
111
91
  }
112
- )), /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(
113
- TextField,
114
- {
115
- name: "lighthouse-create-audit-emulated-form-factor-tf",
116
- className: classes.input,
117
- label: "Emulated Form Factor",
118
- helperText: "Device to simulate when auditing",
119
- select: true,
120
- required: true,
121
- disabled: submitting,
122
- onChange: (ev) => setFormFactor(ev.target.value),
123
- value: formFactor,
124
- inputProps: { "aria-label": "Emulated form factor" }
125
- },
126
- /* @__PURE__ */ React.createElement(MenuItem, { value: "mobile" }, "Mobile"),
127
- /* @__PURE__ */ React.createElement(MenuItem, { value: "desktop" }, "Desktop")
128
- )), /* @__PURE__ */ React.createElement(ListItem, { className: classes.buttonList }, /* @__PURE__ */ React.createElement(
129
- Button,
92
+ ),
93
+ /* @__PURE__ */ jsx(Grid, { container: true, direction: "column", children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, sm: 6, children: /* @__PURE__ */ jsx(InfoCard, { children: /* @__PURE__ */ jsx(
94
+ "form",
130
95
  {
131
- variant: "outlined",
132
- color: "primary",
133
- onClick: () => navigate(".."),
134
- disabled: submitting
135
- },
136
- "Cancel"
137
- ), /* @__PURE__ */ React.createElement(
138
- Button,
139
- {
140
- variant: "contained",
141
- color: "primary",
142
- type: "submit",
143
- disabled: submitting
144
- },
145
- "Create Audit"
146
- )))
147
- )))));
96
+ onSubmit: (ev) => {
97
+ ev.preventDefault();
98
+ triggerAudit();
99
+ },
100
+ children: /* @__PURE__ */ jsxs(List, { children: [
101
+ /* @__PURE__ */ jsx(ListItem, { children: /* @__PURE__ */ jsx(
102
+ TextField,
103
+ {
104
+ name: "lighthouse-create-audit-url-tf",
105
+ className: classes.input,
106
+ label: "URL",
107
+ placeholder: "https://spotify.com",
108
+ helperText: "The target URL for Lighthouse to use.",
109
+ required: true,
110
+ disabled: submitting,
111
+ onChange: (ev) => setUrl(ev.target.value),
112
+ value: url,
113
+ inputProps: { "aria-label": "URL" }
114
+ }
115
+ ) }),
116
+ /* @__PURE__ */ jsx(ListItem, { children: /* @__PURE__ */ jsxs(
117
+ TextField,
118
+ {
119
+ name: "lighthouse-create-audit-emulated-form-factor-tf",
120
+ className: classes.input,
121
+ label: "Emulated Form Factor",
122
+ helperText: "Device to simulate when auditing",
123
+ select: true,
124
+ required: true,
125
+ disabled: submitting,
126
+ onChange: (ev) => setFormFactor(ev.target.value),
127
+ value: formFactor,
128
+ inputProps: { "aria-label": "Emulated form factor" },
129
+ children: [
130
+ /* @__PURE__ */ jsx(MenuItem, { value: "mobile", children: "Mobile" }),
131
+ /* @__PURE__ */ jsx(MenuItem, { value: "desktop", children: "Desktop" })
132
+ ]
133
+ }
134
+ ) }),
135
+ /* @__PURE__ */ jsxs(ListItem, { className: classes.buttonList, children: [
136
+ /* @__PURE__ */ jsx(
137
+ Button,
138
+ {
139
+ variant: "outlined",
140
+ color: "primary",
141
+ onClick: () => navigate(".."),
142
+ disabled: submitting,
143
+ children: "Cancel"
144
+ }
145
+ ),
146
+ /* @__PURE__ */ jsx(
147
+ Button,
148
+ {
149
+ variant: "contained",
150
+ color: "primary",
151
+ type: "submit",
152
+ disabled: submitting,
153
+ children: "Create Audit"
154
+ }
155
+ )
156
+ ] })
157
+ ] })
158
+ }
159
+ ) }) }) })
160
+ ] });
148
161
  };
149
- const CreateAudit = () => /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Header, { title: "Lighthouse", subtitle: "Website audits powered by Lighthouse" }, /* @__PURE__ */ React.createElement(HeaderLabel, { label: "Owner", value: "Spotify" }), /* @__PURE__ */ React.createElement(HeaderLabel, { label: "Lifecycle", value: "Alpha" })), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(CreateAuditContent, null)));
162
+ const CreateAudit = () => /* @__PURE__ */ jsxs(Page, { themeId: "tool", children: [
163
+ /* @__PURE__ */ jsxs(Header, { title: "Lighthouse", subtitle: "Website audits powered by Lighthouse", children: [
164
+ /* @__PURE__ */ jsx(HeaderLabel, { label: "Owner", value: "Spotify" }),
165
+ /* @__PURE__ */ jsx(HeaderLabel, { label: "Lifecycle", value: "Alpha" })
166
+ ] }),
167
+ /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(CreateAuditContent, {}) })
168
+ ] });
150
169
 
151
170
  export { CreateAuditContent, CreateAudit as default };
152
171
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../src/components/CreateAudit/index.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 Button from '@material-ui/core/Button';\nimport Grid from '@material-ui/core/Grid';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport TextField from '@material-ui/core/TextField';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React, { useCallback, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport {\n FormFactor,\n LighthouseConfigSettings,\n} from '@backstage-community/plugin-lighthouse-common';\nimport { lighthouseApiRef } from '../../api';\nimport { useQuery } from '../../utils';\nimport LighthouseSupportButton from '../SupportButton';\n\nimport {\n Content,\n ContentHeader,\n Header,\n HeaderLabel,\n InfoCard,\n Page,\n} from '@backstage/core-components';\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\n\n// TODO(freben): move all of this out of index\n\nconst useStyles = makeStyles(theme => ({\n input: {\n minWidth: 300,\n [theme.breakpoints.down('xs')]: {\n minWidth: '100%',\n },\n },\n buttonList: {\n marginLeft: theme.spacing(-1),\n marginRight: theme.spacing(-1),\n '& > *': {\n margin: theme.spacing(1),\n },\n [theme.breakpoints.down('xs')]: {\n marginLeft: 0,\n marginRight: 0,\n flexDirection: 'column',\n '& > *': {\n width: '100%',\n },\n },\n },\n}));\n\nconst formFactorToScreenEmulationMap: Record<\n FormFactor,\n LighthouseConfigSettings['screenEmulation']\n> = {\n // the default is mobile, so no need to override\n mobile: undefined,\n // Values from lighthouse's cli \"desktop\" preset\n // https://github.com/GoogleChrome/lighthouse/blob/a6738e0033e7e5ca308b97c1c36f298b7d399402/lighthouse-core/config/constants.js#L71-L77\n desktop: {\n mobile: false,\n width: 1350,\n height: 940,\n deviceScaleFactor: 1,\n disabled: false,\n },\n};\n\nexport const CreateAuditContent = () => {\n const errorApi = useApi(errorApiRef);\n const lighthouseApi = useApi(lighthouseApiRef);\n const classes = useStyles();\n const query = useQuery();\n const navigate = useNavigate();\n const [submitting, setSubmitting] = useState(false);\n const [url, setUrl] = useState<string>(query.get('url') || '');\n const [formFactor, setFormFactor] = useState<FormFactor>('mobile');\n\n const triggerAudit = useCallback(async (): Promise<void> => {\n setSubmitting(true);\n try {\n // TODO use the id from the response to redirect to the audit page for that id when\n // FAILED and RUNNING audits are supported\n await lighthouseApi.triggerAudit({\n url: url.replace(/\\/$/, ''),\n options: {\n lighthouseConfig: {\n settings: {\n formFactor,\n emulatedFormFactor: formFactor,\n screenEmulation: formFactorToScreenEmulationMap[formFactor],\n },\n },\n },\n });\n navigate('..');\n } catch (err) {\n errorApi.post(err);\n } finally {\n setSubmitting(false);\n }\n }, [url, formFactor, lighthouseApi, setSubmitting, errorApi, navigate]);\n\n return (\n <>\n <ContentHeader\n title=\"Trigger a new audit\"\n description=\"Submitting this form will immediately trigger and store a new Lighthouse audit. Trigger audits to track your website's accessibility, performance, SEO, and best practices over time.\"\n >\n <LighthouseSupportButton />\n </ContentHeader>\n <Grid container direction=\"column\">\n <Grid item xs={12} sm={6}>\n <InfoCard>\n <form\n onSubmit={ev => {\n ev.preventDefault();\n triggerAudit();\n }}\n >\n <List>\n <ListItem>\n <TextField\n name=\"lighthouse-create-audit-url-tf\"\n className={classes.input}\n label=\"URL\"\n placeholder=\"https://spotify.com\"\n helperText=\"The target URL for Lighthouse to use.\"\n required\n disabled={submitting}\n onChange={ev => setUrl(ev.target.value)}\n value={url}\n inputProps={{ 'aria-label': 'URL' }}\n />\n </ListItem>\n <ListItem>\n <TextField\n name=\"lighthouse-create-audit-emulated-form-factor-tf\"\n className={classes.input}\n label=\"Emulated Form Factor\"\n helperText=\"Device to simulate when auditing\"\n select\n required\n disabled={submitting}\n onChange={ev =>\n setFormFactor(ev.target.value as FormFactor)\n }\n value={formFactor}\n inputProps={{ 'aria-label': 'Emulated form factor' }}\n >\n <MenuItem value=\"mobile\">Mobile</MenuItem>\n <MenuItem value=\"desktop\">Desktop</MenuItem>\n </TextField>\n </ListItem>\n <ListItem className={classes.buttonList}>\n <Button\n variant=\"outlined\"\n color=\"primary\"\n onClick={() => navigate('..')}\n disabled={submitting}\n >\n Cancel\n </Button>\n <Button\n variant=\"contained\"\n color=\"primary\"\n type=\"submit\"\n disabled={submitting}\n >\n Create Audit\n </Button>\n </ListItem>\n </List>\n </form>\n </InfoCard>\n </Grid>\n </Grid>\n </>\n );\n};\n\nconst CreateAudit = () => (\n <Page themeId=\"tool\">\n <Header title=\"Lighthouse\" subtitle=\"Website audits powered by Lighthouse\">\n <HeaderLabel label=\"Owner\" value=\"Spotify\" />\n <HeaderLabel label=\"Lifecycle\" value=\"Alpha\" />\n </Header>\n <Content>\n <CreateAuditContent />\n </Content>\n </Page>\n);\n\nexport default CreateAudit;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA6CA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,KAAO,EAAA;AAAA,IACL,QAAU,EAAA,GAAA;AAAA,IACV,CAAC,KAAM,CAAA,WAAA,CAAY,IAAK,CAAA,IAAI,CAAC,GAAG;AAAA,MAC9B,QAAU,EAAA;AAAA;AACZ,GACF;AAAA,EACA,UAAY,EAAA;AAAA,IACV,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,CAAE,CAAA,CAAA;AAAA,IAC5B,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,CAAE,CAAA,CAAA;AAAA,I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AAA,SAAA,EAAW,QAAQ,UAC3B,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,UAAA;AAAA,QACR,KAAM,EAAA,SAAA;AAAA,QACN,OAAA,EAAS,MAAM,QAAA,CAAS,IAAI,CAAA;AAAA,QAC5B,QAAU,EAAA;AAAA,OAAA;AAAA,MACX;AAAA,KAGD,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,WAAA;AAAA,QACR,KAAM,EAAA,SAAA;AAAA,QACN,IAAK,EAAA,QAAA;AAAA,QACL,QAAU,EAAA;AAAA,OAAA;AAAA,MACX;AAAA,KAGH,CACF;AAAA,GAEJ,CACF,CACF,CACF,CAAA;AAEJ;AAEA,MAAM,WAAc,GAAA,sBACjB,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,SAAQ,MACZ,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,MAAO,EAAA,EAAA,KAAA,EAAM,YAAa,EAAA,QAAA,EAAS,sCAClC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,eAAY,KAAM,EAAA,OAAA,EAAQ,KAAM,EAAA,SAAA,EAAU,CAC3C,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAY,EAAA,EAAA,KAAA,EAAM,aAAY,KAAM,EAAA,OAAA,EAAQ,CAC/C,CAAA,kBACC,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,kBAAA,EAAA,IAAmB,CACtB,CACF;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../../src/components/CreateAudit/index.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 Button from '@material-ui/core/Button';\nimport Grid from '@material-ui/core/Grid';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport TextField from '@material-ui/core/TextField';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useCallback, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport {\n FormFactor,\n LighthouseConfigSettings,\n} from '@backstage-community/plugin-lighthouse-common';\nimport { lighthouseApiRef } from '../../api';\nimport { useQuery } from '../../utils';\nimport LighthouseSupportButton from '../SupportButton';\n\nimport {\n Content,\n ContentHeader,\n Header,\n HeaderLabel,\n InfoCard,\n Page,\n} from '@backstage/core-components';\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\n\n// TODO(freben): move all of this out of index\n\nconst useStyles = makeStyles(theme => ({\n input: {\n minWidth: 300,\n [theme.breakpoints.down('xs')]: {\n minWidth: '100%',\n },\n },\n buttonList: {\n marginLeft: theme.spacing(-1),\n marginRight: theme.spacing(-1),\n '& > *': {\n margin: theme.spacing(1),\n },\n [theme.breakpoints.down('xs')]: {\n marginLeft: 0,\n marginRight: 0,\n flexDirection: 'column',\n '& > *': {\n width: '100%',\n },\n },\n },\n}));\n\nconst formFactorToScreenEmulationMap: Record<\n FormFactor,\n LighthouseConfigSettings['screenEmulation']\n> = {\n // the default is mobile, so no need to override\n mobile: undefined,\n // Values from lighthouse's cli \"desktop\" preset\n // https://github.com/GoogleChrome/lighthouse/blob/a6738e0033e7e5ca308b97c1c36f298b7d399402/lighthouse-core/config/constants.js#L71-L77\n desktop: {\n mobile: false,\n width: 1350,\n height: 940,\n deviceScaleFactor: 1,\n disabled: false,\n },\n};\n\nexport const CreateAuditContent = () => {\n const errorApi = useApi(errorApiRef);\n const lighthouseApi = useApi(lighthouseApiRef);\n const classes = useStyles();\n const query = useQuery();\n const navigate = useNavigate();\n const [submitting, setSubmitting] = useState(false);\n const [url, setUrl] = useState<string>(query.get('url') || '');\n const [formFactor, setFormFactor] = useState<FormFactor>('mobile');\n\n const triggerAudit = useCallback(async (): Promise<void> => {\n setSubmitting(true);\n try {\n // TODO use the id from the response to redirect to the audit page for that id when\n // FAILED and RUNNING audits are supported\n await lighthouseApi.triggerAudit({\n url: url.replace(/\\/$/, ''),\n options: {\n lighthouseConfig: {\n settings: {\n formFactor,\n emulatedFormFactor: formFactor,\n screenEmulation: formFactorToScreenEmulationMap[formFactor],\n },\n },\n },\n });\n navigate('..');\n } catch (err) {\n errorApi.post(err);\n } finally {\n setSubmitting(false);\n }\n }, [url, formFactor, lighthouseApi, setSubmitting, errorApi, navigate]);\n\n return (\n <>\n <ContentHeader\n title=\"Trigger a new audit\"\n description=\"Submitting this form will immediately trigger and store a new Lighthouse audit. Trigger audits to track your website's accessibility, performance, SEO, and best practices over time.\"\n >\n <LighthouseSupportButton />\n </ContentHeader>\n <Grid container direction=\"column\">\n <Grid item xs={12} sm={6}>\n <InfoCard>\n <form\n onSubmit={ev => {\n ev.preventDefault();\n triggerAudit();\n }}\n >\n <List>\n <ListItem>\n <TextField\n name=\"lighthouse-create-audit-url-tf\"\n className={classes.input}\n label=\"URL\"\n placeholder=\"https://spotify.com\"\n helperText=\"The target URL for Lighthouse to use.\"\n required\n disabled={submitting}\n onChange={ev => setUrl(ev.target.value)}\n value={url}\n inputProps={{ 'aria-label': 'URL' }}\n />\n </ListItem>\n <ListItem>\n <TextField\n name=\"lighthouse-create-audit-emulated-form-factor-tf\"\n className={classes.input}\n label=\"Emulated Form Factor\"\n helperText=\"Device to simulate when auditing\"\n select\n required\n disabled={submitting}\n onChange={ev =>\n setFormFactor(ev.target.value as FormFactor)\n }\n value={formFactor}\n inputProps={{ 'aria-label': 'Emulated form factor' }}\n >\n <MenuItem value=\"mobile\">Mobile</MenuItem>\n <MenuItem value=\"desktop\">Desktop</MenuItem>\n </TextField>\n </ListItem>\n <ListItem className={classes.buttonList}>\n <Button\n variant=\"outlined\"\n color=\"primary\"\n onClick={() => navigate('..')}\n disabled={submitting}\n >\n Cancel\n </Button>\n <Button\n variant=\"contained\"\n color=\"primary\"\n type=\"submit\"\n disabled={submitting}\n >\n Create Audit\n </Button>\n </ListItem>\n </List>\n </form>\n </InfoCard>\n </Grid>\n </Grid>\n </>\n );\n};\n\nconst CreateAudit = () => (\n <Page themeId=\"tool\">\n <Header title=\"Lighthouse\" subtitle=\"Website audits powered by Lighthouse\">\n <HeaderLabel label=\"Owner\" value=\"Spotify\" />\n <HeaderLabel label=\"Lifecycle\" value=\"Alpha\" />\n </Header>\n <Content>\n <CreateAuditContent />\n </Content>\n </Page>\n);\n\nexport default CreateAudit;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA6CA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,KAAO,EAAA;AAAA,IACL,QAAU,EAAA,GAAA;AAAA,IACV,CAAC,KAAM,CAAA,WAAA,CAAY,IAAK,CAAA,IAAI,CAAC,GAAG;AAAA,MAC9B,QAAU,EAAA;AAAA;AACZ,GACF;AAAA,EACA,UAAY,EAAA;AAAA,IACV,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,CAAE,CAAA,CAAA;AAAA,IAC5B,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,CAAE,CAAA,CAAA;AAAA,IAC7B,OAAS,EAAA;AAAA,MACP,MAAA,EAAQ,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,KACzB;AAAA,IACA,CAAC,KAAM,CAAA,WAAA,CAAY,IAAK,CAAA,IAAI,CAAC,GAAG;AAAA,MAC9B,UAAY,EAAA,CAAA;AAAA,MACZ,WAAa,EAAA,CAAA;AAAA,MACb,aAAe,EAAA,QAAA;AAAA,MACf,OAAS,EAAA;AAAA,QACP,KAAO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AAC,MAAA;AAAA,cAAA;AAAA,gBACC,OAAQ,EAAA,WAAA;AAAA,gBACR,KAAM,EAAA,SAAA;AAAA,gBACN,IAAK,EAAA,QAAA;AAAA,gBACL,QAAU,EAAA,UAAA;AAAA,gBACX,QAAA,EAAA;AAAA;AAAA;AAED,WACF,EAAA;AAAA,SACF,EAAA;AAAA;AAAA,KACF,EACF,GACF,CACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;AAEA,MAAM,WAAc,GAAA,sBACjB,IAAA,CAAA,IAAA,EAAA,EAAK,SAAQ,MACZ,EAAA,QAAA,EAAA;AAAA,kBAAA,IAAA,CAAC,MAAO,EAAA,EAAA,KAAA,EAAM,YAAa,EAAA,QAAA,EAAS,sCAClC,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,WAAY,EAAA,EAAA,KAAA,EAAM,OAAQ,EAAA,KAAA,EAAM,SAAU,EAAA,CAAA;AAAA,oBAC1C,GAAA,CAAA,WAAA,EAAA,EAAY,KAAM,EAAA,WAAA,EAAY,OAAM,OAAQ,EAAA;AAAA,GAC/C,EAAA,CAAA;AAAA,kBACC,GAAA,CAAA,OAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,kBAAA,EAAA,EAAmB,CACtB,EAAA;AAAA,CACF,EAAA;;;;"}
@@ -1,10 +1,11 @@
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
1
2
  import Button from '@material-ui/core/Button';
2
3
  import Grid from '@material-ui/core/Grid';
3
4
  import Tab from '@material-ui/core/Tab';
4
5
  import Tabs from '@material-ui/core/Tabs';
5
6
  import { makeStyles } from '@material-ui/core/styles';
6
7
  import CloseIcon from '@material-ui/icons/Close';
7
- import React, { useState } from 'react';
8
+ import { useState } from 'react';
8
9
  import useLocalStorage from 'react-use/esm/useLocalStorage';
9
10
  import LighthouseSupportButton from '../SupportButton/index.esm.js';
10
11
  import { ContentHeader, InfoCard, Link, MarkdownContent } from '@backstage/core-components';
@@ -63,11 +64,11 @@ const useStyles = makeStyles((theme) => ({
63
64
  function GettingStartedCard() {
64
65
  const classes = useStyles();
65
66
  const [value, setValue] = useState(0);
66
- return /* @__PURE__ */ React.createElement(
67
+ return /* @__PURE__ */ jsxs(
67
68
  InfoCard,
68
69
  {
69
70
  title: "Get started",
70
- subheader: /* @__PURE__ */ React.createElement(
71
+ subheader: /* @__PURE__ */ jsxs(
71
72
  Tabs,
72
73
  {
73
74
  value,
@@ -75,24 +76,28 @@ function GettingStartedCard() {
75
76
  textColor: "primary",
76
77
  onChange: (_ev, newValue) => setValue(newValue),
77
78
  "aria-label": "get started tabs",
78
- className: classes.tabs
79
- },
80
- /* @__PURE__ */ React.createElement(Tab, { className: classes.tab, label: "Use cases" }),
81
- /* @__PURE__ */ React.createElement(Tab, { className: classes.tab, label: "Setup" })
79
+ className: classes.tabs,
80
+ children: [
81
+ /* @__PURE__ */ jsx(Tab, { className: classes.tab, label: "Use cases" }),
82
+ /* @__PURE__ */ jsx(Tab, { className: classes.tab, label: "Setup" })
83
+ ]
84
+ }
82
85
  ),
83
86
  divider: true,
84
- actions: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Grid, { container: true, direction: "row", justifyContent: "flex-end" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
87
+ actions: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Grid, { container: true, direction: "row", justifyContent: "flex-end", children: /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
85
88
  Button,
86
89
  {
87
90
  component: Link,
88
91
  to: "https://github.com/spotify/lighthouse-audit-service",
89
- size: "small"
90
- },
91
- "Check out the README"
92
- ))))
93
- },
94
- value === 0 && /* @__PURE__ */ React.createElement(MarkdownContent, { content: USE_CASES }),
95
- value === 1 && /* @__PURE__ */ React.createElement(MarkdownContent, { content: SETUP })
92
+ size: "small",
93
+ children: "Check out the README"
94
+ }
95
+ ) }) }) }),
96
+ children: [
97
+ value === 0 && /* @__PURE__ */ jsx(MarkdownContent, { content: USE_CASES }),
98
+ value === 1 && /* @__PURE__ */ jsx(MarkdownContent, { content: SETUP })
99
+ ]
100
+ }
96
101
  );
97
102
  }
98
103
  function LighthouseIntro({ onDismiss = () => {
@@ -103,27 +108,35 @@ function LighthouseIntro({ onDismiss = () => {
103
108
  false
104
109
  );
105
110
  if (dismissed) return null;
106
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ContentHeader, { title: "Welcome to Lighthouse in Backstage!" }, /* @__PURE__ */ React.createElement(LighthouseSupportButton, null)), /* @__PURE__ */ React.createElement(Grid, { className: classes.content, container: true, spacing: 3, direction: "row" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, sm: 6, md: 4 }, /* @__PURE__ */ React.createElement(GettingStartedCard, null)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, sm: 6, md: 8 }, /* @__PURE__ */ React.createElement(
107
- Grid,
108
- {
109
- container: true,
110
- justifyContent: "flex-end",
111
- alignItems: "flex-end",
112
- className: classes.closeButtonContainer
113
- },
114
- /* @__PURE__ */ React.createElement(Grid, { item: true, className: classes.closeButtonItem }, /* @__PURE__ */ React.createElement(
115
- Button,
116
- {
117
- variant: "text",
118
- onClick: () => {
119
- onDismiss();
120
- setDismissed(true);
111
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
112
+ /* @__PURE__ */ jsx(ContentHeader, { title: "Welcome to Lighthouse in Backstage!", children: /* @__PURE__ */ jsx(LighthouseSupportButton, {}) }),
113
+ /* @__PURE__ */ jsxs(Grid, { className: classes.content, container: true, spacing: 3, direction: "row", children: [
114
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, sm: 6, md: 4, children: /* @__PURE__ */ jsx(GettingStartedCard, {}) }),
115
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, sm: 6, md: 8, children: /* @__PURE__ */ jsx(
116
+ Grid,
117
+ {
118
+ container: true,
119
+ justifyContent: "flex-end",
120
+ alignItems: "flex-end",
121
+ className: classes.closeButtonContainer,
122
+ children: /* @__PURE__ */ jsx(Grid, { item: true, className: classes.closeButtonItem, children: /* @__PURE__ */ jsxs(
123
+ Button,
124
+ {
125
+ variant: "text",
126
+ onClick: () => {
127
+ onDismiss();
128
+ setDismissed(true);
129
+ },
130
+ children: [
131
+ /* @__PURE__ */ jsx(CloseIcon, {}),
132
+ " Hide intro"
133
+ ]
134
+ }
135
+ ) })
121
136
  }
122
- },
123
- /* @__PURE__ */ React.createElement(CloseIcon, null),
124
- " Hide intro"
125
- ))
126
- ))));
137
+ ) })
138
+ ] })
139
+ ] });
127
140
  }
128
141
 
129
142
  export { LIGHTHOUSE_INTRO_LOCAL_STORAGE, LighthouseIntro as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../src/components/Intro/index.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 Button from '@material-ui/core/Button';\nimport Grid from '@material-ui/core/Grid';\nimport Tab from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloseIcon from '@material-ui/icons/Close';\nimport React, { useState } from 'react';\nimport useLocalStorage from 'react-use/esm/useLocalStorage';\nimport LighthouseSupportButton from '../SupportButton';\nimport {\n ContentHeader,\n InfoCard,\n Link,\n MarkdownContent,\n} from '@backstage/core-components';\n\n// TODO(freben): move all of this out of index\n\nexport const LIGHTHOUSE_INTRO_LOCAL_STORAGE =\n '@backstage/lighthouse-plugin/intro-dismissed';\n\nconst USE_CASES = `\nGoogle's [Lighthouse](https://developers.google.com/web/tools/lighthouse) auditing tool for websites\nis a great open-source resource for benchmarking and improving the accessibility, performance, SEO, and best practices of your site.\nAt Spotify, we keep track of Lighthouse audit scores over time to look at trends and overall areas for investment.\n\nThis plugin allows you to generate on-demand Lighthouse audits for websites, and to track the trends for the\ntop-level categories of Lighthouse at a glance.\n\nIn the future, we hope to add support for scheduling audits (which we do internally), as well as allowing\ncustom runs of Lighthouse to be ingested (for auditing sites that require authentication or some session state).\n`;\n\nconst SETUP = `\nTo get started, you will need a running instance of [lighthouse-audit-service](https://github.com/spotify/lighthouse-audit-service).\n_It's likely you will need to enable CORS when running lighthouse-audit-service. Initialize the app\nwith the environment variable \\`LAS_CORS\\` set to \\`true\\`._\n\nWhen you have an instance running that Backstage can hook into, first install the plugin into your app:\n\n\\`\\`\\`sh\n# From your Backstage root directory\nyarn --cwd packages/app add @backstage-community/plugin-lighthouse\n\\`\\`\\`\n\nModify your app routes in \\`App.tsx\\` to include the \\`LighthousePage\\` component exported from the plugin, for example:\n\n\\`\\`\\`tsx\n// At the top imports\nimport { LighthousePage } from '@backstage-community/plugin-lighthouse';\n\n<FlatRoutes>\n // ...\n <Route path=\"/lighthouse\" element={<LighthousePage />} />\n // ...\n</FlatRoutes>;\n\\`\\`\\`\n\nThen configure the \\`lighthouse-audit-service\\` URL in your [\\`app-config.yaml\\`](https://github.com/backstage/backstage/blob/master/app-config.yaml).\n\n\\`\\`\\`yaml\nlighthouse:\n baseUrl: http://your-service-url\n\\`\\`\\`\n`;\n\nconst useStyles = makeStyles(theme => ({\n tabs: { marginBottom: -18 },\n tab: { minWidth: 72, paddingLeft: 1, paddingRight: 1 },\n content: { marginBottom: theme.spacing(2) },\n closeButtonContainer: { height: '100%' },\n closeButtonItem: { paddingBottom: 0 },\n}));\n\nfunction GettingStartedCard() {\n const classes = useStyles();\n const [value, setValue] = useState(0);\n return (\n <InfoCard\n title=\"Get started\"\n subheader={\n <Tabs\n value={value}\n indicatorColor=\"primary\"\n textColor=\"primary\"\n onChange={(_ev, newValue: number) => setValue(newValue)}\n aria-label=\"get started tabs\"\n className={classes.tabs}\n >\n <Tab className={classes.tab} label=\"Use cases\" />\n <Tab className={classes.tab} label=\"Setup\" />\n </Tabs>\n }\n divider\n actions={\n <>\n <Grid container direction=\"row\" justifyContent=\"flex-end\">\n <Grid item>\n <Button\n component={Link}\n to=\"https://github.com/spotify/lighthouse-audit-service\"\n size=\"small\"\n >\n Check out the README\n </Button>\n </Grid>\n </Grid>\n </>\n }\n >\n {value === 0 && <MarkdownContent content={USE_CASES} />}\n {value === 1 && <MarkdownContent content={SETUP} />}\n </InfoCard>\n );\n}\n\nexport interface Props {\n onDismiss?: () => void;\n}\n\nexport default function LighthouseIntro({ onDismiss = () => {} }: Props) {\n const classes = useStyles();\n const [dismissed, setDismissed] = useLocalStorage(\n LIGHTHOUSE_INTRO_LOCAL_STORAGE,\n false,\n );\n\n if (dismissed) return null;\n\n return (\n <>\n <ContentHeader title=\"Welcome to Lighthouse in Backstage!\">\n <LighthouseSupportButton />\n </ContentHeader>\n <Grid className={classes.content} container spacing={3} direction=\"row\">\n <Grid item xs={12} sm={6} md={4}>\n <GettingStartedCard />\n </Grid>\n {/* TODO add link and image for blog post here */}\n {/* <Grid item xs={12} sm={6} md={4}>\n <InfoCard>Blog</InfoCard>\n </Grid> */}\n <Grid item xs={12} sm={6} md={8}>\n <Grid\n container\n justifyContent=\"flex-end\"\n alignItems=\"flex-end\"\n className={classes.closeButtonContainer}\n >\n <Grid item className={classes.closeButtonItem}>\n <Button\n variant=\"text\"\n onClick={() => {\n onDismiss();\n setDismissed(true);\n }}\n >\n <CloseIcon /> Hide intro\n </Button>\n </Grid>\n </Grid>\n </Grid>\n </Grid>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAkCO,MAAM,8BACX,GAAA;AAEF,MAAM,SAAY,GAAA;AAAA;AAAA;AAAA;;AAAA;AA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AA,EAAW,QAAQ,OAAS,EAAA,SAAA,EAAS,MAAC,OAAS,EAAA,CAAA,EAAG,WAAU,KAChE,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAI,EAAI,EAAA,EAAA,EAAI,GAAG,EAAI,EAAA,CAAA,EAAA,sCAC3B,kBAAmB,EAAA,IAAA,CACtB,mBAKC,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,MAAI,IAAC,EAAA,EAAA,EAAI,IAAI,EAAI,EAAA,CAAA,EAAG,IAAI,CAC5B,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,cAAe,EAAA,UAAA;AAAA,MACf,UAAW,EAAA,UAAA;AAAA,MACX,WAAW,OAAQ,CAAA;AAAA,KAAA;AAAA,wCAElB,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,SAAA,EAAW,QAAQ,eAC5B,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,MAAA;AAAA,QACR,SAAS,MAAM;AACb,UAAU,SAAA,EAAA;AACV,UAAA,YAAA,CAAa,IAAI,CAAA;AAAA;AACnB,OAAA;AAAA,0CAEC,SAAU,EAAA,IAAA,CAAA;AAAA,MAAE;AAAA,KAEjB;AAAA,GAEJ,CACF,CACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../../src/components/Intro/index.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 Button from '@material-ui/core/Button';\nimport Grid from '@material-ui/core/Grid';\nimport Tab from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloseIcon from '@material-ui/icons/Close';\nimport { useState } from 'react';\nimport useLocalStorage from 'react-use/esm/useLocalStorage';\nimport LighthouseSupportButton from '../SupportButton';\nimport {\n ContentHeader,\n InfoCard,\n Link,\n MarkdownContent,\n} from '@backstage/core-components';\n\n// TODO(freben): move all of this out of index\n\nexport const LIGHTHOUSE_INTRO_LOCAL_STORAGE =\n '@backstage/lighthouse-plugin/intro-dismissed';\n\nconst USE_CASES = `\nGoogle's [Lighthouse](https://developers.google.com/web/tools/lighthouse) auditing tool for websites\nis a great open-source resource for benchmarking and improving the accessibility, performance, SEO, and best practices of your site.\nAt Spotify, we keep track of Lighthouse audit scores over time to look at trends and overall areas for investment.\n\nThis plugin allows you to generate on-demand Lighthouse audits for websites, and to track the trends for the\ntop-level categories of Lighthouse at a glance.\n\nIn the future, we hope to add support for scheduling audits (which we do internally), as well as allowing\ncustom runs of Lighthouse to be ingested (for auditing sites that require authentication or some session state).\n`;\n\nconst SETUP = `\nTo get started, you will need a running instance of [lighthouse-audit-service](https://github.com/spotify/lighthouse-audit-service).\n_It's likely you will need to enable CORS when running lighthouse-audit-service. Initialize the app\nwith the environment variable \\`LAS_CORS\\` set to \\`true\\`._\n\nWhen you have an instance running that Backstage can hook into, first install the plugin into your app:\n\n\\`\\`\\`sh\n# From your Backstage root directory\nyarn --cwd packages/app add @backstage-community/plugin-lighthouse\n\\`\\`\\`\n\nModify your app routes in \\`App.tsx\\` to include the \\`LighthousePage\\` component exported from the plugin, for example:\n\n\\`\\`\\`tsx\n// At the top imports\nimport { LighthousePage } from '@backstage-community/plugin-lighthouse';\n\n<FlatRoutes>\n // ...\n <Route path=\"/lighthouse\" element={<LighthousePage />} />\n // ...\n</FlatRoutes>;\n\\`\\`\\`\n\nThen configure the \\`lighthouse-audit-service\\` URL in your [\\`app-config.yaml\\`](https://github.com/backstage/backstage/blob/master/app-config.yaml).\n\n\\`\\`\\`yaml\nlighthouse:\n baseUrl: http://your-service-url\n\\`\\`\\`\n`;\n\nconst useStyles = makeStyles(theme => ({\n tabs: { marginBottom: -18 },\n tab: { minWidth: 72, paddingLeft: 1, paddingRight: 1 },\n content: { marginBottom: theme.spacing(2) },\n closeButtonContainer: { height: '100%' },\n closeButtonItem: { paddingBottom: 0 },\n}));\n\nfunction GettingStartedCard() {\n const classes = useStyles();\n const [value, setValue] = useState(0);\n return (\n <InfoCard\n title=\"Get started\"\n subheader={\n <Tabs\n value={value}\n indicatorColor=\"primary\"\n textColor=\"primary\"\n onChange={(_ev, newValue: number) => setValue(newValue)}\n aria-label=\"get started tabs\"\n className={classes.tabs}\n >\n <Tab className={classes.tab} label=\"Use cases\" />\n <Tab className={classes.tab} label=\"Setup\" />\n </Tabs>\n }\n divider\n actions={\n <>\n <Grid container direction=\"row\" justifyContent=\"flex-end\">\n <Grid item>\n <Button\n component={Link}\n to=\"https://github.com/spotify/lighthouse-audit-service\"\n size=\"small\"\n >\n Check out the README\n </Button>\n </Grid>\n </Grid>\n </>\n }\n >\n {value === 0 && <MarkdownContent content={USE_CASES} />}\n {value === 1 && <MarkdownContent content={SETUP} />}\n </InfoCard>\n );\n}\n\nexport interface Props {\n onDismiss?: () => void;\n}\n\nexport default function LighthouseIntro({ onDismiss = () => {} }: Props) {\n const classes = useStyles();\n const [dismissed, setDismissed] = useLocalStorage(\n LIGHTHOUSE_INTRO_LOCAL_STORAGE,\n false,\n );\n\n if (dismissed) return null;\n\n return (\n <>\n <ContentHeader title=\"Welcome to Lighthouse in Backstage!\">\n <LighthouseSupportButton />\n </ContentHeader>\n <Grid className={classes.content} container spacing={3} direction=\"row\">\n <Grid item xs={12} sm={6} md={4}>\n <GettingStartedCard />\n </Grid>\n {/* TODO add link and image for blog post here */}\n {/* <Grid item xs={12} sm={6} md={4}>\n <InfoCard>Blog</InfoCard>\n </Grid> */}\n <Grid item xs={12} sm={6} md={8}>\n <Grid\n container\n justifyContent=\"flex-end\"\n alignItems=\"flex-end\"\n className={classes.closeButtonContainer}\n >\n <Grid item className={classes.closeButtonItem}>\n <Button\n variant=\"text\"\n onClick={() => {\n onDismiss();\n setDismissed(true);\n }}\n >\n <CloseIcon /> Hide intro\n </Button>\n </Grid>\n </Grid>\n </Grid>\n </Grid>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAkCO,MAAM,8BACX,GAAA;AAEF,MAAM,SAAY,GAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA,CAAA;AAYlB,MAAM,KAAQ,GAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAiCd,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAA,EAAM,EAAE,YAAA,EAAc,CAAI,EAAA,EAAA;AAAA,EAC1B,KAAK,EAAE,QAAA,EAAU,IAAI,WAAa,EAAA,CAAA,EAAG,cAAc,CAAE,EAAA;AAAA,EACrD,SAAS,EAAE,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAE,EAAA;AAAA,EAC1C,oBAAA,EAAsB,EAAE,MAAA,EAAQ,MAAO,EAAA;AAAA,EACvC,eAAA,EAAiB,EAAE,aAAA,EAAe,CAAE;AACtC,CAAE,CAAA,CAAA;AAEF,SAAS,kBAAqB,GAAA;AAC5B,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,CAAC,CAAA;AACpC,EACE,uBAAA,IAAA;AAAA,IAAC,QAAA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IAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,OAAQ,EAAA,MAAA;AAAA,cACR,SAAS,MAAM;AACb,gBAAU,SAAA,EAAA;AACV,gBAAA,YAAA,CAAa,IAAI,CAAA;AAAA,eACnB;AAAA,cAEA,QAAA,EAAA;AAAA,gCAAA,GAAA,CAAC,SAAU,EAAA,EAAA,CAAA;AAAA,gBAAE;AAAA;AAAA;AAAA,WAEjB,EAAA;AAAA;AAAA,OAEJ,EAAA;AAAA,KACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { SupportButton } from '@backstage/core-components';
3
3
 
4
4
  function LighthouseSupportButton() {
5
- return /* @__PURE__ */ React.createElement(SupportButton, null, "Lighthouse audits run for any web domain, stored over time.");
5
+ return /* @__PURE__ */ jsx(SupportButton, { children: "Lighthouse audits run for any web domain, stored over time." });
6
6
  }
7
7
 
8
8
  export { LighthouseSupportButton as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../src/components/SupportButton/index.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 */\nimport React from 'react';\nimport { SupportButton } from '@backstage/core-components';\n\nexport default function LighthouseSupportButton() {\n return (\n <SupportButton>\n Lighthouse audits run for any web domain, stored over time.\n </SupportButton>\n );\n}\n"],"names":[],"mappings":";;;AAkBA,SAAwB,uBAA0B,GAAA;AAChD,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,qBAAc,6DAEf,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../../src/components/SupportButton/index.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 */\nimport { SupportButton } from '@backstage/core-components';\n\nexport default function LighthouseSupportButton() {\n return (\n <SupportButton>\n Lighthouse audits run for any web domain, stored over time.\n </SupportButton>\n );\n}\n"],"names":[],"mappings":";;;AAiBA,SAAwB,uBAA0B,GAAA;AAChD,EACE,uBAAA,GAAA,CAAC,iBAAc,QAEf,EAAA,6DAAA,EAAA,CAAA;AAEJ;;;;"}