@backstage/plugin-kubernetes 0.7.1-next.0 → 0.7.1-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,14 @@
1
1
  # @backstage/plugin-kubernetes
2
2
 
3
+ ## 0.7.1-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 860ed68343: Fixed bug in CronJobsAccordions component that causes an error when cronjobs use a kubernetes alias, such as `@hourly` or `@daily` instead of standard cron syntax.
8
+ - Updated dependencies
9
+ - @backstage/core-components@0.10.1-next.1
10
+ - @backstage/plugin-catalog-react@1.1.3-next.1
11
+
3
12
  ## 0.7.1-next.0
4
13
 
5
14
  ### Patch Changes
package/dist/index.esm.js CHANGED
@@ -1978,6 +1978,24 @@ const CronJobDrawer = ({
1978
1978
  }))));
1979
1979
  };
1980
1980
 
1981
+ const k8sCronAliases = /* @__PURE__ */ new Map([
1982
+ ["@yearly", "0 0 1 1 *"],
1983
+ ["@annually", "0 0 1 1 *"],
1984
+ ["@monthly", "0 0 1 * *"],
1985
+ ["@weekly", "0 0 * * 0"],
1986
+ ["@daily", "0 0 * * *"],
1987
+ ["@midnight", "0 0 * * *"],
1988
+ ["@hourly", "0 * * * *"]
1989
+ ]);
1990
+ const humanizeCron = (schedule) => {
1991
+ const deAliasedSchedule = k8sCronAliases.get(schedule) || schedule;
1992
+ try {
1993
+ return cronstrue.toString(deAliasedSchedule);
1994
+ } catch (e) {
1995
+ return deAliasedSchedule;
1996
+ }
1997
+ };
1998
+
1981
1999
  const CronJobSummary = ({ cronJob }) => {
1982
2000
  var _a, _b;
1983
2001
  return /* @__PURE__ */ React__default.createElement(Grid, {
@@ -2009,7 +2027,7 @@ const CronJobSummary = ({ cronJob }) => {
2009
2027
  item: true
2010
2028
  }, /* @__PURE__ */ React__default.createElement(Typography, {
2011
2029
  variant: "body1"
2012
- }, "Schedule:", " ", ((_b = cronJob.spec) == null ? void 0 : _b.schedule) ? `${cronJob.spec.schedule} (${cronstrue.toString(
2030
+ }, "Schedule:", " ", ((_b = cronJob.spec) == null ? void 0 : _b.schedule) ? `${cronJob.spec.schedule} (${humanizeCron(
2013
2031
  cronJob.spec.schedule
2014
2032
  )})` : "N/A"))));
2015
2033
  };