Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/frontend/tests/*
26 changes: 26 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"extends": "eslint:recommended",
"plugins": ["vue"],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"semi": [
"error",
"always"
]
}
}
48 changes: 0 additions & 48 deletions .jshintrc

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pythontest:
jstest:
@echo "Running javascript testsuite"
@echo "----------------------------"
`npm bin`/jshint --config .jshintrc --exclude frontend/tests frontend
`npm bin`/eslint --ext .vue,.js --ignore-path .eslintignore frontend/
`npm bin`/node-qunit-phantomjs frontend/tests/tests.html

.PHONY: jscoverage
Expand Down
44 changes: 2 additions & 42 deletions frontend/admin/admin-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ var API = (function () {
})();

var RestError = function(code, message) {
console.log("Creating error "+code+" message: "+message);
this.code = code;
this.message = message;
};
Expand Down Expand Up @@ -97,11 +96,6 @@ var create_handler = function(promise, data, textStatus, jqXHR) {
if (status !== 201) {
// Strange situation in which the call succeeded, but
// not with a 201. Just do our best.
console.log(
"Create succeded but response with status " +
status +
" instead of 201."
);
promise.reject(status, payload);
return;
}
Expand All @@ -113,7 +107,6 @@ var create_handler = function(promise, data, textStatus, jqXHR) {
var arr = url.pathname.replace(/\/$/, "").split('/');
id = arr[arr.length - 1];
} catch (e) {
console.log("Response had invalid or absent Location header");
promise.reject(status, payload);
return;
}
Expand All @@ -133,11 +126,6 @@ var create_singleton_handler = function(promise, data, textStatus, jqXHR) {
if (status !== 201) {
// Strange situation in which the call succeeded, but
// not with a 201. Just do our best.
console.log(
"Create succeded but response with status " +
status +
" instead of 201."
);
promise.reject(status, payload);
return;
}
Expand All @@ -146,7 +134,6 @@ var create_singleton_handler = function(promise, data, textStatus, jqXHR) {
try {
location = jqXHR.getResponseHeader('Location');
} catch (e) {
console.log("Response had invalid or absent Location header");
promise.reject(status, payload);
return;
}
Expand All @@ -166,11 +153,6 @@ var update_handler = function(promise, data, textStatus, jqXHR) {
if (status !== 204) {
// Strange situation in which the call succeeded, but
// not with a 201. Just do our best.
console.log(
"Update succeded but response with status " +
status +
" instead of 204."
);
promise.reject(status, payload);
return;
}
Expand All @@ -188,11 +170,6 @@ var delete_handler = function(promise, data, textStatus, jqXHR) {
}

if (status !== 204) {
console.log(
"Delete succeded but response with status " +
status +
" instead of 204."
);
promise.reject(status, payload);
return;
}
Expand All @@ -210,19 +187,11 @@ var retrieve_handler = function(promise, data, textStatus, jqXHR) {
}

if (status !== 200) {
console.log(
"Retrieve succeded but response with status " +
status +
" instead of 200."
);
promise.reject(status, payload);
return;
}

if (payload === null) {
console.log(
"Retrieve succeded but empty or invalid payload"
);
promise.reject(status, payload);
return;
}
Expand Down Expand Up @@ -255,8 +224,7 @@ var Resource = function(type) {
API.request("PUT", urlUtils.pathJoin(type, id), body, query_args)
.done(function(data, textStatus, jqXHR) {
update_handler(promise, data, textStatus, jqXHR);
}
)
})
.fail(function(jqXHR) {
fail_handler(promise, jqXHR);
});
Expand Down Expand Up @@ -309,19 +277,11 @@ var Resource = function(type) {
}

if (status !== 200) {
console.log(
"Items retrieve succeded but response with status " +
status +
" instead of 200."
);
promise.reject(status, payload);
return;
}

if (payload === null) {
console.log(
"Items Retrieve succeded but empty or invalid payload"
);
promise.reject(status, payload);
return;
}
Expand Down Expand Up @@ -411,4 +371,4 @@ module.exports = {
"User" : new Resource("users"),
"Container" : new Resource("containers"),
"Stats" : new SingletonResource("stats"),
};
};
3 changes: 1 addition & 2 deletions frontend/admin/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ let router = new VueRouter({
]
});

let vm;
vm = new Vue({
new Vue({
el: "#app",
router: router
});
36 changes: 1 addition & 35 deletions frontend/user/user-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ var API = (function () {
})();

var RestError = function(code, message) {
console.log("Creating error "+code+" message: "+message);
this.code = code;
this.message = message;
};
Expand Down Expand Up @@ -97,11 +96,6 @@ var create_handler = function(promise, data, textStatus, jqXHR) {
if (status !== 201) {
// Strange situation in which the call succeeded, but
// not with a 201. Just do our best.
console.log(
"Create succeded but response with status " +
status +
" instead of 201."
);
promise.reject(status, payload);
return;
}
Expand All @@ -113,7 +107,6 @@ var create_handler = function(promise, data, textStatus, jqXHR) {
var arr = url.pathname.replace(/\/$/, "").split('/');
id = arr[arr.length - 1];
} catch (e) {
console.log("Response had invalid or absent Location header");
promise.reject(status, payload);
return;
}
Expand All @@ -133,11 +126,6 @@ var update_handler = function(promise, data, textStatus, jqXHR) {
if (status !== 204) {
// Strange situation in which the call succeeded, but
// not with a 201. Just do our best.
console.log(
"Update succeded but response with status " +
status +
" instead of 204."
);
promise.reject(status, payload);
return;
}
Expand All @@ -155,11 +143,6 @@ var delete_handler = function(promise, data, textStatus, jqXHR) {
}

if (status !== 204) {
console.log(
"Delete succeded but response with status " +
status +
" instead of 204."
);
promise.reject(status, payload);
return;
}
Expand All @@ -177,19 +160,11 @@ var retrieve_handler = function(promise, data, textStatus, jqXHR) {
}

if (status !== 200) {
console.log(
"Retrieve succeded but response with status " +
status +
" instead of 200."
);
promise.reject(status, payload);
return;
}

if (payload === null) {
console.log(
"Retrieve succeded but empty or invalid payload"
);
promise.reject(status, payload);
return;
}
Expand Down Expand Up @@ -222,8 +197,7 @@ var Resource = function(type) {
API.request("PUT", urlUtils.pathJoin(type, id), body, query_args)
.done(function(data, textStatus, jqXHR) {
update_handler(promise, data, textStatus, jqXHR);
}
)
})
.fail(function(jqXHR) {
fail_handler(promise, jqXHR);
});
Expand Down Expand Up @@ -276,19 +250,11 @@ var Resource = function(type) {
}

if (status !== 200) {
console.log(
"Items retrieve succeded but response with status " +
status +
" instead of 200."
);
promise.reject(status, payload);
return;
}

if (payload === null) {
console.log(
"Items Retrieve succeded but empty or invalid payload"
);
promise.reject(status, payload);
return;
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"babel-preset-env": "^1.4.0",
"babel-preset-es2015": "^6.24.1",
"css-loader": "^0.28.1",
"jshint": "*",
"eslint": "^3.19.0",
"eslint-plugin-vue": "^2.0.1",
"node-qunit-phantomjs": "*",
"vue-loader": "^12.0.4",
"vue-template-compiler": "^2.3.3",
Expand Down