<script type="text/ng-template" id="runButton.html">
    <button ng-show="model.showRunButton" class="btn btn-success pull-right" ng-click="viewTemplates()" title="Run an application from a template">
        <i class="fa fa-play-circle"></i> Run ...
    </button>
</script>
<script type="text/ng-template" id="idTemplate.html">
    <div class="ngCellText nowrap">
        <a href="" title="View details for {{row.entity.metadata.name || row.entity.name}}">
            <!--<img class="app-icon-small" ng-src="{{row.entity.$iconUrl}}" ng-show="row.entity.$iconUrl">-->
            <strong>{{row.entity.$oracleName || row.entity.name}}</strong></a>
    </div>
</script>
<script type="text/ng-template" id="selectorTemplate.html">
    <div class="ngCellText">
        <span ng-repeat="(name, value) in row.entity.spec.selector track by $index">
      <strong>{{name}}</strong>: {{value}}
    </span>
    </div>
</script>
<script type="text/ng-template" id="podCountsAndLinkTemplate.html">
    <div class="ngCellText" ng-init="entity=row.entity" ng-controller="Kubernetes.Status">
        <a ng-show="row.entity.$podCounters.podsLink" title="pods status">
            <span ng-show="row.entity.$podCounters.ready && (row.entity.$oracleStatus===2)" class="badge badge-success"> 启动</span>
            <span ng-show="row.entity.$podCounters.ready && (row.entity.$oracleStatus===0)" class="badge badge-info"> 等待</span>
            <span ng-show="row.entity.$podCounters.ready && (row.entity.$oracleStatus===1)" class="badge badge-important "> 失败</span>
            <span ng-show="row.entity.$podCounters.valid || row.entity.$podCounters.waiting" class="badge badge-info"> 等待</span>
            <span ng-show="!(row.entity.$podCounters.waiting || row.entity.$podCounters.ready || row.entity.$podCounters.valid || row.entity.$podCounters.error)" class="badge"> 停止</span>
            <span ng-show="row.entity.$podCounters.error" class="badge badge-important"> 失败</span>
        </a>
    </div>
</script>
<script type="text/ng-template" id="dataSummaryTemplate.html">
    <div class="ngCellText" ng-init="entity=row.entity">
        <a ng-show="row.entity.$podCounters.podsLink" title="pods status">
            <span ng-show="row.entity.$extractStatus === 0" class="badge badge-info"> 待汇总</span>
            <div ng-show="row.entity.$extractStatus === 1">
                <span class="badge badge-success" > 汇总中</span>
                <span ng-include="'oracleLogTemplate.html'"></span>
            </div>
            <div ng-show="row.entity.$extractStatus === 2">
                <span class="badge" > 已完成</span>
                <span ng-include="'oracleLogTemplate.html'"></span>
            </div>          
        </a>
    </div>
</script>
<script type="text/ng-template" id="labelTemplate.html">
    <div class="ngCellText" ng-init="entity=row.entity" ng-controller="Kubernetes.Labels">
        <p ng-show="data"><strong>Labels</strong></p>
        <span ng-repeat="label in labels track by $index" class="pod-label badge" ng-class="labelClass(label.key)" ng-click="handleClick(entity, label.key, label)" title="{{label.key}}"><span class="glyphicon glyphicon-tag"/> {{label.title}}</span>
    </div>
</script>
<script type="text/ng-template" id="eventSourceTemplate.html">
    <div class="ngCellText" ng-init="labels=row.entity.source">
        <p ng-show="data"><strong>Labels</strong></p>
        <span ng-repeat="(key, value) in labels track by $index" class="pod-label badge" class="background-light-grey mouse-pointer" title="{{key}}" ng-click="$emit('labelFilterUpdate', key + '=' + value)">{{value}}</span>
    </div>
</script>
<script type="text/ng-template" id="dataLabelsTemplate.html">
    <div class="ngCellText" ng-init="labels=row.entity.labels" ng-controller="Kubernetes.DataLabels">
        <p ng-show="data"><strong>Labels</strong></p>
        <span ng-repeat="(key, value) in labels track by $index" class="pod-label badge" ng-class="labelClass(key)" ng-click="labelClick(entity, key, value)" title="{{key}}"><span class="glyphicon glyphicon-tag"/> {{value}}</span>
    </div>
</script>
<script type="text/ng-template" id="hostTemplate.html">
    <div class="ngCellText" ng-init="host=row.entity.$host">
        <span class="pod-label badge background-light-grey mouse-pointer" ng-click="$emit('labelFilterUpdate', 'host=' + host)">{{host}}</span>
    </div>
</script>
<script type="text/ng-template" id="portalAddress.html">
    <div class="ngCellText">
        <div ng-repeat="port in row.entity.$ports track by $index">
            <a target="_blank" href="{{row.entity.$connectUrl}}" ng-show="row.entity.$connectUrl && row.entity.$podCounters.ready" title="Protocol {{row.entity.spec.protocol}}">
        {{row.entity.$host}}
      </a>
            <span ng-hide="row.entity.$connectUrl && row.entity.$podCounters.ready">{{row.entity.spec.portalIP || row.entity.spec.clusterIP}}:{{port}}</span>
        </div>
    </div>
</script>
<script type="text/ng-template" id="iconCellTemplate.html">
    <div class="ngCellText">
        <img class="app-icon-small" ng-src="{{row.entity.$iconUrl}}">
    </div>
</script>
<script type="text/ng-template" id="ageTemplate.html">
    <div class="ngCellText " ng-model="row.entity.$pods[0].$age">
        {{row.entity.$pods[0].$age}}
    </div>
</script>
<script type="text/ng-template" id="firstTimestampTemplate.html">
    <div class="ngCellText" title="{{row.entity.$firstTimestamp}}">
        {{row.entity.$firstTimestamp | relativeTime}}
    </div>
</script>
<script type="text/ng-template" id="lastTimestampTemplate.html">
    <div class="ngCellText" title="{{row.entity.$lastTimestamp}}">
        {{row.entity.$lastTimestamp | relativeTime}}
    </div>
</script>
<script type="text/ng-template" id="eventKindTemplate.html">
    <div class="ngCellText" ng-init="kind=row.entity.involvedObject.kind">
        <span class="pod-label badge" class="background-light-grey mouse-pointer" ng-click="$emit('labelFilterUpdate', 'kind=' + kind)">{{kind}}</span>
    </div>
</script>
<script type="text/ng-template" id="eventNameTemplate.html">
    <div class="ngCellText" ng-init="name=row.entity.involvedObject.name">
        <span class="pod-label badge" class="background-light-grey mouse-pointer" ng-click="$emit('labelFilterUpdate', 'name=' + name)">{{name}}</span>
    </div>
</script>
<script type="text/ng-template" id="eventSummaryTemplate.html">
    <div class="ngCellText" title="Number of events on this resource">
        <a ng-show="row.entity.$pods[0].$eventsLink" href="{{row.entity.$pods[0].$eventsLink}}">
            <span class="badge">{{row.entity.$pods[0].$events.length}}</span>
        </a>
    </div>
</script>
<script type="text/ng-template" id="connectTemplate.html">
    <span ng-show="entity.$jolokiaUrl && entity.$ready" ng-controller="Kubernetes.ConnectController">
      <a class="clickable"
         ng-click="doConnect(row.entity)"
         title="Open a new window and connect to this container">
        <i class="fa fa-sign-in"></i>
      </a>
    </span>
</script>
<script type="text/ng-template" id="termTemplate.html">
    <span ng-show="entity.status.phase === 'Running'" ng-controller="Kubernetes.TermController">
      <span ng-repeat="container in entity.spec.containers" ng-show="canConnectTo(container)">
        <i class="fa fa-television clickable" title="Open up a terminal to {{container.name}}" ng-click="openTerminal(entity.metadata.selfLink, container.name)"></i>
      </span>
    </span>
</script>
<script type="text/ng-template" id="logIconTemplate.html">
    <span ng-show="entity.status.phase === 'Running'" ng-controller="Kubernetes.PodLogLinkController">
    <i class="fa fa-file-text" title="Open up the logs for {{entity.metadata.name}}" ng-click="openLogs(entity)"></i>
  </span>
</script>
<script type="text/ng-template" id="oracleLogTemplate.html">
    <span ng-controller="Kubernetes.PodLogLinkController">
    <i class="fa fa-file-text" title="打开{{entity.$oracleName}}的汇总日志" ng-click="openLogs(entity)"></i>
  </span>
</script>
<script type="text/ng-template" id="connectParamTemplate.html">
    <div class="ngCellText" ng-init="entity=row.entity">
        <div ng-show="row.entity.$pods.length && row.entity.$pods[0].$host && row.entity.$pods[0].spec.containers[0].ports[0].hostPort"><strong>{{row.entity.$pods[0].$host}}:{{row.entity.$pods[0].spec.containers[0].ports[0].hostPort}}/orcl</strong>
            <button class="btn" zero-clipboard data-clipboard-text="{{row.entity.$pods[0].$host}}:{{row.entity.$pods[0].spec.containers[0].ports[0].hostPort}}/orcl" title="点击复制">
                <i class="fa fa-copy"></i></button>
        </div>
    </div>
</script>
<script type="text/ng-template" id="statusTemplate.html">
    <div class="ngCellText nowrap" ng-init="entity=row.entity" ng-controller="Kubernetes.PodStatus" title="Pod {{entity.metadata.name}} is {{entity.status.phase}}">
        <!-- in detail view -->
        <p ng-show="data"><strong>Status: </strong></p>
        <i class="fa {{entity.$statusCss}}"></i>
        <span ng-show="data">{{data}}</span>
        <!-- in table -->
        <span ng-include="'connectTemplate.html'"></span>
        <span ng-include="'termTemplate.html'"></span>
        <span ng-include="'logIconTemplate.html'"></span>
    </div>
</script>
<script type="text/ng-template" id="resizeDialog.html">
    <div modal="resizeDialog.dialog.show">
        <form class="form-horizontal" ng-submit="resizeDialog.onOk()">
            <div class="modal-header">
                <h4>Scale {{resizeDialog.controller.metadata.name}}</h4></div>
            <div class="modal-body">
                <div class="control-group">
                    <label class="control-label" for="replicas">Number of pods you would like to scale to?</label>
                    <div class="controls">
                        <input type="number" min="0" id="replicas" ng-model="resizeDialog.newReplicas">
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <input class="btn btn-primary" type="submit" ng-disabled="resizeDialog.newReplicas === resizeDialog.controller.status.replicas" value="Resize">
                <button class="btn btn-warning cancel sj_btn_grey" type="button" ng-click="resizeDialog.close()">取消</button>
            </div>
        </form>
    </div>
</script>
<script type="text/ng-template" id="namespaceSelector.html">
    <span ng-controller="Kubernetes.NamespaceController">
    namespace:
    <select ng-model="namespace" ng-options="namespace for namespace in namespaces"
            title="choose the namespace - which is a selection of resources in kubernetes">
    </select>
  </span>
</script>
<script type="text/ng-template" id="pendingPipelines.html">
    <div class="row" ng-controller="Developer.PipelinesController">
        <div class="row">
            <div class="col-md-12">
                <div ng-hide="model.fetched">
                    <div class="align-center">
                        <i class="fa fa-spinner fa-spin"></i>
                    </div>
                </div>
                <div ng-show="model.fetched">
                    <div ng-hide="model.job.builds.length" class="align-center">
                        <p class="alert alert-info">There are no pipelines for this job.</p>
                    </div>
                    <div ng-show="model.job.builds.length">
                        <div class="pipeline-build-block" ng-repeat="build in model.job.builds | filter:model.filterText track by $index">
                            <div pipeline-view></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</script>
<script type="text/ng-template" id="taskEdit.html">
    <div class="ngCellText" ng-init="entity=row.entity" ng-controller="Kubernetes.TaskEdit">
        <button class="btn sj_btn" ng-click="showDeleteOne.open(entity)">
            <span class="glyphicon glyphicon-trash"></span>&nbsp;&nbsp;删除
        </button>
        <div hawtio-confirm-dialog="showDeleteOne.show" title="是否删除任务?" ok-button-text="确认" cancel-button-text="取消" on-cancel="showDeleteOne.onCancelled()" on-ok="showDeleteOne.onOk()">
            <div class="dialog-body">
                <p>
                    是否删除:{{entity.name}}-{{entity.systemName}} 任务?
                </p>
            </div>
        </div>
    </div>
</script>
<!-- 迁移进度条 -->
<script type="text/ng-template" id="taskProcess.html">
    <div class="ngCellText progress" ng-init="entity=row.entity">
        <div ng-show="entity.status!==3" class="progress-bar progress-bar-success active sj_progress_bar " role="progressbar" aria-valuenow="{{entity.process}}" aria-valuemin="0" aria-valuemax="100" style="width: {{entity.process}}%">
            <span class="sj_progress_font">{{entity.process}}%</span>
        </div>
        <div ng-show="entity.status ===3" class="progress-bar progress-bar-danger active sj_progress_bar" role="progressbar" aria-valuenow="{{entity.process}}" aria-valuemin="0" aria-valuemax="100" style="width: {{entity.process}}%" title="{{entity.process}}%">
            <span class="sj_progress_font">{{entity.process}}%</span>
        </div>
    </div>
</script>
<!--迁移状态显示 -->
<script type="text/ng-template" id="taskStatus.html">
    <div class="ngCellText" ng-init="entity=row.entity">
        <div ng-show="entity.status == 0">
            <sapn class="glyphicon glyphicon-minus"> 待迁移
        </div>
        <div ng-show="entity.status == 1"> 
            <span class="glyphicon glyphicon-transfer"> 迁移中
        </div>
        <div ng-show="entity.status == 2"> 
            <span class="glyphicon glyphicon-ok"> 已完成
        </div>
        <div ng-show="entity.status == 3"> 
            <span class="glyphicon glyphicon-remove"> 失败
        </div>
    </div>
</script>
<script type="text/ng-template" id="creationTimeTemplate.html">
    <div class="ngCellText" title="created at: {{row.entity.$creationDate | date : 'h:mm:ss a, EEE MMM yyyy'}}">
        {{row.entity.$creationDate.relative()}}
    </div>
</script>
<script type="text/ng-template" id="dataExtractTemplate.html">
    <div class="ngCellText" ng-init="entity=row.entity">
        <span ng-show="entity.extractStatus==00">否</span>
        <span ng-show="entity.extractStatus===1">是</span>
    </div>
</script>
<div ng-controller="Kubernetes.TopLevel">
    <div class="wiki-icon-view" ng-controller="Kubernetes.FileDropController" nv-file-drop nv-file-over uploader="uploader" over-class="ready-drop">
        <div class="row kubernetes-view" ng-view></div>
    </div>
</div>