From f443f2d0c7d841b74d3569ad20f490d3cb2c90d6 Mon Sep 17 00:00:00 2001 From: David Nowinsky Date: Fri, 28 Aug 2020 10:58:00 +0200 Subject: [PATCH] fixup! WIP Prototype usage of js translator in playground --- playground/app.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/playground/app.js b/playground/app.js index 0d062efc3b..b6fb4bc66b 100644 --- a/playground/app.js +++ b/playground/app.js @@ -161,10 +161,7 @@ class MongoService { } } -const mongoservice = new MongoService(); -const mongoBackendPlugin = servicePluginFactory(mongoservice); - -class DataService { +class JsDataService { constructor() { this.dataDomains = { defaultDataset: [{ @@ -204,9 +201,17 @@ class DataService { }; } } + + async loadCSV(file) { + throw Error('Not implemented'); + } } -const dataService = new DataService(); +/* Use either: + - `JsDataService`: to execute all data transforms directly in the browser + - `MongoService`: to query against a Mongo database + */ +const dataService = new JsDataService(); const dataBackendPlugin = servicePluginFactory(dataService); async function buildVueApp() { @@ -258,7 +263,7 @@ async function buildVueApp() { groupname: 'Group 1', }, }); - const collections = await mongoservice.listCollections(); + const collections = await dataService.listCollections(); store.commit(VQBnamespace('setDomains'), { domains: collections }); store.dispatch(VQBnamespace('updateDataset')); }, @@ -325,7 +330,7 @@ async function buildVueApp() { this.draggedover = false; event.preventDefault(); // For the moment, only take one file and we should also test event.target - const { collection: domain } = await mongoservice.loadCSV(event.dataTransfer.files[0]); + const { collection: domain } = await dataService.loadCSV(event.dataTransfer.files[0]); await setupInitialData(store, domain); event.target.value = null; },