header and hide fields

This commit is contained in:
Laura Carvajal
2016-10-17 12:23:48 +01:00
committed by Rowan Manning
parent c562bb07f3
commit 39435f37e4
5 changed files with 50 additions and 12 deletions

View File

@@ -36,6 +36,15 @@ function route(app) {
});
app.express.post('/new', (req, res) => {
let parsedHeaders = '';
try {
parsedHeaders = JSON.parse(req.body.headers);
} catch (e) {
console.log(`error parsing headers object: ${req.body.headers}. Ignoring.`);
}
const newTask = {
name: req.body.name,
url: req.body.url,
@@ -45,7 +54,10 @@ function route(app) {
wait: req.body.wait || undefined,
username: req.body.username || undefined,
password: req.body.password || undefined
headers: parsedHeaders || undefined,
hideElements: req.body.hide || undefined
};
app.webservice.tasks.create(newTask, (err, task) => {
if (err) {
const standards = getStandards().map(standard => {

View File

@@ -69,6 +69,8 @@ function route(app) {
task.wait = req.body.wait;
task.username = req.body.username;
task.password = req.body.password;
task.headers = req.body.headers;
task.hideElements = req.body.hideElements;
const standards = getStandards().map(standard => {
if (standard.title === task.standard) {
standard.selected = true;