<!--

    Copyright © 2016-2017 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.

-->
<div class="md-whiteframe-4dp" flex layout="row" layout-align="start center"
     style="padding: 0 0 0 10px; margin: 5px;">
    <span flex="50">
        {{ component.name }}
    </span>
    <span flex="50">
        {{ componentTypeName }}
    </span>
    <span ng-if="readOnly" style="min-width: 40px; min-height: 40px; margin: 0 6px;"></br></span>
    <md-button ng-disabled="$root.loading" class="md-icon-button md-primary"
               style="min-width: 40px;"
               ng-click="openComponent($event)"
               aria-label="{{ (readOnly ? 'action.view' : 'action.edit') | translate }}">
        <md-tooltip ng-if="readOnly" md-direction="top">
            {{ 'action.view' | translate }}
        </md-tooltip>
        <md-tooltip ng-if="!readOnly" md-direction="top">
            {{ 'action.edit' | translate }}
        </md-tooltip>
        <md-icon ng-if="readOnly" aria-label="{{ 'action.view' | translate }}"
                 class="material-icons">
            more_horiz
        </md-icon>
        <md-icon ng-if="!readOnly" aria-label="{{ 'action.edit' | translate }}"
                 class="material-icons">
            edit
        </md-icon>
    </md-button>
    <md-button ng-if="!readOnly" ng-disabled="$root.loading" class="md-icon-button md-primary"
               style="min-width: 40px;"
               ng-click="onRemoveComponent({event: $event})"
               aria-label="{{ 'action.remove' | translate }}">
        <md-tooltip md-direction="top">
            {{ 'action.remove' | translate }}
        </md-tooltip>
        <md-icon aria-label="{{ 'action.delete' | translate }}"
                 class="material-icons">
            close
        </md-icon>
    </md-button>
</div>