Skip to content

Commit

Permalink
Fixes #160: adding support to generate documentation from multiple re…
Browse files Browse the repository at this point in the history
…pository in WEBUI
  • Loading branch information
poonai committed Jun 27, 2017
1 parent 1b3196c commit 2753c00
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
7 changes: 6 additions & 1 deletion backend/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ exports.executeScript = function (socket, formData) {
var debug = formData.debug;
var uniqueId = uuidV4();
var webUI = "true";
var subProject = ""
if (formData.subProject != undefined) {
subProject = formData.subProject.join(",")
}

var donePercent = 0;

Expand All @@ -25,7 +29,8 @@ exports.executeScript = function (socket, formData) {
"-m", email,
"-d", debug,
"-u", uniqueId,
"-w", webUI
"-w", webUI,
"-s", subProject
];

var process = spawn("./generate.sh", args);
Expand Down
12 changes: 12 additions & 0 deletions public/scripts/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ $(function () {
if (validation.isValid(formData)) {
socket.emit('execute', formData);
$(this).attr("disabled", "none");
$("#subProject").attr("disabled", "none");
} else {
$('.notification').append($('<li>')).text(validation.getMessages());
$('#notification-container').css("visibility", "visible");
Expand Down Expand Up @@ -72,7 +73,18 @@ function getData() {
if (field.name === "git_url") { data.gitUrl = field.value.trim(); }
if (field.name === "doc_theme") { data.docTheme = field.value.trim(); }
if (field.name === "debug" ) { data.debug = field.value; }
if (field.name === "subproject_url[]") {
if (data.subProject == undefined) {
data.subProject = [field.value];
} else {
data.subProject.push(field.value);
}
}
});

return data;
}

function addSubProject() {
$("#subproject").append(`<input id="subProject_url" placeholder="Enter URL of Github Repository" name="subproject_url[]" class="form-control" type="text">`)
}
9 changes: 9 additions & 0 deletions public/scripts/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
}
}

if (formData.subProject != undefined) {
for (var i = 0; i < formData.subProject.length; i++) {
regex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/;
if(!regex.test(formData.subProject[i])) {
messages.push("Invalid URL");
valid = false;
}
}
}
return valid;
},

Expand Down
9 changes: 9 additions & 0 deletions public/stylesheets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ a {
text-align: left;
}

#subProject_url{
margin-bottom: 8px;
}

#messages li {
margin-bottom: 5px;
}
Expand All @@ -38,6 +42,11 @@ a {
margin-bottom: 20px;
}

#subProject {
margin-bottom: 20px;
margin-left: 10px;
}

#btnDownload {
display: none;
width: -moz-fit-content;
Expand Down
2 changes: 2 additions & 0 deletions views/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ block content
.form-group
label.control-label(for='git_url') GITURL:
select#git_url.form-control(type='text', placeholder='Enter URL of Github Repository', name='git_url')
.div#subproject
.form-group
label.control-label(for='doc_theme') Doc Theme:
select#doc_theme.form-control(name='doc_theme')
Expand All @@ -42,6 +43,7 @@ block content
input#debug(type='checkbox', value='true', name='debug', checked=false)
.form-group#buttons
button.btn.btn-default(type='button' id='btnGenerate') Generate Docs
button.btn.btn-default(type='button' id='subProject' onclick="addSubProject()") Add Sub Project
.row
a.btn.btn-default(id='btnDownload') Download
a.btn.btn-default(id='btnPreview' target='_blank') Preview
Expand Down

0 comments on commit 2753c00

Please sign in to comment.