diff --git a/apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/ConfigController.java b/apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/ConfigController.java index 8c4e298e074d8d8f84e468b109d8c5de77a947c6..66622a1a0ff23ff2a9e174cb880f7c13d085f406 100644 --- a/apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/ConfigController.java +++ b/apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/ConfigController.java @@ -1,10 +1,13 @@ package com.ctrip.apollo.portal.controller; +import com.ctrip.apollo.core.dto.ItemDTO; import com.ctrip.apollo.core.enums.Env; import com.ctrip.apollo.core.dto.ReleaseDTO; import com.ctrip.apollo.core.exception.BadRequestException; import com.ctrip.apollo.core.utils.StringUtils; +import com.ctrip.apollo.portal.entity.ItemDiffs; +import com.ctrip.apollo.portal.entity.form.NamespaceSyncModel; import com.ctrip.apollo.portal.entity.form.NamespaceTextModel; import com.ctrip.apollo.portal.entity.NamespaceVO; import com.ctrip.apollo.portal.entity.form.NamespaceReleaseModel; @@ -78,4 +81,28 @@ public class ConfigController { } + @RequestMapping(value = "/apps/{appId}/env/{env}/clusters/{clusterName}/namespaces/{namespaceName}/items") + public List findItems(@PathVariable String appId, @PathVariable String env, + @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"); + } + + return configService.findItems(appId, Env.valueOf(env), clusterName, namespaceName); + } + + @RequestMapping(value = "/namespaces/{namespaceName}/diff", method = RequestMethod.POST, consumes = { + "application/json"}) + public List diff(@RequestBody NamespaceSyncModel model){ + if (model == null){ + throw new BadRequestException("request payload shoud not be null"); + } + if (model.isInvalid()) { + throw new BadRequestException("request model is invalid"); + } + + return configService.compare(model.getSyncItems(), model.getSyncToNamespaces()); + } + } diff --git a/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/ItemDiffs.java b/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/ItemDiffs.java new file mode 100644 index 0000000000000000000000000000000000000000..652dcb0835adf96573cc4c56f203b81b04b4e03c --- /dev/null +++ b/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/ItemDiffs.java @@ -0,0 +1,27 @@ +package com.ctrip.apollo.portal.entity; + +import com.ctrip.apollo.core.dto.ItemChangeSets; + +public class ItemDiffs { + private NamespaceIdentifer namespace; + private ItemChangeSets diffs; + + public ItemDiffs(NamespaceIdentifer namespace){ + this.namespace = namespace; + } + public NamespaceIdentifer getNamespace() { + return namespace; + } + + public void setNamespace(NamespaceIdentifer namespace) { + this.namespace = namespace; + } + + public ItemChangeSets getDiffs() { + return diffs; + } + + public void setDiffs(ItemChangeSets diffs) { + this.diffs = diffs; + } +} diff --git a/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/NamespaceIdentifer.java b/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/NamespaceIdentifer.java new file mode 100644 index 0000000000000000000000000000000000000000..4390887962f84404cf525a9a7431552076deedb5 --- /dev/null +++ b/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/NamespaceIdentifer.java @@ -0,0 +1,50 @@ +package com.ctrip.apollo.portal.entity; + +import com.ctrip.apollo.core.enums.Env; +import com.ctrip.apollo.core.utils.StringUtils; +import com.ctrip.apollo.portal.entity.form.Verifiable; + +public class NamespaceIdentifer implements Verifiable{ + private String appId; + private String env; + private String clusterName; + private String namespaceName; + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public Env getEnv() { + return Env.valueOf(env); + } + + public void setEnv(String env) { + this.env = env; + } + + public String getClusterName() { + return clusterName; + } + + public void setClusterName(String clusterName) { + this.clusterName = clusterName; + } + + public String getNamespaceName() { + return namespaceName; + } + + public void setNamespaceName(String namespaceName) { + this.namespaceName = namespaceName; + } + + + @Override + public boolean isInvalid() { + return StringUtils.isContainEmpty(env, clusterName, namespaceName); + } +} diff --git a/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/SimpleMsg.java b/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/SimpleMsg.java deleted file mode 100644 index 4dca0b8218ace28cf9435c4cf9e95d48a54a7c9e..0000000000000000000000000000000000000000 --- a/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/SimpleMsg.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ctrip.apollo.portal.entity; - -public class SimpleMsg { - - private String msg; - - public SimpleMsg(String msg){ - this.msg = msg; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } -} diff --git a/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/NamespaceReleaseModel.java b/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/NamespaceReleaseModel.java index c6597abcaa794a092c23066613d74d22b56d345b..a34d5c4002ce22e70d9f497ffced7eb51bddac0a 100644 --- a/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/NamespaceReleaseModel.java +++ b/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/NamespaceReleaseModel.java @@ -4,7 +4,7 @@ package com.ctrip.apollo.portal.entity.form; import com.ctrip.apollo.core.enums.Env; import com.ctrip.apollo.core.utils.StringUtils; -public class NamespaceReleaseModel implements FormModel{ +public class NamespaceReleaseModel implements Verifiable { private String appId; private String env; diff --git a/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/NamespaceSyncModel.java b/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/NamespaceSyncModel.java new file mode 100644 index 0000000000000000000000000000000000000000..5b1cb43aa6bd7cab72eb95e3cdc2c678254760a7 --- /dev/null +++ b/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/NamespaceSyncModel.java @@ -0,0 +1,43 @@ +package com.ctrip.apollo.portal.entity.form; + +import com.ctrip.apollo.core.dto.ItemDTO; +import com.ctrip.apollo.portal.entity.NamespaceIdentifer; + +import org.springframework.util.CollectionUtils; + +import java.util.List; + +public class NamespaceSyncModel implements Verifiable { + + private List syncToNamespaces; + private List syncItems; + + @Override + public boolean isInvalid() { + if (CollectionUtils.isEmpty(syncToNamespaces) || CollectionUtils.isEmpty(syncItems)){ + return true; + } + for (NamespaceIdentifer namespaceIdentifer: syncToNamespaces){ + if (namespaceIdentifer.isInvalid()){ + return true; + } + } + return false; + } + + public List getSyncToNamespaces() { + return syncToNamespaces; + } + + public void setSyncToNamespaces(List syncToNamespaces) { + this.syncToNamespaces = syncToNamespaces; + } + + public List getSyncItems() { + return syncItems; + } + + public void setSyncItems(List syncItems) { + this.syncItems = syncItems; + } +} diff --git a/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/NamespaceTextModel.java b/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/NamespaceTextModel.java index c191ecf393f989af603dcb17851a83f85cbc591f..ef0204b180a63c04dec6c370ac31c176c146a30a 100644 --- a/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/NamespaceTextModel.java +++ b/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/NamespaceTextModel.java @@ -4,7 +4,7 @@ package com.ctrip.apollo.portal.entity.form; import com.ctrip.apollo.core.enums.Env; import com.ctrip.apollo.core.utils.StringUtils; -public class NamespaceTextModel implements FormModel{ +public class NamespaceTextModel implements Verifiable { private String appId; private String env; diff --git a/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/FormModel.java b/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/Verifiable.java similarity index 70% rename from apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/FormModel.java rename to apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/Verifiable.java index 6b4cf7348bbaa1766318735d47bef97e0707698d..6d2126a0caa5ec786d98d621395de69976186890 100644 --- a/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/FormModel.java +++ b/apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/form/Verifiable.java @@ -1,6 +1,6 @@ package com.ctrip.apollo.portal.entity.form; -public interface FormModel { +public interface Verifiable { boolean isInvalid(); diff --git a/apollo-portal/src/main/java/com/ctrip/apollo/portal/service/ConfigService.java b/apollo-portal/src/main/java/com/ctrip/apollo/portal/service/ConfigService.java index 451bc9682f9e15e701726f50bd4e22f87e0473d6..f22afab81eece26a159e0a5b40afdb3a213e25fc 100644 --- a/apollo-portal/src/main/java/com/ctrip/apollo/portal/service/ConfigService.java +++ b/apollo-portal/src/main/java/com/ctrip/apollo/portal/service/ConfigService.java @@ -7,17 +7,23 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import org.springframework.web.client.HttpClientErrorException; +import com.ctrip.apollo.common.utils.BeanUtils; import com.ctrip.apollo.common.utils.ExceptionUtils; import com.ctrip.apollo.core.enums.Env; import com.ctrip.apollo.core.dto.ItemChangeSets; import com.ctrip.apollo.core.dto.ItemDTO; import com.ctrip.apollo.core.dto.NamespaceDTO; import com.ctrip.apollo.core.dto.ReleaseDTO; +import com.ctrip.apollo.core.exception.BadRequestException; +import com.ctrip.apollo.core.exception.NotFoundException; import com.ctrip.apollo.core.exception.ServiceException; import com.ctrip.apollo.core.utils.StringUtils; import com.ctrip.apollo.portal.api.AdminServiceAPI; +import com.ctrip.apollo.portal.entity.ItemDiffs; +import com.ctrip.apollo.portal.entity.NamespaceIdentifer; import com.ctrip.apollo.portal.entity.form.NamespaceTextModel; import com.ctrip.apollo.portal.entity.NamespaceVO; import com.ctrip.apollo.portal.entity.form.NamespaceReleaseModel; @@ -172,4 +178,82 @@ public class ConfigService { return releaseAPI.release(model.getAppId(), model.getEnv(), model.getClusterName(), model.getNamespaceName(), model.getReleaseBy(), model.getReleaseComment()); } + + public List findItems(String appId, Env env, String clusterName, String namespaceName){ + return itemAPI.findItems(appId, env, clusterName, namespaceName); + } + + public List compare(List sourceItems, List comparedNamespaces){ + + List result = new LinkedList<>(); + + String appId, clusterName, namespaceName; + Env env; + for (NamespaceIdentifer namespace: comparedNamespaces){ + appId = namespace.getAppId(); + clusterName = namespace.getClusterName(); + namespaceName = namespace.getNamespaceName(); + env = namespace.getEnv(); + NamespaceDTO namespaceDTO = null; + try { + namespaceDTO = namespaceAPI.loadNamespace(appId, env, clusterName, namespaceName); + } catch (NotFoundException e){ + logger.warn("namespace not exist. appId:{}, env:{}, clusterName:{}, namespaceName:{}", appId, env, clusterName, + namespaceName); + throw new BadRequestException(String.format( + "namespace not exist. appId:%s, env:%s, clusterName:%s, namespaceName:%s", appId, env, clusterName, + namespaceName)); + } + + ItemDiffs itemDiffs = new ItemDiffs(namespace); + ItemChangeSets changeSets = new ItemChangeSets(); + itemDiffs.setDiffs(changeSets); + + List + targetItems = + itemAPI.findItems(namespace.getAppId(), namespace.getEnv(), + namespace.getClusterName(), namespace.getNamespaceName()); + + long namespaceId = namespaceDTO.getId(); + if (CollectionUtils.isEmpty(targetItems)){//all source items is added + int lineNum = 1; + for (ItemDTO sourceItem: sourceItems){ + changeSets.addCreateItem(buildItem(namespaceId, lineNum++, sourceItem)); + } + }else { + Map keyMapItem = BeanUtils.mapByKey("key", targetItems); + String key,sourceValue,sourceComment; + ItemDTO targetItem = null; + int maxLineNum = targetItems.size();//append to last + for (ItemDTO sourceItem: sourceItems){ + key = sourceItem.getKey(); + sourceValue = sourceItem.getValue(); + sourceComment = sourceItem.getComment(); + targetItem = keyMapItem.get(key); + + if (targetItem == null) {//added items + + changeSets.addCreateItem(buildItem(namespaceId, ++maxLineNum, sourceItem)); + + }else if (!sourceValue.equals(targetItem.getValue()) || !sourceComment.equals(targetItem.getComment())){//modified items + targetItem.setValue(sourceValue); + targetItem.setComment(sourceComment); + changeSets.addUpdateItem(targetItem); + } + } + } + + result.add(itemDiffs); + } + + return result; + } + + private ItemDTO buildItem(long namespaceId, int lineNum, ItemDTO sourceItem){ + ItemDTO createdItem = new ItemDTO(); + BeanUtils.copyEntityProperties(sourceItem, createdItem); + createdItem.setLineNum(lineNum++); + createdItem.setNamespaceId(namespaceId); + return createdItem; + } } diff --git a/apollo-portal/src/main/resources/application.yml b/apollo-portal/src/main/resources/application.yml index 25913dd8ec5e5f25af5c957899b3db2a49253218..7880bd3635f3b9f55c517bd3bf4b341ad46ea428 100644 --- a/apollo-portal/src/main/resources/application.yml +++ b/apollo-portal/src/main/resources/application.yml @@ -17,4 +17,4 @@ ctrip: apollo: portal: - env: local,dev + env: local diff --git a/apollo-portal/src/main/resources/static/img/sync-error.png b/apollo-portal/src/main/resources/static/img/sync-error.png new file mode 100644 index 0000000000000000000000000000000000000000..46f1bd014aa9f07911a4d5f3804182fa356dd256 Binary files /dev/null and b/apollo-portal/src/main/resources/static/img/sync-error.png differ diff --git a/apollo-portal/src/main/resources/static/img/sync-succ.png b/apollo-portal/src/main/resources/static/img/sync-succ.png new file mode 100644 index 0000000000000000000000000000000000000000..f8be249cb21a4c31ecaf302af8a85e2e5697b3dc Binary files /dev/null and b/apollo-portal/src/main/resources/static/img/sync-succ.png differ diff --git a/apollo-portal/src/main/resources/static/img/sync.png b/apollo-portal/src/main/resources/static/img/sync.png new file mode 100644 index 0000000000000000000000000000000000000000..70edc15379fa041befc22caba83d07495062ec70 Binary files /dev/null and b/apollo-portal/src/main/resources/static/img/sync.png differ diff --git a/apollo-portal/src/main/resources/static/index.html b/apollo-portal/src/main/resources/static/index.html index 1f1f598f2cc6c7697256472585158227fd8d197f..e579eac463548b5ee9c77331e822e4064e1093b7 100644 --- a/apollo-portal/src/main/resources/static/index.html +++ b/apollo-portal/src/main/resources/static/index.html @@ -76,10 +76,14 @@ + + + + diff --git a/apollo-portal/src/main/resources/static/scripts/AppUtils.js b/apollo-portal/src/main/resources/static/scripts/AppUtils.js index acbfbe6fc7d8c0252abfe48cbd02eedb9c26dd77..826726baca1e463514e558c2c39cc6e3834f8071 100644 --- a/apollo-portal/src/main/resources/static/scripts/AppUtils.js +++ b/apollo-portal/src/main/resources/static/scripts/AppUtils.js @@ -1,12 +1,34 @@ appUtil.service('AppUtil', [function () { - + return { errorMsg: function (response) { - var msg = "Code:" + response.status; - if (response.data.message != null){ + var msg = "Code:" + response.status; + if (response.data.message != null) { msg += " Msg:" + response.data.message; } return msg; + }, + parseParams: function (path) { + if (!path) { + return {}; + } + if (path.startsWith("/")) { + path = path.substring(1, path.length); + } + var params = path.split("&"); + var result = {}; + params.forEach(function (param) { + var kv = param.split("="); + result[kv[0]] = kv[1]; + }); + return result; + }, + cutOffString: function (str, maxLength) { + if (!str || maxLength <= 0) { + return ''; + } + return str.length > maxLength ? str.substr(0, maxLength) : str; } + } }]); diff --git a/apollo-portal/src/main/resources/static/scripts/PageCommon.js b/apollo-portal/src/main/resources/static/scripts/PageCommon.js new file mode 100644 index 0000000000000000000000000000000000000000..5d9e1e70ef27633f27f15599890699b96071c906 --- /dev/null +++ b/apollo-portal/src/main/resources/static/scripts/PageCommon.js @@ -0,0 +1,12 @@ +$(document).ready(function () { + $("html").niceScroll({ + styler: "fb", + cursorcolor: "#e8403f", + cursorwidth: '6', + cursorborderradius: '10px', + background: '#404040', + spacebarenabled: false, + cursorborder: '', + zindex: '1000' + }); +}); diff --git a/apollo-portal/src/main/resources/static/scripts/app.js b/apollo-portal/src/main/resources/static/scripts/app.js index 8ac1b82fdd8b3c2d4e74ef95706d71ca70f6b8b9..52dc2b4135a07f4006253bf79c8e316589cd0e4b 100644 --- a/apollo-portal/src/main/resources/static/scripts/app.js +++ b/apollo-portal/src/main/resources/static/scripts/app.js @@ -11,6 +11,8 @@ var index_module = angular.module('index', ['toastr', 'app.service', 'app.util', var application_module = angular.module('application', ['app.service', 'app.util', 'toastr', 'angular-loading-bar']); //创建项目页面 var create_app_module = angular.module('create_app', ['ngResource', 'toastr', 'app.service', 'app.util', 'angular-loading-bar']); +//配置同步页面 +var sync_item_module = angular.module('sync_item', ['app.service', 'app.util', 'toastr', 'angular-loading-bar']); diff --git a/apollo-portal/src/main/resources/static/scripts/controller/app/AppConfigController.js b/apollo-portal/src/main/resources/static/scripts/controller/app/AppConfigController.js index 045601bb83852161d2a4eb6468d6413e47eba0fa..a19066cae0dddce18a6d69b091d60f41a043a2da 100644 --- a/apollo-portal/src/main/resources/static/scripts/controller/app/AppConfigController.js +++ b/apollo-portal/src/main/resources/static/scripts/controller/app/AppConfigController.js @@ -2,7 +2,8 @@ application_module.controller("AppConfigController", ['$scope', '$location', 'toastr', 'AppService', 'AppUtil', 'ConfigService', function ($scope, $location, toastr, AppService, AppUtil, ConfigService) { - var appId = $location.$$url.split("=")[1]; + + var appId = AppUtil.parseParams($location.$$url).appid; var currentUser = 'test_user'; var pageContext = { appId: appId, @@ -92,16 +93,17 @@ application_module.controller("AppConfigController", //初始化视图 if ($scope.namespaces) { + $scope.namespaces.forEach(function (item) { item.isModify = false; - if (!viewType){//default text view + if (!viewType) {//default text view $scope.switchView(item, namespace_view_type.TEXT); - }else if (viewType == namespace_view_type.TABLE){ + } else if (viewType == namespace_view_type.TABLE) { item.viewType = namespace_view_type.TABLE; } item.isTextEditing = false; - }) + }); } }, function (result) { @@ -122,10 +124,12 @@ application_module.controller("AppConfigController", //把表格内容解析成文本 function parseModel2Text(namespace) { + if (!namespace.items) { return "无配置信息"; } var result = ""; + var itemCnt = 0; namespace.items.forEach(function (item) { if (item.item.key) { result += @@ -133,9 +137,12 @@ application_module.controller("AppConfigController", } else { result += item.item.comment + "\n"; } - + itemCnt ++; }); + itemCnt > 30 ? 30 : itemCnt; + itemCnt < 9 ? 8 : itemCnt; + namespace.itemCnt = itemCnt + 3; return result; } @@ -183,14 +190,12 @@ application_module.controller("AppConfigController", ////// table view oper ////// - //查看旧值 - $scope.queryOldValue = function (key, oldValue) { - $scope.queryKey = key; - if (oldValue == '') { - $scope.OldValue = key + "是新添加的key"; - } else { - $scope.OldValue = oldValue; - } + $scope.watch = {}; + //查看配置 + $scope.watchItem = function (key, value, oldValue) { + $scope.watch.key = key; + $scope.watch.value = value; + $scope.watch.oldValue = oldValue; }; /////// release /////// @@ -251,7 +256,6 @@ application_module.controller("AppConfigController", }); }); }; - - + }]); diff --git a/apollo-portal/src/main/resources/static/scripts/controller/app/SyncConfigController.js b/apollo-portal/src/main/resources/static/scripts/controller/app/SyncConfigController.js new file mode 100644 index 0000000000000000000000000000000000000000..5bbfb301283cf093b6d1740a9b9ab056c892d84a --- /dev/null +++ b/apollo-portal/src/main/resources/static/scripts/controller/app/SyncConfigController.js @@ -0,0 +1,76 @@ +sync_item_module.controller("SyncItemController", + ['$scope', '$location', 'toastr', 'AppService', 'AppUtil', 'ConfigService', + function ($scope, $location, toastr, AppService, AppUtil, ConfigService) { + + var params = AppUtil.parseParams($location.$$url); + var currentUser = 'test_user'; + $scope.pageContext = { + appId: params.appid, + env: params.env, + clusterName: params.clusterName, + namespaceName: params.namespaceName + }; + + ////// load env ////// + AppService.load_nav_tree($scope.pageContext.appId).then(function (result) { + $scope.clusters = result.nodes; + $scope.clusters = []; + result.nodes.forEach(function (node) { + var env = node.env; + node.clusters.forEach(function (cluster) { + cluster.env = env; + cluster.checked = false; + $scope.clusters.push(cluster); + }) + }); + }, function (result) { + toastr.error(AppUtil.errorMsg(result), "加载环境出错"); + }); + + var envAllSelected = false; + $scope.toggleEnvsCheckedStatus = function () { + envAllSelected = !envAllSelected; + $scope.clusters.forEach(function (cluster) { + cluster.checked = envAllSelected; + }) + }; + + ////// load items ////// + ConfigService.find_items($scope.pageContext.appId, $scope.pageContext.env, + $scope.pageContext.clusterName, $scope.pageContext.namespaceName).then(function (result) { + + $scope.sourceItems = result; + $scope.sourceItems.forEach(function (item) { + item.checked = false; + }) + + }, function (result) { + toastr.error(AppUtil.errorMsg(result), "加载配置出错"); + }); + + var itemAllSelected = false; + $scope.toggleItemsCheckedStatus = function () { + itemAllSelected = !itemAllSelected; + $scope.sourceItems.forEach(function (item) { + item.checked = itemAllSelected; + }) + }; + + ////// flow control /////// + + $scope.syncItemStep = 1; + $scope.syncItemNextStep = function (offset) { + $scope.syncItemStep += offset; + }; + + $scope.syncItems = function () { + $scope.syncItemStep += 1; + }; + + $scope.destorySync = function () { + $scope.syncItemStep = 1; + } + + + }]); + 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 711c3eb8bc624d67986a7448f9b0005de2de07c7..55f43a5f2bd25c29618db93e36ce140289b3634b 100644 --- a/apollo-portal/src/main/resources/static/scripts/services/ConfigService.js +++ b/apollo-portal/src/main/resources/static/scripts/services/ConfigService.js @@ -1,10 +1,15 @@ appService.service("ConfigService", ['$resource', '$q', function ($resource, $q) { var config_source = $resource("", {}, { - load_all_groups: { + load_all_namespaces: { method: 'GET', isArray: true, url: '/apps/:appId/env/:env/clusters/:clusterName/namespaces' }, + find_items:{ + method:'GET', + isArray: true, + url:'/apps/:appId/env/:env/clusters/:clusterName/namespaces/:namespaceName/items' + }, modify_items: { method: 'PUT', url: '/apps/:appId/env/:env/clusters/:clusterName/namespaces/:namespaceName/items' @@ -18,7 +23,7 @@ appService.service("ConfigService", ['$resource', '$q', function ($resource, $q) return { load_all_namespaces: function (appId, env, clusterName) { var d = $q.defer(); - config_source.load_all_groups({ + config_source.load_all_namespaces({ appId: appId, env: env, clusterName: clusterName @@ -29,6 +34,20 @@ appService.service("ConfigService", ['$resource', '$q', function ($resource, $q) }); return d.promise; }, + find_items: function (appId, env, clusterName, namespaceName) { + var d = $q.defer(); + config_source.find_items({ + appId: appId, + env: env, + clusterName: clusterName, + namespaceName: namespaceName + }, function (result) { + d.resolve(result); + }, function (result) { + d.reject(result); + }); + return d.promise; + }, modify_items: function (appId, env, clusterName, namespaceName, configText, namespaceId, comment, modifyBy) { var d = $q.defer(); 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 8a7f219bf7faf20e506424d2fc2ce325d54be5ff..b422dbf5b8f18e18a4c7574bf6508bb1029bb12f 100644 --- a/apollo-portal/src/main/resources/static/styles/common-style.css +++ b/apollo-portal/src/main/resources/static/styles/common-style.css @@ -197,6 +197,10 @@ table th { table-layout: fixed; } +.namespace-view-table tr{ + cursor: pointer; + +} .namespace-view-table td { word-wrap: break-word; } diff --git a/apollo-portal/src/main/resources/static/views/app.html b/apollo-portal/src/main/resources/static/views/app.html index 4d148b13ab756beb959a69d39c09384405501d22..7eff4eabcaa5ded923fbe8354f161b2c1b792446 100644 --- a/apollo-portal/src/main/resources/static/views/app.html +++ b/apollo-portal/src/main/resources/static/views/app.html @@ -65,7 +65,16 @@ - + +
+
+ +
+
+
@@ -169,7 +179,7 @@ -