-
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
Feature/metadata editing/restrict annotations #464
base: feature/metadata-editing/develop
Are you sure you want to change the base?
Feature/metadata editing/restrict annotations #464
Conversation
…-editing/restrict-annotations
@@ -18,16 +18,23 @@ import styles from "./EditMetadata.module.css"; | |||
// a more robust solution in the future such as login or a more secure method. | |||
// or find a way to get this information passed in via GH secrets to the packaged | |||
// web bundle | |||
// TODO: Actually lets try to request this from GH or something..? |
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.
TODO: Before merging - test putting this into a file we can request from the web or something at least to get it out of this level of hard-coded. (Maybe even labkey...)
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.
The intent is to update these password quarterly, right? So at least extracting them seems smart.
@@ -22,7 +23,7 @@ export const AnnotationTypeIdMap = { | |||
[AnnotationType.BOOLEAN]: 3, | |||
[AnnotationType.DATETIME]: 4, | |||
[AnnotationType.DROPDOWN]: 5, | |||
// [AnnotationType.LOOKUP]: 6, // Not currently supported | |||
[AnnotationType.LOOKUP]: 6, // Not currently supported |
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.
is this comment still valid?
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'm only partway through reviewing, just adding comments so far for now
@@ -16,6 +9,7 @@ import { interaction } from "../../state"; | |||
import { StatusUpdate, ProcessStatus } from "../../state/interaction/actions"; | |||
|
|||
import styles from "./StatusMessage.module.css"; | |||
import LoadingIcon from "../Icons/LoadingIcon"; |
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.
import order thing
@@ -81,6 +82,10 @@ export default class Annotation { | |||
return this.annotation.isOpenFileLink || false; | |||
} | |||
|
|||
public get isImmutable(): boolean { |
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.
wondering if would benefit from an explanatory comment here (e.g., that this is mainly to prevent editing on certain top level annotations)
@@ -136,7 +136,7 @@ export default (filters?: FileFilter[], onDismiss?: () => void) => { | |||
], | |||
}, | |||
}, | |||
...(isQueryingAicsFms | |||
...(isQueryingAicsFms && isOnWeb |
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.
are we preventing editing on desktop?
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.
Yea I was originally but I think I'll add it back and use LK or something to grab the passwords - I just didn't want the desktop to be a relic holding stale passwords
"Cell Line R And D", | ||
"Cell Line Source", | ||
"Cell Population Id", | ||
, |
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.
extra comma?
@@ -102,6 +102,9 @@ export default class HttpFileService extends HttpServiceBase implements FileServ | |||
public async getFiles(request: GetFilesRequest): Promise<FileDetail[]> { | |||
const { from, limit, fileSet } = request; | |||
|
|||
if (limit - from > 1000) { | |||
throw new Error("uhh" + limit + " " + from); |
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.
still needed?
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.
lol
filesSelected = await fileSet.fetchFileRange(0, totalFileCount); | ||
} else { | ||
filesSelected = await fileSelection.fetchAllDetails(); | ||
console.log("non-filters", filesSelected.length); |
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.
still needed?
invertColor?: boolean; | ||
size?: SpinnerSize; | ||
|
||
"data-testid"?: string; |
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.
what is this for?
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.
This is a prop used by the testing components - generally we don't need to explicitly define it like this but in this case we do
infoMessage = ( | ||
<p className={styles.errorMessage}> | ||
The files you have selected do not share the same program or do not have a program | ||
at all. |
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.
"program at all" feels a little weird. maybe "program metadata tag"
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.
Looks good!! I couldn't fully test locally but tried out the pre-submit behavior and things work as expected
key: annotation.name, | ||
text: annotation.displayName, | ||
disabled: annotation.isImmutable, | ||
title: annotation.isImmutable |
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'm not seeing this tooltip show up for some reason
text: annotation.displayName, | ||
disabled: annotation.isImmutable, | ||
title: annotation.isImmutable | ||
? "This field cannot be edited because it is automatically created based on some heuristic" |
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.
unsure if wording of "based on some heuristic" is clear but I don't have a suggested alternative
// If it's a dropdown, we need to fetch the dropdown options | ||
if (option?.data === AnnotationType.STRING) { | ||
annotationService | ||
.fetchAnnotationDetails(selectedFieldName) |
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.
Is this likely to ever take long (i.e., any chance we'd need a loading indicator on the UI side?)
@@ -0,0 +1,79 @@ | |||
.error-message { | |||
background-color: rgba(194, 48, 48, 0.5); |
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.
there are also the global variables --error-status-background-color
and --error-status-text-color
which are what we use for backgrounds/borders in the status messages
<> | ||
<p> | ||
A password is required for editing or creating new metadata. Each password is | ||
specific to a program, only files associated with that program can be edited. |
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.
tiny nit: program; instead of program,
also in line 65
Changes
Anya added a ton of metadata editing logic this is the last piece which just adds a password modal auth before the actual edit modal and also restricts some of the annotations by hard coding some locked down ones. Resolves #341 & resolves #343.
Additionally:
main
but because this is merged into a different branch it shows as a diff)Testing
Tested locally against staging and production (staging seems to recently have gotten a data change though making it difficult to test with)
TODO