
These tags are preserved by the Closure compiler and vulcanize in order to serve the license notices embedded in the outputs. In a standalone Gerrit server, these license are also covered in the LICENSES.txt served with the documentation. When serving PG assets from a CDN, it's less obvious what the corresponding LICENSES.txt file is, since the CDN is not directly linked to a running Gerrit server. Safer to embed the licenses in the assets themselves. Change-Id: Id1add1451fad1baa7916882a6bda02c326ccc988
159 lines
5.1 KiB
HTML
159 lines
5.1 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="../../../behaviors/gr-access-behavior/gr-access-behavior.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/shared-styles.html">
|
|
<link rel="import" href="../../shared/gr-button/gr-button.html">
|
|
<link rel="import" href="../../shared/gr-icons/gr-icons.html">
|
|
<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
|
|
<link rel="import" href="../gr-permission/gr-permission.html">
|
|
|
|
<script src="../../../scripts/util.js"></script>
|
|
|
|
<dom-module id="gr-access-section">
|
|
<template>
|
|
<style include="shared-styles">
|
|
:host {
|
|
display: block;
|
|
margin-bottom: 1em;
|
|
}
|
|
fieldset {
|
|
border: 1px solid #d1d2d3;
|
|
}
|
|
.name {
|
|
align-items: center;
|
|
display: flex;
|
|
}
|
|
.header,
|
|
#deletedContainer {
|
|
align-items: center;
|
|
background: #f6f6f6;
|
|
border-bottom: 1px dotted #d1d2d3;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
min-height: 3em;
|
|
padding: 0 .7em;
|
|
}
|
|
#deletedContainer {
|
|
border-bottom: 0;
|
|
}
|
|
.sectionContent {
|
|
padding: .7em;
|
|
}
|
|
#editBtn,
|
|
.editing #editBtn.global,
|
|
#deletedContainer,
|
|
.deleted #mainContainer,
|
|
#addPermission,
|
|
#deleteBtn,
|
|
.editingRef .name,
|
|
#editRefInput {
|
|
display: none;
|
|
}
|
|
.editing #editBtn,
|
|
.editingRef #editRefInput {
|
|
display: flex;
|
|
}
|
|
.deleted #deletedContainer {
|
|
display: flex;
|
|
}
|
|
.editing #addPermission,
|
|
#mainContainer,
|
|
.editing #deleteBtn {
|
|
display: block;
|
|
}
|
|
.editing #deleteBtn,
|
|
#undoRemoveBtn {
|
|
padding-right: .7em;
|
|
}
|
|
</style>
|
|
<style include="gr-form-styles"></style>
|
|
<fieldset id="section"
|
|
class$="gr-form-styles [[_computeSectionClass(editing, _editingRef, _deleted)]]">
|
|
<div id="mainContainer">
|
|
<div class="header">
|
|
<div class="name">
|
|
<h3>[[_computeSectionName(section.id)]]</h3>
|
|
<gr-button
|
|
id="editBtn"
|
|
link
|
|
class$="[[_computeEditBtnClass(section.id)]]"
|
|
on-tap="editReference">
|
|
<iron-icon id="icon" icon="gr-icons:create"></iron-icon>
|
|
</gr-button>
|
|
</div>
|
|
<input
|
|
id="editRefInput"
|
|
bind-value="{{section.id}}"
|
|
is="iron-input"
|
|
type="text"
|
|
on-input="_handleValueChange">
|
|
<gr-button
|
|
link
|
|
id="deleteBtn"
|
|
on-tap="_handleRemoveReference">Remove</gr-button>
|
|
</div><!-- end header -->
|
|
<div class="sectionContent">
|
|
<template
|
|
is="dom-repeat"
|
|
items="{{_permissions}}"
|
|
as="permission">
|
|
<gr-permission
|
|
name="[[_computePermissionName(section.id, permission, permissionValues, capabilities)]]"
|
|
permission="{{permission}}"
|
|
labels="[[labels]]"
|
|
section="[[section.id]]"
|
|
editing="[[editing]]"
|
|
groups="[[groups]]">
|
|
</gr-permission>
|
|
</template>
|
|
<div id="addPermission">
|
|
Add permission:
|
|
<select id="permissionSelect">
|
|
<!-- called with a third parameter so that permissions update
|
|
after a new section is added. -->
|
|
<template
|
|
is="dom-repeat"
|
|
items="[[_computePermissions(section.id, capabilities, labels, section.value.permissions.*)]]">
|
|
<option value="[[item.value.id]]">[[item.value.name]]</option>
|
|
</template>
|
|
</select>
|
|
<gr-button
|
|
link
|
|
id="addBtn"
|
|
on-tap="_handleAddPermission">Add</gr-button>
|
|
</div>
|
|
<!-- end addPermission -->
|
|
</div><!-- end sectionContent -->
|
|
</div><!-- end mainContainer -->
|
|
<div id="deletedContainer">
|
|
<span>[[_computeSectionName(section.id)]] was deleted</span>
|
|
<gr-button
|
|
link
|
|
id="undoRemoveBtn"
|
|
on-tap="_handleUndoRemove">Undo</gr-button>
|
|
</div><!-- end deletedContainer -->
|
|
</fieldset>
|
|
<gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
|
|
</template>
|
|
<script src="gr-access-section.js"></script>
|
|
</dom-module>
|