@backstage/core-components 0.12.0-next.0 → 0.12.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 +33 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.esm.js +33 -5
- package/dist/index.esm.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @backstage/core-components
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fb3733e446: **BREAKING**: Removed the `HomepageTimer` as it has been replaced by the `HeaderWorldClock` in the Home plugin and was deprecated over a year ago.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 5f695c219a: Set the `searchTooltip` to "Filter" to follow how the `searchPlaceholder` is set making this more consistent
|
|
12
|
+
- f36127f5fe: Add optional step to SimpleStepper
|
|
13
|
+
- b4fb5c8ecc: MissingAnnotationEmptyState now accepts either a string or an array of strings to support multiple missing annotations.
|
|
14
|
+
- 7573b65232: Internal refactor of imports to avoid circular dependencies
|
|
15
|
+
- 858986f6b6: Disable base path workaround in `Link` component when React Router v6 stable is used.
|
|
16
|
+
- f905853ad6: Prefer using `Link` from `@backstage/core-components` rather than material-UI.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @backstage/version-bridge@1.0.2
|
|
19
|
+
- @backstage/core-plugin-api@1.1.0
|
|
20
|
+
- @backstage/config@1.0.4
|
|
21
|
+
- @backstage/errors@1.1.3
|
|
22
|
+
- @backstage/theme@0.2.16
|
|
23
|
+
|
|
24
|
+
## 0.12.0-next.1
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- b4fb5c8ecc: MissingAnnotationEmptyState now accepts either a string or an array of strings to support multiple missing annotations.
|
|
29
|
+
- Updated dependencies
|
|
30
|
+
- @backstage/config@1.0.4-next.0
|
|
31
|
+
- @backstage/core-plugin-api@1.1.0-next.0
|
|
32
|
+
- @backstage/errors@1.1.3-next.0
|
|
33
|
+
- @backstage/theme@0.2.16
|
|
34
|
+
- @backstage/version-bridge@1.0.1
|
|
35
|
+
|
|
3
36
|
## 0.12.0-next.0
|
|
4
37
|
|
|
5
38
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -576,7 +576,7 @@ declare function EmptyState(props: Props$h): JSX.Element;
|
|
|
576
576
|
declare type EmptyStateImageClassKey = 'generalImg';
|
|
577
577
|
|
|
578
578
|
declare type Props$g = {
|
|
579
|
-
annotation: string;
|
|
579
|
+
annotation: string | string[];
|
|
580
580
|
readMoreUrl?: string;
|
|
581
581
|
};
|
|
582
582
|
declare type MissingAnnotationEmptyStateClassKey = 'code';
|
|
@@ -938,6 +938,10 @@ declare type StepActions = {
|
|
|
938
938
|
canRestart?: () => boolean;
|
|
939
939
|
onRestart?: () => void;
|
|
940
940
|
restartText?: string;
|
|
941
|
+
showSkip?: boolean;
|
|
942
|
+
canSkip?: () => boolean;
|
|
943
|
+
onSkip?: () => void;
|
|
944
|
+
skipText?: string;
|
|
941
945
|
};
|
|
942
946
|
declare type StepProps = {
|
|
943
947
|
title: string;
|
package/dist/index.esm.js
CHANGED
|
@@ -1045,7 +1045,7 @@ function EmptyState(props) {
|
|
|
1045
1045
|
}) : missing.customImage));
|
|
1046
1046
|
}
|
|
1047
1047
|
|
|
1048
|
-
const
|
|
1048
|
+
const COMPONENT_YAML_TEMPLATE = `apiVersion: backstage.io/v1alpha1
|
|
1049
1049
|
kind: Component
|
|
1050
1050
|
metadata:
|
|
1051
1051
|
name: example
|
|
@@ -1056,6 +1056,11 @@ spec:
|
|
|
1056
1056
|
type: website
|
|
1057
1057
|
lifecycle: production
|
|
1058
1058
|
owner: user:guest`;
|
|
1059
|
+
const ANNOTATION_REGEXP = /^.*ANNOTATION.*$/m;
|
|
1060
|
+
const ANNOTATION_YAML = COMPONENT_YAML_TEMPLATE.match(ANNOTATION_REGEXP)[0];
|
|
1061
|
+
const ANNOTATION_LINE = COMPONENT_YAML_TEMPLATE.split("\n").findIndex(
|
|
1062
|
+
(line) => ANNOTATION_REGEXP.test(line)
|
|
1063
|
+
);
|
|
1059
1064
|
const useStyles$J = makeStyles(
|
|
1060
1065
|
(theme) => ({
|
|
1061
1066
|
code: {
|
|
@@ -1066,24 +1071,35 @@ const useStyles$J = makeStyles(
|
|
|
1066
1071
|
}),
|
|
1067
1072
|
{ name: "BackstageMissingAnnotationEmptyState" }
|
|
1068
1073
|
);
|
|
1074
|
+
function generateLineNumbers(lineCount) {
|
|
1075
|
+
return Array.from(Array(lineCount + 1).keys(), (i) => i + ANNOTATION_LINE);
|
|
1076
|
+
}
|
|
1077
|
+
function generateComponentYaml(annotations) {
|
|
1078
|
+
const annotationYaml = annotations.map((ann) => ANNOTATION_YAML.replace("ANNOTATION", ann)).join("\n");
|
|
1079
|
+
return COMPONENT_YAML_TEMPLATE.replace(ANNOTATION_YAML, annotationYaml);
|
|
1080
|
+
}
|
|
1081
|
+
function generateDescription(annotations) {
|
|
1082
|
+
const isSingular = annotations.length <= 1;
|
|
1083
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, "The ", isSingular ? "annotation" : "annotations", " ", annotations.map((ann) => /* @__PURE__ */ React.createElement("code", null, ann)).reduce((prev, curr) => /* @__PURE__ */ React.createElement(React.Fragment, null, prev, ", ", curr)), " ", isSingular ? "is" : "are", " missing. You need to add the", " ", isSingular ? "annotation" : "annotations", " to your component if you want to enable this tool.");
|
|
1084
|
+
}
|
|
1069
1085
|
function MissingAnnotationEmptyState(props) {
|
|
1070
1086
|
const { annotation, readMoreUrl } = props;
|
|
1087
|
+
const annotations = Array.isArray(annotation) ? annotation : [annotation];
|
|
1071
1088
|
const url = readMoreUrl || "https://backstage.io/docs/features/software-catalog/well-known-annotations";
|
|
1072
1089
|
const classes = useStyles$J();
|
|
1073
|
-
const description = /* @__PURE__ */ React.createElement(React.Fragment, null, "The ", /* @__PURE__ */ React.createElement("code", null, annotation), " annotation is missing. You need to add the annotation to your component if you want to enable this tool.");
|
|
1074
1090
|
return /* @__PURE__ */ React.createElement(EmptyState, {
|
|
1075
1091
|
missing: "field",
|
|
1076
1092
|
title: "Missing Annotation",
|
|
1077
|
-
description,
|
|
1093
|
+
description: generateDescription(annotations),
|
|
1078
1094
|
action: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
1079
1095
|
variant: "body1"
|
|
1080
1096
|
}, "Add the annotation to your component YAML as shown in the highlighted example below:"), /* @__PURE__ */ React.createElement("div", {
|
|
1081
1097
|
className: classes.code
|
|
1082
1098
|
}, /* @__PURE__ */ React.createElement(CodeSnippet, {
|
|
1083
|
-
text:
|
|
1099
|
+
text: generateComponentYaml(annotations),
|
|
1084
1100
|
language: "yaml",
|
|
1085
1101
|
showLineNumbers: true,
|
|
1086
|
-
highlightedNumbers:
|
|
1102
|
+
highlightedNumbers: generateLineNumbers(annotations.length),
|
|
1087
1103
|
customStyle: { background: "inherit", fontSize: "115%" }
|
|
1088
1104
|
})), /* @__PURE__ */ React.createElement(Button$1, {
|
|
1089
1105
|
color: "primary",
|
|
@@ -2730,6 +2746,13 @@ const NextBtn = ({
|
|
|
2730
2746
|
"data-testid": `nextButton-${stepIndex}`,
|
|
2731
2747
|
onClick: handleClick
|
|
2732
2748
|
}, text || (last ? "Finish" : "Next"));
|
|
2749
|
+
const SkipBtn = ({ text, handleClick, disabled, stepIndex }) => /* @__PURE__ */ React.createElement(Button$1, {
|
|
2750
|
+
variant: "outlined",
|
|
2751
|
+
color: "primary",
|
|
2752
|
+
disabled,
|
|
2753
|
+
"data-testid": `skipButton-${stepIndex}`,
|
|
2754
|
+
onClick: handleClick
|
|
2755
|
+
}, text || "Skip");
|
|
2733
2756
|
const BackBtn = ({ text, handleClick, disabled, stepIndex }) => /* @__PURE__ */ React.createElement(Button$1, {
|
|
2734
2757
|
onClick: handleClick,
|
|
2735
2758
|
"data-testid": `backButton-${stepIndex}`,
|
|
@@ -2778,6 +2801,11 @@ const SimpleStepperFooter = ({
|
|
|
2778
2801
|
handleClick: handleBack,
|
|
2779
2802
|
disabled: stepIndex === 0,
|
|
2780
2803
|
stepIndex
|
|
2804
|
+
}), actions.showSkip && /* @__PURE__ */ React.createElement(SkipBtn, {
|
|
2805
|
+
text: actions.skipText,
|
|
2806
|
+
handleClick: handleNext,
|
|
2807
|
+
disabled: !!stepperLength && stepIndex >= stepperLength || !!actions.canSkip && !actions.canSkip(),
|
|
2808
|
+
stepIndex
|
|
2781
2809
|
}), [void 0, true].includes(actions.showNext) && /* @__PURE__ */ React.createElement(NextBtn, {
|
|
2782
2810
|
text: actions.nextText,
|
|
2783
2811
|
handleClick: handleNext,
|