namespace-panel.html 16.0 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">有修改
L
lepdou 已提交
19
                                <span class="badge label" 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
                   ng-click="goToSyncPage(namespace)"
                   ng-show="namespace.hasModifyPermission && namespace.isPropertiesFormat">
                    <img src="img/sync.png">
                    同步配置
                </a>
            </div>
        </div>
    </header>
L
lepdou 已提交
63 64
    <!--f1f2f7-->

L
lepdou 已提交
65

L
lepdou 已提交
66
    <header class="panel-heading second-panel-heading">
L
lepdou 已提交
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 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
        <div class="row">
            <div class="col-md-5 pull-left">
                <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>
                </ul>
            </div>
            <div class="col-md-7 text-right">
                <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-->
    <!--只读模式下的文本内容,不替换换行符-->
123
                            <textarea class="form-control no-radius" rows="{{namespace.itemCnt}}"
L
lepdou 已提交
124 125 126 127 128 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
                                      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}"
164
                ng-if="config.item.key && !config.isDeleted">
L
lepdou 已提交
165 166 167 168 169 170 171 172 173 174 175 176
                <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 已提交
177
                <td width="10%" ng-bind="config.item.dataChangeLastModifiedBy">
L
lepdou 已提交
178 179
                </td>
                <td width="15%"
L
lepdou 已提交
180
                    ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'">
L
lepdou 已提交
181 182 183 184 185 186 187 188 189 190 191 192 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 228 229 230 231 232 233 234
                </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>

    <!--历史修改视图-->
    <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>

235 236
                    <!--兼容老数据,不显示item类型为空行和注释的item-->
                    <tr ng-repeat="item in commits.changeSets.createItems" ng-show="item.key">
L
lepdou 已提交
237 238 239 240 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
                        <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>
</div>