entity-aliases.tpl.html 4.78 KB
<!--

    Copyright © 2016-2020 The Thingsboard Authors

    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.

-->
<md-dialog class="tb-aliases-dialog" style="width: 700px;" aria-label="{{ vm.title | translate }}">
	<form name="theForm" ng-submit="vm.save()">
		<md-toolbar>
			<div class="md-toolbar-tools">
				<h2>{{ vm.title | translate }}</h2>
				<span flex></span>
				<md-button class="md-icon-button" ng-click="vm.cancel()">
					<ng-md-icon icon="close" aria-label="{{ 'dialog.close' | translate }}"></ng-md-icon>
				</md-button>
			</div>
		</md-toolbar>
		<md-progress-linear class="md-warn" md-mode="indeterminate" ng-disabled="!$root.loading" ng-show="$root.loading"></md-progress-linear>
		<span style="min-height: 5px;" flex="" ng-show="!$root.loading"></span>
		<div class="tb-aliases-header" flex layout="row" layout-align="start center">
			<span flex="5"></span>
			<div flex layout="row" layout-align="start center">
				<span class="tb-header-label" translate flex="20" style="min-width: 150px;">alias.name</span>
				<span class="tb-header-label" translate flex="70" style="padding-left: 10px;">alias.entity-filter</span>
				<span class="tb-header-label" translate flex="10" style="padding-left: 10px; min-width: 120px;">alias.resolve-multiple</span>
				<span style="min-width: 80px;"></span>
			</div>
		</div>
		<md-divider></md-divider>
		<md-dialog-content>
			<div class="md-dialog-content">
				<fieldset ng-disabled="$root.loading">
					<div ng-form name="aliasForm" flex layout="row" layout-align="start center" ng-repeat="entityAlias in vm.entityAliases track by $index">
						<span flex="5">{{$index + 1}}.</span>
						<div class="md-whiteframe-4dp tb-alias" flex layout="row" layout-align="start center">
							<md-input-container flex="20" style="min-width: 150px;" md-no-float class="md-block">
								<input required name="alias" placeholder="{{ 'entity.alias' | translate }}" ng-model="entityAlias.alias">
								<div ng-messages="aliasForm.alias.$error">
									<div translate ng-message="required">entity.alias-required</div>
								</div>
							</md-input-container>
							<tb-entity-filter-view
									flex="70" style="padding-left: 10px;"
									ng-model="entityAlias.filter">
							</tb-entity-filter-view>
							<section flex="10" style="padding-left: 10px; min-width: 120px;"
									 class="tb-resolve-multiple-switch"
									 layout="column"
									 layout-align="center center">
								<md-switch class="resolve-multiple-switch"
										   ng-model="entityAlias.filter.resolveMultiple"
										   aria-label="resolve-multiple-switcher">
								</md-switch>
							</section>
							<md-button ng-disabled="$root.loading" class="md-icon-button md-primary" style="min-width: 40px;"
									   ng-click="vm.editAlias($event, entityAlias)" aria-label="{{ 'action.edit' | translate }}">
								<md-tooltip md-direction="top">
									{{ 'alias.edit' | translate }}
								</md-tooltip>
								<md-icon aria-label="{{ 'alias.edit' | translate }}" class="material-icons">
									edit
								</md-icon>
							</md-button>
							<md-button ng-disabled="$root.loading" class="md-icon-button md-primary" style="min-width: 40px;"
									   ng-click="vm.removeAlias($event, entityAlias)" aria-label="{{ 'action.remove' | translate }}">
								<md-tooltip md-direction="top">
									{{ 'entity.remove-alias' | translate }}
								</md-tooltip>
								<md-icon aria-label="{{ 'action.delete' | translate }}" class="material-icons">
									close
								</md-icon>
							</md-button>
						</div>
					</div>
				</fieldset>
			</div>
		</md-dialog-content>
		<md-dialog-actions layout="row">
			<md-button ng-show="!vm.disableAdd" ng-disabled="$root.loading" class="md-primary md-raised"
					   ng-click="vm.addAlias($event)"
					   aria-label="{{ 'alias.add' | translate }}">
				<md-tooltip md-direction="top">
					{{ 'alias.add' | translate }}
				</md-tooltip>
				<span translate>alias.add</span>
			</md-button>
			<span flex></span>
			<md-button ng-disabled="$root.loading || theForm.$invalid || !theForm.$dirty" type="submit" class="md-raised md-primary">
				{{ 'action.save' | translate }}
			</md-button>
			<md-button ng-disabled="$root.loading" ng-click="vm.cancel()" style="margin-right:20px;">{{ 'action.cancel' | translate }}</md-button>
		</md-dialog-actions>
	</form>
</md-dialog>