Commit 7fc51e61 by lepdou

文本view

parent 761dd307
...@@ -32,18 +32,60 @@ application_module.controller("AppConfigController", ...@@ -32,18 +32,60 @@ application_module.controller("AppConfigController",
levels: 99 levels: 99
}); });
}, function (result) { }, function (result) {
toastr.error("加载导航出错"); toastr.error("加载导航出错:" + result);
}); });
/////////// ///////////
$scope.env = 'LOCAL'; $scope.env = 'LOCAL';
$scope.clusterName = 'default'; $scope.clusterName = 'default';
ConfigService.load_all_namespaces($scope.appId, $scope.env, $scope.clusterName).then( ConfigService.load_all_namespaces($scope.appId, $scope.env, $scope.clusterName).then(
function (result) { function (result) {
$scope.namespaces = result; $scope.namespaces = result;
//初始化视图
if($scope.namespaces){
$scope.namespaces.forEach(function(item){
item.viewType = 'table';
})
}
}, function (result) { }, function (result) {
toastr.error("加载配置信息出错"); toastr.error("加载配置信息出错:" + result);
}); });
/////////
$scope.queryOldValue = function (key, oldValue) {
$scope.queryKey = key;
if (oldValue == '') {
$scope.OldValue = key + "是新添加的key";
} else {
$scope.OldValue = oldValue;
}
};
$scope.switchView = function(namespace, viewType){
if('textarea' == viewType){
namespace.text = parseTableModel2Text(namespace);
}
namespace.viewType = viewType;
};
function parseTableModel2Text(namespace){
if(!namespace.items){
return "无配置信息";
}
var result = "";
namespace.items.forEach(function(item){
if(item.modified){
result += "**";
}
result += item.item.key + ":" + item.item.value + " ##" + item.item.comment + "\n";
});
return result;
}
}]); }]);
...@@ -64,13 +64,16 @@ ...@@ -64,13 +64,16 @@
</div> </div>
<div class="btn-group" role="group" aria-label="..."> <div class="btn-group" role="group" aria-label="...">
<button type="button" <button type="button"
class="btn btn-default btn-sm J_tableview_btn">文本 class="btn btn-default btn-sm J_tableview_btn"
ng-click="switchView(namespace, 'textarea')">文本
</button> </button>
<button type="button" <button type="button"
class="btn btn-default btn-sm J_tableview_btn">表格 class="btn btn-default btn-sm J_tableview_btn"
ng-click="switchView(namespace, 'table')">表格
</button> </button>
<button type="button" <button type="button"
class="btn btn-default btn-sm J_historyview_btn"> class="btn btn-default btn-sm J_historyview_btn"
ng-click="switchView(namespace, 'history')">
更改日志 更改日志
</button> </button>
</div> </div>
...@@ -86,8 +89,13 @@ ...@@ -86,8 +89,13 @@
</div> </div>
</header> </header>
<div ng-show="namespace.viewType == 'textarea'">
<textarea class="form-control" rows="20">
{{namespace.text}}
</textarea>
</div>
<table class="table table-bordered text-center table-hover"> <table class="table table-bordered text-center table-hover" ng-show="namespace.viewType == 'table'">
<thead> <thead>
<tr> <tr>
<th> <th>
...@@ -114,6 +122,11 @@ ...@@ -114,6 +122,11 @@
{{config.item.key}} {{config.item.key}}
</td> </td>
<td> <td>
<button data-placement="top" title="查看旧值"
class="glyphicon glyphicon-eye-open"
aria-hidden="true" data-toggle="modal" data-target="#oldValue"
ng-show="config.modified"
ng-click="queryOldValue(config.item.key, config.oldValue)"></button>
{{config.item.value}} {{config.item.value}}
</td> </td>
<td> <td>
...@@ -129,8 +142,10 @@ ...@@ -129,8 +142,10 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<!--历史修改视图--> <!--历史修改视图-->
<div class="J_historyview Hide historyview"> <div class="J_historyview historyview" ng-show="namespace.viewType == 'history'">
<div class="row"> <div class="row">
<div class="col-md-11 col-md-offset-1 list" style=""> <div class="col-md-11 col-md-offset-1 list" style="">
<div class="media"> <div class="media">
...@@ -180,12 +195,33 @@ ...@@ -180,12 +195,33 @@
</div> </div>
</div> </div>
<!-- Modal -->
<div class="modal fade " id="oldValue" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header panel-primary">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">旧值</h4>
</div>
<div class="modal-body">
{{OldValue}}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
<div ng-include="'../common/footer.html'"></div> <div ng-include="'../common/footer.html'"></div>
<!-- jquery.js --> <!-- jquery.js -->
<script src="../../vendor/jquery.js" type="text/javascript"></script> <script src="../../vendor/jquery.js" type="text/javascript"></script>
...@@ -217,5 +253,11 @@ ...@@ -217,5 +253,11 @@
<!--controller--> <!--controller-->
<script type="application/javascript" src="../../scripts/controller/app/AppConfigController.js"></script> <script type="application/javascript" src="../../scripts/controller/app/AppConfigController.js"></script>
<script type="application/javascript">
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
</body> </body>
</html> </html>
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