blob: 8b513122c3a2c5a8542dbe93c16dcbc47499f61f [file] [log] [blame]
<!--
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.html">
<link rel="import" href="../../shared/gr-account-link/gr-account-link.html">
<link rel="import" href="../../shared/gr-label/gr-label.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-rest-api-interface/gr-rest-api-interface.html">
<link rel="import" href="../gr-reviewer-list/gr-reviewer-list.html">
<dom-module id="gr-change-metadata">
<template>
<style>
section:not(:first-of-type) {
margin-top: 1em;
}
.title,
.value {
display: block;
}
.title {
color: #666;
font-weight: bold;
}
.labelValueContainer:not(:first-of-type) {
margin-top: .25em;
}
.labelValueContainer .approved,
.labelValueContainer .notApproved {
display: inline-block;
padding: .1em .3em;
border-radius: 3px;
}
.labelValue {
display: inline-block;
}
.approved {
background-color: #d4ffd4;
}
.notApproved {
background-color: #ffd4d4;
}
@media screen and (max-width: 50em), screen and (min-width: 75em) {
:host {
display: table;
}
section {
display: table-row;
}
section:not(:first-of-type) .title,
section:not(:first-of-type) .value {
padding-top: .5em;
}
.title,
.value {
display: table-cell;
vertical-align: top;
}
.title {
padding-right: .5em;
}
}
</style>
<section>
<span class="title">Updated</span>
<span class="value">
<gr-date-formatter
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>
</span>
</section>
<template is="dom-if" if="[[_showReviewersByState]]">
<section>
<span class="title">Reviewers</span>
<span class="value">
<gr-reviewer-list
change="{{change}}"
mutable="[[mutable]]"
reviewers-only></gr-reviewer-list>
</span>
</section>
<section>
<span class="title">CC</span>
<span class="value">
<gr-reviewer-list
change="{{change}}"
mutable="[[mutable]]"
ccs-only></gr-reviewer-list>
</span>
</section>
</template>
<template is="dom-if" if="[[!_showReviewersByState]]">
<section>
<span class="title">Reviewers</span>
<span class="value">
<gr-reviewer-list
change="{{change}}"
mutable="[[mutable]]"></gr-reviewer-list>
</span>
</section>
</template>
<section>
<span class="title">Project</span>
<span class="value">[[change.project]]</span>
</section>
<section>
<span class="title">Branch</span>
<span class="value">[[change.branch]]</span>
</section>
<section>
<span class="title">Commit</span>
<span class="value">
<template is="dom-if" if="[[_showWebLink]]">
<a target="_blank"
href$="[[_webLink]]">[[_computeShortHash(commitInfo)]]</a>
</template>
<template is="dom-if" if="[[!_showWebLink]]">
[[_computeShortHash(commitInfo)]]
</template>
</span>
</section>
<section>
<span class="title">Topic</span>
<span class="value">
<gr-editable-label
value="{{change.topic}}"
placeholder="[[_computeTopicPlaceholder(_topicReadOnly)]]"
read-only="[[_topicReadOnly]]"
on-changed="_handleTopicChanged"></gr-editable-label>
</span>
</section>
<section class="strategy" hidden$="[[_computeHideStrategy(change)]]" hidden>
<span class="title">Strategy</span>
<span class="value">[[_computeStrategy(change)]]</span>
</section>
<template is="dom-repeat"
items="[[_computeLabelNames(change.labels)]]" as="labelName">
<section>
<span class="title">[[labelName]]</span>
<span class="value">
<template is="dom-repeat"
items="[[_computeLabelValues(labelName, change.labels)]]"
as="label">
<div class="labelValueContainer">
<span class$="[[label.className]]">
<gr-label
has-tooltip
title="[[_computeValueTooltip(label.value, labelName)]]"
class="labelValue">
[[label.value]]
</gr-label>
<gr-account-link account="[[label.account]]"></gr-account-link>
</span>
</div>
</template>
</span>
</section>
</template>
<gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
</template>
<script src="gr-change-metadata.js"></script>
</dom-module>