@backstage/plugin-scaffolder 0.13.0 → 0.15.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 +120 -0
- package/dist/esm/{Router-8ca04a51.esm.js → Router-47c9a9ee.esm.js} +193 -28
- package/dist/esm/Router-47c9a9ee.esm.js.map +1 -0
- package/dist/esm/{index-7ce19edf.esm.js → index-ced3b204.esm.js} +67 -232
- package/dist/esm/index-ced3b204.esm.js.map +1 -0
- package/dist/index.d.ts +202 -93
- package/dist/index.esm.js +2 -5
- package/dist/index.esm.js.map +1 -1
- package/package.json +17 -17
- package/dist/esm/Router-8ca04a51.esm.js.map +0 -1
- package/dist/esm/index-7ce19edf.esm.js.map +0 -1
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
import { parseEntityRef, KubernetesValidatorFunctions, makeValidator, RELATION_OWNED_BY
|
|
2
|
-
import { createApiRef, useApi, attachComponentData, createExternalRouteRef, createRouteRef, createPlugin, createApiFactory, discoveryApiRef, fetchApiRef, createRoutableExtension,
|
|
1
|
+
import { parseEntityRef, KubernetesValidatorFunctions, makeValidator, RELATION_OWNED_BY } from '@backstage/catalog-model';
|
|
2
|
+
import { createApiRef, useApi, identityApiRef, attachComponentData, createExternalRouteRef, createRouteRef, createSubRouteRef, createPlugin, createApiFactory, discoveryApiRef, fetchApiRef, createRoutableExtension, alertApiRef, useApp, useRouteRef } from '@backstage/core-plugin-api';
|
|
3
3
|
import { ResponseError } from '@backstage/errors';
|
|
4
4
|
import qs from 'qs';
|
|
5
5
|
import ObservableImpl from 'zen-observable';
|
|
6
|
-
import { catalogApiRef,
|
|
7
|
-
import { TextField, FormControl as FormControl$1,
|
|
6
|
+
import { catalogApiRef, humanizeEntityRef, useEntityTypeFilter, entityRouteRef } from '@backstage/plugin-catalog-react';
|
|
7
|
+
import { TextField, FormControl as FormControl$1, Box, Typography, FormControlLabel, Checkbox, makeStyles, Grid, StepButton, Paper, Button, CircularProgress } from '@material-ui/core';
|
|
8
8
|
import FormControl from '@material-ui/core/FormControl';
|
|
9
9
|
import Autocomplete from '@material-ui/lab/Autocomplete';
|
|
10
10
|
import React, { useCallback, useEffect, useState, createContext, useContext, useMemo, memo } from 'react';
|
|
11
11
|
import useAsync from 'react-use/lib/useAsync';
|
|
12
12
|
import useEffectOnce from 'react-use/lib/useEffectOnce';
|
|
13
13
|
import { Autocomplete as Autocomplete$1 } from '@material-ui/lab';
|
|
14
|
-
import { scmIntegrationsApiRef, scmAuthApiRef
|
|
14
|
+
import { scmIntegrationsApiRef, scmAuthApiRef } from '@backstage/integration-react';
|
|
15
15
|
import FormHelperText from '@material-ui/core/FormHelperText';
|
|
16
16
|
import Input from '@material-ui/core/Input';
|
|
17
17
|
import InputLabel from '@material-ui/core/InputLabel';
|
|
18
|
-
import { Select, Progress,
|
|
18
|
+
import { Select, Progress, Link, Page, Header, Lifecycle, Content, ErrorPage, LogViewer } from '@backstage/core-components';
|
|
19
19
|
import useDebounce from 'react-use/lib/useDebounce';
|
|
20
|
-
import Star from '@material-ui/icons/Star';
|
|
21
|
-
import StarBorder from '@material-ui/icons/StarBorder';
|
|
22
|
-
import WarningIcon from '@material-ui/icons/Warning';
|
|
23
|
-
import { generatePath, useNavigate, useParams } from 'react-router';
|
|
24
20
|
import capitalize from 'lodash/capitalize';
|
|
25
21
|
import CheckBoxIcon from '@material-ui/icons/CheckBox';
|
|
26
22
|
import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';
|
|
@@ -36,6 +32,7 @@ import Check from '@material-ui/icons/Check';
|
|
|
36
32
|
import FiberManualRecordIcon from '@material-ui/icons/FiberManualRecord';
|
|
37
33
|
import classNames from 'classnames';
|
|
38
34
|
import { DateTime, Interval } from 'luxon';
|
|
35
|
+
import { useNavigate, useParams } from 'react-router';
|
|
39
36
|
import useInterval from 'react-use/lib/useInterval';
|
|
40
37
|
import { useImmerReducer } from 'use-immer';
|
|
41
38
|
import LanguageIcon from '@material-ui/icons/Language';
|
|
@@ -205,7 +202,7 @@ const EntityPicker = (props) => {
|
|
|
205
202
|
const defaultKind = (_b = uiSchema["ui:options"]) == null ? void 0 : _b.defaultKind;
|
|
206
203
|
const catalogApi = useApi(catalogApiRef);
|
|
207
204
|
const { value: entities, loading } = useAsync(() => catalogApi.getEntities(allowedKinds ? { filter: { kind: allowedKinds } } : void 0));
|
|
208
|
-
const entityRefs = entities == null ? void 0 : entities.items.map((e) =>
|
|
205
|
+
const entityRefs = entities == null ? void 0 : entities.items.map((e) => humanizeEntityRef(e, { defaultKind }));
|
|
209
206
|
const onSelect = useCallback((_, value) => {
|
|
210
207
|
onChange(value || "");
|
|
211
208
|
}, [onChange]);
|
|
@@ -587,11 +584,11 @@ const useTemplateSecrets = () => {
|
|
|
587
584
|
if (!value) {
|
|
588
585
|
throw new Error("useTemplateSecrets must be used within a SecretsContextProvider");
|
|
589
586
|
}
|
|
590
|
-
const { setSecrets } = value;
|
|
591
|
-
const
|
|
592
|
-
|
|
593
|
-
}, [
|
|
594
|
-
return {
|
|
587
|
+
const { setSecrets: updateSecrets } = value;
|
|
588
|
+
const setSecrets = useCallback((input) => {
|
|
589
|
+
updateSecrets((currentSecrets) => ({ ...currentSecrets, ...input }));
|
|
590
|
+
}, [updateSecrets]);
|
|
591
|
+
return { setSecrets };
|
|
595
592
|
};
|
|
596
593
|
|
|
597
594
|
const RepoUrlPicker = (props) => {
|
|
@@ -600,7 +597,7 @@ const RepoUrlPicker = (props) => {
|
|
|
600
597
|
const [state, setState] = useState(parseRepoPickerUrl(formData));
|
|
601
598
|
const integrationApi = useApi(scmIntegrationsApiRef);
|
|
602
599
|
const scmAuthApi = useApi(scmAuthApiRef);
|
|
603
|
-
const {
|
|
600
|
+
const { setSecrets } = useTemplateSecrets();
|
|
604
601
|
const allowedHosts = useMemo(() => {
|
|
605
602
|
var _a2, _b2;
|
|
606
603
|
return (_b2 = (_a2 = uiSchema == null ? void 0 : uiSchema["ui:options"]) == null ? void 0 : _a2.allowedHosts) != null ? _b2 : [];
|
|
@@ -638,7 +635,7 @@ const RepoUrlPicker = (props) => {
|
|
|
638
635
|
customScopes: requestUserCredentials.additionalScopes
|
|
639
636
|
}
|
|
640
637
|
});
|
|
641
|
-
|
|
638
|
+
setSecrets({ [requestUserCredentials.secretsKey]: token });
|
|
642
639
|
}, 500, [state, uiSchema]);
|
|
643
640
|
const hostType = (_b = state.host && ((_a = integrationApi.byHost(state.host)) == null ? void 0 : _a.type)) != null ? _b : null;
|
|
644
641
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(RepoUrlPickerHost, {
|
|
@@ -710,7 +707,7 @@ const OwnedEntityPicker = (props) => {
|
|
|
710
707
|
const allowedKinds = (_a = uiSchema["ui:options"]) == null ? void 0 : _a.allowedKinds;
|
|
711
708
|
const defaultKind = (_b = uiSchema["ui:options"]) == null ? void 0 : _b.defaultKind;
|
|
712
709
|
const { ownedEntities, loading } = useOwnedEntities(allowedKinds);
|
|
713
|
-
const entityRefs = ownedEntities == null ? void 0 : ownedEntities.items.map((e) =>
|
|
710
|
+
const entityRefs = ownedEntities == null ? void 0 : ownedEntities.items.map((e) => humanizeEntityRef(e, { defaultKind })).filter((n) => n);
|
|
714
711
|
const onSelect = (_, value) => {
|
|
715
712
|
onChange(value || "");
|
|
716
713
|
};
|
|
@@ -737,6 +734,29 @@ const OwnedEntityPicker = (props) => {
|
|
|
737
734
|
})
|
|
738
735
|
}));
|
|
739
736
|
};
|
|
737
|
+
function useOwnedEntities(allowedKinds) {
|
|
738
|
+
const identityApi = useApi(identityApiRef);
|
|
739
|
+
const catalogApi = useApi(catalogApiRef);
|
|
740
|
+
const { loading, value: refs } = useAsync(async () => {
|
|
741
|
+
const identity = await identityApi.getBackstageIdentity();
|
|
742
|
+
const identityRefs = identity.ownershipEntityRefs;
|
|
743
|
+
const catalogs = await catalogApi.getEntities(allowedKinds ? {
|
|
744
|
+
filter: {
|
|
745
|
+
kind: allowedKinds,
|
|
746
|
+
[`relations.${RELATION_OWNED_BY}`]: identityRefs || []
|
|
747
|
+
}
|
|
748
|
+
} : {
|
|
749
|
+
filter: {
|
|
750
|
+
[`relations.${RELATION_OWNED_BY}`]: identityRefs || []
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
return catalogs;
|
|
754
|
+
}, []);
|
|
755
|
+
const ownedEntities = useMemo(() => {
|
|
756
|
+
return refs;
|
|
757
|
+
}, [refs]);
|
|
758
|
+
return useMemo(() => ({ loading, ownedEntities }), [loading, ownedEntities]);
|
|
759
|
+
}
|
|
740
760
|
|
|
741
761
|
const FIELD_EXTENSION_WRAPPER_KEY = "scaffolder.extensions.wrapper.v1";
|
|
742
762
|
const FIELD_EXTENSION_KEY = "scaffolder.extensions.field.v1";
|
|
@@ -759,6 +779,21 @@ const registerComponentRouteRef = createExternalRouteRef({
|
|
|
759
779
|
const rootRouteRef = createRouteRef({
|
|
760
780
|
id: "scaffolder"
|
|
761
781
|
});
|
|
782
|
+
const selectedTemplateRouteRef = createSubRouteRef({
|
|
783
|
+
id: "scaffolder/selected-template",
|
|
784
|
+
parent: rootRouteRef,
|
|
785
|
+
path: "/templates/:templateName"
|
|
786
|
+
});
|
|
787
|
+
const scaffolderTaskRouteRef = createSubRouteRef({
|
|
788
|
+
id: "scaffolder/task",
|
|
789
|
+
parent: rootRouteRef,
|
|
790
|
+
path: "/tasks/:taskId"
|
|
791
|
+
});
|
|
792
|
+
createSubRouteRef({
|
|
793
|
+
id: "scaffolder/actions",
|
|
794
|
+
parent: rootRouteRef,
|
|
795
|
+
path: "/actions"
|
|
796
|
+
});
|
|
762
797
|
|
|
763
798
|
const scaffolderPlugin = createPlugin({
|
|
764
799
|
id: "scaffolder",
|
|
@@ -804,7 +839,7 @@ const OwnerPickerFieldExtension = scaffolderPlugin.provide(createScaffolderField
|
|
|
804
839
|
}));
|
|
805
840
|
const ScaffolderPage = scaffolderPlugin.provide(createRoutableExtension({
|
|
806
841
|
name: "ScaffolderPage",
|
|
807
|
-
component: () => import('./Router-
|
|
842
|
+
component: () => import('./Router-47c9a9ee.esm.js').then((m) => m.Router),
|
|
808
843
|
mountPoint: rootRouteRef
|
|
809
844
|
}));
|
|
810
845
|
const OwnedEntityPickerFieldExtension = scaffolderPlugin.provide(createScaffolderFieldExtension({
|
|
@@ -816,187 +851,6 @@ const EntityTagsPickerFieldExtension = scaffolderPlugin.provide(createScaffolder
|
|
|
816
851
|
name: "EntityTagsPicker"
|
|
817
852
|
}));
|
|
818
853
|
|
|
819
|
-
const YellowStar = withStyles({
|
|
820
|
-
root: {
|
|
821
|
-
color: "#f3ba37"
|
|
822
|
-
}
|
|
823
|
-
})(Star);
|
|
824
|
-
const WhiteBorderStar = withStyles({
|
|
825
|
-
root: {
|
|
826
|
-
color: "#ffffff"
|
|
827
|
-
}
|
|
828
|
-
})(StarBorder);
|
|
829
|
-
const useStyles$3 = makeStyles((theme) => ({
|
|
830
|
-
starButton: {
|
|
831
|
-
position: "absolute",
|
|
832
|
-
top: theme.spacing(0.5),
|
|
833
|
-
right: theme.spacing(0.5),
|
|
834
|
-
padding: "0.25rem"
|
|
835
|
-
}
|
|
836
|
-
}));
|
|
837
|
-
const favouriteTemplateTooltip = (isStarred) => isStarred ? "Remove from favorites" : "Add to favorites";
|
|
838
|
-
const favouriteTemplateIcon = (isStarred) => isStarred ? /* @__PURE__ */ React.createElement(YellowStar, null) : /* @__PURE__ */ React.createElement(WhiteBorderStar, null);
|
|
839
|
-
const FavouriteTemplate = (props) => {
|
|
840
|
-
const classes = useStyles$3();
|
|
841
|
-
const { toggleStarredEntity, isStarredEntity } = useStarredEntity(props.entity);
|
|
842
|
-
return /* @__PURE__ */ React.createElement(IconButton, {
|
|
843
|
-
color: "inherit",
|
|
844
|
-
className: classes.starButton,
|
|
845
|
-
...props,
|
|
846
|
-
onClick: () => toggleStarredEntity()
|
|
847
|
-
}, /* @__PURE__ */ React.createElement(Tooltip, {
|
|
848
|
-
title: favouriteTemplateTooltip(isStarredEntity)
|
|
849
|
-
}, favouriteTemplateIcon(isStarredEntity)));
|
|
850
|
-
};
|
|
851
|
-
|
|
852
|
-
const useStyles$2 = makeStyles((theme) => ({
|
|
853
|
-
cardHeader: {
|
|
854
|
-
position: "relative"
|
|
855
|
-
},
|
|
856
|
-
title: {
|
|
857
|
-
backgroundImage: ({ backgroundImage }) => backgroundImage
|
|
858
|
-
},
|
|
859
|
-
box: {
|
|
860
|
-
overflow: "hidden",
|
|
861
|
-
textOverflow: "ellipsis",
|
|
862
|
-
display: "-webkit-box",
|
|
863
|
-
"-webkit-line-clamp": 10,
|
|
864
|
-
"-webkit-box-orient": "vertical",
|
|
865
|
-
paddingBottom: "0.8em"
|
|
866
|
-
},
|
|
867
|
-
label: {
|
|
868
|
-
color: theme.palette.text.secondary,
|
|
869
|
-
textTransform: "uppercase",
|
|
870
|
-
fontSize: "0.65rem",
|
|
871
|
-
fontWeight: "bold",
|
|
872
|
-
letterSpacing: 0.5,
|
|
873
|
-
lineHeight: 1,
|
|
874
|
-
paddingBottom: "0.2rem"
|
|
875
|
-
},
|
|
876
|
-
leftButton: {
|
|
877
|
-
marginRight: "auto"
|
|
878
|
-
}
|
|
879
|
-
}));
|
|
880
|
-
const useDeprecationStyles = makeStyles((theme) => ({
|
|
881
|
-
deprecationIcon: {
|
|
882
|
-
position: "absolute",
|
|
883
|
-
top: theme.spacing(0.5),
|
|
884
|
-
right: theme.spacing(3.5),
|
|
885
|
-
padding: "0.25rem"
|
|
886
|
-
},
|
|
887
|
-
link: {
|
|
888
|
-
color: theme.palette.warning.light
|
|
889
|
-
}
|
|
890
|
-
}));
|
|
891
|
-
const getTemplateCardProps = (template) => {
|
|
892
|
-
var _a, _b, _c, _d, _e;
|
|
893
|
-
return {
|
|
894
|
-
key: template.metadata.uid,
|
|
895
|
-
name: template.metadata.name,
|
|
896
|
-
title: `${(_a = template.metadata.title || template.metadata.name) != null ? _a : ""}`,
|
|
897
|
-
type: (_b = template.spec.type) != null ? _b : "",
|
|
898
|
-
description: (_c = template.metadata.description) != null ? _c : "-",
|
|
899
|
-
tags: (_e = (_d = template.metadata) == null ? void 0 : _d.tags) != null ? _e : []
|
|
900
|
-
};
|
|
901
|
-
};
|
|
902
|
-
const DeprecationWarning = () => {
|
|
903
|
-
const styles = useDeprecationStyles();
|
|
904
|
-
const Title = /* @__PURE__ */ React.createElement(Typography, {
|
|
905
|
-
style: { padding: 10, maxWidth: 300 }
|
|
906
|
-
}, "This template uses a syntax that has been deprecated, and should be migrated to a newer syntax. Click for more info.");
|
|
907
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
908
|
-
className: styles.deprecationIcon
|
|
909
|
-
}, /* @__PURE__ */ React.createElement(Tooltip, {
|
|
910
|
-
title: Title
|
|
911
|
-
}, /* @__PURE__ */ React.createElement(Link, {
|
|
912
|
-
href: "https://backstage.io/docs/features/software-templates/migrating-from-v1beta2-to-v1beta3",
|
|
913
|
-
className: styles.link
|
|
914
|
-
}, /* @__PURE__ */ React.createElement(WarningIcon, null))));
|
|
915
|
-
};
|
|
916
|
-
const TemplateCard = ({ template, deprecated }) => {
|
|
917
|
-
var _a;
|
|
918
|
-
const backstageTheme = useTheme();
|
|
919
|
-
const rootLink = useRouteRef(rootRouteRef);
|
|
920
|
-
const templateProps = getTemplateCardProps(template);
|
|
921
|
-
const ownedByRelations = getEntityRelations(template, RELATION_OWNED_BY);
|
|
922
|
-
const themeId = backstageTheme.getPageTheme({ themeId: templateProps.type }) ? templateProps.type : "other";
|
|
923
|
-
const theme = backstageTheme.getPageTheme({ themeId });
|
|
924
|
-
const classes = useStyles$2({ backgroundImage: theme.backgroundImage });
|
|
925
|
-
const href = generatePath(`${rootLink()}/templates/:templateName`, {
|
|
926
|
-
templateName: templateProps.name
|
|
927
|
-
});
|
|
928
|
-
const scmIntegrationsApi = useApi(scmIntegrationsApiRef);
|
|
929
|
-
const sourceLocation = getEntitySourceLocation(template, scmIntegrationsApi);
|
|
930
|
-
return /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(CardMedia, {
|
|
931
|
-
className: classes.cardHeader
|
|
932
|
-
}, /* @__PURE__ */ React.createElement(FavouriteTemplate, {
|
|
933
|
-
entity: template
|
|
934
|
-
}), deprecated && /* @__PURE__ */ React.createElement(DeprecationWarning, null), /* @__PURE__ */ React.createElement(ItemCardHeader, {
|
|
935
|
-
title: templateProps.title,
|
|
936
|
-
subtitle: templateProps.type,
|
|
937
|
-
classes: { root: classes.title }
|
|
938
|
-
})), /* @__PURE__ */ React.createElement(CardContent, {
|
|
939
|
-
style: { display: "grid" }
|
|
940
|
-
}, /* @__PURE__ */ React.createElement(Box, {
|
|
941
|
-
className: classes.box
|
|
942
|
-
}, /* @__PURE__ */ React.createElement(Typography, {
|
|
943
|
-
variant: "body2",
|
|
944
|
-
className: classes.label
|
|
945
|
-
}, "Description"), templateProps.description), /* @__PURE__ */ React.createElement(Box, {
|
|
946
|
-
className: classes.box
|
|
947
|
-
}, /* @__PURE__ */ React.createElement(Typography, {
|
|
948
|
-
variant: "body2",
|
|
949
|
-
className: classes.label
|
|
950
|
-
}, "Owner"), /* @__PURE__ */ React.createElement(EntityRefLinks, {
|
|
951
|
-
entityRefs: ownedByRelations,
|
|
952
|
-
defaultKind: "Group"
|
|
953
|
-
})), /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
954
|
-
variant: "body2",
|
|
955
|
-
className: classes.label
|
|
956
|
-
}, "Tags"), (_a = templateProps.tags) == null ? void 0 : _a.map((tag) => /* @__PURE__ */ React.createElement(Chip, {
|
|
957
|
-
size: "small",
|
|
958
|
-
label: tag,
|
|
959
|
-
key: tag
|
|
960
|
-
})))), /* @__PURE__ */ React.createElement(CardActions, null, sourceLocation && /* @__PURE__ */ React.createElement(IconButton, {
|
|
961
|
-
className: classes.leftButton,
|
|
962
|
-
href: sourceLocation.locationTargetUrl
|
|
963
|
-
}, /* @__PURE__ */ React.createElement(ScmIntegrationIcon, {
|
|
964
|
-
type: sourceLocation.integrationType
|
|
965
|
-
})), /* @__PURE__ */ React.createElement(Button, {
|
|
966
|
-
color: "primary",
|
|
967
|
-
to: href,
|
|
968
|
-
"aria-label": `Choose ${templateProps.title}`
|
|
969
|
-
}, "Choose")));
|
|
970
|
-
};
|
|
971
|
-
|
|
972
|
-
const TemplateList = ({
|
|
973
|
-
TemplateCardComponent,
|
|
974
|
-
group
|
|
975
|
-
}) => {
|
|
976
|
-
const { loading, error, entities } = useEntityList();
|
|
977
|
-
const Card = TemplateCardComponent || TemplateCard;
|
|
978
|
-
const maybeFilteredEntities = group ? entities.filter((e) => group.filter(e)) : entities;
|
|
979
|
-
const title = group ? group.titleComponent || /* @__PURE__ */ React.createElement(ContentHeader, {
|
|
980
|
-
title: group.title
|
|
981
|
-
}) : /* @__PURE__ */ React.createElement(ContentHeader, {
|
|
982
|
-
title: "Other Templates"
|
|
983
|
-
});
|
|
984
|
-
if (group && maybeFilteredEntities.length === 0) {
|
|
985
|
-
return null;
|
|
986
|
-
}
|
|
987
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, loading && /* @__PURE__ */ React.createElement(Progress, null), error && /* @__PURE__ */ React.createElement(WarningPanel, {
|
|
988
|
-
title: "Oops! Something went wrong loading the templates"
|
|
989
|
-
}, error.message), !error && !loading && !entities.length && /* @__PURE__ */ React.createElement(Typography, {
|
|
990
|
-
variant: "body2"
|
|
991
|
-
}, "No templates found that match your filter. Learn more about", " ", /* @__PURE__ */ React.createElement(Link$1, {
|
|
992
|
-
to: "https://backstage.io/docs/features/software-templates/adding-templates"
|
|
993
|
-
}, "adding templates"), "."), /* @__PURE__ */ React.createElement(Content, null, title, /* @__PURE__ */ React.createElement(ItemCardGrid, null, maybeFilteredEntities && (maybeFilteredEntities == null ? void 0 : maybeFilteredEntities.length) > 0 && maybeFilteredEntities.map((template) => /* @__PURE__ */ React.createElement(Card, {
|
|
994
|
-
key: stringifyEntityRef(template),
|
|
995
|
-
template,
|
|
996
|
-
deprecated: template.apiVersion === "backstage.io/v1beta2"
|
|
997
|
-
})))));
|
|
998
|
-
};
|
|
999
|
-
|
|
1000
854
|
const icon = /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, {
|
|
1001
855
|
fontSize: "small"
|
|
1002
856
|
});
|
|
@@ -1188,34 +1042,20 @@ const IconLink = (props) => {
|
|
|
1188
1042
|
className: classes.svgIcon
|
|
1189
1043
|
}, Icon ? /* @__PURE__ */ React.createElement(Icon, null) : /* @__PURE__ */ React.createElement(LanguageIcon, null))), /* @__PURE__ */ React.createElement(Grid, {
|
|
1190
1044
|
item: true
|
|
1191
|
-
}, /* @__PURE__ */ React.createElement(Link
|
|
1045
|
+
}, /* @__PURE__ */ React.createElement(Link, {
|
|
1192
1046
|
to: href,
|
|
1193
1047
|
...linkProps
|
|
1194
1048
|
}, text || href)));
|
|
1195
1049
|
};
|
|
1196
1050
|
|
|
1197
1051
|
const TaskPageLinks = ({ output }) => {
|
|
1198
|
-
const {
|
|
1199
|
-
let { links = [] } = output;
|
|
1052
|
+
const { links = [] } = output;
|
|
1200
1053
|
const app = useApp();
|
|
1201
1054
|
const entityRoute = useRouteRef(entityRouteRef);
|
|
1202
1055
|
const iconResolver = (key) => {
|
|
1203
1056
|
var _a;
|
|
1204
1057
|
return key ? (_a = app.getSystemIcon(key)) != null ? _a : LanguageIcon : LanguageIcon;
|
|
1205
1058
|
};
|
|
1206
|
-
if (remoteUrl) {
|
|
1207
|
-
links = [{ url: remoteUrl, title: "Repo" }, ...links];
|
|
1208
|
-
}
|
|
1209
|
-
if (entityRefOutput) {
|
|
1210
|
-
links = [
|
|
1211
|
-
{
|
|
1212
|
-
entityRef: entityRefOutput,
|
|
1213
|
-
title: "Open in catalog",
|
|
1214
|
-
icon: "catalog"
|
|
1215
|
-
},
|
|
1216
|
-
...links
|
|
1217
|
-
];
|
|
1218
|
-
}
|
|
1219
1059
|
return /* @__PURE__ */ React.createElement(Box, {
|
|
1220
1060
|
px: 3,
|
|
1221
1061
|
pb: 3
|
|
@@ -1355,15 +1195,12 @@ const TaskStatusStepper = memo(({
|
|
|
1355
1195
|
})))));
|
|
1356
1196
|
})));
|
|
1357
1197
|
});
|
|
1358
|
-
const hasLinks = ({
|
|
1359
|
-
entityRef,
|
|
1360
|
-
remoteUrl,
|
|
1361
|
-
links = []
|
|
1362
|
-
}) => !!(entityRef || remoteUrl || links.length > 0);
|
|
1198
|
+
const hasLinks = ({ links = [] }) => links.length > 0;
|
|
1363
1199
|
const TaskPage = ({ loadingText }) => {
|
|
1364
1200
|
const classes = useStyles();
|
|
1365
1201
|
const navigate = useNavigate();
|
|
1366
|
-
const
|
|
1202
|
+
const rootPath = useRouteRef(rootRouteRef);
|
|
1203
|
+
const templateRoute = useRouteRef(selectedTemplateRouteRef);
|
|
1367
1204
|
const [userSelectedStepId, setUserSelectedStepId] = useState(void 0);
|
|
1368
1205
|
const [lastActiveStepId, setLastActiveStepId] = useState(void 0);
|
|
1369
1206
|
const { taskId } = useParams();
|
|
@@ -1404,16 +1241,14 @@ const TaskPage = ({ loadingText }) => {
|
|
|
1404
1241
|
const handleStartOver = () => {
|
|
1405
1242
|
var _a, _b, _c;
|
|
1406
1243
|
if (!taskStream.task || !((_b = (_a = taskStream.task) == null ? void 0 : _a.spec.templateInfo) == null ? void 0 : _b.entityRef)) {
|
|
1407
|
-
navigate(
|
|
1244
|
+
navigate(rootPath());
|
|
1408
1245
|
return;
|
|
1409
1246
|
}
|
|
1410
|
-
const formData = taskStream.task.spec.
|
|
1247
|
+
const formData = taskStream.task.spec.parameters;
|
|
1411
1248
|
const { name } = parseEntityRef((_c = taskStream.task.spec.templateInfo) == null ? void 0 : _c.entityRef);
|
|
1412
|
-
navigate(
|
|
1249
|
+
navigate(`${templateRoute({ templateName: name })}?${qs.stringify({
|
|
1413
1250
|
formData: JSON.stringify(formData)
|
|
1414
|
-
})}
|
|
1415
|
-
templateName: name
|
|
1416
|
-
}));
|
|
1251
|
+
})}`);
|
|
1417
1252
|
};
|
|
1418
1253
|
return /* @__PURE__ */ React.createElement(Page, {
|
|
1419
1254
|
themeId: "home"
|
|
@@ -1439,7 +1274,7 @@ const TaskPage = ({ loadingText }) => {
|
|
|
1439
1274
|
onUserStepChange: setUserSelectedStepId
|
|
1440
1275
|
}), output && hasLinks(output) && /* @__PURE__ */ React.createElement(TaskPageLinks, {
|
|
1441
1276
|
output
|
|
1442
|
-
}), /* @__PURE__ */ React.createElement(Button
|
|
1277
|
+
}), /* @__PURE__ */ React.createElement(Button, {
|
|
1443
1278
|
className: classes.button,
|
|
1444
1279
|
onClick: handleStartOver,
|
|
1445
1280
|
disabled: !completed,
|
|
@@ -1455,5 +1290,5 @@ const TaskPage = ({ loadingText }) => {
|
|
|
1455
1290
|
})))))));
|
|
1456
1291
|
};
|
|
1457
1292
|
|
|
1458
|
-
export { EntityPicker as E, FIELD_EXTENSION_WRAPPER_KEY as F, OwnerPicker as O, RepoUrlPicker as R, SecretsContext as S, TemplateTypePicker as T, EntityNamePicker as a, EntityTagsPicker as b, OwnedEntityPicker as c, registerComponentRouteRef as d, entityNamePickerValidation as e,
|
|
1459
|
-
//# sourceMappingURL=index-
|
|
1293
|
+
export { EntityPicker as E, FIELD_EXTENSION_WRAPPER_KEY as F, OwnerPicker as O, RepoUrlPicker as R, SecretsContext as S, TemplateTypePicker as T, EntityNamePicker as a, EntityTagsPicker as b, OwnedEntityPicker as c, registerComponentRouteRef as d, entityNamePickerValidation as e, scaffolderApiRef as f, scaffolderTaskRouteRef as g, rootRouteRef as h, FIELD_EXTENSION_KEY as i, SecretsContextProvider as j, TaskPage as k, ScaffolderClient as l, createScaffolderFieldExtension as m, ScaffolderFieldExtensions as n, EntityPickerFieldExtension as o, EntityNamePickerFieldExtension as p, EntityTagsPickerFieldExtension as q, repoPickerValidation as r, selectedTemplateRouteRef as s, OwnerPickerFieldExtension as t, OwnedEntityPickerFieldExtension as u, RepoUrlPickerFieldExtension as v, ScaffolderPage as w, scaffolderPlugin as x, useTemplateSecrets as y };
|
|
1294
|
+
//# sourceMappingURL=index-ced3b204.esm.js.map
|