Skip to content

Commit

Permalink
dashboard - fix analyze + save + load features
Browse files Browse the repository at this point in the history
  • Loading branch information
kumavis committed Aug 5, 2020
1 parent f4db5fb commit 5572886
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 25 deletions.
3 changes: 2 additions & 1 deletion Dashboard/content/js/graph.js
Expand Up @@ -24,7 +24,8 @@ Graph.tex = function(page, summary, texFile) {
}

Graph.findFile = function(type) {
return dialog.showSaveDialog({properties: ['saveFile'], filters: type});
const response = dialog.showSaveDialogSync({properties: ['saveFile'], filters: type});
return response.filePaths[0]
}

Graph.saveSvg = function(page) {
Expand Down
10 changes: 5 additions & 5 deletions Dashboard/content/js/output.js
Expand Up @@ -82,21 +82,21 @@ async function loadOutput(page) {
});
}

function saveOutput(page) {
async function saveOutput(page) {

if (!current_stdout) {
console.log('There is no output');
return;
}

let file = dialog.showSaveDialog({properties: ['saveFile']});

const response = await dialog.showSaveDialog({properties: ['saveFile']});
const file = response.filePath
if (!file) {
return;
}

fs.writeFile('' + file, current_summary, function(err) {});
fs.writeFile('' + file + STDOUT_SUFFIX, current_stdout);
fs.writeFile('' + file, current_summary, (err) => { if (err) throw err });
fs.writeFile('' + file + STDOUT_SUFFIX, current_stdout, (err) => { if (err) throw err });
}

module.exports = {
Expand Down
36 changes: 19 additions & 17 deletions Dashboard/content/js/runner.js
Expand Up @@ -23,29 +23,31 @@ function kill() {
exec.stderr && exec.stderr.end();
}

function runExpoSE(page) {
async function runExpoSE(page) {

if (running()) {
console.log('Already Running Something');
return;
}

let file = dialog.showOpenDialog({properties: ['openFile'], filters: [{name: 'JavaScript File', extensions: ['js']}]});

if (file) {
console.log('Preparing to execute ' + file);
view.clear(page);
view.running(true, page);
summary(null, page);
timer.start(page);
exec = Executor(file, null, function(data) {
view.out('' + data, page);
}, function(err, jsonOut) {
view.running(false, page);
timer.stop(page);
output.handleOutput(err, exec.final, jsonOut, page);
});
}
const response = await dialog.showOpenDialog({properties: ['openFile'], filters: [{name: 'JavaScript File', extensions: ['js']}]});
if (response.canceled) return

const file = response.filePaths[0]
if (!file) return

console.log('Preparing to execute ' + file);
view.clear(page);
view.running(true, page);
summary(null, page);
timer.start(page);
exec = Executor(file, null, function(data) {
view.out('' + data, page);
}, function(err, jsonOut) {
view.running(false, page);
timer.stop(page);
output.handleOutput(err, exec.final, jsonOut, page);
});
}

module.exports = {
Expand Down
5 changes: 3 additions & 2 deletions Dashboard/src/expose_executor.js
@@ -1,13 +1,14 @@
/* Copyright (c) Royal Holloway, University of London | Contact Blake Loring (blake@parsed.uk), Duncan Mitchell (Duncan.Mitchell.2015@rhul.ac.uk), or Johannes Kinder (johannes.kinder@rhul.ac.uk) for details or support | LICENSE.md for license details */

const tmp = require("tmp");
const path = require("path");
const fs = require("fs");
const spawn = require("child_process").spawn;

const EXPOSE_PATH = "expoSE";
const EXPOSE_PATH = path.resolve(__dirname, '../../expoSE');

//TODO: Executor should use summary.jobs[n].replay to build replay for consistency
//Otherwise 1 change becomes 2
//Otherwise 1 change becomes 2expoSE
function Executor(filepath, input, data, done) {

//Create tmp output file for the JSON
Expand Down
3 changes: 3 additions & 0 deletions Dashboard/src/graph_builder.js
Expand Up @@ -17,6 +17,9 @@ function BuildGraph(outFile, outType, coverageFiles, inRate, done) {
this.running = false;
done(c);
}.bind(this));

prc.stderr.pipe(process.stderr)

}

module.exports = BuildGraph;

0 comments on commit 5572886

Please sign in to comment.