Commit 20abd55d by Jason Song Committed by GitHub

Merge pull request #314 from lepdou/namespace-as-file-format-2

bugfix
parents ff156676 66ca68f3
...@@ -50,6 +50,9 @@ public class ItemSetService { ...@@ -50,6 +50,9 @@ public class ItemSetService {
Item entity = BeanUtils.transfrom(Item.class, item); Item entity = BeanUtils.transfrom(Item.class, item);
Item beforeUpdateItem = itemService.findOne(entity.getId()); Item beforeUpdateItem = itemService.findOne(entity.getId());
if (beforeUpdateItem != null){
beforeUpdateItem = BeanUtils.transfrom(Item.class, beforeUpdateItem);
}
entity.setDataChangeLastModifiedBy(operator); entity.setDataChangeLastModifiedBy(operator);
Item updatedItem = itemService.update(entity); Item updatedItem = itemService.update(entity);
......
...@@ -51,7 +51,6 @@ public class ConfigController { ...@@ -51,7 +51,6 @@ public class ConfigController {
model.setEnv(env); model.setEnv(env);
model.setNamespaceName(namespaceName); model.setNamespaceName(namespaceName);
configService.updateConfigItemByText(model); configService.updateConfigItemByText(model);
} }
......
...@@ -80,7 +80,7 @@ public class NamespaceController { ...@@ -80,7 +80,7 @@ public class NamespaceController {
@PreAuthorize(value = "@permissionValidator.hasCreateAppNamespacePermission(#appId, #appNamespace)") @PreAuthorize(value = "@permissionValidator.hasCreateAppNamespacePermission(#appId, #appNamespace)")
@RequestMapping(value = "/apps/{appId}/appnamespaces", method = RequestMethod.POST) @RequestMapping(value = "/apps/{appId}/appnamespaces", method = RequestMethod.POST)
public void createAppNamespace(@PathVariable String appId, @RequestBody AppNamespace appNamespace) { public AppNamespace createAppNamespace(@PathVariable String appId, @RequestBody AppNamespace appNamespace) {
checkArgument(appNamespace.getAppId(), appNamespace.getName()); checkArgument(appNamespace.getAppId(), appNamespace.getName());
if (!InputValidator.isValidAppNamespace(appNamespace.getName())) { if (!InputValidator.isValidAppNamespace(appNamespace.getName())) {
...@@ -106,6 +106,7 @@ public class NamespaceController { ...@@ -106,6 +106,7 @@ public class NamespaceController {
publisher.publishEvent(new AppNamespaceCreationEvent(createdAppNamespace)); publisher.publishEvent(new AppNamespaceCreationEvent(createdAppNamespace));
return createdAppNamespace;
} }
@RequestMapping("/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces") @RequestMapping("/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces")
......
...@@ -21,19 +21,20 @@ public class FileTextResolver implements ConfigTextResolver { ...@@ -21,19 +21,20 @@ public class FileTextResolver implements ConfigTextResolver {
return changeSets; return changeSets;
} }
if (CollectionUtils.isEmpty(baseItems)) { if (CollectionUtils.isEmpty(baseItems)) {
changeSets.addCreateItem(createItem(namespaceId, configText)); changeSets.addCreateItem(createItem(namespaceId, 0, configText));
} else { } else {
ItemDTO beforeItem = baseItems.get(0); ItemDTO beforeItem = baseItems.get(0);
if (!configText.equals(beforeItem.getValue())) {//update if (!configText.equals(beforeItem.getValue())) {//update
changeSets.addUpdateItem(createItem(namespaceId, configText)); changeSets.addUpdateItem(createItem(namespaceId, beforeItem.getId(), configText));
} }
} }
return changeSets; return changeSets;
} }
private ItemDTO createItem(long namespaceId, String value) { private ItemDTO createItem(long namespaceId, long itemId, String value) {
ItemDTO item = new ItemDTO(); ItemDTO item = new ItemDTO();
item.setId(itemId);
item.setNamespaceId(namespaceId); item.setNamespaceId(namespaceId);
item.setValue(value); item.setValue(value);
item.setKey(ConfigConsts.CONFIG_FILE_CONTENT_KEY); item.setKey(ConfigConsts.CONFIG_FILE_CONTENT_KEY);
......
...@@ -112,7 +112,7 @@ namespace_module.controller("LinkNamespaceController", ...@@ -112,7 +112,7 @@ namespace_module.controller("LinkNamespaceController",
} else {//private的直接link并且跳转到授权页面 } else {//private的直接link并且跳转到授权页面
$window.location.href = $window.location.href =
"/namespace/role.html?#/appid=" + $scope.appId "/namespace/role.html?#/appid=" + $scope.appId
+ "&namespaceName=" + $scope.appNamespace.name; + "&namespaceName=" + result.name;
} }
}, 1000); }, 1000);
}, function (result) { }, function (result) {
......
...@@ -26,7 +26,7 @@ directive_module.directive('apollonspanel', ...@@ -26,7 +26,7 @@ directive_module.directive('apollonspanel',
LOG: 'log' LOG: 'log'
}; };
var MIN_ROW_SIZE = 30; var MIN_ROW_SIZE = 10;
scope.switchView = switchView; scope.switchView = switchView;
......
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