@backstage/plugin-scaffolder 1.7.0 → 1.8.0-next.1

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,58 @@
1
1
  # @backstage/plugin-scaffolder
2
2
 
3
+ ## 1.8.0-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 580285787d: The `create` and `click` analytics events are now also captured on the "next" version of the component creation page.
8
+ - 3b3fc3cc3c: Fix `formData` not being present in the `next` version
9
+ - Updated dependencies
10
+ - @backstage/core-components@0.12.0-next.1
11
+ - @backstage/catalog-client@1.1.2-next.0
12
+ - @backstage/catalog-model@1.1.3-next.0
13
+ - @backstage/config@1.0.4-next.0
14
+ - @backstage/core-plugin-api@1.1.0-next.0
15
+ - @backstage/errors@1.1.3-next.0
16
+ - @backstage/integration@1.4.0-next.0
17
+ - @backstage/integration-react@1.1.6-next.1
18
+ - @backstage/theme@0.2.16
19
+ - @backstage/types@1.0.1-next.0
20
+ - @backstage/plugin-catalog-common@1.0.8-next.0
21
+ - @backstage/plugin-catalog-react@1.2.1-next.1
22
+ - @backstage/plugin-permission-react@0.4.7-next.0
23
+ - @backstage/plugin-scaffolder-common@1.2.2-next.0
24
+
25
+ ## 1.8.0-next.0
26
+
27
+ ### Minor Changes
28
+
29
+ - edae17309e: Added props to override default Scaffolder page title, subtitle and pageTitleOverride.
30
+ Routes like `rootRouteRef`, `selectedTemplateRouteRef`, `nextRouteRef`, `nextSelectedTemplateRouteRef` were made public and can be used in your app (e.g. in custom TemplateCard component).
31
+
32
+ ### Patch Changes
33
+
34
+ - 4830a3569f: Basic analytics instrumentation is now in place:
35
+
36
+ - As users make their way through template steps, a `click` event is fired, including the step number.
37
+ - After a user clicks "Create" a `create` event is fired, including the name of the software that was just created. The template used at creation is set on the `entityRef` context key.
38
+
39
+ - f905853ad6: Prefer using `Link` from `@backstage/core-components` rather than material-UI.
40
+ - Updated dependencies
41
+ - @backstage/plugin-catalog-react@1.2.1-next.0
42
+ - @backstage/core-components@0.12.0-next.0
43
+ - @backstage/core-plugin-api@1.1.0-next.0
44
+ - @backstage/integration@1.4.0-next.0
45
+ - @backstage/catalog-model@1.1.3-next.0
46
+ - @backstage/types@1.0.1-next.0
47
+ - @backstage/integration-react@1.1.6-next.0
48
+ - @backstage/plugin-permission-react@0.4.7-next.0
49
+ - @backstage/catalog-client@1.1.2-next.0
50
+ - @backstage/config@1.0.4-next.0
51
+ - @backstage/errors@1.1.3-next.0
52
+ - @backstage/theme@0.2.16
53
+ - @backstage/plugin-catalog-common@1.0.8-next.0
54
+ - @backstage/plugin-scaffolder-common@1.2.2-next.0
55
+
3
56
  ## 1.7.0
4
57
 
5
58
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder",
3
- "version": "1.7.0",
3
+ "version": "1.8.0-next.1",
4
4
  "main": "../dist/index.esm.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -1,11 +1,11 @@
1
1
  import React, { useState, useContext, useCallback, createContext, useEffect, useRef, useMemo, Children, Component, Fragment } from 'react';
2
2
  import { useNavigate, Navigate, useOutlet, Routes, Route } from 'react-router';
3
- import { ItemCardHeader, MarkdownContent, Button, ContentHeader, Progress, WarningPanel, Link as Link$1, Content, ItemCardGrid, Page, Header, CreateButton, SupportButton, StructuredMetadataTable, InfoCard, ErrorPage, ErrorPanel, LogViewer, StatusError, StatusOK, StatusPending, Lifecycle, EmptyState, Table as Table$1 } from '@backstage/core-components';
4
- import { useApp, useRouteRef, useApi, errorApiRef, featureFlagsApiRef, useApiHolder, useRouteRefParams, alertApiRef, useElementFilter } from '@backstage/core-plugin-api';
3
+ import { ItemCardHeader, MarkdownContent, Button, Link, ContentHeader, Progress, WarningPanel, Content, ItemCardGrid, Page, Header, CreateButton, SupportButton, StructuredMetadataTable, InfoCard, ErrorPage, ErrorPanel, LogViewer, StatusError, StatusOK, StatusPending, Lifecycle, EmptyState, Table as Table$1 } from '@backstage/core-components';
4
+ import { useApp, useRouteRef, useApi, useRouteRefParams, useAnalytics, errorApiRef, featureFlagsApiRef, useApiHolder, AnalyticsContext, alertApiRef, useElementFilter } from '@backstage/core-plugin-api';
5
5
  import { getEntityRelations, getEntitySourceLocation, FavoriteEntity, EntityRefLinks, useEntityList, EntityListProvider, CatalogFilterLayout, EntitySearchBar, EntityKindPicker, UserListPicker, EntityTagPicker, catalogApiRef, humanizeEntityRef, EntityRefLink } from '@backstage/plugin-catalog-react';
6
- import { s as selectedTemplateRouteRef, v as viewTechDocRouteRef, e as editRouteRef, a as actionsRouteRef, b as scaffolderListTaskRouteRef, r as registerComponentRouteRef, T as TemplateTypePicker, S as SecretsContext, c as scaffolderApiRef, d as scaffolderTaskRouteRef, f as rootRouteRef, g as TaskStatusStepper, h as TaskPageLinks, F as FIELD_EXTENSION_WRAPPER_KEY, i as FIELD_EXTENSION_KEY, L as LAYOUTS_WRAPPER_KEY, j as LAYOUTS_KEY, l as legacySelectedTemplateRouteRef, k as SecretsContextProvider, m as TaskPage } from './index-e49d2205.esm.js';
6
+ import { s as selectedTemplateRouteRef, v as viewTechDocRouteRef, e as editRouteRef, a as actionsRouteRef, b as scaffolderListTaskRouteRef, r as registerComponentRouteRef, T as TemplateTypePicker, S as SecretsContext, c as scaffolderApiRef, d as scaffolderTaskRouteRef, f as rootRouteRef, g as TaskStatusStepper, h as TaskPageLinks, F as FIELD_EXTENSION_WRAPPER_KEY, i as FIELD_EXTENSION_KEY, L as LAYOUTS_WRAPPER_KEY, j as LAYOUTS_KEY, l as legacySelectedTemplateRouteRef, k as SecretsContextProvider, m as TaskPage } from './index-68c01d69.esm.js';
7
7
  import { RELATION_OWNED_BY, parseEntityRef, stringifyEntityRef, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
8
- import { makeStyles, useTheme, Card, CardMedia, CardContent, Box, Typography, Chip, CardActions, Tooltip, IconButton, Link, Stepper, Step, StepLabel, StepContent, Button as Button$1, Paper, LinearProgress, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Divider as Divider$1, FormControl, InputLabel, Select, MenuItem as MenuItem$1, List as List$2, ListItemIcon as ListItemIcon$1, ListItemText as ListItemText$1 } from '@material-ui/core';
8
+ import { makeStyles, useTheme, Card, CardMedia, CardContent, Box, Typography, Chip, CardActions, Tooltip, IconButton, Stepper, Step, StepLabel, StepContent, Button as Button$1, Paper, LinearProgress, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Divider as Divider$1, FormControl, InputLabel, Select, MenuItem as MenuItem$1, List as List$2, ListItemIcon as ListItemIcon$1, ListItemText as ListItemText$1 } from '@material-ui/core';
9
9
  import { scmIntegrationsApiRef, ScmIntegrationIcon } from '@backstage/integration-react';
10
10
  import LanguageIcon from '@material-ui/icons/Language';
11
11
  import WarningIcon from '@material-ui/icons/Warning';
@@ -66,7 +66,7 @@ import SettingsIcon from '@material-ui/icons/Settings';
66
66
  import AllIcon from '@material-ui/icons/FontDownload';
67
67
  import { DateTime, Interval } from 'luxon';
68
68
  import humanizeDuration from 'humanize-duration';
69
- import { D as DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from './default-bdf322b4.esm.js';
69
+ import { D as DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from './default-08d14dbd.esm.js';
70
70
  import '@backstage/errors';
71
71
  import 'zen-observable';
72
72
  import '@material-ui/core/FormControl';
@@ -163,7 +163,7 @@ const DeprecationWarning = () => {
163
163
  }, /* @__PURE__ */ React.createElement(Tooltip, {
164
164
  title: Title
165
165
  }, /* @__PURE__ */ React.createElement(Link, {
166
- href: "https://backstage.io/docs/features/software-templates/migrating-from-v1beta2-to-v1beta3",
166
+ to: "https://backstage.io/docs/features/software-templates/migrating-from-v1beta2-to-v1beta3",
167
167
  className: styles.link
168
168
  }, /* @__PURE__ */ React.createElement(WarningIcon, null))));
169
169
  };
@@ -291,7 +291,7 @@ const TemplateList = ({
291
291
  title: "Oops! Something went wrong loading the templates"
292
292
  }, error.message), !error && !loading && !entities.length && /* @__PURE__ */ React.createElement(Typography, {
293
293
  variant: "body2"
294
- }, "No templates found that match your filter. Learn more about", " ", /* @__PURE__ */ React.createElement(Link$1, {
294
+ }, "No templates found that match your filter. Learn more about", " ", /* @__PURE__ */ React.createElement(Link, {
295
295
  to: "https://backstage.io/docs/features/software-templates/adding-templates"
296
296
  }, "adding templates"), "."), /* @__PURE__ */ React.createElement(Content, null, titleComponent, /* @__PURE__ */ React.createElement(ItemCardGrid, null, maybeFilteredEntities && (maybeFilteredEntities == null ? void 0 : maybeFilteredEntities.length) > 0 && maybeFilteredEntities.map((template) => /* @__PURE__ */ React.createElement(Card, {
297
297
  key: stringifyEntityRef(template),
@@ -362,7 +362,8 @@ function ScaffolderPageContextMenu(props) {
362
362
  const ScaffolderPageContents = ({
363
363
  TemplateCardComponent,
364
364
  groups,
365
- contextMenu
365
+ contextMenu,
366
+ headerOptions
366
367
  }) => {
367
368
  const registerComponentLink = useRouteRef(registerComponentRouteRef);
368
369
  const otherTemplatesGroup = {
@@ -380,7 +381,8 @@ const ScaffolderPageContents = ({
380
381
  }, /* @__PURE__ */ React.createElement(Header, {
381
382
  pageTitleOverride: "Create a New Component",
382
383
  title: "Create a New Component",
383
- subtitle: "Create new software components using standard templates"
384
+ subtitle: "Create new software components using standard templates",
385
+ ...headerOptions
384
386
  }, /* @__PURE__ */ React.createElement(ScaffolderPageContextMenu, {
385
387
  ...contextMenu
386
388
  })), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, {
@@ -407,11 +409,13 @@ const ScaffolderPageContents = ({
407
409
  const ScaffolderPage = ({
408
410
  TemplateCardComponent,
409
411
  groups,
410
- contextMenu
412
+ contextMenu,
413
+ headerOptions
411
414
  }) => /* @__PURE__ */ React.createElement(EntityListProvider, null, /* @__PURE__ */ React.createElement(ScaffolderPageContents, {
412
415
  TemplateCardComponent,
413
416
  groups,
414
- contextMenu
417
+ contextMenu,
418
+ headerOptions
415
419
  }));
416
420
 
417
421
  function isObject$1(value) {
@@ -570,6 +574,8 @@ const MultistepJsonForm = (props) => {
570
574
  finishButtonLabel,
571
575
  layouts
572
576
  } = props;
577
+ const { templateName } = useRouteRefParams(selectedTemplateRouteRef);
578
+ const analytics = useAnalytics();
573
579
  const [activeStep, setActiveStep] = useState(0);
574
580
  const [disableButtons, setDisableButtons] = useState(false);
575
581
  const errorApi = useApi(errorApiRef);
@@ -609,7 +615,9 @@ const MultistepJsonForm = (props) => {
609
615
  onReset();
610
616
  };
611
617
  const handleNext = () => {
612
- setActiveStep(Math.min(activeStep + 1, steps.length));
618
+ const stepNum = Math.min(activeStep + 1, steps.length);
619
+ setActiveStep(stepNum);
620
+ analytics.captureEvent("click", `Next Step (${stepNum})`);
613
621
  };
614
622
  const handleBack = () => setActiveStep(Math.max(activeStep - 1, 0));
615
623
  const handleCreate = async () => {
@@ -619,6 +627,7 @@ const MultistepJsonForm = (props) => {
619
627
  setDisableButtons(true);
620
628
  try {
621
629
  await onFinish();
630
+ analytics.captureEvent("create", formData.name || `new ${templateName}`);
622
631
  } catch (err) {
623
632
  errorApi.post(err);
624
633
  } finally {
@@ -810,7 +819,9 @@ const TemplatePage = ({
810
819
  const customFieldValidators = Object.fromEntries(
811
820
  customFieldExtensions.map(({ name, validation }) => [name, validation])
812
821
  );
813
- return /* @__PURE__ */ React.createElement(Page, {
822
+ return /* @__PURE__ */ React.createElement(AnalyticsContext, {
823
+ attributes: { entityRef: templateRef }
824
+ }, /* @__PURE__ */ React.createElement(Page, {
814
825
  themeId: "home"
815
826
  }, /* @__PURE__ */ React.createElement(Header, {
816
827
  pageTitleOverride: "Create a New Component",
@@ -839,7 +850,7 @@ const TemplatePage = ({
839
850
  )
840
851
  };
841
852
  })
842
- }))));
853
+ })))));
843
854
  };
844
855
 
845
856
  const useStyles$c = makeStyles((theme) => ({
@@ -2454,7 +2465,7 @@ const ListTaskPageContent = (props) => {
2454
2465
  {
2455
2466
  title: "Task ID",
2456
2467
  field: "id",
2457
- render: (row) => /* @__PURE__ */ React.createElement(Link$1, {
2468
+ render: (row) => /* @__PURE__ */ React.createElement(Link, {
2458
2469
  to: `${rootLink()}/tasks/${row.id}`
2459
2470
  }, row.id)
2460
2471
  },
@@ -2556,7 +2567,8 @@ const Router = (props) => {
2556
2567
  element: /* @__PURE__ */ React.createElement(ScaffolderPage, {
2557
2568
  groups,
2558
2569
  TemplateCardComponent,
2559
- contextMenu: props.contextMenu
2570
+ contextMenu: props.contextMenu,
2571
+ headerOptions: props.headerOptions
2560
2572
  })
2561
2573
  }), /* @__PURE__ */ React.createElement(Route, {
2562
2574
  path: legacySelectedTemplateRouteRef.path,
@@ -2592,4 +2604,4 @@ const Router = (props) => {
2592
2604
  };
2593
2605
 
2594
2606
  export { Router };
2595
- //# sourceMappingURL=Router-4521e309.esm.js.map
2607
+ //# sourceMappingURL=Router-ace3f7b5.esm.js.map