Skip to content

Commit

Permalink
METLIGHT-4328 - Publication box activates on hover but doesn’t naviga…
Browse files Browse the repository at this point in the history
…te anywhere

Disable Publication box hyperlink on hiver
  • Loading branch information
famaladoss committed Jul 21, 2021
1 parent 4f3f700 commit 2f5afad
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
<div class="content">
<h4 class="publication-title">
<b>
<a (click)='openModal()' target="_blank">{{ publication.title | slice : 0 : 90 }}<span *ngIf="publication.title.length > 90">...</span>
</a>
{{ publication.title | slice : 0 : 90 }}<span *ngIf="publication.title.length > 90">...</span>
</b>
</h4>
<h6 class="publication-authors" style="margin-bottom: 0">
Expand Down Expand Up @@ -61,7 +60,7 @@ <h6 class="publication-authors" style="margin-bottom: 0">
<footer class="modal-card-foot">
<div class="columns is-gapless full-width">
<div class="column is-half">

</div>
<div class="column is-half has-text-right">
<button (click)='closeImportAuthor()' class="button is-default">Done</button><button (click)="saveAuthors()" class="button is-info">Import Selected</button>
Expand Down Expand Up @@ -120,7 +119,7 @@ <h6 class="publication-authors" style="margin-bottom: 0">
</div>
<section class="modal-card-body">
<mat-form-field class="full-width">
<textarea class="no-scroll"
<textarea class="no-scroll"
formControlName="title"
matInput
[tabIndex]="1"
Expand All @@ -137,7 +136,7 @@ <h6 class="publication-authors" style="margin-bottom: 0">
</mat-error>
</mat-form-field>
<mat-form-field class="full-width">
<textarea class="no-scroll"
<textarea class="no-scroll"
formControlName="authorList"
matInput
[tabIndex]="2"
Expand All @@ -154,7 +153,7 @@ <h6 class="publication-authors" style="margin-bottom: 0">
</mat-error>
</mat-form-field>
<mat-form-field class="full-width">
<input class="no-scroll"
<input class="no-scroll"
formControlName="doi"
[tabIndex]="3"
(blur)="getArticleFromDOI()"
Expand All @@ -168,7 +167,7 @@ <h6 class="publication-authors" style="margin-bottom: 0">
</mat-error>
</mat-form-field>
<mat-form-field class="full-width">
<input class="no-scroll"
<input class="no-scroll"
[tabIndex]="4"
formControlName="pubMedID"
(blur)="getArticleFromPubMedID()"
Expand Down Expand Up @@ -210,4 +209,4 @@ <h6 class="publication-authors" style="margin-bottom: 0">
</footer>
</div>
</form>
</div>
</div>
114 changes: 58 additions & 56 deletions src/app/services/editor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import Swal from 'sweetalert2';
providedIn: 'root'
})
export class EditorService {
@select(state => state.study.identifier) studyIdentifier;
@select(state => state.study.validations) studyValidations;
@select(state => state.study.files) studyFiles;
@select(state => state.study.identifier) studyIdentifier;
@select(state => state.study.validations) studyValidations;
@select(state => state.study.files) studyFiles;

redirectUrl: string = RedirectURL;
currentStudyIdentifier: string = null;
Expand All @@ -38,13 +38,13 @@ export class EditorService {
}

constructor(private ngRedux: NgRedux<IAppState>, private router: Router, private doiService: DOIService, private authService: AuthService, private europePMCService: EuropePMCService, private dataService: MetabolightsService) {
this.studyIdentifier.subscribe(value => {
this.currentStudyIdentifier = value
this.studyIdentifier.subscribe(value => {
this.currentStudyIdentifier = value
});
this.studyValidations.subscribe(value => {
this.studyValidations.subscribe(value => {
this.validations = value;
});
this.studyFiles.subscribe(value => {
this.studyFiles.subscribe(value => {
this.files = value;
});
}
Expand Down Expand Up @@ -85,11 +85,11 @@ export class EditorService {
initialise(data, signInRequest){
let user = null
if(signInRequest){
user = JSON.parse(data.content).owner;
user = JSON.parse(data.content).owner;
localStorage.setItem('user', JSON.stringify(user));
contentHeaders.set('user_token', user.apiToken);
this.ngRedux.dispatch({
type: 'INITIALISE'
this.ngRedux.dispatch({
type: 'INITIALISE'
})
this.ngRedux.dispatch({ type: 'SET_USER', body: {
'user': user
Expand All @@ -102,8 +102,8 @@ export class EditorService {
}else{
user = JSON.parse(data)
contentHeaders.set('user_token', user.apiToken);
this.ngRedux.dispatch({
type: 'INITIALISE'
this.ngRedux.dispatch({
type: 'INITIALISE'
})
this.ngRedux.dispatch({ type: 'SET_USER', body: {
'user': user
Expand All @@ -117,71 +117,71 @@ export class EditorService {
}

loadValidations(){
this.dataService.getValidations().subscribe(
this.dataService.getValidations().subscribe(
validations => {
this.ngRedux.dispatch({ type: 'SET_LOADING_INFO', body: {
'info': 'Loading study validations'
'info': 'Loading study validations'
}})
this.ngRedux.dispatch({
type: 'LOAD_VALIDATION_RULES',
this.ngRedux.dispatch({
type: 'LOAD_VALIDATION_RULES',
body: {
'validations': validations
}
})
},
err => {
console.log(err)
},
err => {
console.log(err)
}
);
}

loadGuides(){
this.dataService.getLanguageMappings().subscribe(
this.dataService.getLanguageMappings().subscribe(
mappings => {
this.ngRedux.dispatch({ type: 'SET_GUIDES_MAPPINGS', body: {
'mappings': mappings
'mappings': mappings
}})
var selected_language = localStorage.getItem('selected_language');
mappings['languages'].forEach( language => {
if((selected_language && language['code'] == selected_language) || (!selected_language && language['default'])){
this.ngRedux.dispatch({
type: 'SET_SELECTED_LANGUAGE',
this.ngRedux.dispatch({
type: 'SET_SELECTED_LANGUAGE',
body: {
'language': language['code']
}
})

this.dataService.getGuides(language['code']).subscribe(
this.dataService.getGuides(language['code']).subscribe(
guides => {
this.ngRedux.dispatch({
type: 'SET_GUIDES',
this.ngRedux.dispatch({
type: 'SET_GUIDES',
body: {
'guides': guides['data']
}
})
})
}
})
},
err => {
console.log(err)

},
err => {
console.log(err)
}
);
}

loadLanguage(language){
this.dataService.getGuides(language).subscribe(
this.dataService.getGuides(language).subscribe(
guides => {
localStorage.setItem('selected_language', language);
this.ngRedux.dispatch({
type: 'SET_SELECTED_LANGUAGE',
this.ngRedux.dispatch({
type: 'SET_SELECTED_LANGUAGE',
body: {
'language': language
}
})
this.ngRedux.dispatch({
type: 'SET_GUIDES',
this.ngRedux.dispatch({
type: 'SET_GUIDES',
body: {
'guides': guides['data']
}
Expand All @@ -200,7 +200,7 @@ export class EditorService {
loadStudyId(id){
return this.ngRedux.dispatch({ type: 'SET_STUDY_IDENTIFIER', body: {
'study': id
}})
}})
}

createStudy(){
Expand All @@ -215,7 +215,7 @@ export class EditorService {
this.ngRedux.dispatch({ type: 'DISABLE_LOADING' })
}
}else{
this.ngRedux.dispatch({ type: 'TOGGLE_LOADING' })
this.ngRedux.dispatch({ type: 'TOGGLE_LOADING' })
}
}

Expand All @@ -228,7 +228,7 @@ export class EditorService {
if(this.currentStudyIdentifier != studyID ){
this.loadStudy(studyID, false)
}
});
});
}
}

Expand All @@ -245,7 +245,7 @@ export class EditorService {
'investigationFailed': false
}})
this.ngRedux.dispatch({ type: 'SET_LOADING_INFO', body: {
'info': 'Loading investigation details'
'info': 'Loading investigation details'
}})
this.ngRedux.dispatch({ type: 'SET_CONFIGURATION', body: {
'configuration': study.isaInvestigation.comments
Expand Down Expand Up @@ -321,7 +321,9 @@ export class EditorService {
}

loadStudyFiles(){
this.dataService.getStudyFiles(null, true).subscribe(data => {
console.log("Loading Study files from static list except first time -")
this.dataService.getStudyFilesFetch().subscribe(data => {
console.log("Got the files list !")
this.ngRedux.dispatch({ type: 'SET_UPLOAD_LOCATION', body: {
'uploadLocation': data.uploadPath
}})
Expand Down Expand Up @@ -422,7 +424,7 @@ export class EditorService {
this.files.study.forEach(file => {
if(file.file.indexOf("s_") == 0 && file.status == 'active'){
this.ngRedux.dispatch({ type: 'SET_LOADING_INFO', body: {
'info': 'Loading Samples data'
'info': 'Loading Samples data'
}})
samplesExist = true
this.updateSamples(file.file)
Expand All @@ -442,10 +444,10 @@ export class EditorService {

loadStudyAssays(files){
this.ngRedux.dispatch({ type: 'SET_LOADING_INFO', body: {
'info': 'Loading assays information'
'info': 'Loading assays information'
}})
files.study.forEach(file => {
if(file.file.indexOf("a_") == 0 && file.status == 'active'){
if(file.file.indexOf("a_") == 0 && file.status == 'active'){
this.updateAssay(file.file)
}
})
Expand All @@ -462,7 +464,7 @@ export class EditorService {
}

updateAssay(file){
this.dataService.getTable(file).subscribe(data => {
this.dataService.getTable(file).subscribe(data => {
let assay = {}
assay["name"] = file;
assay['meta'] = this.extractAssayDetails(assay)
Expand Down Expand Up @@ -494,7 +496,7 @@ export class EditorService {
if(c.header.indexOf("Protocol REF") > -1){
protocols.push(data['rows'][0][c.header])
}
})
})
}
assay['protocols'] = protocols

Expand All @@ -504,7 +506,7 @@ export class EditorService {
if(mafFile != "" && mafFiles.indexOf(mafFile) < 0){
mafFiles.push(mafFile);
}
})
})
mafFiles.forEach( f => {
this.updateMAF(f);
})
Expand Down Expand Up @@ -539,7 +541,7 @@ export class EditorService {

let mdisplayedColumns = mcolumns.map( a => { return a.columnDef } )
mdisplayedColumns.unshift("Select")
mdisplayedColumns.sort(function(a, b){
mdisplayedColumns.sort(function(a, b){
return parseInt(mdata.header[a]) - parseInt(mdata.header[b]);
});
mdisplayedColumns = mdisplayedColumns.filter( key => {
Expand All @@ -553,7 +555,7 @@ export class EditorService {
delete mdata['data']

maf['data'] = mdata
this.ngRedux.dispatch({ type: 'SET_STUDY_MAF', body: maf});
this.ngRedux.dispatch({ type: 'SET_STUDY_MAF', body: maf});
})
}

Expand All @@ -572,7 +574,7 @@ export class EditorService {
updateSamples(file){
let samples = {}
samples["name"] = file;
this.dataService.getTable(file).subscribe(data => {
this.dataService.getTable(file).subscribe(data => {
let columns = []
Object.keys(data.header).forEach( key => {
let fn = "element['"+ key +"']"
Expand All @@ -585,7 +587,7 @@ export class EditorService {
})
let displayedColumns = columns.map( a => { return a.columnDef } )
displayedColumns.unshift("Select")
displayedColumns.sort(function(a, b){
displayedColumns.sort(function(a, b){
return parseInt(data.header[a]) - parseInt(data.header[b]);
});
var index = displayedColumns.indexOf("Source Name");
Expand All @@ -606,7 +608,7 @@ export class EditorService {
displayedColumns.splice(displayedColumns.indexOf('Protocol REF'), 1);
displayedColumns.splice( 1, 0, 'Protocol REF');
}

if(displayedColumns[2] != 'Sample Name'){
displayedColumns.splice(displayedColumns.indexOf('Sample Name'), 1);
displayedColumns.splice( 2, 0, 'Sample Name');
Expand Down Expand Up @@ -750,9 +752,9 @@ export class EditorService {

// Protocols
getProtocols(id) {
return this.dataService.getProtocols(id).pipe(map( data => {
return this.dataService.getProtocols(id).pipe(map( data => {
this.ngRedux.dispatch({ type: 'SET_STUDY_PROTOCOLS', body: data})
return data
return data
}))
}

Expand Down Expand Up @@ -795,7 +797,7 @@ export class EditorService {
return this.dataService.deleteFactor(factorName)
}

// table
// table
addColumns(filename, body, tableType, metaInfo) {
return this.dataService.addColumns(filename, body).pipe(map(data => {
this.updateTableState(filename, tableType, metaInfo)
Expand Down Expand Up @@ -840,7 +842,7 @@ export class EditorService {
return data
}));
}

savePublication(body){
return this.dataService.savePublication(body);
}
Expand All @@ -863,4 +865,4 @@ export class EditorService {
changeReleasedate(releaseDate){
return this.dataService.changeReleasedate(releaseDate)
}
}
}
Loading

0 comments on commit 2f5afad

Please sign in to comment.