-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: show full millisecond values for subsecond durations (#81) * 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](npm/cli@v6.14.5...v6.14.6) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * 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 * feat: Enables support for Blobs on the Launch form (#86) * refactor: adds scaffolding for blob input support * fix: add controls and processing for blob fields * fix: support using string values for dimensionality in collections * fix: more info so validators can check subfields * test: tests for blob input helper * test: remaining tests for blobs * chore: cleanup * refactor: adding some type guards * test: fixing some test cases Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
bed1b81
commit 65f2a81
Showing
36 changed files
with
1,103 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
import { | ||
FormControl, | ||
FormHelperText, | ||
InputLabel, | ||
MenuItem, | ||
Select, | ||
TextField, | ||
Typography | ||
} from '@material-ui/core'; | ||
import { makeStyles, Theme } from '@material-ui/core/styles'; | ||
import { BlobDimensionality } from 'models'; | ||
import * as React from 'react'; | ||
import { | ||
blobFormatHelperText, | ||
blobUriHelperText, | ||
defaultBlobValue | ||
} from './constants'; | ||
import { InputProps } from './types'; | ||
import { getLaunchInputId, isBlobValue } from './utils'; | ||
|
||
const useStyles = makeStyles((theme: Theme) => ({ | ||
dimensionalityInput: { | ||
flex: '1 1 auto', | ||
marginLeft: theme.spacing(2) | ||
}, | ||
formatInput: { | ||
flex: '1 1 auto' | ||
}, | ||
inputContainer: { | ||
borderLeft: `1px solid ${theme.palette.divider}`, | ||
marginTop: theme.spacing(1), | ||
paddingLeft: theme.spacing(1) | ||
}, | ||
metadataContainer: { | ||
display: 'flex', | ||
marginTop: theme.spacing(1), | ||
width: '100%' | ||
} | ||
})); | ||
|
||
/** A micro form for entering the values related to a Blob Literal */ | ||
export const BlobInput: React.FC<InputProps> = props => { | ||
const styles = useStyles(); | ||
const { error, label, name, onChange, value: propValue } = props; | ||
const blobValue = isBlobValue(propValue) ? propValue : defaultBlobValue; | ||
const hasError = !!error; | ||
const helperText = hasError ? error : props.helperText; | ||
|
||
const handleUriChange = ({ | ||
target: { value: uri } | ||
}: React.ChangeEvent<HTMLInputElement>) => { | ||
onChange({ | ||
...blobValue, | ||
uri | ||
}); | ||
}; | ||
|
||
const handleFormatChange = ({ | ||
target: { value: format } | ||
}: React.ChangeEvent<HTMLInputElement>) => { | ||
onChange({ | ||
...blobValue, | ||
format | ||
}); | ||
}; | ||
|
||
const handleDimensionalityChange = ({ | ||
target: { value } | ||
}: React.ChangeEvent<{ value: unknown }>) => { | ||
onChange({ | ||
...blobValue, | ||
dimensionality: value as BlobDimensionality | ||
}); | ||
}; | ||
|
||
const selectId = getLaunchInputId(`${name}-select`); | ||
|
||
return ( | ||
<div> | ||
<Typography variant="body1" component="label"> | ||
{label} | ||
</Typography> | ||
<FormHelperText error={hasError}>{helperText}</FormHelperText> | ||
<div className={styles.inputContainer}> | ||
<TextField | ||
id={getLaunchInputId(`${name}-uri`)} | ||
helperText={blobUriHelperText} | ||
fullWidth={true} | ||
label="uri" | ||
onChange={handleUriChange} | ||
value={blobValue.uri} | ||
variant="outlined" | ||
/> | ||
<div className={styles.metadataContainer}> | ||
<TextField | ||
className={styles.formatInput} | ||
id={getLaunchInputId(`${name}-format`)} | ||
helperText={blobFormatHelperText} | ||
label="format" | ||
onChange={handleFormatChange} | ||
value={blobValue.format} | ||
variant="outlined" | ||
/> | ||
<FormControl className={styles.dimensionalityInput}> | ||
<InputLabel id={`${selectId}-label`}> | ||
Dimensionality | ||
</InputLabel> | ||
<Select | ||
labelId={`${selectId}-label`} | ||
id={selectId} | ||
value={blobValue.dimensionality} | ||
onChange={handleDimensionalityChange} | ||
> | ||
<MenuItem value={BlobDimensionality.SINGLE}> | ||
Single (File) | ||
</MenuItem> | ||
<MenuItem value={BlobDimensionality.MULTIPART}> | ||
Multipart (Directory) | ||
</MenuItem> | ||
</Select> | ||
</FormControl> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/components/Launch/LaunchWorkflowForm/UnsupportedRequiredInputsError.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { makeStyles, Theme } from '@material-ui/core/styles'; | ||
import ErrorOutline from '@material-ui/icons/ErrorOutline'; | ||
import { NonIdealState } from 'components/common'; | ||
import { useCommonStyles } from 'components/common/styles'; | ||
import * as React from 'react'; | ||
import { | ||
cannotLaunchWorkflowString, | ||
requiredInputSuffix, | ||
unsupportedRequiredInputsString | ||
} from './constants'; | ||
import { ParsedInput } from './types'; | ||
|
||
const useStyles = makeStyles((theme: Theme) => ({ | ||
contentContainer: { | ||
whiteSpace: 'pre-line', | ||
textAlign: 'left' | ||
}, | ||
errorContainer: { | ||
marginBottom: theme.spacing(2) | ||
} | ||
})); | ||
|
||
function formatLabel(label: string) { | ||
return label.endsWith(requiredInputSuffix) | ||
? label.substring(0, label.length - 1) | ||
: label; | ||
} | ||
|
||
export interface UnsupportedRequiredInputsErrorProps { | ||
inputs: ParsedInput[]; | ||
} | ||
/** An informational error to be shown if a Workflow cannot be launch due to | ||
* required inputs for which we will not be able to provide a value. | ||
*/ | ||
export const UnsupportedRequiredInputsError: React.FC<UnsupportedRequiredInputsErrorProps> = ({ | ||
inputs | ||
}) => { | ||
const styles = useStyles(); | ||
const commonStyles = useCommonStyles(); | ||
return ( | ||
<NonIdealState | ||
className={styles.errorContainer} | ||
icon={ErrorOutline} | ||
size="medium" | ||
title={cannotLaunchWorkflowString} | ||
> | ||
<div className={styles.contentContainer}> | ||
<p>{unsupportedRequiredInputsString}</p> | ||
<ul className={commonStyles.listUnstyled}> | ||
{inputs.map(input => ( | ||
<li | ||
key={input.name} | ||
className={commonStyles.textMonospace} | ||
> | ||
{formatLabel(input.label)} | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
</NonIdealState> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/components/Launch/LaunchWorkflowForm/__mocks__/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
import { Core } from 'flyteidl'; | ||
import { BlobDimensionality } from 'models'; | ||
|
||
export function primitiveLiteral(primitive: Core.IPrimitive): Core.ILiteral { | ||
return { scalar: { primitive } }; | ||
} | ||
|
||
export function blobLiteral({ | ||
uri, | ||
format, | ||
dimensionality | ||
}: { | ||
uri?: string; | ||
format?: string; | ||
dimensionality?: BlobDimensionality; | ||
}): Core.ILiteral { | ||
return { | ||
scalar: { | ||
blob: { uri, metadata: { type: { format, dimensionality } } } | ||
} | ||
}; | ||
} |
Oops, something went wrong.