<!DOCTYPE html>
<html data-ng-app="application">

<head>
    <meta charset="UTF-8">
    <title>{{'Config.Title' | translate }}</title>
    <link rel="icon" href="./img/config.png">
    <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css">
    <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
    <link rel="stylesheet" type="text/css" href="vendor/jquery-plugin/textareafullscreen.css">
    <link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css">
    <link rel="stylesheet" type="text/css" href="styles/common-style.css">
</head>

<body>

    <apollonav></apollonav>

    <div id="config-info" class="apollo-container app">
        <div ng-controller="ConfigBaseInfoController">
            <div class="J_appNotFound hidden row text-center app-not-found" ng-show="notFoundApp">
                <img src="img/404.png">
                <br>
                <p>
                    <span ng-bind="pageContext.appId"></span> {{'Config.AppIdNotFound' | translate }}<a
                        href="/app.html">{{'Config.ClickByCreate' | translate }}</a>
                </p>
            </div>

            <div class="side-bar" ng-class="{'position-absolute': viewMode == 1, 'position-fixed': viewMode == 2}">
                <div class="J_appFound hidden"
                    ng-show="!notFoundApp && (viewMode == 1 || (viewMode == 2 && showSideBar))">

                    <!--env list-->
                    <section class="panel">
                        <header class="panel-heading">
                            {{'Config.EnvList' | translate }}
                            <span class="pull-right" data-tooltip="tooltip" data-placement="bottom"
                                title="{{'Config.EnvListTips' | translate }}">
                                <img src="img/question.png" class="i-20" />
                            </span>
                        </header>
                        <div id="treeview" class="no-radius"></div>
                    </section>


                    <!--app info-->
                    <section class="panel">
                        <header class="panel-heading">
                            {{'Config.ProjectInfo' | translate }}
                            <span class="pull-right">

                                <a href="/app/setting.html?#/appid={{pageContext.appId}}"
                                    style="margin-right: 5px;text-decoration:none;">
                                    <img src="img/edit.png" class="i-20 cursor-pointer" data-tooltip="tooltip"
                                        data-placement="bottom"
                                        title="{{'Config.ModifyBasicProjectInfo' | translate }}" />
                                </a>

                                <img src="img/unlike.png" class="i-20 cursor-pointer" ng-if="!favoriteId"
                                    ng-click="addFavorite()" data-tooltip="tooltip" data-placement="bottom"
                                    title="{{'Config.Favorite' | translate }}" />

                                <img src="img/like.png" class="i-20 cursor-pointer" ng-if="favoriteId"
                                    ng-click="deleteFavorite()" data-tooltip="tooltip" data-placement="bottom"
                                    title="{{'Config.CancelFavorite' | translate }}" />
                            </span>
                        </header>
                        <div class="panel-body">
                            <table class="project-info">
                                <tbody class="text-left">
                                    <tr>
                                        <th>{{'Common.AppId' | translate }}:</th>
                                        <td ng-bind="appBaseInfo.appId"></td>
                                    </tr>
                                    <tr>
                                        <th>{{'Common.AppName' | translate }}:</th>
                                        <td>
                                            <small ng-bind="appBaseInfo.name"></small>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>{{'Common.Department' | translate }}:</th>
                                        <td ng-bind="appBaseInfo.orgInfo"></td>
                                    </tr>
                                    <tr>
                                        <th>{{'Common.AppOwner' | translate }}:</th>
                                        <td ng-bind="appBaseInfo.ownerName"></td>
                                    </tr>
                                    <tr>
                                        <th>{{'Common.Email' | translate }}:</th>
                                        <td>
                                            <small ng-bind="appBaseInfo.ownerEmail"></small>
                                        </td>
                                    </tr>
                                    <tr ng-show="missEnvs.length > 0">
                                        <th>{{'Config.MissEnv' | translate }}:</th>
                                        <td>
                                            <span ng-repeat="env in missEnvs" ng-bind="env">
                                            </span>
                                        </td>
                                    </tr>
                                    <tr ng-show="missingNamespaces.length > 0">
                                        <th>{{'Config.MissNamespace' | translate }}:</th>
                                        <td>
                                            <span ng-repeat="namespace in missingNamespaces" ng-bind="namespace">
                                            </span>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

                        </div>
                    </section>

                    <!--operation entrance-->
                    <section>
                        <apolloentrance apollo-title="'Config.ProjectManage' | translate"
                            apollo-img-src="'project-manage'"
                            apollo-href="'/app/setting.html?#/appid=' + pageContext.appId"></apolloentrance>

                        <a class="list-group-item" ng-show="missEnvs.length > 0" ng-click="createAppInMissEnv()">
                            <div class="row icon-text icon-plus-orange">
                                <p class="btn-title ng-binding">{{'Config.CreateAppMissEnv' | translate }}</p>
                            </div>
                        </a>

                        <a class="list-group-item" ng-show="missingNamespaces.length > 0"
                            ng-click="createMissingNamespaces()">
                            <div class="row icon-text icon-plus-orange">
                                <p class="btn-title ng-binding">{{'Config.CreateAppMissNamespace' | translate }}</p>
                            </div>
                        </a>

                        <apolloentrance apollo-title="'Config.AddCluster' | translate" apollo-img-src="'plus-orange'"
                            apollo-href="'cluster.html?#/appid=' + pageContext.appId"
                            ng-show="hasCreateClusterPermission"></apolloentrance>

                        <div class="list-group-item cursor-pointer hover" ng-click="showMasterPermissionTips()"
                            ng-show="!hasCreateClusterPermission">
                            <div class="row icon-text icon-plus-orange">
                                <p class="btn-title">{{'Config.AddCluster' | translate }}</p>
                            </div>
                        </div>

                        <apolloentrance apollo-title="'Config.AddNamespace' | translate" apollo-img-src="'plus-orange'"
                            apollo-href="'namespace.html?#/appid=' + pageContext.appId"
                            ng-show="hasCreateNamespacePermission"></apolloentrance>

                        <div class="list-group-item cursor-pointer hover" ng-click="showMasterPermissionTips()"
                            ng-show="!hasCreateNamespacePermission">
                            <div class="row icon-text icon-plus-orange">
                                <p class="btn-title">{{'Config.AddNamespace' | translate }}</p>
                            </div>
                        </div>


                    </section>

                </div>
            </div>
        </div>

        <!--具体配置信息-->
        <!--namespaces-->
        <div class="config-item-container hide" ng-class="{'view-mode-1': viewMode == 1, 'view-mode-2': viewMode == 2}"
            ng-controller="ConfigNamespaceController">

            <h4 class="text-center" ng-show="viewMode == 2">
                {{'Config.CurrentlyOperatorEnv' | translate }}:{{pageContext.env}}，
                {{'Common.Cluster' | translate }}:{{pageContext.clusterName}}
            </h4>
            <div class="alert alert-info alert-dismissible" role="alert"
                ng-show="(!hideTip || !hideTip[pageContext.appId][pageContext.clusterName]) && envMapClusters[pageContext.env]">

                <button class="btn btn-sm btn-default pull-right" style="margin-top: -7px;margin-right:-15px;"
                    ng-click="closeTip(pageContext.clusterName)">{{'Config.DoNotRemindAgain' | translate }}
                </button>

                <!--default cluster tip -->
                <div ng-show="pageContext.clusterName == 'default'">
                    <strong>{{'Config.Note' | translate }}:</strong>
                    <span translate="Config.ClusterIsDefaultTipContent"
                        translate-value-name="{{envMapClusters[pageContext.env]}}"></span>
                </div>

                <!--custom cluster tip-->
                <div ng-show="pageContext.clusterName != 'default'">
                    <strong>{{'Config.Note' | translate }}:</strong>
                    <span translate="Config.ClusterIsCustomTipContent"
                        translate-value-name="{{pageContext.clusterName}}"></span>
                </div>

            </div>

            <div class="alert alert-info" ng-if="hasNotPublishNamespace">
                <p><b>{{'Config.Note' | translate }}:</b> {{'Config.HasNotPublishNamespace' | translate }}</p>
                <p>
                    <mark ng-bind="namespacePublishInfo.join('，')"></mark>
                </p>
            </div>

            <apollonspanel ng-repeat="namespace in namespaces" namespace="namespace" app-id="pageContext.appId"
                env="pageContext.env" lock-check="lockCheck" cluster="pageContext.clusterName" user="currentUser"
                pre-release-ns="prepareReleaseNamespace" create-item="createItem" edit-item="editItem"
                pre-delete-item="preDeleteItem" show-text="showText"
                show-no-modify-permission-dialog="showNoModifyPermissionDialog" show-body="namespaces.length < 3"
                lazy-load="namespaces.length > 10" pre-create-branch="preCreateBranch"
                pre-delete-branch="preDeleteBranch">
            </apollonspanel>

            <releasemodal app-id="pageContext.appId" env="pageContext.env" cluster="pageContext.clusterName">
            </releasemodal>

            <itemmodal to-operation-namespace="toOperationNamespace" app-id="pageContext.appId" env="pageContext.env"
                cluster="pageContext.clusterName" item="item">
            </itemmodal>

            <showtextmodal text="text"></showtextmodal>

            <rollbackmodal app-id="pageContext.appId" env="pageContext.env" cluster="pageContext.clusterName">
            </rollbackmodal>

            <rulesmodal app-id="pageContext.appId" env="pageContext.env" cluster="pageContext.clusterName">

            </rulesmodal>


            <mergeandpublishmodal app-id="pageContext.appId" env="pageContext.env" cluster="pageContext.clusterName">
            </mergeandpublishmodal>

            <publishdenymodal env="pageContext.env"></publishdenymodal>

            <deletenamespacemodal env="pageContext.env"></deletenamespacemodal>

            <apolloconfirmdialog apollo-dialog-id="'deleteConfirmDialog'"
                apollo-title="'Config.DeleteItem.DialogTitle' | translate"
                apollo-detail="'Config.DeleteItem.DialogContent' | translate:this" apollo-show-cancel-btn="true"
                apollo-confirm="deleteItem"></apolloconfirmdialog>

            <apolloconfirmdialog apollo-dialog-id="'releaseNoPermissionDialog'"
                apollo-title="'Config.PublishNoPermission.DialogTitle' | translate"
                apollo-detail="'Config.PublishNoPermission.DialogContent' | translate:this"
                apollo-show-cancel-btn="false">
            </apolloconfirmdialog>

            <apolloconfirmdialog apollo-dialog-id="'modifyNoPermissionDialog'"
                apollo-title="'Config.ModifyNoPermission.DialogTitle' | translate"
                apollo-detail="'Config.ModifyNoPermission.DialogContent' | translate:this"
                apollo-show-cancel-btn="false">
            </apolloconfirmdialog>

            <apolloconfirmdialog apollo-dialog-id="'masterNoPermissionDialog'"
                apollo-title="'Config.MasterNoPermission.DialogTitle' | translate"
                apollo-detail="'Config.MasterNoPermission.DialogContent' | translate:this"
                apollo-show-cancel-btn="false">
            </apolloconfirmdialog>

            <apolloconfirmdialog apollo-dialog-id="'namespaceLockedDialog'"
                apollo-title="'Config.NamespaceLocked.DialogTitle' | translate"
                apollo-detail="'Config.NamespaceLocked.DialogContent' | translate:this" apollo-show-cancel-btn="false">
            </apolloconfirmdialog>

            <apolloconfirmdialog apollo-dialog-id="'rollbackAlertDialog'"
                apollo-title="'Config.RollbackAlert.DialogTitle' | translate"
                apollo-detail="'Config.RollbackAlert.DialogContent' | translate" apollo-show-cancel-btn="true"
                apollo-confirm="rollback"></apolloconfirmdialog>

            <apolloconfirmdialog apollo-dialog-id="'emergencyPublishAlertDialog'"
                apollo-title="'Config.EmergencyPublishAlert.DialogTitle' | translate"
                apollo-detail="'Config.EmergencyPublishAlert.DialogContent' | translate" apollo-show-cancel-btn="true"
                apollo-confirm="emergencyPublish">
            </apolloconfirmdialog>

            <apolloconfirmdialog apollo-dialog-id="'deleteBranchDialog'"
                apollo-title="'Config.DeleteBranch.DialogTitle' | translate"
                apollo-detail="'Config.DeleteBranch.DialogContent' | translate" apollo-show-cancel-btn="true"
                apollo-confirm="deleteBranch">
            </apolloconfirmdialog>

            <apolloconfirmdialog apollo-dialog-id="'updateRuleTips'"
                apollo-title="'Config.UpdateRuleTips.DialogTitle' | translate"
                apollo-detail="'Config.UpdateRuleTips.DialogContent' | translate"></apolloconfirmdialog>

            <apolloconfirmdialog apollo-dialog-id="'mergeAndReleaseDenyDialog'"
                apollo-title="'Config.MergeAndReleaseDeny.DialogTitle' | translate"
                apollo-detail="'Config.MergeAndReleaseDeny.DialogContent' | translate"></apolloconfirmdialog>

            <apolloconfirmdialog apollo-dialog-id="'grayReleaseWithoutRulesTips'"
                apollo-title="'Config.GrayReleaseWithoutRulesTips.DialogTitle' | translate"
                apollo-detail="'Config.GrayReleaseWithoutRulesTips.DialogContent' | translate">
            </apolloconfirmdialog>

            <apolloconfirmdialog apollo-dialog-id="'deleteNamespaceDenyForMasterInstanceDialog'"
                apollo-title="'Config.DeleteNamespaceDenyForMasterInstance.DialogTitle' | translate"
                apollo-detail="'Config.DeleteNamespaceDenyForMasterInstance.DialogContent' | translate:this"
                apollo-confirm="continueDeleteNamespace">
            </apolloconfirmdialog>

            <apolloconfirmdialog apollo-dialog-id="'deleteNamespaceDenyForBranchInstanceDialog'"
                apollo-title="'Config.DeleteNamespaceDenyForBranchInstance.DialogTitle' | translate"
                apollo-detail="'Config.DeleteNamespaceDenyForBranchInstance.DialogContent' | translate:this"
                apollo-confirm="continueDeleteNamespace">
            </apolloconfirmdialog>

            <apolloconfirmdialog apollo-dialog-id="'deleteNamespaceDenyForPublicNamespaceDialog'"
                apollo-title="'Config.DeleteNamespaceDenyForPublicNamespace.DialogTitle' | translate"
                apollo-detail="deleteNamespaceContext.detailReason">
            </apolloconfirmdialog>

            <apolloconfirmdialog apollo-dialog-id="'syntaxCheckFailedDialog'"
                apollo-title="'Config.SyntaxCheckFailed.DialogTitle' | translate"
                apollo-detail="syntaxCheckContext.syntaxCheckMessage" apollo-extra-class="'pre'">
            </apolloconfirmdialog>


            <div class="modal fade" id="createBranchTips" tabindex="-1" role="dialog">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header panel-primary">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                    aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title">{{'Config.CreateBranchTips.DialogTitle' | translate}}</h4>
                        </div>
                        <div class="modal-body" ng-bind-html="'Config.CreateBranchTips.DialogContent' | translate">
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default"
                                data-dismiss="modal">{{'Common.Cancel' | translate}}</button>
                            <button type="button" class="btn btn-primary" data-dismiss="modal"
                                ng-click="createBranch()">{{'Common.Ok' | translate}}</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <div ng-include="'views/common/footer.html'"></div>


    <!-- jquery.js -->
    <script src="vendor/jquery.min.js" type="text/javascript"></script>

    <script src="vendor/select2/select2.min.js" type="text/javascript"></script>
    <script src="vendor/jquery-plugin/jquery.textareafullscreen.js" type="text/javascript"></script>

    <!--lodash.js-->
    <script src="vendor/lodash.min.js" type="text/javascript"></script>

    <!--angular-->
    <script src="vendor/angular/angular.min.js"></script>
    <script src="vendor/angular/angular-resource.min.js"></script>
    <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script>
    <script src="vendor/angular/loading-bar.min.js"></script>
    <script src="vendor/angular/angular-cookies.min.js"></script>
    <script src="vendor/angular/angular-sanitize.min.js"></script>

    <script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script>
    <script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script>
    <script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script>
    <!-- bootstrap.js -->
    <script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="vendor/bootstrap/js/bootstrap-treeview.min.js" type="text/javascript"></script>

    <script src="vendor/diff.min.js" type="text/javascript"></script>

    <script src="vendor/clipboard.min.js" type="text/javascript"></script>

    <script src="vendor/ui-ace/ace.js" type="text/javascript"></script>
    <script src="vendor/ui-ace/ui-ace.min.js" type="text/javascript"></script>
    <script src="vendor/ui-ace/mode-properties.js" type="text/javascript"></script>
    <script src="vendor/ui-ace/mode-xml.js" type="text/javascript"></script>
    <script src="vendor/ui-ace/mode-yaml.js" type="text/javascript"></script>
    <script src="vendor/ui-ace/mode-json.js" type="text/javascript"></script>
    <script src="vendor/ui-ace/worker-json.js" type="text/javascript"></script>
    <script src="vendor/ui-ace/worker-xml.js" type="text/javascript"></script>



    <!--valdr-->
    <script src="vendor/valdr/valdr.min.js" type="text/javascript"></script>
    <script src="vendor/valdr/valdr-message.min.js" type="text/javascript"></script>

    <!--biz script-->
    <script type="application/javascript" src="scripts/app.js"></script>

    <!--service-->
    <script type="application/javascript" src="scripts/services/AppService.js"></script>
    <script type="application/javascript" src="scripts/services/EnvService.js"></script>
    <script type="application/javascript" src="scripts/services/UserService.js"></script>
    <script type="application/javascript" src="scripts/services/ConfigService.js"></script>
    <script type="application/javascript" src="scripts/services/ReleaseService.js"></script>
    <script type="application/javascript" src="scripts/services/PermissionService.js"></script>
    <script type="application/javascript" src="scripts/services/NamespaceService.js"></script>
    <script type="application/javascript" src="scripts/services/CommitService.js"></script>
    <script type="application/javascript" src="scripts/services/CommonService.js"></script>
    <script type="application/javascript" src="scripts/services/NamespaceLockService.js"></script>
    <script type="application/javascript" src="scripts/services/InstanceService.js"></script>
    <script type="application/javascript" src="scripts/services/FavoriteService.js"></script>
    <script type="application/javascript" src="scripts/services/NamespaceBranchService.js"></script>
    <script type="application/javascript" src="scripts/services/EventManager.js"></script>


    <script type="application/javascript" src="scripts/AppUtils.js"></script>

    <!--directive-->
    <script type="application/javascript" src="scripts/directive/directive.js"></script>
    <script type="application/javascript" src="scripts/directive/namespace-panel-directive.js"></script>
    <script type="application/javascript" src="scripts/directive/diff-directive.js"></script>
    <script type="application/javascript" src="scripts/directive/release-modal-directive.js"></script>
    <script type="application/javascript" src="scripts/directive/item-modal-directive.js"></script>
    <script type="application/javascript" src="scripts/directive/show-text-modal-directive.js"></script>
    <script type="application/javascript" src="scripts/directive/rollback-modal-directive.js"></script>
    <script type="application/javascript" src="scripts/directive/gray-release-rules-modal-directive.js"></script>
    <script type="application/javascript" src="scripts/directive/merge-and-publish-modal-directive.js"></script>
    <script type="application/javascript" src="scripts/directive/publish-deny-modal-directive.js"></script>
    <script type="application/javascript" src="scripts/directive/delete-namespace-modal-directive.js"></script>

    <!--controller-->
    <script type="application/javascript" src="scripts/controller/config/ConfigNamespaceController.js"></script>
    <script type="application/javascript" src="scripts/controller/config/ConfigBaseInfoController.js"></script>

    <script type="application/javascript" src="scripts/PageCommon.js"></script>

    <script src="scripts/valdr.js" type="text/javascript"></script>
</body>

</html>
