Skip to content

Commit

Permalink
merging conflicts #410
Browse files Browse the repository at this point in the history
  • Loading branch information
Omnia Kahla authored and Omnia Kahla committed Nov 2, 2020
2 parents 1aaabcc + f91e220 commit 7e91e5d
Show file tree
Hide file tree
Showing 15 changed files with 641 additions and 242 deletions.
46 changes: 37 additions & 9 deletions backend/routes/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,14 @@ router.get('/:id', checkAuth2, (req, res, next) => {
//}

//await getMainHierarchyOfPages(pages, hierarchyOfPages);
//console.log('final hierarchy');
//console.log(hierarchyOfPages);
// console.log('final hierarchy');
// console.log(hierarchyOfPages);
res.status(200).json({
message: 'Action was found',
action: actionResult[0],
hierarchyOfPages: hierarchyOfPages
})
}
else{
} else {
res.status(200).json({
message: 'Action was found',
action: actionResult[0],
Expand Down Expand Up @@ -218,12 +217,41 @@ router.get('/:id', checkAuth2, (req, res, next) => {
path: 'hasPages'
}
})
.then(result => {
.then(async result => {
if (result[0].published === true) {
res.status(200).json({
message: 'Action was found',
action: result[0]
})
let hierarchyOfPages = [];
let pages=result[0].hasPageSet.hasPages;
if(pages.length!=0){
for(let i=0;i<pages.length;i++){
hierarchyOfPages.push({page: pages[i], subPages:await getHierarchyOfPages(pages[i])});
}
//for(let i=0;i<pages.length;i++) {
//pagesIds.push(page._id);
// const page=pages[i];
//
//hierarchyOfPages.push({page: page, subPages:await getHierarchyOfPages(page._id)});
// console.log('atest');
// console.log(subPages);
// const pageInHierarchy={page: page, subPages:subPages };
// hierarchyOfPages.push(pageInHierarchy);
// await getHierarchyOfPages(page._id, hierarchyOfPages);
//}

//await getMainHierarchyOfPages(pages, hierarchyOfPages);
// console.log('final hierarchy');
// console.log(hierarchyOfPages);
res.status(200).json({
message: 'Action was found',
action: result[0],
hierarchyOfPages: hierarchyOfPages
})
} else {
res.status(200).json({
message: 'Action was found',
action: result[0],
hierarchyOfPages: []
})
}
} else {
res.status(404).json({message: 'Action was not found'})
}
Expand Down
2 changes: 1 addition & 1 deletion publishOnlyTestInstance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

DATE=`date +%y-%m-%d`

VERSION="v1"
VERSION="v2"

docker login

Expand Down
8 changes: 4 additions & 4 deletions src/app/app-engine/apps/crispr/crispr.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
*ngIf="selectedAction === 'download'">
<mat-label>{{ showSubmitButton ? 'Choose another csv' : 'Choose csv' }}</mat-label>
<mat-icon matSuffix>insert_drive_file</mat-icon>
<input matInput style="display: none;" >
<input matInput style="display: none;" [disabled]="waitingForResponse">
</mat-form-field>

<mat-form-field
Expand All @@ -59,7 +59,7 @@
matTooltip="Submit {{ fileToUpload.name }}">
<mat-label>Submit {{ fileToUpload.name }}</mat-label>
<mat-icon matSuffix>send</mat-icon>
<input matInput style="display: none;" >
<input matInput style="display: none;" [disabled]="waitingForResponse">
</mat-form-field>

<mat-progress-bar
Expand All @@ -74,9 +74,9 @@
<button mat-button (click)="errorMessage = undefined" *ngIf="errorMessage" ><mat-icon>close</mat-icon></button>


<input style="display: none;" type="file" #imgFileInput (change)="onFileChange($event.target.files)"/>
<input [disabled]="waitingForResponse" style="display: none;" type="file" #imgFileInput (change)="onFileChange($event.target.files)"/>

<input style="display: none;" type="file" #imgFileInput2 (change)="onFileChange2($event.target.files)"/>
<input [disabled]="waitingForResponse" style="display: none;" type="file" #imgFileInput2 (change)="onFileChange2($event.target.files)"/>


<span *ngIf="csvContainsTooManyLines" >Your csv contains too many lines</span>
Expand Down
107 changes: 55 additions & 52 deletions src/app/app-engine/apps/crispr/crispr.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,77 +76,80 @@ export class CrisprComponent {

submitFile( sequence?: string ) {

let reader = new FileReader();
reader.readAsText( this.fileToUpload );
if ( !this.waitingForResponse ) {
this.progressBarValue = 0;
let reader = new FileReader();
reader.readAsText( this.fileToUpload );

reader.onload = () => {
reader.onload = () => {

const csvRecordsArray = (<string>reader.result).split(/\r\n|\n/);
const csvRecordsArray = (<string>reader.result).split(/\r\n|\n/);

if ( csvRecordsArray.length > 20001 ) {
this.csvContainsTooManyLines = true;
}
if ( csvRecordsArray.length > 20001 ) {
this.csvContainsTooManyLines = true;
}

this.sequencesArray = [];
this.sequencesArray = [];

for ( const sequenceEntry of csvRecordsArray ) {
this.sequencesArray.push( {
sequence: sequenceEntry.split( ',')[ 0 ],
positions: sequenceEntry.split( ',')[ 1 ]
} );
}
for ( const sequenceEntry of csvRecordsArray ) {
this.sequencesArray.push( {
sequence: sequenceEntry.split( ',')[ 0 ],
positions: sequenceEntry.split( ',')[ 1 ]
} );
}

this.sequencesArray.shift();
this.sequencesArray.shift();

let arrayForTable = [];
let arrayForTable = [];

if ( this.sequencesArray.length > 100 ) {
arrayForTable = this.sequencesArray.slice( 0, 100 );
} else {
arrayForTable = this.sequencesArray;
}
if ( this.sequencesArray.length > 100 ) {
arrayForTable = this.sequencesArray.slice( 0, 100 );
} else {
arrayForTable = this.sequencesArray;
}

this.dataSource = new MatTableDataSource( arrayForTable );
this.dataSource = new MatTableDataSource( arrayForTable );

};
};

reader.onerror = function () {
console.log('error is occured while reading file!');
};
reader.onerror = function () {
console.log('error is occured while reading file!');
};

this.errorMessage = undefined;
this.errorMessage = undefined;

this.selectedSequences = [ sequence ];
this.selectedSequences = [ sequence ];

this.form.set( 'selectedBaseEditor', this.selectedBaseEditor );
this.form.set( 'selectedPredictionType', this.selectedPredictionType );
this.form.set( 'selectedSequences', this.selectedAction === 'plot' ? this.selectedSequences.toString() : undefined );
this.form.set( 'selectedAction', this.selectedAction );
this.form.set( 'selectedBaseEditor', this.selectedBaseEditor );
this.form.set( 'selectedPredictionType', this.selectedPredictionType );
this.form.set( 'selectedSequences', this.selectedAction === 'plot' ? this.selectedSequences.toString() : undefined );
this.form.set( 'selectedAction', this.selectedAction );

this.submittedBaseEditor = this.selectedBaseEditor;
this.submittedPredictionType = this.selectedPredictionType;
this.submittedBaseEditor = this.selectedBaseEditor;
this.submittedPredictionType = this.selectedPredictionType;

this.waitingForResponse = true;
this.waitingForResponse = true;

this.updateProgressBar();
this.updateProgressBar();

console.log( this.sessionHash );
this.http.post('http://172.23.39.73:4321', this.form, { responseType: 'blob' })
.subscribe((val) => {
if ( this.selectedAction === 'plot' ) {
const blob = new Blob([ val as any ], { type: 'application/pdf' });
const url = URL.createObjectURL(blob);
this.pathToFile = this.sanitizer.bypassSecurityTrustResourceUrl( url );
this.fileHasChanged = false;
this.waitingForResponse = false;
} else if ( this.selectedAction === 'download' ) {
saveAs(val, 'predictions_' + this.selectedBaseEditor + '_' + this.selectedPredictionType + '.zip');
console.log( this.sessionHash );
this.http.post('http://172.23.39.73:4321', this.form, { responseType: 'blob' })
.subscribe((val) => {
if ( this.selectedAction === 'plot' ) {
const blob = new Blob([ val as any ], { type: 'application/pdf' });
const url = URL.createObjectURL(blob);
this.pathToFile = this.sanitizer.bypassSecurityTrustResourceUrl( url );
this.fileHasChanged = false;
this.waitingForResponse = false;
} else if ( this.selectedAction === 'download' ) {
saveAs(val, 'predictions_' + this.selectedBaseEditor + '_' + this.selectedPredictionType + '.zip');
this.waitingForResponse = false;
}
}, error => {
this.errorMessage = error.message;
this.waitingForResponse = false;
}
}, error => {
this.errorMessage = error.message;
this.waitingForResponse = false;
});
});
}
}

/** Whether the number of selected elements matches the total number of rows. */
Expand Down
71 changes: 52 additions & 19 deletions src/app/app-engine/apps/d3js/bar-chart/bar-chart.component.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,56 @@
<div>
<div class="scaleBarChartWidth">
<div class="scaleBarChartInput">
<mat-form-field>
<input matInput
placeholder="Chart width:"
[value]="this.imageWidth"
[(ngModel)]="this.newImageWidth"
(keyup)="reDrawBarChart()">
</mat-form-field>
<div [ngStyle]="{'width':'100%', 'height': '150px'}">
<div [ngStyle]="{'float':'left'}">
<div class="scaleBarChartWidth">
<div class="scaleBarChartInput">
<div [ngStyle]="{'font-weight':'bold'}">Chart width</div>
<mat-form-field>
<input matInput
type="number"
placeholder="Pixel"
[value]="this.chartWidth"
[(ngModel)]="this.newChartWidth"
(keyup)="reDrawBarChart()">
</mat-form-field>
</div>
<div class="scaleBarChartSlider">
<mat-slider
min="150"
max="{{ this.chartWidth * 4 }}"
step="50"
[value]="this.chartWidth"
[(ngModel)]="this.newChartWidth"
(change)="reDrawBarChart()"></mat-slider>
</div>
</div>
</div>
<div class="scaleBarChartSlider">
<mat-slider
min="150"
max="{{ this.imageWidth * 4 }}"
step="50"
[value]="this.imageWidth"
[(ngModel)]="this.newImageWidth"
(change)="reDrawBarChart()"></mat-slider>
<!-- thumbLabel -->
<div *ngIf="showRange" [ngStyle]="{'float':'left'}">
<div class="selectBarChartRange" [ngStyle]="{'position':'relative', 'width': '100%', 'height': '100%'}">
<div class="selectLowerRange" [ngStyle]="{'float':'left'}">
<div>
<div [innerHTML]="this.rangeLabel" [ngStyle]="{'font-weight':'bold'}"></div>
<mat-form-field [ngStyle]="{'width':'80px', 'margin-right':'10px'}">
<input matInput
placeholder="Lowest"
[value]="this.rangeLowest"
[(ngModel)]="this.newRangeLowest">
<!-- (keyup)="reDrawBarChart()">-->
</mat-form-field>
</div>
</div>
<div class="selectUpperRange" [ngStyle]="{'float':'left'}">
<div>
<div [ngStyle]="{'font-weight':'bold'}">&nbsp;</div>
<mat-form-field [ngStyle]="{'width':'80px', 'margin-left':'10px'}">
<input matInput
placeholder="Highest"
[value]="this.rangeHighest"
[(ngModel)]="this.newRangeHighest">
<!-- (keyup)="reDrawBarChart()">-->
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
<!-- <button id="scaleBarChartButton" mat-button (click)="reDrawBarChart()">Update</button> -->
Expand All @@ -33,7 +66,7 @@
[(ngModel)]="this.isSorted"
(change)="reDrawBarChart()"
>
Sort by value
Sorted by value
</mat-slide-toggle>
</div>
</div>
13 changes: 4 additions & 9 deletions src/app/app-engine/apps/d3js/bar-chart/bar-chart.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
overflow: hidden;
}

.scaleBarChartInput {

}

.scaleBarChartSlider {

.selectBarChartRange {
margin: 10px 0 0 30px;
width: 128px;
overflow: hidden;
}

.bar {
Expand Down Expand Up @@ -49,8 +47,5 @@
z-index: 4;
}

.barChartTooltipValue {

}


Loading

0 comments on commit 7e91e5d

Please sign in to comment.