Merge "CheckerQuery: Make returned lists immutable"
diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 0000000..8066d26
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,101 @@
+{
+ "extends": ["eslint:recommended", "google"],
+ "parserOptions": {
+ "ecmaVersion": 8
+ },
+ "env": {
+ "browser": true,
+ "es6": true
+ },
+ "globals": {
+ "__dirname": false,
+ "app": false,
+ "page": false,
+ "Polymer": false,
+ "process": false,
+ "require": false,
+ "Gerrit": false,
+ "Promise": false,
+ "assert": false,
+ "test": false,
+ "flushAsynchronousOperations": false
+ },
+ "rules": {
+ "arrow-parens": ["error", "as-needed"],
+ "block-spacing": ["error", "always"],
+ "brace-style": ["error", "1tbs", { "allowSingleLine": true }],
+ "camelcase": "off",
+ "comma-dangle": ["error", {
+ "arrays": "always-multiline",
+ "objects": "always-multiline",
+ "imports": "always-multiline",
+ "exports": "always-multiline",
+ "functions": "never"
+ }],
+ "eol-last": "off",
+ "indent": ["error", 2, {
+ "MemberExpression": 2,
+ "FunctionDeclaration": {"body": 1, "parameters": 2},
+ "FunctionExpression": {"body": 1, "parameters": 2},
+ "CallExpression": {"arguments": 2 },
+ "ArrayExpression": 1,
+ "ObjectExpression": 1,
+ "SwitchCase": 1
+ }],
+ "keyword-spacing": ["error", { "after": true, "before": true }],
+ "lines-between-class-members": ["error", "always"],
+ "max-len": [
+ "error",
+ 80,
+ 2,
+ {"ignoreComments": true}
+ ],
+ "new-cap": ["error", { "capIsNewExceptions": ["Polymer", "LegacyElementMixin", "GestureEventListeners", "LegacyDataMixin"] }],
+ "no-console": "off",
+ "no-multiple-empty-lines": [ "error", { "max": 1 } ],
+ "no-prototype-builtins": "off",
+ "no-redeclare": "off",
+ "no-restricted-syntax": [
+ "error",
+ {
+ "selector": "ExpressionStatement > CallExpression > MemberExpression[object.name='test'][property.name='only']",
+ "message": "Remove test.only."
+ },
+ {
+ "selector": "ExpressionStatement > CallExpression > MemberExpression[object.name='suite'][property.name='only']",
+ "message": "Remove suite.only."
+ }
+ ],
+ "no-undef": "off",
+ "no-useless-escape": "off",
+ "no-var": "error",
+ "object-shorthand": ["error", "always"],
+ "padding-line-between-statements": [
+ "error",
+ {
+ "blankLine": "always",
+ "prev": "class",
+ "next": "*"
+ },
+ {
+ "blankLine": "always",
+ "prev": "*",
+ "next": "class"
+ }
+ ],
+ "prefer-arrow-callback": "error",
+ "prefer-const": "error",
+ "prefer-spread": "error",
+ "quote-props": ["error", "consistent-as-needed"],
+ "require-jsdoc": "off",
+ "semi": [2, "always"],
+ "template-curly-spacing": "error",
+ "valid-jsdoc": "off"
+ },
+ "plugins": [
+ "html"
+ ],
+ "settings": {
+ "html/report-bad-indent": "error"
+ }
+}
diff --git a/gr-checks/externs.js b/gr-checks/externs.js
index f14959b..e193ad1 100644
--- a/gr-checks/externs.js
+++ b/gr-checks/externs.js
@@ -3,4 +3,4 @@
* @externs
*/
-function moment() {};
+function moment() {}
diff --git a/gr-checks/gr-checkers-list.js b/gr-checks/gr-checkers-list.js
index b07b861..04dd3f1 100644
--- a/gr-checks/gr-checkers-list.js
+++ b/gr-checks/gr-checkers-list.js
@@ -1,7 +1,7 @@
(function() {
'use strict';
const CHECKERS_PER_PAGE = 15;
- const GET_CHECKERS_URL = "/plugins/checks/checkers/";
+ const GET_CHECKERS_URL = '/plugins/checks/checkers/';
/**
* Show a list of all checkers along with creating/editing them
@@ -40,17 +40,17 @@
},
_startingIndex: {
type: Number,
- value: 0
+ value: 0,
},
_showNextButton: {
type: Boolean,
value: true,
- computed: '_computeShowNextButton(_startingIndex, _filteredCheckers)'
+ computed: '_computeShowNextButton(_startingIndex, _filteredCheckers)',
},
_showPrevButton: {
type: Boolean,
value: true,
- computed: '_computeShowPrevButton(_startingIndex, _filteredCheckers)'
+ computed: '_computeShowPrevButton(_startingIndex, _filteredCheckers)',
},
},
observers: [
@@ -66,14 +66,14 @@
*/
if (Polymer.FlattenedNodesObserver) {
this._checkersListObserver = new Polymer.FlattenedNodesObserver(
- this.$.listBody, () => {
- this.$.listOverlay.refit();
- });
+ this.$.listBody, () => {
+ this.$.listOverlay.refit();
+ });
} else {
this._checkersListObserver = Polymer.dom(this.$.listBody).observeNodes(
- () => {
- this.$.listOverlay.refit();
- });
+ () => {
+ this.$.listOverlay.refit();
+ });
}
},
@@ -87,10 +87,10 @@
_showConfigureOverlay() {
this.$.listOverlay.open().then(
- () => {
- this._getCheckers();
- }
- )
+ () => {
+ this._getCheckers();
+ }
+ );
},
_showCheckers(_checkers, _filter) {
@@ -99,7 +99,7 @@
// TODO(dhruvsri): highlight matching part
this._filteredCheckers = this._checkers.filter(checker =>
this._contains(checker.name, this._filter) ||
- this._contains(checker.repository, this._filter))
+ this._contains(checker.repository, this._filter));
this._startingIndex = 0;
},
@@ -112,7 +112,7 @@
return [];
}
return this._filteredCheckers.slice(this._startingIndex,
- this._startingIndex + CHECKERS_PER_PAGE);
+ this._startingIndex + CHECKERS_PER_PAGE);
},
_computeShowNextButton(_startingIndex, _filteredCheckers) {
@@ -132,7 +132,7 @@
_handleNextClicked() {
if (this._startingIndex + CHECKERS_PER_PAGE <
this._filteredCheckers.length) {
- this._startingIndex += CHECKERS_PER_PAGE;
+ this._startingIndex += CHECKERS_PER_PAGE;
}
},
@@ -157,7 +157,7 @@
},
_handleEditIconClicked(e) {
- let checker = e.model.item;
+ const checker = e.model.item;
this.checker = checker;
this.$.editOverlay.open();
},
@@ -175,7 +175,7 @@
_computeBlocking(checker) {
return (checker && checker.blocking && checker.blocking.length > 0)
- ? "YES": "NO";
+ ? 'YES': 'NO';
},
_handleCreateConfirm() {
@@ -193,5 +193,5 @@
this.$.createOverlay.close();
},
- })
+ });
})();
\ No newline at end of file
diff --git a/gr-checks/gr-checkers-list_test.html b/gr-checks/gr-checkers-list_test.html
index 6b5e0ad..177e37e 100644
--- a/gr-checks/gr-checkers-list_test.html
+++ b/gr-checks/gr-checkers-list_test.html
@@ -20,172 +20,171 @@
<script>
const CHECKERS = [
{
- "uuid":"C:D",
- "name":"A",
- "description":"B",
- "repository":"Backend",
- "status":"ENABLED",
- "blocking":[
+ uuid: 'C:D',
+ name: 'A',
+ description: 'B',
+ repository: 'Backend',
+ status: 'ENABLED',
+ blocking: [
- ],
- "query":"status:open",
- "created":"2019-07-25 13:08:43.000000000",
- "updated":"2019-07-25 13:08:43.000000000"
+ ],
+ query: 'status:open',
+ created: '2019-07-25 13:08:43.000000000',
+ updated: '2019-07-25 13:08:43.000000000',
},
{
- "uuid":"aa:bb",
- "name":"n1",
- "description":"d1",
- "repository":"All-Users",
- "status":"ENABLED",
- "blocking":[
+ uuid: 'aa:bb',
+ name: 'n1',
+ description: 'd1',
+ repository: 'All-Users',
+ status: 'ENABLED',
+ blocking: [
- ],
- "query":"status:open",
- "created":"2019-07-29 13:07:17.000000000",
- "updated":"2019-07-29 13:07:17.000000000"
+ ],
+ query: 'status:open',
+ created: '2019-07-29 13:07:17.000000000',
+ updated: '2019-07-29 13:07:17.000000000',
},
{
- "uuid":"adsf:asdasdas",
- "name":"ds",
- "description":"s",
- "repository":"Scripts",
- "status":"ENABLED",
- "blocking":[
+ uuid: 'adsf:asdasdas',
+ name: 'ds',
+ description: 's',
+ repository: 'Scripts',
+ status: 'ENABLED',
+ blocking: [
- ],
- "query":"status:open",
- "created":"2019-07-29 13:28:09.000000000",
- "updated":"2019-07-29 13:28:09.000000000"
+ ],
+ query: 'status:open',
+ created: '2019-07-29 13:28:09.000000000',
+ updated: '2019-07-29 13:28:09.000000000',
},
{
- "uuid":"ijkl:mnop",
- "name":"abcd",
- "description":"efgh",
- "repository":"All-Projects",
- "status":"ENABLED",
- "blocking":[
+ uuid: 'ijkl:mnop',
+ name: 'abcd',
+ description: 'efgh',
+ repository: 'All-Projects',
+ status: 'ENABLED',
+ blocking: [
- ],
- "query":"status:open",
- "created":"2019-07-29 09:33:25.000000000",
- "updated":"2019-07-29 09:33:25.000000000"
+ ],
+ query: 'status:open',
+ created: '2019-07-29 09:33:25.000000000',
+ updated: '2019-07-29 09:33:25.000000000',
},
{
- "uuid":"ngfnf:mhghgnhghn",
- "name":"nbvfg",
- "description":"fjhgj",
- "repository":"All-Users",
- "status":"ENABLED",
- "blocking":[
+ uuid: 'ngfnf:mhghgnhghn',
+ name: 'nbvfg',
+ description: 'fjhgj',
+ repository: 'All-Users',
+ status: 'ENABLED',
+ blocking: [
- ],
- "query":"status:open",
- "created":"2019-08-06 14:21:34.000000000",
- "updated":"2019-08-06 14:21:34.000000000"
+ ],
+ query: 'status:open',
+ created: '2019-08-06 14:21:34.000000000',
+ updated: '2019-08-06 14:21:34.000000000',
},
{
- "uuid":"sdfsdf--:sdfsdf333",
- "name":"sdfsdf",
- "description":"sdfsdfsd",
- "repository":"Scripts",
- "status":"ENABLED",
- "blocking":[
+ uuid: 'sdfsdf--:sdfsdf333',
+ name: 'sdfsdf',
+ description: 'sdfsdfsd',
+ repository: 'Scripts',
+ status: 'ENABLED',
+ blocking: [
- ],
- "query":"status:open",
- "created":"2019-07-30 13:00:19.000000000",
- "updated":"2019-07-30 13:00:19.000000000"
- },
- {
- "uuid":"test:checker1",
- "name":"Unit Tests",
- "description":"Random description that should be improved at some point",
- "repository":"Backend",
- "status":"ENABLED",
- "blocking":[
-
- ],
- "query":"status:open",
- "created":"2019-07-22 13:16:52.000000000",
- "updated":"2019-07-22 14:21:14.000000000"
+ ],
+ query: 'status:open',
+ created: '2019-07-30 13:00:19.000000000',
+ updated: '2019-07-30 13:00:19.000000000',
},
{
- "uuid":"test:checker2",
- "name":"Code Style",
- "repository":"Backend",
- "status":"ENABLED",
- "blocking":[
+ uuid: 'test:checker1',
+ name: 'Unit Tests',
+ description: 'Random description that should be improved at some point',
+ repository: 'Backend',
+ status: 'ENABLED',
+ blocking: [
- ],
- "query":"status:open",
- "created":"2019-07-22 13:26:56.000000000",
- "updated":"2019-07-22 13:26:56.000000000"
+ ],
+ query: 'status:open',
+ created: '2019-07-22 13:16:52.000000000',
+ updated: '2019-07-22 14:21:14.000000000',
},
{
- "uuid":"xddf:sdfsdfsdf",
- "name":"sdfsdf",
- "description":"sdfsdf",
- "repository":"Scripts",
- "status":"ENABLED",
- "blocking":[
+ uuid: 'test:checker2',
+ name: 'Code Style',
+ repository: 'Backend',
+ status: 'ENABLED',
+ blocking: [
- ],
- "query":"status:open",
- "created":"2019-07-29 14:11:59.000000000",
- "updated":"2019-07-29 14:11:59.000000000"
+ ],
+ query: 'status:open',
+ created: '2019-07-22 13:26:56.000000000',
+ updated: '2019-07-22 13:26:56.000000000',
},
{
- "uuid":"zxczxc:bnvnbvnbvn",
- "name":"zxc",
- "description":"zxc",
- "repository":"Scripts",
- "status":"ENABLED",
- "blocking":[
+ uuid: 'xddf:sdfsdfsdf',
+ name: 'sdfsdf',
+ description: 'sdfsdf',
+ repository: 'Scripts',
+ status: 'ENABLED',
+ blocking: [
- ],
- "query":"status:open",
- "created":"2019-07-29 14:00:24.000000000",
- "updated":"2019-07-29 14:00:24.000000000"
+ ],
+ query: 'status:open',
+ created: '2019-07-29 14:11:59.000000000',
+ updated: '2019-07-29 14:11:59.000000000',
},
{
- "uuid":"zxczxc:sdfsdf",
- "name":"zxc",
- "description":"zxc",
- "repository":"Scripts",
- "status":"ENABLED",
- "blocking":[
+ uuid: 'zxczxc:bnvnbvnbvn',
+ name: 'zxc',
+ description: 'zxc',
+ repository: 'Scripts',
+ status: 'ENABLED',
+ blocking: [
- ],
- "query":"status:open",
- "created":"2019-07-29 13:30:47.000000000",
- "updated":"2019-07-29 13:30:47.000000000"
- }
+ ],
+ query: 'status:open',
+ created: '2019-07-29 14:00:24.000000000',
+ updated: '2019-07-29 14:00:24.000000000',
+ },
+ {
+ uuid: 'zxczxc:sdfsdf',
+ name: 'zxc',
+ description: 'zxc',
+ repository: 'Scripts',
+ status: 'ENABLED',
+ blocking: [
+
+ ],
+ query: 'status:open',
+ created: '2019-07-29 13:30:47.000000000',
+ updated: '2019-07-29 13:30:47.000000000',
+ },
];
</script>
<script>
-
suite('gr-checkers-list tests', () => {
let element;
let sandbox;
- let fetchJSONSpy, fetchJSONPromise, fetchJSONResolve;
+ let fetchJSONSpy; let fetchJSONResolve;
- setup((done) => {
+ setup(done => {
sandbox = sinon.sandbox.create();
fetchJSONSpy = sinon.stub();
const fetchJSONPromise = new Promise((resolve, reject) => {
- fetchJSONResolve = resolve;
- })
- fetchJSONSpy.returns(fetchJSONPromise)
+ fetchJSONResolve = resolve;
+ });
+ fetchJSONSpy.returns(fetchJSONPromise);
const pluginRestApi = {
fetchJSON: fetchJSONSpy,
};
element = fixture('basic', {
- pluginRestApi
+ pluginRestApi,
});
flush(done);
});
@@ -193,12 +192,12 @@
teardown(() => { sandbox.restore(); });
test('renders checker list table headings', () => {
- const checkersList = element.$$('table')
+ const checkersList = element.$$('table');
const headings = checkersList.firstElementChild.firstElementChild.
- children;
- const expectedHeadings = ["Checker Name", "Repository", "Status",
- "Required", "Checker Description", "Edit"];
- for (let i = 0;i < headings.length;i++) {
+ children;
+ const expectedHeadings = ['Checker Name', 'Repository', 'Status',
+ 'Required', 'Checker Description', 'Edit'];
+ for (let i = 0; i < headings.length; i++) {
assert(headings[i].innerText === expectedHeadings[i]);
}
});
@@ -206,39 +205,38 @@
test('create checker button renders', () => {
assert(element.querySelector('#createNewContainer'));
const button = element.querySelector('#createNewContainer')
- .querySelector('gr-button');
+ .querySelector('gr-button');
assert(button);
assert(button.innerText === 'Create New');
});
suite('with checkers', () => {
- setup((done) => {
+ setup(done => {
fetchJSONResolve(CHECKERS);
flush(done);
- })
+ });
test('renders correct number of checkers', () => {
const checkers = element.$$('table > tbody:nth-child(2)')
- .querySelectorAll('tr');
+ .querySelectorAll('tr');
assert(checkers.length === CHECKERS.length);
- })
+ });
test('renders correct checkers', () => {
const checkers = element.$$('table > tbody:nth-child(2)')
- .querySelectorAll('tr');
- for (let i = 0;i < checkers.length;i++) {
+ .querySelectorAll('tr');
+ for (let i = 0; i < checkers.length; i++) {
const checkerDetails = checkers[i].querySelectorAll('td');
assert(CHECKERS[i].name === checkerDetails[0].innerText);
assert(CHECKERS[i].repository === checkerDetails[1].innerText);
- const status = CHECKERS[i].status || "NO";
+ const status = CHECKERS[i].status || 'NO';
assert(status === checkerDetails[2].innerText);
- const checkerRequired = (CHECKERS[i].blocking &&
+ const checkerRequired = (CHECKERS[i].blocking &&
CHECKERS[i].blocking.length > 0)
- ? "YES": "NO";
+ ? 'YES': 'NO';
assert(checkerRequired === checkerDetails[3].innerText);
const description = CHECKERS[i].description || '';
assert(description === checkerDetails[4].innerText);
}
- })
+ });
});
-
});
</script>
diff --git a/gr-checks/gr-checks-all-statuses.js b/gr-checks/gr-checks-all-statuses.js
index c4be5bc..cf07732 100644
--- a/gr-checks/gr-checks-all-statuses.js
+++ b/gr-checks/gr-checks-all-statuses.js
@@ -18,7 +18,7 @@
FAILED: 'FAILED',
NOT_RELEVANT: 'NOT_RELEVANT',
- STATUS_UNKNOWN: 'UNKNOWN'
+ STATUS_UNKNOWN: 'UNKNOWN',
};
function isStatus(status, includedStatuses) {
diff --git a/gr-checks/gr-checks-change-list-header-view.js b/gr-checks/gr-checks-change-list-header-view.js
index ee3b994..74b8161 100644
--- a/gr-checks/gr-checks-change-list-header-view.js
+++ b/gr-checks/gr-checks-change-list-header-view.js
@@ -1,5 +1,5 @@
(function() {
-'use strict';
+ 'use strict';
Polymer({
is: 'gr-checks-change-list-header-view',
diff --git a/gr-checks/gr-checks-change-list-header-view_test.html b/gr-checks/gr-checks-change-list-header-view_test.html
index b6aa3be..5724fb7 100644
--- a/gr-checks/gr-checks-change-list-header-view_test.html
+++ b/gr-checks/gr-checks-change-list-header-view_test.html
@@ -15,15 +15,13 @@
</test-fixture>
<script>
-
suite('gr-checks-change-list-header-view tests', () => {
let element;
let sandbox;
- setup((done) => {
+ setup(done => {
sandbox = sinon.sandbox.create();
-
element = fixture('basic');
flush(done);
});
diff --git a/gr-checks/gr-checks-change-list-item-cell-view.js b/gr-checks/gr-checks-change-list-item-cell-view.js
index 65be586..8cf55a2 100644
--- a/gr-checks/gr-checks-change-list-item-cell-view.js
+++ b/gr-checks/gr-checks-change-list-item-cell-view.js
@@ -1,5 +1,5 @@
(function() {
-'use strict';
+ 'use strict';
Polymer({
is: 'gr-checks-change-list-item-cell-view',
diff --git a/gr-checks/gr-checks-change-list-item-cell-view_test.html b/gr-checks/gr-checks-change-list-item-cell-view_test.html
index 24d5f6b..f01b7d1 100644
--- a/gr-checks/gr-checks-change-list-item-cell-view_test.html
+++ b/gr-checks/gr-checks-change-list-item-cell-view_test.html
@@ -15,22 +15,20 @@
</test-fixture>
<script>
-
suite('gr-checks-change-list-item-cell-view tests', () => {
let element;
let sandbox;
- setup((done) => {
+ setup(done => {
sandbox = sinon.sandbox.create();
-
element = fixture('basic', {
change: {
- 'project': 'test-repository',
- 'revisions': {
- 'first-sha': "test-revision",
- 'second-sha': "test-revision2",
- }
+ project: 'test-repository',
+ revisions: {
+ 'first-sha': 'test-revision',
+ 'second-sha': 'test-revision2',
+ },
},
});
flush(done);
diff --git a/gr-checks/gr-checks-change-view-tab-header-view.js b/gr-checks/gr-checks-change-view-tab-header-view.js
index e77a888..a75b494 100644
--- a/gr-checks/gr-checks-change-view-tab-header-view.js
+++ b/gr-checks/gr-checks-change-view-tab-header-view.js
@@ -1,5 +1,5 @@
(function() {
-'use strict';
+ 'use strict';
Polymer({
is: 'gr-checks-change-view-tab-header-view',
diff --git a/gr-checks/gr-checks-change-view-tab-header-view_test.html b/gr-checks/gr-checks-change-view-tab-header-view_test.html
index 79fb0a9..cdcff23 100644
--- a/gr-checks/gr-checks-change-view-tab-header-view_test.html
+++ b/gr-checks/gr-checks-change-view-tab-header-view_test.html
@@ -20,10 +20,9 @@
let element;
let sandbox;
- setup((done) => {
+ setup(done => {
sandbox = sinon.sandbox.create();
-
element = fixture('basic');
flush(done);
});
diff --git a/gr-checks/gr-checks-chip-view.js b/gr-checks/gr-checks-chip-view.js
index 36e4c1b..878f3cc 100644
--- a/gr-checks/gr-checks-chip-view.js
+++ b/gr-checks/gr-checks-chip-view.js
@@ -49,21 +49,20 @@
function downgradeFailureToWarning(checks) {
const hasFailedCheck = checks.some(
- (check) => {
- return check.state == Statuses.FAILED;
- }
- )
+ check => {
+ return check.state == Statuses.FAILED;
+ }
+ );
if (!hasFailedCheck) return '';
const hasRequiredFailedCheck = checks.some(
- (check) => {
- return check.state == Statuses.FAILED &&
+ check => {
+ return check.state == Statuses.FAILED &&
check.blocking && check.blocking.length > 0;
- }
- )
+ }
+ );
return hasRequiredFailedCheck ? '' : 'set';
}
-
Polymer({
is: 'gr-checks-chip-view',
@@ -78,20 +77,21 @@
_status: {type: String, computed: '_computeStatus(_checkStatuses)'},
_statusString: {
type: String,
- computed: '_computeStatusString(_status, _checkStatuses, _failedRequiredChecksCount)',
+ computed: '_computeStatusString(_status, _checkStatuses,' +
+ '_failedRequiredChecksCount)',
},
_chipClasses: {type: String, computed: '_computeChipClass(_status)'},
// Type is set as string so that it reflects on changes
// Polymer does not support reflecting changes in Boolean property
_downgradeFailureToWarning: {
type: String,
- value: ''
+ value: '',
},
pollChecksInterval: Object,
visibilityChangeListenerAdded: {
type: Boolean,
- value: false
- }
+ value: false,
+ },
},
detached() {
@@ -104,21 +104,21 @@
],
listeners: {
- 'click': 'showChecksTable'
+ click: 'showChecksTable',
},
showChecksTable() {
this.dispatchEvent(
- new CustomEvent(
- 'show-checks-table',
- {
- bubbles: true,
- composed: true,
- detail: {
- tab: 'change-view-tab-content-checks'
- }
- })
- );
+ new CustomEvent(
+ 'show-checks-table',
+ {
+ bubbles: true,
+ composed: true,
+ detail: {
+ tab: 'change-view-tab-content-checks',
+ },
+ })
+ );
},
/**
@@ -155,7 +155,7 @@
}
const poll = () => this._fetchChecks(change, revision, getChecks);
poll();
- this.pollChecksInterval = setInterval(poll, CHECKS_POLL_INTERVAL_MS)
+ this.pollChecksInterval = setInterval(poll, CHECKS_POLL_INTERVAL_MS);
if (!this.visibilityChangeListenerAdded) {
this.visibilityChangeListenerAdded = true;
this.listen(document, 'visibilitychange', '_onVisibililityChange');
@@ -174,10 +174,10 @@
computeFailedRequiredChecksCount(checks) {
const failedRequiredChecks = checks.filter(
- check => {
- return check.state == Statuses.FAILED &&
+ check => {
+ return check.state == Statuses.FAILED &&
check.blocking && check.blocking.length > 0;
- }
+ }
);
return failedRequiredChecks.length;
},
@@ -191,7 +191,7 @@
if (!checkStatuses) return;
if (checkStatuses.total === 0) return 'No checks';
let statusString = `${checkStatuses[status]} of ${
- checkStatuses.total} checks ${HumanizedStatuses[status]}`;
+ checkStatuses.total} checks ${HumanizedStatuses[status]}`;
if (status === Statuses.FAILED && failedRequiredChecksCount > 0) {
statusString += ` (${failedRequiredChecksCount} required)`;
}
diff --git a/gr-checks/gr-checks-chip-view_test.html b/gr-checks/gr-checks-chip-view_test.html
index b13a855..e17d772 100644
--- a/gr-checks/gr-checks-chip-view_test.html
+++ b/gr-checks/gr-checks-chip-view_test.html
@@ -18,16 +18,16 @@
const CHECK1 = {
checkId: 'test-check-id',
log: 'http://example.com/test-log-url',
- started: "2019-02-06T22:25:19.269Z",
- finished: "2019-02-06T22:25:44.574Z",
+ started: '2019-02-06T22:25:19.269Z',
+ finished: '2019-02-06T22:25:44.574Z',
state: 'SUCCESSFUL',
};
const CHECK2 = {
checkId: 'test-check-id-2',
log: 'http://example.com/test-log-url',
- started: "2019-02-06T22:25:19.269Z",
- finished: "2019-02-06T22:25:44.574Z",
+ started: '2019-02-06T22:25:19.269Z',
+ finished: '2019-02-06T22:25:44.574Z',
state: 'FAILED',
};
@@ -36,7 +36,7 @@
let sandbox;
let getChecksSpy;
- setup((done) => {
+ setup(done => {
sandbox = sinon.sandbox.create();
getChecksSpy = sinon.stub();
@@ -45,10 +45,10 @@
element = fixture('basic', {
getChecks: getChecksSpy,
change: {
- '_number': 314,
+ _number: 314,
},
revision: {
- '_number': 271,
+ _number: 271,
},
});
flush(done);
diff --git a/gr-checks/gr-checks-item.js b/gr-checks/gr-checks-item.js
index 572ba2e..63777b9 100644
--- a/gr-checks/gr-checks-item.js
+++ b/gr-checks/gr-checks-item.js
@@ -38,12 +38,12 @@
},
_requiredForMerge: {
type: String,
- computed: '_computeRequiredForMerge(check)'
+ computed: '_computeRequiredForMerge(check)',
},
showCheckMessage: {
type: Boolean,
value: false,
- }
+ },
},
/**
@@ -52,23 +52,22 @@
* @event retry-check
*/
-
/**
* @param {!Defs.Check} check
* @return {string}
*/
_computeStartTime(check) {
- if (!check.started) return "-";
+ if (!check.started) return '-';
return check.started;
},
_toggleMessageShown() {
this.showCheckMessage = !this.showCheckMessage;
- this.fire('toggle-check-message', {uuid: this.check.checker_uuid})
+ this.fire('toggle-check-message', {uuid: this.check.checker_uuid});
},
_computeExpandIcon(showCheckMessage) {
- return showCheckMessage ? "gr-icons:expand-less": "gr-icons:expand-more";
+ return showCheckMessage ? 'gr-icons:expand-less': 'gr-icons:expand-more';
},
/**
@@ -77,7 +76,7 @@
*/
_computeDuration(check) {
if (!check.started || !check.finished) {
- return "-";
+ return '-';
}
const startTime = moment(check.started);
const finishTime = check.finished ? moment(check.finished) : moment();
@@ -90,11 +89,12 @@
* @return {string}
*/
_computeRequiredForMerge(check) {
- return (check.blocking && check.blocking.length === 0) ? "Optional" : "Required";
+ return (check.blocking && check.blocking.length === 0) ? 'Optional' :
+ 'Required';
},
_handleReRunClicked(event) {
- this.fire('retry-check',{uuid: this.check.checker_uuid},
- {bubbles: false});
+ this.fire('retry-check', {uuid: this.check.checker_uuid},
+ {bubbles: false});
},
});
diff --git a/gr-checks/gr-checks-item_test.html b/gr-checks/gr-checks-item_test.html
index 826f99d..fc12bba 100644
--- a/gr-checks/gr-checks-item_test.html
+++ b/gr-checks/gr-checks-item_test.html
@@ -23,7 +23,7 @@
let sandbox;
let retryCheckSpy;
- setup((done) => {
+ setup(done => {
sandbox = sinon.sandbox.create();
retryCheckSpy = sinon.stub();
retryCheckSpy.returns(Promise.resolve());
@@ -33,8 +33,8 @@
check: {
checkId: 'test-check-id',
url: 'http://example.com/test-log-url',
- started: "2019-02-06T22:25:19.269Z",
- finished: "2019-02-06T22:25:44.574Z",
+ started: '2019-02-06T22:25:19.269Z',
+ finished: '2019-02-06T22:25:44.574Z',
},
});
flush(done);
@@ -49,31 +49,32 @@
test('renders the run time', () => {
const name = element.$$('td:nth-child(6)');
- assert.equal(name .textContent.trim(), "11:25:19 PM");
+ assert.equal(name .textContent.trim(), '11:25:19 PM');
});
suite('duration', () => {
test('renders the run duration', () => {
const name = element.$$('td:nth-child(7)');
- assert.equal(name .textContent.trim(), "25 sec");
+ assert.equal(name .textContent.trim(), '25 sec');
});
test('renders 0 sec when the start and end time are the same', () => {
element.check = {
checkId: 'test-check-id',
url: 'http://example.com/test-log-url',
- started: "2019-02-06T22:25:19.269Z",
- finished: "2019-02-06T22:25:19.269Z",
+ started: '2019-02-06T22:25:19.269Z',
+ finished: '2019-02-06T22:25:19.269Z',
};
const name = element.$$('td:nth-child(7)');
- assert.equal(name .textContent.trim(), "0 sec");
+ assert.equal(name .textContent.trim(), '0 sec');
});
});
test('renders a link to the log', () => {
const logLink = element.$$('td:nth-child(8) > a');
- assert.equal(logLink.getAttribute('href'), "http://example.com/test-log-url");
- assert.equal(logLink.textContent.trim(), "View log");
+ assert.equal(logLink.getAttribute('href'),
+ 'http://example.com/test-log-url');
+ assert.equal(logLink.textContent.trim(), 'View log');
});
// pausing this check until retry api is available from backend
@@ -94,6 +95,5 @@
// assert.isTrue(retryCheckSpy.called);
// });
// });
-
});
</script>
diff --git a/gr-checks/gr-checks-status.js b/gr-checks/gr-checks-status.js
index 908fde5..565e11a 100644
--- a/gr-checks/gr-checks-status.js
+++ b/gr-checks/gr-checks-status.js
@@ -1,5 +1,5 @@
(function() {
-'use strict';
+ 'use strict';
Polymer({
is: 'gr-checks-status',
@@ -11,7 +11,7 @@
reflectToAttribute: true,
},
status: String,
- downgradeFailureToWarning: String
+ downgradeFailureToWarning: String,
},
_isUnevaluated(status) {
@@ -35,11 +35,13 @@
},
_isFailed(status) {
- return !this.downgradeFailureToWarning && window.Gerrit.Checks.isFailed(status);
+ return !this.downgradeFailureToWarning &&
+ window.Gerrit.Checks.isFailed(status);
},
_isWarning(status) {
- return this.downgradeFailureToWarning && window.Gerrit.Checks.isFailed(status);
+ return this.downgradeFailureToWarning &&
+ window.Gerrit.Checks.isFailed(status);
},
});
diff --git a/gr-checks/gr-checks-status_test.html b/gr-checks/gr-checks-status_test.html
index bc59777..f4c5fab 100644
--- a/gr-checks/gr-checks-status_test.html
+++ b/gr-checks/gr-checks-status_test.html
@@ -16,7 +16,6 @@
<script>
suite('gr-checks-status tests', () => {
- let element;
let sandbox;
setup(() => {
@@ -27,9 +26,8 @@
function testStatus(expectedStatusClass, statusText, statusesToTest) {
suite(expectedStatusClass, () => {
-
- for(let statusToTest of statusesToTest) {
- test(`renders ${expectedStatusClass} for ${statusToTest}`, (done) => {
+ for (const statusToTest of statusesToTest) {
+ test(`renders ${expectedStatusClass} for ${statusToTest}`, done => {
const element = fixture('basic', {
status: statusToTest,
showText: false,
@@ -41,7 +39,8 @@
done();
});
});
- test(`renders ${expectedStatusClass} for ${statusToTest} rendering text ${statusText}`, (done) => {
+ test(`renders ${expectedStatusClass} for ${statusToTest} rendering
+ text ${statusText}`, done => {
const element = fixture('basic', {
status: statusToTest,
showText: true,
diff --git a/gr-checks/gr-checks-view.js b/gr-checks/gr-checks-view.js
index fdd86e3..096da03 100644
--- a/gr-checks/gr-checks-view.js
+++ b/gr-checks/gr-checks-view.js
@@ -55,11 +55,11 @@
pollChecksInterval: Number,
visibilityChangeListenerAdded: {
type: Boolean,
- value: false
+ value: false,
},
_createCheckerCapability: {
type: Boolean,
- value: false
+ value: false,
},
},
@@ -87,12 +87,12 @@
return this.pluginRestApi.getAccount().then(account => {
if (!account) { return; }
return this.pluginRestApi
- .getAccountCapabilities(['checks-administrateCheckers'])
- .then(capabilities => {
- if (capabilities['checks-administrateCheckers']) {
- this._createCheckerCapability = true;
- }
- });
+ .getAccountCapabilities(['checks-administrateCheckers'])
+ .then(capabilities => {
+ if (capabilities['checks-administrateCheckers']) {
+ this._createCheckerCapability = true;
+ }
+ });
});
},
@@ -102,15 +102,16 @@
_orderChecks(a, b) {
if (a.state != b.state) {
- let indexA = StatusPriorityOrder.indexOf(a.state);
- let indexB = StatusPriorityOrder.indexOf(b.state);
+ const indexA = StatusPriorityOrder.indexOf(a.state);
+ const indexB = StatusPriorityOrder.indexOf(b.state);
if (indexA != -1 && indexB != -1) {
return indexA - indexB;
}
return indexA == -1 ? 1 : -1;
}
if (a.state === Statuses.FAILED) {
- if (a.blocking && b.blocking && a.blocking.length !== b.blocking.length) {
+ if (a.blocking && b.blocking &&
+ a.blocking.length !== b.blocking.length) {
return a.blocking.length == 0 ? 1 : -1;
}
}
@@ -121,19 +122,19 @@
const uuid = e.detail.uuid;
const retryCheck = (change, revision, uuid) => {
return this.pluginRestApi.post(
- '/changes/' + change + '/revisions/' + revision + '/checks/' + uuid + '/rerun'
- )
- }
+ '/changes/' + change + '/revisions/' + revision + '/checks/' + uuid
+ + '/rerun'
+ );
+ };
retryCheck(this.change._number, this.revision._number, uuid).then(
- res => {
- this._fetchChecks(this.change, this.revision, this.getChecks);
- }, e => {
- console.error(e);
- }
- )
+ res => {
+ this._fetchChecks(this.change, this.revision, this.getChecks);
+ }, e => {
+ console.error(e);
+ }
+ );
},
-
/**
* Merge new checks into old checks to maintain showCheckMessage
* property
@@ -144,14 +145,14 @@
*/
_updateChecks(checks) {
return checks.map(
- (check) => {
- const prevCheck = this._checks.find(
- (c) => { return c.checker_uuid === check.checker_uuid }
- )
- if (!prevCheck) return Object.assign({}, check);
- return Object.assign({}, prevCheck, check,
- {showCheckMessage: prevCheck.showCheckMessage});
- });
+ check => {
+ const prevCheck = this._checks.find(
+ c => { return c.checker_uuid === check.checker_uuid; }
+ );
+ if (!prevCheck) return Object.assign({}, check);
+ return Object.assign({}, prevCheck, check,
+ {showCheckMessage: prevCheck.showCheckMessage});
+ });
},
/**
@@ -188,17 +189,17 @@
_toggleCheckMessage(e) {
const uuid = e.detail.uuid;
if (!uuid) {
- console.warn("uuid not found");
+ console.warn('uuid not found');
return;
}
const idx = this._checks.findIndex(check => check.checker_uuid === uuid);
if (idx == -1) {
- console.warn("check not found");
+ console.warn('check not found');
return;
}
// Update subproperty of _checks[idx] so that it reflects to polymer
this.set(`_checks.${idx}.showCheckMessage`,
- !this._checks[idx].showCheckMessage)
+ !this._checks[idx].showCheckMessage);
},
_pollChecksRegularly(change, revision, getChecks) {
@@ -207,7 +208,7 @@
}
const poll = () => this._fetchChecks(change, revision, getChecks);
poll();
- this.pollChecksInterval = setInterval(poll, CHECKS_POLL_INTERVAL_MS)
+ this.pollChecksInterval = setInterval(poll, CHECKS_POLL_INTERVAL_MS);
if (!this.visibilityChangeListenerAdded) {
this.visibilityChangeListenerAdded = true;
this.listen(document, 'visibilitychange', '_onVisibililityChange');
diff --git a/gr-checks/gr-checks-view_test.html b/gr-checks/gr-checks-view_test.html
index 1f54281..a801b9f 100644
--- a/gr-checks/gr-checks-view_test.html
+++ b/gr-checks/gr-checks-view_test.html
@@ -17,7 +17,7 @@
<script>
Polymer({
is: 'gr-overlay',
- refit() {}
+ refit() {},
});
</script>
</dom-module>
@@ -39,44 +39,44 @@
const CHECK1 = {
checkId: 'test-check-id',
logUrl: 'http://example.com/test-log-url',
- startTime: "2019-02-06T22:25:19.269Z",
- finishTime: "2019-02-06T22:25:44.574Z",
- checker_name: "test checker",
- state: "RUNNING",
- checker_status: "ENABLED",
+ startTime: '2019-02-06T22:25:19.269Z',
+ finishTime: '2019-02-06T22:25:44.574Z',
+ checker_name: 'test checker',
+ state: 'RUNNING',
+ checker_status: 'ENABLED',
blocking: [],
- checker_description: "No-op jobs for testing purposes",
- message: "added test file\n\nChange-Id: I8df212a28ae23cc239afd10ee4f506887e03ab70\n",
+ checker_description: 'No-op jobs for testing purposes',
+ message: '\n\nChange-Id: I8df212a28ae23cc239afd10ee4f506887e03ab70\n',
showCheckMessage: undefined,
- checker_uuid: "gerritforge:codestyle-a6a0e4682515f3521897c5f950d1394f4619d928",
+ checker_uuid: 'codestyle-a6a0e4682515f3521897c5f950d1394f4619d928',
};
const CHECK2 = {
checkId: 'test-check-id2',
logUrl: 'http://example.com/test-log-url',
- startTime: "2019-02-06T22:25:19.269Z",
- finishTime: "2019-02-06T22:25:44.574Z",
- checker_name: "test checker2",
- state: "RUNNING",
- checker_status: "ENABLED",
+ startTime: '2019-02-06T22:25:19.269Z',
+ finishTime: '2019-02-06T22:25:44.574Z',
+ checker_name: 'test checker2',
+ state: 'RUNNING',
+ checker_status: 'ENABLED',
blocking: [],
- checker_description: "No-op jobs for testing purposes 2",
- message: "added test file\n\nChange-Id: I8df212a28ae23cc239afd10ee4f506887e03ab70\n",
+ checker_description: 'No-op jobs for testing purposes 2',
+ message: '\n\nChange-Id: I8df212a28ae23cc239afd10ee4f506887e03ab70\n',
showCheckMessage: undefined,
- checker_uuid: "gerritforge:polygerrit-a6a0e4682515f3521897c5f950d1394f4619d928",
+ checker_uuid: 'polygerrit-a6a0e4682515f3521897c5f950d1394f4619d928',
};
const REVISION = {
- "kind": "REWORK",
- "_number": 3,
- "created": "2018-05-15 21:56:13.000000000",
- "uploader": {
- "_account_id": 1000000,
+ kind: 'REWORK',
+ _number: 3,
+ created: '2018-05-15 21:56:13.000000000',
+ uploader: {
+ _account_id: 1000000,
},
- "ref": "refs/changes/00/1000/1",
- "commit": {
- "parents": [],
- "subject": "added test file",
- "message": "added test file\n\nChange-Id: I8df212a28ae23cc239afd10ee4f506887e03ab70\n",
- "commit": "1c9a1dfd38ea51dc7880f3ddf669100710f0c91b"
+ ref: 'refs/changes/00/1000/1',
+ commit: {
+ parents: [],
+ subject: '',
+ message: '\n\nChange-Id: I8df212a28ae23cc239afd10ee4f506887e03ab70\n',
+ commit: '1c9a1dfd38ea51dc7880f3ddf669100710f0c91b',
},
};
@@ -88,12 +88,12 @@
let retryCheckSpy;
let isConfiguredSpy;
let isConfiguredResolve;
- let getAccountSpy, getAccountPromise, getAccountResolve;
- let fetchJSONSpy, fetchJSONPromise, fetchJSONResolve;
- let getAccountCapabilitiesSpy, getAccountCapabilitiesPromise,
- getAccountCapabilitiesResolve;
+ let getAccountSpy; let getAccountResolve;
+ let fetchJSONSpy; let fetchJSONResolve;
+ let getAccountCapabilitiesSpy;
+ let getAccountCapabilitiesResolve;
- setup((done) => {
+ setup(done => {
sandbox = sinon.sandbox.create();
getChecksSpy = sinon.stub();
@@ -115,39 +115,39 @@
getAccountSpy = sinon.stub();
const getAccountPromise = new Promise((resolve, reject) => {
getAccountResolve = resolve;
- })
+ });
getAccountSpy.returns(getAccountPromise);
fetchJSONSpy = sinon.stub();
const fetchJSONPromise = new Promise((resolve, reject) => {
fetchJSONResolve = resolve;
- })
- fetchJSONSpy.returns(fetchJSONPromise)
+ });
+ fetchJSONSpy.returns(fetchJSONPromise);
getAccountCapabilitiesSpy = sinon.stub();
const getAccountCapabilitiesPromise = new Promise((resolve, reject) => {
getAccountCapabilitiesResolve = resolve;
- })
+ });
getAccountCapabilitiesSpy.returns(getAccountCapabilitiesPromise);
plugin.restApi = () => ({
getAccount: getAccountSpy,
fetchJSON: fetchJSONSpy,
- getAccountCapabilities: getAccountCapabilitiesSpy
+ getAccountCapabilities: getAccountCapabilitiesSpy,
});
element = fixture('basic', {
retryCheck: retryCheckSpy,
getChecks: getChecksSpy,
isConfigured: isConfiguredSpy,
change: {
- 'project': 'test-repository',
- '_number': 2,
- 'revisions': {
- 'first-sha': "test-revision",
+ project: 'test-repository',
+ _number: 2,
+ revisions: {
+ 'first-sha': 'test-revision',
'second-sha': REVISION,
},
},
- plugin: plugin,
+ plugin,
revision: REVISION,
});
flush(done);
@@ -166,7 +166,7 @@
});
suite('no checks returned', () => {
- setup((done) => {
+ setup(done => {
getChecksResolve([]);
flush(done);
});
@@ -181,18 +181,19 @@
});
suite('not configured', () => {
- setup((done) => {
+ setup(done => {
isConfiguredResolve(false);
flush(done);
});
test('renders checks not configured', () => {
const header = element.$$('h2');
- assert.equal(header.textContent.trim(), 'Code review checks not configured');
+ assert.equal(header.textContent.trim(),
+ 'Code review checks not configured');
});
suite('create checker capability false', () => {
- setup((done) => {
+ setup(done => {
getAccountResolve(true);
getAccountCapabilitiesResolve({'checks-administrateCheckers': false});
flush(done);
@@ -203,7 +204,7 @@
});
suite('create checker capability true', () => {
- setup((done) => {
+ setup(done => {
getAccountResolve(true);
getAccountCapabilitiesResolve({'checks-administrateCheckers': true});
flush(done);
@@ -212,24 +213,24 @@
assert(element.$$('gr-button'));
});
});
-
});
suite('no checks ran', () => {
- setup((done) => {
+ setup(done => {
isConfiguredResolve(true);
flush(done);
});
test('renders checks not configured', () => {
const header = element.$$('h2');
- assert.equal(header.textContent.trim(), 'No checks ran for this code review');
+ assert.equal(header.textContent.trim(),
+ 'No checks ran for this code review');
});
});
});
suite('checks updated properly', () => {
- setup((done) => {
+ setup(done => {
element._checks = [CHECK1, CHECK2];
flush(done);
});
@@ -237,12 +238,12 @@
test('message is updated', () => {
const NEW_CHECKS = [Object.assign({}, CHECK1),
Object.assign({}, CHECK2)];
- NEW_CHECKS[0].message = "New message 1";
- NEW_CHECKS[1].message = "New message 2";
+ NEW_CHECKS[0].message = 'New message 1';
+ NEW_CHECKS[1].message = 'New message 2';
const EXPECTED_CHECKS = [Object.assign({}, CHECK1),
Object.assign({}, CHECK2)];
- EXPECTED_CHECKS[0].message = "New message 1";
- EXPECTED_CHECKS[1].message = "New message 2";
+ EXPECTED_CHECKS[0].message = 'New message 1';
+ EXPECTED_CHECKS[1].message = 'New message 2';
const UPDATED_CHECKS = element._updateChecks(NEW_CHECKS);
assert.equal(UPDATED_CHECKS[0].message, NEW_CHECKS[0].message);
assert.equal(UPDATED_CHECKS[1].message, NEW_CHECKS[1].message);
@@ -259,14 +260,13 @@
test('status is updated', () => {
const NEW_CHECKS = [Object.assign({}, CHECK1),
Object.assign({}, CHECK2)];
- NEW_CHECKS[0].state = "SUCCESSFUL";
- NEW_CHECKS[1].state = "FAILED";
+ NEW_CHECKS[0].state = 'SUCCESSFUL';
+ NEW_CHECKS[1].state = 'FAILED';
const UPDATED_CHECKS = element._updateChecks(NEW_CHECKS);
assert.deepEqual(UPDATED_CHECKS, NEW_CHECKS);
});
test('showMessage property is retained', () => {
-
element._checks[0].showCheckMessage = true;
element._checks[1].showCheckMessage = false;
@@ -274,13 +274,12 @@
Object.assign({}, CHECK2)];
const UPDATED_CHECKS = element._updateChecks(NEW_CHECKS);
assert.equal(UPDATED_CHECKS[0].showCheckMessage,
- CHECK1.showCheckMessage);
+ CHECK1.showCheckMessage);
assert.equal(UPDATED_CHECKS[1].showCheckMessage,
- CHECK2.showCheckMessage);
+ CHECK2.showCheckMessage);
element._checks[0].showCheckMessage = undefined;
element._checks[1].showCheckMessage = undefined;
-
});
test('message is not shown if new check has no message', () => {
@@ -290,7 +289,6 @@
const UPDATED_CHECKS = element._updateChecks(NEW_CHECKS);
assert.equal(UPDATED_CHECKS[0].message, NEW_CHECKS[0].message);
});
-
});
suite('with checks', () => {
@@ -310,11 +308,11 @@
test('renders a table of all the checks', () => {
const tbody = element.$$('table > tbody');
- assert.lengthOf(tbody.querySelectorAll('gr-checks-item'), 3)
+ assert.lengthOf(tbody.querySelectorAll('gr-checks-item'), 3);
});
suite('create checker capability false', () => {
- setup((done) => {
+ setup(done => {
getAccountResolve(true);
getAccountCapabilitiesResolve({'checks-administrateCheckers': false});
flush(done);
@@ -325,7 +323,7 @@
});
suite('create checker capability true', () => {
- setup((done) => {
+ setup(done => {
getAccountResolve(true);
getAccountCapabilitiesResolve({'checks-administrateCheckers': true});
flush(done);
@@ -334,7 +332,6 @@
assert(element.$$('gr-button'));
});
});
-
});
});
diff --git a/gr-checks/gr-checks.html b/gr-checks/gr-checks.html
index ceed087..7a636da 100644
--- a/gr-checks/gr-checks.html
+++ b/gr-checks/gr-checks.html
@@ -9,10 +9,9 @@
<dom-module id="gr-checks">
<script>
Gerrit.install(plugin => {
-
const getChecks = (change, revision) => {
return plugin.restApi().get(
- '/changes/' + change + '/revisions/' + revision + '/checks?o=CHECKER');
+ '/changes/' + change + '/revisions/' + revision + '/checks?o=CHECKER');
};
// TODO(brohlfs): Enable this dashboard column when search queries start
@@ -24,23 +23,23 @@
// 'change-list-item-cell',
// 'gr-checks-change-list-item-cell-view');
plugin.registerCustomComponent(
- 'commit-container',
- 'gr-checks-chip-view').onAttached(
- view => {
- view['getChecks'] = getChecks;
- }
+ 'commit-container',
+ 'gr-checks-chip-view').onAttached(
+ view => {
+ view['getChecks'] = getChecks;
+ }
);
plugin.registerDynamicCustomComponent(
- 'change-view-tab-header',
- 'gr-checks-change-view-tab-header-view'
+ 'change-view-tab-header',
+ 'gr-checks-change-view-tab-header-view'
);
plugin.registerDynamicCustomComponent(
- 'change-view-tab-content',
- 'gr-checks-view').onAttached(
- view => {
- view['isConfigured'] = (repository) => Promise.resolve(true);
- view['getChecks'] = getChecks;
- });
- });
+ 'change-view-tab-content',
+ 'gr-checks-view').onAttached(
+ view => {
+ view['isConfigured'] = repository => Promise.resolve(true);
+ view['getChecks'] = getChecks;
+ });
+ });
</script>
</dom-module>
diff --git a/gr-checks/gr-create-checkers-dialog.js b/gr-checks/gr-create-checkers-dialog.js
index 2c0dd25..51be8c0 100644
--- a/gr-checks/gr-create-checkers-dialog.js
+++ b/gr-checks/gr-create-checkers-dialog.js
@@ -11,14 +11,14 @@
properties: {
checker: {
type: Object,
- observer: '_checkerChanged'
+ observer: '_checkerChanged',
},
_name: String,
_scheme: String,
_id: String,
_uuid: {
type: String,
- value: ""
+ value: '',
},
pluginRestApi: Object,
_url: String,
@@ -26,8 +26,8 @@
_getRepoSuggestions: {
type: Function,
value() {
- return this._repoSuggestions.bind(this)
- }
+ return this._repoSuggestions.bind(this);
+ },
},
// The backend might support multiple repos in the future
// which is why I decided to keep it as an array.
@@ -38,37 +38,37 @@
},
_repositorySelected: {
type: Boolean,
- value: false
+ value: false,
},
_handleOnRemove: Function,
_errorMsg: {
type: String,
- value: ''
+ value: '',
},
_statuses: {
type: Array,
value: [
{
- "text": "ENABLED",
- "value": "ENABLED"
+ text: 'ENABLED',
+ value: 'ENABLED',
},
{
- "text": "DISABLED",
- "value": "DISABLED"
- }
+ text: 'DISABLED',
+ value: 'DISABLED',
+ },
],
- readOnly: true
+ readOnly: true,
},
_required: {
type: Boolean,
- value: false
+ value: false,
},
_status: String,
_edit: {
type: Boolean,
- value: false
+ value: false,
},
- _query: String
+ _query: String,
},
behaviours: [
@@ -80,14 +80,13 @@
* @event cancel
*/
-
observers: [
'_updateUUID(_scheme, _id)',
],
_checkerChanged() {
if (!this.checker) {
- console.warn("checker not set");
+ console.warn('checker not set');
return;
}
this._edit = true;
@@ -107,7 +106,7 @@
},
_updateUUID(_scheme, _id) {
- this._uuid = _scheme + ":" + _id;
+ this._uuid = _scheme + ':' + _id;
},
_handleStatusChange(e) {
@@ -156,47 +155,47 @@
_createChecker(checker) {
return this.pluginRestApi.send(
- 'POST',
- CREATE_CHECKER_URL,
- checker,
- )
+ 'POST',
+ CREATE_CHECKER_URL,
+ checker
+ );
},
_editChecker(checker) {
const url = CREATE_CHECKER_URL + checker.uuid;
return this.pluginRestApi.send(
- 'POST',
- url,
- checker
- )
+ 'POST',
+ url,
+ checker
+ );
},
handleEditChecker() {
if (!this._validateRequest()) return;
this._editChecker(this._getCheckerRequestObject()).then(
- res => {
- if (res) {
- this._errorMsg = '';
- this.fire('cancel', {reload: true}, {bubbles: true});
+ res => {
+ if (res) {
+ this._errorMsg = '';
+ this.fire('cancel', {reload: true}, {bubbles: true});
+ }
+ },
+ error => {
+ this._errorMsg = error;
}
- },
- error => {
- this._errorMsg = error;
- }
- )
+ );
},
_getCheckerRequestObject() {
return {
- "name" : this._name,
- "description" : this._description || '',
- "uuid" : this._uuid,
- "repository": this._repos[0].name,
- "url" : this._url,
- "status": this._status,
- "blocking": this._required ? ["STATE_NOT_PASSING"] : [],
- "query": this._query
- }
+ name: this._name,
+ description: this._description || '',
+ uuid: this._uuid,
+ repository: this._repos[0].name,
+ url: this._url,
+ status: this._status,
+ blocking: this._required ? ['STATE_NOT_PASSING'] : [],
+ query: this._query,
+ };
},
handleCreateChecker() {
@@ -204,13 +203,13 @@
// Currently after creating checker there is no reload happening (as
// this would result in the user exiting the screen).
this._createChecker(this._getCheckerRequestObject()).then(
- res => {
- if (res) this._cleanUp();
- },
- error => {
- this._errorMsg = error;
- }
- )
+ res => {
+ if (res) this._cleanUp();
+ },
+ error => {
+ this._errorMsg = error;
+ }
+ );
},
_cleanUp() {
@@ -229,10 +228,12 @@
},
_repoSuggestions(filter) {
- const _makeSuggestion = repo => {return {name: repo.name, value: repo}};
+ const _makeSuggestion = repo => {
+ return {name: repo.name, value: repo};
+ };
return this.pluginRestApi.getRepos(filter, REPOS_PER_PAGE).then(
- repos => repos.map(repo => _makeSuggestion(repo))
- )
+ repos => repos.map(repo => _makeSuggestion(repo))
+ );
},
_handleRepositorySelected(e) {
@@ -245,7 +246,7 @@
},
_handleOnRemove(e) {
- let idx = this._repos.indexOf(e.detail.repo);
+ const idx = this._repos.indexOf(e.detail.repo);
if (idx == -1) return;
this.splice('_repos', idx, 1);
if (this._repos.length == 0) {
diff --git a/gr-checks/gr-repo-chip.js b/gr-checks/gr-repo-chip.js
index 0e1a0bd..19aff38 100644
--- a/gr-checks/gr-repo-chip.js
+++ b/gr-checks/gr-repo-chip.js
@@ -18,6 +18,5 @@
e.preventDefault();
this.fire('remove', {repo: this.repo});
},
- })
-
+ });
})();
\ No newline at end of file
diff --git a/test/index.html b/test/index.html
index b1ffd08..f132465 100644
--- a/test/index.html
+++ b/test/index.html
@@ -29,6 +29,6 @@
'../gr-checks/gr-checks-chip-view_test.html',
'../gr-checks/gr-checks-item_test.html',
'../gr-checks/gr-checks-status_test.html',
- '../gr-checks/gr-checks-view_test.html'
+ '../gr-checks/gr-checks-view_test.html',
]);
</script>
\ No newline at end of file