<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you 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="nav-tabs-custom">
    <ul class="nav nav-tabs">
        <li class="{{project.visiblePage=='cubes'? 'active':''}}">
            <a href="" ng-click="project.visiblePage='cubes';">Cubes</a>
        </li>
        <li class="{{project.visiblePage=='access'? 'active':''}}"
            ng-if="!kylinConfig.isExternalAclEnabled()">
            <a href="" ng-click="project.visiblePage='access';listAccess(project, 'ProjectInstance');">Access</a>
        </li>
        <li class="{{project.visiblePage=='config'? 'active':''}}">
            <a href="" ng-click="project.visiblePage='config';">Configuration Overwrites</a>
        </li>
        <li class="{{project.visiblePage=='owner'? 'active':''}}"
            ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('project',project, permissions.ADMINISTRATION.mask)">
            <a href="" ng-click="project.visiblePage='owner';getOwnerString(project)">Owner</a>
        </li>
    </ul>

    <div class="cube-detail" ng-if="project.visiblePage=='cubes'">
        <div class="row">
            <div class="col-xs-1"></div>

            <div class="col-xs-10">
                <div class="space-8"></div>
                <table ng-if="project.realizations.length > 0" class="table table-striped table-hover" >
                    <thead>
                        <tr>
                            <th>Cube Name</th>
                            <th>Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="item in project.realizations" ng-if="item.type=='CUBE'">
                            <td>{{item.realization}}</td>
                            <td><a href='models' style="color: #428BCA">Detail</a></td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div no-result ng-if="project.realizations.length == 0"></div>
            <div class="col-xs-1"></div>
        </div>
    </div>

    <div class="cube-detail" ng-if="project.visiblePage=='config'">
        <div class="row">
            <div class="col-xs-1"></div>

            <div class="col-xs-10">
                <div class="space-8"></div>
                <table ng-if="getMapLength(project.override_kylin_properties) > 0" class="table table-striped table-hover" >
                    <thead>
                        <tr>
                            <th>Key</th>
                            <th>Value</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="(key,value) in project.override_kylin_properties">
                            <td>{{key}}</td>
                            <td>{{value}}</td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div no-result ng-if="getMapLength(project.override_kylin_properties) == 0" style="clear:both"></div>
            <div class="col-xs-1"></div>
        </div>
    </div>

    <div class="cube-detail" ng-if="project.visiblePage=='access'">
        <div class="row">
            <div class="col-xs-1"></div>
            <div class="col-xs-10">
                <div ng-include src="'partials/common/access.html'" ng-init="entity=project;type='ProjectInstance';"></div>
            </div>
            <div class="col-xs-1"></div>
        </div>
    </div>

    <div class="cube-detail" ng-show="project.visiblePage=='owner'">
        <div class="row">
            <div class="col-xs-1"></div>
            <div class="col-xs-10">
                <h5><b>Owner:</b></h5>
                <div class="form-group">
                    <input ng-model="project.newOwner" class="form-control" placeholder="User List..." />
                </div>
                <div class="form-group">
                    <button class="btn btn-primary btn-sm" ng-click="updateOwner(project)">Save</button>
                </div>
                <div class="space-4"></div>
            </div>
            <div class="col-xs-1"></div>
        </div>
    </div>
</div>
