Skip to content

Commit

Permalink
fixup! WIP Prototype usage of js translator in playground
Browse files Browse the repository at this point in the history
  • Loading branch information
davinov committed Aug 28, 2020
1 parent ba7389f commit f443f2d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions playground/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,7 @@ class MongoService {
}
}

const mongoservice = new MongoService();
const mongoBackendPlugin = servicePluginFactory(mongoservice);

class DataService {
class JsDataService {
constructor() {
this.dataDomains = {
defaultDataset: [{
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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'));
},
Expand Down Expand Up @@ -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;
},
Expand Down

0 comments on commit f443f2d

Please sign in to comment.