This change adds an UI element that displays messages registered with the MessageOfTheDay extension point. The messages will be displayed below the main navigation header. This functionality was already part of the GWT-UI, but was never migrated to the new UI. The messages can be dismissed by a button click, that will create a cookie that will prevent the message from being displayed again until the redisplay time configured with the message. The content of the message can be HTML. Depending on where the message- content is coming from, this might be harmful. In case of the messageoftheday plugin, the message is added as a config from the Gerrit server site, which can probably be considered save. However, in a future change rendering HTML should be made configurable and switched off by default. Text should then be rendered using `gr-formatted-text`. Change-Id: I2cbbcbcd49734b645701b9fac62a016a269d37f2
		
			
				
	
	
		
			272 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			272 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<!--
 | 
						|
@license
 | 
						|
Copyright (C) 2015 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.
 | 
						|
-->
 | 
						|
<script>
 | 
						|
  // This must be set prior to loading Polymer for the first time.
 | 
						|
  if (localStorage.getItem('USE_SHADOW_DOM') === 'true') {
 | 
						|
    window.Polymer = {
 | 
						|
      dom: 'shadow',
 | 
						|
      passiveTouchGestures: true,
 | 
						|
    };
 | 
						|
  } else if (!window.Polymer) {
 | 
						|
    window.Polymer = {
 | 
						|
      passiveTouchGestures: true,
 | 
						|
    };
 | 
						|
  }
 | 
						|
  // Needed for JSCompiler to understand it's global.
 | 
						|
  // eslint-disable-next-line no-unused-vars, prefer-const
 | 
						|
  let Gerrit = window.Gerrit || {};
 | 
						|
  window.Gerrit = Gerrit;
 | 
						|
</script>
 | 
						|
 | 
						|
<link rel="import" href="../bower_components/polymer/polymer.html">
 | 
						|
<link rel="import" href="../bower_components/polymer-resin/standalone/polymer-resin.html">
 | 
						|
<link rel="import" href="../behaviors/safe-types-behavior/safe-types-behavior.html">
 | 
						|
<script>
 | 
						|
  security.polymer_resin.install({
 | 
						|
    allowedIdentifierPrefixes: [''],
 | 
						|
    reportHandler: security.polymer_resin.CONSOLE_LOGGING_REPORT_HANDLER,
 | 
						|
    safeTypesBridge: Gerrit.SafeTypes.safeTypesBridge,
 | 
						|
  });
 | 
						|
</script>
 | 
						|
 | 
						|
<link rel="import" href="../behaviors/base-url-behavior/base-url-behavior.html">
 | 
						|
<link rel="import" href="../behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.html">
 | 
						|
<link rel="import" href="../styles/shared-styles.html">
 | 
						|
<link rel="import" href="../styles/themes/app-theme.html">
 | 
						|
<link rel="import" href="./admin/gr-admin-view/gr-admin-view.html">
 | 
						|
<link rel="import" href="./documentation/gr-documentation-search/gr-documentation-search.html">
 | 
						|
<link rel="import" href="./change-list/gr-change-list-view/gr-change-list-view.html">
 | 
						|
<link rel="import" href="./change-list/gr-dashboard-view/gr-dashboard-view.html">
 | 
						|
<link rel="import" href="./change/gr-change-view/gr-change-view.html">
 | 
						|
<link rel="import" href="./core/gr-error-manager/gr-error-manager.html">
 | 
						|
<link rel="import" href="./core/gr-keyboard-shortcuts-dialog/gr-keyboard-shortcuts-dialog.html">
 | 
						|
<link rel="import" href="./core/gr-main-header/gr-main-header.html">
 | 
						|
<link rel="import" href="./core/gr-message-header/gr-message-header.html">
 | 
						|
<link rel="import" href="./core/gr-navigation/gr-navigation.html">
 | 
						|
<link rel="import" href="./core/gr-reporting/gr-reporting.html">
 | 
						|
<link rel="import" href="./core/gr-router/gr-router.html">
 | 
						|
<link rel="import" href="./diff/gr-diff-view/gr-diff-view.html">
 | 
						|
<link rel="import" href="./edit/gr-editor-view/gr-editor-view.html">
 | 
						|
<link rel="import" href="./plugins/gr-endpoint-decorator/gr-endpoint-decorator.html">
 | 
						|
<link rel="import" href="./plugins/gr-endpoint-param/gr-endpoint-param.html">
 | 
						|
<link rel="import" href="./plugins/gr-external-style/gr-external-style.html">
 | 
						|
<link rel="import" href="./plugins/gr-plugin-host/gr-plugin-host.html">
 | 
						|
<link rel="import" href="./settings/gr-cla-view/gr-cla-view.html">
 | 
						|
<link rel="import" href="./settings/gr-registration-dialog/gr-registration-dialog.html">
 | 
						|
<link rel="import" href="./settings/gr-settings-view/gr-settings-view.html">
 | 
						|
<link rel="import" href="./shared/gr-fixed-panel/gr-fixed-panel.html">
 | 
						|
<link rel="import" href="./shared/gr-lib-loader/gr-lib-loader.html">
 | 
						|
<link rel="import" href="./shared/gr-rest-api-interface/gr-rest-api-interface.html">
 | 
						|
 | 
						|
<script src="../scripts/util.js"></script>
 | 
						|
 | 
						|
<dom-module id="gr-app">
 | 
						|
  <template>
 | 
						|
    <style include="shared-styles">
 | 
						|
      :host {
 | 
						|
        background-color: var(--view-background-color);
 | 
						|
        display: flex;
 | 
						|
        flex-direction: column;
 | 
						|
        min-height: 100%;
 | 
						|
      }
 | 
						|
      gr-fixed-panel {
 | 
						|
        /**
 | 
						|
         * This one should be greater that the z-index in gr-diff-view
 | 
						|
         * because gr-main-header contains overlay.
 | 
						|
         */
 | 
						|
        z-index: 10;
 | 
						|
      }
 | 
						|
      gr-main-header,
 | 
						|
      footer {
 | 
						|
        color: var(--primary-text-color);
 | 
						|
      }
 | 
						|
      gr-main-header {
 | 
						|
        background: var(--header-background, var(--header-background-color, #eee));
 | 
						|
        padding: 0 var(--default-horizontal-margin);
 | 
						|
        border-bottom: var(--header-border-bottom);
 | 
						|
        border-image: var(--header-border-image);
 | 
						|
        border-right: 0;
 | 
						|
        border-left: 0;
 | 
						|
        border-top: 0;
 | 
						|
      }
 | 
						|
      gr-main-header.shadow {
 | 
						|
        /* Make it obvious for shadow dom testing */
 | 
						|
        border-bottom: 1px solid pink;
 | 
						|
      }
 | 
						|
      footer {
 | 
						|
        background: var(--footer-background, var(--footer-background-color, #eee));
 | 
						|
        border-top: var(--footer-border-top);
 | 
						|
        display: flex;
 | 
						|
        justify-content: space-between;
 | 
						|
        padding: .5rem var(--default-horizontal-margin);
 | 
						|
        z-index: 100;
 | 
						|
      }
 | 
						|
      main {
 | 
						|
        flex: 1;
 | 
						|
        padding-bottom: 2em;
 | 
						|
        position: relative;
 | 
						|
      }
 | 
						|
      .errorView {
 | 
						|
        align-items: center;
 | 
						|
        display: none;
 | 
						|
        flex-direction: column;
 | 
						|
        justify-content: center;
 | 
						|
        position: absolute;
 | 
						|
        top: 0;
 | 
						|
        right: 0;
 | 
						|
        bottom: 0;
 | 
						|
        left: 0;
 | 
						|
      }
 | 
						|
      .errorView.show {
 | 
						|
        display: flex;
 | 
						|
      }
 | 
						|
      .errorEmoji {
 | 
						|
        font-size: 2.6rem;
 | 
						|
      }
 | 
						|
      .errorText,
 | 
						|
      .errorMoreInfo {
 | 
						|
        margin-top: .75em;
 | 
						|
      }
 | 
						|
      .errorText {
 | 
						|
        font-size: 1.2rem;
 | 
						|
      }
 | 
						|
      .errorMoreInfo {
 | 
						|
        color: var(--deemphasized-text-color);
 | 
						|
      }
 | 
						|
      .feedback {
 | 
						|
        color: var(--error-text-color);
 | 
						|
      }
 | 
						|
    </style>
 | 
						|
    <gr-endpoint-decorator name="banner"></gr-endpoint-decorator>
 | 
						|
    <gr-fixed-panel id="header">
 | 
						|
      <gr-main-header
 | 
						|
          id="mainHeader"
 | 
						|
          search-query="{{params.query}}"
 | 
						|
          class$="[[_computeShadowClass(_isShadowDom)]]">
 | 
						|
      </gr-main-header>
 | 
						|
    </gr-fixed-panel>
 | 
						|
    <template
 | 
						|
        is="dom-repeat"
 | 
						|
        items="[[_getMessages(_serverConfig)]]"
 | 
						|
        as="message">
 | 
						|
      <gr-message-header message="{{message}}"></gr-message-header>
 | 
						|
    </template>
 | 
						|
    <main>
 | 
						|
      <template is="dom-if" if="[[_showChangeListView]]" restamp="true">
 | 
						|
        <gr-change-list-view
 | 
						|
            params="[[params]]"
 | 
						|
            account="[[_account]]"
 | 
						|
            view-state="{{_viewState.changeListView}}"></gr-change-list-view>
 | 
						|
      </template>
 | 
						|
      <template is="dom-if" if="[[_showDashboardView]]" restamp="true">
 | 
						|
        <gr-dashboard-view
 | 
						|
            account="[[_account]]"
 | 
						|
            params="[[params]]"
 | 
						|
            view-state="{{_viewState.dashboardView}}"></gr-dashboard-view>
 | 
						|
      </template>
 | 
						|
      <template is="dom-if" if="[[_showChangeView]]" restamp="true">
 | 
						|
        <gr-change-view
 | 
						|
            params="[[params]]"
 | 
						|
            view-state="{{_viewState.changeView}}"
 | 
						|
            back-page="[[_lastSearchPage]]"></gr-change-view>
 | 
						|
      </template>
 | 
						|
      <template is="dom-if" if="[[_showEditorView]]" restamp="true">
 | 
						|
        <gr-editor-view
 | 
						|
            params="[[params]]"></gr-editor-view>
 | 
						|
      </template>
 | 
						|
      <template is="dom-if" if="[[_showDiffView]]" restamp="true">
 | 
						|
          <gr-diff-view
 | 
						|
              params="[[params]]"
 | 
						|
              change-view-state="{{_viewState.changeView}}"></gr-diff-view>
 | 
						|
        </template>
 | 
						|
      <template is="dom-if" if="[[_showSettingsView]]" restamp="true">
 | 
						|
        <gr-settings-view
 | 
						|
            params="[[params]]"
 | 
						|
            on-account-detail-update="_handleAccountDetailUpdate">
 | 
						|
        </gr-settings-view>
 | 
						|
      </template>
 | 
						|
      <template is="dom-if" if="[[_showAdminView]]" restamp="true">
 | 
						|
        <gr-admin-view path="[[_path]]"
 | 
						|
            params=[[params]]></gr-admin-view>
 | 
						|
      </template>
 | 
						|
      <template is="dom-if" if="[[_showPluginScreen]]" restamp="true">
 | 
						|
        <gr-endpoint-decorator name="[[_pluginScreenName]]">
 | 
						|
          <gr-endpoint-param name="token" value="[[params.screen]]"></gr-endpoint-param>
 | 
						|
        </gr-endpoint-decorator>
 | 
						|
      </template>
 | 
						|
      <template is="dom-if" if="[[_showCLAView]]" restamp="true">
 | 
						|
        <gr-cla-view></gr-cla-view>
 | 
						|
      </template>
 | 
						|
      <template is="dom-if" if="[[_showDocumentationSearch]]" restamp="true">
 | 
						|
        <gr-documentation-search
 | 
						|
            params="[[params]]">
 | 
						|
        </gr-documentation-search>
 | 
						|
      </template>
 | 
						|
      <div id="errorView" class="errorView">
 | 
						|
        <div class="errorEmoji">[[_lastError.emoji]]</div>
 | 
						|
        <div class="errorText">[[_lastError.text]]</div>
 | 
						|
        <div class="errorMoreInfo">[[_lastError.moreInfo]]</div>
 | 
						|
      </div>
 | 
						|
    </main>
 | 
						|
    <footer r="contentinfo" class$="[[_computeShadowClass(_isShadowDom)]]">
 | 
						|
      <div>
 | 
						|
        Powered by <a href="https://www.gerritcodereview.com/" rel="noopener"
 | 
						|
        target="_blank">Gerrit Code Review</a>
 | 
						|
        ([[_version]])
 | 
						|
        <gr-endpoint-decorator name="footer-left"></gr-endpoint-decorator>
 | 
						|
      </div>
 | 
						|
      <div>
 | 
						|
        <template is="dom-if" if="[[_feedbackUrl]]">
 | 
						|
          <a class="feedback"
 | 
						|
              href$="[[_feedbackUrl]]"
 | 
						|
              rel="noopener"
 | 
						|
              target="_blank">Send feedback</a> |
 | 
						|
        </template>
 | 
						|
        <template is="dom-if" if="[[_computeShowGwtUiLink(_serverConfig)]]">
 | 
						|
          <a id="gwtLink" href$="[[computeGwtUrl(_path)]]" rel="external">Switch to Old UI</a> |
 | 
						|
        </template>
 | 
						|
        Press “?” for keyboard shortcuts
 | 
						|
        <gr-endpoint-decorator name="footer-right"></gr-endpoint-decorator>
 | 
						|
      </div>
 | 
						|
    </footer>
 | 
						|
    <gr-overlay id="keyboardShortcuts" with-backdrop>
 | 
						|
      <gr-keyboard-shortcuts-dialog
 | 
						|
          view="[[params.view]]"
 | 
						|
          on-close="_handleKeyboardShortcutDialogClose"></gr-keyboard-shortcuts-dialog>
 | 
						|
    </gr-overlay>
 | 
						|
    <gr-overlay id="registrationOverlay" with-backdrop>
 | 
						|
      <gr-registration-dialog
 | 
						|
          id="registrationDialog"
 | 
						|
          settings-url="[[_settingsUrl]]"
 | 
						|
          on-account-detail-update="_handleAccountDetailUpdate"
 | 
						|
          on-close="_handleRegistrationDialogClose">
 | 
						|
      </gr-registration-dialog>
 | 
						|
    </gr-overlay>
 | 
						|
    <gr-endpoint-decorator name="plugin-overlay"></gr-endpoint-decorator>
 | 
						|
    <gr-error-manager id="errorManager"></gr-error-manager>
 | 
						|
    <gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
 | 
						|
    <gr-reporting id="reporting"></gr-reporting>
 | 
						|
    <gr-router id="router"></gr-router>
 | 
						|
    <gr-plugin-host id="plugins"
 | 
						|
        config="[[_serverConfig]]">
 | 
						|
    </gr-plugin-host>
 | 
						|
    <gr-lib-loader id="libLoader"></gr-lib-loader>
 | 
						|
    <gr-external-style id="externalStyle" name="app-theme"></gr-external-style>
 | 
						|
  </template>
 | 
						|
  <script src="gr-app.js" crossorigin="anonymous"></script>
 | 
						|
</dom-module>
 |