Commit c8ed6bd6 by lepdou

UI handle public namespace not exist situation

parent 7e4f6bcc
...@@ -222,7 +222,7 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na ...@@ -222,7 +222,7 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
} }
function initLinkedNamespace(namespace) { function initLinkedNamespace(namespace) {
if (!namespace.isPublic || !namespace.isLinkedNamespace) { if (!namespace.isPublic || !namespace.isLinkedNamespace || namespace.format != 'properties') {
return; return;
} }
//load public namespace //load public namespace
...@@ -237,12 +237,11 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na ...@@ -237,12 +237,11 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
linkNamespaceItemKeys.push(key); linkNamespaceItemKeys.push(key);
}); });
publicNamespace.viewItems = []; publicNamespace.viewItems = [];
publicNamespace.items.forEach(function (item) { publicNamespace.items.forEach(function (item) {
var key = item.item.key; var key = item.item.key;
if (key){ if (key) {
publicNamespace.viewItems.push(item); publicNamespace.viewItems.push(item);
} }
...@@ -250,7 +249,7 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na ...@@ -250,7 +249,7 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
if (item.isModified || item.isDeleted) { if (item.isModified || item.isDeleted) {
publicNamespace.isModified = true; publicNamespace.isModified = true;
} else if (key){ } else if (key) {
publicNamespace.hasPublishedItem = true; publicNamespace.hasPublishedItem = true;
} }
}); });
......
...@@ -373,53 +373,129 @@ ...@@ -373,53 +373,129 @@
</div> </div>
<!--link namespace's public namespace--> <!--link namespace's public namespace-->
<div class="panel panel-default" ng-if="namespace.isLinkedNamespace"> <div ng-if="namespace.isLinkedNamespace">
<div class="panel-heading"> <div class="panel panel-default" ng-if="namespace.publicNamespace">
<div class="row"> <div class="panel-heading">
<div class="padding-top-5 col-md-4"> <div class="row">
公共的配置 <div class="padding-top-5 col-md-4">
<a href="/config.html?#/appid={{namespace.publicNamespace.baseInfo.appId}}" target="_blank"> 公共的配置
<small> <a href="/config.html?#/appid={{namespace.publicNamespace.baseInfo.appId}}" target="_blank">
(AppId:{{namespace.publicNamespace.baseInfo.appId}}, <small>
Cluster:{{namespace.publicNamespace.baseInfo.clusterName}}) (AppId:{{namespace.publicNamespace.baseInfo.appId}},
</small> Cluster:{{namespace.publicNamespace.baseInfo.clusterName}})
</a> </small>
</div> </a>
</div>
<div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<div class="btn-group btn-group-sm" role="group" ng-show="namespace.publicNamespace.isModified"> <div class="btn-group btn-group-sm" role="group" ng-show="namespace.publicNamespace.isModified">
<button type="button" class="btn btn-default" <button type="button" class="btn btn-default"
ng-class="{'active':namespace.publicNamespaceViewType == 'RELEASE' ng-class="{'active':namespace.publicNamespaceViewType == 'RELEASE'
|| !namespace.publicNamespaceViewType}" || !namespace.publicNamespaceViewType}"
ng-click="namespace.publicNamespaceViewType = 'RELEASE'"> ng-click="namespace.publicNamespaceViewType = 'RELEASE'">
已发布的配置 已发布的配置
</button> </button>
<button type="button" class="btn btn-default" <button type="button" class="btn btn-default"
ng-class="{'active':namespace.publicNamespaceViewType == 'NOT_RELEASE'}" ng-class="{'active':namespace.publicNamespaceViewType == 'NOT_RELEASE'}"
ng-click="namespace.publicNamespaceViewType = 'NOT_RELEASE'"> ng-click="namespace.publicNamespaceViewType = 'NOT_RELEASE'">
未发布的配置 未发布的配置
</button> </button>
</div>
</div> </div>
</div>
<div class="col-md-2 col-lg-offset-2 text-right"> <div class="col-md-2 col-lg-offset-2 text-right">
<input type="text" class="form-control" placeholder="filter by key ..." <input type="text" class="form-control" placeholder="filter by key ..."
ng-class="{'search-onblur': namespace.publicNamespace.searchStatus == 'OFF' ng-class="{'search-onblur': namespace.publicNamespace.searchStatus == 'OFF'
|| !namespace.publicNamespace.searchStatus, || !namespace.publicNamespace.searchStatus,
'search-focus': namespace.publicNamespace.searchStatus == 'ON'}" 'search-focus': namespace.publicNamespace.searchStatus == 'ON'}"
ng-model="namespace.publicNamespace.searchKey" ng-model="namespace.publicNamespace.searchKey"
ng-change="searchItems(namespace.publicNamespace)" ng-change="searchItems(namespace.publicNamespace)"
ng-blur="namespace.publicNamespace.searchStatus='OFF'" ng-blur="namespace.publicNamespace.searchStatus='OFF'"
ng-focus="namespace.publicNamespace.searchStatus='ON'"/> ng-focus="namespace.publicNamespace.searchStatus='ON'"/>
</div>
</div> </div>
</div> </div>
</div>
<!--published items--> <!--published items-->
<div ng-show="!namespace.publicNamespaceViewType || namespace.publicNamespaceViewType == 'RELEASE'"> <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-->
<table class="table table-bordered table-striped table-hover" <table class="table table-bordered table-striped table-hover"
ng-show="namespace.publicNamespace.hasPublishedItem"> ng-show="namespace.publicNamespaceViewType == 'NOT_RELEASE'">
<thead> <thead>
<tr> <tr>
<th class="hover" title="排序" <th class="hover" title="排序"
...@@ -429,16 +505,13 @@ ...@@ -429,16 +505,13 @@
</th> </th>
<th> <th>
Value Old Value
</th> </th>
<th> <th>
备注 New Value
</th> </th>
<th class="hover" title="排序" <th>
ng-click="col='item.dataChangeLastModifiedBy';desc=!desc;"> 备注
最后修改人
<span class="glyphicon glyphicon-sort"></span>
</th> </th>
<th class="hover" title="排序" <th class="hover" title="排序"
ng-click="col='item.dataChangeLastModifiedTime';desc=!desc;"> ng-click="col='item.dataChangeLastModifiedTime';desc=!desc;">
...@@ -453,120 +526,60 @@ ...@@ -453,120 +526,60 @@
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="config in namespace.publicNamespace.viewItems |orderBy:col:desc" <tr ng-repeat="config in namespace.publicNamespace.viewItems |orderBy:col:desc"
ng-if="config.item.key && !config.isModified && !config.isDeleted"> ng-if="config.item.key && (config.isModified || config.isDeleted)">
<td width="15%" class="cursor-pointer" title="点击查看" ng-click="showText(config.item.key)"> <td width="20%" 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 | limitTo: 250"></span>
<span ng-bind="config.item.key.length > 250 ? '...' :''"></span> <span ng-bind="config.item.key.length > 250 ? '...' :''"></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>
</td> </td>
<td width="35%" class="cursor-pointer" title="点击查看" ng-click="showText(config.item.value)"> <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>
</td>
<td width="25%" 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 | limitTo: 250"></span>
<span ng-bind="config.item.value.length > 250 ? '...': ''"></span> <span ng-bind="config.item.value.length > 250 ? '...': ''"></span>
</td> </td>
<td width="15%" title="{{config.item.comment}}"> <td width="10%" title="{{config.item.comment}}">
<span ng-bind="config.item.comment | limitTo: 250"></span> <span ng-bind="config.item.comment | limitTo: 250"></span>
<span ng-bind="config.item.comment.length > 250 ?'...' : ''"></span> <span ng-bind="config.item.comment.length > 250 ?'...' : ''"></span>
</td> </td>
<td width="10%" ng-bind="config.item.dataChangeLastModifiedBy">
</td>
<td width="15%" <td width="15%"
ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"> ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'">
</td> </td>
<td width="10%" class="text-center" ng-if="!config.isDeleted"> <td width="5%" class="text-center" ng-if="!config.isDeleted">
<img src="img/gray.png" data-tooltip="tooltip" data-placement="bottom" title="覆盖此配置" <img src="img/gray.png" data-tooltip="tooltip" data-placement="bottom" title="覆盖此配置"
ng-click="editItem(namespace, config.item)" ng-click="editItem(namespace, config.item)"
ng-show="namespace.hasModifyPermission && !config.covered"> ng-show="namespace.hasModifyPermission && !config.covered">
</td> </td>
<td width="6%" class="text-center" ng-if="config.isDeleted">
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="text-center no-config-panel" <div class="text-center no-config-panel"
ng-if="namespace.publicNamespace.viewItems ng-if="!namespace.publicNamespace.viewItems || !namespace.publicNamespace.viewItems.length">
&& namespace.publicNamespace.viewItems.length <h5>无公共的配置</h5>
&& !namespace.publicNamespace.hasPublishedItem">
<h5>无发布的配置</h5>
</div> </div>
</div> </div>
<div class="panel panel-default" ng-if="!namespace.publicNamespace">
<!--not published items--> <div class="panel-heading">
<table class="table table-bordered table-striped table-hover" 公共的配置
ng-show="namespace.publicNamespaceViewType == 'NOT_RELEASE'"> </div>
<thead> <div class="panel-body text-center">
<tr> 当前公共namespace的所有者
<th class="hover" title="排序" <a href="/config.html?#/appid={{namespace.parentAppId}}" target="_blank">{{namespace.parentAppId}}</a>
ng-click="col='item.key';desc=!desc;"> 没有关联此namespace,请联系{{namespace.parentAppId}}的所有者在{{namespace.parentAppId}}项目里关联此namespace
Key&nbsp; </div>
<span class="glyphicon glyphicon-sort"></span>
</th>
<th>
Old Value
</th>
<th>
New Value
</th>
<th>
备注
</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="20%" 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>
<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>
</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>
</td>
<td width="25%" 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="10%" 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="15%"
ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'">
</td>
<td width="5%" 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>
</tr>
</tbody>
</table>
<div class="text-center no-config-panel"
ng-if="!namespace.publicNamespace.viewItems || !namespace.publicNamespace.viewItems.length">
<h5>无公共的配置</h5>
</div> </div>
</div> </div>
</div> </div>
<!--text view--> <!--text view-->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment