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

Add readOnly in curation page #481

Open
wants to merge 4 commits into
base: rc
Choose a base branch
from
Open

Conversation

gebbing12
Copy link

@gebbing12 gebbing12 commented Nov 27, 2024

@gebbing12 gebbing12 requested review from jfkonecn and removed request for jfkonecn November 27, 2024 17:48
@jfkonecn jfkonecn requested a review from calvinlu3 November 27, 2024 18:10
Copy link
Contributor

@calvinlu3 calvinlu3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the changes!

Would you also try adding a banner to the curation page that alerts the user that the page is currently in read only mode?
Some text along the lines of "This page is currently in read-only mode because ___ user is currently reviewing"

@@ -13,9 +13,16 @@ import { Button } from 'reactstrap';
export interface IRCTButtonProps extends StoreProps {
cancerTypePath: string;
relevantCancerTypesInfoPath: string; // path to dx, px, or tx
readOnly?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to define the readOnly property here because it will come from StoreProp type.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the readOnly property to RCTButton because I thought this component might be used in multiple places simultaneously. If it’s only used in CurationPage, I’ll remove this line and use StoreProp instead.

@@ -204,19 +211,21 @@ function CancerTypeCollapsible({
action={
<>
<CommentIcon id={`${cancerTypesUuid}_diagnostic_comments`} path={`${cancerTypePath}/diagnostic_comments`} />
<RCTButton cancerTypePath={cancerTypePath} relevantCancerTypesInfoPath={`${cancerTypePath}/diagnostic`} />
<RCTButton cancerTypePath={cancerTypePath} relevantCancerTypesInfoPath={`${cancerTypePath}/diagnostic`} readOnly={readOnly} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing in the readOnly props explicitly is not required because it will be injected by mobx.

@gebbing12
Copy link
Author

gebbing12 commented Dec 4, 2024

Thanks for making the changes!

Would you also try adding a banner to the curation page that alerts the user that the page is currently in read only mode? Some text along the lines of "This page is currently in read-only mode because ___ user is currently reviewing"

I have added a banner to the top of the page. Please let me know if there are any improvements needed for the text or style.
691733353841_ pic

@gebbing12 gebbing12 requested a review from calvinlu3 December 5, 2024 20:26
@calvinlu3
Copy link
Contributor

I have added a banner to the top of the page. Please let me know if there are any improvements needed for the text or style. 691733353841_ pic

Let's get rid of the "x" button - the alert should not be dismissible.
Also move the alert under the GeneticTypeTabs because the user should be able to edit the germline if somatic is in review (and vice versa).
image

@gebbing12
Copy link
Author

I have added a banner to the top of the page. Please let me know if there are any improvements needed for the text or style. 691733353841_ pic

Let's get rid of the "x" button - the alert should not be dismissible. Also move the alert under the GeneticTypeTabs because the user should be able to edit the germline if somatic is in review (and vice versa). image

I have added a banner to the top of the page. Please let me know if there are any improvements needed for the text or style. 691733353841_ pic

Let's get rid of the "x" button - the alert should not be dismissible. Also move the alert under the GeneticTypeTabs because the user should be able to edit the germline if somatic is in review (and vice versa). image

Update of banner
WeChatcbf7a0093376990bca3ecb126bdd317a

Comment on lines 32 to 35
<span>
{isGermline ? 'This Germline ' : 'This Somatic '}
is currently in read only mode because {meta.review.currentReviewer} is currently reviewing.
</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe The germline section is current in read only mode because {meta.review.currentReviewer} is currently reviewing.

Copy link
Contributor

@calvinlu3 calvinlu3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, just some minor comments. Thanks!

@@ -86,6 +88,11 @@ export const CurationPage = (props: ICurationPageProps) => {
}
if (geneEntity && props.firebaseInitSuccess) {
const cleanupCallbacks: Unsubscribe[] = [];
cleanupCallbacks.push(
onValue(ref(props.firebaseDb, firebaseMetaCurrentReviewerPath), snapshot => {
props.setReadOnly(snapshot.val() ? true : false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can keep it concise using double negation

Suggested change
props.setReadOnly(snapshot.val() ? true : false);
props.setReadOnly(!!snapshot.val());

@@ -7,9 +7,11 @@ const AddMutationButton: React.FunctionComponent<{
onClickHandler: (show: boolean) => void;
showIcon?: boolean;
showFullTitle?: boolean;
}> = ({ showAddMutationModal, onClickHandler, showIcon = true, showFullTitle = false }) => {
disabled?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep it consistent with the RCTButton and just inject the CurationPage store into AddMutationButton and use the readOnly property for disabled. Same end result, but one less prop to pass in.

const ReadOnlyBanner = ({ isGermline, hugoSymbol, firebaseDb }: IReadOnlyBanner) => {
const firebaseMetaPath = getFirebaseMetaGenePath(isGermline, hugoSymbol);
const [meta, setMeta] = useState<Meta>();
const [isVisible, setIsVisible] = useState(true);
Copy link
Contributor

@calvinlu3 calvinlu3 Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like isVisible is not needed anymore because we always display the banner.

@@ -133,6 +137,10 @@ export class CurationPageStore {
.filter(query => query.queryId && this.annotatedAltsCache.cache[query.queryId] && this.annotatedAltsCache.cache[query.queryId].result)
.map(query => (query.queryId !== undefined ? this.annotatedAltsCache.cache[query.queryId].result : undefined));
}

setReadOnly(isAnotherUserReviewing: boolean) {
this.readOnly = isAnotherUserReviewing ? true : false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already a boolean value, can just set as is.

Suggested change
this.readOnly = isAnotherUserReviewing ? true : false;
this.readOnly = isAnotherUserReviewing;

@calvinlu3 calvinlu3 added the feature Feature tag for release label Dec 24, 2024
}

const ReadOnlyBanner = ({ isGermline, hugoSymbol, firebaseDb }: IReadOnlyBanner) => {
const firebaseMetaPath = getFirebaseMetaGenePath(isGermline, hugoSymbol);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put this inside the useEffect and add isGermline and hugoSymbol to the dependency array.
If the path changes you'd would want the useEffect to be called again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature tag for release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants