Skip to content

Commit

Permalink
Merge pull request #252 from datavisyn/release-6.1.0
Browse files Browse the repository at this point in the history
Release 6.1.0
  • Loading branch information
Anita Steiner authored Nov 22, 2019
2 parents 680865b + 566f521 commit beeb164
Show file tree
Hide file tree
Showing 9 changed files with 221 additions and 328 deletions.
304 changes: 35 additions & 269 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "tdp_core",
"description": "Target discovery platform for exploring rankings of genes, disease models, and other entities.",
"version": "6.0.0",
"version": "6.1.0",
"author": {
"name": "datavisyn",
"email": "contact@datavisyn.io",
"url": "https://datavisyn.io/"
"url": "https://www.datavisyn.io"
},
"license": "BSD-3-Clause",
"homepage": "https://phovea.caleydo.org",
"homepage": "https://www.datavisyn.io",
"bugs": {
"url": "https://github.com/datavisyn/tdp_core/issues"
},
Expand Down Expand Up @@ -105,7 +105,7 @@
"karma-sourcemap-loader": "0.3.7",
"karma-webpack": "2.0.3",
"mkdirp": "0.5.1",
"node-sass": "4.7.2",
"node-sass": "^4.12.0",
"null-loader": "0.1.1",
"raw-loader": "0.5.1",
"sass-loader": "6.0.7",
Expand Down
2 changes: 1 addition & 1 deletion src/ATDPApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export abstract class ATDPApplication<T> extends ACLUEWrapper {
if (typeof this.options.showResearchDisclaimer === 'function') {
this.options.showResearchDisclaimer(aboutDialogBody);
} else {
aboutDialogBody.insertAdjacentHTML('afterbegin', '<div class="alert alert-warning" role="alert"><strong>Disclaimer</strong> This software is <strong>for research purpose only</strong>.</span></div>');
aboutDialogBody.insertAdjacentHTML('afterbegin', '<div class="alert alert-warning" role="alert"><strong>Disclaimer</strong> This software is <strong>for research purposes only</strong>.</span></div>');
}
}

Expand Down
36 changes: 26 additions & 10 deletions src/SessionList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ abstract class ASessionList {
});
$enter.select('a[data-action="select"]').on('click', (d) => {
stopEvent();
if (!canWrite(d)) {
manager.cloneLocal(d);
} else {
if (canWrite(d)) {
manager.loadGraph(d);
} else {
manager.cloneLocal(d);
}
return false;
});
Expand Down Expand Up @@ -308,11 +308,19 @@ export class PersistentSessionList extends ASessionList {
{
const $tr = $parent.select('#session_others tbody').selectAll('tr').data(otherworkspaces);

const $trEnter = $tr.enter().append('tr').html(`
<td></td>
<td></td>
<td></td>
<td>${ASessionList.createButton('clone')}</td>`);
const $trEnter = $tr.enter().append('tr').html((d) => {
let actions = '';
if(canWrite(d)) {
actions += ASessionList.createButton('select');
}
actions += ASessionList.createButton('clone');

return `
<td></td>
<td></td>
<td></td>
<td>${actions}</td>`;
});

this.registerActionListener(manager, $trEnter);
$tr.select('td').text((d) => d.name);
Expand Down Expand Up @@ -345,11 +353,19 @@ export class PersistentSessionList extends ASessionList {
{
const $tr = $parent.select('#session_others').selectAll('div').data(otherworkspaces);

const $trEnter = $tr.enter().append('div').classed('sessionEntry', true).html(`
const $trEnter = $tr.enter().append('div').classed('sessionEntry', true).html((d) => {
let actions = '';
if(canWrite(d)) {
actions += ASessionList.createButton('select');
}
actions += ASessionList.createButton('clone');

return `
<span></span>
<span></span>
<span></span>
<span>${ASessionList.createButton('clone')}</span>`);
<span>${actions}</span>`;
});

this.registerActionListener(manager, $trEnter);
$tr.select('span').text((d) => d.name);
Expand Down
8 changes: 4 additions & 4 deletions src/dialogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export {setGlobalErrorTemplate} from 'phovea_ui/src/errors';
export {errorAlert as showErrorModalDialog} from './notifications';

export interface IDialogModule {
generateDialog(title: string, primaryBtnText?: string): Dialog;
generateDialog(title: string, primaryBtnText?: string, additionalCSSClasses?: string): Dialog;

areyousure(msg?: string, options?: IAreYouSureOptions | string): Promise<boolean>;

FormDialog: {new(title: string, primaryBtnText?: string, formId?: string): FormDialog};
FormDialog: {new(title: string, primaryBtnText?: string, formId?: string, additionalCSSClasses?: string): FormDialog};
}

export function lazyDialogModule(): Promise<IDialogModule> {
Expand All @@ -26,9 +26,9 @@ export function lazyDialogModule(): Promise<IDialogModule> {
* @param {CLUEGraphManager} manager
* @param {string} id session id
*/
export function showProveanceGraphNotFoundDialog(manager: CLUEGraphManager, id: string) {
export function showProveanceGraphNotFoundDialog(manager: CLUEGraphManager, id: string, additionalCSSClasses: string = '') {
lazyDialogModule().then(({generateDialog}) => {
const dialog = generateDialog('Session Not Found!', 'Create New Temporary Session');
const dialog = generateDialog('Session Not Found!', 'Create New Temporary Session', additionalCSSClasses);
// append bg-danger to the dialog parent element
dialog.body.parentElement.parentElement.parentElement.classList.add('bg-danger');
dialog.body.innerHTML = `
Expand Down
4 changes: 2 additions & 2 deletions src/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export interface IViewGroupExtensionDesc extends IPluginDesc {


export interface ISelection {
readonly idtype: IDType;
readonly idtype: IDType; // see phovea_core/src/idtype/manager#resolve
readonly range: Range;

/**
Expand All @@ -175,7 +175,7 @@ export interface ISelection {

export interface IViewContext {
readonly graph: ProvenanceGraph;
readonly desc: IViewPluginDesc;
readonly desc: IViewPluginDesc; // see tdp_core/src/views/interfaces#toViewPluginDesc and phovea_core/src/plugin#get
readonly ref: IObjectRef<any>;
}

Expand Down
88 changes: 88 additions & 0 deletions src/lineup/ARankingView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,79 @@ export interface IARankingViewOptions {
* @default true
*/
enableOverviewMode: boolean | 'active';

/**
* enable zoom button
* @default true
*/
enableZoom: boolean;

/**
* enable download data button
* @default true
*/
enableDownload: boolean;

/**
* enable save list of entities button
* @default true
*/
enableSaveRanking: boolean;

/**
* enable collapsing button of side panel
* @default true
*/
enableSidePanelCollapsing: boolean;

/**
* enable side panel
* @default 'collapsed'
*/
enableSidePanel: boolean | 'collapsed' | 'top';

/**
* enable add columns button
* @default true
*/
enableAddingColumns: boolean;

/**
* enable support columns in the add column dialog
* @default true
*/
enableAddingSupportColumns: boolean;

/**
* enable combining columns in the add column dialog
* @default true
*/
enableAddingCombiningColumns: boolean;

/**
* enable score columns in the add column dialog
* @default true
*/
enableAddingScoreColumns: boolean;

/**
* enable previously created columns in the add column dialog
* @default true
*/
enableAddingPreviousColumns: boolean;

/**
* enable database columns in the add column dialog
* @default true
*/
enableAddingDatabaseColumns: boolean;

/**
* enable meta data score columns in the add column dialog
* @default true
*/
enableAddingMetaDataColumns: boolean;

enableHeaderSummary: boolean;

enableHeaderRotation: boolean;
Expand All @@ -91,6 +154,7 @@ export interface IARankingViewOptions {

/**
* base class for views based on LineUp
* There is also AEmbeddedRanking to display simple rankings with LineUp.
*/
export abstract class ARankingView extends AView {

Expand Down Expand Up @@ -142,8 +206,17 @@ export abstract class ARankingView extends AView {
subType: {key: '', value: ''},
enableOverviewMode: true,
enableZoom: true,
enableDownload: true,
enableSaveRanking: true,
enableAddingColumns: true,
enableAddingColumnGrouping: false,
enableAddingSupportColumns: true,
enableAddingCombiningColumns: true,
enableAddingScoreColumns: true,
enableAddingPreviousColumns: true,
enableAddingDatabaseColumns: true,
enableAddingMetaDataColumns: true,
enableSidePanelCollapsing: true,
enableSidePanel: 'collapsed',
enableHeaderSummary: true,
enableStripedBackground: false,
Expand All @@ -158,6 +231,17 @@ export abstract class ARankingView extends AView {

private readonly selectionAdapter: ISelectionAdapter | null;

/**
* Creates a RankingView with the given selection.
* Can be wrapped with a ViewWrapper.
*
* @remarks You need to call init() to actually display the Ranking View.
*
* @param context with provenance graph to store the executed operations
* @param selection The Ids and IdType of the selection
* @param parent where to put the ranking view
* @param options to configure the ranking view
*/
constructor(context: IViewContext, selection: ISelection, parent: HTMLElement, options: Partial<IARankingViewOptions> = {}) {
super(context, selection, parent);

Expand Down Expand Up @@ -247,6 +331,10 @@ export abstract class ARankingView extends AView {
this.selectionAdapter = this.createSelectionAdapter();
}

/**
* @param params Seperate element that displays the "Showing x of y ..." message
* @param onParameterChange eventlistener for content changes
*/
init(params: HTMLElement, onParameterChange: (name: string, value: any, previousValue: any) => Promise<any>) {
return super.init(params, onParameterChange).then(() => {
// inject stats
Expand Down
79 changes: 49 additions & 30 deletions src/lineup/internal/LineUpPanelActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default class LineUpPanelActions extends EventHandler {
<div class="lu-adder">${this.search ? '<button class="fa fa-plus" title="Add Column"></button>' : ''}
</div>`);

if (!this.isTopMode) { // top mode doesn't need collapse feature
if (!this.isTopMode && this.options.enableSidePanelCollapsing) { // top mode doesn't need collapse feature
this.node.insertAdjacentHTML('afterbegin', `<a href="#" title="(Un)Collapse"></a>`);
this.node.querySelector('a')!.addEventListener('click', (evt) => {
evt.preventDefault();
Expand All @@ -148,8 +148,12 @@ export default class LineUpPanelActions extends EventHandler {

const buttons = this.node.querySelector('section');
this.appendExtraButtons().forEach((b) => buttons.appendChild(b));
buttons.appendChild(this.appendSaveRanking());
buttons.appendChild(this.appendDownload());
if(this.options.enableSaveRanking) {
buttons.appendChild(this.appendSaveRanking());
}
if(this.options.enableDownload) {
buttons.appendChild(this.appendDownload());
}
if (this.options.enableZoom) {
buttons.appendChild(this.createMarkup('Zoom In', 'fa fa-search-plus gap', () => this.fire(LineUpPanelActions.EVENT_ZOOM_IN)));
buttons.appendChild(this.createMarkup('Zoom Out', 'fa fa-search-minus', () => this.fire(LineUpPanelActions.EVENT_ZOOM_OUT)));
Expand Down Expand Up @@ -330,11 +334,13 @@ export default class LineUpPanelActions extends EventHandler {
}
const {metaDataOptions, loadedScorePlugins} = await this.resolveScores(this.idType);

const items: (ISearchOption | IGroupSearchItem<ISearchOption>)[] = [
this.groupedDialog('Database Columns', this.getColumnDescription(descs, false))
];
const items: (ISearchOption | IGroupSearchItem<ISearchOption>)[] = [];

if (loadedScorePlugins.length > 0) {
if(this.options.enableAddingDatabaseColumns) {
items.push(this.groupedDialog('Database Columns', this.getColumnDescription(descs, false)));
}

if (this.options.enableAddingScoreColumns && loadedScorePlugins.length > 0) {
items.push({
text: 'Parameterized Scores',
children: loadedScorePlugins.map((score) => {
Expand All @@ -353,36 +359,49 @@ export default class LineUpPanelActions extends EventHandler {
});
}

const scoreDescs = this.getColumnDescription(descs, true);
if (scoreDescs.length > 0) {
items.push({
text: 'Previously Added Columns',
children: scoreDescs
});
if(this.options.enableAddingPreviousColumns) {
const scoreDescs = this.getColumnDescription(descs, true);
if (scoreDescs.length > 0) {
items.push({
text: 'Previously Added Columns',
children: scoreDescs
});
}
}

const combiningColumns = this.groupedDialog('Combining Columns', [
{ text: 'Weighted Sum', id: 'weightedSum', action: () => this.addColumn(createStackDesc('Weighted Sum')) },
{ text: 'Scripted Combination', id: 'scriptedCombination', action: () => this.addColumn(createScriptDesc('Scripted Combination')) },
{ text: 'Nested', id: 'nested', action: () => this.addColumn(createNestedDesc('Nested')) },
{ text: 'Min/Max/Mean Combination', id: 'reduce', action: () => this.addColumn(createReduceDesc()) },
{ text: 'Imposition', id: 'imposition', action: () => this.addColumn(createImpositionDesc()) }
]);
const specialColumnsOption = {
text: 'Special Columns',
children: []
};

if(this.options.enableAddingCombiningColumns) {
const combiningColumns = this.groupedDialog('Combining Columns', [
{ text: 'Weighted Sum', id: 'weightedSum', action: () => this.addColumn(createStackDesc('Weighted Sum')) },
{ text: 'Scripted Combination', id: 'scriptedCombination', action: () => this.addColumn(createScriptDesc('Scripted Combination')) },
{ text: 'Nested', id: 'nested', action: () => this.addColumn(createNestedDesc('Nested')) },
{ text: 'Min/Max/Mean Combination', id: 'reduce', action: () => this.addColumn(createReduceDesc()) },
{ text: 'Imposition', id: 'imposition', action: () => this.addColumn(createImpositionDesc()) }
]);
specialColumnsOption.children.push(combiningColumns);
}

const supportColumns = this.groupedDialog('Support Columns', [
if(this.options.enableAddingSupportColumns) {
const supportColumns = this.groupedDialog('Support Columns', [
{text: 'Group Information', id: 'group', action: () => this.addColumn(createGroupDesc('Group'))},
{text: 'Selection Checkbox', id: 'selection', action: () => this.addColumn(createSelectionDesc())},
{text: 'Aggregate Group', id: 'aggregate', action: () => this.addColumn(createAggregateDesc())}
]);
]);
specialColumnsOption.children.push(supportColumns);
}

items.push({
text: 'Special Columns',
children: [
combiningColumns,
supportColumns,
...metaDataOptions
]
});
if(this.options.enableAddingMetaDataColumns) {
specialColumnsOption.children.push(...metaDataOptions);
}

// Only add special columns option if there are any items available
if(specialColumnsOption.children.length > 0) {
items.push(specialColumnsOption);
}

this.search.data = items;
}
Expand Down
Loading

0 comments on commit beeb164

Please sign in to comment.