blob: e7179d78740239f99c0cc2e35dd4871cd3f2f65a [file] [log] [blame]
<!--
@license
Copyright (C) 2016 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="../../../behaviors/rest-client-behavior/rest-client-behavior.html">
<link rel="import" href="../../../styles/shared-styles.html">
<link rel="import" href="../../../styles/gr-voting-styles.html">
<link rel="import" href="../../core/gr-navigation/gr-navigation.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="../../shared/gr-account-chip/gr-account-chip.html">
<link rel="import" href="../../shared/gr-account-link/gr-account-link.html">
<link rel="import" href="../../shared/gr-date-formatter/gr-date-formatter.html">
<link rel="import" href="../../shared/gr-editable-label/gr-editable-label.html">
<link rel="import" href="../../shared/gr-icons/gr-icons.html">
<link rel="import" href="../../shared/gr-limited-text/gr-limited-text.html">
<link rel="import" href="../../shared/gr-linked-chip/gr-linked-chip.html">
<link rel="import" href="../../shared/gr-tooltip-content/gr-tooltip-content.html">
<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
<link rel="import" href="../gr-change-requirements/gr-change-requirements.html">
<link rel="import" href="../gr-commit-info/gr-commit-info.html">
<link rel="import" href="../gr-reviewer-list/gr-reviewer-list.html">
<dom-module id="gr-change-metadata">
<template>
<style include="shared-styles">
:host {
display: table;
}
section {
display: table-row;
}
section:not(:first-of-type) .title,
section:not(:first-of-type) .value {
padding-top: .5em;
}
section:not(:first-of-type) {
margin-top: 1em;
}
.title,
.value {
display: table-cell;
}
.title {
color: var(--deemphasized-text-color);
font-weight: var(--font-weight-bold);
max-width: 20em;
padding-left: var(--metadata-horizontal-padding);
padding-right: .5em;
word-break: break-word;
}
.value {
padding-right: var(--metadata-horizontal-padding);
}
gr-change-requirements {
--requirements-horizontal-padding: var(--metadata-horizontal-padding);
}
gr-account-link {
max-width: 20ch;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: middle;
white-space: nowrap;
}
gr-editable-label {
max-width: 9em;
}
.webLink {
display: block;
}
/* CSS Mixins should be applied last. */
section.assignee {
@apply --change-metadata-assignee;
}
section.strategy {
@apply --change-metadata-strategy;
}
section.topic {
@apply --change-metadata-topic;
}
gr-account-chip[disabled],
gr-linked-chip[disabled] {
opacity: 0;
pointer-events: none;
}
.hashtagChip {
margin-bottom: .5em;
}
#externalStyle {
display: block;
}
.parentList.merge {
list-style-type: decimal;
padding-left: 1em;
}
.parentList gr-commit-info {
display: inline-block;
}
.hideDisplay,
#parentNotCurrentMessage {
display: none;
}
.icon {
margin: -.25em 0;
}
.icon.help,
.icon.notTrusted {
color: #FFA62F;
}
.icon.invalid {
color: var(--vote-text-color-disliked);
}
.icon.trusted {
color: var(--vote-text-color-recommended);
}
.parentList.notCurrent.nonMerge #parentNotCurrentMessage {
--arrow-color: #ffa62f;
display: inline-block;
}
.separatedSection {
border-top: 1px solid var(--border-color);
margin-top: .5em;
padding: .5em 0;
}
</style>
<gr-external-style id="externalStyle" name="change-metadata">
<section>
<span class="title">Updated</span>
<span class="value">
<gr-date-formatter
has-tooltip
date-str="[[change.updated]]"></gr-date-formatter>
</span>
</section>
<section>
<span class="title">Owner</span>
<span class="value">
<gr-account-link account="[[change.owner]]"></gr-account-link>
<template is="dom-if" if="[[_pushCertificateValidation]]">
<gr-tooltip-content
has-tooltip
title$="[[_pushCertificateValidation.message]]">
<iron-icon
class$="icon [[_pushCertificateValidation.class]]"
icon="[[_pushCertificateValidation.icon]]">
</iron-icon>
</gr-tooltip-content>
</template>
</span>
</section>
<section class$="[[_computeShowRoleClass(change, _CHANGE_ROLE.UPLOADER)]]">
<span class="title">Uploader</span>
<span class="value">
<gr-account-link
account="[[_getNonOwnerRole(change, _CHANGE_ROLE.UPLOADER)]]"
></gr-account-link>
</span>
</section>
<section class$="[[_computeShowRoleClass(change, _CHANGE_ROLE.AUTHOR)]]">
<span class="title">Author</span>
<span class="value">
<gr-account-link
account="[[_getNonOwnerRole(change, _CHANGE_ROLE.AUTHOR)]]"
></gr-account-link>
</span>
</section>
<section class$="[[_computeShowRoleClass(change, _CHANGE_ROLE.COMMITTER)]]">
<span class="title">Committer</span>
<span class="value">
<gr-account-link
account="[[_getNonOwnerRole(change, _CHANGE_ROLE.COMMITTER)]]"
></gr-account-link>
</span>
</section>
<section class="assignee">
<span class="title">Assignee</span>
<span class="value">
<gr-account-list
max-count="1"
id="assigneeValue"
placeholder="Set assignee..."
accounts="{{_assignee}}"
change="[[change]]"
readonly="[[_computeAssigneeReadOnly(_mutable, change)]]"
allow-any-user></gr-account-list>
</span>
</section>
<section>
<span class="title">Reviewers</span>
<span class="value">
<gr-reviewer-list
change="{{change}}"
mutable="[[_mutable]]"
reviewers-only
max-reviewers-displayed="3"></gr-reviewer-list>
</span>
</section>
<section>
<span class="title">CC</span>
<span class="value">
<gr-reviewer-list
change="{{change}}"
mutable="[[_mutable]]"
ccs-only
max-reviewers-displayed="3"></gr-reviewer-list>
</span>
</section>
<section>
<span class="title">Repo</span>
<span class="value">
<a href$="[[_computeProjectURL(change.project)]]">
<gr-limited-text limit="40" text="[[change.project]]"></gr-limited-text>
</a>
</span>
</section>
<section>
<span class="title">Branch</span>
<span class="value">
<a href$="[[_computeBranchURL(change.project, change.branch)]]">
<gr-limited-text limit="40" text="[[change.branch]]"></gr-limited-text>
</a>
</span>
</section>
<section>
<span class="title">[[_computeParentsLabel(_currentParents)]]</span>
<span class="value">
<ol class$="[[_computeParentListClass(_currentParents, parentIsCurrent)]]">
<template is="dom-repeat" items="[[_currentParents]]" as="parent">
<li>
<gr-commit-info
change="[[change]]"
commit-info="[[parent]]"
server-config="[[serverConfig]]"></gr-commit-info>
<gr-tooltip-content
id="parentNotCurrentMessage"
has-tooltip
show-icon
title$="[[_notCurrentMessage]]"></gr-tooltip-content>
</li>
</template>
</ol>
</span>
</section>
<section class="topic">
<span class="title">Topic</span>
<span class="value">
<template
is="dom-if"
if="[[_showTopicChip(change.*, _settingTopic)]]">
<gr-linked-chip
text="[[change.topic]]"
limit="40"
href="[[_computeTopicURL(change.topic)]]"
removable="[[!_topicReadOnly]]"
on-remove="_handleTopicRemoved"></gr-linked-chip>
</template>
<template
is="dom-if"
if="[[_showAddTopic(change.*, _settingTopic)]]">
<gr-editable-label
class="topicEditableLabel"
label-text="Add a topic"
value="[[change.topic]]"
max-length="1024"
placeholder="[[_computeTopicPlaceholder(_topicReadOnly)]]"
read-only="[[_topicReadOnly]]"
on-changed="_handleTopicChanged"></gr-editable-label>
</template>
</span>
</section>
<section class="strategy" hidden$="[[_computeHideStrategy(change)]]" hidden>
<span class="title">Strategy</span>
<span class="value">[[_computeStrategy(change)]]</span>
</section>
<section class="hashtag">
<span class="title">Hashtags</span>
<span class="value">
<template is="dom-repeat" items="[[change.hashtags]]">
<gr-linked-chip
class="hashtagChip"
text="[[item]]"
href="[[_computeHashtagURL(item)]]"
removable="[[!_hashtagReadOnly]]"
on-remove="_handleHashtagRemoved">
</gr-linked-chip>
</template>
<template is="dom-if" if="[[!_hashtagReadOnly]]">
<gr-editable-label
uppercase
label-text="Add a hashtag"
value="{{_newHashtag}}"
placeholder="[[_computeHashtagPlaceholder(_hashtagReadOnly)]]"
read-only="[[_hashtagReadOnly]]"
on-changed="_handleHashtagChanged"></gr-editable-label>
</template>
</span>
</section>
<div class="separatedSection">
<gr-change-requirements
change="{{change}}"
account="[[account]]"
mutable="[[_mutable]]"></gr-change-requirements>
</div>
<section id="webLinks" hidden$="[[!_computeWebLinks(commitInfo, serverConfig)]]">
<span class="title">Links</span>
<span class="value">
<template is="dom-repeat"
items="[[_computeWebLinks(commitInfo, serverConfig)]]" as="link">
<a href="[[link.url]]" class="webLink" rel="noopener" target="_blank">
[[link.name]]
</a>
</template>
</span>
</section>
<gr-endpoint-decorator name="change-metadata-item">
<gr-endpoint-param name="labels" value="[[labels]]"></gr-endpoint-param>
<gr-endpoint-param name="change" value="[[change]]"></gr-endpoint-param>
<gr-endpoint-param name="revision" value="[[revision]]"></gr-endpoint-param>
</gr-endpoint-decorator>
</gr-external-style>
<gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
</template>
<script src="gr-change-metadata.js"></script>
</dom-module>