Skip to content

Commit e3bde2c

Browse files
palomnykmsioda
authored andcommitted
webapp update (#82)
* No longer need this hack for getting access to /src/. * Update to work with new dockBlj requirements. Remove the 'echo' bash function for getting full paths. This temporarily removes the to use paths with $BASH_VARIABLES in them. I will find a more elegant solution. I currently think this is due to the 'exec' function that launches dockBlj. A better solution will be forthcoming in the near future. * Update comments to reflect new dockBlj requirements. Adding support for AWS Dashboard. * Add AWS Dash button to dropdown menu. * Fix varible declariation. Shorten configPath name declaration. Continue to add wrapper to AWSBatchGenomicsStack. * Add animation to AWS Dash. * Add classes for aws dash validation. * Move advanced AWS to a modal and rename as AWS Mini-Dashboard. Add kneadData tab to menu. Add project.description. Add rdp.db. Update Humann2. * "project." is replaced with "pipeline." * Move AWS Mini-Dash js to it's own file. * Add the ability to pass configPath to config page though get request. * Update paths. * Add log messages to help if paths break in the future. * If no path starting with "/" is given, /retrieveProjectFiles with send the config as it were named in the $BLJ/rescources/gui. * In case of a blank configPath, route to /config without an id. * If a path starting with "/" is given to "/saveConfigToGui" the config will be saved to path instead of default $BLJ/resources/gui/. * Add anchor for pipeline properties files on menu. Add place to post handlebars varibles to get them into the javascript layer. * Add console logs. Allow for path to start with $BLJ. Node doesn't handle bash variables that well, but we can find a workaround in the future. * Add configPath config class. Because pipeline master configs and unrun configs are stored in seperate places, we need to have a way to keep track. Create loadConfigPathToForm() as a way to build the recent config options. Wrapped it in a function so that I can reuse it for the properties. This function will work with configPath. Add window.onload function that will eventually be able to grab handlebars variables from html elements and get them into the javascript layer. * Seperate logic of CSS and js for less clutter in my js. * Change name of /retrieveProjects to /retrievePipelines. Add path aspect to /retrievePipelines. * Remove unneeded HTML. * retrieveProjects() -> retrievePipelines() * Rename variable descrip to fit naming convention. Move names.push(file) into if statement with the rest of the push statements. Remove unneeded indention. * Fix to match preceeding back-end change. * Formatting. * Removing unneeded line. * Start event listener for restartListAnchor. Update retrieveProjects() to retrievePipelines(). Some formatting. * Initial build for adding anchors for restarting pipelines.
1 parent 87adadb commit e3bde2c

12 files changed

Lines changed: 584 additions & 260 deletions

File tree

web_app/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ RUN apt-get update && \
3030
RUN rm -r $BLJ/web_app/*
3131
COPY . $BLJ/web_app/
3232

33-
COPY /src/ $BLJ/src/
33+
# COPY /src/ $BLJ/src/
3434
#COPY /Users/aaronyerke/git/BioLockJ/src/ $BLJ/src/
3535

3636
WORKDIR $BLJ/web_app/

web_app/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ var app = express();
1414

1515
// view engine setup
1616
app.engine('hbs', hbs({extname: 'hbs', defaultLayout: 'layout', layoutDir: __dirname + '/views/layouts/'}));
17-
app.set('views', path.join(__dirname, 'views'));
17+
app.set('views', path.join(__dirname, 'views'));// __dirname now resolves to: /web_app
1818
app.set('view engine', 'hbs');
1919

20+
console.log('__dirname from app.js', __dirname);
21+
2022
// uncomment after placing your favicon in /public
2123
app.use(favicon(path.join(__dirname, 'public', 'images', 'favicon.ico')));
2224
app.use(logger('dev'));

web_app/lib/indexAux.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ exports.saveConfigToLocal = function(configName, configText){
4747
//console.log(configPath.toString());
4848
fs.writeFile(configPath, configText,function(err) {
4949
if(err) {
50-
return console.log(err);
50+
return console.log(err);
5151
}
5252
console.log("The file was saved!");
5353
})
@@ -61,22 +61,15 @@ exports.createFullLaunchCommand = function(launchJSON, restartPath){//
6161
let command = [];
6262
command.push(dockblj.toString());
6363
Object.keys(launchJSON).forEach(key => {
64-
var resolvedPath = execSync(`echo ${launchJSON[key]}`).toString().trim();
65-
// if (resolvedPath.endsWith('\n')){
66-
// resolvedPath = resolvedPath.slice(0,resolvedPath.length - 1)
67-
// console.log('resolvedPath has "\n":', resolvedPath);
68-
// }
69-
// console.log('resolvedPath[0:10]', resolvedPa);
70-
// resolvedPath = resolvedPath.toString()[resolvedPath.length];
71-
console.log('key: ', key);
72-
console.log('resolvedPath: ', resolvedPath);
7364
//if key not config, grab path.Dirname(launchJSON[key])
74-
if (key != 'c' && key != 'i'){//need only the dir, not the file name
75-
// launchJSON[key] = path.dirname(resolvedPath);
76-
command.push(`-${key} ${path.dirname(resolvedPath)}`)
65+
66+
//need to pass directories to map for all except -c and -i is already a directory
67+
if (key != 'c' && key != 'i'){// TODO: update this to handle '\' also incase someone is running windows
68+
command.push(`-${key}=${path.dirname(launchJSON[key])}`)
7769
}else{
78-
command.push(`-${key} ${resolvedPath}`);
70+
command.push(`-${key}=${launchJSON[key]}`);
7971
};
72+
// command.push(`-${key}=${launchJSON[key]}`);
8073
});
8174
command.push('-docker');
8275
if (restartPath !== undefined ){
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/**
2+
Author: Aaron Yerke
3+
Purpose: Wrappers for the mjzapata/AWSBatchGenomicsStack repository on github.
4+
Notes: Its a work in progress
5+
*/
6+
7+
8+
document.getElementById('getMalcolmGitRepo').addEventListener('click', function(evt){
9+
evt.preventDefault();
10+
sendFormToNode('getMalcolmGitRepo', '/getMalcolmGitRepo');
11+
});
12+
document.getElementById('validateAwsCreditials').addEventListener('click', function(evt){
13+
evt.preventDefault();
14+
setTimeout(function(){
15+
var request = new XMLHttpRequest();
16+
request.open('POST', '/validateAwsCreditials', true);
17+
request.setRequestHeader("Content-Type", "application/json");
18+
request.send();
19+
console.log('AWS VALIDATION REQUEST SENT');
20+
request.onreadystatechange = function() {
21+
if (request.readyState == XMLHttpRequest.DONE) {
22+
console.log(request.responseText);
23+
document.getElementById('awsCredentialsStatus').innerHTML = request.responseText;
24+
}
25+
}
26+
console.log(request.responseText);
27+
}, 2000);
28+
});
29+
30+
document.getElementById('submitConfigureAWS').addEventListener('click', function(evt){
31+
evt.preventDefault();
32+
let thisForm = document.getElementById('configureAwsForm');
33+
if (thisForm.checkValidity()){
34+
console.log("this: ",this);
35+
let promis = sendFormToNode('submitConfigureAWS', '/configureAws');
36+
promis.then(result => {
37+
console.log('result: ', result);
38+
let correct = Array.from(thisForm.getElementsByClassName('correctInput'));
39+
let incorrect = Array.from(thisForm.getElementsByClassName('incorrectInput'));
40+
if (result.trim() === 'valid'){
41+
correct.forEach( ele => ele.style.display = 'inline');
42+
incorrect.forEach( ele => ele.style.display = 'none');
43+
}else {
44+
incorrect.forEach( ele => ele.style.display = 'inline');
45+
correct.forEach( ele => ele.style.display = 'none');
46+
}
47+
})
48+
}
49+
});
50+
//document.getElementById('configureAwsForm').getElementsByTagName('span').getElementsByClassName('correctInput')
51+
document.getElementById('deployComputeStack').addEventListener('click', function(evt){
52+
evt.preventDefault();
53+
console.log('this: ', this);
54+
let formData = {};
55+
let myForm = new FormData(this.parentNode.parentNode);
56+
for (var i of myForm.entries()) {
57+
formData[i[0]] = i[1];
58+
}
59+
console.log('formData: ', formData);
60+
let request = new XMLHttpRequest();
61+
request.open("POST", '/deployCloudInfrastructure', true);
62+
request.setRequestHeader("Content-Type", "application/json");
63+
request.send(JSON.stringify({formData}));
64+
65+
request.onreadystatechange = function() {
66+
if (request.readyState == XMLHttpRequest.DONE) {
67+
console.log(request.responseText);
68+
let correct = Array.from(this.parentNode.parentNode.getElementsByClassName('correctInput'));
69+
let incorrect = Array.from(this.parentNode.parentNode.getElementsByClassName('incorrectInput'));
70+
if (responseText === "success"){
71+
correct.forEach( ele => ele.style.display = 'inline');
72+
incorrect.forEach( ele => ele.style.display = 'none');
73+
}else {
74+
incorrect.forEach( ele => ele.style.display = 'inline');
75+
correct.forEach( ele => ele.style.display = 'none');
76+
}
77+
}
78+
}
79+
});
80+
document.getElementById('launchEc2HeadNodeButton').addEventListener('click', function(evt) {
81+
evt.preventDefault();
82+
sendFormToNode('launchEc2HeadNodeButton', 'launchEc2HeadNode')
83+
});

0 commit comments

Comments
 (0)