Skip to content
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
18 changes: 17 additions & 1 deletion client/client/app/app.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export default class ngbAppController extends baseController {
initStateFromParams() {
this._changeStateFromParams(this.$stateParams);

const {toolbar, layout, bookmark, screenshot, embedded, controls} = this.$stateParams;
const {toolbar, layout, bookmark, screenshot, embedded, controls, panels, hideMenu} = this.$stateParams;
if (embedded) {
this.appearanceContext.embedded = this.dictionaryState.on.toLowerCase() === embedded.toLowerCase();
} else if (controls) {
Expand Down Expand Up @@ -319,6 +319,22 @@ export default class ngbAppController extends baseController {
const screenShotVisibility = this.dictionaryState.on.toLowerCase() === screenshot.toLowerCase();
this.projectContext.screenShotVisibility = screenShotVisibility;
}
if (panels) {
try {
const panelsArray = JSON.parse(panels);
if (Array.isArray(panelsArray)) {
this.appearanceContext.initialPanels = panelsArray.map(panel => panel.toLowerCase());
}
} catch (e) {
// eslint-disable-next-line no-console
console.warn(`Error parsing "panels" attribute: ${e.message}`);
}
}
if (hideMenu !== undefined) {
const menuHidden = `${hideMenu}`.toLowerCase() === 'true' ||
this.dictionaryState.on.toLowerCase() === `${hideMenu}`.toLowerCase();
this.projectContext.toolbarVisibility = !menuHidden;
}
}

_goToState() {
Expand Down
7 changes: 4 additions & 3 deletions client/client/app/app.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ export default function routes($urlRouterProvider, $httpProvider, $stateProvider
pathway: null,
embedded: null,
controls: null,
auth: null
auth: null,
panels: null,
hideMenu: null
},
resolve: {
$stateParams: '$stateParams'
},
reloadOnSearch: false,
template: require('./app.tpl.html'),
url: '/:referenceId/:chromosome/:start/:end?rewrite&bookmark&screenshot&toolbar&layout&tracks&filterByGenome&collapsedTrackHeaders&miew&heatmap&embedded&controls&pathway&auth'
url: '/:referenceId/:chromosome/:start/:end?rewrite&bookmark&screenshot&toolbar&layout&tracks&filterByGenome&collapsedTrackHeaders&miew&heatmap&embedded&controls&pathway&auth&panels&hideMenu'
});

}
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,28 @@ export default class ngbGoldenLayoutController extends baseController {
if (this.goldenLayout.isSubWindow) {
this._createCommunicationBetweenWindows();
}

if (this.appearanceContext.initialPanels) {
this.setPanelsFromParams();
}
}

setPanelsFromParams() {
const initialPanels = this.appearanceContext.initialPanels;
for (const key in this.appLayout.Panels) {
if (this.appLayout.Panels.hasOwnProperty(key)) {
const panelObject = this.appLayout.Panels[key];
const [panelItem] = this.goldenLayout.root
.getItemsByFilter((obj) => obj.config && obj.config.componentState
&& obj.config.componentState.panel === panelObject.panel);
if (initialPanels.includes(key.toLowerCase()) && !panelItem) {
this.panelAdd(panelObject);
}
if (!initialPanels.includes(key.toLowerCase()) && panelItem) {
this.panelRemove(panelObject);
}
}
}
}

handleKeyPressed(event) {
Expand Down Expand Up @@ -677,6 +699,7 @@ export default class ngbGoldenLayoutController extends baseController {
this.goldenLayout.destroy();
const layout = null;
this.projectContext.layout = layout;
this.appearanceContext.initialPanels = null;
this.initLayout();
}

Expand Down