Add basic scaffolding for the checks tab
Change-Id: I7a0d80ca17a3429cd340fc7f26bf0ac828ebeac4
This commit is contained in:
@@ -21,10 +21,11 @@
|
|||||||
export enum PrimaryTab {
|
export enum PrimaryTab {
|
||||||
FILES = 'files',
|
FILES = 'files',
|
||||||
/**
|
/**
|
||||||
* When renaming this, the links in UrlFormatter must be updated.
|
* When renaming 'comments' or 'findings', UrlFormatter.java must be updated.
|
||||||
*/
|
*/
|
||||||
COMMENT_THREADS = 'comments',
|
COMMENT_THREADS = 'comments',
|
||||||
FINDINGS = 'findings',
|
FINDINGS = 'findings',
|
||||||
|
CHECKS = 'checks',
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -43,6 +43,7 @@ import '../../diff/gr-apply-fix-dialog/gr-apply-fix-dialog';
|
|||||||
import '../gr-reply-dialog/gr-reply-dialog';
|
import '../gr-reply-dialog/gr-reply-dialog';
|
||||||
import '../gr-thread-list/gr-thread-list';
|
import '../gr-thread-list/gr-thread-list';
|
||||||
import '../gr-upload-help-dialog/gr-upload-help-dialog';
|
import '../gr-upload-help-dialog/gr-upload-help-dialog';
|
||||||
|
import '../../checks/gr-checks-tab';
|
||||||
import {flush} from '@polymer/polymer/lib/legacy/polymer.dom';
|
import {flush} from '@polymer/polymer/lib/legacy/polymer.dom';
|
||||||
import {GestureEventListeners} from '@polymer/polymer/lib/mixins/gesture-event-listeners';
|
import {GestureEventListeners} from '@polymer/polymer/lib/mixins/gesture-event-listeners';
|
||||||
import {LegacyElementMixin} from '@polymer/polymer/lib/legacy/legacy-element-mixin';
|
import {LegacyElementMixin} from '@polymer/polymer/lib/legacy/legacy-element-mixin';
|
||||||
@@ -153,6 +154,7 @@ import {GrMessagesList} from '../gr-messages-list/gr-messages-list';
|
|||||||
import {GrThreadList} from '../gr-thread-list/gr-thread-list';
|
import {GrThreadList} from '../gr-thread-list/gr-thread-list';
|
||||||
import {PORTING_COMMENTS_CHANGE_LATENCY_LABEL} from '../../../services/gr-reporting/gr-reporting';
|
import {PORTING_COMMENTS_CHANGE_LATENCY_LABEL} from '../../../services/gr-reporting/gr-reporting';
|
||||||
import {fire, EventType} from '../../../utils/event-util';
|
import {fire, EventType} from '../../../utils/event-util';
|
||||||
|
import {KnownExperimentId} from '../../../services/flags/flags';
|
||||||
|
|
||||||
const CHANGE_ID_ERROR = {
|
const CHANGE_ID_ERROR = {
|
||||||
MISMATCH: 'mismatch',
|
MISMATCH: 'mismatch',
|
||||||
@@ -263,6 +265,8 @@ export class GrChangeView extends KeyboardShortcutMixin(
|
|||||||
|
|
||||||
reporting = appContext.reportingService;
|
reporting = appContext.reportingService;
|
||||||
|
|
||||||
|
flagsService = appContext.flagsService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL params passed from the router.
|
* URL params passed from the router.
|
||||||
*/
|
*/
|
||||||
@@ -532,6 +536,8 @@ export class GrChangeView extends KeyboardShortcutMixin(
|
|||||||
|
|
||||||
_throttledToggleChangeStar?: EventListener;
|
_throttledToggleChangeStar?: EventListener;
|
||||||
|
|
||||||
|
_isChecksEnabled = false;
|
||||||
|
|
||||||
keyboardShortcuts() {
|
keyboardShortcuts() {
|
||||||
return {
|
return {
|
||||||
[Shortcut.SEND_REPLY]: null, // DOC_ONLY binding
|
[Shortcut.SEND_REPLY]: null, // DOC_ONLY binding
|
||||||
@@ -555,6 +561,14 @@ export class GrChangeView extends KeyboardShortcutMixin(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
ready() {
|
||||||
|
super.ready();
|
||||||
|
this._isChecksEnabled = this.flagsService.isEnabled(
|
||||||
|
KnownExperimentId.CI_REBOOT_CHECKS
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
|
@@ -558,6 +558,11 @@ export const htmlTemplate = html`
|
|||||||
<span>Comments</span></gr-tooltip-content
|
<span>Comments</span></gr-tooltip-content
|
||||||
>
|
>
|
||||||
</paper-tab>
|
</paper-tab>
|
||||||
|
<template is="dom-if" if="[[_isChecksEnabled]]">
|
||||||
|
<paper-tab data-name$="[[_constants.PrimaryTab.CHECKS]]"
|
||||||
|
>Checks</paper-tab
|
||||||
|
>
|
||||||
|
</template>
|
||||||
<template
|
<template
|
||||||
is="dom-repeat"
|
is="dom-repeat"
|
||||||
items="[[_dynamicTabHeaderEndpoints]]"
|
items="[[_dynamicTabHeaderEndpoints]]"
|
||||||
@@ -646,6 +651,12 @@ export const htmlTemplate = html`
|
|||||||
unresolved-only
|
unresolved-only
|
||||||
></gr-thread-list>
|
></gr-thread-list>
|
||||||
</template>
|
</template>
|
||||||
|
<template
|
||||||
|
is="dom-if"
|
||||||
|
if="[[_isTabActive(_constants.PrimaryTab.CHECKS, _activeTabs)]]"
|
||||||
|
>
|
||||||
|
<gr-checks-tab id="checksTab"></gr-checks-tab>
|
||||||
|
</template>
|
||||||
<template
|
<template
|
||||||
is="dom-if"
|
is="dom-if"
|
||||||
if="[[_isTabActive(_constants.PrimaryTab.FINDINGS, _activeTabs)]]"
|
if="[[_isTabActive(_constants.PrimaryTab.FINDINGS, _activeTabs)]]"
|
||||||
|
36
polygerrit-ui/app/elements/checks/gr-checks-tab.ts
Normal file
36
polygerrit-ui/app/elements/checks/gr-checks-tab.ts
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright (C) 2020 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
import {html} from 'lit-html';
|
||||||
|
import {customElement} from 'lit-element';
|
||||||
|
import {GrLitElement} from '../lit/gr-lit-element';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The "Checks" tab on the Gerrit change page. Gets its data from plugins that
|
||||||
|
* have registered with the Checks Plugin API.
|
||||||
|
*/
|
||||||
|
@customElement('gr-checks-tab')
|
||||||
|
export class GrChecksTab extends GrLitElement {
|
||||||
|
render() {
|
||||||
|
return html`<span>Hello Checks!</span>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'gr-checks-tab': GrChecksTab;
|
||||||
|
}
|
||||||
|
}
|
26
polygerrit-ui/app/elements/checks/gr-checks-tab_test.ts
Normal file
26
polygerrit-ui/app/elements/checks/gr-checks-tab_test.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright (C) 2020 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import '../../test/common-test-setup-karma';
|
||||||
|
import {GrChecksTab} from './gr-checks-tab';
|
||||||
|
|
||||||
|
suite('gr-checks-tab test', () => {
|
||||||
|
test('is defined', () => {
|
||||||
|
const el = document.createElement('gr-checks-tab');
|
||||||
|
assert.instanceOf(el, GrChecksTab);
|
||||||
|
});
|
||||||
|
});
|
@@ -26,4 +26,5 @@ export interface FlagsService {
|
|||||||
export enum KnownExperimentId {
|
export enum KnownExperimentId {
|
||||||
PATCHSET_COMMENTS = 'UiFeature__patchset_comments',
|
PATCHSET_COMMENTS = 'UiFeature__patchset_comments',
|
||||||
NEW_CONTEXT_CONTROLS = 'UiFeature__new_context_controls',
|
NEW_CONTEXT_CONTROLS = 'UiFeature__new_context_controls',
|
||||||
|
CI_REBOOT_CHECKS = 'UiFeature__ci_reboot_checks',
|
||||||
}
|
}
|
||||||
|
@@ -200,8 +200,8 @@ func handleSrcRequest(compiledSrcPath string, dirListingMux *http.ServeMux, writ
|
|||||||
data = moduleImportRegexp.ReplaceAll(data, []byte("${1}tslib/tslib.es6.js';"))
|
data = moduleImportRegexp.ReplaceAll(data, []byte("${1}tslib/tslib.es6.js';"))
|
||||||
|
|
||||||
// 'lit-element' imports and exports have to be resolved to 'lit-element/lit-element.js'.
|
// 'lit-element' imports and exports have to be resolved to 'lit-element/lit-element.js'.
|
||||||
moduleImportRegexp = regexp.MustCompile("(?m)^((import|export).*'/node_modules/)lit-element.js';$")
|
moduleImportRegexp = regexp.MustCompile("(?m)^((import|export).*'/node_modules/)lit-(element|html).js';$")
|
||||||
data = moduleImportRegexp.ReplaceAll(data, []byte("${1}lit-element/lit-element.js';"))
|
data = moduleImportRegexp.ReplaceAll(data, []byte("${1}lit-${3}/lit-${3}.js';"))
|
||||||
|
|
||||||
if strings.HasSuffix(normalizedContentPath, "/node_modules/page/page.js") {
|
if strings.HasSuffix(normalizedContentPath, "/node_modules/page/page.js") {
|
||||||
// Can't import page.js directly, because this is undefined.
|
// Can't import page.js directly, because this is undefined.
|
||||||
|
Reference in New Issue
Block a user