Commit 81fd802f authored by Rajkumar-D's avatar Rajkumar-D
Browse files

Adding EGA Dac related changes

parent 94d30e83
......@@ -64,6 +64,7 @@ import { NonSubmissionResultDialogComponent } from './non-submission-result-dial
import { AceEditorModule } from 'ng2-ace-editor';
import { DacManagementComponent } from './dac-management/dac-management.component';
import { DacPolicyManagementComponent } from './dac-policy-management/dac-policy-management.component';
import { DacDatasetManagementComponent } from './dac-dataset-management/dac-dataset-management.component';
const appRoutes: Routes = [
......@@ -113,6 +114,7 @@ const appRoutes: Routes = [
path: 'app-checklist/:checklistType/:init',
component: ChecklistComponent,
canActivate: [WebinAuthenticationGuardService],
},
{
path: 'account',
......@@ -125,30 +127,52 @@ const appRoutes: Routes = [
{
path: 'study',
component: StudyManagementComponent,
canActivate: [WebinAuthenticationGuardService],
},
{
path: 'study/:id',
component: StudyManagementComponent,
canActivate: [WebinAuthenticationGuardService],
},
{
path: 'read-submission',
component: ReadSubmissionComponent,
canActivate: [WebinAuthenticationGuardService],
},
{
path: 'taxonomy',
component: TaxonomyManagementComponent,
canActivate: [WebinAuthenticationGuardService],
},
{
path: 'dac',
component: DacManagementComponent,
canActivate: [WebinAuthenticationGuardService],
},
{
path: 'dac/:id',
component: DacManagementComponent,
canActivate: [WebinAuthenticationGuardService],
},
{
path: 'dac-policy',
component: DacPolicyManagementComponent,
canActivate: [WebinAuthenticationGuardService],
},
{
path: 'dac-policy/:id',
component: DacPolicyManagementComponent,
canActivate: [WebinAuthenticationGuardService],
},
{
path: 'dac-dataset',
component: DacDatasetManagementComponent,
canActivate: [WebinAuthenticationGuardService],
},
{
path: 'dac-dataset/:id',
component: DacDatasetManagementComponent,
canActivate: [WebinAuthenticationGuardService],
},
{
path: '**',
......@@ -211,6 +235,7 @@ const appRoutes: Routes = [
NonSubmissionResultDialogComponent,
DacManagementComponent,
DacPolicyManagementComponent,
DacDatasetManagementComponent,
],
......
......@@ -147,10 +147,10 @@
</mat-expansion-panel-header>
<div *ngFor="let field of fieldGroup.fields">
<mat-checkbox class="checklist-checked-field" [(ngModel)]="selectedFields[field.label]"
[disabled]="mandatoryFields[field.label]"><b class="checklist-checked-field">{{
field.label
}}</b>
<mat-checkbox [(ngModel)]="selectedFields[field.label]" [disabled]="mandatoryFields[field.label]">
{{
field.label
}}
</mat-checkbox>
<p fxHide fxShow.gt-sm>
<i>{{ field.mandatory }}
......
......@@ -48,10 +48,10 @@
<mat-form-field>
<input matInput name="name" [(ngModel)]="contactObj.name" placeholder="Name" required>
</mat-form-field>
<mat-form-field>
<!--<mat-form-field>
<input matInput name="telephone" [(ngModel)]="contactObj.telephone" placeholder="Telephone number"
required>
</mat-form-field>
</mat-form-field>-->
<mat-form-field>
<input matInput name="organization" [(ngModel)]="contactObj.organization" placeholder="Organization"
required>
......
.body{
padding:10px 20px 10px 10px;
}
.container{
padding: 10px 0px 0px 0px;
}
.mat-row:nth-child(even){
background-color:#f8f8f8;
}
.column {
float: left;
width: 50%;
}
.mat-header-cell{
font-weight: bold;
font-size: 14px;
color: #000000c7;
}
mat-form-field {
width: 100%;
}
mat-card{
margin:10px;
}
mat-form-field.mat-form-field {
font-size: 14px;
font-family: Roboto;
}
mat-icon {
cursor: pointer;
}
.mat-radio-button ~ .mat-radio-button {
margin-left: 16px;
}
\ No newline at end of file
<form (ngSubmit)="submitDacDataset(f)" #f="ngForm">
<div class="body">
<div>
<div class="mat-h3 mat-tittle">Register Dataset</div>
</div>
<mat-divider></mat-divider>
<div class="container">
<mat-card>
<mat-vertical-stepper #stepper>
<mat-step label="Select an existing policy" *ngIf="action!='Edit'">
<app-report (selectedRecord)="getSelectedPolicy($event,stepper)"
[reportType]="ReportType.policies" [embDefaultSearch]="true" [embeded]="true">
</app-report>
<input type="hidden" name="policyRef" [(ngModel)]="selectedDacPolicyId" />
</mat-step>
<mat-step label="Submit dataset">
<div class="row">
<div class="column">
<mat-form-field class="app-field-padding">
<input matInput placeholder="Short descriptive title for the dataset" required
[(ngModel)]="title" name="title" />
</mat-form-field>
<mat-form-field>
<textarea matInput rows="3" [(ngModel)]="accessions" name="accessions"
placeholder="Accessions of the runs and/or analysis to be associated with this dataset. e.g. EGAR00001nnnnnn, EGAZ00001nnnnnn)"
required></textarea>
</mat-form-field>
</div>
<div class="column">
<mat-form-field>
<textarea matInput rows="3" [(ngModel)]="description" name="description"
placeholder="Description for the dataset" required></textarea>
</mat-form-field>
</div>
</div>
<div class="row">
<mat-card style="display:flow-root">
<mat-card-subtitle>Dataset type</mat-card-subtitle>
<div class="column">
<div *ngFor="let type of datasetTypes1">
<mat-checkbox matInput [checked]="typeArr.indexOf(type)>=0"
(change)="typeSelected($event,type)">
{{type}}
</mat-checkbox>
</div>
</div>
<div class="column">
<div sty1e="float:left;width:50%" *ngFor="let type of datasetTypes2">
<mat-checkbox matInput [checked]="typeArr.indexOf(type)>=0"
(change)="typeSelected($event,type)">
{{type}}
</mat-checkbox>
</div>
</div>
</mat-card>
</div>
<div style="text-align:Center">
<button mat-raised-button color="accent" [disabled]="f.invalid">Save</button>
<button *ngIf="action==='Edit'" mat-raised-button style="margin-left: 5px;"
[routerLink]="['/report',ReportType.datasets,{defaultSearch: true}]">Cancel</button>
<button *ngIf="action!='Edit'" mat-raised-button style="margin-left: 5px;"
routerLink="">Cancel</button>
</div>
</mat-step>
</mat-vertical-stepper>
</mat-card>
</div>
</div>
<div class="centred" *ngIf="showLoadingFlag" style="height:70px;">
<mat-spinner [diameter]="50" [strokeWidth]="5" style="margin:0 auto;">
</mat-spinner>
</div>
</form>
\ No newline at end of file
import { Component, OnInit } from '@angular/core';
import { MatDialog, MatStepper } from '@angular/material';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs';
import { ReportType } from '../report-type.enum';
import { SubmissionResultDialogComponent } from '../submission-result-dialog/submission-result-dialog.component';
import { UtilService } from '../util/Util-services';
import { XmlService } from '../util/xml.service';
@Component({
selector: 'app-dac-dataset-management',
templateUrl: './dac-dataset-management.component.html',
styleUrls: ['./dac-dataset-management.component.css']
})
export class DacDatasetManagementComponent implements OnInit {
constructor(private xmlUtil: XmlService,
private util: UtilService,
public dialog: MatDialog,
private activatedRoute: ActivatedRoute,) { }
ReportType = ReportType;
selectedDacPolicyId: string;
action: string;
id: string;
showLoadingFlag = false;
xmlString: string;
title: string;
description: string;
accessions: string;
typeArr = [];
refArr = [];
selectedTypeArr = [];
ngOnInit() {
this.id = this.activatedRoute.snapshot.params.id;
if (this.id) {
this.action = "Edit";
this.initEdit(this.id);
}
}
getSelectedPolicy(reportObj: object, stepper: MatStepper) {
this.selectedDacPolicyId = reportObj["id"];
stepper.next();
}
submitDacDataset(form) {
var observable: Observable<string>;
let redirectPath = "";
this.accessions = this.accessions.replace(/\s/g, '');
this.refArr = this.accessions.split(",").filter(val => val != "").sort();
if (this.action != "Edit") {
observable = this.xmlUtil.generateDacDatasetXml(
form.value,
this.typeArr,
this.refArr
);
} else {
observable = this.xmlUtil.updateDacDatasetXml(
this.xmlString,
form.value,
this.typeArr,
this.refArr
);
redirectPath = null;
}
this.util.showSubmissionResponse(
this,
SubmissionResultDialogComponent,
observable,
redirectPath
);
}
initEdit(id) {
this.showLoading();
this.util.getDacDatasetXml(id).subscribe((xmlString: any) => {
this.xmlString = xmlString;
this.setPageValuesfromXml();
});
}
showLoading() {
this.showLoadingFlag = true;
}
hideLoading() {
this.showLoadingFlag = false;
}
setPageValuesfromXml() {
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(this.xmlString, "text/xml");
this.title = xmlDoc.getElementsByTagName("TITLE")[0].childNodes[0].nodeValue;
this.description = xmlDoc.getElementsByTagName("DESCRIPTION")[0].childNodes[0].nodeValue;
this.getAndSetAccession(xmlDoc);
this.setDatasetType(xmlDoc);
this.hideLoading();
}
typeSelected(event, type) {
if (event.checked) {
if (this.typeArr.indexOf(type) === -1) {
this.typeArr.push(type);
}
} else {
this.typeArr.splice(this.typeArr.indexOf(type), 1);
}
}
getAndSetAccession(xmlDoc) {
let accessionArr = [];
let runRef = xmlDoc.getElementsByTagName("RUN_REF");
let analysisRef = xmlDoc.getElementsByTagName("ANALYSIS_REF");
for (var i = 0; i < runRef.length; i++) {
accessionArr.push(runRef[i].getAttribute("accession"));
}
for (var i = 0; i < analysisRef.length; i++) {
accessionArr.push(analysisRef[i].getAttribute("accession"));
}
this.accessions = accessionArr.join(",");
}
setDatasetType(xmlDoc) {
let datasetType = xmlDoc.getElementsByTagName("DATASET_TYPE");
for (var i = 0; i < datasetType.length; i++) {
if (this.typeArr.indexOf(datasetType[i].childNodes[0].nodeValue) < 0) {
this.typeArr.push(datasetType[i].childNodes[0].nodeValue);
}
}
}
datasetTypes1 = ["Whole genome sequencing", "Exome sequencing",
"Genotyping by array", "Transcriptome profiling by high-throughput sequencing",
"Transcriptome profiling by array",
"Amplicon sequencing",
"Methylation binding domain sequencing"
]
datasetTypes2 = ["Methylation profiling by high-throughput sequencing",
"Phenotype information", "Study summary information",
"Genomic variant calling", "Chromatin accessibility profiling by high-throughput sequencing", "Histone modification profiling by high-throughput sequencing", "Chip-Seq"
]
}
......@@ -7,7 +7,7 @@
<div class="container">
<mat-card>
<mat-card-subtitle>DAC Details</mat-card-subtitle>
<div style="width: 100%;">
<div style="width: 50%;">
<mat-form-field class="app-field-padding">
<textarea rows="3" matInput placeholder="Short descriptive title for the DAC" required
[(ngModel)]="title" name="title"></textarea>
......@@ -32,12 +32,12 @@
</td>
</ng-container>
<ng-container matColumnDef="telephone">
<!--<ng-container matColumnDef="telephone">
<th mat-header-cell *matHeaderCellDef>Telephone</th>
<td mat-cell *matCellDef="let element">
{{ element.telephone }}
</td>
</ng-container>
</ng-container>-->
<ng-container matColumnDef="organization">
<th mat-header-cell *matHeaderCellDef>Organization</th>
......@@ -67,7 +67,7 @@
<button mat-raised-button color="accent"
[disabled]="f.invalid || contactArray.length < 1">Save</button>
<button *ngIf="action==='Edit'" mat-raised-button style="margin-left: 5px;"
routerLink="/report/studies">Cancel</button>
[routerLink]="['/report',ReportType.dacs,{defaultSearch: true}]">Cancel</button>
<button *ngIf="action!='Edit'" mat-raised-button style="margin-left: 5px;"
routerLink="">Cancel</button>
</div>
......@@ -79,4 +79,4 @@
</div>
</div>
</form>
</form>
\ No newline at end of file
......@@ -3,6 +3,7 @@ import { MatDialog, MatTableDataSource } from '@angular/material';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs';
import { ContactDialogModalComponent } from '../contact-dialog-modal/contact-dialog-modal.component';
import { ReportType } from '../report-type.enum';
import { SubmissionResultDialogComponent } from '../submission-result-dialog/submission-result-dialog.component';
import { UtilService } from '../util/Util-services';
import { XmlService } from '../util/xml.service';
......@@ -14,6 +15,7 @@ import { XmlService } from '../util/xml.service';
})
export class DacManagementComponent implements OnInit {
ReportType = ReportType;
editMode = false;
/* Used for storing added emails, this will be used for validation */
emails = [];
......@@ -27,7 +29,7 @@ export class DacManagementComponent implements OnInit {
displayedColumns: string[] = [
"emailAddress",
"name",
"telephone",
//"telephone",
"organization",
"edit",
"remove",
......@@ -174,6 +176,7 @@ export class DacManagementComponent implements OnInit {
});
}
this.updateEmailsArray();
if (contacts.length > 0) {
this.dataSource = new MatTableDataSource<any>(this.contactArray);
}
......
......@@ -7,34 +7,54 @@
<div class="container">
<mat-card>
<mat-vertical-stepper #stepper>
<mat-step label="Select an existing DAC">
<app-report (selectedRecord)="getSelectedDac($event,stepper)" [reportType]="reportType"
[embDefaultSearch]="true" [embeded]="true"></app-report>
<mat-step label="Select an existing DAC" *ngIf="action!='Edit'">
<app-report (selectedRecord)="getSelectedDac($event,stepper)" [reportType]="ReportType.dacs"
[embDefaultSearch]="true" [embeded]="true">
</app-report>
<input type="hidden" name="dacRef" [(ngModel)]="selectedDacId" />
</mat-step>
<mat-step label="Submit policy">
<div style="width: 50%;">
<mat-radio-group name="group" [(ngModel)]="policyType">
<mat-radio-button value="textSelected"> Enter
<mat-form-field class="app-field-padding">
<input matInput placeholder="Short descriptive title for the policy" required
[(ngModel)]="title" name="title" />
</mat-form-field>
<mat-radio-group name="group" #radioGroup="matRadioGroup">
<mat-radio-button [checked]="!policyUrl" value="textSelected"> Enter
policy text
</mat-radio-button>
<mat-radio-button value="urlSelected">Enter the
<mat-radio-button [checked]="policyUrl" value="urlSelected">Enter
the
URL containing
your policy text
</mat-radio-button>
</mat-radio-group>
<mat-form-field *ngIf="policyType=='textSelected'">
<textarea matInput rows="3" [(ngModel)]="text" name="text" placeholder="Polict text"
required></textarea>
<mat-form-field *ngIf="radioGroup.value=='textSelected'">
<textarea matInput rows="3" [(ngModel)]="policyText" name="policyText"
placeholder="Polict text" required></textarea>
</mat-form-field>
<mat-form-field *ngIf="policyType=='urlSelected'">
<input matInput [(ngModel)]="url" name="url" placeholder="Polict URL" required />
<mat-form-field *ngIf="radioGroup.value=='urlSelected'">
<input matInput [(ngModel)]="policyText" name="policyText" placeholder="Polict URL"
required />
</mat-form-field>
</div>
<div style="text-align:Center">
<button mat-raised-button color="accent" [disabled]="f.invalid">Save</button>
<button *ngIf="action==='Edit'" mat-raised-button style="margin-left: 5px;"
[routerLink]="['/report',ReportType.policies,{defaultSearch: true}]">Cancel</button>
<button *ngIf="action!='Edit'" mat-raised-button style="margin-left: 5px;"
routerLink="">Cancel</button>
</div>
</mat-step>
</mat-vertical-stepper>
</mat-card>
</div>
</div>
<div class="centred" *ngIf="showLoadingFlag" style="height:70px;">
<mat-spinner [diameter]="50" [strokeWidth]="5" style="margin:0 auto;">
</mat-spinner>
</div>
</form>
\ No newline at end of file
import { Component, OnInit } from '@angular/core';
import { MatStepper } from '@angular/material';
import { MatDialog, MatStepper } from '@angular/material';
import { getEnabledCategories } from 'trace_events';
import { ReportType } from '../report-type.enum';
import { FormControl, FormGroupDirective, NgForm, Validators, FormGroup } from '@angular/forms';
import { Observable } from 'rxjs';
import { XmlService } from '../util/xml.service';
import { UtilService } from '../util/Util-services';
import { SubmissionResultDialogComponent } from '../submission-result-dialog/submission-result-dialog.component';
import { ActivatedRoute } from '@angular/router';
@Component({
......@@ -12,15 +17,30 @@ import { FormControl, FormGroupDirective, NgForm, Validators, FormGroup } from '
})
export class DacPolicyManagementComponent implements OnInit {
constructor() { }
reportType = ReportType.dacs;
constructor(private xmlUtil: XmlService,
private util: UtilService,
public dialog: MatDialog,
private activatedRoute: ActivatedRoute,) { }
ReportType = ReportType;
selectedDacId: string;
textSelected: boolean;
urlSelected: boolean;
text: string;
url: string;
action: string;
id: string;
showLoadingFlag = false;
xmlString: string;
title: string;
policyText: string;
policyUrl = false;
ngOnInit() {
this.id = this.activatedRoute.snapshot.params.id;
if (this.id) {
this.action = "Edit";
this.initEdit(this.id);
}
}
getSelectedDac(reportObj: object, stepper: MatStepper) {
......@@ -29,6 +49,56 @@ export class DacPolicyManagementComponent implements OnInit {
}
submitDacPolicy(form) {
var observable: Observable<string>;
let redirectPath = ""
if (this.action != "Edit") {
observable = this.xmlUtil.generateDacPolicyXml(
form.value,
);
} else {
observable = this.xmlUtil.updateDacPolicyXml(
this.xmlString,
form.value,
);
redirectPath = null;
}
this.util.showSubmissionResponse(
this,
SubmissionResultDialogComponent,