Skip to content

Commit

Permalink
Merge pull request #12349 from torchiaf/feature/harvester-shell-integ…
Browse files Browse the repository at this point in the history
…ration-2

Harvester shell integration - bump chron libraries
  • Loading branch information
torchiaf authored Nov 5, 2024
2 parents 99285c9 + efb2826 commit 2e494c4
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-extension-charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ jobs:
- name: Setup Nodejs with yarn caching
uses: actions/setup-node@v4
with:
node-version: '20'
cache: yarn
node-version-file: '.nvmrc'

- name: Install dependencies
run: yarn
Expand Down
4 changes: 2 additions & 2 deletions pkg/rancher-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"@vue/test-utils": "~2.0.0-0",
"babel-eslint": "10.1.0",
"core-js": "3.25.3",
"cron-validator": "1.2.0",
"cronstrue": "1.95.0",
"cron-validator": "1.3.1",
"cronstrue": "2.50.0",
"eslint": "7.32.0",
"eslint-plugin-import": "2.23.4",
"eslint-plugin-node": "11.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,16 @@ export default defineComponent({
if (this.type !== 'cron' || !this.value) {
return;
}
if (typeof this.value === 'string' && !isValidCron(this.value)) {
// refer https://github.com/GuillaumeRochat/cron-validator#readme
if (!isValidCron(this.value as string, {
alias: true,
allowBlankDay: true,
allowSevenAsSunday: true,
})) {
return this.t('generic.invalidCron');
}
try {
const hint = cronstrue.toString(this.value || '');
const hint = cronstrue.toString(this.value as string || '', { verbose: true });
return hint;
} catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions shell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
"cookie": "0.5.0",
"cookie-universal": "2.2.2",
"core-js": "3.25.3",
"cron-validator": "1.2.0",
"cronstrue": "1.95.0",
"cron-validator": "1.3.1",
"cronstrue": "2.50.0",
"cross-env": "6.0.3",
"css-loader": "6.7.3",
"csv-loader": "3.0.3",
Expand Down
2 changes: 1 addition & 1 deletion shell/utils/validators/cron-schedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import cronstrue from 'cronstrue';

export function cronSchedule(schedule = '', getters, errors) {
try {
cronstrue.toString(schedule);
cronstrue.toString(schedule, { verbose: true });
} catch (e) {
errors.push(getters['i18n/t']('validation.invalidCron'));
}
Expand Down
2 changes: 1 addition & 1 deletion shell/utils/validators/formRules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default function(t: Translation, { key = 'Value' }: ValidationOptions): {

const cronSchedule: Validator = (val: string) => {
try {
cronstrue.toString(val);
cronstrue.toString(val, { verbose: true });
} catch (e) {
return t('validation.invalidCron');
}
Expand Down
54 changes: 50 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6370,11 +6370,21 @@ [email protected]:
resolved "https://registry.npmjs.org/cron-validator/-/cron-validator-1.2.0.tgz#952d2c926b85724dfe9c0d0ca781fe956124de93"
integrity sha512-fX9eq71ToAt4bJeJzFNe8OCljKNQdc2Otw4kZDfB3vyplrAyEO9Q20YgmCJ4pr+jI/QQ2yizM87Eh+b2Ty7GuQ==

[email protected]:
version "1.3.1"
resolved "https://registry.yarnpkg.com/cron-validator/-/cron-validator-1.3.1.tgz#8f2fe430f92140df77f91178ae31fc1e3a48a20e"
integrity sha512-C1HsxuPCY/5opR55G5/WNzyEGDWFVG+6GLrA+fW/sCTcP6A6NTjUP2AK7B8n2PyFs90kDG2qzwm8LMheADku6A==

[email protected]:
version "1.95.0"
resolved "https://registry.npmjs.org/cronstrue/-/cronstrue-1.95.0.tgz#171df1fad8b0f0cb636354dd1d7842161c15478f"
integrity sha512-CdbQ17Z8Na2IdrK1SiD3zmXfE66KerQZ8/iApkGsxjmUVGJPS9M9oK4FZC3LM6ohUjjq3UeaSk+90Cf3QbXDfw==

[email protected]:
version "2.50.0"
resolved "https://registry.yarnpkg.com/cronstrue/-/cronstrue-2.50.0.tgz#eabba0f915f186765258b707b7a3950c663b5573"
integrity sha512-ULYhWIonJzlScCCQrPUG5uMXzXxSixty4djud9SS37DoNxDdkeRocxzHuAo4ImRBUK+mAuU5X9TSwEDccnnuPg==

[email protected]:
version "6.0.3"
resolved "https://registry.npmjs.org/cross-env/-/cross-env-6.0.3.tgz#4256b71e49b3a40637a0ce70768a6ef5c72ae941"
Expand Down Expand Up @@ -9316,7 +9326,18 @@ html-tags@^3.3.1:
tapable "^1.1.3"
util.promisify "1.0.0"

"html-webpack-plugin-5@npm:html-webpack-plugin@^5", html-webpack-plugin@^5.0.0, html-webpack-plugin@^5.1.0:
"html-webpack-plugin-5@npm:html-webpack-plugin@^5":
version "5.6.0"
resolved "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-5.6.0.tgz#50a8fa6709245608cb00e811eacecb8e0d7b7ea0"
integrity sha512-iwaY4wzbe48AfKLZ/Cc8k0L+FKG6oSNRaZ8x5A/T/IVDGyXcbHncM9TdDa93wn0FsSm82FhTKW7f3vS61thXAw==
dependencies:
"@types/html-minifier-terser" "^6.0.0"
html-minifier-terser "^6.0.2"
lodash "^4.17.21"
pretty-error "^4.0.0"
tapable "^2.0.0"

html-webpack-plugin@^5.0.0, html-webpack-plugin@^5.1.0:
version "5.6.0"
resolved "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-5.6.0.tgz#50a8fa6709245608cb00e811eacecb8e0d7b7ea0"
integrity sha512-iwaY4wzbe48AfKLZ/Cc8k0L+FKG6oSNRaZ8x5A/T/IVDGyXcbHncM9TdDa93wn0FsSm82FhTKW7f3vS61thXAw==
Expand Down Expand Up @@ -13920,7 +13941,7 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"

"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand All @@ -13937,6 +13958,15 @@ string-width@^2.1.1:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^4.0.0"

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^5.0.1, string-width@^5.1.2:
version "5.1.2"
resolved "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794"
Expand Down Expand Up @@ -13988,7 +14018,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand All @@ -14009,6 +14039,13 @@ strip-ansi@^4.0.0:
dependencies:
ansi-regex "^3.0.0"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^7.0.1:
version "7.1.0"
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
Expand Down Expand Up @@ -15287,7 +15324,7 @@ [email protected]:
loader-utils "^2.0.0"
schema-utils "^3.0.0"

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -15313,6 +15350,15 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit 2e494c4

Please sign in to comment.