@backstage-community/plugin-shortcuts 0.19.0 → 0.21.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @backstage-community/plugin-shortcuts
2
2
 
3
+ ## 0.21.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c1a0011: Backstage version bump to v1.51.0
8
+
9
+ ## 0.20.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 386f4fe: Backstage version bump to v1.50.2
14
+
3
15
  ## 0.19.0
4
16
 
5
17
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"AddShortcut.esm.js","sources":["../src/AddShortcut.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { useState } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport { SubmitHandler } from 'react-hook-form';\nimport Button from '@material-ui/core/Button';\nimport Card from '@material-ui/core/Card';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Popover from '@material-ui/core/Popover';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ShortcutForm } from './ShortcutForm';\nimport { FormValues, Shortcut } from './types';\nimport { ShortcutApi } from './api';\nimport { alertApiRef, useApi, useAnalytics } from '@backstage/core-plugin-api';\n\nconst useStyles = makeStyles(theme => ({\n card: {\n maxWidth: 400,\n },\n header: {\n marginBottom: theme.spacing(1),\n },\n button: {\n marginTop: theme.spacing(1),\n },\n}));\n\ntype Props = {\n onClose: () => void;\n anchorEl?: Element;\n api: ShortcutApi;\n\n allowExternalLinks?: boolean;\n};\n\nexport const AddShortcut = ({\n onClose,\n anchorEl,\n api,\n allowExternalLinks,\n}: Props) => {\n const classes = useStyles();\n const alertApi = useApi(alertApiRef);\n const { pathname, search } = useLocation();\n const [formValues, setFormValues] = useState<FormValues>();\n const open = Boolean(anchorEl);\n const analytics = useAnalytics();\n\n const handleSave: SubmitHandler<FormValues> = async ({ url, title }) => {\n analytics.captureEvent('click', `Clicked 'Save' in AddShortcut`);\n const shortcut: Omit<Shortcut, 'id'> = { url, title };\n\n try {\n await api.add(shortcut);\n alertApi.post({\n message: `Added shortcut '${title}' to your sidebar`,\n severity: 'success',\n display: 'transient',\n });\n } catch (error) {\n alertApi.post({\n message: `Could not add shortcut: ${error.message}`,\n severity: 'error',\n });\n }\n\n onClose();\n };\n\n const handlePaste = () => {\n setFormValues({ url: `${pathname}${search}`, title: document.title });\n };\n\n const handleClose = () => {\n setFormValues(undefined);\n onClose();\n };\n\n return (\n <Popover\n open={open}\n anchorEl={anchorEl}\n TransitionProps={{ onExit: handleClose }}\n onClose={onClose}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n >\n <Card className={classes.card}>\n <CardHeader\n className={classes.header}\n title=\"Add Shortcut\"\n titleTypographyProps={{ variant: 'subtitle2' }}\n action={\n <Button\n className={classes.button}\n variant=\"text\"\n size=\"small\"\n color=\"primary\"\n onClick={handlePaste}\n >\n Use current page\n </Button>\n }\n />\n <ShortcutForm\n onClose={handleClose}\n onSave={handleSave}\n formValues={formValues}\n allowExternalLinks={allowExternalLinks}\n />\n </Card>\n </Popover>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA6BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,GAC/B;AA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ddShortcut.esm.js","sources":["../src/AddShortcut.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { useState } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport { SubmitHandler } from 'react-hook-form';\nimport Button from '@material-ui/core/Button';\nimport Card from '@material-ui/core/Card';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Popover from '@material-ui/core/Popover';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ShortcutForm } from './ShortcutForm';\nimport { FormValues, Shortcut } from './types';\nimport { ShortcutApi } from './api';\nimport { alertApiRef, useApi, useAnalytics } from '@backstage/core-plugin-api';\n\nconst useStyles = makeStyles(theme => ({\n card: {\n maxWidth: 400,\n },\n header: {\n marginBottom: theme.spacing(1),\n },\n button: {\n marginTop: theme.spacing(1),\n },\n}));\n\ntype Props = {\n onClose: () => void;\n anchorEl?: Element;\n api: ShortcutApi;\n\n allowExternalLinks?: boolean;\n};\n\nexport const AddShortcut = ({\n onClose,\n anchorEl,\n api,\n allowExternalLinks,\n}: Props) => {\n const classes = useStyles();\n const alertApi = useApi(alertApiRef);\n const { pathname, search } = useLocation();\n const [formValues, setFormValues] = useState<FormValues>();\n const open = Boolean(anchorEl);\n const analytics = useAnalytics();\n\n const handleSave: SubmitHandler<FormValues> = async ({ url, title }) => {\n analytics.captureEvent('click', `Clicked 'Save' in AddShortcut`);\n const shortcut: Omit<Shortcut, 'id'> = { url, title };\n\n try {\n await api.add(shortcut);\n alertApi.post({\n message: `Added shortcut '${title}' to your sidebar`,\n severity: 'success',\n display: 'transient',\n });\n } catch (error) {\n alertApi.post({\n message: `Could not add shortcut: ${error.message}`,\n severity: 'error',\n });\n }\n\n onClose();\n };\n\n const handlePaste = () => {\n setFormValues({ url: `${pathname}${search}`, title: document.title });\n };\n\n const handleClose = () => {\n setFormValues(undefined);\n onClose();\n };\n\n return (\n <Popover\n open={open}\n anchorEl={anchorEl}\n TransitionProps={{ onExit: handleClose }}\n onClose={onClose}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n >\n <Card className={classes.card}>\n <CardHeader\n className={classes.header}\n title=\"Add Shortcut\"\n titleTypographyProps={{ variant: 'subtitle2' }}\n action={\n <Button\n className={classes.button}\n variant=\"text\"\n size=\"small\"\n color=\"primary\"\n onClick={handlePaste}\n >\n Use current page\n </Button>\n }\n />\n <ShortcutForm\n onClose={handleClose}\n onSave={handleSave}\n formValues={formValues}\n allowExternalLinks={allowExternalLinks}\n />\n </Card>\n </Popover>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA6BA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,IAAA,EAAM;AAAA,IACJ,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,YAAA,EAAc,KAAA,CAAM,OAAA,CAAQ,CAAC;AAAA,GAC/B;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,SAAA,EAAW,KAAA,CAAM,OAAA,CAAQ,CAAC;AAAA;AAE9B,CAAA,CAAE,CAAA;AAUK,MAAM,cAAc,CAAC;AAAA,EAC1B,OAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAA;AAAA,EACA;AACF,CAAA,KAAa;AACX,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,EAAE,QAAA,EAAU,MAAA,EAAO,GAAI,WAAA,EAAY;AACzC,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,QAAA,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EAAc;AAAA,QACZ,QAAA,EAAU,KAAA;AAAA,QACV,UAAA,EAAY;AAAA,OACd;AAAA,MAEA,QAAA,kBAAA,IAAA,CAAC,IAAA,EAAA,EAAK,SAAA,EAAW,OAAA,CAAQ,IAAA,EACvB,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,WAAW,OAAA,CAAQ,MAAA;AAAA,YACnB,KAAA,EAAM,cAAA;AAAA,YACN,oBAAA,EAAsB,EAAE,OAAA,EAAS,WAAA,EAAY;AAAA,YAC7C,MAAA,kBACE,GAAA;AAAA,cAAC,MAAA;AAAA,cAAA;AAAA,gBACC,WAAW,OAAA,CAAQ,MAAA;AAAA,gBACnB,OAAA,EAAQ,MAAA;AAAA,gBACR,IAAA,EAAK,OAAA;AAAA,gBACL,KAAA,EAAM,SAAA;AAAA,gBACN,OAAA,EAAS,WAAA;AAAA,gBACV,QAAA,EAAA;AAAA;AAAA;AAED;AAAA,SAEJ;AAAA,wBACA,GAAA;AAAA,UAAC,YAAA;AAAA,UAAA;AAAA,YACC,OAAA,EAAS,WAAA;AAAA,YACT,MAAA,EAAQ,UAAA;AAAA,YACR,UAAA;AAAA,YACA;AAAA;AAAA;AACF,OAAA,EACF;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditShortcut.esm.js","sources":["../src/EditShortcut.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { SubmitHandler } from 'react-hook-form';\nimport Button from '@material-ui/core/Button';\nimport Card from '@material-ui/core/Card';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Popover from '@material-ui/core/Popover';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ShortcutForm } from './ShortcutForm';\nimport { FormValues, Shortcut } from './types';\nimport DeleteIcon from '@material-ui/icons/Delete';\nimport { ShortcutApi } from './api';\nimport { alertApiRef, useApi, useAnalytics } from '@backstage/core-plugin-api';\n\nconst useStyles = makeStyles(theme => ({\n card: {\n width: 400,\n },\n header: {\n marginBottom: theme.spacing(1),\n },\n button: {\n marginTop: theme.spacing(1),\n },\n}));\n\ntype Props = {\n shortcut: Shortcut;\n onClose: () => void;\n anchorEl?: Element;\n api: ShortcutApi;\n allowExternalLinks?: boolean;\n};\n\nexport const EditShortcut = ({\n shortcut,\n onClose,\n anchorEl,\n api,\n allowExternalLinks,\n}: Props) => {\n const classes = useStyles();\n const alertApi = useApi(alertApiRef);\n const open = Boolean(anchorEl);\n const analytics = useAnalytics();\n\n const handleSave: SubmitHandler<FormValues> = async ({ url, title }) => {\n analytics.captureEvent('click', `Clicked 'Save' in Edit Shortcut`);\n const newShortcut: Shortcut = {\n ...shortcut,\n url,\n title,\n };\n\n try {\n await api.update(newShortcut);\n alertApi.post({\n message: `Updated shortcut '${title}'`,\n severity: 'success',\n display: 'transient',\n });\n } catch (error) {\n alertApi.post({\n message: `Could not update shortcut: ${error.message}`,\n severity: 'error',\n });\n }\n\n onClose();\n };\n\n const handleRemove = async () => {\n analytics.captureEvent('click', `Clicked 'Remove' in Edit Shortcut`);\n\n try {\n await api.remove(shortcut.id);\n alertApi.post({\n message: `Removed shortcut '${shortcut.title}' from your sidebar`,\n severity: 'success',\n display: 'transient',\n });\n } catch (error) {\n alertApi.post({\n message: `Could not delete shortcut: ${error.message}`,\n severity: 'error',\n });\n }\n };\n\n const handleClose = () => {\n onClose();\n };\n\n return (\n <Popover\n open={open}\n anchorEl={anchorEl}\n onClose={onClose}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n >\n <Card className={classes.card}>\n <CardHeader\n className={classes.header}\n title=\"Edit Shortcut\"\n titleTypographyProps={{ variant: 'subtitle2' }}\n action={\n <Button\n className={classes.button}\n variant=\"text\"\n size=\"small\"\n color=\"secondary\"\n startIcon={<DeleteIcon />}\n onClick={handleRemove}\n >\n Remove\n </Button>\n }\n />\n <ShortcutForm\n formValues={{ url: shortcut.url, title: shortcut.title }}\n onClose={handleClose}\n onSave={handleSave}\n allowExternalLinks={allowExternalLinks}\n />\n </Card>\n </Popover>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA4BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,KAAO,EAAA;AAAA,GACT;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,GAC/B;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA;AAE9B,CAAE,CAAA,CAAA;AAUK,MAAM,eAAe,CAAC;AAAA,EAC3B,QAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAA;AAAA,EACA;AACF,CAAa,KAAA;AACX,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,IAAA,GAAO,QAAQ,QAAQ,CAAA;AAC7B,EAAA,MAAM,YAAY,YAAa,EAAA;AAE/B,EAAA,MAAM,UAAwC,GAAA,OAAO,EAAE,GAAA,EAAK,OAAY,KAAA;AACtE,IAAU,SAAA,CAAA,YAAA,CAAa,SAAS,CAAiC,+BAAA,CAAA,CAAA;AACjE,IAAA,MAAM,WAAwB,GAAA;AAAA,MAC5B,GAAG,QAAA;AAAA,MACH,GAAA;AAAA,MACA;AAAA,KACF;AAEA,IAAI,IAAA;AACF,MAAM,MAAA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AAA,MAEA,QAAC,kBAAA,IAAA,CAAA,IAAA,EAAA,EAAK,SAAW,EAAA,OAAA,CAAQ,IACvB,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,WAAW,OAAQ,CAAA,MAAA;AAAA,YACnB,KAAM,EAAA,eAAA;AAAA,YACN,oBAAA,EAAsB,EAAE,OAAA,EAAS,WAAY,EAAA;AAAA,YAC7C,MACE,kBAAA,GAAA;AAAA,cAAC,MAAA;AAAA,cAAA;AAAA,gBACC,WAAW,OAAQ,CAAA,MAAA;AAAA,gBACnB,OAAQ,EAAA,MAAA;AAAA,gBACR,IAAK,EAAA,OAAA;AAAA,gBACL,KAAM,EAAA,WAAA;AAAA,gBACN,SAAA,sBAAY,UAAW,EAAA,EAAA,CAAA;AAAA,gBACvB,OAAS,EAAA,YAAA;AAAA,gBACV,QAAA,EAAA;AAAA;AAAA;AAED;AAAA,SAEJ;AAAA,wBACA,GAAA;AAAA,UAAC,YAAA;AAAA,UAAA;AAAA,YACC,YAAY,EAAE,GAAA,EAAK,SAAS,GAAK,EAAA,KAAA,EAAO,SAAS,KAAM,EAAA;AAAA,YACvD,OAAS,EAAA,WAAA;AAAA,YACT,MAAQ,EAAA,UAAA;AAAA,YACR;AAAA;AAAA;AACF,OACF,EAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"EditShortcut.esm.js","sources":["../src/EditShortcut.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { SubmitHandler } from 'react-hook-form';\nimport Button from '@material-ui/core/Button';\nimport Card from '@material-ui/core/Card';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Popover from '@material-ui/core/Popover';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ShortcutForm } from './ShortcutForm';\nimport { FormValues, Shortcut } from './types';\nimport DeleteIcon from '@material-ui/icons/Delete';\nimport { ShortcutApi } from './api';\nimport { alertApiRef, useApi, useAnalytics } from '@backstage/core-plugin-api';\n\nconst useStyles = makeStyles(theme => ({\n card: {\n width: 400,\n },\n header: {\n marginBottom: theme.spacing(1),\n },\n button: {\n marginTop: theme.spacing(1),\n },\n}));\n\ntype Props = {\n shortcut: Shortcut;\n onClose: () => void;\n anchorEl?: Element;\n api: ShortcutApi;\n allowExternalLinks?: boolean;\n};\n\nexport const EditShortcut = ({\n shortcut,\n onClose,\n anchorEl,\n api,\n allowExternalLinks,\n}: Props) => {\n const classes = useStyles();\n const alertApi = useApi(alertApiRef);\n const open = Boolean(anchorEl);\n const analytics = useAnalytics();\n\n const handleSave: SubmitHandler<FormValues> = async ({ url, title }) => {\n analytics.captureEvent('click', `Clicked 'Save' in Edit Shortcut`);\n const newShortcut: Shortcut = {\n ...shortcut,\n url,\n title,\n };\n\n try {\n await api.update(newShortcut);\n alertApi.post({\n message: `Updated shortcut '${title}'`,\n severity: 'success',\n display: 'transient',\n });\n } catch (error) {\n alertApi.post({\n message: `Could not update shortcut: ${error.message}`,\n severity: 'error',\n });\n }\n\n onClose();\n };\n\n const handleRemove = async () => {\n analytics.captureEvent('click', `Clicked 'Remove' in Edit Shortcut`);\n\n try {\n await api.remove(shortcut.id);\n alertApi.post({\n message: `Removed shortcut '${shortcut.title}' from your sidebar`,\n severity: 'success',\n display: 'transient',\n });\n } catch (error) {\n alertApi.post({\n message: `Could not delete shortcut: ${error.message}`,\n severity: 'error',\n });\n }\n };\n\n const handleClose = () => {\n onClose();\n };\n\n return (\n <Popover\n open={open}\n anchorEl={anchorEl}\n onClose={onClose}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n >\n <Card className={classes.card}>\n <CardHeader\n className={classes.header}\n title=\"Edit Shortcut\"\n titleTypographyProps={{ variant: 'subtitle2' }}\n action={\n <Button\n className={classes.button}\n variant=\"text\"\n size=\"small\"\n color=\"secondary\"\n startIcon={<DeleteIcon />}\n onClick={handleRemove}\n >\n Remove\n </Button>\n }\n />\n <ShortcutForm\n formValues={{ url: shortcut.url, title: shortcut.title }}\n onClose={handleClose}\n onSave={handleSave}\n allowExternalLinks={allowExternalLinks}\n />\n </Card>\n </Popover>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA4BA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,IAAA,EAAM;AAAA,IACJ,KAAA,EAAO;AAAA,GACT;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,YAAA,EAAc,KAAA,CAAM,OAAA,CAAQ,CAAC;AAAA,GAC/B;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,SAAA,EAAW,KAAA,CAAM,OAAA,CAAQ,CAAC;AAAA;AAE9B,CAAA,CAAE,CAAA;AAUK,MAAM,eAAe,CAAC;AAAA,EAC3B,QAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAA;AAAA,EACA;AACF,CAAA,KAAa;AACX,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,IAAA,GAAO,QAAQ,QAAQ,CAAA;AAC7B,EAAA,MAAM,YAAY,YAAA,EAAa;AAE/B,EAAA,MAAM,UAAA,GAAwC,OAAO,EAAE,GAAA,EAAK,OAAM,KAAM;AACtE,IAAA,SAAA,CAAU,YAAA,CAAa,SAAS,CAAA,+BAAA,CAAiC,CAAA;AACjE,IAAA,MAAM,WAAA,GAAwB;AAAA,MAC5B,GAAG,QAAA;AAAA,MACH,GAAA;AAAA,MACA;AAAA,KACF;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AA,EAAc;AAAA,QACZ,QAAA,EAAU,KAAA;AAAA,QACV,UAAA,EAAY;AAAA,OACd;AAAA,MAEA,QAAA,kBAAA,IAAA,CAAC,IAAA,EAAA,EAAK,SAAA,EAAW,OAAA,CAAQ,IAAA,EACvB,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,WAAW,OAAA,CAAQ,MAAA;AAAA,YACnB,KAAA,EAAM,eAAA;AAAA,YACN,oBAAA,EAAsB,EAAE,OAAA,EAAS,WAAA,EAAY;AAAA,YAC7C,MAAA,kBACE,GAAA;AAAA,cAAC,MAAA;AAAA,cAAA;AAAA,gBACC,WAAW,OAAA,CAAQ,MAAA;AAAA,gBACnB,OAAA,EAAQ,MAAA;AAAA,gBACR,IAAA,EAAK,OAAA;AAAA,gBACL,KAAA,EAAM,WAAA;AAAA,gBACN,SAAA,sBAAY,UAAA,EAAA,EAAW,CAAA;AAAA,gBACvB,OAAA,EAAS,YAAA;AAAA,gBACV,QAAA,EAAA;AAAA;AAAA;AAED;AAAA,SAEJ;AAAA,wBACA,GAAA;AAAA,UAAC,YAAA;AAAA,UAAA;AAAA,YACC,YAAY,EAAE,GAAA,EAAK,SAAS,GAAA,EAAK,KAAA,EAAO,SAAS,KAAA,EAAM;AAAA,YACvD,OAAA,EAAS,WAAA;AAAA,YACT,MAAA,EAAQ,UAAA;AAAA,YACR;AAAA;AAAA;AACF,OAAA,EACF;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ShortcutForm.esm.js","sources":["../src/ShortcutForm.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { useEffect, useRef } from 'react';\nimport useObservable from 'react-use/esm/useObservable';\nimport { useForm, SubmitHandler, Controller } from 'react-hook-form';\nimport Button from '@material-ui/core/Button';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport TextField from '@material-ui/core/TextField';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { FormValues } from './types';\nimport { shortcutsApiRef } from './api';\nimport { useApi } from '@backstage/core-plugin-api';\n\nconst useStyles = makeStyles(theme => ({\n field: {\n marginBottom: theme.spacing(2),\n },\n actionRoot: {\n paddingLeft: theme.spacing(2),\n paddingBottom: theme.spacing(3),\n justifyContent: 'flex-start',\n },\n}));\n\ntype Props = {\n formValues?: FormValues;\n onSave: SubmitHandler<FormValues>;\n onClose: () => void;\n allowExternalLinks?: boolean;\n};\n\nexport const ShortcutForm = ({\n formValues,\n onSave,\n onClose,\n allowExternalLinks,\n}: Props) => {\n const classes = useStyles();\n const shortcutApi = useApi(shortcutsApiRef);\n const shortcutData = useObservable(\n shortcutApi.shortcut$(),\n shortcutApi.get(),\n );\n const { current: originalValues } = useRef({\n url: formValues?.url ?? '',\n title: formValues?.title ?? '',\n });\n const {\n handleSubmit,\n reset,\n control,\n formState: { errors },\n } = useForm<FormValues>({\n mode: 'onChange',\n defaultValues: originalValues,\n });\n\n const titleIsUnique = (title: string) => {\n if (\n title !== originalValues.title &&\n shortcutData.some(shortcutTitle => shortcutTitle.title === title)\n )\n return 'A shortcut with this title already exists';\n return true;\n };\n\n const urlIsUnique = (url: string) => {\n if (\n url !== originalValues.url &&\n shortcutData.some(shortcutUrl => shortcutUrl.url === url)\n )\n return 'A shortcut with this url already exists';\n return true;\n };\n\n useEffect(() => {\n reset(formValues);\n }, [reset, formValues]);\n\n return (\n <>\n <CardContent>\n <Controller\n name=\"url\"\n control={control}\n rules={{\n required: true,\n validate: urlIsUnique,\n ...(allowExternalLinks\n ? {\n pattern: {\n value: /^(https?:\\/\\/)|\\//,\n message: 'Must start with http(s):// or /',\n },\n }\n : {\n pattern: {\n value: /^\\//,\n message: 'Must be a relative URL (starts with a /)',\n },\n }),\n }}\n render={({ field }) => (\n <TextField\n {...field}\n error={!!errors.url}\n helperText={errors.url?.message}\n type=\"text\"\n placeholder=\"Enter a URL\"\n InputLabelProps={{\n shrink: true,\n }}\n className={classes.field}\n fullWidth\n label=\"Shortcut URL\"\n variant=\"outlined\"\n autoComplete=\"off\"\n />\n )}\n />\n <Controller\n name=\"title\"\n control={control}\n rules={{\n required: true,\n validate: titleIsUnique,\n minLength: {\n value: 2,\n message: 'Must be at least 2 characters',\n },\n }}\n render={({ field }) => (\n <TextField\n {...field}\n error={!!errors.title}\n helperText={errors.title?.message}\n type=\"text\"\n placeholder=\"Enter a display name\"\n InputLabelProps={{\n shrink: true,\n }}\n className={classes.field}\n fullWidth\n label=\"Display Name\"\n variant=\"outlined\"\n autoComplete=\"off\"\n />\n )}\n />\n </CardContent>\n <CardActions classes={{ root: classes.actionRoot }}>\n <Button\n variant=\"contained\"\n color=\"primary\"\n size=\"large\"\n onClick={handleSubmit(onSave)}\n >\n Save\n </Button>\n <Button variant=\"outlined\" size=\"large\" onClick={onClose}>\n Cancel\n </Button>\n </CardActions>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA4BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,KAAO,EAAA;AAAA,IACL,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,GAC/B;AAAA,EACA,UAAY,EAAA;AAAA,IACV,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC5B,aAAA,EAAe,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC9B,cAAgB,EAAA;AAAA;AAEpB,CAAE,CAAA,CAAA;AASK,MAAM,eAAe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AAA,CAAA;AAAA,cACP,OAAS,EAAA;AAAA;AACX,WACF;AAAA,UACA,MAAQ,EAAA,CAAC,EAAE,KAAA,EACT,qBAAA,GAAA;AAAA,YAAC,SAAA;AAAA,YAAA;AAAA,cACE,GAAG,KAAA;AAAA,cACJ,KAAA,EAAO,CAAC,CAAC,MAAO,CAAA,KAAA;AAAA,cAChB,UAAA,EAAY,OAAO,KAAO,EAAA,OAAA;AAAA,cAC1B,IAAK,EAAA,MAAA;AAAA,cACL,WAAY,EAAA,sBAAA;AAAA,cACZ,eAAiB,EAAA;AAAA,gBACf,MAAQ,EAAA;AAAA,eACV;AAAA,cACA,WAAW,OAAQ,CAAA,KAAA;AAAA,cACnB,SAAS,EAAA,IAAA;AAAA,cACT,KAAM,EAAA,cAAA;AAAA,cACN,OAAQ,EAAA,UAAA;AAAA,cACR,YAAa,EAAA;AAAA;AAAA;AACf;AAAA;AAEJ,KACF,EAAA,CAAA;AAAA,yBACC,WAAY,EAAA,EAAA,OAAA,EAAS,EAAE,IAAM,EAAA,OAAA,CAAQ,YACpC,EAAA,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,OAAQ,EAAA,WAAA;AAAA,UACR,KAAM,EAAA,SAAA;AAAA,UACN,IAAK,EAAA,OAAA;AAAA,UACL,OAAA,EAAS,aAAa,MAAM,CAAA;AAAA,UAC7B,QAAA,EAAA;AAAA;AAAA,OAED;AAAA,sBACA,GAAA,CAAC,UAAO,OAAQ,EAAA,UAAA,EAAW,MAAK,OAAQ,EAAA,OAAA,EAAS,SAAS,QAE1D,EAAA,QAAA,EAAA;AAAA,KACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ShortcutForm.esm.js","sources":["../src/ShortcutForm.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { useEffect, useRef } from 'react';\nimport useObservable from 'react-use/esm/useObservable';\nimport { useForm, SubmitHandler, Controller } from 'react-hook-form';\nimport Button from '@material-ui/core/Button';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport TextField from '@material-ui/core/TextField';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { FormValues } from './types';\nimport { shortcutsApiRef } from './api';\nimport { useApi } from '@backstage/core-plugin-api';\n\nconst useStyles = makeStyles(theme => ({\n field: {\n marginBottom: theme.spacing(2),\n },\n actionRoot: {\n paddingLeft: theme.spacing(2),\n paddingBottom: theme.spacing(3),\n justifyContent: 'flex-start',\n },\n}));\n\ntype Props = {\n formValues?: FormValues;\n onSave: SubmitHandler<FormValues>;\n onClose: () => void;\n allowExternalLinks?: boolean;\n};\n\nexport const ShortcutForm = ({\n formValues,\n onSave,\n onClose,\n allowExternalLinks,\n}: Props) => {\n const classes = useStyles();\n const shortcutApi = useApi(shortcutsApiRef);\n const shortcutData = useObservable(\n shortcutApi.shortcut$(),\n shortcutApi.get(),\n );\n const { current: originalValues } = useRef({\n url: formValues?.url ?? '',\n title: formValues?.title ?? '',\n });\n const {\n handleSubmit,\n reset,\n control,\n formState: { errors },\n } = useForm<FormValues>({\n mode: 'onChange',\n defaultValues: originalValues,\n });\n\n const titleIsUnique = (title: string) => {\n if (\n title !== originalValues.title &&\n shortcutData.some(shortcutTitle => shortcutTitle.title === title)\n )\n return 'A shortcut with this title already exists';\n return true;\n };\n\n const urlIsUnique = (url: string) => {\n if (\n url !== originalValues.url &&\n shortcutData.some(shortcutUrl => shortcutUrl.url === url)\n )\n return 'A shortcut with this url already exists';\n return true;\n };\n\n useEffect(() => {\n reset(formValues);\n }, [reset, formValues]);\n\n return (\n <>\n <CardContent>\n <Controller\n name=\"url\"\n control={control}\n rules={{\n required: true,\n validate: urlIsUnique,\n ...(allowExternalLinks\n ? {\n pattern: {\n value: /^(https?:\\/\\/)|\\//,\n message: 'Must start with http(s):// or /',\n },\n }\n : {\n pattern: {\n value: /^\\//,\n message: 'Must be a relative URL (starts with a /)',\n },\n }),\n }}\n render={({ field }) => (\n <TextField\n {...field}\n error={!!errors.url}\n helperText={errors.url?.message}\n type=\"text\"\n placeholder=\"Enter a URL\"\n InputLabelProps={{\n shrink: true,\n }}\n className={classes.field}\n fullWidth\n label=\"Shortcut URL\"\n variant=\"outlined\"\n autoComplete=\"off\"\n />\n )}\n />\n <Controller\n name=\"title\"\n control={control}\n rules={{\n required: true,\n validate: titleIsUnique,\n minLength: {\n value: 2,\n message: 'Must be at least 2 characters',\n },\n }}\n render={({ field }) => (\n <TextField\n {...field}\n error={!!errors.title}\n helperText={errors.title?.message}\n type=\"text\"\n placeholder=\"Enter a display name\"\n InputLabelProps={{\n shrink: true,\n }}\n className={classes.field}\n fullWidth\n label=\"Display Name\"\n variant=\"outlined\"\n autoComplete=\"off\"\n />\n )}\n />\n </CardContent>\n <CardActions classes={{ root: classes.actionRoot }}>\n <Button\n variant=\"contained\"\n color=\"primary\"\n size=\"large\"\n onClick={handleSubmit(onSave)}\n >\n Save\n </Button>\n <Button variant=\"outlined\" size=\"large\" onClick={onClose}>\n Cancel\n </Button>\n </CardActions>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA4BA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,KAAA,EAAO;AAAA,IACL,YAAA,EAAc,KAAA,CAAM,OAAA,CAAQ,CAAC;AAAA,GAC/B;AAAA,EACA,UAAA,EAAY;AAAA,IACV,WAAA,EAAa,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC5B,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":3,"file":"ShortcutIcon.esm.js","sources":["../src/ShortcutIcon.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { makeStyles } from '@material-ui/core/styles';\nimport Avatar from '@material-ui/core/Avatar';\n\ntype Props = {\n text: string;\n color: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n avatar: (props: Props) => ({\n color: theme.palette.getContrastText(props.color),\n backgroundColor: props.color,\n width: 28,\n height: 28,\n fontWeight: 'bold',\n fontSize: 13,\n filter: 'contrast(150%) brightness(1.4)',\n }),\n}));\n\nexport const ShortcutIcon = (props: Props) => {\n const classes = useStyles(props);\n\n return <Avatar className={classes.avatar}>{props.text}</Avatar>;\n};\n"],"names":[],"mappings":";;;;AAwBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,MAAA,EAAQ,CAAC,KAAkB,MAAA;AAAA,IACzB,KAAO,EAAA,KAAA,CAAM,OAAQ,CAAA,eAAA,CAAgB,MAAM,KAAK,CAAA;AAAA,IAChD,iBAAiB,KAAM,CAAA,KAAA;AAAA,IACvB,KAAO,EAAA,EAAA;AAAA,IACP,MAAQ,EAAA,EAAA;AAAA,IACR,UAAY,EAAA,MAAA;AAAA,IACZ,QAAU,EAAA,EAAA;AAAA,IACV,MAAQ,EAAA;AAAA,GACV;AACF,CAAE,CAAA,CAAA;AAEW,MAAA,YAAA,GAAe,CAAC,KAAiB,KAAA;AAC5C,EAAM,MAAA,OAAA,GAAU,UAAU,KAAK,CAAA;AAE/B,EAAA,2BAAQ,MAAO,EAAA,EAAA,SAAA,EAAW,OAAQ,CAAA,MAAA,EAAS,gBAAM,IAAK,EAAA,CAAA;AACxD;;;;"}
1
+ {"version":3,"file":"ShortcutIcon.esm.js","sources":["../src/ShortcutIcon.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { makeStyles } from '@material-ui/core/styles';\nimport Avatar from '@material-ui/core/Avatar';\n\ntype Props = {\n text: string;\n color: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n avatar: (props: Props) => ({\n color: theme.palette.getContrastText(props.color),\n backgroundColor: props.color,\n width: 28,\n height: 28,\n fontWeight: 'bold',\n fontSize: 13,\n filter: 'contrast(150%) brightness(1.4)',\n }),\n}));\n\nexport const ShortcutIcon = (props: Props) => {\n const classes = useStyles(props);\n\n return <Avatar className={classes.avatar}>{props.text}</Avatar>;\n};\n"],"names":[],"mappings":";;;;AAwBA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,MAAA,EAAQ,CAAC,KAAA,MAAkB;AAAA,IACzB,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,eAAA,CAAgB,MAAM,KAAK,CAAA;AAAA,IAChD,iBAAiB,KAAA,CAAM,KAAA;AAAA,IACvB,KAAA,EAAO,EAAA;AAAA,IACP,MAAA,EAAQ,EAAA;AAAA,IACR,UAAA,EAAY,MAAA;AAAA,IACZ,QAAA,EAAU,EAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AACF,CAAA,CAAE,CAAA;AAEK,MAAM,YAAA,GAAe,CAAC,KAAA,KAAiB;AAC5C,EAAA,MAAM,OAAA,GAAU,UAAU,KAAK,CAAA;AAE/B,EAAA,2BAAQ,MAAA,EAAA,EAAO,SAAA,EAAW,OAAA,CAAQ,MAAA,EAAS,gBAAM,IAAA,EAAK,CAAA;AACxD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ShortcutItem.esm.js","sources":["../src/ShortcutItem.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 type { MouseEvent } from 'react';\n\nimport { useState } from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport IconButton from '@material-ui/core/IconButton';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport EditIcon from '@material-ui/icons/Edit';\nimport { ShortcutIcon } from './ShortcutIcon';\nimport { EditShortcut } from './EditShortcut';\nimport { ShortcutApi } from './api';\nimport { Shortcut } from './types';\nimport { SidebarItem } from '@backstage/core-components';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n '&:hover #edit': {\n visibility: 'visible',\n },\n },\n button: {\n visibility: 'hidden',\n },\n icon: {\n color: theme.palette.common.white,\n fontSize: 16,\n },\n}));\n\nconst getIconText = (title: string) =>\n title.split(' ').length === 1\n ? // If there's only one word, keep the first two characters\n // eslint-disable-next-line no-restricted-syntax\n title[0].toUpperCase() + title[1].toLowerCase()\n : // If there's more than one word, take the first character of the first two words\n // eslint-disable-next-line no-restricted-syntax\n title\n .replace(/\\B\\W/g, '')\n .split(' ')\n .map(s => s[0])\n .join('')\n .slice(0, 2)\n .toUpperCase();\n\ntype Props = {\n shortcut: Shortcut;\n api: ShortcutApi;\n allowExternalLinks?: boolean;\n};\n\nexport const ShortcutItem = ({ shortcut, api, allowExternalLinks }: Props) => {\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = useState<Element | undefined>();\n\n const handleClick = (event: MouseEvent<Element>) => {\n event.preventDefault();\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = () => {\n setAnchorEl(undefined);\n };\n\n const text = getIconText(shortcut.title);\n const color = api.getColor(shortcut.url);\n\n return (\n <>\n <Tooltip title={shortcut.title} enterDelay={500}>\n <SidebarItem\n className={classes.root}\n to={shortcut.url}\n text={shortcut.title}\n icon={() => <ShortcutIcon text={text} color={color} />}\n >\n <IconButton\n id=\"edit\"\n data-testid=\"edit\"\n onClick={handleClick}\n className={classes.button}\n >\n <EditIcon className={classes.icon} />\n </IconButton>\n </SidebarItem>\n </Tooltip>\n <EditShortcut\n onClose={handleClose}\n anchorEl={anchorEl}\n api={api}\n shortcut={shortcut}\n allowExternalLinks={allowExternalLinks}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA6BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,eAAiB,EAAA;AAAA,MACf,UAAY,EAAA;AAAA;AACd,GACF;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,UAAY,EAAA;AAAA,GACd;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,KAAA;AAAA,IAC5B,QAAU,EAAA;AAAA;AAEd,CAAE,CAAA,CAAA;AAEF,MAAM,cAAc,CAAC,KAAA,KACnB,MAAM,KAAM,CAAA,GAAG,EAAE,MAAW,KAAA,CAAA;AAAA;AAAA;AAAA,EAGxB,KAAA,CAAM,CAAC,CAAE,CAAA,WAAA,KAAgB,KAAM,CAAA,CAAC,EAAE,WAAY;AAAA;AAAA;AAAA;AAAA,EAG9C,KAAA,CACG,QAAQ,OAAS,EAAA,EAAE,E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AAA,YACZ,OAAS,EAAA,WAAA;AAAA,YACT,WAAW,OAAQ,CAAA,MAAA;AAAA,YAEnB,QAAC,kBAAA,GAAA,CAAA,QAAA,EAAA,EAAS,SAAW,EAAA,OAAA,CAAQ,IAAM,EAAA;AAAA;AAAA;AACrC;AAAA,KAEJ,EAAA,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,OAAS,EAAA,WAAA;AAAA,QACT,QAAA;AAAA,QACA,GAAA;AAAA,QACA,QAAA;AAAA,QACA;AAAA;AAAA;AACF,GACF,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ShortcutItem.esm.js","sources":["../src/ShortcutItem.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 type { MouseEvent } from 'react';\n\nimport { useState } from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport IconButton from '@material-ui/core/IconButton';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport EditIcon from '@material-ui/icons/Edit';\nimport { ShortcutIcon } from './ShortcutIcon';\nimport { EditShortcut } from './EditShortcut';\nimport { ShortcutApi } from './api';\nimport { Shortcut } from './types';\nimport { SidebarItem } from '@backstage/core-components';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n '&:hover #edit': {\n visibility: 'visible',\n },\n },\n button: {\n visibility: 'hidden',\n },\n icon: {\n color: theme.palette.common.white,\n fontSize: 16,\n },\n}));\n\nconst getIconText = (title: string) =>\n title.split(' ').length === 1\n ? // If there's only one word, keep the first two characters\n // eslint-disable-next-line no-restricted-syntax\n title[0].toUpperCase() + title[1].toLowerCase()\n : // If there's more than one word, take the first character of the first two words\n // eslint-disable-next-line no-restricted-syntax\n title\n .replace(/\\B\\W/g, '')\n .split(' ')\n .map(s => s[0])\n .join('')\n .slice(0, 2)\n .toUpperCase();\n\ntype Props = {\n shortcut: Shortcut;\n api: ShortcutApi;\n allowExternalLinks?: boolean;\n};\n\nexport const ShortcutItem = ({ shortcut, api, allowExternalLinks }: Props) => {\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = useState<Element | undefined>();\n\n const handleClick = (event: MouseEvent<Element>) => {\n event.preventDefault();\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = () => {\n setAnchorEl(undefined);\n };\n\n const text = getIconText(shortcut.title);\n const color = api.getColor(shortcut.url);\n\n return (\n <>\n <Tooltip title={shortcut.title} enterDelay={500}>\n <SidebarItem\n className={classes.root}\n to={shortcut.url}\n text={shortcut.title}\n icon={() => <ShortcutIcon text={text} color={color} />}\n >\n <IconButton\n id=\"edit\"\n data-testid=\"edit\"\n onClick={handleClick}\n className={classes.button}\n >\n <EditIcon className={classes.icon} />\n </IconButton>\n </SidebarItem>\n </Tooltip>\n <EditShortcut\n onClose={handleClose}\n anchorEl={anchorEl}\n api={api}\n shortcut={shortcut}\n allowExternalLinks={allowExternalLinks}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA6BA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,IAAA,EAAM;AAAA,IACJ,eAAA,EAAiB;AAAA,MACf,UAAA,EAAY;AAAA;AACd,GACF;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,UAAA,EAAY;AAAA,GACd;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO,KAAA;AAAA,IAC5B,QAAA,EAAU;AAAA;AAEd,CAAA,CAAE,CAAA;AAEF,MAAM,cAAc,CAAC,KAAA,KACn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AA,CAAS,KAAA;AAAA,QACf,IAAA,EAAM,sBAAM,GAAA,CAAC,YAAA,EAAA,EAAa,MAAY,KAAA,EAAc,CAAA;AAAA,QAEpD,QAAA,kBAAA,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,EAAA,EAAG,MAAA;AAAA,YACH,aAAA,EAAY,MAAA;AAAA,YACZ,OAAA,EAAS,WAAA;AAAA,YACT,WAAW,OAAA,CAAQ,MAAA;AAAA,YAEnB,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EAAS,SAAA,EAAW,OAAA,CAAQ,IAAA,EAAM;AAAA;AAAA;AACrC;AAAA,KACF,EACF,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAS,WAAA;AAAA,QACT,QAAA;AAAA,QACA,GAAA;AAAA,QACA,QAAA;AAAA,QACA;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Shortcuts.esm.js","sources":["../src/Shortcuts.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 type { MouseEvent } from 'react';\n\nimport { useState } from 'react';\nimport useObservable from 'react-use/esm/useObservable';\nimport PlayListAddIcon from '@material-ui/icons/PlaylistAdd';\nimport { ShortcutItem } from './ShortcutItem';\nimport { AddShortcut } from './AddShortcut';\nimport { shortcutsApiRef } from './api';\n\nimport {\n Progress,\n SidebarItem,\n SidebarScrollWrapper,\n} from '@backstage/core-components';\nimport { IconComponent, useApi } from '@backstage/core-plugin-api';\n\n/**\n * ShortcutsProps\n * Props for the {@link Shortcuts} component.\n * @public\n */\nexport interface ShortcutsProps {\n icon?: IconComponent;\n allowExternalLinks?: boolean;\n}\n\nexport const Shortcuts = (props: ShortcutsProps) => {\n const shortcutApi = useApi(shortcutsApiRef);\n const shortcuts = useObservable(shortcutApi.shortcut$(), shortcutApi.get());\n const [anchorEl, setAnchorEl] = useState<Element | undefined>();\n const loading = Boolean(!shortcuts);\n\n const handleClick = (event: MouseEvent<Element>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = () => {\n setAnchorEl(undefined);\n };\n\n return (\n <SidebarScrollWrapper>\n <SidebarItem\n icon={props.icon ?? PlayListAddIcon}\n text=\"Add Shortcuts\"\n onClick={handleClick}\n />\n <AddShortcut\n onClose={handleClose}\n anchorEl={anchorEl}\n api={shortcutApi}\n allowExternalLinks={props.allowExternalLinks}\n />\n {loading ? (\n <Progress />\n ) : (\n shortcuts?.map(shortcut => (\n <ShortcutItem\n key={shortcut.id}\n shortcut={shortcut}\n api={shortcutApi}\n allowExternalLinks={props.allowExternalLinks}\n />\n ))\n )}\n </SidebarScrollWrapper>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AA0Ca,MAAA,SAAA,GAAY,CAAC,KAA0B,KAAA;AAClD,EAAM,MAAA,WAAA,GAAc,OAAO,eAAe,CAAA;AAC1C,EAAA,MAAM,YAAY,aAAc,CAAA,WAAA,CAAY,WAAa,EAAA,WAAA,CAAY,KAAK,CAAA;AAC1E,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,QAA8B,EAAA;AAC9D,EAAM,MAAA,OAAA,GAAU,OAAQ,CAAA,CAAC,SAAS,CAAA;AAElC,EAAM,MAAA,WAAA,GAAc,CAAC,KAA+B,KAAA;AAClD,IAAA,WAAA,CAAY,MAAM,aAAa,CAAA;AAAA,GACjC;AAEA,EAAA,MAAM,cAAc,MAAM;AACxB,IAAA,WAAA,CAAY,KAAS,CAAA,CAAA;AAAA,GACvB;AAEA,EAAA,4BACG,oBACC,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAM,MAAM,IAAQ,IAAA,eAAA;AAAA,QACpB,IAAK,EAAA,eAAA;AAAA,QACL,OAAS,EAAA;AAAA;AAAA,KACX;AAAA,oBACA,GAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,OAAS,EAAA,WAAA;AAAA,QACT,QAAA;AAAA,QACA,GAAK,EAAA,WAAA;AAAA,QACL,oBAAoB,KAAM,CAAA;AAAA;AAAA,KAC5B;AAAA,IACC,0BACE,GAAA,CAAA,QAAA,EAAA,EAAS,CAEV,GAAA,SAAA,EAAW,IAAI,CACb,QAAA,qBAAA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QAEC,QAAA;AAAA,QACA,GAAK,EAAA,WAAA;AAAA,QACL,oBAAoB,KAAM,CAAA;AAAA,OAAA;AAAA,MAHrB,QAAS,CAAA;AAAA,KAKjB;AAAA,GAEL,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"Shortcuts.esm.js","sources":["../src/Shortcuts.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 type { MouseEvent } from 'react';\n\nimport { useState } from 'react';\nimport useObservable from 'react-use/esm/useObservable';\nimport PlayListAddIcon from '@material-ui/icons/PlaylistAdd';\nimport { ShortcutItem } from './ShortcutItem';\nimport { AddShortcut } from './AddShortcut';\nimport { shortcutsApiRef } from './api';\n\nimport {\n Progress,\n SidebarItem,\n SidebarScrollWrapper,\n} from '@backstage/core-components';\nimport { IconComponent, useApi } from '@backstage/core-plugin-api';\n\n/**\n * ShortcutsProps\n * Props for the {@link Shortcuts} component.\n * @public\n */\nexport interface ShortcutsProps {\n icon?: IconComponent;\n allowExternalLinks?: boolean;\n}\n\nexport const Shortcuts = (props: ShortcutsProps) => {\n const shortcutApi = useApi(shortcutsApiRef);\n const shortcuts = useObservable(shortcutApi.shortcut$(), shortcutApi.get());\n const [anchorEl, setAnchorEl] = useState<Element | undefined>();\n const loading = Boolean(!shortcuts);\n\n const handleClick = (event: MouseEvent<Element>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = () => {\n setAnchorEl(undefined);\n };\n\n return (\n <SidebarScrollWrapper>\n <SidebarItem\n icon={props.icon ?? PlayListAddIcon}\n text=\"Add Shortcuts\"\n onClick={handleClick}\n />\n <AddShortcut\n onClose={handleClose}\n anchorEl={anchorEl}\n api={shortcutApi}\n allowExternalLinks={props.allowExternalLinks}\n />\n {loading ? (\n <Progress />\n ) : (\n shortcuts?.map(shortcut => (\n <ShortcutItem\n key={shortcut.id}\n shortcut={shortcut}\n api={shortcutApi}\n allowExternalLinks={props.allowExternalLinks}\n />\n ))\n )}\n </SidebarScrollWrapper>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AA0CO,MAAM,SAAA,GAAY,CAAC,KAAA,KAA0B;AAClD,EAAA,MAAM,WAAA,GAAc,OAAO,eAAe,CAAA;AAC1C,EAAA,MAAM,YAAY,aAAA,CAAc,WAAA,CAAY,WAAU,EAAG,WAAA,CAAY,KAAK,CAAA;AAC1E,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,QAAA,EAA8B;AAC9D,EAAA,MAAM,OAAA,GAAU,OAAA,CAAQ,CAAC,SAAS,CAAA;AAElC,EAAA,MAAM,WAAA,GAAc,CAAC,KAAA,KAA+B;AAClD,IAAA,WAAA,CAAY,MAAM,aAAa,CAAA;AAAA,EACjC,CAAA;AAEA,EAAA,MAAM,cAAc,MAAM;AACxB,IAAA,WAAA,CAAY,MAAS,CAAA;AAAA,EACvB,CAAA;AAEA,EAAA,4BACG,oBAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAM,MAAM,IAAA,IAAQ,eAAA;AAAA,QACpB,IAAA,EAAK,eAAA;AAAA,QACL,OAAA,EAAS;AAAA;AAAA,KACX;AAAA,oBACA,GAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAS,WAAA;AAAA,QACT,QAAA;AAAA,QACA,GAAA,EAAK,WAAA;AAAA,QACL,oBAAoB,KAAA,CAAM;AAAA;AAAA,KAC5B;AAAA,IACC,0BACC,GAAA,CAAC,QAAA,EAAA,EAAS,CAAA,GAEV,SAAA,EAAW,IAAI,CAAA,QAAA,qBACb,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QAEC,QAAA;AAAA,QACA,GAAA,EAAK,WAAA;AAAA,QACL,oBAAoB,KAAA,CAAM;AAAA,OAAA;AAAA,MAHrB,QAAA,CAAS;AAAA,KAKjB;AAAA,GAAA,EAEL,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultShortcutsApi.esm.js","sources":["../../src/api/DefaultShortcutsApi.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { pageTheme } from '@backstage/theme';\nimport { v4 as uuid } from 'uuid';\nimport {\n ShortcutApi,\n type Shortcut,\n} from '@backstage-community/plugin-shortcuts';\nimport type { StorageApi } from '@backstage/core-plugin-api';\nimport type { Observable } from '@backstage/types';\nimport ObservableImpl from 'zen-observable';\n\n/**\n * Default implementation of the {@link ShortcutApi} that uses the\n * {@link @backstage/core-plugin-api#StorageApi} to store shortcuts.\n *\n * @remarks\n *\n * Note that the storage API given is used directly, as in, this implementation\n * does not itself dive into a sub-bucket. So you may want to provide a bucket\n * that is scoped to the plugin (default: 'shortcuts').\n *\n * @public\n */\nexport class DefaultShortcutsApi implements ShortcutApi {\n private shortcuts: Shortcut[];\n private readonly subscribers = new Set<\n ZenObservable.SubscriptionObserver<Shortcut[]>\n >();\n\n private readonly observable = new ObservableImpl<Shortcut[]>(subscriber => {\n // forward the the latest value\n subscriber.next(this.shortcuts);\n\n this.subscribers.add(subscriber);\n return () => {\n this.subscribers.delete(subscriber);\n };\n });\n\n constructor(private readonly storageApi: StorageApi) {\n this.shortcuts = this.storageApi.snapshot<Shortcut[]>('items').value ?? [];\n this.storageApi.observe$<Shortcut[]>('items').subscribe({\n next: next => {\n this.shortcuts = next.value ?? [];\n this.notifyChanges();\n },\n });\n }\n\n shortcut$(): Observable<Shortcut[]> {\n return this.observable;\n }\n\n get() {\n return this.shortcuts;\n }\n\n async add(shortcut: Omit<Shortcut, 'id'>) {\n const shortcuts = this.sort([...this.get(), { ...shortcut, id: uuid() }]);\n\n await this.storageApi.set('items', shortcuts);\n }\n\n async remove(id: string) {\n const shortcuts = this.get().filter(s => s.id !== id);\n\n await this.storageApi.set('items', shortcuts);\n }\n\n async update(shortcut: Shortcut) {\n const shortcuts = this.get().filter(s => s.id !== shortcut.id);\n shortcuts.push(shortcut);\n\n await this.storageApi.set('items', shortcuts);\n }\n\n getColor(url: string) {\n const type = url.split('/')[1];\n const theme =\n this.THEME_MAP[type] ??\n (Object.keys(pageTheme).includes(type) ? type : 'tool');\n\n return pageTheme[theme].colors[0];\n }\n\n private readonly THEME_MAP: Record<string, keyof typeof pageTheme> = {\n catalog: 'home',\n docs: 'documentation',\n };\n\n private sort(shortcuts: Shortcut[]): Shortcut[] {\n return shortcuts.slice().sort((a, b) => (a.title >= b.title ? 1 : -1));\n }\n\n private notifyChanges() {\n for (const subscription of this.subscribers) {\n subscription.next(this.shortcuts);\n }\n }\n}\n"],"names":["uuid"],"mappings":";;;;AAsCO,MAAM,mBAA2C,CAAA;AAAA,EAgBtD,YAA6B,UAAwB,EAAA;AAAxB,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAC3B,IAAA,IAAA,CAAK,YAAY,IAAK,CAAA,UAAA,CAAW,SAAqB,OAAO,CAAA,CAAE,SAAS,EAAC;AACzE,IAAA,IAAA,CAAK,UAAW,CAAA,QAAA,CAAqB,OAAO,CAAA,CAAE,SAAU,CAAA;AAAA,MACtD,MAAM,CAAQ,IAAA,KAAA;AACZ,QAAK,IAAA,CAAA,SAAA,GAAY,IAAK,CAAA,KAAA,IAAS,EAAC;AAChC,QAAA,IAAA,CAAK,aAAc,EAAA;AAAA;AACrB,KACD,CAAA;AAAA;AACH,EAvBQ,SAAA;AAAA,EACS,WAAA,uBAAkB,GAEjC,EAAA;AAAA,EAEe,UAAA,GAAa,IAAI,cAAA,CAA2B,CAAc,UAAA,KAAA;AAEzE,IAAW,UAAA,CAAA,IAAA,CAAK,KAAK,SAAS,CAAA;AAE9B,IAAK,IAAA,CAAA,WAAA,CAAY,IAAI,UAAU,CAAA;AAC/B,IAAA,OAAO,MAAM;AACX,MAAK,IAAA,CAAA,WAAA,CAAY,OAAO,UAAU,CAAA;AAAA,KACpC;AAAA,GACD,CAAA;AAAA,EAYD,SAAoC,GAAA;AAClC,IAAA,OAAO,IAAK,CAAA,UAAA;AAAA;AACd,EAEA,GAAM,GAAA;AACJ,IAAA,OAAO,IAAK,CAAA,SAAA;AAAA;AACd,EAEA,MAAM,IAAI,QAAgC,EAAA;AACxC,IAAA,MAAM,SAAY,GAAA,IAAA,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OAAO,SAAU,CAAA,KAAA,EAAQ,CAAA,IAAA,CAAK,CAAC,CAAA,EAAG,CAAO,KAAA,CAAA,CAAE,KAAS,IAAA,CAAA,CAAE,KAAQ,GAAA,CAAA,GAAI,CAAG,CAAA,CAAA;AAAA;AACvE,EAEQ,aAAgB,GAAA;AACtB,IAAW,KAAA,MAAA,YAAA,IAAgB,KAAK,WAAa,EAAA;AAC3C,MAAa,YAAA,CAAA,IAAA,CAAK,KAAK,SAAS,CAAA;AAAA;AAClC;AAEJ;;;;"}
1
+ {"version":3,"file":"DefaultShortcutsApi.esm.js","sources":["../../src/api/DefaultShortcutsApi.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { pageTheme } from '@backstage/theme';\nimport { v4 as uuid } from 'uuid';\nimport {\n ShortcutApi,\n type Shortcut,\n} from '@backstage-community/plugin-shortcuts';\nimport type { StorageApi } from '@backstage/core-plugin-api';\nimport type { Observable } from '@backstage/types';\nimport ObservableImpl from 'zen-observable';\n\n/**\n * Default implementation of the {@link ShortcutApi} that uses the\n * {@link @backstage/core-plugin-api#StorageApi} to store shortcuts.\n *\n * @remarks\n *\n * Note that the storage API given is used directly, as in, this implementation\n * does not itself dive into a sub-bucket. So you may want to provide a bucket\n * that is scoped to the plugin (default: 'shortcuts').\n *\n * @public\n */\nexport class DefaultShortcutsApi implements ShortcutApi {\n private shortcuts: Shortcut[];\n private readonly subscribers = new Set<\n ZenObservable.SubscriptionObserver<Shortcut[]>\n >();\n\n private readonly observable = new ObservableImpl<Shortcut[]>(subscriber => {\n // forward the the latest value\n subscriber.next(this.shortcuts);\n\n this.subscribers.add(subscriber);\n return () => {\n this.subscribers.delete(subscriber);\n };\n });\n\n constructor(private readonly storageApi: StorageApi) {\n this.shortcuts = this.storageApi.snapshot<Shortcut[]>('items').value ?? [];\n this.storageApi.observe$<Shortcut[]>('items').subscribe({\n next: next => {\n this.shortcuts = next.value ?? [];\n this.notifyChanges();\n },\n });\n }\n\n shortcut$(): Observable<Shortcut[]> {\n return this.observable;\n }\n\n get() {\n return this.shortcuts;\n }\n\n async add(shortcut: Omit<Shortcut, 'id'>) {\n const shortcuts = this.sort([...this.get(), { ...shortcut, id: uuid() }]);\n\n await this.storageApi.set('items', shortcuts);\n }\n\n async remove(id: string) {\n const shortcuts = this.get().filter(s => s.id !== id);\n\n await this.storageApi.set('items', shortcuts);\n }\n\n async update(shortcut: Shortcut) {\n const shortcuts = this.get().filter(s => s.id !== shortcut.id);\n shortcuts.push(shortcut);\n\n await this.storageApi.set('items', shortcuts);\n }\n\n getColor(url: string) {\n const type = url.split('/')[1];\n const theme =\n this.THEME_MAP[type] ??\n (Object.keys(pageTheme).includes(type) ? type : 'tool');\n\n return pageTheme[theme].colors[0];\n }\n\n private readonly THEME_MAP: Record<string, keyof typeof pageTheme> = {\n catalog: 'home',\n docs: 'documentation',\n };\n\n private sort(shortcuts: Shortcut[]): Shortcut[] {\n return shortcuts.slice().sort((a, b) => (a.title >= b.title ? 1 : -1));\n }\n\n private notifyChanges() {\n for (const subscription of this.subscribers) {\n subscription.next(this.shortcuts);\n }\n }\n}\n"],"names":["uuid"],"mappings":";;;;AAsCO,MAAM,mBAAA,CAA2C;AAAA,EAgBtD,YAA6B,UAAA,EAAwB;AAAxB,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAC3B,IAAA,IAAA,CAAK,YAAY,IAAA,CAAK,UAAA,CAAW,SAAqB,OAAO,CAAA,CAAE,SAAS,EAAC;AACzE,IAAA,IAAA,CAAK,UAAA,CAAW,QAAA,CAAqB,OAAO,CAA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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 { Shortcut } from '../types';\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport { Observable } from '@backstage/types';\n\n/** @public */\nexport const shortcutsApiRef = createApiRef<ShortcutApi>({\n id: 'plugin.shortcuts.api',\n});\n\n/** @public */\nexport interface ShortcutApi {\n /**\n * Returns an Observable that will subscribe to changes.\n */\n shortcut$(): Observable<Shortcut[]>;\n\n /**\n * Returns an immediate snapshot of shortcuts, sorted by title\n */\n get(): Shortcut[];\n\n /**\n * Generates a unique id for the shortcut and then saves it.\n */\n add(shortcut: Omit<Shortcut, 'id'>): Promise<void>;\n\n /**\n * Removes the shortcut.\n */\n remove(id: string): Promise<void>;\n\n /**\n * Finds an existing shortcut that matches the ID of the\n * supplied shortcut and updates its values.\n */\n update(shortcut: Shortcut): Promise<void>;\n\n /**\n * Each shortcut should get a color for its icon based on the url.\n *\n * Preferably using some abstraction between the url and the actual\n * color value.\n */\n getColor(url: string): string;\n}\n"],"names":[],"mappings":";;AAqBO,MAAM,kBAAkB,YAA0B,CAAA;AAAA,EACvD,EAAI,EAAA;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"ShortcutApi.esm.js","sources":["../../src/api/ShortcutApi.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { Shortcut } from '../types';\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport { Observable } from '@backstage/types';\n\n/** @public */\nexport const shortcutsApiRef = createApiRef<ShortcutApi>({\n id: 'plugin.shortcuts.api',\n});\n\n/** @public */\nexport interface ShortcutApi {\n /**\n * Returns an Observable that will subscribe to changes.\n */\n shortcut$(): Observable<Shortcut[]>;\n\n /**\n * Returns an immediate snapshot of shortcuts, sorted by title\n */\n get(): Shortcut[];\n\n /**\n * Generates a unique id for the shortcut and then saves it.\n */\n add(shortcut: Omit<Shortcut, 'id'>): Promise<void>;\n\n /**\n * Removes the shortcut.\n */\n remove(id: string): Promise<void>;\n\n /**\n * Finds an existing shortcut that matches the ID of the\n * supplied shortcut and updates its values.\n */\n update(shortcut: Shortcut): Promise<void>;\n\n /**\n * Each shortcut should get a color for its icon based on the url.\n *\n * Preferably using some abstraction between the url and the actual\n * color value.\n */\n getColor(url: string): string;\n}\n"],"names":[],"mappings":";;AAqBO,MAAM,kBAAkB,YAAA,CAA0B;AAAA,EACvD,EAAA,EAAI;AACN,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"deprecated.esm.js","sources":["../src/deprecated.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { DefaultShortcutsApi } from './api';\n\n/**\n * @public\n * @deprecated Use {@link DefaultShortcutsApi} instead.\n */\nexport const LocalStoredShortcuts = DefaultShortcutsApi;\n"],"names":[],"mappings":";;;AAsBO,MAAM,oBAAuB,GAAA;;;;"}
1
+ {"version":3,"file":"deprecated.esm.js","sources":["../src/deprecated.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { DefaultShortcutsApi } from './api';\n\n/**\n * @public\n * @deprecated Use {@link DefaultShortcutsApi} instead.\n */\nexport const LocalStoredShortcuts = DefaultShortcutsApi;\n"],"names":[],"mappings":";;;AAsBO,MAAM,oBAAA,GAAuB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { DefaultShortcutsApi, shortcutsApiRef } from './api';\nimport {\n createApiFactory,\n createComponentExtension,\n createPlugin,\n storageApiRef,\n} from '@backstage/core-plugin-api';\n\n/** @public */\nexport const shortcutsPlugin = createPlugin({\n id: 'shortcuts',\n apis: [\n createApiFactory({\n api: shortcutsApiRef,\n deps: { storageApi: storageApiRef },\n factory: ({ storageApi }) =>\n new DefaultShortcutsApi(storageApi.forBucket('shortcuts')),\n }),\n ],\n});\n\n/** @public */\nexport const Shortcuts = shortcutsPlugin.provide(\n createComponentExtension({\n name: 'Shortcuts',\n component: { lazy: () => import('./Shortcuts').then(m => m.Shortcuts) },\n }),\n);\n"],"names":[],"mappings":";;;;AAyBO,MAAM,kBAAkB,YAAa,CAAA;AAAA,EAC1C,EAAI,EAAA,WAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,eAAA;AAAA,MACL,IAAA,EAAM,EAAE,UAAA,EAAY,aAAc,EAAA;AAAA,MAClC,OAAA,EAAS,CAAC,EAAE,UAAW,EAAA,KACrB,IAAI,mBAAoB,CAAA,UAAA,CAAW,SAAU,CAAA,WAAW,CAAC;AAAA,KAC5D;AAAA;AAEL,CAAC;AAGM,MAAM,YAAY,eAAgB,CAAA,OAAA;AAAA,EACvC,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,WAAA;AAAA,IACN,SAAA,EAAW,EAAE,IAAA,EAAM,MAAM,OAAO,oBAAa,CAAA,CAAE,IAAK,CAAA,CAAA,CAAA,KAAK,CAAE,CAAA,SAAS,CAAE;AAAA,GACvE;AACH;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { DefaultShortcutsApi, shortcutsApiRef } from './api';\nimport {\n createApiFactory,\n createComponentExtension,\n createPlugin,\n storageApiRef,\n} from '@backstage/core-plugin-api';\n\n/** @public */\nexport const shortcutsPlugin = createPlugin({\n id: 'shortcuts',\n apis: [\n createApiFactory({\n api: shortcutsApiRef,\n deps: { storageApi: storageApiRef },\n factory: ({ storageApi }) =>\n new DefaultShortcutsApi(storageApi.forBucket('shortcuts')),\n }),\n ],\n});\n\n/** @public */\nexport const Shortcuts = shortcutsPlugin.provide(\n createComponentExtension({\n name: 'Shortcuts',\n component: { lazy: () => import('./Shortcuts').then(m => m.Shortcuts) },\n }),\n);\n"],"names":[],"mappings":";;;;AAyBO,MAAM,kBAAkB,YAAA,CAAa;AAAA,EAC1C,EAAA,EAAI,WAAA;AAAA,EACJ,IAAA,EAAM;AAAA,IACJ,gBAAA,CAAiB;AAAA,MACf,GAAA,EAAK,eAAA;AAAA,MACL,IAAA,EAAM,EAAE,UAAA,EAAY,aAAA,EAAc;AAAA,MAClC,OAAA,EAAS,CAAC,EAAE,UAAA,EAAW,KACrB,IAAI,mBAAA,CAAoB,UAAA,CAAW,SAAA,CAAU,WAAW,CAAC;AAAA,KAC5D;AAAA;AAEL,CAAC;AAGM,MAAM,YAAY,eAAA,CAAgB,OAAA;AAAA,EACvC,wBAAA,CAAyB;AAAA,IACvB,IAAA,EAAM,WAAA;AAAA,IACN,SAAA,EAAW,EAAE,IAAA,EAAM,MAAM,OAAO,oBAAa,CAAA,CAAE,IAAA,CAAK,CAAA,CAAA,KAAK,CAAA,CAAE,SAAS,CAAA;AAAE,GACvE;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage-community/plugin-shortcuts",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "A Backstage plugin that provides a shortcuts feature to the sidebar",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -37,9 +37,9 @@
37
37
  "test": "backstage-cli package test"
38
38
  },
39
39
  "dependencies": {
40
- "@backstage/core-components": "^0.18.8",
41
- "@backstage/core-plugin-api": "^1.12.4",
42
- "@backstage/theme": "^0.7.2",
40
+ "@backstage/core-components": "^0.18.10",
41
+ "@backstage/core-plugin-api": "^1.12.6",
42
+ "@backstage/theme": "^0.7.3",
43
43
  "@backstage/types": "^1.2.2",
44
44
  "@material-ui/core": "^4.12.2",
45
45
  "@material-ui/icons": "^4.9.1",
@@ -50,9 +50,9 @@
50
50
  "zen-observable": "^0.10.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@backstage/cli": "^0.36.0",
54
- "@backstage/dev-utils": "^1.1.21",
55
- "@backstage/test-utils": "^1.7.16",
53
+ "@backstage/cli": "^0.36.2",
54
+ "@backstage/dev-utils": "^1.1.23",
55
+ "@backstage/test-utils": "^1.7.18",
56
56
  "@testing-library/dom": "^10.0.0",
57
57
  "@testing-library/jest-dom": "^6.0.0",
58
58
  "@testing-library/react": "^15.0.0",