sync.html 12.9 KB
Newer Older
lepdou committed
1 2 3 4
<!doctype html>
<html ng-app="sync_item">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
zhangle committed
5
    <link rel="icon" href="../img/config.png">
lepdou committed
6 7 8 9 10 11 12 13
    <!-- styles -->
    <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" media='all' href="../vendor/angular/loading-bar.min.css">
    <link rel="stylesheet" type="text/css" href="../styles/common-style.css">
    <title>同步配置</title>
</head>

14
<body>
lepdou committed
15

lepdou committed
16
<apollonav></apollonav>
lepdou committed
17

lepdou committed
18
<div class="container-fluid apollo-container hidden" ng-controller="SyncItemController">
lepdou committed
19 20 21
    <section class="panel col-md-offset-1 col-md-10">
        <header class="panel-heading">
            <div class="row">
22
                <div class="col-md-7">
lepdou committed
23 24 25 26 27
                    <h4 class="modal-title">同步配置
                        <small ng-show="syncItemStep == 1">(第一步:选择同步信息)</small>
                        <small ng-show="syncItemStep == 2">(第二步:检查Diff)</small>
                    </h4>
                </div>
28
                <div class="col-md-5 text-right">
lepdou committed
29 30 31 32
                    <button type="button" class="btn btn-primary" ng-show="syncItemStep > 1 && syncItemStep < 3"
                            ng-click="syncItemNextStep(-1)">上一步
                    </button>
                    <button type="button" class="btn btn-primary" ng-show="syncItemStep < 2"
lepdou committed
33
                            ng-click="diff()">下一步
lepdou committed
34
                    </button>
lepdou committed
35
                    <button type="button" class="btn btn-success" ng-show="syncItemStep == 2 && hasDiff"
36
                            ng-click="syncItems()" ng-disabled="syncBtnDisabled">同步
lepdou committed
37
                    </button>
38
                    <button type="button" class="btn btn-info" data-dismiss="modal"
lepdou committed
39
                            ng-click="backToAppHomePage()">返回到项目首页
lepdou committed
40 41 42 43 44 45
                    </button>
                </div>
            </div>
        </header>
        <div class="panel-body">
            <div class="row" ng-show="syncItemStep == 1">
lepdou committed
46
                <div class="alert-info alert no-radius">
zhangle committed
47 48 49 50 51 52
                    <strong>Tips:</strong>
                    <ul>
                        <li>通过同步配置功能,可以使多个环境、集群间的配置保持一致</li>
                        <li>需要注意的是,同步完之后需要发布后才会对应用生效</li>
                    </ul>
                </div>
lepdou committed
53 54 55 56 57 58 59 60
                <div class="form-horizontal">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">同步的Namespace</label>
                        <div class="col-sm-6">
                            <h4 ng-bind="pageContext.namespaceName"></h4>
                        </div>
                    </div>
                </div>
lepdou committed
61 62 63 64
                <div class="form-horizontal">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">同步到那个集群</label>
                        <div class="col-sm-6">
65
                            <apolloclusterselector apollo-app-id="pageContext.appId" apollo-default-all-checked="true"
lepdou committed
66 67 68
                                                   apollo-select="collectSelectedClusters"
                                                   apollo-not-checked-env="pageContext.env"
                                                   apollo-not-checked-cluster="pageContext.clusterName"></apolloclusterselector>
lepdou committed
69 70 71 72 73 74 75 76 77 78 79 80
                        </div>
                    </div>
                </div>
                <hr>
            </div>

            <div class="row" ng-show="syncItemStep == 1" style="margin-top: 10px;">
                <div class="form-horizontal">
                    <div class="col-sm-2 text-right">
                        <label class="control-label">需要同步的配置</label>
                    </div>
                    <div class="col-sm-10">
zhangle committed
81 82 83 84 85 86
                        <div class="row text-right" style="margin-bottom: 5px; margin-right: 0px;">
                            按最后更新时间过滤
                            开始时间:<input type="date" ng-model="filterBeginTime"> 结束时间:  <input type="date" ng-model="filterEndTime">
                            <button class="btn btn-sm btn-primary" ng-click="filter()">过滤</button>
                            <button class="btn btn-sm btn-default" ng-click="resetFilter()">重置</button>
                        </div>
87
                        <table class="table table-bordered table-striped table-hover">
lepdou committed
88 89 90
                            <thead>
                            <tr>
                                <td><input type="checkbox" ng-click="toggleItemsCheckedStatus()"></td>
zhangle committed
91 92 93 94 95 96 97 98 99 100 101 102 103
                                <td class="hover" ng-click="col='key';desc=!desc;">
                                    Key
                                    <span class="glyphicon glyphicon-sort"></span>
                                </td>
                                <td>Value</td>
                                <td class="hover" ng-click="col='dataChangeCreatedTime';desc=!desc;">
                                    Create Time
                                    <span class="glyphicon glyphicon-sort"></span>
                                </td>
                                <td class="hover" ng-click="col='dataChangeLastModifiedTime';desc=!desc;">
                                    Update Time
                                    <span class="glyphicon glyphicon-sort"></span>
                                </td>
lepdou committed
104 105 106
                            </tr>
                            </thead>
                            <tbody>
zhangle committed
107
                            <tr ng-repeat="item in viewItems|orderBy:col:desc">
lepdou committed
108 109
                                <td width="10%"><input type="checkbox" ng-checked="item.checked"
                                                       ng-click="switchSelect(item)"></td>
lepdou committed
110
                                <td width="20%">
111 112
                                    <span ng-bind="item.key | limitTo: 250"></span>
                                    <span ng-bind="item.key.length > 250 ? '...' : ''"></span>
lepdou committed
113
                                </td>
114
                                <td class="cursor-pointer" width="40%" ng-click="showText(item.value)">
115 116
                                    <span ng-bind="item.value | limitTo: 250"></span>
                                    <span ng-bind="item.value.length > 250 ? '...' : ''"></span>
lepdou committed
117
                                </td>
zhangle committed
118 119 120 121 122
                                <td width="15%">
                                    <span ng-bind="item.dataChangeCreatedTime  | date: 'yyyy-MM-dd HH:mm:ss'"></span>
                                </td>
                                <td width="15%">
                                    <span ng-bind="item.dataChangeLastModifiedTime  | date: 'yyyy-MM-dd HH:mm:ss'"></span>
lepdou committed
123
                                </td>
lepdou committed
124 125 126 127 128 129 130 131 132 133
                            </tr>
                            </tbody>
                        </table>

                    </div>
                </div>

            </div>

            <!--step 2-->
lepdou committed
134
            <div class="row" ng-show="syncItemStep == 2" ng-repeat="clusterDiff in clusterDiffs">
lepdou committed
135
                <h4 class="text-center">
lepdou committed
136 137 138
                    环境:<span ng-bind="clusterDiff.namespace.env"></span>
                    集群:<span ng-bind="clusterDiff.namespace.clusterName"></span>
                    <span ng-show="!clusterDiff.extInfo">Namespace:{{pageContext.namespaceName}}</span>
lepdou committed
139
                </h4>
lepdou committed
140 141 142 143
                <div class="text-center"
                     ng-show="clusterDiff.diffs.createItems.length + clusterDiff.diffs.updateItems.length == 0 || clusterDiff.extInfo">
                    <span ng-show="clusterDiff.diffs.createItems.length + clusterDiff.diffs.updateItems.length == 0 && !clusterDiff.extInfo">没有更新的配置</span>
                    <span ng-show="clusterDiff.extInfo" ng-bind="clusterDiff.extInfo"></span>
lepdou committed
144 145
                    ,忽略同步
                </div>
146

lepdou committed
147 148
                <div class="row" style="margin-top: 10px;"
                     ng-show="clusterDiff.diffs.updateItems.length + clusterDiff.diffs.createItems.length > 0">
lepdou committed
149
                    <div class="form-horizontal">
lepdou committed
150
                        <div class="col-sm-12">
lepdou committed
151
                            <table class="table table-bordered table-striped table-hover">
lepdou committed
152 153
                                <thead>
                                <tr>
lepdou committed
154 155 156 157 158 159
                                    <td>Type</td>
                                    <td>Key</td>
                                    <td>同步前</td>
                                    <td>同步后</td>
                                    <td>Comment</td>
                                    <td>操作</td>
lepdou committed
160 161 162
                                </tr>
                                </thead>
                                <tbody>
lepdou committed
163 164 165 166 167 168 169 170 171 172
                                <tr ng-repeat="createItem in clusterDiff.diffs.createItems">
                                    <td width="5%">新增</td>
                                    <td width="15%" ng-bind="createItem.key"></td>
                                    <td width="30%"></td>
                                    <td width="30%" ng-bind="createItem.value"></td>
                                    <td width="15%" ng-bind="createItem.comment"></td>
                                    <td width="5%">
                                        <a data-tooltip="tooltip" data-placement="bottom" title="不同步该配置"
                                           ng-click="removeItem(clusterDiff.diffs, 'create', createItem)">删除</a>
                                    </td>
lepdou committed
173
                                </tr>
lepdou committed
174 175 176 177 178 179 180 181 182 183
                                <tr ng-repeat="updateItem in clusterDiff.diffs.updateItems">
                                    <td width="5%">更新</td>
                                    <td width="15%" ng-bind="updateItem.key"></td>
                                    <td width="30%" ng-bind="updateItem.oldValue"></td>
                                    <td width="30%" ng-bind="updateItem.value"></td>
                                    <td width="15%" ng-bind="updateItem.comment"></td>
                                    <td width="5%">
                                        <a data-tooltip="tooltip" data-placement="bottom" title="不同步该配置"
                                           ng-click="removeItem(clusterDiff.diffs, 'update', updateItem)">删除</a>
                                    </td>
lepdou committed
184 185 186
                                </tr>
                                </tbody>
                            </table>
lepdou committed
187 188 189 190 191 192 193 194

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


            <!--step 3-->
lepdou committed
195
            <div class="row text-center" ng-show="syncItemStep == 3 && syncSuccess">
lepdou committed
196
                <img src="../img/sync-succ.png" style="height: 100px; width: 100px">
197
                <h3>同步成功!</h3>
lepdou committed
198 199 200
            </div>
            <div class="row text-center" ng-show="syncItemStep == 3 && !syncSuccess">
                <img src="../img/sync-error.png" style="height: 100px; width: 100px">
201
                <h3>同步失败!</h3>
lepdou committed
202 203 204 205
            </div>

        </div>
    </section>
206

lepdou committed
207
    <showtextmodal text="text"/>
lepdou committed
208 209
</div>

210 211


lepdou committed
212
<div ng-include="'../views/common/footer.html'"></div>
lepdou committed
213

lepdou committed
214 215 216
<!-- jquery.js -->
<script src="../vendor/jquery.min.js" type="text/javascript"></script>

lepdou committed
217 218 219 220 221 222
<!--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>

lepdou committed
223

lepdou committed
224 225 226 227 228 229
<!-- bootstrap.js -->
<script src="../vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>

<!--nicescroll-->
<script src="../vendor/jquery.nicescroll.min.js"></script>

230
<script src="../vendor/clipboard.min.js" type="text/javascript"></script>
lepdou committed
231 232 233
<!--biz-->
<script type="application/javascript" src="../scripts/app.js"></script>
<script type="application/javascript" src="../scripts/services/AppService.js"></script>
lepdou committed
234
<script type="application/javascript" src="../scripts/services/EnvService.js"></script>
lepdou committed
235
<script type="application/javascript" src="../scripts/services/ConfigService.js"></script>
lepdou committed
236
<script type="application/javascript" src="../scripts/services/UserService.js"></script>
237
<script type="application/javascript" src="../scripts/services/CommonService.js"></script>
lepdou committed
238
<script type="application/javascript" src="../scripts/AppUtils.js"></script>
239
<script type="application/javascript" src="../scripts/controller/config/SyncConfigController.js"></script>
lepdou committed
240 241

<script type="application/javascript" src="../scripts/PageCommon.js"></script>
lepdou committed
242
<script type="application/javascript" src="../scripts/directive/directive.js"></script>
lepdou committed
243
<script type="application/javascript" src="../scripts/directive/show-text-modal-directive.js"></script>
lepdou committed
244 245
</body>
</html>