Files
gerrit/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands.html
David Ostrovsky aa04f13bdf gr-repo-command: Add support for tooltips
Project core and plugins actions exposing label and title. Label
supposed to be used as button name and title is supposed to be used
as button tooltip. Support for tooltip is added in this change. To make
minimal invasive change, we preserve title that was already taken as the
name of the button and add new tooltip attribute.

Alternative approach would be to consistently use label and title, like
it is done on change screen. However that approach may break some users,
that rely on current naming convention.

Note that this also fixed the problem for plugin authors. For example in
custom element in project screen, tooltip can be used as following:

    <gr-repo-command
        title="[[action.label]]"
        tooltip="[[action.title]]"
        on-command-tap="_handleCommandTap">
    </gr-repo-command>

Bug: Issue 9638
Change-Id: Ib1b54eb7cd4ba544402d293b9fce9bb176b01065
2018-08-29 20:12:43 +02:00

89 lines
3.7 KiB
HTML

<!--
@license
Copyright (C) 2017 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.
-->
<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../../bower_components/iron-autogrow-textarea/iron-autogrow-textarea.html">
<link rel="import" href="../../../bower_components/iron-input/iron-input.html">
<link rel="import" href="../../../styles/gr-form-styles.html">
<link rel="import" href="../../../styles/gr-subpage-styles.html">
<link rel="import" href="../../../styles/shared-styles.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="../../shared/gr-dialog/gr-dialog.html">
<link rel="import" href="../../shared/gr-overlay/gr-overlay.html">
<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
<link rel="import" href="../gr-create-change-dialog/gr-create-change-dialog.html">
<link rel="import" href="../gr-repo-command/gr-repo-command.html">
<dom-module id="gr-repo-commands">
<template>
<style include="shared-styles"></style>
<style include="gr-subpage-styles"></style>
<style include="gr-form-styles"></style>
<main class="gr-form-styles read-only">
<h1 id="Title">Repository Commands</h1>
<div id="loading" class$="[[_computeLoadingClass(_loading)]]">Loading...</div>
<div id="loadedContent" class$="[[_computeLoadingClass(_loading)]]">
<h2 id="options">Command</h2>
<div id="form">
<gr-repo-command
title="Create change"
on-command-tap="_createNewChange">
</gr-repo-command>
<gr-repo-command
id="editRepoConfig"
title="Edit repo config"
on-command-tap="_handleEditRepoConfig">
</gr-repo-command>
<gr-repo-command
title="[[_repoConfig.actions.gc.label]]"
tooltip="[[_repoConfig.actions.gc.title]]"
hidden$="[[!_repoConfig.actions.gc.enabled]]"
on-command-tap="_handleRunningGC">
</gr-repo-command>
<gr-endpoint-decorator name="repo-command">
<gr-endpoint-param name="config" value="[[_repoConfig]]">
</gr-endpoint-param>
<gr-endpoint-param name="repoName" value="[[repo]]">
</gr-endpoint-param>
</gr-endpoint-decorator>
</div>
</div>
</main>
<gr-overlay id="createChangeOverlay" with-backdrop>
<gr-dialog
id="createChangeDialog"
confirm-label="Create"
disabled="[[!_canCreate]]"
on-confirm="_handleCreateChange"
on-cancel="_handleCloseCreateChange">
<div class="header" slot="header">
Create Change
</div>
<div class="main" slot="main">
<gr-create-change-dialog
id="createNewChangeModal"
can-create="{{_canCreate}}"
repo-name="[[repo]]"></gr-create-change-dialog>
</div>
</gr-dialog>
</gr-overlay>
<gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
</template>
<script src="gr-repo-commands.js"></script>
</dom-module>