Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: artifact table updates #7

Merged
merged 4 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pages/Task/__tests__/ArtifactTable.test.cypress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ describe('ArtifactTable', () => {
gid('select-field').eq(0).click()
cy.get('button').contains('Python').click()
gid('modal-container')
gid('modal-content').contains("Task('LogTestFlow/968832/loglines/33632798')['FirstArtifact'].data")
gid('modal-content').contains("Task('LogTestFlow/968832/loglines/33632798', attempt=0)['FirstArtifact'].data")
});
});
12 changes: 7 additions & 5 deletions src/pages/Task/components/ArtifactTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function getErrorString(str: string): string {
// Location Renderer
//

type ValidLinkVariant = 'raw' | 'python' | 'r';
type ValidLinkVariant = 'python' | 'r';

type LocationRendererProps = {
item: Artifact;
Expand All @@ -131,7 +131,6 @@ const LocationRenderer: React.FC<LocationRendererProps> = ({ item, onSelect }) =
options={[
['python', 'Python'],
['r', 'R'],
['raw', 'Raw url'],
]}
optionsAlignment="right"
/>
Expand Down Expand Up @@ -184,11 +183,14 @@ const LinkPopup: React.FC<{ link: PopupLink | null; onClose: () => void }> = ({
// Keeping code snippet in object for now since we might to add separate snippets for different situations.
const codeByType = {
any: {
raw: (artifact: Artifact) => artifact.location,
python: (artifact: Artifact) =>
`Task('${artifact.flow_id}/${artifact.run_number}/${artifact.step_name}/${artifact.task_id}')['${artifact.name}'].data`,
`Task('${artifact.flow_id}/${artifact.run_id || artifact.run_number}/${artifact.step_name}/${
artifact.task_name || artifact.task_id
}'${typeof artifact.attempt_id === 'number' ? `, attempt=${artifact.attempt_id}` : ''})['${artifact.name}'].data`,
r: (artifact: Artifact) =>
`flow$new("${artifact.flow_id}")$run("${artifact.run_number}")$step("${artifact.step_name}")$task("${artifact.task_id}")$artifact("${artifact.name}")$${artifact.name}`,
`flow$new("${artifact.flow_id}")$run("${artifact.run_id || artifact.run_number}")$step("${
artifact.step_name
}")$task("${artifact.task_name || artifact.task_id}")$artifact("${artifact.name}")$${artifact.name}`,
},
};

Expand Down
2 changes: 1 addition & 1 deletion src/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ const en = {
'task-error':
'Task page encountered an unexpected error. This should not happen and might be caused by unexpected data.',

'artifact-too-large': 'File too large to display. Only available as download from location.',
'artifact-too-large': 'File too large to display, use the client to access this object.',
'artifact-not-accessible': 'Artifact location is not accessible by the server.',
'artifact-handle-failed': 'Reading the artifact content failed.',
'artifact-unknown-error': 'Unexpected error happened while loading artifacts.',
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ export interface Metadata extends MetaDataBaseObject {

export interface Artifact extends MetaDataBaseObject {
run_number: number;
run_id?: string;
step_name: string;
task_id: number;
task_name?: string;
name: string;
location: string;
ds_type: string;
Expand Down