diff --git a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemController.java b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemController.java index 7e22a1cebfaf7f4dc082e74c0966552eeeb0381e..1d2adaaf78bb4f905160a5fed0add49e2db473e0 100644 --- a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemController.java +++ b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemController.java @@ -36,7 +36,14 @@ public class ItemController { BeanUtils.copyEntityProperties(entity, managedEntity); entity = itemService.update(managedEntity); } else { + Item lastItem = itemService.findLastOne(appId, clusterName, namespaceName); + int lineNum = 1; + if (lastItem != null){ + lineNum = lastItem.getLineNum() + 1; + } + entity.setLineNum(lineNum); entity.setDataChangeCreatedBy(user.getUsername()); + entity.setDataChangeLastModifiedBy(user.getUsername()); entity = itemService.save(entity); } diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ItemRepository.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ItemRepository.java index 3c67d3f99f63a00aba28d23b60d1fac52a9170f5..3257149dad87d2ec659591c7c61710d6a554e0fc 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ItemRepository.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ItemRepository.java @@ -12,4 +12,5 @@ public interface ItemRepository extends PagingAndSortingRepository { List findByNamespaceIdOrderByLineNumAsc(Long namespaceId); + Item findFirst1ByNamespaceIdOrderByLineNumDesc(Long namespaceId); } diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemService.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemService.java index 9f6aa87441e41903288b90bb0770fa308a1d7393..e00656d3f32d8d23a81d490f95310dc997cff63f 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemService.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemService.java @@ -45,6 +45,17 @@ public class ItemService { return item; } + public Item findLastOne(String appId, String clusterName, String namespaceName) { + Namespace namespace = namespaceRepository.findByAppIdAndClusterNameAndNamespaceName(appId, + clusterName, namespaceName); + if (namespace == null) { + throw new NotFoundException( + String.format("namespace not found for %s %s %s", appId, clusterName, namespaceName)); + } + Item item = itemRepository.findFirst1ByNamespaceIdOrderByLineNumDesc(namespace.getId()); + return item; + } + public Item findOne(long itemId) { Item item = itemRepository.findOne(itemId); return item; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/AdminServiceAPI.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/AdminServiceAPI.java index f93b7ca3e32fb21d30648d9f764c00098dab343a..93ebdc1e36eadc6f46adbcf529139166ea1f54cb 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/AdminServiceAPI.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/AdminServiceAPI.java @@ -115,6 +115,12 @@ public class AdminServiceAPI { .format("apps/%s/clusters/%s/namespaces/%s/itemset", appId, clusterName, namespace), changeSets, Void.class); } + + public ItemDTO createOrUpdateItem(String appId, Env env, String clusterName, String namespace, ItemDTO item){ + return restTemplate.postForEntity(getAdminServiceHost(env) + String + .format("apps/%s/clusters/%s/namespaces/%s/items", appId, clusterName, namespace), + item, ItemDTO.class).getBody(); + } } @Service diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PortalConfigController.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PortalConfigController.java index bb7e1b858fb09aa5f0975026e0294a727b3cbf3a..1a07c4639e182f9fa501a1b864f74fa38d217dd2 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PortalConfigController.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PortalConfigController.java @@ -37,7 +37,7 @@ public class PortalConfigController { @RequestBody NamespaceTextModel model) { if (model == null) { - throw new BadRequestException("request payload shoud not be null"); + throw new BadRequestException("request payload should not be null"); } model.setAppId(appId); model.setClusterName(clusterName); @@ -51,13 +51,39 @@ public class PortalConfigController { configService.updateConfigItemByText(model); } + @RequestMapping(value = "/apps/{appId}/env/{env}/clusters/{clusterName}/namespaces/{namespaceName}/item", method = RequestMethod.POST) + public ItemDTO createItem(@PathVariable String appId, @PathVariable String env, + @PathVariable String clusterName, @PathVariable String namespaceName, + @RequestBody ItemDTO item){ + if (StringUtils.isContainEmpty(appId, env, clusterName, namespaceName)){ + throw new BadRequestException("request payload should not be contain empty."); + } + if (!isValidItem(item) && item.getNamespaceId() <= 0){ + throw new BadRequestException("request model is invalid"); + } + return configService.createOrUpdateItem(appId, Env.valueOf(env), clusterName, namespaceName, item); + } + + @RequestMapping(value = "/apps/{appId}/env/{env}/clusters/{clusterName}/namespaces/{namespaceName}/item", method = RequestMethod.PUT) + public ItemDTO updateItem(@PathVariable String appId, @PathVariable String env, + @PathVariable String clusterName, @PathVariable String namespaceName, + @RequestBody ItemDTO item){ + if (StringUtils.isContainEmpty(appId, env, clusterName, namespaceName)){ + throw new BadRequestException("request payload should not be contain empty."); + } + if (!isValidItem(item)){ + throw new BadRequestException("request model is invalid"); + } + return configService.createOrUpdateItem(appId, Env.valueOf(env), clusterName, namespaceName, item); + } + @RequestMapping(value = "/apps/{appId}/env/{env}/clusters/{clusterName}/namespaces/{namespaceName}/release", method = RequestMethod.POST, consumes = { "application/json"}) public ReleaseDTO createRelease(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName, @RequestBody NamespaceReleaseModel model) { if (model == null) { - throw new BadRequestException("request payload shoud not be null"); + throw new BadRequestException("request payload should not be null"); } model.setAppId(appId); model.setClusterName(clusterName); @@ -77,7 +103,7 @@ public class PortalConfigController { @PathVariable String clusterName, @PathVariable String namespaceName){ if (StringUtils.isContainEmpty(appId, env, clusterName, namespaceName)){ - throw new BadRequestException("appid,env,cluster name,namespace name can not be null"); + throw new BadRequestException("appid,env,cluster name,namespace name can not be empty"); } return configService.findItems(appId, Env.valueOf(env), clusterName, namespaceName); @@ -87,7 +113,7 @@ public class PortalConfigController { "application/json"}) public List diff(@RequestBody NamespaceSyncModel model){ if (model == null){ - throw new BadRequestException("request payload shoud not be null"); + throw new BadRequestException("request payload should not be null"); } if (model.isInvalid()) { throw new BadRequestException("request model is invalid"); @@ -100,7 +126,7 @@ public class PortalConfigController { "application/json"}) public ResponseEntity update(@RequestBody NamespaceSyncModel model){ if (model == null){ - throw new BadRequestException("request payload shoud not be null"); + throw new BadRequestException("request payload should not be null"); } if (model.isInvalid()) { throw new BadRequestException("request model is invalid"); @@ -109,4 +135,8 @@ public class PortalConfigController { return ResponseEntity.status(HttpStatus.OK).build(); } + private boolean isValidItem(ItemDTO item){ + return item != null && !StringUtils.isContainEmpty(item.getKey(), item.getValue()); + } + } diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/PortalConfigService.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/PortalConfigService.java index 5ebb933690c2efaea3db0b6303b559b2292c0c8b..c0d385e7612da8a7b70bf5c142db1198c17d1d8e 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/PortalConfigService.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/PortalConfigService.java @@ -71,6 +71,11 @@ public class PortalConfigService { } } + + public ItemDTO createOrUpdateItem(String appId, Env env, String clusterName, String namespaceName, ItemDTO item){ + return itemAPI.createOrUpdateItem(appId, env, clusterName, namespaceName, item); + + } /** * createRelease config items */ diff --git a/apollo-portal/src/main/resources/static/app.html b/apollo-portal/src/main/resources/static/app.html index 65543046259e7da60a14e58b923ab64f47948a9c..4761b52721336303afdca7ee05804e65773efa8c 100644 --- a/apollo-portal/src/main/resources/static/app.html +++ b/apollo-portal/src/main/resources/static/app.html @@ -25,26 +25,26 @@
- +
- +
- +
- +
diff --git a/apollo-portal/src/main/resources/static/config.html b/apollo-portal/src/main/resources/static/config.html index e1c20794dea75e23ba73a0255eb414fad2904c8d..2fed902339cd5b70ebcba548d336d452589d842b 100644 --- a/apollo-portal/src/main/resources/static/config.html +++ b/apollo-portal/src/main/resources/static/config.html @@ -75,13 +75,13 @@
- - - - - + + + + + - +
@@ -108,7 +108,8 @@
@@ -116,7 +117,8 @@
@@ -132,7 +134,8 @@ @@ -203,13 +215,14 @@
+ ng-show="namespace.viewType == 'table' && namespace.items.length > 0"> + - - + - - - + + @@ -304,79 +333,141 @@ - - + diff --git a/apollo-portal/src/main/resources/static/config/sync.html b/apollo-portal/src/main/resources/static/config/sync.html index 85825b66272b4aea13ec84d4f84365412f54937b..d1f2debf100641e7e21c020cfa69fe6515c1ec1f 100644 --- a/apollo-portal/src/main/resources/static/config/sync.html +++ b/apollo-portal/src/main/resources/static/config/sync.html @@ -60,7 +60,7 @@
-
@@ -227,29 +240,45 @@ 最后修改时间 + 操作 +
+
+ + + + + +   +
+
diff --git a/apollo-portal/src/main/resources/static/scripts/controller/app/ConfigNamespaceController.js b/apollo-portal/src/main/resources/static/scripts/controller/app/ConfigNamespaceController.js index 3cd7a9c688f9ebc47d3afbc58c3bc6c2964b0668..09267d79b28cceaaed286ed2e70c69da6e878496 100644 --- a/apollo-portal/src/main/resources/static/scripts/controller/app/ConfigNamespaceController.js +++ b/apollo-portal/src/main/resources/static/scripts/controller/app/ConfigNamespaceController.js @@ -5,42 +5,50 @@ application_module.controller("ConfigNamespaceController", ////// namespace ////// var namespace_view_type = { - TEXT:'text', + TEXT: 'text', TABLE: 'table', LOG: 'log' }; $rootScope.refreshNamespaces = function (viewType) { - if ($rootScope.pageContext.env == ''){ + if ($rootScope.pageContext.env == '') { return; } - ConfigService.load_all_namespaces($rootScope.pageContext.appId, $rootScope.pageContext.env, - $rootScope.pageContext.clusterName, viewType).then( + ConfigService.load_all_namespaces($rootScope.pageContext.appId, + $rootScope.pageContext.env, + $rootScope.pageContext.clusterName, + viewType).then( function (result) { $scope.namespaces = result; //初始化视图 if ($scope.namespaces) { - - $scope.namespaces.forEach(function (item) { - item.isModify = false; + + $scope.namespaces.forEach(function (namespace) { if (!viewType) {//default text view - $scope.switchView(item, namespace_view_type.TEXT); + $scope.switchView(namespace, namespace_view_type.TABLE); } else if (viewType == namespace_view_type.TABLE) { - item.viewType = namespace_view_type.TABLE; + namespace.viewType = namespace_view_type.TABLE; } - item.isTextEditing = false; + namespace.isTextEditing = false; }); } setInterval(function () { $('[data-tooltip="tooltip"]').tooltip(); - },2500); + $('.namespace-view-table').bind( 'mousewheel DOMMouseScroll', function ( e ) { + var e0 = e.originalEvent, + delta = e0.wheelDelta || -e0.detail; + + this.scrollTop += ( delta < 0 ? 1 : -1 ) * 30; + e.preventDefault(); + }); + }, 2500); }, function (result) { toastr.error(AppUtil.errorMsg(result), "加载配置信息出错"); }); - } + }; ////// global view oper ////// @@ -52,11 +60,11 @@ application_module.controller("ConfigNamespaceController", } namespace.viewType = viewType; }; - + var MAX_ROW_SIZE = 30; //把表格内容解析成文本 function parseModel2Text(namespace) { - + if (!namespace.items) { return "无配置信息"; } @@ -69,7 +77,7 @@ application_module.controller("ConfigNamespaceController", } else { result += item.item.comment + "\n"; } - itemCnt ++; + itemCnt++; }); namespace.itemCnt = itemCnt > MAX_ROW_SIZE ? MAX_ROW_SIZE : itemCnt + 3; @@ -87,8 +95,10 @@ application_module.controller("ConfigNamespaceController", $scope.commitComment = ''; //更新配置 $scope.commitChange = function () { - ConfigService.modify_items($scope.pageContext.appId, $scope.pageContext.env, $scope.pageContext.clusterName, - $scope.draft.namespace.namespaceName, $scope.draft.text, + ConfigService.modify_items($scope.pageContext.appId, $scope.pageContext.env, + $scope.pageContext.clusterName, + $scope.draft.namespace.namespaceName, + $scope.draft.text, $scope.draft.namespace.id, $scope.commitComment).then( function (result) { toastr.success("更新成功"); @@ -104,52 +114,132 @@ application_module.controller("ConfigNamespaceController", ); }; - //文本编辑框状态切换 $scope.toggleTextEditStatus = function (namespace) { namespace.isTextEditing = !namespace.isTextEditing; - if (namespace.isTextEditing){//切换为编辑状态,保存一下原来值 + if (namespace.isTextEditing) {//切换为编辑状态,保存一下原来值 $scope.draft.backupText = namespace.text; - }else { - if ($scope.draft.backupText){//取消编辑,则复原 + } else { + if ($scope.draft.backupText) {//取消编辑,则复原 namespace.text = $scope.draft.backupText; } } }; - ////// table view oper ////// - - $scope.watch = {}; - //查看配置 - $scope.watchItem = function (key, value, oldValue) { - $scope.watch.key = key; - $scope.watch.value = value; - $scope.watch.oldValue = oldValue; - }; - /////// release /////// + var releaseModal = $('#releaseModal'); var releaseNamespace = {}; - + $scope.prepareReleaseNamespace = function (namespace) { - releaseNamespace = namespace; + releaseNamespace = namespace; }; $scope.releaseComment = ''; $scope.releaseTitle = ''; $scope.release = function () { ConfigService.release($rootScope.pageContext.appId, $rootScope.pageContext.env, $rootScope.pageContext.clusterName, - releaseNamespace.namespace.namespaceName, $scope.releaseTitle, + releaseNamespace.namespace.namespaceName, + $scope.releaseTitle, $scope.releaseComment).then( function (result) { + releaseModal.modal('hide'); toastr.success("发布成功"); //refresh all namespace items $rootScope.refreshNamespaces(); }, function (result) { - toastr.error(AppUtil.errorMsg(result), "发布失败"); + toastr.error(AppUtil.errorMsg(result), "发布失败"); } - ); + ); + }; + + var TABLE_VIEW_OPER_TYPE = { + RETRIEVE: 'retrieve', + CREATE: 'create', + UPDATE: 'update' + }; + + $scope.tableViewOperType = '', $scope.item = {}; + + //查看配置 + $scope.retrieveItem = function (item, oldValue) { + switchTableViewOperType(TABLE_VIEW_OPER_TYPE.RETRIEVE); + $scope.item = item; + $scope.item.oldValue = oldValue; + }; + + var toOperationNamespaceName = ''; + //修改配置 + $scope.editItem = function (namespace, item) { + switchTableViewOperType(TABLE_VIEW_OPER_TYPE.UPDATE); + $scope.item = item; + toOperationNamespaceName = namespace.namespace.namespaceName; + }; + + //新增配置 + $scope.createItem = function (namespace) { + switchTableViewOperType(TABLE_VIEW_OPER_TYPE.CREATE); + $scope.item = {}; + $scope.item.namespaceId = namespace.namespace.id; + toOperationNamespaceName = namespace.namespace.namespaceName; + }; + + $scope.switchToEdit = function () { + switchTableViewOperType(TABLE_VIEW_OPER_TYPE.UPDATE); + }; + + var selectedClusters = []; + $scope.collectSelectedClusters = function (data) { + selectedClusters = data; + }; + + function switchTableViewOperType(type) { + $scope.tableViewOperType = type; + } + + var itemModal = $("#itemModal"); + $scope.doItem = function () { + + if (selectedClusters.length == 0) { + toastr.error("请选择集群"); + } else { + selectedClusters.forEach(function (cluster) { + if ($scope.tableViewOperType == TABLE_VIEW_OPER_TYPE.CREATE) { + + ConfigService.create_item($rootScope.pageContext.appId, + cluster.env, + cluster.name, + toOperationNamespaceName, + $scope.item).then( + function (result) { + toastr.success("[" + cluster.env + "," + cluster.name + "]", + "创建成功"); + itemModal.modal('hide'); + $rootScope.refreshNamespaces(namespace_view_type.TABLE); + }, function (result) { + AppUtil.errorMsg(result); + }); + + } else if ($scope.tableViewOperType == TABLE_VIEW_OPER_TYPE.UPDATE) { + + ConfigService.update_item($rootScope.pageContext.appId, + cluster.env, + cluster.name, + toOperationNamespaceName, + $scope.item).then( + function (result) { + toastr.success("[" + cluster.env + "," + cluster.name + "]", + "更新成功"); + itemModal.modal('hide'); + $rootScope.refreshNamespaces(namespace_view_type.TABLE); + }, function (result) { + AppUtil.errorMsg(result); + }); + } + }); + } + }; $('.config-item-container').removeClass('hide'); diff --git a/apollo-portal/src/main/resources/static/scripts/directive.js b/apollo-portal/src/main/resources/static/scripts/directive.js index 576b94c520ba0b51f37ecc749dce08bf5238500b..6dcaf74af4a383e163114c9de025f017272b0123 100644 --- a/apollo-portal/src/main/resources/static/scripts/directive.js +++ b/apollo-portal/src/main/resources/static/scripts/directive.js @@ -1,4 +1,3 @@ - /** navbar */ directive_module.directive('apollonav', function ($compile, $window, AppService, EnvService) { return { @@ -10,7 +9,7 @@ directive_module.directive('apollonav', function ($compile, $window, AppService, scope.sourceApps = []; scope.copyedApps = []; - + EnvService.find_all_envs().then(function (result) { //default select first env AppService.find_all_app(result[0]).then(function (result) { @@ -35,23 +34,23 @@ directive_module.directive('apollonav', function ($compile, $window, AppService, scope.changeSearchKey = function () { scope.copyedApps = []; - scope.sourceApps.forEach(function (app) { - if (app.name.indexOf(scope.searchKey) > -1 || app.appId.indexOf(scope.searchKey) > -1) { - scope.copyedApps.push(app); - } - }); + scope.sourceApps.forEach(function (app) { + if (app.name.indexOf(scope.searchKey) > -1 || app.appId.indexOf(scope.searchKey) > -1) { + scope.copyedApps.push(app); + } + }); scope.shouldShowAppList = true; }; - + scope.jumpToConfigPage = function () { - if (selectedApp.appId){ + if (selectedApp.appId) { var needReloadPage = false; - if ($window.location.href.indexOf("config.html") > -1){ + if ($window.location.href.indexOf("config.html") > -1) { needReloadPage = true; } $window.location.href = '/config.html?#appid=' + selectedApp.appId; - if (needReloadPage){ + if (needReloadPage) { $window.location.reload(); } } @@ -72,10 +71,10 @@ directive_module.directive('apollonav', function ($compile, $window, AppService, scope.copyedApps[--selectedAppIdx].selected = true; } } else if (event.keyCode == 13) { - if (scope.shouldShowAppList && selectedAppIdx > -1){ + if (scope.shouldShowAppList && selectedAppIdx > -1) { select(scope.copyedApps[selectedAppIdx]); event.preventDefault(); - }else { + } else { scope.jumpToConfigPage(); } @@ -157,23 +156,39 @@ directive_module.directive('apolloclusterselector', function ($compile, $window, scope.select(collectSelectedClusters()); }; - scope.switchSelect = function (o) { + scope.switchSelect = function (o, $event) { o.checked = !o.checked; + $event.stopPropagation(); + scope.select(collectSelectedClusters()); + }; + + scope.toggleClusterCheckedStatus = function (cluster) { + cluster.checked = !cluster.checked; scope.select(collectSelectedClusters()); }; function collectSelectedClusters() { var selectedClusters = []; scope.clusters.forEach(function (cluster) { - if (cluster.checked){ + if (cluster.checked) { cluster.clusterName = cluster.name; selectedClusters.push(cluster); } }); return selectedClusters; } - + } } }); + +directive_module.directive('apollorequiredfiled', function ($compile, $window) { + return { + restrict: 'E', + template: '*', + transclude: true, + replace: true + } + +}); diff --git a/apollo-portal/src/main/resources/static/scripts/services/ConfigService.js b/apollo-portal/src/main/resources/static/scripts/services/ConfigService.js index 926661edb2e86cb6061fae3ecec6eb751ecf93ad..9274ee94ca6bdba94cf787b4383b23c9e05ce68c 100644 --- a/apollo-portal/src/main/resources/static/scripts/services/ConfigService.js +++ b/apollo-portal/src/main/resources/static/scripts/services/ConfigService.js @@ -5,10 +5,10 @@ appService.service("ConfigService", ['$resource', '$q', function ($resource, $q) isArray: true, url: '/apps/:appId/env/:env/clusters/:clusterName/namespaces' }, - find_items:{ - method:'GET', + find_items: { + method: 'GET', isArray: true, - url:'/apps/:appId/env/:env/clusters/:clusterName/namespaces/:namespaceName/items' + url: '/apps/:appId/env/:env/clusters/:clusterName/namespaces/:namespaceName/items' }, modify_items: { method: 'PUT', @@ -16,7 +16,7 @@ appService.service("ConfigService", ['$resource', '$q', function ($resource, $q) }, release: { method: 'POST', - url:'/apps/:appId/env/:env/clusters/:clusterName/namespaces/:namespaceName/release' + url: '/apps/:appId/env/:env/clusters/:clusterName/namespaces/:namespaceName/release' }, diff: { method: 'POST', @@ -27,6 +27,14 @@ appService.service("ConfigService", ['$resource', '$q', function ($resource, $q) method: 'PUT', url: '/namespaces/:namespaceName/items', isArray: false + }, + create_item: { + method: 'POST', + url: '/apps/:appId/env/:env/clusters/:clusterName/namespaces/:namespaceName/item' + }, + update_item: { + method: 'PUT', + url: '/apps/:appId/env/:env/clusters/:clusterName/namespaces/:namespaceName/item' } }); @@ -34,10 +42,10 @@ appService.service("ConfigService", ['$resource', '$q', function ($resource, $q) load_all_namespaces: function (appId, env, clusterName) { var d = $q.defer(); config_source.load_all_namespaces({ - appId: appId, - env: env, - clusterName: clusterName - }, function (result) { + appId: appId, + env: env, + clusterName: clusterName + }, function (result) { d.resolve(result); }, function (result) { d.reject(result); @@ -52,9 +60,9 @@ appService.service("ConfigService", ['$resource', '$q', function ($resource, $q) clusterName: clusterName, namespaceName: namespaceName }, function (result) { - d.resolve(result); + d.resolve(result); }, function (result) { - d.reject(result); + d.reject(result); }); return d.promise; }, @@ -70,16 +78,16 @@ appService.service("ConfigService", ['$resource', '$q', function ($resource, $q) { configText: configText, namespaceId: namespaceId, - comment:comment + comment: comment }, function (result) { d.resolve(result); }, function (result) { d.reject(result); - }); + }); return d.promise; }, - + release: function (appId, env, clusterName, namespaceName, releaseBy, comment) { var d = $q.defer(); config_source.release({ @@ -113,8 +121,38 @@ appService.service("ConfigService", ['$resource', '$q', function ($resource, $q) sync_items: function (namespaceName, sourceData) { var d = $q.defer(); config_source.sync_item({ - namespaceName: namespaceName - }, sourceData, function (result) { + namespaceName: namespaceName + }, sourceData, function (result) { + d.resolve(result); + }, function (result) { + d.reject(result); + }); + return d.promise; + }, + + create_item: function (appId, env, clusterName, namespaceName, item) { + var d = $q.defer(); + config_source.create_item({ + appId: appId, + env: env, + clusterName: clusterName, + namespaceName: namespaceName + }, item, function (result) { + d.resolve(result); + }, function (result) { + d.reject(result); + }); + return d.promise; + }, + + update_item: function (appId, env, clusterName, namespaceName, item) { + var d = $q.defer(); + config_source.update_item({ + appId: appId, + env: env, + clusterName: clusterName, + namespaceName: namespaceName + }, item, function (result) { d.resolve(result); }, function (result) { d.reject(result); diff --git a/apollo-portal/src/main/resources/static/styles/common-style.css b/apollo-portal/src/main/resources/static/styles/common-style.css index 6717980f4e98f62247890a53ed18ec5ea71f0369..802fc45700529422dc3a5b8f63f3d6f8ef0aa7e2 100644 --- a/apollo-portal/src/main/resources/static/styles/common-style.css +++ b/apollo-portal/src/main/resources/static/styles/common-style.css @@ -212,22 +212,21 @@ table th { } .namespace-view-table { - max-height: 700px; -} -.namespace-view-table table { - table-layout: fixed; } -.namespace-view-table tr { - cursor: pointer; - +.namespace-view-table table { + table-layout: inherit; } .namespace-view-table td { word-wrap: break-word; } +.namespace-view-table .glyphicon{ + cursor: pointer; +} + .history-view { padding: 50px 20px; diff --git a/apollo-portal/src/main/resources/static/views/component/env-selector.html b/apollo-portal/src/main/resources/static/views/component/env-selector.html index 2256b19c8e8f0ec0d4d8b258c6336c39deba7684..d43205583f19945aeabf9e029f0047aa7aa8fb99 100644 --- a/apollo-portal/src/main/resources/static/views/component/env-selector.html +++ b/apollo-portal/src/main/resources/static/views/component/env-selector.html @@ -1,4 +1,4 @@ -
+
@@ -8,9 +8,9 @@ - + + ng-click="switchSelect(cluster, $event)"> diff --git a/application.pid b/application.pid new file mode 100644 index 0000000000000000000000000000000000000000..aa743d54120163068f2aa6b6f52b28b9c28551be --- /dev/null +++ b/application.pid @@ -0,0 +1 @@ +19575 \ No newline at end of file