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

MTBLS assignment after validation #139

Open
wants to merge 15 commits into
base: development
Choose a base branch
from
Open
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 .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
variables:
APP_VERSION: "2.1.0"
APP_VERSION: "2.2.0"
workflow:
rules:
- if: $CI_COMMIT_BRANCH == "test" || $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "staging" || $CI_COMMIT_BRANCH == "development" || $CI_COMMIT_BRANCH == "migration"
Expand Down
17 changes: 11 additions & 6 deletions src/app/auth-guard.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ export class AuthGuard implements OnInit {
let obfuscationCode = null;
if (url.startsWith("/MTBLS")) {
studyIdentifier = url.split("/")[1];
} else if (url.startsWith("/study/MTBLS")) {
}if (url.startsWith("/REQ")) {
studyIdentifier = url.split("/")[1];
}else if (url.startsWith("/study/MTBLS")) {
studyIdentifier = url.split("/")[2];
}else if (url.startsWith("/study/REQ")) {
studyIdentifier = url.split("/")[2];
} else if (url.startsWith("/reviewer")) {
obfuscationCode = url.split("/")[1].replace("reviewer", "");
Expand Down Expand Up @@ -236,14 +240,15 @@ export class AuthGuard implements OnInit {
}

async checkStudyUrl(url: string, studyId: string, state: RouterStateSnapshot) {
const regEx = new RegExp('^(MTBLS[1-9][0-9]{0,10})($|\\?)', 'g');
const regEx = new RegExp('^((MTBLS[1-9][0-9]{0,10})|(REQ[0-9]{1,20}))($|\\?)', 'g');
const studyIdResults = studyId.match(regEx);
if (studyIdResults === null || studyIdResults.length === 0) {
this.editorService.redirectUrl = url;
const errorCode = "E-0001-003";
this.router.navigate(["/study-not-found"], { queryParams: { code: errorCode } });
return false;
this.editorService.redirectUrl = url;
const errorCode = "E-0001-003";
this.router.navigate(["/study-not-found"], { queryParams: { code: errorCode } });
return false;
}

let studyIdentifier = studyIdResults[0];
if (studyIdentifier.endsWith("?")) {
studyIdentifier = studyIdResults[0].slice(0, -1);
Expand Down
27 changes: 9 additions & 18 deletions src/app/components/guide/create/create.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
class="is-pulled-left"
src="{{ baseHref }}assets/img/MetaboLightsLogo.png"
/>
<span style="margin-left: 10px">New Study - Get started</span>
<span style="margin-left: 10px">New Submission - Get started</span>
</div>
<div class="panel-block">
<div class="column">
<h3>
The following steps will guide you through creating your
metabolomics study. Once submitted you can view and edit your
study through the MetaboLights website.
metabolomics study submission request. Once created you can view and edit your
submission through the MetaboLights website.
</h3>
<br />
<br />
Expand All @@ -27,7 +27,7 @@ <h3>
>
<div class="column">
<p class="has-text-centered">
<mat-icon>info</mat-icon> Once you create your study, you
<mat-icon>info</mat-icon> Once you create a request, you
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 change the wording here, as 'request' is a little unclear - "Once you create a provisonal study - denoted by the identifier REQ (for request)..."

can switch between the guided submission and full study view
where you see these buttons.
</p>
Expand Down Expand Up @@ -73,7 +73,7 @@ <h3>
src="{{ baseHref }}assets/img/MetaboLightsLogo.png"
/>
<span style="margin-left: 10px"
>New Study - Raw / Derived data files</span
>New Request - Raw / Derived data files</span
>
</div>
<div class="panel-block">
Expand Down Expand Up @@ -135,13 +135,12 @@ <h3>
class="is-pulled-left"
src="{{ baseHref }}assets/img/MetaboLightsLogo.png"
/>
<span style="margin-left: 10px">New Study - Identifier</span>
<span style="margin-left: 10px">New Request</span>
</div>
<div class="panel-block">
<div class="column">
<h3><b>MetaboLights study</b></h3>
<p>
Your study has been assigned the unique identifier
Your study request has been assigned wit an identifier
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, I would change the wording to something like provisional - 'creating a request is vague'- also need to correct spelling of 'wit'

<span class="has-text-link"
><b>{{ newStudy }}</b></span
>
Expand All @@ -152,17 +151,9 @@ <h3><b>MetaboLights study</b></h3>
<br />
<h3><b>How to reference your MetaboLights study</b></h3>
<p>
Please use {{ newStudy }} when referencing this study in
manuscripts etc. together with the URL
<a href="www.ebi.ac.uk/metabolights/{{ newStudy }}"
><b
><span class="has-text-link"
>www.ebi.ac.uk/metabolights/{{ newStudy }}</span
></b
></a
>
A MetaboLights accession number will be assigned to your study after you complete the submission. Please upload your dateset and complete the study metadata as soon as possible.
<br /><br />
<b>Please also cite the following MetaboLights paper</b> <br />
<b>While citing MetaboLights, please cite the following paper: </b> <br />
<a
target="_blank"
href="https://academic.oup.com/nar/advance-article/doi/10.1093/nar/gkad1045/7424432"
Expand Down
6 changes: 3 additions & 3 deletions src/app/components/guide/meta/meta.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ <h3 class="mb5">Do you have a manuscript?</h3>
</div>
<div class="panel-block">
<button
(click)="saveMetaData()"
(click)="saveMetadataNgxs()"
class="button is-success is-fullwidth"
>
<mat-spinner
Expand Down Expand Up @@ -269,7 +269,7 @@ <h3 class="mb5">Do you have a manuscript?</h3>
</span>
</div>
<div class="panel-block">
<button (click)="saveMetaData()" class="button is-success is-fullwidth">
<button (click)="saveMetadataNgxs()" class="button is-success is-fullwidth">
<mat-spinner
[diameter]="20"
[strokeWidth]="3"
Expand Down Expand Up @@ -334,7 +334,7 @@ <h3 class="mb5">Do you have a manuscript?</h3>
</span>
</div>
<div class="panel-block">
<button (click)="saveMetaData()" class="button is-success is-fullwidth">
<button (click)="saveMetadataNgxs()" class="button is-success is-fullwidth">
<mat-spinner
[diameter]="20"
[strokeWidth]="3"
Expand Down
6 changes: 3 additions & 3 deletions src/app/components/guide/meta/meta.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ export class MetaComponent implements OnInit {
skipMetaData() {
this.router.navigate(["/guide/assays", this.requestedStudy]);
}


saveMetadataNgxs() {
this.isLoading = true;
if (this.isManuscriptValid()) {
this.store.dispatch(new Title.Update(this.manuscript.title)).subscribe(
this.store.dispatch(new Title.Update({"title": this.manuscript.title})).subscribe(
(completed) => {
this.store.dispatch(new StudyAbstract.Update(this.manuscript.abstract)).subscribe(
(completed) => {
Expand Down Expand Up @@ -231,7 +231,7 @@ export class MetaComponent implements OnInit {
}
)
} else {
this.router.navigate(["/guides/assays", this.requestedStudy]);
this.router.navigate(["/guide/assays", this.requestedStudy]);
}
},
(error) => {
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/guide/progress/progress.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
</span>
</div>
<div class="step-details">
<p *ngIf="!study" class="step-title">Create Study</p>
<p *ngIf="!study" class="step-title">Create a Request</p>
<p *ngIf="study" class="step-title">
<a
[ngClass]="{ 'has-text-grey': step < 2 }"
(click)="redirectTo('info', null, 1)"
>
Study Created <br />
Request Created <br />
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, 'Request Created' is a little vague, especially for users who have used metabolights before (but if the team is happy with it then I'm happy)

{{ study }}</a
>
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/public/study/study.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export class PublicStudyComponent implements OnInit {
.split("/")
.filter((n) => n);
if (urlSplit.length >= 2) {
if (urlSplit[urlSplit.length - 1].indexOf("MTBLS") < 0) {
if (urlSplit[urlSplit.length - 1].indexOf("MTBLS") < 0 && urlSplit[urlSplit.length - 1].indexOf("REQ") < 0) {
urlSplit.pop();
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/components/shared/add-assay/add-assay.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ <h3 class="mb5">Define assay</h3>
<span
*ngIf="
selectedAssayTechnologyOption != null &&
selectedAssayTypeOption != null
selectedAssayTypeOption != null &&
selectedAssayVariantOption != null
"
>
<button (click)="addAssay()" class="button is-primary">
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/shared/ontology/ontology.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
/>
</mat-option>
</span>
<!--<ng-template #showMore>
<ng-template #showMore>
<mat-option><small>search more terms on ontology sources</small></mat-option>
</ng-template>-->
</ng-template>
</span>
<mat-option
class="bb"
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/shared/ontology/ontology.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class OntologyComponent implements OnInit, OnChanges {
if (values) {
let match = false;
this.values.forEach((ontology) => {
if (!match && ontology.annotationValue && ontology.annotationValue === value.annotationValue
if (!match && ontology && ontology.annotationValue && ontology.annotationValue === value.annotationValue
&& ontology.termAccession && ontology.termAccession === value.termAccession
&& ontology.termSource && ontology.termSource === value.termSource
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class AssayDetailsComponent implements OnInit {

});
this.studySamples$.subscribe((value) => {
if (value.data) {
if (value && value.data) {
this.sampleNames = value.data.rows.map((r) => r["Sample Name"]);
this.filteredSampleNames = this.sampleNames;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</div>
<div class="timeline-item">
<div class="timeline-marker is-image is-32x32">
<img src="https://bulma.io/images/placeholders/32x32.png" />
<img src="assets/img/file.png" />
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't call any asset simply 'file'

<div class="timeline-content">
<p class="heading">February 2016</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class RsyncStatusTransformPipe implements PipeTransform {
CALCULATION_FAILURE: 'Check failure',
NOT_FOUND: "No Task Found",
PENDING: 'Task is in Queue ...',
RUNNING: 'TAsk is running ...',
RUNNING: 'Task is running ...',
COMPLETED_SUCCESS: "Task completed. Sync Completed",
SYNC_FAILURE: "Sync failure",
START_FAILURE: "Start failure",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class ProtocolComponent implements OnInit, OnChanges {
});

this.readonly$.subscribe((value) => {
if (value !== null) {
if (value !== null && this.protocol) {
this.isStudyReadOnly = value;
if(!this.isStudyReadOnly) {
this.protocolGuides$.subscribe((value) => {
Expand Down Expand Up @@ -426,7 +426,7 @@ export class ProtocolComponent implements OnInit, OnChanges {
/**
* This is an extraordinary antipattern but don't have much of a choice,
* we can't change the components current protocol via the state without destroying
* the component that has the modal rendered.
* the component that has the modal rendered.
*/
this.protocolSubscription = this.store.select(ProtocolsState.specificProtocol(name))
.subscribe(
Expand All @@ -435,7 +435,7 @@ export class ProtocolComponent implements OnInit, OnChanges {
this.openModal(this.protocol);
}
)

}
toastr.success(message, "Success", this.toastrSettings)

Expand Down
24 changes: 16 additions & 8 deletions src/app/components/study/status/status.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
SimpleChanges,
} from "@angular/core";
import Swal from "sweetalert2";
import { ActivatedRoute } from "@angular/router";
import { ActivatedRoute, Router } from "@angular/router";
import { EditorService } from "../../../services/editor.service";
import * as toastr from "toastr";
import { environment } from "src/environments/environment";
Expand All @@ -19,6 +19,7 @@ import { ValidationState } from "src/app/ngxs-store/study/validation/validation.
import { ApplicationState } from "src/app/ngxs-store/non-study/application/application.state";
import { UserState } from "src/app/ngxs-store/non-study/user/user.state";
import { StudyStatus } from "src/app/ngxs-store/study/general-metadata/general-metadata.actions";
import { Loading, SetLoadingInfo } from "src/app/ngxs-store/non-study/transitions/transitions.actions";

@Component({
selector: "mtbls-status",
Expand Down Expand Up @@ -51,7 +52,8 @@ export class StatusComponent implements OnInit {
constructor(
private editorService: EditorService,
private route: ActivatedRoute,
private store: Store
private store: Store,
private router: Router,
) {
this.setUpSubscriptionsNgxs();
}
Expand All @@ -65,9 +67,16 @@ export class StatusComponent implements OnInit {
this.validation = value;
});
this.studyStatus$.subscribe((value) => {
this.closeModal();
this.store.dispatch(new Loading.Disable())
if (value !== null) {
const prevStatus = this.status
this.status = value;
this.toStatus = value;
if (prevStatus !== null && this.requestedStudy && this.status !== prevStatus) {
toastr.success("Study status updated.", "Success", this.toastrSettings);
this.router.navigate(["/study", this.requestedStudy]);
}
}
});
this.isCurator$.subscribe((value) => {
Expand Down Expand Up @@ -105,17 +114,16 @@ export class StatusComponent implements OnInit {
cancelButtonText: "Back",
}).then((willChange) => {
if (willChange.value) {

this.store.dispatch(new Loading.Enable())
this.store.dispatch(new SetLoadingInfo("Updating study status ..."))
this.closeModal();
this.store.dispatch(new StudyStatus.Update(toStatus)).subscribe(
(completed) => {
this.closeModal();
toastr.success("Study status updated.", "Success", this.toastrSettings);
let readonly = true;
if (this.curator) readonly = false;
if (toStatus === 'Submitted') readonly = false;
this.editorService.loadStudyNgxs(this.requestedStudy, false);

}, (error) => {
this.closeModal();
this.store.dispatch(new Loading.Disable())
this.toStatus = this.status;
let message = null;
typeof error.json === 'function' ? message = error.json().message : "Could not update study status."
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/study/study.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export class StudyComponent implements OnInit, OnDestroy {
.split("/")
.filter((n) => n);
if (urlSplit.length >= 3) {
if (urlSplit[urlSplit.length - 1].indexOf("MTBLS") < 0) {
if (urlSplit[urlSplit.length - 1].indexOf("MTBLS") < 0 && urlSplit[urlSplit.length - 1].indexOf("REQ") < 0) {
urlSplit.pop();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,21 @@ export class GeneralMetadataState {
const state = ctx.getState();
this.generalMetadataService.changeStatus(action.status, state.id).subscribe(
(response) => {
ctx.dispatch(new StudyStatus.Set(action.status));
const state = ctx.getState();
let updated_study_id = state.id;
if (response.hasOwnProperty("assigned_study_id")){
updated_study_id = response["assigned_study_id"]
if (state.id !== updated_study_id) {
ctx.dispatch(new Identifier.Set(updated_study_id));
}
}
let assigned_status = action.status;
if (response.hasOwnProperty("assigned_status")){
assigned_status = response["assigned_status"]
}
if (assigned_status !== state.status) {
ctx.dispatch(new StudyStatus.Set(assigned_status));
}
}
)
}
Expand Down
18 changes: 0 additions & 18 deletions src/assets/configs/validations.json
Original file line number Diff line number Diff line change
Expand Up @@ -2488,24 +2488,6 @@
]
}
]
},
{
"name": "Company/Institutional partner template",
"value": "template",
"color": "is-danger",
"disabled": false,
"techniques": [
{
"name": "Metabolon study",
"value": "metabolon",
"disabled": true
},
{
"name": "Imperial Phenome Center",
"value": "imperial",
"disabled": true
}
]
}
]
}
Expand Down
Loading