namespace-panel-master-tab.html 55.4 KB
Newer Older
1 2 3
<!--master panel body-->
<section class="master-panel-body"
         ng-if="namespace.hasBranch
lepdou committed
4
         && namespace.displayControl.currentOperateBranch == 'master' ||
5 6 7 8
          !namespace.hasBranch">
    <!--main header-->
    <header class="panel-heading">
        <div class="row">
9
            <div class="col-md-6 col-sm-6 header-namespace">
lepdou committed
10 11
                <span class="cursor-pointer"
                      data-toggle="collapse" data-target="#BODY{{namespace.id}}" aria-expanded="false"
12
                      ng-click="namespace.displayControl.show = !namespace.displayControl.show">
lepdou committed
13
                    <span class="glyphicon glyphicon-triangle-bottom small"
14
                          ng-show="namespace.displayControl.show"></span>
lepdou committed
15
                    <span class="glyphicon glyphicon-triangle-top small"
16
                          ng-show="!namespace.displayControl.show"></span>
lepdou committed
17 18 19 20
                    <b class="namespace-name" ng-bind="namespace.viewName"
                       data-tooltip="tooltip" data-placement="bottom" title="点击展开/收缩Namespace"></b>

                </span>
21
                <span class="label label-info no-radius namespace-label" ng-bind="namespace.format"></span>
22 23 24
                <span class="label label-warning no-radius namespace-label modify-tip"
                      ng-show="namespace.itemModifiedCnt > 0">
                    有修改
25 26 27 28 29 30
                    <span class="badge label badge-white namespace-label" ng-bind="namespace.itemModifiedCnt"></span>
                </span>
                <span class="label label-primary no-radius namespace-label"
                      ng-show="namespace.lockOwner">当前修改者:{{namespace.lockOwner}}</span>
            </div>

31
            <div class="col-md-6 col-sm-6 text-right header-buttons">
lepdou committed
32

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
                <button type="button" class="btn btn-success btn-sm"
                        data-tooltip="tooltip" data-placement="bottom" title="发布配置"
                        ng-show="(namespace.hasReleasePermission || namespace.hasModifyPermission)"
                        ng-disabled="namespace.isTextEditing"
                        ng-click="publish(namespace)">
                    <img src="img/release.png">
                    发布
                </button>
                <button type="button" class="btn btn-default btn-sm"
                        data-tooltip="tooltip" data-placement="bottom" title="回滚已发布配置"
                        ng-show="namespace.hasReleasePermission"
                        ng-click="rollback(namespace)">
                    <img src="img/rollback.png">
                    回滚
                </button>
                <a type="button" class="btn btn-default btn-sm"
                   data-tooltip="tooltip" data-placement="bottom" title="查看发布历史"
                   href="/config/history.html?#/appid={{appId}}&env={{env}}&clusterName={{cluster}}&namespaceName={{namespace.baseInfo.namespaceName}}">
                    <img src="img/release-history.png">
                    发布历史
                </a>
                <a type="button" class="btn btn-default btn-sm"
                   data-tooltip="tooltip" data-placement="bottom" title="配置修改、发布权限"
                   href="/namespace/role.html?#/appid={{appId}}&namespaceName={{namespace.baseInfo.namespaceName}}"
                   ng-show="hasAssignUserPermission">
                    <img src="img/assign.png">
                    授权
                </a>

                <a type="button" class="btn btn-default btn-sm"
                   data-tooltip="tooltip" data-placement="bottom" title="创建测试版本"
                   ng-show="!namespace.hasBranch && namespace.isPropertiesFormat && namespace.hasModifyPermission"
                   ng-click="preCreateBranch(namespace)">
                    <img src="img/test.png">
lepdou committed
67
                    灰度
68
                </a>
lepdou committed
69

70 71 72 73 74 75
                <a type="button" class="btn btn-default btn-sm J_tableview_btn"
                   data-tooltip="tooltip" data-placement="bottom" title="您没有任何配置权限,请申请"
                   ng-click="showNoModifyPermissionDialog()"
                   ng-show="!namespace.hasModifyPermission && !namespace.hasReleasePermission">
                    申请配置权限
                </a>
lepdou committed
76

77
                <div class="btn-group"
78
                     ng-show="namespace.hasModifyPermission || namespace.hasReleasePermission || hasAssignUserPermission">
lepdou committed
79
                    <button type="button" class="btn btn-default btn-sm dropdown-toggle"
80
                            data-toggle="dropdown"
lepdou committed
81 82 83 84 85 86 87 88 89 90
                            aria-haspopup="true" aria-expanded="false">
                        <img src="img/operate.png"> <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu" style="right: 0; left: -160px;">
                        <li ng-click="deleteNamespace(namespace)">
                            <a style="color: red">
                                <img src="img/delete.png"> 删除Namespace</a>
                        </li>
                    </ul>
                </div>
91 92 93 94
            </div>
        </div>
    </header>

lepdou committed
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
    <div id="BODY{{namespace.id}}" class="collapse in">
        <!--second header-->
        <header class="panel-heading second-panel-heading">
            <div class="row">
                <div class="col-md-6 col-sm-6 pull-left">
                    <!--master branch nav tabs-->
                    <ul class="nav nav-tabs">
                        <li role="presentation" ng-click="switchView(namespace, 'table')"
                            ng-show="namespace.isPropertiesFormat">
                            <a ng-class="{node_active:namespace.viewType == 'table'}">
                                <img src="img/table.png">
                                表格
                            </a>
                        </li>
                        <li role="presentation"
                            ng-click="switchView(namespace, 'text')">
                            <a ng-class="{node_active:namespace.viewType == 'text'}">
                                <img src="img/text.png">
                                文本
                            </a>
                        </li>
                        <li role="presentation" ng-click="switchView(namespace, 'history')">
                            <a ng-class="{node_active:namespace.viewType == 'history'}">
                                <img src="img/change.png">
                                更改历史
                            </a>
                        </li>
                        <li role="presentation" ng-click="switchView(namespace, 'instance')">
                            <a ng-class="{node_active:namespace.viewType == 'instance'}">
                                <img src="img/machine.png">
                                实例列表
                                <span class="badge badge-grey" ng-bind="namespace.instancesCount"></span>
                            </a>
                        </li>
                    </ul>
                </div>
                <div class="col-md-6 col-sm-6 text-right">
132 133 134 135
                    <img src="img/copy.png" class="ns_btn clipboard cursor-pointer"
                         data-clipboard-text="{{namespace.text}}"
                         data-tooltip="tooltip" data-placement="bottom" title="复制文本"
                         ng-show="!namespace.isTextEditing && namespace.viewType == 'text' && namespace.hasModifyPermission">
lepdou committed
136
                    &nbsp;
137 138 139 140 141 142 143 144
                    <img src="img/cancel.png" class="ns_btn cursor-pointer"
                         data-tooltip="tooltip" data-placement="bottom" title="取消修改"
                         ng-show="namespace.isTextEditing && namespace.viewType == 'text'"
                         ng-click="toggleTextEditStatus(namespace)">
                    <img src="img/edit.png" class="ns_btn cursor-pointer"
                         data-tooltip="tooltip" data-placement="bottom" title="修改配置"
                         ng-show="!namespace.isTextEditing && namespace.viewType == 'text' && namespace.hasModifyPermission"
                         ng-click="toggleTextEditStatus(namespace)">
lepdou committed
145 146

                    &nbsp;
147 148 149 150 151
                    <img src="img/submit.png" class="ns_btn cursor-pointer"
                         data-tooltip="tooltip" data-placement="bottom" title="提交修改"
                         data-toggle="modal" data-target="#commitModal"
                         ng-show="namespace.isTextEditing && namespace.viewType == 'text'"
                         ng-click="modifyByText(namespace)">
lepdou committed
152 153 154 155

                    <button type="button" class="btn btn-default btn-sm"
                            data-tooltip="tooltip" data-placement="bottom" title="按Key过滤配置"
                            ng-show="namespace.viewType == 'table' && namespace.displayControl.currentOperateBranch == 'master'
156
                        && !namespace.isLinkedNamespace"
lepdou committed
157 158 159 160
                            ng-click="toggleItemSearchInput(namespace)">
                        <span class="glyphicon glyphicon-filter"></span>
                        过滤配置
                    </button>
161

lepdou committed
162 163 164 165
                    <button type="button" class="btn btn-default btn-sm J_tableview_btn"
                            data-tooltip="tooltip" data-placement="bottom" title="同步各环境间配置"
                            ng-click="goToSyncPage(namespace)"
                            ng-show="namespace.viewType == 'table' && namespace.displayControl.currentOperateBranch == 'master'
166
                             && namespace.hasModifyPermission && namespace.isPropertiesFormat">
lepdou committed
167 168 169
                        <img src="img/sync.png">
                        同步配置
                    </button>
170

lepdou committed
171 172
                    <button type="button" class="btn btn-primary btn-sm"
                            ng-show="!namespace.isLinkedNamespace
173
                             && namespace.viewType == 'table'
lepdou committed
174
                             && namespace.displayControl.currentOperateBranch == 'master'
175
                             && namespace.hasModifyPermission"
lepdou committed
176 177 178 179 180
                            ng-click="createItem(namespace)">
                        <img src="img/plus.png">
                        新增配置
                    </button>
                </div>
181
            </div>
lepdou committed
182
        </header>
183

lepdou committed
184 185 186 187
        <!--namespace body-->
        <section>
            <!--table view-->
            <div class="namespace-view-table" ng-show="namespace.viewType == 'table'">
188

lepdou committed
189 190 191
                <div class="J_namespace-release-tip well well-sm no-radius text-center"
                     ng-show="namespace.isLatestReleaseLoaded && !namespace.isLinkedNamespace && !namespace.latestRelease">
                    <span style="color: red"> Tips: 此namespace从来没有发布过,Apollo客户端将获取不到配置并记录404日志信息,请及时发布。</span>
192
                </div>
lepdou committed
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
                <!--not link namespace-->
                <div ng-if="!namespace.isLinkedNamespace">
                    <div class="search-input" ng-show="namespace.displayControl.showSearchInput">
                        <input type="text" class="form-control" placeholder="输入key过滤"
                               ng-model="namespace.searchKey"
                               ng-change="searchItems(namespace)">
                    </div>

                    <table class="table table-bordered table-striped table-hover">
                        <thead>
                        <tr>
                            <th>发布状态</th>
                            <th class="hover" title="排序"
                                ng-click="col='item.key';desc=!desc;">
                                Key&nbsp;
                                <span class="glyphicon glyphicon-sort"></span>

                            </th>
                            <th>
                                Value
                            </th>
                            <th>
                                备注
                            </th>
                            <th class="hover" title="排序"
                                ng-click="col='item.dataChangeLastModifiedBy';desc=!desc;">
                                最后修改人
                                <span class="glyphicon glyphicon-sort"></span>

                            </th>
                            <th class="hover" title="排序"
                                ng-click="col='item.dataChangeLastModifiedTime';desc=!desc;">
                                最后修改时间
                                <span class="glyphicon glyphicon-sort"></span>
                            </th>
228

lepdou committed
229 230 231 232 233 234 235
                            <th>
                                操作
                            </th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="config in namespace.viewItems |orderBy:col:desc"
lepdou committed
236 237
                            ng-if="config.item.key"
                            ng-class="{'warning': !config.item.value}">
lepdou committed
238
                            <td width="8%" class="text-center">
239 240 241
                            <span class="label label-warning no-radius cursor-pointer" ng-if="config.isModified"
                                  data-tooltip="tooltip" data-placement="bottom" title="点击查看已发布的值"
                                  ng-click="showText(config.oldValue?config.oldValue:'新增的配置,无发布的值')">未发布</span>
242 243 244
                                <span class="label label-default-light no-radius"
                                      data-tooltip="tooltip" data-placement="bottom" title="已生效的配置"
                                      ng-if="!config.isModified">已发布</span>
lepdou committed
245 246 247 248
                            </td>
                            <td width="15%" class="cursor-pointer" title="点击查看" ng-click="showText(config.item.key)">
                                <span ng-bind="config.item.key | limitTo: 250"></span>
                                <span ng-bind="config.item.key.length > 250 ? '...' :''"></span>
249 250 251 252 253 254 255 256 257 258
                                <span class="label label-default cursor-pointer" ng-if="config.hasBranchValue"
                                      data-tooltip="tooltip" data-placement="bottom" title="该配置有灰度配置,点击查看灰度的值"
                                      ng-click="namespace.displayControl.currentOperateBranch=namespace.branchName;namespace.branch.viewType='table'"></span>
                                <span class="label label-success" ng-if="config.isModified && !config.oldValue"
                                      data-tooltip="tooltip" data-placement="bottom" title="新增的配置"></span>
                                <span class="label label-info"
                                      ng-if="config.isModified && config.oldValue && !config.isDeleted"
                                      data-tooltip="tooltip" data-placement="bottom" title="修改的配置"></span>
                                <span class="label label-danger" ng-if="config.isDeleted"
                                      data-tooltip="tooltip" data-placement="bottom" title="删除的配置"></span>
lepdou committed
259 260 261 262 263 264 265 266 267 268 269 270 271 272
                            </td>
                            <td width="30%" class="cursor-pointer" title="点击查看" ng-click="showText(config.item.value)">
                                <span ng-bind="config.item.value | limitTo: 250"></span>
                                <span ng-bind="config.item.value.length > 250 ? '...': ''"></span>
                            </td>
                            <td width="13%" title="{{config.item.comment}}">
                                <span ng-bind="config.item.comment | limitTo: 250"></span>
                                <span ng-bind="config.item.comment.length > 250 ?'...' : ''"></span>
                            </td>
                            <td width="10%" ng-bind="config.item.dataChangeLastModifiedBy">
                            </td>
                            <td width="16%"
                                ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'">
                            </td>
273

lepdou committed
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
                            <td width="8%" class="text-center" ng-if="!config.isDeleted">
                                <img src="img/edit.png" data-tooltip="tooltip" data-placement="bottom" title="修改"
                                     ng-click="editItem(namespace, config.item)"
                                     ng-show="namespace.hasModifyPermission">
                                <img style="margin-left: 5px;" src="img/cancel.png"
                                     data-tooltip="tooltip" data-placement="bottom" title="删除"
                                     ng-click="preDeleteItem(namespace, config.item.id)"
                                     ng-show="namespace.hasModifyPermission">
                            </td>
                            <td width="6%" class="text-center" ng-if="config.isDeleted">
                            </td>

                        </tr>
                        </tbody>
                    </table>
                </div>

                <!--link namespace-->
                <div class="panel panel-default" ng-if="namespace.isLinkedNamespace">
                    <div class="panel-heading">
                        <div class="row">
                            <div class="padding-top-5 col-md-4 col-sm-4">
                                覆盖的配置
                            </div>
                            <div class="col-md-8 col-sm-8">
                                <input type="text" class="form-control pull-right" placeholder="filter by key ..."
                                       ng-class="{'search-onblur': namespace.searchStatus == 'OFF' || !namespace.searchStatus,
301
                                    'search-focus': namespace.searchStatus == 'ON'}"
lepdou committed
302 303 304 305 306
                                       ng-model="namespace.searchKey"
                                       ng-change="searchItems(namespace)"
                                       ng-focus="namespace.searchStatus='ON'"
                                       ng-blur="namespace.searchStatus='OFF'">
                            </div>
307 308 309
                        </div>
                    </div>

lepdou committed
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
                    <table class="table table-bordered table-striped table-hover"
                           ng-if="namespace.viewItems && namespace.viewItems.length">
                        <thead>
                        <tr>
                            <th>发布状态</th>
                            <th class="hover" title="排序"
                                ng-click="col='item.key';desc=!desc;">
                                Key&nbsp;
                                <span class="glyphicon glyphicon-sort"></span>

                            </th>
                            <th>
                                Value
                            </th>
                            <th>
                                备注
                            </th>
                            <th class="hover" title="排序"
                                ng-click="col='item.dataChangeLastModifiedBy';desc=!desc;">
                                最后修改人
                                <span class="glyphicon glyphicon-sort"></span>

                            </th>
                            <th class="hover" title="排序"
                                ng-click="col='item.dataChangeLastModifiedTime';desc=!desc;">
                                最后修改时间
                                <span class="glyphicon glyphicon-sort"></span>
                            </th>

                            <th>
                                操作
                            </th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="config in namespace.viewItems |orderBy:col:desc"
                            ng-if="config.item.key">
                            <td width="8%" class="text-center">
348 349 350
                            <span class="label label-warning no-radius cursor-pointer" ng-if="config.isModified"
                                  data-tooltip="tooltip" data-placement="bottom" title="点击查看已发布的值"
                                  ng-click="showText(config.oldValue?config.oldValue:'新增的配置,无发布的值')">未发布</span>
351 352 353
                                <span class="label label-default-light no-radius"
                                      data-tooltip="tooltip" data-placement="bottom" title="已生效的配置"
                                      ng-if="!config.isModified">已发布</span>
lepdou committed
354 355 356 357
                            </td>
                            <td width="15%" class="cursor-pointer" title="点击查看" ng-click="showText(config.item.key)">
                                <span ng-bind="config.item.key | limitTo: 250"></span>
                                <span ng-bind="config.item.key.length > 250 ? '...' :''"></span>
358 359 360 361 362 363 364 365 366 367
                                <span class="label label-default cursor-pointer" ng-if="config.hasBranchValue"
                                      data-tooltip="tooltip" data-placement="bottom" title="该配置有灰度配置,点击查看灰度的值"
                                      ng-click="namespace.displayControl.currentOperateBranch=namespace.branchName;namespace.branch.viewType='table'"></span>
                                <span class="label label-success" ng-if="config.isModified && !config.oldValue"
                                      data-tooltip="tooltip" data-placement="bottom" title="新增的配置"></span>
                                <span class="label label-info"
                                      ng-if="config.isModified && config.oldValue && !config.isDeleted"
                                      data-tooltip="tooltip" data-placement="bottom" title="修改的配置"></span>
                                <span class="label label-danger" ng-if="config.isDeleted"
                                      data-tooltip="tooltip" data-placement="bottom" title="删除的配置"></span>
lepdou committed
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402
                            </td>
                            <td width="30%" class="cursor-pointer" title="点击查看" ng-click="showText(config.item.value)">
                                <span ng-bind="config.item.value | limitTo: 250"></span>
                                <span ng-bind="config.item.value.length > 250 ? '...': ''"></span>
                            </td>
                            <td width="13%" title="{{config.item.comment}}">
                                <span ng-bind="config.item.comment | limitTo: 250"></span>
                                <span ng-bind="config.item.comment.length > 250 ?'...' : ''"></span>
                            </td>
                            <td width="10%" ng-bind="config.item.dataChangeLastModifiedBy">
                            </td>
                            <td width="16%"
                                ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'">
                            </td>

                            <td width="8%" class="text-center" ng-if="!config.isDeleted">
                                <img src="img/edit.png" data-tooltip="tooltip" data-placement="bottom" title="修改"
                                     ng-click="editItem(namespace, config.item)"
                                     ng-show="namespace.hasModifyPermission">
                                <img style="margin-left: 5px;" src="img/cancel.png"
                                     data-tooltip="tooltip" data-placement="bottom" title="删除"
                                     ng-click="preDeleteItem(namespace, config.item.id)"
                                     ng-show="namespace.hasModifyPermission">
                            </td>
                            <td width="6%" class="text-center" ng-if="config.isDeleted">
                            </td>

                        </tr>
                        </tbody>
                    </table>

                    <div class="text-center no-config-panel"
                         ng-if="!namespace.viewItems || !namespace.viewItems.length">
                        <h5>无覆盖的配置</h5>
                    </div>
403 404
                </div>

lepdou committed
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419
                <!--link namespace's public namespace-->
                <div ng-if="namespace.isLinkedNamespace">
                    <div class="panel panel-default" ng-if="namespace.publicNamespace">
                        <div class="panel-heading">
                            <div class="row">
                                <div class="padding-top-5 col-md-4 col-sm-4">
                                    公共的配置
                                    <a href="/config.html?#/appid={{namespace.publicNamespace.baseInfo.appId}}&env={{env}}&cluster={{namespace.publicNamespace.baseInfo.clusterName}}"
                                       target="_blank">
                                        <small>
                                            (AppId:{{namespace.publicNamespace.baseInfo.appId}},
                                            Cluster:{{namespace.publicNamespace.baseInfo.clusterName}})
                                        </small>
                                    </a>
                                </div>
420

lepdou committed
421 422 423 424 425
                                <div class="col-md-4 col-sm-4 text-center">
                                    <div class="btn-group btn-group-sm" role="group"
                                         ng-show="namespace.publicNamespace.isModified">
                                        <button type="button" class="btn btn-default"
                                                ng-class="{'active':namespace.publicNamespaceViewType == 'RELEASE'
426
                                        || !namespace.publicNamespaceViewType}"
lepdou committed
427 428 429 430 431 432 433 434 435
                                                ng-click="namespace.publicNamespaceViewType = 'RELEASE'">
                                            已发布的配置
                                        </button>
                                        <button type="button" class="btn btn-default"
                                                ng-class="{'active':namespace.publicNamespaceViewType == 'NOT_RELEASE'}"
                                                ng-click="namespace.publicNamespaceViewType = 'NOT_RELEASE'">
                                            未发布的配置
                                        </button>
                                    </div>
436
                                </div>
437

lepdou committed
438 439 440
                                <div class="col-md-4 col-sm-4">
                                    <input type="text" class="form-control pull-right" placeholder="filter by key ..."
                                           ng-class="{'search-onblur': namespace.publicNamespace.searchStatus == 'OFF'
441 442
                                   || !namespace.publicNamespace.searchStatus,
                                    'search-focus': namespace.publicNamespace.searchStatus == 'ON'}"
lepdou committed
443 444 445 446 447
                                           ng-model="namespace.publicNamespace.searchKey"
                                           ng-change="searchItems(namespace.publicNamespace)"
                                           ng-blur="namespace.publicNamespace.searchStatus='OFF'"
                                           ng-focus="namespace.publicNamespace.searchStatus='ON'"/>
                                </div>
448
                            </div>
449 450 451
                        </div>


lepdou committed
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531
                        <!--published items-->
                        <div ng-show="!namespace.publicNamespaceViewType || namespace.publicNamespaceViewType == 'RELEASE'">
                            <table class="table table-bordered table-striped table-hover"
                                   ng-show="namespace.publicNamespace.hasPublishedItem">
                                <thead>
                                <tr>
                                    <th class="hover" title="排序"
                                        ng-click="col='item.key';desc=!desc;">
                                        Key&nbsp;
                                        <span class="glyphicon glyphicon-sort"></span>

                                    </th>
                                    <th>
                                        Value
                                    </th>
                                    <th>
                                        备注
                                    </th>
                                    <th class="hover" title="排序"
                                        ng-click="col='item.dataChangeLastModifiedBy';desc=!desc;">
                                        最后修改人
                                        <span class="glyphicon glyphicon-sort"></span>

                                    </th>
                                    <th class="hover" title="排序"
                                        ng-click="col='item.dataChangeLastModifiedTime';desc=!desc;">
                                        最后修改时间
                                        <span class="glyphicon glyphicon-sort"></span>
                                    </th>

                                    <th>
                                        操作
                                    </th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr ng-repeat="config in namespace.publicNamespace.viewItems |orderBy:col:desc"
                                    ng-if="config.item.key && !config.isModified && !config.isDeleted">
                                    <td width="15%" class="cursor-pointer" title="点击查看"
                                        ng-click="showText(config.item.key)">
                                        <span ng-bind="config.item.key | limitTo: 250"></span>
                                        <span ng-bind="config.item.key.length > 250 ? '...' :''"></span>
                                    </td>
                                    <td width="35%" class="cursor-pointer" title="点击查看"
                                        ng-click="showText(config.item.value)">
                                        <span ng-bind="config.item.value | limitTo: 250"></span>
                                        <span ng-bind="config.item.value.length > 250 ? '...': ''"></span>
                                    </td>
                                    <td width="15%" title="{{config.item.comment}}">
                                        <span ng-bind="config.item.comment | limitTo: 250"></span>
                                        <span ng-bind="config.item.comment.length > 250 ?'...' : ''"></span>
                                    </td>
                                    <td width="10%" ng-bind="config.item.dataChangeLastModifiedBy">
                                    </td>
                                    <td width="15%"
                                        ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'">
                                    </td>

                                    <td width="10%" class="text-center" ng-if="!config.isDeleted">
                                        <img src="img/gray.png" data-tooltip="tooltip" data-placement="bottom"
                                             title="覆盖此配置"
                                             ng-click="editItem(namespace, config.item)"
                                             ng-show="namespace.hasModifyPermission && !config.covered">
                                    </td>
                                    <td width="6%" class="text-center" ng-if="config.isDeleted">
                                    </td>

                                </tr>
                                </tbody>
                            </table>

                            <div class="text-center no-config-panel"
                                 ng-if="namespace.publicNamespace.viewItems
                     && namespace.publicNamespace.viewItems.length
                     && !namespace.publicNamespace.hasPublishedItem">
                                <h5>无发布的配置</h5>
                            </div>
                        </div>

                        <!--not published items-->
532
                        <table class="table table-bordered table-striped table-hover"
lepdou committed
533
                               ng-show="namespace.publicNamespaceViewType == 'NOT_RELEASE'">
534 535 536 537 538 539 540 541 542
                            <thead>
                            <tr>
                                <th class="hover" title="排序"
                                    ng-click="col='item.key';desc=!desc;">
                                    Key&nbsp;
                                    <span class="glyphicon glyphicon-sort"></span>

                                </th>
                                <th>
lepdou committed
543
                                    已发布的值
544 545
                                </th>
                                <th>
lepdou committed
546
                                    未发布的值
547
                                </th>
lepdou committed
548 549
                                <th>
                                    备注
550 551 552 553 554 555 556 557 558 559 560 561 562 563
                                </th>
                                <th class="hover" title="排序"
                                    ng-click="col='item.dataChangeLastModifiedTime';desc=!desc;">
                                    最后修改时间
                                    <span class="glyphicon glyphicon-sort"></span>
                                </th>

                                <th>
                                    操作
                                </th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr ng-repeat="config in namespace.publicNamespace.viewItems |orderBy:col:desc"
lepdou committed
564 565
                                ng-if="config.item.key && (config.isModified || config.isDeleted)">
                                <td width="20%" class="cursor-pointer" title="点击查看"
lepdou committed
566
                                    ng-click="showText(config.item.key)">
567 568
                                    <span ng-bind="config.item.key | limitTo: 250"></span>
                                    <span ng-bind="config.item.key.length > 250 ? '...' :''"></span>
569 570 571 572 573 574 575
                                    <span class="label label-success" ng-if="config.isModified && !config.oldValue"
                                          data-tooltip="tooltip" data-placement="bottom" title="新增的配置"></span>
                                    <span class="label label-info"
                                          ng-if="config.isModified && config.oldValue && !config.isDeleted"
                                          data-tooltip="tooltip" data-placement="bottom" title="修改的配置"></span>
                                    <span class="label label-danger" ng-if="config.isDeleted"
                                          data-tooltip="tooltip" data-placement="bottom" title="删除的配置"></span>
lepdou committed
576 577 578 579 580
                                </td>
                                <td width="25%" class="cursor-pointer" title="点击查看"
                                    ng-click="showText(config.oldValue)">
                                    <span ng-bind="config.oldValue | limitTo: 250"></span>
                                    <span ng-bind="config.oldValue.length > 250 ? '...': ''"></span>
581
                                </td>
lepdou committed
582
                                <td width="25%" class="cursor-pointer" title="点击查看"
lepdou committed
583
                                    ng-click="showText(config.item.value)">
584 585 586
                                    <span ng-bind="config.item.value | limitTo: 250"></span>
                                    <span ng-bind="config.item.value.length > 250 ? '...': ''"></span>
                                </td>
lepdou committed
587
                                <td width="10%" title="{{config.item.comment}}">
588 589 590 591 592 593 594
                                    <span ng-bind="config.item.comment | limitTo: 250"></span>
                                    <span ng-bind="config.item.comment.length > 250 ?'...' : ''"></span>
                                </td>
                                <td width="15%"
                                    ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'">
                                </td>

lepdou committed
595 596
                                <td width="5%" class="text-center" ng-if="!config.isDeleted">
                                    <img src="img/gray.png" data-tooltip="tooltip" data-placement="bottom" title="覆盖此配置"
597 598 599 600 601 602 603 604
                                         ng-click="editItem(namespace, config.item)"
                                         ng-show="namespace.hasModifyPermission && !config.covered">
                                </td>

                            </tr>
                            </tbody>
                        </table>
                        <div class="text-center no-config-panel"
lepdou committed
605 606
                             ng-if="!namespace.publicNamespace.viewItems || !namespace.publicNamespace.viewItems.length">
                            <h5>无公共的配置</h5>
607 608
                        </div>
                    </div>
lepdou committed
609 610 611 612 613 614 615 616 617
                    <div class="panel panel-default" ng-if="!namespace.publicNamespace">
                        <div class="panel-heading">
                            公共的配置
                        </div>
                        <div class="panel-body text-center">
                            当前公共namespace的所有者
                            <a href="/config.html?#/appid={{namespace.parentAppId}}" target="_blank">{{namespace.parentAppId}}</a>
                            没有关联此namespace,请联系{{namespace.parentAppId}}的所有者在{{namespace.parentAppId}}项目里关联此namespace
                        </div>
618
                    </div>
619
                </div>
620

lepdou committed
621
            </div>
622

lepdou committed
623 624
            <!--text view-->
            <!--只读模式下的文本内容,不替换换行符-->
625 626 627 628 629 630
            <div ui-ace="aceConfig" readonly="true"
                 class="form-control no-radius"
                 rows="{{namespace.itemCnt < 10 ? 10: namespace.itemCnt>20 ? 20:namespace.itemCnt}}"
                 ng-show="namespace.viewType == 'text' && !namespace.isTextEditing"
                 ng-model="namespace.text">
            </div>
lepdou committed
631
            <!--编辑状态下的文本内容,会过滤掉换行符-->
632 633 634 635 636 637
            <div ui-ace="aceConfig"
                 class="form-control no-radius"
                 rows="{{namespace.itemCnt < 10 ? 10: namespace.itemCnt>20 ? 20:namespace.itemCnt}}"
                 ng-show="namespace.viewType == 'text' && namespace.isTextEditing"
                 ng-disabled="!namespace.isTextEditing" ng-model="namespace.editText">
            </div>
638

lepdou committed
639 640 641 642 643 644 645 646 647 648 649 650 651
            <!--history view-->
            <div class="J_historyview history-view" ng-show="namespace.viewType == 'history'">
                <div class="media"
                     ng-show="namespace.commits && namespace.commits.length"
                     ng-repeat="commits in namespace.commits">
                    <div class="media-body">
                        <div class="row">
                            <div class="col-md-6 col-sm-6"><h3 class="media-heading"
                                                               ng-bind="commits.dataChangeCreatedBy"></h3>
                            </div>
                            <div class="col-md-6 col-sm-6 text-right"><h5 class="media-heading"
                                                                          ng-bind="commits.dataChangeCreatedTime  | date: 'yyyy-MM-dd HH:mm:ss'"></h5>
                            </div>
652 653 654
                        </div>


lepdou committed
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678
                        <!--properties format-->
                        <table class="table table-bordered table-striped text-center table-hover"
                               style="margin-top: 5px;"
                               ng-if="namespace.isPropertiesFormat">
                            <thead>
                            <tr>
                                <th>
                                    Type
                                </th>
                                <th>
                                    Key
                                </th>
                                <th>
                                    Old Value
                                </th>
                                <th>
                                    New Value
                                </th>
                                <th>
                                    Comment
                                </th>
                            </tr>
                            </thead>
                            <tbody>
679

lepdou committed
680 681 682 683 684 685
                            <!--兼容老数据,不显示item类型为空行和注释的item-->
                            <tr ng-repeat="item in commits.changeSets.createItems" ng-show="item.key">
                                <td width="2%">
                                    新增
                                </td>
                                <td width="20%" title="{{item.key}}">
686

lepdou committed
687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746
                                    <span ng-bind="item.key | limitTo: 250"></span>
                                    <span ng-bind="item.key.length > 250 ? '...' :''"></span>
                                </td>
                                <td width="30%">
                                </td>
                                <td width="30%" class="cursor-pointer" title="{{item.value}}"
                                    ng-click="showText(item.value)">
                                    <span ng-bind="item.value | limitTo: 250"></span>
                                    <span ng-bind="item.value.length > 250 ? '...': ''"></span>
                                </td>
                                <td width="18%" title="{{item.comment}}">
                                    <span ng-bind="item.comment | limitTo: 250"></span>
                                    <span ng-bind="item.comment.length > 250 ?'...' : ''"></span>
                                </td>
                            </tr>
                            <tr ng-repeat="item in commits.changeSets.updateItems">
                                <td width="2%">
                                    更新
                                </td>
                                <td width="20%" title="{{item.newItem.key}}">
                                    <span ng-bind="item.newItem.key | limitTo: 250"></span>
                                    <span ng-bind="item.newItem.key.length > 250 ? '...' :''"></span>
                                </td>
                                <td width="30%" class="cursor-pointer" title="{{item.oldItem.value}}"
                                    ng-click="showText(item.oldItem.value)">
                                    <span ng-bind="item.oldItem.value | limitTo: 250"></span>
                                    <span ng-bind="item.oldItem.value.length > 250 ? '...': ''"></span>
                                </td>
                                <td width="30%" class="cursor-pointer" title="{{item.newItem.value}}"
                                    ng-click="showText(item.newItem.value)">
                                    <span ng-bind="item.newItem.value | limitTo: 250"></span>
                                    <span ng-bind="item.newItem.value.length > 250 ? '...': ''"></span>
                                </td>
                                <td width="18%" title="{{item.newItem.comment}}">
                                    <span ng-bind="item.newItem.comment | limitTo: 250"></span>
                                    <span ng-bind="item.newItem.comment.length > 250 ?'...' : ''"></span>
                                </td>
                            </tr>
                            <tr ng-repeat="item in commits.changeSets.deleteItems"
                                ng-show="item.key || item.comment">
                                <td width="2%">
                                    删除
                                </td>
                                <td width="20%" title="{{item.key}}">
                                    <span ng-bind="item.key | limitTo: 250"></span>
                                    <span ng-bind="item.key.length > 250 ? '...' :''"></span>
                                </td>
                                <td width="30%" title="{{item.value}}">
                                    <span ng-bind="item.value | limitTo: 250"></span>
                                    <span ng-bind="item.value.length > 250 ? '...': ''"></span>
                                </td>
                                <td width="30%">
                                </td>
                                <td width="18%" title="{{item.comment}}">
                                    <span ng-bind="item.comment | limitTo: 250"></span>
                                    <span ng-bind="item.comment.length > 250 ?'...' : ''"></span>
                                </td>
                            </tr>
                            </tbody>
                        </table>
747

lepdou committed
748 749 750
                        <!--not properties format-->
                        <div ng-if="!namespace.isPropertiesFormat">
                            <div ng-repeat="item in commits.changeSets.createItems">
751 752 753
                    <textarea class="form-control no-radius" rows="20"
                              ng-disabled="true" ng-bind="item.value">
                                </textarea>
lepdou committed
754
                            </div>
755

lepdou committed
756
                            <div ng-repeat="item in commits.changeSets.updateItems">
757 758 759
                    <textarea class="form-control no-radius" rows="20"
                              ng-disabled="true" ng-bind="item.newItem.value">
                                </textarea>
lepdou committed
760
                            </div>
761 762 763
                        </div>


lepdou committed
764 765 766 767 768 769 770 771 772 773
                    </div>
                    <hr>
                </div>
                <div class="text-center">
                    <button type="button" class="btn btn-default" ng-show="!namespace.hasLoadAllCommit"
                            ng-click="loadCommitHistory(namespace)">加载更多
                        <span class="glyphicon glyphicon-menu-down"></span></button>
                </div>
                <div class="empty-container text-center" ng-show="!namespace.commits || !namespace.commits.length">
                    无更改历史
774
                </div>
775
            </div>
lepdou committed
776 777 778 779
            <!--instance view-->
            <div class="panel panel-default instance-view" ng-show="namespace.viewType == 'instance'">
                <div class="panel-heading">
                    <div class="row">
780

lepdou committed
781 782 783 784 785 786 787 788 789 790 791 792 793
                        <div class="col-md-5 col-sm-5">
                            <small>实例说明:只展示最近一天访问过Apollo的实例</small>
                        </div>
                        <div class="col-md-7 col-sm-7 text-right">
                            <div class="btn-group btn-group-sm" role="group">
                                <button type="button" class="btn btn-default"
                                        ng-class="{'btn-primary':namespace.instanceViewType == 'latest_release'}"
                                        ng-click="switchInstanceViewType(namespace, 'latest_release')"> 使用最新配置的实例
                                    <span class="badge" ng-bind="namespace.latestReleaseInstances.total"></span>
                                </button>
                                <button type="button" class="btn btn-default"
                                        ng-class="{'btn-primary':namespace.instanceViewType == 'not_latest_release'}"
                                        ng-click="switchInstanceViewType(namespace, 'not_latest_release')">使用非最新配置的实例
794 795
                                    <span class="badge"
                                          ng-bind="namespace.instancesCount - namespace.latestReleaseInstances.total"></span>
lepdou committed
796 797 798 799 800 801 802 803 804 805 806
                                </button>
                                <button type="button" class="btn btn-default"
                                        ng-class="{'btn-primary':namespace.instanceViewType == 'all'}"
                                        ng-click="switchInstanceViewType(namespace, 'all')">所有实例
                                    <span class="badge" ng-bind="namespace.instancesCount"></span>
                                </button>
                            </div>
                            <button class="btn btn-default btn-sm"
                                    data-tooltip="tooltip" data-placement="bottom" title="刷新列表"
                                    ng-click="refreshInstancesInfo(namespace)">
                                <img src="../../img/refresh.png"/>
807 808 809
                            </button>
                        </div>

lepdou committed
810
                    </div>
811 812
                </div>

lepdou committed
813 814
                <!--latest release instances-->
                <div class="panel-body" ng-show="namespace.instanceViewType == 'latest_release'">
815

lepdou committed
816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847
                    <div class="panel-default" ng-if="namespace.latestReleaseInstances.total > 0">
                        <div class="panel-heading">
                            <a target="_blank" data-tooltip="tooltip" data-placement="bottom" title="查看配置"
                               href="/config/history.html?#/appid={{appId}}&env={{env}}&clusterName={{cluster}}&namespaceName={{namespace.baseInfo.namespaceName}}&releaseId={{namespace.latestRelease.id}}">
                                {{namespace.latestRelease.name}}
                            </a>
                        </div>
                        <table class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <td>App ID</td>
                                <td>Cluster Name</td>
                                <td>Data Center</td>
                                <td>IP</td>
                                <td>配置获取时间</td>
                            </tr>
                            </thead>
                            <tbody>
                            <tr ng-repeat="instance in namespace.latestReleaseInstances.content">
                                <td width="20%" ng-bind="instance.appId"></td>
                                <td width="20%" ng-bind="instance.clusterName"></td>
                                <td width="20%" ng-bind="instance.dataCenter"></td>
                                <td width="20%" ng-bind="instance.ip"></td>
                                <td width="20%">{{instance.configs && instance.configs.length ?
                                    (instance.configs[0].releaseDeliveryTime | date: 'yyyy-MM-dd HH:mm:ss') : ''}}
                                </td>
                            </tr>
                            </tbody>
                        </table>
                        <div class="row text-center"
                             ng-show="namespace.latestReleaseInstances.content.length < namespace.latestReleaseInstances.total">
                            <button class="btn btn-default" ng-click="loadInstanceInfo(namespace)">加载更多</button>
848

lepdou committed
849
                        </div>
850 851
                    </div>

lepdou committed
852 853 854
                    <div class="text-center" ng-if="namespace.latestReleaseInstances.total == 0">
                        无实例信息
                    </div>
855 856
                </div>

lepdou committed
857 858 859 860 861 862 863 864 865 866
                <!--not latest release instances-->
                <div class="panel-body" ng-show="namespace.instanceViewType == 'not_latest_release'">
                    <div class="panel-default"
                         ng-if="namespace.instancesCount - namespace.latestReleaseInstances.total > 0"
                         ng-repeat="release in namespace.notLatestReleases">
                        <div class="panel-heading">
                            <a target="_blank" data-tooltip="tooltip" data-placement="bottom" title="查看配置"
                               href="/config/history.html?#/appid={{appId}}&env={{env}}&clusterName={{cluster}}&namespaceName={{namespace.baseInfo.namespaceName}}&releaseId={{release.id}}">
                                {{release.name}}
                            </a>
867

lepdou committed
868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894
                        </div>
                        <table class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <td>App ID</td>
                                <td>Cluster Name</td>
                                <td>Data Center</td>
                                <td>IP</td>
                                <td>配置获取时间</td>
                            </tr>
                            </thead>
                            <tbody>
                            <tr ng-repeat="instance in namespace.notLatestReleaseInstances[release.id]">
                                <td width="20%" ng-bind="instance.appId"></td>
                                <td width="20%" ng-bind="instance.clusterName"></td>
                                <td width="20%" ng-bind="instance.dataCenter"></td>
                                <td width="20%" ng-bind="instance.ip"></td>
                                <td width="20%">{{instance.configs && instance.configs.length ?
                                    (instance.configs[0].releaseDeliveryTime | date: 'yyyy-MM-dd HH:mm:ss') : ''}}
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="text-center"
                         ng-if="namespace.instancesCount - namespace.latestReleaseInstances.total == 0">
                        无实例信息
895 896 897
                    </div>
                </div>

lepdou committed
898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924
                <!--all instances-->
                <div class="panel-body" ng-show="namespace.instanceViewType == 'all'">
                    <div class="panel-default" ng-if="namespace.instancesCount > 0">
                        <table class="table table-bordered table-striped" ng-if="namespace.allInstances">
                            <thead>
                            <tr>
                                <td>App ID</td>
                                <td>Cluster Name</td>
                                <td>Data Center</td>
                                <td>IP</td>
                            </tr>
                            </thead>
                            <tbody>
                            <tr ng-repeat="instance in namespace.allInstances">
                                <td width="25%" ng-bind="instance.appId"></td>
                                <td width="25%" ng-bind="instance.clusterName"></td>
                                <td width="25%" ng-bind="instance.dataCenter"></td>
                                <td width="25%" ng-bind="instance.ip"></td>
                            </tr>
                            </tbody>
                        </table>
                        <div class="row text-center" ng-show="namespace.allInstances.length < namespace.instancesCount">
                            <button class="btn btn-default" ng-click="loadInstanceInfo(namespace)">加载更多</button>
                        </div>
                    </div>
                    <div class="text-center" ng-if="namespace.instancesCount == 0">
                        无实例信息
925 926 927
                    </div>
                </div>
            </div>
lepdou committed
928 929
        </section>
    </div>
lepdou committed
930

931
</section>