Skip to content

Commit

Permalink
Metabolic pathways visualisation (#731): context menu navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriiKrasnov committed Jan 30, 2022
1 parent 403c6c4 commit 5c9f93d
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,20 @@ export default class NgbGenesTableContextMenuController extends BaseController {
this.dispatcher.emitSimpleEvent('read:show:homologs', data);
event.stopImmediatePropagation();
}

pathwaysSearch() {
this.close();
const layoutChange = this.appLayout.Panels.pathways;
layoutChange.displayed = true;
this.dispatcher.emitSimpleEvent('layout:item:change', {layoutChange});
const readInfo = {
search: this.entity[`${this.ngbGenesTableService.defaultPrefix}featureName`]
};
const data = {
...readInfo,
source: 'gene'
};
this.dispatcher.emitSimpleEvent('read:show:pathways', data);
event.stopImmediatePropagation();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,15 @@
</span>
</md-button>
</md-menu-item>
<md-menu-item>
<md-button ng-click="ctrl.isGene && ctrl.pathwaysSearch($event)"
ng-disabled="!ctrl.isGene">
<span>Show pathways</span>
<span class="ngb-context-menu-warning" ng-if="!ctrl.isGene">
<ng-md-icon class="ngb-context-menu-warning-icon" icon="warning" size="15"></ng-md-icon>
Feature type is not Gene or Name is missing
</span>
</md-button>
</md-menu-item>
</md-menu-content>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default class ngbPathwaysService {

initEvents() {
this.dispatcher.on('read:show:pathways', data => {
this.currentSearch = data;
this.currentSearch = data ? data.search : null;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export default class ngbPathwaysPanelController extends baseController {
searchRequest;

events = {
'read:show:pathways': () => {
'read:show:pathways': data => {
this.searchRequest = data ? data.search : null;
this.changeState('INTERNAL_PATHWAYS');
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,30 @@ export default class ngbTrackEvents {
: undefined,
});
}
if (data.feature.feature
&& data.feature.feature.toLowerCase() === 'gene'
&& data.feature.name) {
const layoutChange = this.appLayout.Panels.pathways;
layoutChange.displayed = true;
menuData.push({
events: [
{
data: {layoutChange},
name: 'layout:item:change'
},
{
data: {
search: data.feature.name
},
name: 'read:show:pathways'
}],
title: 'Show pathways',
disabled: (data.feature.feature || '').toLowerCase() !== 'gene' || !data.feature.name,
warning: (data.feature.feature || '').toLowerCase() !== 'gene' || !data.feature.name
? 'Feature type is not Gene or Name is missing'
: undefined,
});
}
if (menuData.length > 0) {
const childScope = this.$scope.$new(false);
childScope.menuData = menuData;
Expand Down

0 comments on commit 5c9f93d

Please sign in to comment.