-
Notifications
You must be signed in to change notification settings - Fork 2
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
bugfix/empty-local-path #458
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,6 +77,7 @@ const NAS_HOST_PREFIXES: Record<Environment, string> = { | |
export interface FmsFile { | ||
annotations: FmsFileAnnotation[]; | ||
file_id?: string; | ||
file_local_path?: string | null; | ||
file_name?: string; | ||
file_path?: string; | ||
file_size?: number; | ||
|
@@ -92,16 +93,6 @@ export default class FileDetail { | |
private readonly env: Environment; | ||
private readonly uniqueId?: string; | ||
|
||
// REMOVE THIS FUNCITON (BACKWARDS COMPAT) | ||
public convertAicsDrivePathToAicsS3Path(path: string): string { | ||
const pathWithoutDrive = path.replace(NAS_HOST_PREFIXES[this.env], ""); | ||
// Should probably record this somewhere we can dynamically adjust to, or perhaps just in the file | ||
// document itself, alas for now this will do. | ||
return FileDetail.convertAicsS3PathToHttpUrl( | ||
`${AICS_FMS_S3_BUCKETS[this.env]}${pathWithoutDrive}` | ||
); | ||
} | ||
|
||
private static convertAicsS3PathToHttpUrl(path: string): string { | ||
return `${AICS_FMS_S3_URL_PREFIX}${path}`; | ||
} | ||
|
@@ -110,6 +101,7 @@ export default class FileDetail { | |
this.fileDetail = fileDetail; | ||
this.env = env; | ||
this.uniqueId = uniqueId; | ||
this.fileDetail.file_local_path = this.localPath; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we changing the inner |
||
} | ||
|
||
public get details() { | ||
|
@@ -157,23 +149,14 @@ export default class FileDetail { | |
} | ||
|
||
public get cloudPath(): string { | ||
//// REMOVE THIS (BACKWARDS COMPAT) | ||
if (this.path.startsWith("/allen")) { | ||
return this.convertAicsDrivePathToAicsS3Path(this.path); | ||
} | ||
//// | ||
|
||
// AICS FMS files' paths are cloud paths | ||
return this.path; | ||
} | ||
|
||
public get localPath(): string | null { | ||
//// REMOVE THIS (BACKWARDS COMPAT) | ||
if (this.path.startsWith("/allen")) { | ||
return this.path; | ||
if (this.downloadInProgress) { | ||
return "Copying to VAST in progress…"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this |
||
} | ||
//// | ||
|
||
if (this.getAnnotation("Cache Eviction Date")) { | ||
return this.getLocalPath(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we just move the body of the Like so:
|
||
} | ||
|
@@ -193,12 +176,6 @@ export default class FileDetail { | |
} | ||
|
||
public get downloadPath(): string { | ||
//// REMOVE THIS (BACKWARDS COMPAT) | ||
if (this.path.startsWith("/allen")) { | ||
return `http://aics.corp.alleninstitute.org/labkey/fmsfiles/image${this.path}`; | ||
} | ||
//// | ||
|
||
const localPath = this.getLocalPath(); | ||
// For AICS files that are available on the Vast, users can use the cloud path, but the | ||
// download will be faster and not incur egress fees if we download via the local network. | ||
|
@@ -211,7 +188,7 @@ export default class FileDetail { | |
|
||
public get downloadInProgress(): boolean { | ||
const shouldBeInLocal = this.getFirstAnnotationValue(AnnotationName.SHOULD_BE_IN_LOCAL); | ||
return Boolean(shouldBeInLocal) && !this.getLocalPath(); | ||
return Boolean(shouldBeInLocal) && !this.getAnnotation("Cache Eviction Date"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like now that it is used a couple places "Cache Eviction Date" should be added to |
||
} | ||
|
||
public get size(): number | undefined { | ||
|
@@ -239,9 +216,10 @@ export default class FileDetail { | |
public getFirstAnnotationValue(annotationName: string): string | number | boolean | undefined { | ||
return this.getAnnotation(annotationName)?.values[0]; | ||
} | ||
|
||
public getAnnotation(annotationName: string): FmsFileAnnotation | undefined { | ||
return this.fileDetail.annotations.find((annotation) => annotation.name === annotationName); | ||
return this.fileDetail.annotations?.find( | ||
(annotation) => annotation.name === annotationName | ||
); | ||
} | ||
|
||
public async getPathToThumbnail(): Promise<string | undefined> { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,7 @@ describe("DatabaseFileService", () => { | |
values: ["6"], | ||
}, | ||
], | ||
file_local_path: null, | ||
}); | ||
}); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the need for this? When does "File Path (Local VAST)" come into play?