Add basic scaffolding for the checks tab
Change-Id: I7a0d80ca17a3429cd340fc7f26bf0ac828ebeac4
This commit is contained in:
@@ -21,10 +21,11 @@
|
||||
export enum PrimaryTab {
|
||||
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',
|
||||
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-thread-list/gr-thread-list';
|
||||
import '../gr-upload-help-dialog/gr-upload-help-dialog';
|
||||
import '../../checks/gr-checks-tab';
|
||||
import {flush} from '@polymer/polymer/lib/legacy/polymer.dom';
|
||||
import {GestureEventListeners} from '@polymer/polymer/lib/mixins/gesture-event-listeners';
|
||||
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 {PORTING_COMMENTS_CHANGE_LATENCY_LABEL} from '../../../services/gr-reporting/gr-reporting';
|
||||
import {fire, EventType} from '../../../utils/event-util';
|
||||
import {KnownExperimentId} from '../../../services/flags/flags';
|
||||
|
||||
const CHANGE_ID_ERROR = {
|
||||
MISMATCH: 'mismatch',
|
||||
@@ -263,6 +265,8 @@ export class GrChangeView extends KeyboardShortcutMixin(
|
||||
|
||||
reporting = appContext.reportingService;
|
||||
|
||||
flagsService = appContext.flagsService;
|
||||
|
||||
/**
|
||||
* URL params passed from the router.
|
||||
*/
|
||||
@@ -532,6 +536,8 @@ export class GrChangeView extends KeyboardShortcutMixin(
|
||||
|
||||
_throttledToggleChangeStar?: EventListener;
|
||||
|
||||
_isChecksEnabled = false;
|
||||
|
||||
keyboardShortcuts() {
|
||||
return {
|
||||
[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 */
|
||||
connectedCallback() {
|
||||
super.connectedCallback();
|
||||
|
@@ -558,6 +558,11 @@ export const htmlTemplate = html`
|
||||
<span>Comments</span></gr-tooltip-content
|
||||
>
|
||||
</paper-tab>
|
||||
<template is="dom-if" if="[[_isChecksEnabled]]">
|
||||
<paper-tab data-name$="[[_constants.PrimaryTab.CHECKS]]"
|
||||
>Checks</paper-tab
|
||||
>
|
||||
</template>
|
||||
<template
|
||||
is="dom-repeat"
|
||||
items="[[_dynamicTabHeaderEndpoints]]"
|
||||
@@ -646,6 +651,12 @@ export const htmlTemplate = html`
|
||||
unresolved-only
|
||||
></gr-thread-list>
|
||||
</template>
|
||||
<template
|
||||
is="dom-if"
|
||||
if="[[_isTabActive(_constants.PrimaryTab.CHECKS, _activeTabs)]]"
|
||||
>
|
||||
<gr-checks-tab id="checksTab"></gr-checks-tab>
|
||||
</template>
|
||||
<template
|
||||
is="dom-if"
|
||||
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 {
|
||||
PATCHSET_COMMENTS = 'UiFeature__patchset_comments',
|
||||
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';"))
|
||||
|
||||
// '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';$")
|
||||
data = moduleImportRegexp.ReplaceAll(data, []byte("${1}lit-element/lit-element.js';"))
|
||||
moduleImportRegexp = regexp.MustCompile("(?m)^((import|export).*'/node_modules/)lit-(element|html).js';$")
|
||||
data = moduleImportRegexp.ReplaceAll(data, []byte("${1}lit-${3}/lit-${3}.js';"))
|
||||
|
||||
if strings.HasSuffix(normalizedContentPath, "/node_modules/page/page.js") {
|
||||
// Can't import page.js directly, because this is undefined.
|
||||
|
Reference in New Issue
Block a user