From 0f7b3c653ab3d3b42c36b1b867f8e5884187af43 Mon Sep 17 00:00:00 2001 From: Randy Schott <1815175+schottra@users.noreply.github.com> Date: Mon, 6 Jul 2020 16:38:22 -0700 Subject: [PATCH 1/4] fix: show full millisecond values for subsecond durations (#81) --- src/common/formatters.ts | 2 +- src/common/test/formatters.spec.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/formatters.ts b/src/common/formatters.ts index 0011c0459..5d29f77e7 100644 --- a/src/common/formatters.ts +++ b/src/common/formatters.ts @@ -71,7 +71,7 @@ export function millisecondsToHMS(valueMS: number): string { } if (valueMS < 1000) { - return subSecondString; + return `${valueMS}ms`; } const duration = moment.duration(valueMS); diff --git a/src/common/test/formatters.spec.ts b/src/common/test/formatters.spec.ts index 718ce5db0..5f209743a 100644 --- a/src/common/test/formatters.spec.ts +++ b/src/common/test/formatters.spec.ts @@ -102,8 +102,8 @@ describe('formatDateLocalTimezone', () => { const millisecondToHMSTestCases: [number, string][] = [ [-1, unknownValueString], [0, zeroSecondsString], - [1, subSecondString], - [999, subSecondString], + [1, '1ms'], + [999, '999ms'], [1000, '1s'], [60000, '1m'], [61000, '1m 1s'], From fa9babaa1cd904b03373c4ee73b1b580a851b78f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2020 16:32:29 -0700 Subject: [PATCH 2/4] Bump npm from 6.14.5 to 6.14.6 (#82) Bumps [npm](https://github.com/npm/cli) from 6.14.5 to 6.14.6. - [Release notes](https://github.com/npm/cli/releases) - [Changelog](https://github.com/npm/cli/blob/latest/CHANGELOG.md) - [Commits](https://github.com/npm/cli/compare/v6.14.5...v6.14.6) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 63 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 14 deletions(-) diff --git a/yarn.lock b/yarn.lock index 169e28285..06aa8a517 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4082,7 +4082,7 @@ ajv-keywords@^3.1.0, ajv-keywords@^3.4.1: resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.0.tgz#5c894537098785926d71e696114a53ce768ed773" integrity sha512-eyoaac3btgU8eJlvh01En8OCKzRqlLe2G5jDsCr3RiE2uLGMEEB1aaGwVVpwR8M95956tGH6R+9edC++OvzaVw== -ajv@^6.1.0, ajv@^6.1.1, ajv@^6.10.2, ajv@^6.12.2, ajv@^6.5.5, ajv@^6.9.1: +ajv@^6.1.0, ajv@^6.1.1, ajv@^6.10.2, ajv@^6.12.2, ajv@^6.9.1: version "6.12.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.2.tgz#c629c5eced17baf314437918d2da88c99d5958cd" integrity sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ== @@ -4092,6 +4092,16 @@ ajv@^6.1.0, ajv@^6.1.1, ajv@^6.10.2, ajv@^6.12.2, ajv@^6.5.5, ajv@^6.9.1: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^6.5.5: + version "6.12.3" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.3.tgz#18c5af38a111ddeb4f2697bd78d68abc1cabd706" + integrity sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + ansi-align@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-2.0.0.tgz#c36aeccba563b89ceb556f3690f0b1d9e3547f7f" @@ -6646,7 +6656,7 @@ debug@^3.0.0, debug@^3.1.0, debug@^3.2.5: dependencies: ms "^2.1.1" -debuglog@^1.0.1: +debuglog@*, debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI= @@ -9163,7 +9173,7 @@ import-local@^3.0.2: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" -imurmurhash@^0.1.4: +imurmurhash@*, imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= @@ -11002,6 +11012,11 @@ lodash._basecopy@^3.0.0: resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" integrity sha1-jaDmqHbPNEwK2KVIghEd08XHyjY= +lodash._baseindexof@*: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c" + integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw= + lodash._baseuniq@~4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8" @@ -11010,11 +11025,16 @@ lodash._baseuniq@~4.6.0: lodash._createset "~4.0.0" lodash._root "~3.0.0" -lodash._bindcallback@^3.0.0: +lodash._bindcallback@*, lodash._bindcallback@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e" integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4= +lodash._cacheindexof@*: + version "3.0.2" + resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92" + integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI= + lodash._createassigner@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz#838a5bae2fdaca63ac22dee8e19fa4e6d6970b11" @@ -11024,12 +11044,19 @@ lodash._createassigner@^3.0.0: lodash._isiterateecall "^3.0.0" lodash.restparam "^3.0.0" +lodash._createcache@*: + version "3.1.2" + resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093" + integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM= + dependencies: + lodash._getnative "^3.0.0" + lodash._createset@~4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY= -lodash._getnative@^3.0.0: +lodash._getnative@*, lodash._getnative@^3.0.0: version "3.9.1" resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U= @@ -11150,7 +11177,7 @@ lodash.memoize@4.x, lodash.memoize@^4.1.2: resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= -lodash.restparam@^3.0.0: +lodash.restparam@*, lodash.restparam@^3.0.0: version "3.6.1" resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU= @@ -12225,10 +12252,10 @@ npm-profile@^4.0.2, npm-profile@^4.0.4: figgy-pudding "^3.4.1" npm-registry-fetch "^4.0.0" -npm-registry-fetch@^4.0.0, npm-registry-fetch@^4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-4.0.4.tgz#2da1ecf3f43d419d96abf313664291a4623d3ea5" - integrity sha512-6jb34hX/iYNQebqWUHtU8YF6Cjb1H6ouTFPClYsyiW6lpFkljTpdeftm53rRojtja1rKAvKNIIiTS5Sjpw4wsA== +npm-registry-fetch@^4.0.0, npm-registry-fetch@^4.0.5: + version "4.0.5" + resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-4.0.5.tgz#cb87cf7f25bfb048d6c3ee19d115bebf93ea5bfa" + integrity sha512-yQ0/U4fYpCCqmueB2g8sc+89ckQ3eXpmU4+Yi2j5o/r0WkKvE2+Y0tK3DEILAtn2UaQTkjTHxIXe2/CSdit+/Q== dependencies: JSONStream "^1.3.4" bluebird "^3.5.1" @@ -12267,9 +12294,9 @@ npm-which@^3.0.1: which "^1.2.10" npm@^6.10.3: - version "6.14.5" - resolved "https://registry.yarnpkg.com/npm/-/npm-6.14.5.tgz#2cc59a3158cdd8461b486d0584c74ab554567219" - integrity sha512-CDwa3FJd0XJpKDbWCST484H+mCNjF26dPrU+xnREW+upR0UODjMEfXPl3bxWuAwZIX6c2ASg1plLO7jP8ehWeA== + version "6.14.6" + resolved "https://registry.yarnpkg.com/npm/-/npm-6.14.6.tgz#1a81ce1fac2bf5457dbf6342ceed503627ff228f" + integrity sha512-axnz6iHFK6WPE0js/+mRp+4IOwpHn5tJEw5KB6FiCU764zmffrhsYHbSHi2kKqNkRBt53XasXjngZfBD3FQzrQ== dependencies: JSONStream "^1.3.5" abbrev "~1.1.1" @@ -12289,6 +12316,7 @@ npm@^6.10.3: cmd-shim "^3.0.3" columnify "~1.5.4" config-chain "^1.1.12" + debuglog "*" detect-indent "~5.0.0" detect-newline "^2.1.0" dezalgo "~1.0.3" @@ -12303,6 +12331,7 @@ npm@^6.10.3: has-unicode "~2.0.1" hosted-git-info "^2.8.8" iferr "^1.0.2" + imurmurhash "*" infer-owner "^1.0.4" inflight "~1.0.6" inherits "^2.0.4" @@ -12321,8 +12350,14 @@ npm@^6.10.3: libnpx "^10.2.2" lock-verify "^2.1.0" lockfile "^1.0.4" + lodash._baseindexof "*" lodash._baseuniq "~4.6.0" + lodash._bindcallback "*" + lodash._cacheindexof "*" + lodash._createcache "*" + lodash._getnative "*" lodash.clonedeep "~4.5.0" + lodash.restparam "*" lodash.union "~4.6.0" lodash.uniq "~4.5.0" lodash.without "~4.4.0" @@ -12342,7 +12377,7 @@ npm@^6.10.3: npm-packlist "^1.4.8" npm-pick-manifest "^3.0.2" npm-profile "^4.0.4" - npm-registry-fetch "^4.0.4" + npm-registry-fetch "^4.0.5" npm-user-validate "~1.0.0" npmlog "~4.1.2" once "~1.4.0" From 8367375122175147e36a058b060cfcc0dfb1cd78 Mon Sep 17 00:00:00 2001 From: Randy Schott <1815175+schottra@users.noreply.github.com> Date: Wed, 15 Jul 2020 14:41:50 -0700 Subject: [PATCH 3/4] fix: show info message for un-launchable workflows (#84) * refactor: adding utility to help determine if an input type is supported * fix: adding detection and special rendering for unlaunchable workflows * fix: implementing error message for unlaunchable workflows * chore: docs * chore: pr feedback --- src/common/utils.ts | 17 ++++ .../LaunchWorkflowForm/LaunchWorkflowForm.tsx | 31 ++++--- .../UnsupportedRequiredInputsError.tsx | 62 +++++++++++++ .../LaunchWorkflowForm.stories.tsx | 8 ++ .../Launch/LaunchWorkflowForm/constants.ts | 4 + .../Launch/LaunchWorkflowForm/getInputs.ts | 5 +- .../inputHelpers/test/inputHelpers.test.ts | 22 +---- .../inputHelpers/test/testCases.ts | 18 ++++ .../inputHelpers/test/utils.test.ts | 51 +++++++++++ .../LaunchWorkflowForm/inputHelpers/utils.ts | 43 +++++++++- .../Launch/LaunchWorkflowForm/styles.ts | 1 - .../test/LaunchWorkflowForm.test.tsx | 86 ++++++++++++++++++- .../LaunchWorkflowForm/test/constants.ts | 2 + .../Launch/LaunchWorkflowForm/types.ts | 1 + .../useLaunchWorkflowFormState.ts | 7 ++ .../Launch/LaunchWorkflowForm/utils.ts | 22 ++++- 16 files changed, 345 insertions(+), 35 deletions(-) create mode 100644 src/components/Launch/LaunchWorkflowForm/UnsupportedRequiredInputsError.tsx create mode 100644 src/components/Launch/LaunchWorkflowForm/inputHelpers/test/utils.test.ts diff --git a/src/common/utils.ts b/src/common/utils.ts index cdf07cb5b..c637e21d1 100644 --- a/src/common/utils.ts +++ b/src/common/utils.ts @@ -99,3 +99,20 @@ export function sortedObjectKeys( ): ReturnType { return Object.keys(object).sort((a, b) => a.localeCompare(b)); } + +/** + * Helper function for exhaustive checks of discriminated unions. + * https://basarat.gitbooks.io/typescript/docs/types/discriminated-unions.html + */ +export function assertNever( + value: never, + { noThrow }: { noThrow?: boolean } = {} +): never { + if (noThrow) { + return value; + } + + throw new Error( + `Unhandled discriminated union member: ${JSON.stringify(value)}` + ); +} diff --git a/src/components/Launch/LaunchWorkflowForm/LaunchWorkflowForm.tsx b/src/components/Launch/LaunchWorkflowForm/LaunchWorkflowForm.tsx index 7d48ca917..9157d7983 100644 --- a/src/components/Launch/LaunchWorkflowForm/LaunchWorkflowForm.tsx +++ b/src/components/Launch/LaunchWorkflowForm/LaunchWorkflowForm.tsx @@ -16,12 +16,13 @@ import { workflowSortFields } from 'models'; import * as React from 'react'; -import { formStrings } from './constants'; +import { formStrings, unsupportedRequiredInputsString } from './constants'; import { InputValueCacheContext } from './inputValueCache'; import { LaunchWorkflowFormInputs } from './LaunchWorkflowFormInputs'; import { SearchableSelector } from './SearchableSelector'; import { useStyles } from './styles'; import { LaunchWorkflowFormProps } from './types'; +import { UnsupportedRequiredInputsError } from './UnsupportedRequiredInputsError'; import { useLaunchWorkflowFormState } from './useLaunchWorkflowFormState'; import { workflowsToSearchableSelectorOptions } from './utils'; @@ -67,6 +68,11 @@ export const LaunchWorkflowForm: React.FC = props => { state.onSubmit(); }; + const preventSubmit = + submissionState.loading || + !state.inputLoadingState.hasLoaded || + state.unsupportedRequiredInputs.length > 0; + return ( @@ -114,12 +120,18 @@ export const LaunchWorkflowForm: React.FC = props => { {...state.inputLoadingState} >
- + {state.unsupportedRequiredInputs.length > 0 ? ( + + ) : ( + + )}
) : null} @@ -143,10 +155,7 @@ export const LaunchWorkflowForm: React.FC = props => {