namespace-panel.html 23.3 KB
Newer Older
L
lepdou 已提交
1 2
<div class="panel" style="border-top: 0px;">
    <div class="row namespace-attribute-panel" ng-if="namespace.isPublic">
L
update  
lepdou 已提交
3 4 5 6 7
        <div class="text-center namespace-attribute-public">
            <span data-tooltip="tooltip" data-placement="bottom" title="公共的Namespace"
                  ng-show="namespace.parentAppId == namespace.baseInfo.appId">公共</span>
            <span data-tooltip="tooltip" data-placement="bottom" title="点击跳转到公共的Namespace"
                  ng-show="namespace.parentAppId != namespace.baseInfo.appId"
L
lepdou 已提交
8
                  ng-click="goToParentAppConfigPage(namespace)">关联</span>
L
lepdou 已提交
9 10
        </div>
    </div>
L
lepdou 已提交
11 12
    <header class="panel-heading">
        <div class="row">
L
lepdou 已提交
13

J
Jason Song 已提交
14
            <div class="col-md-6 header-namespace">
L
lepdou 已提交
15 16
                <b ng-bind="namespace.viewName" style="font-size: 20px;" data-tooltip="tooltip" data-placement="bottom"
                   title="{{namespace.comment}}"></b>
L
lepdou 已提交
17 18
                <span class="label label-info no-radius" ng-bind="namespace.format"></span>
                                <span class="label label-primary no-radius" ng-show="namespace.itemModifiedCnt > 0">有修改
Z
zhangle 已提交
19
                                <span class="badge label badge-white" ng-bind="namespace.itemModifiedCnt"></span></span>
L
lepdou 已提交
20 21
                <span class="label label-warning no-radius"
                      ng-show="namespace.lockOwner">当前修改者:{{namespace.lockOwner}}</span>
L
lepdou 已提交
22
            </div>
J
Jason Song 已提交
23
            <div class="col-md-6 text-right header-buttons">
L
lepdou 已提交
24 25
                <button type="button" class="btn btn-success btn-sm J_tableview_btn"
                        data-tooltip="tooltip" data-placement="bottom" title="发布配置"
L
lepdou 已提交
26 27 28 29 30 31 32
                        ng-show="namespace.hasReleasePermission || namespace.hasModifyPermission"
                        ng-disabled="namespace.isTextEditing"
                        ng-click="preReleaseNs(namespace)">
                    <img src="img/release.png">
                    发布

                </button>
L
lepdou 已提交
33 34
                <button type="button" class="btn btn-default btn-sm J_tableview_btn"
                        data-tooltip="tooltip" data-placement="bottom" title="回滚配置"
L
lepdou 已提交
35
                        ng-show="namespace.hasReleasePermission"
L
lepdou 已提交
36
                        ng-click="preRollback(namespace)">
L
lepdou 已提交
37 38 39
                    <img src="img/rollback.png">
                    回滚
                </button>
L
lepdou 已提交
40
                <a type="button" class="btn btn-default btn-sm J_tableview_btn"
L
lepdou 已提交
41
                   data-tooltip="tooltip" data-placement="bottom" title="查看发布历史"
L
lepdou 已提交
42
                   href="/config/history.html?#/appid={{appId}}&env={{env}}&clusterName={{cluster}}&namespaceName={{namespace.baseInfo.namespaceName}}">
L
lepdou 已提交
43 44
                    <img src="img/release-history.png">
                    发布历史
L
lepdou 已提交
45
                </a>
L
lepdou 已提交
46
                <a type="button" class="btn btn-default btn-sm J_tableview_btn"
L
lepdou 已提交
47
                   data-tooltip="tooltip" data-placement="bottom" title="配置修改、发布权限"
L
lepdou 已提交
48
                   href="/namespace/role.html?#/appid={{appId}}&namespaceName={{namespace.baseInfo.namespaceName}}"
L
lepdou 已提交
49 50 51 52 53
                   ng-show="hasAssignUserPermission">
                    <img src="img/assign.png">
                    授权
                </a>
                <a type="button" class="btn btn-default btn-sm J_tableview_btn"
L
lepdou 已提交
54
                   data-tooltip="tooltip" data-placement="bottom" title="同步各环境间配置"
L
lepdou 已提交
55 56 57 58 59 60 61 62 63
                   ng-click="goToSyncPage(namespace)"
                   ng-show="namespace.hasModifyPermission && namespace.isPropertiesFormat">
                    <img src="img/sync.png">
                    同步配置
                </a>
            </div>
        </div>
    </header>

L
lepdou 已提交
64
    <header class="panel-heading second-panel-heading">
L
lepdou 已提交
65
        <div class="row">
Z
update  
zhangle 已提交
66
            <div class="col-md-8 pull-left">
L
lepdou 已提交
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
                <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>
Z
zhangle 已提交
87 88 89 90 91 92 93
                    <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>
L
lepdou 已提交
94 95
                </ul>
            </div>
Z
update  
zhangle 已提交
96
            <div class="col-md-4 text-right">
L
lepdou 已提交
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
                <a data-tooltip="tooltip" data-placement="bottom" title="取消修改"
                   ng-show="namespace.isTextEditing && namespace.viewType == 'text'"
                   ng-click="toggleTextEditStatus(namespace)">
                    <img src="img/cancel.png" class="ns_btn">
                </a>
                <a data-tooltip="tooltip" data-placement="bottom" title="修改配置"
                   ng-show="!namespace.isTextEditing && namespace.viewType == 'text' && namespace.hasModifyPermission"
                   ng-click="toggleTextEditStatus(namespace)">
                    <img src="img/edit.png" class="ns_btn">
                </a>

                &nbsp;
                <a data-tooltip="tooltip" data-placement="bottom" title="提交修改"
                   data-toggle="modal" data-target="#commitModal"
                   ng-show="namespace.isTextEditing && namespace.viewType == 'text'"
                   ng-click="modifyByText(namespace)">
                    <img src="img/submit.png" class="ns_btn">
                </a>

                <button type="button" class="btn btn-primary btn-sm"
                        ng-show="namespace.viewType == 'table' && namespace.hasModifyPermission"
                        ng-click="createItem(namespace)">
                    <img src="img/plus.png">
                    新增配置
                </button>

            </div>
        </div>
    </header>
    <!--text view-->
    <!--只读模式下的文本内容,不替换换行符-->
128
                            <textarea class="form-control no-radius" rows="{{namespace.itemCnt}}"
L
lepdou 已提交
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
                                      ng-show="namespace.viewType == 'text' && !namespace.isTextEditing"
                                      ng-disabled="!namespace.isTextEditing" ng-model="namespace.text"
                                      ng-bind="namespace.text">
                                </textarea>
    <!--编辑状态下的文本内容,会过滤掉换行符-->
                            <textarea class="form-control" rows="{{namespace.itemCnt}}" style="border-radius: 0px"
                                      ng-show="namespace.viewType == 'text' && namespace.isTextEditing"
                                      ng-disabled="!namespace.isTextEditing" ng-model="namespace.editText"
                                      ng-bind="namespace.editText">
                                </textarea>

    <!--table view-->
    <div class="namespace-view-table">
        <table class="table table-bordered table-striped text-center table-hover"
               ng-show="namespace.viewType == 'table' && namespace.items.length > 0">
            <thead>
            <tr>
                <th>
                    Key
                </th>
                <th>
                    Value
                </th>
                <th>
                    备注
                </th>
                <th>
                    最后修改人
                </th>
                <th>
                    最后修改时间
                </th>
                <th>
                    操作
                </th>
            </tr>
            </thead>
            <tbody>

            <tr ng-repeat="config in namespace.items" ng-class="{warning:config.isModified}"
169
                ng-if="config.item.key && !config.isDeleted">
L
lepdou 已提交
170 171 172 173 174 175 176 177 178 179 180 181
                <td width="20%" title="{{config.item.key}}">
                    <span ng-bind="config.item.key | limitTo: 250"></span>
                    <span ng-bind="config.item.key.length > 250 ? '...' :''"></span>
                </td>
                <td width="25%" title="{{config.item.value}}">
                    <span ng-bind="config.item.value | limitTo: 250"></span>
                    <span ng-bind="config.item.value.length > 250 ? '...': ''"></span>
                </td>
                <td width="20%" title="{{config.item.comment}}">
                    <span ng-bind="config.item.comment | limitTo: 250"></span>
                    <span ng-bind="config.item.comment.length > 250 ?'...' : ''"></span>
                </td>
L
lepdou 已提交
182
                <td width="10%" ng-bind="config.item.dataChangeLastModifiedBy">
L
lepdou 已提交
183 184
                </td>
                <td width="15%"
L
lepdou 已提交
185
                    ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'">
L
lepdou 已提交
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
                </td>

                <td width="10%">
                    <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>

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

Z
zhangle 已提交
203
    <!--history view-->
L
lepdou 已提交
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
    <div class="J_historyview history-view" ng-show="namespace.viewType == 'history'">
        <div class="media" ng-repeat="commits in namespace.commits">
            <div class="media-body">
                <div class="row">
                    <div class="col-md-6"><h3 class="media-heading" ng-bind="commits.dataChangeCreatedBy"></h3></div>
                    <div class="col-md-6 text-right"><h5 class="media-heading"
                                                         ng-bind="commits.dataChangeCreatedTime  | date: 'yyyy-MM-dd HH:mm:ss'"></h5>
                    </div>
                </div>


                <!--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>

239 240
                    <!--兼容老数据,不显示item类型为空行和注释的item-->
                    <tr ng-repeat="item in commits.changeSets.createItems" ng-show="item.key">
L
lepdou 已提交
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 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 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328
                        <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%">
                        </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="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%" title="{{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%" title="{{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>

                <!--not properties format-->
                <div ng-if="!namespace.isPropertiesFormat">
                    <div ng-repeat="item in commits.changeSets.createItems">
                    <textarea class="form-control" rows="20" style="border-radius: 0px"
                              ng-disabled="true" ng-bind="item.value">
                                </textarea>
                    </div>

                    <div ng-repeat="item in commits.changeSets.updateItems">
                    <textarea class="form-control" rows="20" style="border-radius: 0px"
                              ng-disabled="true" ng-bind="item.newItem.value">
                                </textarea>
                    </div>
                </div>


            </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>
Z
zhangle 已提交
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 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 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466

    <!--instance view-->
    <div class="panel panel-default instance-view" ng-show="namespace.viewType == 'instance'">
        <div class="panel-heading">
            <div class="row text-right" style="padding-right: 15px;">

                <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')">使用非最新配置的实例
                        <span class="badge"
                              ng-bind="namespace.instancesCount - namespace.latestReleaseInstances.total"></span>
                    </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"/>
                </button>
            </div>
        </div>

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

            <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}}&scrollTo={{namespace.latestRelease.name}}">
                        {{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>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="instance in namespace.latestReleaseInstances.content">
                        <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.latestReleaseInstances.content.length < namespace.latestReleaseInstances.total">
                    <button class="btn btn-default" ng-click="loadInstanceInfo(namespace)">加载更多</button>

                </div>
            </div>

            <div class="text-center" ng-if="namespace.latestReleaseInstances.total == 0">
                无实例信息
            </div>
        </div>

        <!--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="releaseName in namespace.notLatestReleaseNames">
                <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}}&scrollTo={{releaseName}}">
                        {{releaseName}}
                    </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>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="instance in namespace.notLatestReleaseInstances[releaseName]">
                        <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>
            <div class="text-center" ng-if="namespace.instancesCount - namespace.latestReleaseInstances.total == 0">
                无实例信息
            </div>
        </div>

         <!--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">
                无实例信息
            </div>
        </div>



    </div>
L
lepdou 已提交
467
</div>