diff --git a/.gitignore b/.gitignore index 5c74ff0..8d6a52a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ /.tscache /.idea /build/ -/dist/ *.egg-info/ *.egg *.py[cod] @@ -20,7 +19,7 @@ __pycache__/ node_modules/ /src/**/*.js /tests/**/*.js -*.map +/src/**/*.map +/tests/**/*.map *.css -/.cache-loader package-lock.json diff --git a/README.md b/README.md index aefc5da..9d9d34b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ -tdp_dummy [![Phovea][phovea-image]][phovea-url] [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![CircleCI](https://circleci.com/gh/Caleydo/tdp_dummy.svg?style=shield)](https://circleci.com/gh/Caleydo/tdp_dummy) +tdp_dummy ===================== +[![Phovea][phovea-image-client]][phovea-url] [![Phovea][phovea-image-server]][phovea-url] [![NPM version][npm-image]][npm-url] [![CircleCI][circleci-image]][circleci-url] This repository provides a SQLite database with dummy data and additional views for this specific dataset for TargID. @@ -34,11 +35,10 @@ npm run build This repository is part of **[Phovea](http://phovea.caleydo.org/)**, a platform for developing web-based visualization applications. For tutorials, API docs, and more information about the build and deployment process, see the [documentation page](http://phovea.caleydo.org). -[phovea-image]: https://img.shields.io/badge/Phovea-Client%20Plugin-F47D20.svg +[phovea-image-client]: https://img.shields.io/badge/Phovea-Client%20Plugin-F47D20.svg +[phovea-image-server]: https://img.shields.io/badge/Phovea-Server%20Plugin-10ACDF.svg [phovea-url]: https://phovea.caleydo.org [npm-image]: https://badge.fury.io/js/tdp_dummy.svg [npm-url]: https://npmjs.org/package/tdp_dummy -[travis-image]: https://travis-ci.org/caleydo/tdp_dummy.svg?branch=master -[travis-url]: https://travis-ci.org/caleydo/tdp_dummy -[daviddm-image]: https://david-dm.org/caleydo/tdp_dummy/status.svg -[daviddm-url]: https://david-dm.org/caleydo/tdp_dummy +[circleci-image]: https://circleci.com/gh/Caleydo/tdp_dummy.svg?style=shield +[circleci-url]: https://circleci.com/gh/Caleydo/tdp_dummy diff --git a/buildInfo.js b/buildInfo.js deleted file mode 100644 index 4e7bd68..0000000 --- a/buildInfo.js +++ /dev/null @@ -1,176 +0,0 @@ -/** - * Created by sam on 13.11.2016. - */ - -const spawnSync = require('child_process').spawnSync; -const path = require('path'); -const resolve = path.resolve; -const fs = require('fs'); - -function dependencyGraph(cwd) { - const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm'; - const r = spawnSync(npm, ['ls', '--prod', '--json'], { - cwd: cwd - }); - if (!r.stdout) { - console.error(cwd, r.error); - return {}; - } - return JSON.parse(r.stdout.toString()); -} - -function gitHead(cwd) { - if (!fs.existsSync(cwd + '/.git')) { - return null; - } - const r = spawnSync('git', ['rev-parse', '--verify', 'HEAD'], { - cwd: cwd - }); - if (!r.stdout) { - console.error(cwd, r.error); - return {}; - } - return r.stdout.toString().trim(); -} - -function resolveModules() { - const reg = fs.readFileSync('../phovea_registry.js').toString(); - const regex = /^import '(.*)\/phovea_registry.js'/gm; - const modules = []; - let r; - while ((r = regex.exec(reg)) !== null) { - modules.push(r[1]); - } - return modules; -} - -function cleanupDependency(d) { - return d; -} - -function resolveWorkspace() { - console.log('resolve parent'); - const workspaceDeps = dependencyGraph('..').dependencies; - const modules = new Set(resolveModules()); - - let deps = null; - const resolveModule = (m) => { - console.log('resolve', m); - const pkg = JSON.parse(fs.readFileSync(`../${m}/package.json`).toString()); - const head = gitHead('../' + m); - const repo = pkg.repository.url; - return { - name: pkg.name, - version: pkg.version, - resolved: head ? `${repo.endsWith('.git') ? repo.slice(0, repo.length - 4) : repo}/commit/${head}` : pkg.version, - dependencies: deps(pkg.dependencies) - }; - }; - deps = (deps) => { - const r = {}; - Object.keys(deps).forEach((d) => { - if (d in workspaceDeps) { - r[d] = cleanupDependency(workspaceDeps[d]); - delete workspaceDeps[d]; - } else if (modules.has(d)) { - modules.delete(d); - r[d] = resolveModule(d); - } else { - r[d] = '-> link'; - } - }); - return r; - }; - - // self = - const root = path.basename(process.cwd()); - console.log(root); - - modules.delete(root); - const base = resolveModule(root); - base.extraDependencies = {}; - while (modules.size > 0) { - let m = Array.from(modules.keys())[0]; - modules.delete(m); - base.extraDependencies[m] = resolveModule(m); - } - return base; -} - -function resolveSingle() { - console.log('resolve self'); - const self = dependencyGraph('.'); - const pkg = require(`./package.json`); - const head = gitHead('.'); - const deps = {}; - Object.keys(self.dependencies || {}).forEach((d) => { - deps[d] = cleanupDependency(self.dependencies[d]); - }); - return { - name: self.name, - version: pkg.version, - resolved: head ? `${pkg.repository.url}#${head}` : pkg.version, - dependencies: deps, - extraDependencies: {} - }; -} - -function generate() { - console.log('building buildInfo'); - const isWorkspaceContext = fs.existsSync('../phovea_registry.js'); - if (isWorkspaceContext) { - return resolveWorkspace(); - } - return resolveSingle(); -} - -const IS_WINDOWS = process.platform === 'win32'; - -function tmpdir() { - if (IS_WINDOWS) { - return process.env.TEMP || process.env.TMP || - (process.env.SystemRoot || process.env.windir) + '\\temp'; - } - return process.env.TMPDIR || process.env.TMP || process.env.TEMP || '/tmp'; -} - -function resolveScreenshot() { - const f = resolve(__dirname, 'media/screenshot.png'); - if (!fs.existsSync(f)) { - return null; - } - const buffer = Buffer.from(fs.readFileSync(f)).toString('base64'); - return `data:image/png;base64,${buffer}`; -} - -function metaData(pkg) { - pkg = pkg || require(`./package.json`); - return { - name: pkg.name, - displayName: pkg.displayName, - version: pkg.version, - repository: pkg.repository.url, - homepage: pkg.homepage, - description: pkg.description, - screenshot: resolveScreenshot() - }; -} - -module.exports.metaData = metaData; -module.exports.metaDataTmpFile = function (pkg) { - const s = metaData(pkg); - const file = `${tmpdir()}/metaData${Math.random().toString(36).slice(-8)}.txt`; - fs.writeFileSync(file, JSON.stringify(s, null, ' ')); - return file; -}; -module.exports.generate = generate; -module.exports.tmpFile = function () { - const s = generate(); - const file = `${tmpdir()}/buildInfo${Math.random().toString(36).slice(-8)}.txt`; - fs.writeFileSync(file, JSON.stringify(s, null, ' ')); - return file; -}; - -if (require.main === module) { - fs.writeFile('deps.json', JSON.stringify(generate(), null, ' ')); -} diff --git a/dist/base/DummyMenuSection.d.ts b/dist/base/DummyMenuSection.d.ts new file mode 100644 index 0000000..daa4772 --- /dev/null +++ b/dist/base/DummyMenuSection.d.ts @@ -0,0 +1,13 @@ +/** + * Created by Holger Stitz on 10.08.2016. + */ +import { IPluginDesc } from 'phovea_core'; +import { INamedSet } from 'tdp_core'; +import { IStartMenuSection, IStartMenuSectionOptions } from 'ordino'; +export declare class DummyMenuSection implements IStartMenuSection { + readonly desc: IPluginDesc; + private readonly idType; + private readonly list; + constructor(parent: HTMLElement, desc: IPluginDesc, options: IStartMenuSectionOptions); + push(namedSet: INamedSet): boolean; +} diff --git a/dist/base/DummyMenuSection.js b/dist/base/DummyMenuSection.js new file mode 100644 index 0000000..ecd33ae --- /dev/null +++ b/dist/base/DummyMenuSection.js @@ -0,0 +1,45 @@ +/** + * Created by Holger Stitz on 10.08.2016. + */ +import { categories } from './config'; +import { IDTypeManager } from 'phovea_core'; +import { NamedSetList } from 'tdp_core'; +export class DummyMenuSection { + constructor(parent, desc, options) { + this.desc = desc; + this.idType = IDTypeManager.getInstance().resolveIdType('IDTypeA'); + const createSession = (namedSet) => { + if (options.session) { + options.session(this.desc.viewId, { namedSet }, {}); + } + else { + console.error('no session factory object given to push new view'); + } + }; + this.list = new NamedSetList(this.idType, createSession, parent.ownerDocument); + // read species + const species = categories.slice(0); + species.unshift('all'); + // convert species to namedset + this.list.push(...species.map((d) => { + return { + name: d, + description: '', + idType: '', + ids: '', + subTypeKey: 'cat', + subTypeValue: d, + creator: '' + }; + })); + parent.appendChild(this.list.node); + } + push(namedSet) { + if (namedSet.idType !== this.idType.id) { + return false; + } + this.list.push(namedSet); + return true; + } +} +//# sourceMappingURL=DummyMenuSection.js.map \ No newline at end of file diff --git a/dist/base/DummyMenuSection.js.map b/dist/base/DummyMenuSection.js.map new file mode 100644 index 0000000..7c1dbd0 --- /dev/null +++ b/dist/base/DummyMenuSection.js.map @@ -0,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C;gBACf,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC,CAAC,CAAC,CAAC;QAEJ,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,CAAC,QAAmB;QACtB,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE;YACtC,OAAO,KAAK,CAAC;SACd;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;CACF"} \ No newline at end of file diff --git a/dist/base/DummySearchProvider.d.ts b/dist/base/DummySearchProvider.d.ts new file mode 100644 index 0000000..f2a041f --- /dev/null +++ b/dist/base/DummySearchProvider.d.ts @@ -0,0 +1,11 @@ +import { IDummyDataSource } from './config'; +import '../scss/main.scss'; +import { IResult, ISearchProvider } from 'tdp_core'; +export declare class DummySearchProvider implements ISearchProvider { + private readonly dataSource; + constructor(dataSource: IDummyDataSource); + search(query: string, page: number, pageSize: number): Promise>; + validate(query: string[]): Promise; +} +export declare function createA(): DummySearchProvider; +export declare function createB(): DummySearchProvider; diff --git a/dist/base/DummySearchProvider.js b/dist/base/DummySearchProvider.js new file mode 100644 index 0000000..84a326f --- /dev/null +++ b/dist/base/DummySearchProvider.js @@ -0,0 +1,28 @@ +import { dataSourceA, dataSourceB } from './config'; +import { RestBaseUtils } from 'tdp_core'; +import '../scss/main.scss'; +export class DummySearchProvider { + constructor(dataSource) { + this.dataSource = dataSource; + } + search(query, page, pageSize) { + return RestBaseUtils.getTDPLookup('dummy', `${this.dataSource.table}_items`, { + column: `${this.dataSource.table}_name`, + query, + page, + limit: pageSize + }); + } + validate(query) { + return RestBaseUtils.getTDPFilteredRows('dummy', `${this.dataSource.table}_items_verify`, {}, { + [`${this.dataSource.table}_name`]: query + }); + } +} +export function createA() { + return new DummySearchProvider(dataSourceA); +} +export function createB() { + return new DummySearchProvider(dataSourceB); +} +//# sourceMappingURL=DummySearchProvider.js.map \ No newline at end of file diff --git a/dist/base/DummySearchProvider.js.map b/dist/base/DummySearchProvider.js.map new file mode 100644 index 0000000..d600e3c --- /dev/null +++ b/dist/base/DummySearchProvider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DummySearchProvider.js","sourceRoot":"","sources":["../../src/base/DummySearchProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,WAAW,EAAE,WAAW,EAAC,MAAM,UAAU,CAAC;AACpE,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AACvC,OAAO,mBAAmB,CAAC;AAG3B,MAAM,OAAO,mBAAmB;IAE9B,YAA6B,UAA4B;QAA5B,eAAU,GAAV,UAAU,CAAkB;IAEzD,CAAC;IAED,MAAM,CAAC,KAAa,EAAE,IAAY,EAAE,QAAgB;QAClD,OAAO,aAAa,CAAC,YAAY,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,QAAQ,EAAE;YAC3E,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,OAAO;YACvC,KAAK;YACL,IAAI;YACJ,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAC;IACL,CAAC;IAED,QAAQ,CAAC,KAAe;QACtB,OAA2B,aAAa,CAAC,kBAAkB,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,eAAe,EAAE,EAAE,EAAE;YAChH,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,OAAO,CAAC,EAAE,KAAK;SACzC,CAAC,CAAC;IACL,CAAC;CACF;AAGD,MAAM,UAAU,OAAO;IACrB,OAAO,IAAI,mBAAmB,CAAC,WAAW,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,OAAO,IAAI,mBAAmB,CAAC,WAAW,CAAC,CAAC;AAC9C,CAAC"} \ No newline at end of file diff --git a/dist/base/config.d.ts b/dist/base/config.d.ts new file mode 100644 index 0000000..30e543d --- /dev/null +++ b/dist/base/config.d.ts @@ -0,0 +1,23 @@ +/** + * Created by Samuel Gratzl on 29.01.2016. + */ +export declare const categories: string[]; +export declare const types: string[]; +export declare const samples: string[]; +/** + * List of ids for parameter form elements + * Reuse this ids and activate the `useSession` option for form elements to have the same selectedIndex between different views + */ +export declare class ParameterFormIds { + static SAMPLE: string; + static TYPE: string; + static SCORE_ATTRIBUTE: string; + static SCORE_AGGREGATION: string; +} +export interface IDummyDataSource { + name: string; + idType: string; + table: string; +} +export declare const dataSourceA: IDummyDataSource; +export declare const dataSourceB: IDummyDataSource; diff --git a/dist/base/config.js b/dist/base/config.js new file mode 100644 index 0000000..5ef07c6 --- /dev/null +++ b/dist/base/config.js @@ -0,0 +1,28 @@ +/** + * Created by Samuel Gratzl on 29.01.2016. + */ +export const categories = ['ACat 1', 'ACat 2', 'ACat 3']; +export const types = ['ABCat 1', 'ABCat 2', 'ABCat 3']; +export const samples = ['BCatB 1', 'BCatB 2', 'BCatB 3', 'BCatB 4', 'BCatB 5']; +/** + * List of ids for parameter form elements + * Reuse this ids and activate the `useSession` option for form elements to have the same selectedIndex between different views + */ +//TODO simplify by using unique prefix to avoid collisions +export class ParameterFormIds { +} +ParameterFormIds.SAMPLE = 'dummySample'; +ParameterFormIds.TYPE = 'dummyType'; +ParameterFormIds.SCORE_ATTRIBUTE = 'dummyAttr'; +ParameterFormIds.SCORE_AGGREGATION = 'dummyAggregation'; +export const dataSourceA = { + name: 'a', + idType: 'IDTypeA', + table: 'a' +}; +export const dataSourceB = { + name: 'b', + idType: 'IDTypeB', + table: 'b' +}; +//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/dist/base/config.js.map b/dist/base/config.js.map new file mode 100644 index 0000000..d2e76bf --- /dev/null +++ b/dist/base/config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/base/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAG/E;;;GAGG;AACH,0DAA0D;AAC1D,MAAM,OAAO,gBAAgB;;AACpB,uBAAM,GAAG,aAAa,CAAC;AACvB,qBAAI,GAAG,WAAW,CAAC;AAEnB,gCAAe,GAAG,WAAW,CAAC;AAC9B,kCAAiB,GAAG,kBAAkB,CAAC;AAUhD,MAAM,CAAC,MAAM,WAAW,GAAqB;IAC3C,IAAI,EAAE,GAAG;IACT,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,GAAG;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAqB;IAC3C,IAAI,EAAE,GAAG;IACT,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,GAAG;CACX,CAAC"} \ No newline at end of file diff --git a/dist/base/index.d.ts b/dist/base/index.d.ts new file mode 100644 index 0000000..847bb7f --- /dev/null +++ b/dist/base/index.d.ts @@ -0,0 +1,3 @@ +export * from './config'; +export * from './DummyMenuSection'; +export * from './DummySearchProvider'; diff --git a/dist/base/index.js b/dist/base/index.js new file mode 100644 index 0000000..2892da7 --- /dev/null +++ b/dist/base/index.js @@ -0,0 +1,4 @@ +export * from './config'; +export * from './DummyMenuSection'; +export * from './DummySearchProvider'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/base/index.js.map b/dist/base/index.js.map new file mode 100644 index 0000000..d43d019 --- /dev/null +++ b/dist/base/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..5e4ccf2 --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,3 @@ +export * from './base'; +export * from './scores'; +export * from './views'; diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..dca4748 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,4 @@ +export * from './base'; +export * from './scores'; +export * from './views'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 0000000..be4ddb2 --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"} \ No newline at end of file diff --git a/dist/phovea.d.ts b/dist/phovea.d.ts new file mode 100644 index 0000000..e69de29 diff --git a/dist/phovea.js b/dist/phovea.js new file mode 100644 index 0000000..4306c80 --- /dev/null +++ b/dist/phovea.js @@ -0,0 +1,139 @@ +/* ***************************************************************************** + * Caleydo - Visualization for Molecular Biology - http://caleydo.org + * Copyright (c) The Caleydo Team. All rights reserved. + * Licensed under the new BSD license, available at http://caleydo.org/license + **************************************************************************** */ +//register all extensions in the registry following the given pattern +module.exports = function (registry, feature) { + //registry.push('extension-type', 'extension-id', function() { return import('./src/extension_impl'); }, {}); + // generator-phovea:begin + /// #if include('ordino') + registry.push('ordinoStartMenuSection', 'dummy_start_a', function () { + return import('./base/DummyMenuSection'); + }, { + name: 'Dummy Data', + factory: 'new DummyMenuSection', + cssClass: 'targidDummyData', + priority: 20, + viewId: 'dummy_start_a', + idType: 'IDTypeA' + }); + /// #endif + registry.push('tdpView', 'dummy_start_a', function () { + return import('./views/DummyList').then((d) => d.DummyStartList); + }, { + name: 'Dummy A', + factory: 'createStartA', + idtype: 'IDTypeA', + selection: 'none' + }); + registry.push('tdpView', 'dummy_start_B', function () { + return import('./views/DummyList').then((d) => d.DummyStartList); + }, { + name: 'Dummy B', + factory: 'createStartB', + idtype: 'IDTypeB', + selection: 'none' + }); + registry.push('tdpView', 'dummy_detail', function () { + return import('./views/DummyDetailView'); + }, { + name: 'Dummy Detail View', + factory: 'new DummyDetailView', + idtype: 'IDTypeA', + selection: '2' + }); + registry.push('tdpView', 'dummy_dependent', function () { + return import('./views/DummyDependentList'); + }, { + name: 'Dummy Dependent List', + factory: 'new DummyDependentList', + idtype: 'IDTypeA', + selection: 'some' + }); + registry.push('tdpView', 'dummyb_dependent', function () { + return import('./views/DummyDependentBList'); + }, { + name: 'Dummy Dependent List', + factory: 'new DummyDependentBList', + idtype: 'IDTypeB', + selection: 'some' + }); + registry.push('tdpView', 'dummy_composite', function () { + return import('tdp_core/dist/views/CompositeView'); + }, { + name: 'DummyComposite', + factory: 'new CompositeView', + idtype: 'IDTypeA', + selection: 'some', + elements: [ + { + key: 'a', + loader() { + return import('./views/DummyComposite'); + }, + factory: 'new DummyA' + }, + { + key: 'b', + loader() { + return import('./views/DummyComposite'); + }, + factory: 'new DummyB' + }, + { + key: 'c', + loader() { + return import('./views/DummyComposite'); + }, + factory: 'new DummyC' + } + ], + layout: { + type: 'vsplit', + keys: ['a', { type: 'hsplit', keys: ['b', 'c'] }] + } + }); + registry.push('tdpView', 'dummy_external', function () { + return import('tdp_core/dist/views/ProxyView'); + }, { + name: 'Wikipedia', + factory: 'new ProxyView', + site: 'https://wikipedia.org/w/index.php?search={id}', + argument: 'id', + idtype: 'IDTypeA', + selection: 'chooser' + }); + registry.push('tdpInstantView', 'dummy', function () { + return import('./views/DummyInstantView'); + }, { + name: 'Info', + factory: 'new DummyInstantView', + idtype: 'IDTypeA' + }); + registry.push('tdpScore', 'dummy_score', function () { + return import('./scores/DummyScore').then((d) => d.DummyScore); + }, { + name: 'Dummy Score', + idtype: 'IDTypeA' + }); + registry.push('tdpScoreImpl', 'dummy_score', function () { + return import('./scores/DummyScore').then((d) => d.DummyScore); + }, { + factory: 'createScore' + }); + registry.push('dTilesSearchProvider', 'dummyA', function () { + return import('./base/DummySearchProvider').then((d) => d.DummySearchProvider); + }, { + idType: 'IDTypeA', + factory: 'createA' + }); + registry.push('dTilesSearchProvider', 'dummyB', function () { + return import('./base/DummySearchProvider').then((d) => d.DummySearchProvider); + }, { + idType: 'IDTypeB', + factory: 'createB' + }); + // generator-phovea:end +}; +//# sourceMappingURL=phovea.js.map \ No newline at end of file diff --git a/dist/phovea.js.map b/dist/phovea.js.map new file mode 100644 index 0000000..f27880d --- /dev/null +++ b/dist/phovea.js.map @@ -0,0 +1 @@ +{"version":3,"file":"phovea.js","sourceRoot":"","sources":["../src/phovea.ts"],"names":[],"mappings":"AAAA;;;;gFAIgF;AAEhF,qEAAqE;AACrE,MAAM,CAAC,OAAO,GAAG,UAAU,QAAQ,EAAE,OAAO;IAC1C,6GAA6G;IAC7G,yBAAyB;IAGzB,yBAAyB;IACzB,QAAQ,CAAC,IAAI,CAAC,wBAAwB,EAAE,eAAe,EAAE;QACvD,OAAO,MAAM,CAAC,yBAAyB,CAAC,CAAC;IAC3C,CAAC,EAAE;QACA,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,sBAAsB;QAC/B,QAAQ,EAAE,iBAAiB;QAC3B,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE,SAAS;KACnB,CAAC,CAAC;IACH,UAAU;IAEV,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,EAAE;QACxC,OAAO,MAAM,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IACnE,CAAC,EAAE;QACA,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,cAAc;QACvB,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,MAAM;KACnB,CAAC,CAA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C,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IACjE,CAAC,EAAE;QACA,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE,SAAS;KACnB,CAAC,CAAC;IACH,QAAQ,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,EAAE;QAC3C,OAAO,MAAM,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IACjE,CAAC,EAAE;QACD,OAAO,EAAE,aAAa;KACvB,CAAC,CAAC;IAEH,QAAQ,CAAC,IAAI,CAAC,sBAAsB,EAAE,QAAQ,EAAE;QAC9C,OAAO,MAAM,CAAC,4BAA4B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC;IACjF,CAAC,EAAE;QACD,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,SAAS;KACnB,CAAC,CAAC;IAEH,QAAQ,CAAC,IAAI,CAAC,sBAAsB,EAAE,QAAQ,EAAE;QAC9C,OAAO,MAAM,CAAC,4BAA4B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC;IACjF,CAAC,EAAE;QACD,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,SAAS;KACnB,CAAC,CAAC;IACH,uBAAuB;AACzB,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/scores/DummyScore.d.ts b/dist/scores/DummyScore.d.ts new file mode 100644 index 0000000..86f5b08 --- /dev/null +++ b/dist/scores/DummyScore.d.ts @@ -0,0 +1,25 @@ +/** + * Created by Samuel Gratzl on 27.04.2016. + */ +import { IScore, IScoreParam } from 'tdp_core'; +export declare class DummyScore implements IScore { + private readonly score; + private readonly tumorSample; + private readonly aggregation; + private readonly dataSource; + constructor(table: 'a' | 'b', score: string, tumorSample: string, aggregation: string); + get idType(): import("phovea_core").IDType; + createDesc(): { + type: string; + label: string; + domain: number[]; + }; + compute(): Promise; + static createScore(params: { + table: 'a' | 'b'; + score: string; + tumorSample: string; + aggregation: string; + }): DummyScore; + static create(desc: any): Promise; +} diff --git a/dist/scores/DummyScore.js b/dist/scores/DummyScore.js new file mode 100644 index 0000000..3300dd5 --- /dev/null +++ b/dist/scores/DummyScore.js @@ -0,0 +1,86 @@ +/** + * Created by Samuel Gratzl on 27.04.2016. + */ +import { samples, ParameterFormIds, dataSourceA, dataSourceB } from '../base/config'; +import { IDTypeManager } from 'phovea_core'; +import { FormDialog, FormElementType } from 'tdp_core'; +import { RestBaseUtils } from 'tdp_core'; +export class DummyScore { + constructor(table, score, tumorSample, aggregation) { + this.score = score; + this.tumorSample = tumorSample; + this.aggregation = aggregation; + this.dataSource = table === 'a' ? dataSourceA : dataSourceB; + } + get idType() { + return IDTypeManager.getInstance().resolveIdType(this.dataSource.idType); + } + createDesc() { + return { + type: 'number', + label: `${this.aggregation} ${this.score} @ ${this.tumorSample}`, + domain: this.score === 'ab_int' ? [0, 100] : [-1, 1] + }; + } + compute() { + return RestBaseUtils.getTDPScore('dummy', `${this.dataSource.table}_score`, { + data_subtype: this.score, + agg: this.aggregation, + filter_b_cat2: this.tumorSample + }); + } + static createScore(params) { + return new DummyScore(params.table, params.score, params.tumorSample, params.aggregation); + } + static create(desc) { + const table = desc.idType === dataSourceA.idType ? 'a' : 'b'; + const dialog = new FormDialog('Add Score Column', 'Add Score Column'); + const formDesc = [ + { + type: FormElementType.SELECT, + label: 'Sample', + id: ParameterFormIds.SAMPLE, + options: { + optionsData: samples + }, + useSession: true + }, + { + type: FormElementType.SELECT, + label: 'Score', + id: ParameterFormIds.SCORE_ATTRIBUTE, + options: { + optionsData: [ + { value: 'ab_real', name: 'Real', data: 'ab_real' }, + { value: 'ab_int', name: 'Int', data: 'ab_int' } + ] + }, + useSession: true + }, + { + type: FormElementType.SELECT, + label: 'Aggregation', + id: ParameterFormIds.SCORE_AGGREGATION, + options: { + optionsData: [ + { value: 'avg', name: 'AVG', data: 'avg' }, + { value: 'min', name: 'MIN', data: 'min' }, + { value: 'max', name: 'MAX', data: 'max' } + ] + }, + useSession: true + } + ]; + dialog.append(...formDesc); + return dialog.showAsPromise((builder) => { + const data = builder.getElementData(); + return { + table, + score: data[ParameterFormIds.SCORE_ATTRIBUTE], + tumorSample: data[ParameterFormIds.SAMPLE], + aggregation: data[ParameterFormIds.SCORE_AGGREGATION] + }; + }); + } +} +//# sourceMappingURL=DummyScore.js.map \ No newline at end of file diff --git a/dist/scores/DummyScore.js.map b/dist/scores/DummyScore.js.map new file mode 100644 index 0000000..c18c6f0 --- /dev/null +++ b/dist/scores/DummyScore.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DummyScore.js","sourceRoot":"","sources":["../../src/scores/DummyScore.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAC,OAAO,EAAE,gBAAgB,EAAoB,WAAW,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AACrG,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAC,UAAU,EAAoB,eAAe,EAAC,MAAM,UAAU,CAAC;AACvE,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,MAAM,OAAO,UAAU;IAGrB,YAAY,KAAgB,EAAmB,KAAa,EAAmB,WAAmB,EAAmB,WAAmB;QAAzF,UAAK,GAAL,KAAK,CAAQ;QAAmB,gBAAW,GAAX,WAAW,CAAQ;QAAmB,gBAAW,GAAX,WAAW,CAAQ;QACtI,IAAI,CAAC,UAAU,GAAG,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC;IAC9D,CAAC;IAED,IAAI,MAAM;QACR,OAAO,aAAa,CAAC,WAAW,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC3E,CA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d.ts b/dist/scores/index.d.ts new file mode 100644 index 0000000..680f3c6 --- /dev/null +++ b/dist/scores/index.d.ts @@ -0,0 +1 @@ +export * from './DummyScore'; diff --git a/dist/scores/index.js b/dist/scores/index.js new file mode 100644 index 0000000..111ce91 --- /dev/null +++ b/dist/scores/index.js @@ -0,0 +1,2 @@ +export * from './DummyScore'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/scores/index.js.map b/dist/scores/index.js.map new file mode 100644 index 0000000..d4215e4 --- /dev/null +++ b/dist/scores/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scores/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"} \ No newline at end of file diff --git a/src/styles/_idtype_color.scss b/dist/scss/_idtype_color.scss similarity index 68% rename from src/styles/_idtype_color.scss rename to dist/scss/_idtype_color.scss index c1d66a6..715f38e 100644 --- a/src/styles/_idtype_color.scss +++ b/dist/scss/_idtype_color.scss @@ -1,4 +1,4 @@ -@import "~tdp_core/src/styles/idtype_color"; +@import "~tdp_core/dist/scss/idtype_color"; * { @include idtype_color('IDTypeA', #73dbff); diff --git a/src/style.scss b/dist/scss/main.scss similarity index 61% rename from src/style.scss rename to dist/scss/main.scss index 420da97..1fbea77 100644 --- a/src/style.scss +++ b/dist/scss/main.scss @@ -1,4 +1,4 @@ /** * Created by Samuel Gratzl on 16.12.2015 */ -@import 'styles/idtype_color'; +@import './idtype_color'; diff --git a/dist/views/DummyComposite.d.ts b/dist/views/DummyComposite.d.ts new file mode 100644 index 0000000..992b2da --- /dev/null +++ b/dist/views/DummyComposite.d.ts @@ -0,0 +1,12 @@ +import { ATableView } from 'tdp_core'; +import { AView } from 'tdp_core'; +export declare class DummyA extends AView { + initImpl(): void; +} +export declare class DummyB extends ATableView { + protected loadRows(): any[]; + protected sharedChanged(name: string): void; +} +export declare class DummyC extends AView { + initImpl(): void; +} diff --git a/dist/views/DummyComposite.js b/dist/views/DummyComposite.js new file mode 100644 index 0000000..d1a346d --- /dev/null +++ b/dist/views/DummyComposite.js @@ -0,0 +1,45 @@ +import { ATableView } from 'tdp_core'; +import { AView } from 'tdp_core'; +import { CompositeView } from 'tdp_core'; +export class DummyA extends AView { + initImpl() { + super.initImpl(); + this.node.innerHTML = 'A'; + let i = 0; + this.node.onclick = () => { + this.updateShared('SHARED', (i++)); + if (i === 2) { + this.fire(CompositeView.VIEW_COMPOSITE_EVENT_CHANGE_RATIOS, 0.2, 0.8); + } + }; + } +} +export class DummyB extends ATableView { + loadRows() { + const v = this.getShared('SHARED') || 1; + const r = []; + for (let i = 0; i < v; ++i) { + r.push({ id: 'a', _id: -1, v: String(v) }); + } + return r; + } + sharedChanged(name) { + if (name === 'SHARED') { + this.reloadData(); + } + } +} +export class DummyC extends AView { + initImpl() { + super.initImpl(); + this.node.innerHTML = 'CCC'; + let i = 0; + this.node.onclick = () => { + this.updateShared('SHARED2', (i++)); + if (i === 2) { + this.fire(CompositeView.VIEW_COMPOSITE_EVENT_CHANGE_RATIOS, 0.2, 0.8); + } + }; + } +} +//# sourceMappingURL=DummyComposite.js.map \ No newline at end of file diff --git a/dist/views/DummyComposite.js.map b/dist/views/DummyComposite.js.map new file mode 100644 index 0000000..efa32d7 --- /dev/null +++ b/dist/views/DummyComposite.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DummyComposite.js","sourceRoot":"","sources":["../../src/views/DummyComposite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAGvC,MAAM,OAAO,MAAO,SAAQ,KAAK;IAC/B,QAAQ;QACN,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;QAC1B,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,IAA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AkC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aACvE;QACH,CAAC,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/dist/views/DummyDependentBList.d.ts b/dist/views/DummyDependentBList.d.ts new file mode 100644 index 0000000..e4a4e32 --- /dev/null +++ b/dist/views/DummyDependentBList.d.ts @@ -0,0 +1,10 @@ +import { ARankingView } from 'tdp_core'; +export declare class DummyDependentBList extends ARankingView { + protected getParameterFormDescs(): import("tdp_core").IFormElementDesc[]; + get itemIDType(): import("phovea_core").IDType; + protected loadColumnDesc(): Promise>; + protected loadRows(): Promise; + protected createSelectionAdapter(): import("tdp_core").ISelectionAdapter; + private static getSelectionColumnDesc; + private loadSelectionColumnData; +} diff --git a/dist/views/DummyDependentBList.js b/dist/views/DummyDependentBList.js new file mode 100644 index 0000000..f233653 --- /dev/null +++ b/dist/views/DummyDependentBList.js @@ -0,0 +1,54 @@ +/** + * Created by Samuel Gratzl on 29.01.2016. + */ +import { types, dataSourceA, ParameterFormIds } from '../base/config'; +import { FormElementType } from 'tdp_core'; +import { AdapterUtils, ARankingView, ColumnDescUtils } from 'tdp_core'; +import { RestBaseUtils } from 'tdp_core'; +import { IDTypeManager } from 'phovea_core'; +export class DummyDependentBList extends ARankingView { + getParameterFormDescs() { + return super.getParameterFormDescs().concat([ + { + type: FormElementType.SELECT, + label: 'Type', + id: ParameterFormIds.TYPE, + options: { + optionsData: types + }, + useSession: true + } + ]); + } + get itemIDType() { + return IDTypeManager.getInstance().resolveIdType(dataSourceA.idType); + } + loadColumnDesc() { + return RestBaseUtils.getTDPDesc('dummy', 'a'); + } + loadRows() { + return RestBaseUtils.getTDPRows('dummy', 'a'); + } + createSelectionAdapter() { + return AdapterUtils.single({ + loadData: (_id, id) => this.loadSelectionColumnData(id), + createDesc: (_id, id) => DummyDependentBList.getSelectionColumnDesc(_id, id) + }); + } + static getSelectionColumnDesc(_id, label) { + const s = ColumnDescUtils.numberCol(`col_${_id}`, 0, 1, { label }); + s.constantDomain = true; + return s; + } + loadSelectionColumnData(name) { + const param = { + attribute: 'ab_real', + name + }; + const filters = { + ab_cat: this.getParameterData(ParameterFormIds.TYPE) + }; + return RestBaseUtils.getTDPScore('dummy', 'a_single_score', param, filters); + } +} +//# sourceMappingURL=DummyDependentBList.js.map \ No newline at end of file diff --git a/dist/views/DummyDependentBList.js.map b/dist/views/DummyDependentBList.js.map new file mode 100644 index 0000000..afa5e51 --- /dev/null +++ b/dist/views/DummyDependentBList.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DummyDependentBList.js","sourceRoot":"","sources":["../../src/views/DummyDependentBList.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAC,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AACzC,OAAO,EAAC,YAAY,EAAE,YAAY,EAAE,eAAe,EAAC,MAAM,UAAU,CAAC;AACrE,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AACvC,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,mBAAoB,SAAQ,YAAY;IAEzC,qBAAqB;QAC7B,OAAO,KAAK,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC;YAC1C;gBACE,IAAI,EAAE,eAAe,CAAC,MAAM;gBAC5B,KAAK,EAAE,MAAM;gBACb,EAAE,EAAE,gBAAgB,CAAC,IAAI;gBACzB,OAAO,EAAE;oBACP,WAAW,EAAE,KAAK;iBACnB;gBACD,UAAU,EAAE,IAAI;aACjB;SACF,CAAC,CAAC;IACL,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,aAAa,CAAC,WAAW,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACvE,CAAC;IAES,cAAc;QACtB,OAAO,aAAa,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAChD,CAAC;IAES,QAAQ;QAChB,OAAO,aAAa,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAChD,CAAC;IAES,sBAAsB;QAC9B,OAAO,YAAY,CAAC,MAAM,CAAC;YACzB,QAAQ,EAAE,CAAC,GAAW,EAAE,EAAU,EAAE,EAAE,CAAC,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC;YACvE,UAAU,EAAE,CAAC,GAAW,EAAE,EAAU,EAAE,EAAE,CAAC,mBAAmB,CAAC,sBAAsB,CAAC,GAAG,EAAE,EAAE,CAAC;SAC7F,CAAC,CAAC;IACL,CAAC;IAEO,MAAM,CAAC,sBAAsB,CAAC,GAAW,EAAE,KAAa;QAC9D,MAAM,CAAC,GAAQ,eAAe,CAAC,SAAS,CAAC,OAAO,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAC,KAAK,EAAC,CAAC,CAAC;QACtE,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC;QACxB,OAAO,CAAC,CAAC;IACX,CAAC;IAEO,uBAAuB,CAAC,IAAY;QAC1C,MAAM,KAAK,GAAG;YACZ,SAAS,EAAE,SAAS;YACpB,IAAI;SACL,CAAC;QACF,MAAM,OAAO,GAAG;YACd,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,IAAI,CAAC;SACrD,CAAC;QACF,OAAO,aAAa,CAAC,WAAW,CAAS,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACtF,CAAC;CACF"} \ No newline at end of file diff --git a/dist/views/DummyDependentList.d.ts b/dist/views/DummyDependentList.d.ts new file mode 100644 index 0000000..4d663ba --- /dev/null +++ b/dist/views/DummyDependentList.d.ts @@ -0,0 +1,10 @@ +import { ARankingView } from 'tdp_core'; +export declare class DummyDependentList extends ARankingView { + protected getParameterFormDescs(): import("tdp_core").IFormElementDesc[]; + get itemIDType(): import("phovea_core").IDType; + protected loadColumnDesc(): Promise>; + protected loadRows(): Promise; + protected createSelectionAdapter(): import("tdp_core").ISelectionAdapter; + private static getSelectionColumnDesc; + private loadSelectionColumnData; +} diff --git a/dist/views/DummyDependentList.js b/dist/views/DummyDependentList.js new file mode 100644 index 0000000..cea7bb2 --- /dev/null +++ b/dist/views/DummyDependentList.js @@ -0,0 +1,64 @@ +/** + * Created by Samuel Gratzl on 29.01.2016. + */ +import { types, samples, ParameterFormIds, dataSourceB } from '../base/config'; +import { FormElementType } from 'tdp_core'; +import { ARankingView, AdapterUtils, ColumnDescUtils } from 'tdp_core'; +import { RestBaseUtils } from 'tdp_core'; +import { IDTypeManager } from 'phovea_core'; +export class DummyDependentList extends ARankingView { + getParameterFormDescs() { + return super.getParameterFormDescs().concat([ + { + type: FormElementType.SELECT, + label: 'Type', + id: ParameterFormIds.TYPE, + options: { + optionsData: types + }, + useSession: true + }, + { + type: FormElementType.SELECT, + label: 'Sample Type', + id: ParameterFormIds.SAMPLE, + options: { + optionsData: samples + }, + useSession: true + } + ]); + } + get itemIDType() { + return IDTypeManager.getInstance().resolveIdType(dataSourceB.idType); + } + loadColumnDesc() { + return RestBaseUtils.getTDPDesc('dummy', 'b'); + } + loadRows() { + return RestBaseUtils.getTDPRows('dummy', 'b'); + } + createSelectionAdapter() { + return AdapterUtils.single({ + loadData: (_id, id) => this.loadSelectionColumnData(id), + createDesc: (_id, id) => DummyDependentList.getSelectionColumnDesc(_id, id) + }); + } + static getSelectionColumnDesc(_id, label) { + const s = ColumnDescUtils.numberCol(`col_${_id}`, 0, 1, { label }); + s.constantDomain = true; + return s; + } + loadSelectionColumnData(name) { + const param = { + attribute: 'ab_real', + name + }; + const filters = { + ab_cat: this.getParameterData(ParameterFormIds.TYPE), + b_cat2: this.getParameterData(ParameterFormIds.SAMPLE), + }; + return RestBaseUtils.getTDPScore('dummy', 'b_single_score', param, filters); + } +} +//# sourceMappingURL=DummyDependentList.js.map \ No newline at end of file diff --git a/dist/views/DummyDependentList.js.map b/dist/views/DummyDependentList.js.map new file mode 100644 index 0000000..a7d2303 --- /dev/null +++ b/dist/views/DummyDependentList.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DummyDependentList.js","sourceRoot":"","sources":["../../src/views/DummyDependentList.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AACzC,OAAO,EAAC,YAAY,EAAE,YAAY,EAAE,eAAe,EAAC,MAAM,UAAU,CAAC;AACrE,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AACvC,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,kBAAmB,SAAQ,YAAY;IAExC,qBAAqB;QAC7B,OAAO,KAAK,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC;YAC1C;gBACE,IAAI,EAAE,eAAe,CAAC,MAAM;gBAC5B,KAAK,EAAE,MAAM;gBACb,EAAE,EAAE,gBAAgB,CAAC,IAAI;gBACzB,OAAO,EAAE;oBACP,WAAW,EAAE,KAAK;iBACnB;gBACD,UAAU,EAAE,IAAI;aACjB;YACD;gBACE,IAAI,EAAE,eAAe,CAAC,MAAM;gBAC5B,KAAK,EAAE,aAAa;gBACpB,EAAE,EAAE,gBAAgB,CAAC,MAAM;gBAC3B,OAAO,EAAE;oBACP,WAAW,EAAE,OAAO;iBACrB;gBACD,UAAU,EAAE,IAAI;aACjB;SACF,CAAC,CAAC;IACL,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,aAAa,CAAC,WAAW,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACvE,CAAC;IAES,cAAc;QACtB,OAAO,aAAa,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAChD,CAAC;IAES,QAAQ;QAChB,OAAO,aAAa,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAChD,CAAC;IAES,sBAAsB;QAC9B,OAAO,YAAY,CAAC,MAAM,CAAC;YACzB,QAAQ,EAAE,CAAC,GAAW,EAAE,EAAU,EAAE,EAAE,CAAC,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC;YACvE,UAAU,EAAE,CAAC,GAAW,EAAE,EAAU,EAAE,EAAE,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,GAAG,EAAE,EAAE,CAAC;SAC5F,CAAC,CAAC;IACL,CAAC;IAEO,MAAM,CAAC,sBAAsB,CAAC,GAAW,EAAE,KAAa;QAC9D,MAAM,CAAC,GAAQ,eAAe,CAAC,SAAS,CAAC,OAAO,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAC,KAAK,EAAC,CAAC,CAAC;QACtE,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC;QACxB,OAAO,CAAC,CAAC;IACX,CAAC;IAEO,uBAAuB,CAAC,IAAY;QAC1C,MAAM,KAAK,GAAG;YACZ,SAAS,EAAE,SAAS;YACpB,IAAI;SACL,CAAC;QACF,MAAM,OAAO,GAAG;YACd,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,IAAI,CAAC;YACpD,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,MAAM,CAAC;SACvD,CAAC;QACF,OAAO,aAAa,CAAC,WAAW,CAAS,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACtF,CAAC;CACF"} \ No newline at end of file diff --git a/dist/views/DummyDetailView.d.ts b/dist/views/DummyDetailView.d.ts new file mode 100644 index 0000000..fba44c5 --- /dev/null +++ b/dist/views/DummyDetailView.d.ts @@ -0,0 +1,19 @@ +/** + * Created by Samuel Gratzl on 27.04.2016. + */ +import '../scss/main.scss'; +import { AD3View } from 'tdp_core'; +export declare class DummyDetailView extends AD3View { + private readonly x; + private readonly y; + private readonly xAxis; + private readonly yAxis; + protected initImpl(): Promise<{ + value1: number; + value2: number; + }[]>; + private build; + private updateChart; + selectionChanged(): void; + private update; +} diff --git a/dist/views/DummyDetailView.js b/dist/views/DummyDetailView.js new file mode 100644 index 0000000..66ce324 --- /dev/null +++ b/dist/views/DummyDetailView.js @@ -0,0 +1,81 @@ +/** + * Created by Samuel Gratzl on 27.04.2016. + */ +import '../scss/main.scss'; +import { AD3View } from 'tdp_core'; +import { ErrorAlertHandler } from 'tdp_core'; +import * as d3 from 'd3'; +import { RestBaseUtils } from 'tdp_core'; +export class DummyDetailView extends AD3View { + constructor() { + super(...arguments); + this.x = d3.scale.linear(); + this.y = d3.scale.linear(); + this.xAxis = d3.svg.axis().orient('bottom').scale(this.x); + this.yAxis = d3.svg.axis().orient('left').scale(this.y); + } + initImpl() { + super.initImpl(); + this.$node.classed('dummy-detail', true); + this.build(); + return this.update(); + } + build() { + const margin = { top: 10, right: 30, bottom: 30, left: 30 }, width = 960 - margin.left - margin.right, height = 500 - margin.top - margin.bottom; + const svg = this.$node.append('svg') + .attr('width', width + margin.left + margin.right) + .attr('height', height + margin.top + margin.bottom) + .append('g') + .attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + this.x.range([0, width]); + this.y.range([height, 0]); + svg.append('g') + .attr('class', 'x axis') + .attr('transform', 'translate(0,' + height + ')'); + svg.append('g') + .attr('class', 'y axis'); + } + updateChart(xlabel, ylabel, rows) { + this.x.domain(d3.extent(rows, (d) => d.value1)); + this.y.domain(d3.extent(rows, (d) => d.value2)); + const svg = this.$node.select('svg g'); + svg.select('g.x.axis').call(this.xAxis); + svg.select('g.y.axis').call(this.yAxis); + const marks = svg.selectAll('.mark').data(rows); + marks.enter().append('circle').classed('mark', true).attr('r', 5); + marks.transition().attr({ + cx: (d) => this.x(d.value1), + cy: (d) => this.y(d.value2), + }); + marks.exit().remove(); + } + selectionChanged() { + super.selectionChanged(); + this.update(); + } + update() { + this.setBusy(true); + let names = null; + const promise = this.resolveSelection() + .then((_names) => { + names = _names; + return RestBaseUtils.getTDPData('dummy', 'dummy_detail', { + a_id1: _names[0], + a_id2: _names[1] + }); + }); + // on success + promise.then((rows) => { + this.updateChart(names[0], names[1], rows); + this.setBusy(false); + }); + // on error + promise.catch(ErrorAlertHandler.getInstance().errorAlert) + .catch((error) => { + console.error(error); + this.setBusy(false); + }); + return promise; + } +} +//# sourceMappingURL=DummyDetailView.js.map \ No newline at end of file diff --git a/dist/views/DummyDetailView.js.map b/dist/views/DummyDetailView.js.map new file mode 100644 index 0000000..c2ea313 --- /dev/null +++ b/dist/views/DummyDetailView.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DummyDetailView.js","sourceRoot":"","sources":["../../src/views/DummyDetailView.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AACjC,OAAO,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,MAAM,OAAO,eAAgB,SAAQ,OAAO;IAA5C;;QAEmB,MAAC,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QACtB,MAAC,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QACtB,UAAK,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACrD,UAAK,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAqFtE,CAAC;IAnFW,QAAQ;QAChB,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjB,IAAI,CAA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,KAAK,CAAC,gBAAgB,EAAE,CAAC;QACzB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAEO,MAAM;QACZ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACnB,IAAI,KAAK,GAAa,IAAI,CAAC;QAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,EAAE;aACpC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACf,KAAK,GAAG,MAAM,CAAC;YACf,OAAO,aAAa,CAAC,UAAU,CAAqC,OAAO,EAAE,cAAc,EAAE;gBAC3F,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;gBAChB,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;aACjB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEL,aAAa;QACb,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YACpB,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;YAC3C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,WAAW;QACX,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC;aACtD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;QAEL,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"} \ No newline at end of file diff --git a/dist/views/DummyInstantView.d.ts b/dist/views/DummyInstantView.d.ts new file mode 100644 index 0000000..bc287de --- /dev/null +++ b/dist/views/DummyInstantView.d.ts @@ -0,0 +1,5 @@ +import { AInstantView } from 'tdp_core'; +export declare class DummyInstantView extends AInstantView { + protected initImpl(): void; + private build; +} diff --git a/dist/views/DummyInstantView.js b/dist/views/DummyInstantView.js new file mode 100644 index 0000000..6a20ba5 --- /dev/null +++ b/dist/views/DummyInstantView.js @@ -0,0 +1,27 @@ +import { AInstantView } from 'tdp_core'; +export class DummyInstantView extends AInstantView { + initImpl() { + super.initImpl(); + this.build(); + } + build() { + const items = this.selection.items; + this.node.innerHTML = ` + + + + ${items.map((d) => ``).join('')} + + + + ${items.map((d) => ``).join('')} + + + + ${items.map((d) => ``).join('')} + + +
ID${d._id}
Name${d.id}
Label${d.text}
`; + } +} +//# sourceMappingURL=DummyInstantView.js.map \ No newline at end of file diff --git a/dist/views/DummyInstantView.js.map b/dist/views/DummyInstantView.js.map new file mode 100644 index 0000000..8bdb1f2 --- /dev/null +++ b/dist/views/DummyInstantView.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DummyInstantView.js","sourceRoot":"","sources":["../../src/views/DummyInstantView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAGtC,MAAM,OAAO,gBAAiB,SAAQ,YAAY;IAEtC,QAAQ;QAChB,KAAK,CAAC,QAAQ,EAAE,CAAC;QAEjB,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAEO,KAAK;QACX,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;QACnC,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG;;;;cAIZ,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;;;;cAI9C,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;;;;cAI7C,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;;;aAGhD,CAAC;IACZ,CAAC;CACF"} \ No newline at end of file diff --git a/dist/views/DummyList.d.ts b/dist/views/DummyList.d.ts new file mode 100644 index 0000000..3d4fbf4 --- /dev/null +++ b/dist/views/DummyList.d.ts @@ -0,0 +1,14 @@ +/** + * Created by Samuel Gratzl on 29.01.2016. + */ +import { IViewContext, ISelection } from 'tdp_core'; +import { IDummyDataSource } from '../base/config'; +import { AStartList } from 'tdp_core'; +export declare class DummyStartList extends AStartList { + private readonly dataSource; + constructor(context: IViewContext, dataSource: IDummyDataSource, selection: ISelection, parent: HTMLElement, options?: {}); + protected loadColumnDesc(): Promise>; + protected loadRows(): Promise; + static createStartA(context: IViewContext, selection: ISelection, parent: HTMLElement, options?: any): DummyStartList; + static createStartB(context: IViewContext, selection: ISelection, parent: HTMLElement, options?: any): DummyStartList; +} diff --git a/dist/views/DummyList.js b/dist/views/DummyList.js new file mode 100644 index 0000000..6944a5b --- /dev/null +++ b/dist/views/DummyList.js @@ -0,0 +1,26 @@ +import { dataSourceA, dataSourceB } from '../base/config'; +import { RestBaseUtils } from 'tdp_core'; +import { AStartList } from 'tdp_core'; +export class DummyStartList extends AStartList { + constructor(context, dataSource, selection, parent, options = {}) { + super(context, selection, parent, Object.assign({ + itemName: dataSource.name, + itemIDType: dataSource.idType + }, options)); + this.dataSource = dataSource; + } + loadColumnDesc() { + return RestBaseUtils.getTDPDesc('dummy', this.dataSource.table); + } + loadRows() { + const filters = this.buildNamedSetFilters('namedset4id'); + return RestBaseUtils.getTDPFilteredRows('dummy', this.dataSource.table, {}, filters); + } + static createStartA(context, selection, parent, options) { + return new DummyStartList(context, dataSourceA, selection, parent, options); + } + static createStartB(context, selection, parent, options) { + return new DummyStartList(context, dataSourceB, selection, parent, options); + } +} +//# sourceMappingURL=DummyList.js.map \ No newline at end of file diff --git a/dist/views/DummyList.js.map b/dist/views/DummyList.js.map new file mode 100644 index 0000000..da35590 --- /dev/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,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9E,CAAC;CACF"} \ No newline at end of file diff --git a/dist/views/index.d.ts b/dist/views/index.d.ts new file mode 100644 index 0000000..734adb6 --- /dev/null +++ b/dist/views/index.d.ts @@ -0,0 +1,6 @@ +export * from './DummyComposite'; +export * from './DummyDependentBList'; +export * from './DummyDependentList'; +export * from './DummyDetailView'; +export * from './DummyInstantView'; +export * from './DummyList'; diff --git a/dist/views/index.js b/dist/views/index.js new file mode 100644 index 0000000..3ea8c71 --- /dev/null +++ b/dist/views/index.js @@ -0,0 +1,7 @@ +export * from './DummyComposite'; +export * from './DummyDependentBList'; +export * from './DummyDependentList'; +export * from './DummyDetailView'; +export * from './DummyInstantView'; +export * from './DummyList'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/views/index.js.map b/dist/views/index.js.map new file mode 100644 index 0000000..01d7da5 --- /dev/null +++ b/dist/views/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/views/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 61859c3..0000000 --- a/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/* ***************************************************************************** - * Caleydo - Visualization for Molecular Biology - http://caleydo.org - * Copyright (c) The Caleydo Team. All rights reserved. - * Licensed under the new BSD license, available at http://caleydo.org/license - **************************************************************************** */ - -/** - * generates and object that contain all modules in the src folder accessible as properties - */ - -/** - * magic file name for the pseudo root file - * @type {string} - */ -var INDEX_FILE = './index.ts'; -/** - * sorts the given filename by name ensuring INDEX is the first one - * @param a - * @param b - * @returns {number} - */ -function byName(a, b) { - if (a === INDEX_FILE) { - return a === b ? 0 : -1; - } - if (b === INDEX_FILE) { - return 1; - } - return a.toLowerCase().localeCompare(b.toLowerCase()); -} -// list all modules in the src folder excluding the one starting with _ -var req = require.context('./src', true, /^\.\/(?!internal)(([^_][\w]+)|(\w+\/index))\.tsx?$/); - -var files = req.keys().sort(byName); - -// root file exists? else use anonymous root object -if (files[0] === INDEX_FILE) { - module.exports = req(files.shift()); -} else { - module.exports = {}; -} - -// generate getter for all modules -files.forEach(function (f) { - Object.defineProperty(module.exports, f.substring(2, f.lastIndexOf('/index.') > 0 ? f.lastIndexOf('/index.') : f.lastIndexOf('.')), { - get: function () { - return req(f); - }, - enumerable: true - }); -}); diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000..8024c72 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,49 @@ +// test dependencies that require transformation +let pluginsToTransform = [ + 'tdp_*', + 'phovea_*', + 'lineupjs' +].join('|'); + +if(pluginsToTransform.length > 0) { + /** Attention: Negative Lookahead! This regex adds the specified repos to a whitelist that holds plugins that are excluded from the transformIgnorePatterns. + * This means that pluginsToTransform should contain all repos that export ts files. They can only be handled by the transformation. */ + pluginsToTransform = `(?!${pluginsToTransform})`; +} + +/** + * TODO check if we can process inline webpack loaders (e.g. as found in https://github.com/phovea/phovea_ui/blob/master/src/_bootstrap.ts) + * see also https://jestjs.io/docs/en/webpack#mocking-css-modules + */ +module.exports = { + transform: { + "^.+\\.(js|ts|tsx)$": "ts-jest", + "\\.xml$": "jest-raw-loader" + }, + testRegex: "(.*(test|spec))\\.(tsx?)$", + moduleFileExtensions: [ + "ts", + "tsx", + "js", + "jsx", + "json", + "node" + ], + modulePaths: [ + "src" + ], + transformIgnorePatterns: [`../node_modules/${pluginsToTransform}`, `node_modules/${pluginsToTransform}`], + globals: { + "__VERSION__": "TEST_VERSION", + "__APP_CONTEXT__": "TEST_CONTEXT", + // has to be set to true, otherwise i18n import fails + "ts-jest": { + "tsConfig": { + "esModuleInterop": true + } + } + }, + moduleNameMapper: { + "^.+\\.(css|less|scss|sass|png|jpg|gif)$": "identity-obj-proxy" + } +} \ No newline at end of file diff --git a/karma.conf.js b/karma.conf.js deleted file mode 100644 index eb434ab..0000000 --- a/karma.conf.js +++ /dev/null @@ -1,52 +0,0 @@ -/* ***************************************************************************** - * Caleydo - Visualization for Molecular Biology - http://caleydo.org - * Copyright (c) The Caleydo Team. All rights reserved. - * Licensed under the new BSD license, available at http://caleydo.org/license - **************************************************************************** */ - -const webpack = require('./webpack.config.js'); - -module.exports = (config) => { - config.set({ - // frameworks to use - // available frameworks: https://npmjs.org/browse/keyword/karma-adapter - frameworks: ['jasmine'], - - // list of files / patterns to load in the browser - files: [ - 'tests.webpack.js' // just load this file - ], - - // preprocess matching files before serving them to the browser - // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor - preprocessors: { - // add webpack as preprocessor - 'tests.webpack.js': ['webpack', 'sourcemap'] - }, - - webpack: webpack('test'), - - failOnEmptyTestSuite: false, - - // test results reporter to use - // possible values: 'dots', 'progress' - // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['progress'], - - // enable / disable watching file and executing tests whenever any file changes - autoWatch: false, - - // middleware: ['polyfill'], - // BUG that install everything "karma-polyfill-service": "github:sgratzl/karma-polyfill-service", - polyfill: { - // features: '', // feature set, see polyfill-service docs for details, defaults to `{default: {}}` - // path: '' // path to serve the polyfill script under, defaults to '/polyfill.js' - }, - - browsers: [process.env.CONTINUOUS_INTEGRATION ? 'Firefox' : 'Chrome'], - - // Continuous Integration mode - // if true, Karma captures browsers, runs the tests and exits - singleRun: true - }); -}; diff --git a/package.json b/package.json index 7fc9227..272e5c5 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "tdp_dummy", "description": "", "homepage": "https://phovea.caleydo.org", - "version": "7.0.0", + "version": "8.0.0", "author": { "name": "The Caleydo Team", "email": "contact@caleydo.org", @@ -16,7 +16,8 @@ "type": "git", "url": "https://github.com/caleydo/tdp_dummy.git" }, - "main": "build/tdp_dummy.js", + "main": "dist/index.js", + "types": "dist/index.d.ts", "engines": { "npm": ">= 6.12", "node": ">= 12.13", @@ -24,10 +25,8 @@ }, "files": [ "src", - "index.js", - "phovea.js", "phovea_registry.js", - "build", + "dist", "tdp_dummy", "__init__.py", "__main__.py", @@ -37,81 +36,60 @@ "redhat_packages.txt" ], "scripts": { + "clean": "rimraf dist lib", + "delete-dependencies": "rimraf node_modules", "check": "flake8 --exclude=.git,venv,deploy,docs,__pycache__,node_modules", "pretest": "echo hybrid", "test": "npm run test:web && npm run test:python", "predist": "echo hybrid", "dist": "npm run dist:web && npm run dist:python", "compile": "tsc", + "compile:watch": "tsc -w", + "postcompile": "npm run copy", "lint": "tslint -c tslint.json -p . 'src/**/*.ts?(x)' 'tests/**/*.ts?(x)'", "docs": "npm run docs:web && npm run docs:python", "prebuild": "echo hybrid", "posttest": "echo hybrid", - "test:watch": "karma start --autoWatch=true --singleRun=false", - "build:dev": "webpack", + "test:watch": "jest --watch", "build": "npm run build:web && npm run build:python", - "start": "webpack-dev-server --inline", - "start:hot": "webpack-dev-server --inline --hot", - "watch": "webpack --watch", + "build:web": "npm run clean && npm run compile", + "copy": "npm run copy-assets && npm run copy-styles", + "copy-assets": "if [ -d src/assets ]; then shx --verbose cp -R src/assets/. dist/assets/; fi", + "copy-styles": "if [ -d src/scss ]; then shx --verbose cp -R src/scss/. dist/scss/; fi", "release:major": "npm version major && npm publish && git push --follow-tags", "release:minor": "npm version minor && npm publish && git push --follow-tags", "release:patch": "npm version patch && npm publish && git push --follow-tags", - "pretest:web": "npm run compile", "pretest:python": "npm run check", "posttest:web": "npm run lint", - "test:web": "test ! $(find tests -name \"*.ts\") || karma start", + "test:web": "test ! $(find tests -name \"*.ts\") || jest", "test:python": "test ! $(find tests -name \"*.py\") || python setup.py test", "predist:web": "npm run build:web && npm run docs:web", - "dist:web": "mkdir dist && cd build && tar cvzf ../dist/tdp_dummy.tar.gz *", + "dist:web": "mkdir lib && cd dist && tar cvzf ../lib/tdp_dummy.tar.gz *", "dist:python": "python setup.py sdist bdist_wheel", "docs:web": "typedoc --options typedoc.json src/**.ts", "docs:python": "sphinx-apidoc -o docs -f ./tdp_dummy && sphinx-build ./docs build/docs", "build:python": "rm -rf build/source && find . -name '*.pyc' -delete && node buildPython.js && cp -r ./tdp_dummy build/source/", - "build:web": "webpack --env prod", "prebuild:python": "node -e \"process.exit(process.env.PHOVEA_SKIP_TESTS === undefined?1:0)\" || npm run test:python", "prebuild:web": "node -e \"process.exit(process.env.PHOVEA_SKIP_TESTS === undefined?1:0)\" || npm run test:web", "predist:python": "npm run build:python && npm run docs:python" }, "dependencies": { - "tdp_core": "github:datavisyn/tdp_core#semver:^9.0.0" + "tdp_core": "^10.0.1" }, "optionalDependencies": { - "ordino": "github:Caleydo/ordino#semver:^7.0.0" + "ordino": "github:Caleydo/ordino#semver:^8.0.1" }, "devDependencies": { - "@types/jasmine": "2.5.47", - "awesome-typescript-loader": "3.1.2", - "cache-loader": "1.2.0", - "css-loader": "0.28.0", - "extract-text-webpack-plugin": "2.1.0", - "extract-loader": "0.1.0", - "ifdef-loader": "2.0.0", - "file-loader": "0.11.1", - "fork-ts-checker-webpack-plugin": "0.4.4", - "html-loader": "0.4.5", - "imports-loader": "0.7.1", - "jasmine": "2.5.3", - "json-loader": "0.5.4", - "karma": "1.5.0", - "karma-chrome-launcher": "2.0.0", - "karma-firefox-launcher": "1.0.1", - "karma-jasmine": "1.1.0", - "karma-junit-reporter": "2.0.0", - "karma-sourcemap-loader": "0.3.7", - "karma-webpack": "2.0.3", - "node-sass": "^4.13.1", - "null-loader": "0.1.1", - "raw-loader": "0.5.1", - "sass-loader": "6.0.7", - "style-loader": "0.16.1", - "thread-loader": "1.1.2", - "ts-loader": "4.0.1", - "tslib": "~1.11.0", - "tslint": "5.9.1", - "typedoc": "~0.16.10", - "typescript": "~3.8.2", - "url-loader": "0.5.8", - "webpack": "2.3.3", - "webpack-dev-server": "2.4.2" + "@types/jest": "~26.0.5", + "identity-obj-proxy": "~3.0.0", + "jest": "~26.1.0", + "jest-raw-loader": "~1.0.1", + "rimraf": "~3.0.2", + "shx": "~0.3.2", + "ts-jest": "~26.1.3", + "tslib": "~2.0.0", + "tslint": "~5.20.1", + "typedoc": "~0.17.8", + "typescript": "~3.9.7" } } diff --git a/phovea_registry.js b/phovea_registry.js index e4b0c05..a7562e9 100644 --- a/phovea_registry.js +++ b/phovea_registry.js @@ -4,7 +4,8 @@ * Licensed under the new BSD license, available at http://caleydo.org/license **************************************************************************** */ -import {register} from 'phovea_core/src/plugin'; +import {PluginRegistry} from 'phovea_core'; +import reg from './dist/phovea'; /** * build a registry by registering all phovea modules @@ -14,4 +15,4 @@ import {register} from 'phovea_core/src/plugin'; import 'ordino/phovea_registry.js'; /// #endif //self -register('tdp_dummy',require('./phovea.js')); +PluginRegistry.getInstance().register('tdp_dummy',reg); diff --git a/requirements.txt b/requirements.txt index 789699f..3b2b590 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ --e git+https://github.com/datavisyn/tdp_core.git@v9.0.0#egg=tdp_core +tdp_core>=10.0.0,<11.0.0 diff --git a/src/DummyMenuSection.ts b/src/base/DummyMenuSection.ts similarity index 77% rename from src/DummyMenuSection.ts rename to src/base/DummyMenuSection.ts index f5650f8..e0e9e92 100644 --- a/src/DummyMenuSection.ts +++ b/src/base/DummyMenuSection.ts @@ -2,15 +2,15 @@ * Created by Holger Stitz on 10.08.2016. */ -import {IPluginDesc} from 'phovea_core/src/plugin'; +import {IPluginDesc} from 'phovea_core'; import {categories} from './config'; -import {INamedSet} from 'tdp_core/src/storage'; -import {IStartMenuSection, IStartMenuSectionOptions} from 'ordino/src/extensions'; -import {resolve} from 'phovea_core/src/idtype'; -import NamedSetList from 'tdp_core/src/storage/NamedSetList'; +import {INamedSet} from 'tdp_core'; +import {IStartMenuSection, IStartMenuSectionOptions} from 'ordino'; +import {IDTypeManager} from 'phovea_core'; +import {NamedSetList} from 'tdp_core'; -export default class DummyMenuSection implements IStartMenuSection { - private readonly idType = resolve('IDTypeA'); +export class DummyMenuSection implements IStartMenuSection { + private readonly idType = IDTypeManager.getInstance().resolveIdType('IDTypeA'); private readonly list: NamedSetList; constructor(parent: HTMLElement, public readonly desc: IPluginDesc, options: IStartMenuSectionOptions) { diff --git a/src/DummySearchProvider.ts b/src/base/DummySearchProvider.ts similarity index 58% rename from src/DummySearchProvider.ts rename to src/base/DummySearchProvider.ts index 5976992..d217451 100644 --- a/src/DummySearchProvider.ts +++ b/src/base/DummySearchProvider.ts @@ -1,16 +1,16 @@ import {IDummyDataSource, dataSourceA, dataSourceB} from './config'; -import {getTDPLookup, getTDPFilteredRows} from 'tdp_core/src/rest'; -import './style.scss'; -import {IResult, ISearchProvider} from 'tdp_core/src/public/search'; +import {RestBaseUtils} from 'tdp_core'; +import '../scss/main.scss'; +import {IResult, ISearchProvider} from 'tdp_core'; -export default class DummySearchProvider implements ISearchProvider { +export class DummySearchProvider implements ISearchProvider { constructor(private readonly dataSource: IDummyDataSource) { } search(query: string, page: number, pageSize: number) { - return getTDPLookup('dummy', `${this.dataSource.table}_items`, { + return RestBaseUtils.getTDPLookup('dummy', `${this.dataSource.table}_items`, { column: `${this.dataSource.table}_name`, query, page, @@ -19,7 +19,7 @@ export default class DummySearchProvider implements ISearchProvider { } validate(query: string[]): Promise { - return >getTDPFilteredRows('dummy', `${this.dataSource.table}_items_verify`, {}, { + return >RestBaseUtils.getTDPFilteredRows('dummy', `${this.dataSource.table}_items_verify`, {}, { [`${this.dataSource.table}_name`]: query }); } diff --git a/src/config.ts b/src/base/config.ts similarity index 100% rename from src/config.ts rename to src/base/config.ts diff --git a/src/base/index.ts b/src/base/index.ts new file mode 100644 index 0000000..847bb7f --- /dev/null +++ b/src/base/index.ts @@ -0,0 +1,3 @@ +export * from './config'; +export * from './DummyMenuSection'; +export * from './DummySearchProvider'; diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..5e4ccf2 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,3 @@ +export * from './base'; +export * from './scores'; +export * from './views'; diff --git a/phovea.js b/src/phovea.ts similarity index 70% rename from phovea.js rename to src/phovea.ts index 441536b..1e51cbe 100644 --- a/phovea.js +++ b/src/phovea.ts @@ -12,9 +12,10 @@ module.exports = function (registry, feature) { /// #if include('ordino') registry.push('ordinoStartMenuSection', 'dummy_start_a', function () { - return import('./src/DummyMenuSection'); + return import('./base/DummyMenuSection'); }, { name: 'Dummy Data', + factory: 'new DummyMenuSection', cssClass: 'targidDummyData', priority: 20, viewId: 'dummy_start_a', @@ -23,7 +24,7 @@ module.exports = function (registry, feature) { /// #endif registry.push('tdpView', 'dummy_start_a', function () { - return import('./src/views/DummyList'); + return import('./views/DummyList').then((d) => d.DummyStartList); }, { name: 'Dummy A', factory: 'createStartA', @@ -32,7 +33,7 @@ module.exports = function (registry, feature) { }); registry.push('tdpView', 'dummy_start_B', function () { - return import('./src/views/DummyList'); + return import('./views/DummyList').then((d) => d.DummyStartList); }, { name: 'Dummy B', factory: 'createStartB', @@ -41,54 +42,58 @@ module.exports = function (registry, feature) { }); registry.push('tdpView', 'dummy_detail', function () { - return import('./src/views/DummyDetailView'); + return import('./views/DummyDetailView'); }, { name: 'Dummy Detail View', + factory: 'new DummyDetailView', idtype: 'IDTypeA', selection: '2' }); registry.push('tdpView', 'dummy_dependent', function () { - return import('./src/views/DummyDependentList'); + return import('./views/DummyDependentList'); }, { name: 'Dummy Dependent List', + factory: 'new DummyDependentList', idtype: 'IDTypeA', selection: 'some' }); registry.push('tdpView', 'dummyb_dependent', function () { - return import('./src/views/DummyDependentBList'); + return import('./views/DummyDependentBList'); }, { name: 'Dummy Dependent List', + factory: 'new DummyDependentBList', idtype: 'IDTypeB', selection: 'some' }); registry.push('tdpView', 'dummy_composite', function () { - return import('tdp_core/src/views/CompositeView'); + return import('tdp_core/dist/views/CompositeView'); }, { name: 'DummyComposite', + factory: 'new CompositeView', idtype: 'IDTypeA', selection: 'some', elements: [ { key: 'a', - loader: function () { - return import('./src/views/DummyComposite') + loader() { + return import('./views/DummyComposite'); }, factory: 'new DummyA' }, { key: 'b', - loader: function () { - return import('./src/views/DummyComposite') + loader() { + return import('./views/DummyComposite'); }, factory: 'new DummyB' }, { key: 'c', - loader: function () { - return import('./src/views/DummyComposite') + loader() { + return import('./views/DummyComposite'); }, factory: 'new DummyC' } @@ -100,9 +105,10 @@ module.exports = function (registry, feature) { }); registry.push('tdpView', 'dummy_external', function () { - return import('tdp_core/src/views/ProxyView'); + return import('tdp_core/dist/views/ProxyView'); }, { name: 'Wikipedia', + factory: 'new ProxyView', site: 'https://wikipedia.org/w/index.php?search={id}', argument: 'id', idtype: 'IDTypeA', @@ -110,33 +116,34 @@ module.exports = function (registry, feature) { }); registry.push('tdpInstantView', 'dummy', function () { - return import('./src/views/DummyInstantView'); + return import('./views/DummyInstantView'); }, { name: 'Info', + factory: 'new DummyInstantView', idtype: 'IDTypeA' }); registry.push('tdpScore', 'dummy_score', function () { - return import('./src/scores/DummyScore'); + return import('./scores/DummyScore').then((d) => d.DummyScore); }, { name: 'Dummy Score', idtype: 'IDTypeA' }); registry.push('tdpScoreImpl', 'dummy_score', function () { - return import('./src/scores/DummyScore'); + return import('./scores/DummyScore').then((d) => d.DummyScore); }, { factory: 'createScore' }); registry.push('dTilesSearchProvider', 'dummyA', function () { - return import('./src/DummySearchProvider') + return import('./base/DummySearchProvider').then((d) => d.DummySearchProvider); }, { idType: 'IDTypeA', factory: 'createA' }); registry.push('dTilesSearchProvider', 'dummyB', function () { - return import('./src/DummySearchProvider') + return import('./base/DummySearchProvider').then((d) => d.DummySearchProvider); }, { idType: 'IDTypeB', factory: 'createB' diff --git a/src/scores/DummyScore.ts b/src/scores/DummyScore.ts index 3420458..7a00af5 100644 --- a/src/scores/DummyScore.ts +++ b/src/scores/DummyScore.ts @@ -2,13 +2,13 @@ * Created by Samuel Gratzl on 27.04.2016. */ -import {IScore, IScoreParam} from 'tdp_core/src/lineup'; -import {samples, ParameterFormIds, IDummyDataSource, dataSourceA, dataSourceB} from '../config'; -import {resolve} from 'phovea_core/src/idtype'; -import {FormDialog, IFormElementDesc, FormElementType} from 'tdp_core/src/form'; -import {getTDPScore} from 'tdp_core/src/rest'; +import {IScore, IScoreParam} from 'tdp_core'; +import {samples, ParameterFormIds, IDummyDataSource, dataSourceA, dataSourceB} from '../base/config'; +import {IDTypeManager} from 'phovea_core'; +import {FormDialog, IFormElementDesc, FormElementType} from 'tdp_core'; +import {RestBaseUtils} from 'tdp_core'; -class DummyScore implements IScore { +export class DummyScore implements IScore { private readonly dataSource: IDummyDataSource; constructor(table: 'a' | 'b', private readonly score: string, private readonly tumorSample: string, private readonly aggregation: string) { @@ -16,7 +16,7 @@ class DummyScore implements IScore { } get idType() { - return resolve(this.dataSource.idType); + return IDTypeManager.getInstance().resolveIdType(this.dataSource.idType); } createDesc() { @@ -28,70 +28,72 @@ class DummyScore implements IScore { } compute(): Promise { - return getTDPScore('dummy', `${this.dataSource.table}_score`, { + return RestBaseUtils.getTDPScore('dummy', `${this.dataSource.table}_score`, { data_subtype: this.score, agg: this.aggregation, filter_b_cat2: this.tumorSample }); } -} -export function createScore(params: { table: 'a' | 'b', score: string, tumorSample: string, aggregation: string }) { - return new DummyScore(params.table, params.score, params.tumorSample, params.aggregation); -} + static createScore(params: { table: 'a' | 'b', score: string, tumorSample: string, aggregation: string }) { + return new DummyScore(params.table, params.score, params.tumorSample, params.aggregation); + } -export function create(desc: any): Promise { - const table = desc.idType === dataSourceA.idType ? 'a' : 'b'; + static create(desc: any): Promise { + const table = desc.idType === dataSourceA.idType ? 'a' : 'b'; - const dialog = new FormDialog('Add Score Column', 'Add Score Column'); - const formDesc: IFormElementDesc[] = [ - { - type: FormElementType.SELECT, - label: 'Sample', - id: ParameterFormIds.SAMPLE, - options: { - optionsData: samples + const dialog = new FormDialog('Add Score Column', 'Add Score Column'); + const formDesc: IFormElementDesc[] = [ + { + type: FormElementType.SELECT, + label: 'Sample', + id: ParameterFormIds.SAMPLE, + options: { + optionsData: samples + }, + useSession: true }, - useSession: true - }, - { - type: FormElementType.SELECT, - label: 'Score', - id: ParameterFormIds.SCORE_ATTRIBUTE, - options: { - optionsData: [ - {value: 'ab_real', name: 'Real', data: 'ab_real'}, - {value: 'ab_int', name: 'Int', data: 'ab_int'} - ] + { + type: FormElementType.SELECT, + label: 'Score', + id: ParameterFormIds.SCORE_ATTRIBUTE, + options: { + optionsData: [ + {value: 'ab_real', name: 'Real', data: 'ab_real'}, + {value: 'ab_int', name: 'Int', data: 'ab_int'} + ] + }, + useSession: true }, - useSession: true - }, - { - type: FormElementType.SELECT, - label: 'Aggregation', - id: ParameterFormIds.SCORE_AGGREGATION, - options: { - optionsData: [ - {value: 'avg', name: 'AVG', data: 'avg'}, - {value: 'min', name: 'MIN', data: 'min'}, - {value: 'max', name: 'MAX', data: 'max'} - ] - }, - useSession: true - } - ]; - dialog.append(...formDesc); + { + type: FormElementType.SELECT, + label: 'Aggregation', + id: ParameterFormIds.SCORE_AGGREGATION, + options: { + optionsData: [ + {value: 'avg', name: 'AVG', data: 'avg'}, + {value: 'min', name: 'MIN', data: 'min'}, + {value: 'max', name: 'MAX', data: 'max'} + ] + }, + useSession: true + } + ]; + dialog.append(...formDesc); - return dialog.showAsPromise((builder) => { - const data = builder.getElementData(); - return { - table, - score: data[ParameterFormIds.SCORE_ATTRIBUTE], - tumorSample: data[ParameterFormIds.SAMPLE], - aggregation: data[ParameterFormIds.SCORE_AGGREGATION] - }; - }); + return dialog.showAsPromise((builder) => { + const data = builder.getElementData(); + return { + table, + score: data[ParameterFormIds.SCORE_ATTRIBUTE], + tumorSample: data[ParameterFormIds.SAMPLE], + aggregation: data[ParameterFormIds.SCORE_AGGREGATION] + }; + }); + } } + + diff --git a/src/scores/index.ts b/src/scores/index.ts new file mode 100644 index 0000000..680f3c6 --- /dev/null +++ b/src/scores/index.ts @@ -0,0 +1 @@ +export * from './DummyScore'; diff --git a/src/scss/_idtype_color.scss b/src/scss/_idtype_color.scss new file mode 100644 index 0000000..715f38e --- /dev/null +++ b/src/scss/_idtype_color.scss @@ -0,0 +1,6 @@ +@import "~tdp_core/dist/scss/idtype_color"; + +* { + @include idtype_color('IDTypeA', #73dbff); + @include idtype_color('IDTypeB', #ff82a0); +} diff --git a/src/scss/main.scss b/src/scss/main.scss new file mode 100644 index 0000000..1fbea77 --- /dev/null +++ b/src/scss/main.scss @@ -0,0 +1,4 @@ +/** + * Created by Samuel Gratzl on 16.12.2015 + */ +@import './idtype_color'; diff --git a/src/views/DummyComposite.ts b/src/views/DummyComposite.ts index 2bce043..5d571db 100644 --- a/src/views/DummyComposite.ts +++ b/src/views/DummyComposite.ts @@ -1,6 +1,6 @@ -import ATableView from 'tdp_core/src/views/ATableView'; -import AView from 'tdp_core/src/views/AView'; -import {VIEW_COMPOSITE_EVENT_CHANGE_RATIOS} from 'tdp_core/src/views/CompositeView'; +import {ATableView} from 'tdp_core'; +import {AView} from 'tdp_core'; +import {CompositeView} from 'tdp_core'; export class DummyA extends AView { @@ -11,7 +11,7 @@ export class DummyA extends AView { this.node.onclick = () => { this.updateShared('SHARED', (i++)); if (i === 2) { - this.fire(VIEW_COMPOSITE_EVENT_CHANGE_RATIOS, 0.2, 0.8); + this.fire(CompositeView.VIEW_COMPOSITE_EVENT_CHANGE_RATIOS, 0.2, 0.8); } }; } @@ -42,7 +42,7 @@ export class DummyC extends AView { this.node.onclick = () => { this.updateShared('SHARED2', (i++)); if (i === 2) { - this.fire(VIEW_COMPOSITE_EVENT_CHANGE_RATIOS, 0.2, 0.8); + this.fire(CompositeView.VIEW_COMPOSITE_EVENT_CHANGE_RATIOS, 0.2, 0.8); } }; } diff --git a/src/views/DummyDependentBList.ts b/src/views/DummyDependentBList.ts index 3e72ff2..701092a 100644 --- a/src/views/DummyDependentBList.ts +++ b/src/views/DummyDependentBList.ts @@ -1,13 +1,13 @@ /** * Created by Samuel Gratzl on 29.01.2016. */ -import {types, dataSourceA, ParameterFormIds} from '../config'; -import {FormElementType} from 'tdp_core/src/form'; -import {single, ARankingView, numberCol} from 'tdp_core/src/lineup'; -import {getTDPDesc, getTDPRows, getTDPScore} from 'tdp_core/src/rest'; -import {resolve} from 'phovea_core/src/idtype'; +import {types, dataSourceA, ParameterFormIds} from '../base/config'; +import {FormElementType} from 'tdp_core'; +import {AdapterUtils, ARankingView, ColumnDescUtils} from 'tdp_core'; +import {RestBaseUtils} from 'tdp_core'; +import {IDTypeManager} from 'phovea_core'; -export default class DummyDependentBList extends ARankingView { +export class DummyDependentBList extends ARankingView { protected getParameterFormDescs() { return super.getParameterFormDescs().concat([ @@ -24,26 +24,26 @@ export default class DummyDependentBList extends ARankingView { } get itemIDType() { - return resolve(dataSourceA.idType); + return IDTypeManager.getInstance().resolveIdType(dataSourceA.idType); } protected loadColumnDesc() { - return getTDPDesc('dummy', 'a'); + return RestBaseUtils.getTDPDesc('dummy', 'a'); } protected loadRows() { - return getTDPRows('dummy', 'a'); + return RestBaseUtils.getTDPRows('dummy', 'a'); } protected createSelectionAdapter() { - return single({ + return AdapterUtils.single({ loadData: (_id: number, id: string) => this.loadSelectionColumnData(id), createDesc: (_id: number, id: string) => DummyDependentBList.getSelectionColumnDesc(_id, id) }); } private static getSelectionColumnDesc(_id: number, label: string) { - const s: any = numberCol(`col_${_id}`, 0, 1, {label}); + const s: any = ColumnDescUtils.numberCol(`col_${_id}`, 0, 1, {label}); s.constantDomain = true; return s; } @@ -56,6 +56,6 @@ export default class DummyDependentBList extends ARankingView { const filters = { ab_cat: this.getParameterData(ParameterFormIds.TYPE) }; - return getTDPScore('dummy', 'a_single_score', param, filters); + return RestBaseUtils.getTDPScore('dummy', 'a_single_score', param, filters); } } diff --git a/src/views/DummyDependentList.ts b/src/views/DummyDependentList.ts index 1718201..edd556e 100644 --- a/src/views/DummyDependentList.ts +++ b/src/views/DummyDependentList.ts @@ -1,13 +1,13 @@ /** * Created by Samuel Gratzl on 29.01.2016. */ -import {types, samples, ParameterFormIds, dataSourceB} from '../config'; -import {FormElementType} from 'tdp_core/src/form'; -import {single, ARankingView, numberCol} from 'tdp_core/src/lineup'; -import {getTDPDesc, getTDPRows, getTDPScore} from 'tdp_core/src/rest'; -import {resolve} from 'phovea_core/src/idtype'; +import {types, samples, ParameterFormIds, dataSourceB} from '../base/config'; +import {FormElementType} from 'tdp_core'; +import {ARankingView, AdapterUtils, ColumnDescUtils} from 'tdp_core'; +import {RestBaseUtils} from 'tdp_core'; +import {IDTypeManager} from 'phovea_core'; -export default class DummyDependentList extends ARankingView { +export class DummyDependentList extends ARankingView { protected getParameterFormDescs() { return super.getParameterFormDescs().concat([ @@ -33,26 +33,26 @@ export default class DummyDependentList extends ARankingView { } get itemIDType() { - return resolve(dataSourceB.idType); + return IDTypeManager.getInstance().resolveIdType(dataSourceB.idType); } protected loadColumnDesc() { - return getTDPDesc('dummy', 'b'); + return RestBaseUtils.getTDPDesc('dummy', 'b'); } protected loadRows() { - return getTDPRows('dummy', 'b'); + return RestBaseUtils.getTDPRows('dummy', 'b'); } protected createSelectionAdapter() { - return single({ + return AdapterUtils.single({ loadData: (_id: number, id: string) => this.loadSelectionColumnData(id), createDesc: (_id: number, id: string) => DummyDependentList.getSelectionColumnDesc(_id, id) }); } private static getSelectionColumnDesc(_id: number, label: string) { - const s: any = numberCol(`col_${_id}`, 0, 1, {label}); + const s: any = ColumnDescUtils.numberCol(`col_${_id}`, 0, 1, {label}); s.constantDomain = true; return s; } @@ -66,6 +66,6 @@ export default class DummyDependentList extends ARankingView { ab_cat: this.getParameterData(ParameterFormIds.TYPE), b_cat2: this.getParameterData(ParameterFormIds.SAMPLE), }; - return getTDPScore('dummy', 'b_single_score', param, filters); + return RestBaseUtils.getTDPScore('dummy', 'b_single_score', param, filters); } } diff --git a/src/views/DummyDetailView.ts b/src/views/DummyDetailView.ts index a0f6045..914a47b 100644 --- a/src/views/DummyDetailView.ts +++ b/src/views/DummyDetailView.ts @@ -1,13 +1,13 @@ /** * Created by Samuel Gratzl on 27.04.2016. */ -import '../style.scss'; -import {AD3View} from 'tdp_core/src/views/AD3View'; -import {showErrorModalDialog} from 'tdp_core/src/dialogs'; +import '../scss/main.scss'; +import {AD3View} from 'tdp_core'; +import {ErrorAlertHandler} from 'tdp_core'; import * as d3 from 'd3'; -import {getTDPData} from 'tdp_core/src/rest'; +import {RestBaseUtils} from 'tdp_core'; -export default class DummyDetailView extends AD3View { +export class DummyDetailView extends AD3View { private readonly x = d3.scale.linear(); private readonly y = d3.scale.linear(); @@ -76,7 +76,7 @@ export default class DummyDetailView extends AD3View { const promise = this.resolveSelection() .then((_names) => { names = _names; - return getTDPData<{ value1: number, value2: number }>('dummy', 'dummy_detail', { + return RestBaseUtils.getTDPData<{ value1: number, value2: number }>('dummy', 'dummy_detail', { a_id1: _names[0], a_id2: _names[1] }); @@ -89,7 +89,7 @@ export default class DummyDetailView extends AD3View { }); // on error - promise.catch(showErrorModalDialog) + promise.catch(ErrorAlertHandler.getInstance().errorAlert) .catch((error) => { console.error(error); this.setBusy(false); diff --git a/src/views/DummyInstantView.ts b/src/views/DummyInstantView.ts index c55233b..b5bba25 100644 --- a/src/views/DummyInstantView.ts +++ b/src/views/DummyInstantView.ts @@ -1,7 +1,7 @@ -import AInstantView from 'tdp_core/src/views/AInstantView'; +import {AInstantView} from 'tdp_core'; -export default class DummyInstantView extends AInstantView { +export class DummyInstantView extends AInstantView { protected initImpl() { super.initImpl(); diff --git a/src/views/DummyList.ts b/src/views/DummyList.ts index c2cbd14..d458707 100644 --- a/src/views/DummyList.ts +++ b/src/views/DummyList.ts @@ -1,13 +1,13 @@ /** * Created by Samuel Gratzl on 29.01.2016. */ -import {IViewContext, ISelection} from 'tdp_core/src/views'; -import {IDummyDataSource, dataSourceA, dataSourceB} from '../config'; -import {getTDPDesc, getTDPFilteredRows} from 'tdp_core/src/rest'; -import {AStartList} from 'tdp_core/src/views/AStartList'; +import {IViewContext, ISelection} from 'tdp_core'; +import {IDummyDataSource, dataSourceA, dataSourceB} from '../base/config'; +import {RestBaseUtils} from 'tdp_core'; +import {AStartList} from 'tdp_core'; -class DummyStartList extends AStartList { +export class DummyStartList extends AStartList { constructor(context: IViewContext, private readonly dataSource: IDummyDataSource, selection: ISelection, parent: HTMLElement, options = {}) { super(context, selection, parent, Object.assign({ itemName: dataSource.name, @@ -16,20 +16,19 @@ class DummyStartList extends AStartList { } protected loadColumnDesc() { - return getTDPDesc('dummy', this.dataSource.table); + return RestBaseUtils.getTDPDesc('dummy', this.dataSource.table); } protected loadRows() { const filters = this.buildNamedSetFilters('namedset4id'); - return getTDPFilteredRows('dummy', this.dataSource.table, {}, filters); + return RestBaseUtils.getTDPFilteredRows('dummy', this.dataSource.table, {}, filters); } -} -export function createStartA(context: IViewContext, selection: ISelection, parent: HTMLElement, options?) { - return new DummyStartList(context, dataSourceA, selection, parent, options); -} + static createStartA(context: IViewContext, selection: ISelection, parent: HTMLElement, options?) { + return new DummyStartList(context, dataSourceA, selection, parent, options); + } -export function createStartB(context: IViewContext, selection: ISelection, parent: HTMLElement, options?) { - return new DummyStartList(context, dataSourceB, selection, parent, options); + static createStartB(context: IViewContext, selection: ISelection, parent: HTMLElement, options?) { + return new DummyStartList(context, dataSourceB, selection, parent, options); + } } - diff --git a/src/views/index.ts b/src/views/index.ts new file mode 100644 index 0000000..734adb6 --- /dev/null +++ b/src/views/index.ts @@ -0,0 +1,6 @@ +export * from './DummyComposite'; +export * from './DummyDependentBList'; +export * from './DummyDependentList'; +export * from './DummyDetailView'; +export * from './DummyInstantView'; +export * from './DummyList'; diff --git a/tests.webpack.js b/tests.webpack.js deleted file mode 100644 index 9438ac4..0000000 --- a/tests.webpack.js +++ /dev/null @@ -1,14 +0,0 @@ -/* ***************************************************************************** - * Caleydo - Visualization for Molecular Biology - http://caleydo.org - * Copyright (c) The Caleydo Team. All rights reserved. - * Licensed under the new BSD license, available at http://caleydo.org/license - **************************************************************************** */ - -// build registry -require('./phovea_registry.js'); - -/** - * find all tests in the spec directory and load them - */ -var context = require.context('./tests', true, /\.test\.ts$/); // make sure you have your directory and regex test set correctly! -context.keys().forEach(context); diff --git a/tsconfig.json b/tsconfig.json index 3a54054..e7bc9b2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,30 +1,26 @@ { "compilerOptions": { - "module": "es6", - "target": "es5", + "module": "ES2020", + "target": "ES2019", "importHelpers": true, "sourceMap": true, + "declaration": true, "moduleResolution": "node", "jsx": "react", + "allowJs": true, + "declarationDir": "dist", + "outDir": "dist", "experimentalDecorators": true, - "downlevelIteration": true, // required as long as target is `es5` - "lib": [ - "dom", - "es2015", - "es2016.array.include", - "es2017.object" - ], - "baseUrl": "../", "noImplicitAny": false, "skipLibCheck": true, "esModuleInterop": false, - "allowSyntheticDefaultImports": true + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true, + "preserveWatchOutput": true }, "include": [ "src/**/*.ts", "src/**/*.tsx", - "tests/**/*.ts", - "index.ts", "tsd.d.ts" ] } diff --git a/tsconfig_dev.json b/tsconfig_dev.json deleted file mode 100644 index 807b9bf..0000000 --- a/tsconfig_dev.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "target": "es6" - } -} diff --git a/tsd.d.ts b/tsd.d.ts index 9e343ca..4bd749e 100644 --- a/tsd.d.ts +++ b/tsd.d.ts @@ -1,39 +1,24 @@ -/* ***************************************************************************** - * Caleydo - Visualization for Molecular Biology - http://caleydo.org - * Copyright (c) The Caleydo Team. All rights reserved. - * Licensed under the new BSD license, available at http://caleydo.org/license - **************************************************************************** */ - //allow sass modules declare module "*.scss" { - const content:string; + const content: string; export default content; } declare module "*.css" { - const content:string; + const content: string; export default content; } +// allow image dependencies declare module "*.png"; declare module "*.jpg"; +declare module "*.gif"; +declare module "*.webp"; +declare module "*.svg"; //allow html dependencies declare module "*.html" { - const content:string; + const content: string; export default content; } -//allow json dependencies -declare module "*.json"; -//allow file dependencies -declare module "file-loader!*"; -//allow file dependencies -declare module "raw-loader!*"; -//allow url dependencies -declare module "url-loader!*"; -//allow html dependencies -declare module "imports-loader!*"; - - -//define System.import as understood by webpack2 -interface ISystem { - import(module: string): Promise; -} -declare const System: ISystem; +declare module "*.xml" { + const content: string; + export default content; +} \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index 7d76873..0000000 --- a/webpack.config.js +++ /dev/null @@ -1,393 +0,0 @@ -/* ***************************************************************************** - * Caleydo - Visualization for Molecular Biology - http://caleydo.org - * Copyright (c) The Caleydo Team. All rights reserved. - * Licensed under the new BSD license, available at http://caleydo.org/license - **************************************************************************** */ - -const {libraryAliases, libraryExternals, modules, entries, ignores, type, registry, vendor} = require('./.yo-rc.json')['generator-phovea']; -const resolve = require('path').resolve; -const pkg = require('./package.json'); -const webpack = require('webpack'); -const fs = require('fs'); -const ExtractTextPlugin = require('extract-text-webpack-plugin'); -const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); -const buildInfo = require('./buildInfo.js'); - -const now = new Date(); -const prefix = (n) => n < 10 ? ('0' + n) : n.toString(); -const buildId = `${now.getUTCFullYear()}${prefix(now.getUTCMonth() + 1)}${prefix(now.getUTCDate())}-${prefix(now.getUTCHours())}${prefix(now.getUTCMinutes())}${prefix(now.getUTCSeconds())}`; -pkg.version = pkg.version.replace('SNAPSHOT', buildId); - -const year = (new Date()).getFullYear(); -const banner = '/*! ' + (pkg.title || pkg.name) + ' - v' + pkg.version + ' - ' + year + '\n' + - (pkg.homepage ? '* ' + pkg.homepage + '\n' : '') + - '* Copyright (c) ' + year + ' ' + pkg.author.name + ';' + - ' Licensed ' + pkg.license + '*/\n'; - -const preCompilerFlags = {flags: (registry || {}).flags || {}}; -const includeFeature = registry ? (extension, id) => { - const exclude = registry.exclude || []; - const include = registry.include || []; - if (!exclude && !include) { - return true; - } - const test = (f) => Array.isArray(f) ? extension.match(f[0]) && (id || '').match(f[1]) : extension.match(f); - return include.every(test) && !exclude.some(test); -} : () => true; - -const tsLoader = [ - { - loader: 'awesome-typescript-loader' - } -]; - -const tsLoaderDev = [ - {loader: 'cache-loader'}, - { - loader: 'thread-loader', - options: { - // there should be 1 cpu for the fork-ts-checker-webpack-plugin - workers: require('os').cpus().length - 1 - } - }, - { - loader: 'ts-loader', - options: { - happyPackMode: true, // IMPORTANT! use happyPackMode mode to speed-up compilation and reduce errors reported to webpack, - compilerOptions: { - target: 'es6' - } - } - } -]; - -// list of loaders and their mappings -const webpackloaders = [ - {test: /\.scss$/, use: 'style-loader!css-loader!sass-loader'}, - {test: /\.css$/, use: 'style-loader!css-loader'}, - {test: /\.tsx?$/, use: tsLoader}, - { - test: /phovea(_registry)?\.js$/, use: [{ - loader: 'ifdef-loader', - options: Object.assign({include: includeFeature}, preCompilerFlags) - }] - }, - {test: /\.json$/, use: 'json-loader'}, - { - test: /\.(png|jpg)$/, - loader: 'url-loader', - options: { - limit: 10000 // inline <= 10kb - } - }, - { - test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, - loader: 'url-loader', - options: { - limit: 10000, // inline <= 10kb - mimetype: 'application/font-woff' - } - }, - { - test: /\.svg(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, - loader: 'url-loader', - options: { - limit: 10000, // inline <= 10kb - mimetype: 'image/svg+xml' - } - }, - {test: /\.(ttf|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'file-loader'} -]; - -/** - * tests whether the given phovea module name is matching the requested file and if so convert it to an external lookup - * depending on the loading type - */ -function testPhoveaModule(moduleName, request) { - if (!(new RegExp('^' + moduleName + '/src.*')).test(request)) { - return false; - } - const subModule = request.match(/.*\/src\/?(.*)/)[1]; - // skip empty modules = root - const path = subModule === '' ? [moduleName] : [moduleName, subModule]; - // phovea_ ... phovea.name - const rootPath = /phovea_.*/.test(moduleName) ? ['phovea', moduleName.slice(7)].concat(path.slice(1)) : path; - return { - root: rootPath, - commonjs2: path, - commonjs: path, - amd: request + (subModule === '' ? '/main' : '') - }; -} - -function testPhoveaModules(modules) { - return (context, request, callback) => { - for (let i = 0; i < modules.length; ++i) { - const r = testPhoveaModule(modules[i], request); - if (r) { - return callback(null, r); - } - } - callback(); - }; -} - -// use workspace registry file if available -const isWorkspaceContext = fs.existsSync(resolve(__dirname, '..', 'phovea_registry.js')); -const registryFile = isWorkspaceContext ? '../phovea_registry.js' : './phovea_registry.js'; -const actMetaData = `file-loader?name=phoveaMetaData.json!${buildInfo.metaDataTmpFile(pkg)}`; -const actBuildInfoFile = `file-loader?name=buildInfo.json!${buildInfo.tmpFile()}`; - -/** - * inject the registry to be included - * @param entry - * @returns {*} - */ -function injectRegistry(entry) { - const extraFiles = [registryFile, actBuildInfoFile, actMetaData]; - // build also the registry - if (typeof entry === 'string') { - return extraFiles.concat(entry); - } - const transformed = {}; - Object.keys(entry).forEach((eentry) => { - transformed[eentry] = extraFiles.concat(entry[eentry]); - }); - return transformed; -} - -/** - * generate a webpack configuration - */ -function generateWebpack(options) { - let base = { - entry: injectRegistry(options.entries), - output: { - path: resolve(__dirname, 'build'), - filename: (options.name || (pkg.name + (options.bundle ? '_bundle' : ''))) + (options.min && !options.nosuffix ? '.min' : '') + '.js', - chunkFilename: '[chunkhash].js', - publicPath: '' // no public path = relative - }, - resolve: { - // add `.ts` and `.tsx` as a resolvable extension. - extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js'], - alias: Object.assign({}, options.libs || {}), - symlinks: false, - // fallback to the directory above if they are siblings just in the workspace context - modules: isWorkspaceContext ? [ - resolve(__dirname, '../'), - 'node_modules' - ] : ['node_modules'] - }, - plugins: [ - // define magic constants that are replaced - new webpack.DefinePlugin({ - 'process.env.NODE_ENV': JSON.stringify(options.isProduction ? 'production' : 'development'), - __VERSION__: JSON.stringify(pkg.version), - __LICENSE__: JSON.stringify(pkg.license), - __BUILD_ID__: JSON.stringify(buildId), - __DEBUG__: options.isDev || options.isTest, - __TEST__: options.isTest, - __PRODUCTION__: options.isProduction, - __APP_CONTEXT__: JSON.stringify('/') - }) - // rest depends on type - ], - externals: [], - module: { - loaders: webpackloaders.slice() - }, - devServer: { - proxy: { - '/api/*': { - target: 'http://localhost:9000', - secure: false, - ws: true - }, - '/login': { - target: 'http://localhost:9000', - secure: false - }, - '/logout': { - target: 'http://localhost:9000', - secure: false - }, - '/loggedinas': { - target: 'http://localhost:9000', - secure: false - } - }, - contentBase: resolve(__dirname, 'build'), - watchOptions: { - aggregateTimeout: 500, - ignored: /node_modules/ - } - }, - watchOptions: { - aggregateTimeout: 500, - ignored: /node_modules/ - } - }; - - if (options.isProduction) { - base.plugins.unshift(new webpack.BannerPlugin({ - banner: banner, - raw: true - })); - base.plugins.push(new webpack.optimize.MinChunkSizePlugin({ - minChunkSize: 10000 // at least 10.000 characters - })); - // base.plugins.push(new webpack.optimize.ModuleConcatenationPlugin()); - } else if (options.isDev) { - // switch to def settings - base.module.loaders.find((d) => d.use === tsLoader).use = tsLoaderDev; - base.plugins.push(new ForkTsCheckerWebpackPlugin({checkSyntacticErrors: true, tsconfig: './tsconfig_dev.json'})); - } - - if (options.library) { - let libName = /phovea_.*/.test(pkg.name) ? ['phovea', pkg.name.slice(7)] : pkg.name; - // generate a library, i.e. output the last entry element - // create library name - if (options.moduleBundle) { - libName = 'phovea'; - } - base.output.library = libName; - base.output.libraryTarget = 'umd'; - base.output.umdNamedDefine = false; // anonymous require module - } - - if (!options.bundle) { - // if we don't bundle don't include external libraries and other phovea modules - base.externals.push(...(options.externals || Object.keys(options.libs || {}))); - - // ignore all phovea modules - if (options.modules) { - base.externals.push(testPhoveaModules(options.modules)); - } - - // ignore extra modules - (options.ignore || []).forEach(function (d) { - base.module.loaders.push({test: new RegExp(d), loader: 'null-loader'}); // use null loader - }); - // ingore phovea module registry calls - (options.modules || []).forEach(function (m) { - base.module.loaders.push({ - test: new RegExp('.*[\\\\/]' + m + '[\\\\/]phovea_registry.js'), - loader: 'null-loader' - }); // use null loader - }); - } - if (!options.bundle || options.isApp) { - // extract the included css file to own file - const p = new ExtractTextPlugin({ - filename: (options.isApp || options.moduleBundle ? 'style' : pkg.name) + (options.min && !options.nosuffix ? '.min' : '') + '.css', - allChunks: true // there seems to be a bug in dynamically loaded chunk styles are not loaded, workaround: extract all styles from all chunks - }); - base.plugins.push(p); - base.module.loaders[0] = { - test: /\.scss$/, - loader: p.extract(['css-loader', 'sass-loader']) - }; - base.module.loaders[1] = { - test: /\.css$/, - loader: p.extract(['css-loader']) - }; - } - if (options.isApp) { - // create manifest - // base.plugins.push(new webpack.optimize.AppCachePlugin()); - } - if (options.commons) { - // build a commons plugin - base.plugins.push(new webpack.optimize.CommonsChunkPlugin({ - // The order of this array matters - name: 'common', - filename: 'common.js', - minChunks: 2 - })); - } - if (options.vendor) { - (Array.isArray(options.vendor) ? options.vendor : [options.vendor]).forEach((reg) => { - base.plugins.push(new webpack.optimize.CommonsChunkPlugin({ - async: true, - children: true, - deepChildren: true, - minChunks: (module, count) => new RegExp(reg, 'i').test(module.resource) && count >= 2 - })); - }); - } - if (options.min) { - // use a minifier - base.plugins.push( - new webpack.LoaderOptionsPlugin({ - minimize: true, - debug: false - }), - new webpack.optimize.UglifyJsPlugin()); - } else { - // generate source maps - base.devtool = 'inline-source-map'; - } - return base; -} - -function generateWebpackConfig(env) { - const isTest = env === 'test'; - const isProduction = env === 'prod'; - const isDev = !isProduction && !isTest; - - const base = { - entries: entries, - libs: libraryAliases, - externals: libraryExternals, - modules: modules, - vendor: vendor, - ignore: ignores, - isProduction: isProduction, - isDev: isDev, - isTest: isTest - }; - - if (isTest) { - return generateWebpack(Object.assign({}, base, { - bundle: true - })); - } - - if (type.startsWith('app')) { - base.isApp = true; - base.bundle = true; // bundle everything together - base.name = '[name]'; // multiple entries case - base.commons = true; // extract commons module - } else if (type === 'bundle') { - base.library = true; // expose as library - base.moduleBundle = true; // expose as library 'phovea' - base.name = pkg.name; // to avoid adding _bundle - base.bundle = true; - } else { // type === 'lib' - base.library = true; - } - - // single generation - if (isDev) { - return generateWebpack(base); - } - if (type.startsWith('app')) { // isProduction app - return generateWebpack(Object.assign({}, base, { - min: true, - nosuffix: true - })); - } - // isProduction - return [ - // plain - generateWebpack(base), - // minified - generateWebpack(Object.assign({}, base, { - min: true - })) - ]; -} - -module.exports = generateWebpackConfig; -module.exports.generateWebpack = generateWebpack;