Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ Apollo 2.5.0
* [Feature: Support ordinary users to modify personal information](https://github.com/apolloconfig/apollo/pull/5511)
* [Feature: Support exporting and importing configurations for specified applications and clusters](https://github.com/apolloconfig/apollo/pull/5517)
* [doc: Add rust apollo client link](https://github.com/apolloconfig/apollo/pull/5514)
* [Perf: optimize namespace-related interface](https://github.com/apolloconfig/apollo/pull/5518)
------------------
All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/16?closed=1)
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ public List<AppNamespace> findPublicAppNamespaces() {
return appNamespaceService.findPublicAppNamespaces();
}

@GetMapping("/appnamespaces/public/names")
public List<String> findPublicAppNamespaceNames() {
return appNamespaceService.findPublicAppNamespaceNames();
}

@GetMapping("/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces")
public List<NamespaceBO> findNamespaces(@PathVariable String appId, @PathVariable String env,
@PathVariable String clusterName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public interface AppNamespaceRepository extends PagingAndSortingRepository<AppNa

List<AppNamespace> findByIsPublicTrue();

@Query("SELECT a.name FROM AppNamespace a WHERE a.isPublic = true AND a.isDeleted = false")
List<String> findNamesByIsPublicTrue();

List<AppNamespace> findByAppId(String appId);

@Modifying
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public List<AppNamespace> findPublicAppNamespaces() {
return appNamespaceRepository.findByIsPublicTrue();
}

public List<String> findPublicAppNamespaceNames() {
return appNamespaceRepository.findNamesByIsPublicTrue();
}

public AppNamespace findPublicAppNamespace(String namespaceName) {
List<AppNamespace> appNamespaces =
appNamespaceRepository.findByNameAndIsPublic(namespaceName, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ namespace_module.controller("LinkNamespaceController",
$scope.pageSetting = setting;
});

NamespaceService.find_public_namespaces().then(function (result) {
NamespaceService.findPublicNamespaceNames().then(function (result) {
var publicNamespaces = [];
result.forEach(function (item) {
var namespace = {};
namespace.id = item.name;
namespace.text = item.name;
namespace.id = item;
namespace.text = item;
publicNamespaces.push(namespace);
});
$('#namespaces').select2({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ appService.service("NamespaceService", ['$resource', '$q', 'AppUtil', function (
method: 'GET',
url: AppUtil.prefixPath() + '/apps/:appId/namespaces/:namespaceName/usage',
isArray: true
},
findPublicNamespaceNames: {
method: 'GET',
isArray: true,
url: AppUtil.prefixPath() + '/appnamespaces/public/names'
}
});

Expand Down Expand Up @@ -211,6 +216,16 @@ appService.service("NamespaceService", ['$resource', '$q', 'AppUtil', function (
return d.promise;
}

function findPublicNamespaceNames() {
var d = $q.defer();
namespace_source.findPublicNamespaceNames({}, function (result) {
d.resolve(result);
}, function (result) {
d.reject(result);
});
return d.promise;
}

return {
find_public_namespaces: find_public_namespaces,
createNamespace: createNamespace,
Expand All @@ -221,7 +236,8 @@ appService.service("NamespaceService", ['$resource', '$q', 'AppUtil', function (
loadAppNamespace: loadAppNamespace,
deleteAppNamespace: deleteAppNamespace,
getLinkedNamespaceUsage: getLinkedNamespaceUsage,
getNamespaceUsage: getNamespaceUsage
getNamespaceUsage: getNamespaceUsage,
findPublicNamespaceNames: findPublicNamespaceNames
}

}]);
Loading