repo_name stringclasses 5 values | pr_number int64 1.52k 15.5k | pr_title stringlengths 8 143 | pr_description stringlengths 0 10.2k | author stringlengths 3 18 | date_created timestamp[ns, tz=UTC] | date_merged timestamp[ns, tz=UTC] | previous_commit stringlengths 40 40 | pr_commit stringlengths 40 40 | query stringlengths 11 10.2k | filepath stringlengths 6 220 | before_content stringlengths 0 597M | after_content stringlengths 0 597M | label int64 -1 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/resources/static/views/component/entrance.html | <a class="list-group-item hover" href="{{href}}">
<!--
~ Copyright 2021 Apollo Authors
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<div class="row icon-text icon-{{imgSrc}}">
<p class="btn-title">{{title}}</p>
</div>
</a>
| <a class="list-group-item hover" href="{{href}}">
<!--
~ Copyright 2021 Apollo Authors
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<div class="row icon-text icon-{{imgSrc}}">
<p class="btn-title">{{title}}</p>
</div>
</a>
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/resources/static/scripts/controller/role/NamespaceRoleController.js | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
role_module.controller('NamespaceRoleController',
['$scope', '$location', '$window', '$translate', 'toastr', 'AppService', 'UserService', 'AppUtil', 'EnvService',
'PermissionService',
function ($scope, $location, $window, $translate, toastr, AppService, UserService, AppUtil, EnvService,
PermissionService) {
var params = AppUtil.parseParams($location.$$url);
$scope.pageContext = {
appId: params.appid,
namespaceName: params.namespaceName
};
$scope.modifyRoleSubmitBtnDisabled = false;
$scope.ReleaseRoleSubmitBtnDisabled = false;
$scope.releaseRoleWidgetId = 'releaseRoleWidgetId';
$scope.modifyRoleWidgetId = 'modifyRoleWidgetId';
$scope.modifyRoleSelectedEnv = "";
$scope.releaseRoleSelectedEnv = "";
PermissionService.init_app_namespace_permission($scope.pageContext.appId, $scope.pageContext.namespaceName)
.then(function (result) {
}, function (result) {
toastr.warn(AppUtil.errorMsg(result), $translate.instant('Namespace.Role.InitNamespacePermissionError'));
});
PermissionService.has_assign_user_permission($scope.pageContext.appId)
.then(function (result) {
$scope.hasAssignUserPermission = result.hasPermission;
}, function (reslt) {
});
EnvService.find_all_envs()
.then(function (result) {
$scope.envs = result;
$scope.envRolesAssignedUsers = {};
for (var iLoop = 0; iLoop < result.length; iLoop++) {
var env = result[iLoop];
PermissionService.get_namespace_env_role_users($scope.pageContext.appId, env, $scope.pageContext.namespaceName)
.then(function (result) {
$scope.envRolesAssignedUsers[result.env] = result;
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Namespace.Role.GetEnvGrantUserError', { env }));
});
}
});
PermissionService.get_namespace_role_users($scope.pageContext.appId,
$scope.pageContext.namespaceName)
.then(function (result) {
$scope.rolesAssignedUsers = result;
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Namespace.Role.GetGrantUserError'));
});
$scope.assignRoleToUser = function (roleType) {
if ("ReleaseNamespace" === roleType) {
var user = $('.' + $scope.releaseRoleWidgetId).select2('data')[0];
if (!user) {
toastr.warning($translate.instant('Namespace.Role.PleaseChooseUser'));
return;
}
$scope.ReleaseRoleSubmitBtnDisabled = true;
var toAssignReleaseNamespaceRoleUser = user.id;
var assignReleaseNamespaceRoleFunc = $scope.releaseRoleSelectedEnv === "" ?
PermissionService.assign_release_namespace_role :
function (appId, namespaceName, user) {
return PermissionService.assign_release_namespace_env_role(appId, $scope.releaseRoleSelectedEnv, namespaceName, user);
};
assignReleaseNamespaceRoleFunc($scope.pageContext.appId,
$scope.pageContext.namespaceName,
toAssignReleaseNamespaceRoleUser)
.then(function (result) {
toastr.success($translate.instant('Namespace.Role.Added'));
$scope.ReleaseRoleSubmitBtnDisabled = false;
if ($scope.releaseRoleSelectedEnv === "") {
$scope.rolesAssignedUsers.releaseRoleUsers.push(
{ userId: toAssignReleaseNamespaceRoleUser });
} else {
$scope.envRolesAssignedUsers[$scope.releaseRoleSelectedEnv].releaseRoleUsers.push(
{ userId: toAssignReleaseNamespaceRoleUser });
}
$('.' + $scope.releaseRoleWidgetId).select2("val", "");
$scope.releaseRoleSelectedEnv = "";
}, function (result) {
$scope.ReleaseRoleSubmitBtnDisabled = false;
toastr.error(AppUtil.errorMsg(result), $translate.instant('Namespace.Role.AddFailed'));
});
} else {
var user = $('.' + $scope.modifyRoleWidgetId).select2('data')[0];
if (!user) {
toastr.warning($translate.instant('Namespace.Role.PleaseChooseUser'));
return;
}
$scope.modifyRoleSubmitBtnDisabled = true;
var toAssignModifyNamespaceRoleUser = user.id;
var assignModifyNamespaceRoleFunc = $scope.modifyRoleSelectedEnv === "" ?
PermissionService.assign_modify_namespace_role :
function (appId, namespaceName, user) {
return PermissionService.assign_modify_namespace_env_role(appId, $scope.modifyRoleSelectedEnv, namespaceName, user);
};
assignModifyNamespaceRoleFunc($scope.pageContext.appId,
$scope.pageContext.namespaceName,
toAssignModifyNamespaceRoleUser)
.then(function (result) {
toastr.success($translate.instant('Namespace.Role.Added'));
$scope.modifyRoleSubmitBtnDisabled = false;
if ($scope.modifyRoleSelectedEnv === "") {
$scope.rolesAssignedUsers.modifyRoleUsers.push(
{ userId: toAssignModifyNamespaceRoleUser });
} else {
$scope.envRolesAssignedUsers[$scope.modifyRoleSelectedEnv].modifyRoleUsers.push(
{ userId: toAssignModifyNamespaceRoleUser });
}
$('.' + $scope.modifyRoleWidgetId).select2("val", "");
$scope.modifyRoleSelectedEnv = "";
}, function (result) {
$scope.modifyRoleSubmitBtnDisabled = false;
toastr.error(AppUtil.errorMsg(result), $translate.instant('Namespace.Role.AddFailed'));
});
}
};
$scope.removeUserRole = function (roleType, user, env) {
if ("ReleaseNamespace" === roleType) {
var removeReleaseNamespaceRoleFunc = !env ?
PermissionService.remove_release_namespace_role :
function (appId, namespaceName, user) {
return PermissionService.remove_release_namespace_env_role(appId, env, namespaceName, user);
};
removeReleaseNamespaceRoleFunc($scope.pageContext.appId,
$scope.pageContext.namespaceName,
user)
.then(function (result) {
toastr.success($translate.instant('Namespace.Role.Deleted'));
if (!env) {
removeUserFromList($scope.rolesAssignedUsers.releaseRoleUsers, user);
} else {
removeUserFromList($scope.envRolesAssignedUsers[env].releaseRoleUsers, user);
}
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Namespace.Role.DeleteFailed'));
});
} else {
var removeModifyNamespaceRoleFunc = !env ?
PermissionService.remove_modify_namespace_role :
function (appId, namespaceName, user) {
return PermissionService.remove_modify_namespace_env_role(appId, env, namespaceName, user);
};
removeModifyNamespaceRoleFunc($scope.pageContext.appId,
$scope.pageContext.namespaceName,
user)
.then(function (result) {
toastr.success($translate.instant('Namespace.Role.Deleted'));
if (!env) {
removeUserFromList($scope.rolesAssignedUsers.modifyRoleUsers, user);
} else {
removeUserFromList($scope.envRolesAssignedUsers[env].modifyRoleUsers, user);
}
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Namespace.Role.DeleteFailed'));
});
}
};
function removeUserFromList(list, user) {
var index = 0;
for (var i = 0; i < list.length; i++) {
if (list[i].userId === user) {
index = i;
break;
}
}
list.splice(index, 1);
}
}]);
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
role_module.controller('NamespaceRoleController',
['$scope', '$location', '$window', '$translate', 'toastr', 'AppService', 'UserService', 'AppUtil', 'EnvService',
'PermissionService',
function ($scope, $location, $window, $translate, toastr, AppService, UserService, AppUtil, EnvService,
PermissionService) {
var params = AppUtil.parseParams($location.$$url);
$scope.pageContext = {
appId: params.appid,
namespaceName: params.namespaceName
};
$scope.modifyRoleSubmitBtnDisabled = false;
$scope.ReleaseRoleSubmitBtnDisabled = false;
$scope.releaseRoleWidgetId = 'releaseRoleWidgetId';
$scope.modifyRoleWidgetId = 'modifyRoleWidgetId';
$scope.modifyRoleSelectedEnv = "";
$scope.releaseRoleSelectedEnv = "";
PermissionService.init_app_namespace_permission($scope.pageContext.appId, $scope.pageContext.namespaceName)
.then(function (result) {
}, function (result) {
toastr.warn(AppUtil.errorMsg(result), $translate.instant('Namespace.Role.InitNamespacePermissionError'));
});
PermissionService.has_assign_user_permission($scope.pageContext.appId)
.then(function (result) {
$scope.hasAssignUserPermission = result.hasPermission;
}, function (reslt) {
});
EnvService.find_all_envs()
.then(function (result) {
$scope.envs = result;
$scope.envRolesAssignedUsers = {};
for (var iLoop = 0; iLoop < result.length; iLoop++) {
var env = result[iLoop];
PermissionService.get_namespace_env_role_users($scope.pageContext.appId, env, $scope.pageContext.namespaceName)
.then(function (result) {
$scope.envRolesAssignedUsers[result.env] = result;
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Namespace.Role.GetEnvGrantUserError', { env }));
});
}
});
PermissionService.get_namespace_role_users($scope.pageContext.appId,
$scope.pageContext.namespaceName)
.then(function (result) {
$scope.rolesAssignedUsers = result;
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Namespace.Role.GetGrantUserError'));
});
$scope.assignRoleToUser = function (roleType) {
if ("ReleaseNamespace" === roleType) {
var user = $('.' + $scope.releaseRoleWidgetId).select2('data')[0];
if (!user) {
toastr.warning($translate.instant('Namespace.Role.PleaseChooseUser'));
return;
}
$scope.ReleaseRoleSubmitBtnDisabled = true;
var toAssignReleaseNamespaceRoleUser = user.id;
var assignReleaseNamespaceRoleFunc = $scope.releaseRoleSelectedEnv === "" ?
PermissionService.assign_release_namespace_role :
function (appId, namespaceName, user) {
return PermissionService.assign_release_namespace_env_role(appId, $scope.releaseRoleSelectedEnv, namespaceName, user);
};
assignReleaseNamespaceRoleFunc($scope.pageContext.appId,
$scope.pageContext.namespaceName,
toAssignReleaseNamespaceRoleUser)
.then(function (result) {
toastr.success($translate.instant('Namespace.Role.Added'));
$scope.ReleaseRoleSubmitBtnDisabled = false;
if ($scope.releaseRoleSelectedEnv === "") {
$scope.rolesAssignedUsers.releaseRoleUsers.push(
{ userId: toAssignReleaseNamespaceRoleUser });
} else {
$scope.envRolesAssignedUsers[$scope.releaseRoleSelectedEnv].releaseRoleUsers.push(
{ userId: toAssignReleaseNamespaceRoleUser });
}
$('.' + $scope.releaseRoleWidgetId).select2("val", "");
$scope.releaseRoleSelectedEnv = "";
}, function (result) {
$scope.ReleaseRoleSubmitBtnDisabled = false;
toastr.error(AppUtil.errorMsg(result), $translate.instant('Namespace.Role.AddFailed'));
});
} else {
var user = $('.' + $scope.modifyRoleWidgetId).select2('data')[0];
if (!user) {
toastr.warning($translate.instant('Namespace.Role.PleaseChooseUser'));
return;
}
$scope.modifyRoleSubmitBtnDisabled = true;
var toAssignModifyNamespaceRoleUser = user.id;
var assignModifyNamespaceRoleFunc = $scope.modifyRoleSelectedEnv === "" ?
PermissionService.assign_modify_namespace_role :
function (appId, namespaceName, user) {
return PermissionService.assign_modify_namespace_env_role(appId, $scope.modifyRoleSelectedEnv, namespaceName, user);
};
assignModifyNamespaceRoleFunc($scope.pageContext.appId,
$scope.pageContext.namespaceName,
toAssignModifyNamespaceRoleUser)
.then(function (result) {
toastr.success($translate.instant('Namespace.Role.Added'));
$scope.modifyRoleSubmitBtnDisabled = false;
if ($scope.modifyRoleSelectedEnv === "") {
$scope.rolesAssignedUsers.modifyRoleUsers.push(
{ userId: toAssignModifyNamespaceRoleUser });
} else {
$scope.envRolesAssignedUsers[$scope.modifyRoleSelectedEnv].modifyRoleUsers.push(
{ userId: toAssignModifyNamespaceRoleUser });
}
$('.' + $scope.modifyRoleWidgetId).select2("val", "");
$scope.modifyRoleSelectedEnv = "";
}, function (result) {
$scope.modifyRoleSubmitBtnDisabled = false;
toastr.error(AppUtil.errorMsg(result), $translate.instant('Namespace.Role.AddFailed'));
});
}
};
$scope.removeUserRole = function (roleType, user, env) {
if ("ReleaseNamespace" === roleType) {
var removeReleaseNamespaceRoleFunc = !env ?
PermissionService.remove_release_namespace_role :
function (appId, namespaceName, user) {
return PermissionService.remove_release_namespace_env_role(appId, env, namespaceName, user);
};
removeReleaseNamespaceRoleFunc($scope.pageContext.appId,
$scope.pageContext.namespaceName,
user)
.then(function (result) {
toastr.success($translate.instant('Namespace.Role.Deleted'));
if (!env) {
removeUserFromList($scope.rolesAssignedUsers.releaseRoleUsers, user);
} else {
removeUserFromList($scope.envRolesAssignedUsers[env].releaseRoleUsers, user);
}
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Namespace.Role.DeleteFailed'));
});
} else {
var removeModifyNamespaceRoleFunc = !env ?
PermissionService.remove_modify_namespace_role :
function (appId, namespaceName, user) {
return PermissionService.remove_modify_namespace_env_role(appId, env, namespaceName, user);
};
removeModifyNamespaceRoleFunc($scope.pageContext.appId,
$scope.pageContext.namespaceName,
user)
.then(function (result) {
toastr.success($translate.instant('Namespace.Role.Deleted'));
if (!env) {
removeUserFromList($scope.rolesAssignedUsers.modifyRoleUsers, user);
} else {
removeUserFromList($scope.envRolesAssignedUsers[env].modifyRoleUsers, user);
}
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Namespace.Role.DeleteFailed'));
});
}
};
function removeUserFromList(list, user) {
var index = 0;
for (var i = 0; i < list.length; i++) {
if (list[i].userId === user) {
index = i;
break;
}
}
list.splice(index, 1);
}
}]);
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/resources/static/scripts/controller/AppController.js | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
app_module.controller('CreateAppController',
['$scope', '$window', '$translate', 'toastr', 'AppService', 'AppUtil', 'OrganizationService', 'SystemRoleService', 'UserService',
createAppController]);
function createAppController($scope, $window, $translate, toastr, AppService, AppUtil, OrganizationService, SystemRoleService, UserService) {
$scope.app = {};
$scope.submitBtnDisabled = false;
$scope.create = create;
init();
function init() {
initOrganization();
initSystemRole();
}
function initOrganization() {
OrganizationService.find_organizations().then(function (result) {
var organizations = [];
result.forEach(function (item) {
var org = {};
org.id = item.orgId;
org.text = item.orgName + '(' + item.orgId + ')';
org.name = item.orgName;
organizations.push(org);
});
$('#organization').select2({
placeholder: $translate.instant('Common.PleaseChooseDepartment'),
width: '100%',
data: organizations
});
}, function (result) {
toastr.error(AppUtil.errorMsg(result), "load organizations error");
});
}
function initSystemRole() {
SystemRoleService.has_open_manage_app_master_role_limit().then(
function (value) {
$scope.isOpenManageAppMasterRoleLimit = value.isManageAppMasterPermissionEnabled;
UserService.load_user().then(
function (value1) {
$scope.currentUser = value1;
},
function (reason) {
toastr.error(AppUtil.errorMsg(reason), "load current user info failed");
})
},
function (reason) {
toastr.error(AppUtil.errorMsg(reason), "init system role of manageAppMaster failed");
}
);
}
function create() {
$scope.submitBtnDisabled = true;
var selectedOrg = $('#organization').select2('data')[0];
if (!selectedOrg.id) {
toastr.warning($translate.instant('Common.PleaseChooseDepartment'));
$scope.submitBtnDisabled = false;
return;
}
$scope.app.orgId = selectedOrg.id;
$scope.app.orgName = selectedOrg.name;
// owner
var owner = $('.ownerSelector').select2('data')[0];
if ($scope.isOpenManageAppMasterRoleLimit) {
owner = { id: $scope.currentUser.userId };
}
if (!owner) {
toastr.warning($translate.instant('Common.PleaseChooseOwner'));
$scope.submitBtnDisabled = false;
return;
}
$scope.app.ownerName = owner.id;
//admins
$scope.app.admins = [];
var admins = $(".adminSelector").select2('data');
if ($scope.isOpenManageAppMasterRoleLimit) {
admins = [{ id: $scope.currentUser.userId }];
}
if (admins) {
admins.forEach(function (admin) {
$scope.app.admins.push(admin.id);
})
}
AppService.create($scope.app).then(function (result) {
toastr.success($translate.instant('Common.Created'));
setInterval(function () {
$scope.submitBtnDisabled = false;
$window.location.href = AppUtil.prefixPath() + '/config.html?#appid=' + result.appId;
}, 1000);
}, function (result) {
$scope.submitBtnDisabled = false;
toastr.error(AppUtil.errorMsg(result), $translate.instant('Common.CreateFailed'));
});
}
$(".J_ownerSelectorPanel").on("select2:select", ".ownerSelector", selectEventHandler);
var $adminSelectorPanel = $(".J_adminSelectorPanel");
$adminSelectorPanel.on("select2:select", ".adminSelector", selectEventHandler);
$adminSelectorPanel.on("select2:unselect", ".adminSelector", selectEventHandler);
function selectEventHandler() {
$('.J_owner').remove();
var owner = $('.ownerSelector').select2('data')[0];
if (owner) {
$(".adminSelector").parent().find(".select2-selection__rendered").prepend(
'<li class="select2-selection__choice J_owner">'
+ _.escape(owner.text) + '</li>')
}
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
app_module.controller('CreateAppController',
['$scope', '$window', '$translate', 'toastr', 'AppService', 'AppUtil', 'OrganizationService', 'SystemRoleService', 'UserService',
createAppController]);
function createAppController($scope, $window, $translate, toastr, AppService, AppUtil, OrganizationService, SystemRoleService, UserService) {
$scope.app = {};
$scope.submitBtnDisabled = false;
$scope.create = create;
init();
function init() {
initOrganization();
initSystemRole();
}
function initOrganization() {
OrganizationService.find_organizations().then(function (result) {
var organizations = [];
result.forEach(function (item) {
var org = {};
org.id = item.orgId;
org.text = item.orgName + '(' + item.orgId + ')';
org.name = item.orgName;
organizations.push(org);
});
$('#organization').select2({
placeholder: $translate.instant('Common.PleaseChooseDepartment'),
width: '100%',
data: organizations
});
}, function (result) {
toastr.error(AppUtil.errorMsg(result), "load organizations error");
});
}
function initSystemRole() {
SystemRoleService.has_open_manage_app_master_role_limit().then(
function (value) {
$scope.isOpenManageAppMasterRoleLimit = value.isManageAppMasterPermissionEnabled;
UserService.load_user().then(
function (value1) {
$scope.currentUser = value1;
},
function (reason) {
toastr.error(AppUtil.errorMsg(reason), "load current user info failed");
})
},
function (reason) {
toastr.error(AppUtil.errorMsg(reason), "init system role of manageAppMaster failed");
}
);
}
function create() {
$scope.submitBtnDisabled = true;
var selectedOrg = $('#organization').select2('data')[0];
if (!selectedOrg.id) {
toastr.warning($translate.instant('Common.PleaseChooseDepartment'));
$scope.submitBtnDisabled = false;
return;
}
$scope.app.orgId = selectedOrg.id;
$scope.app.orgName = selectedOrg.name;
// owner
var owner = $('.ownerSelector').select2('data')[0];
if ($scope.isOpenManageAppMasterRoleLimit) {
owner = { id: $scope.currentUser.userId };
}
if (!owner) {
toastr.warning($translate.instant('Common.PleaseChooseOwner'));
$scope.submitBtnDisabled = false;
return;
}
$scope.app.ownerName = owner.id;
//admins
$scope.app.admins = [];
var admins = $(".adminSelector").select2('data');
if ($scope.isOpenManageAppMasterRoleLimit) {
admins = [{ id: $scope.currentUser.userId }];
}
if (admins) {
admins.forEach(function (admin) {
$scope.app.admins.push(admin.id);
})
}
AppService.create($scope.app).then(function (result) {
toastr.success($translate.instant('Common.Created'));
setInterval(function () {
$scope.submitBtnDisabled = false;
$window.location.href = AppUtil.prefixPath() + '/config.html?#appid=' + result.appId;
}, 1000);
}, function (result) {
$scope.submitBtnDisabled = false;
toastr.error(AppUtil.errorMsg(result), $translate.instant('Common.CreateFailed'));
});
}
$(".J_ownerSelectorPanel").on("select2:select", ".ownerSelector", selectEventHandler);
var $adminSelectorPanel = $(".J_adminSelectorPanel");
$adminSelectorPanel.on("select2:select", ".adminSelector", selectEventHandler);
$adminSelectorPanel.on("select2:unselect", ".adminSelector", selectEventHandler);
function selectEventHandler() {
$('.J_owner').remove();
var owner = $('.ownerSelector').select2('data')[0];
if (owner) {
$(".adminSelector").parent().find(".select2-selection__rendered").prepend(
'<li class="select2-selection__choice J_owner">'
+ _.escape(owner.text) + '</li>')
}
}
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./docs/en/deployment/quick-start.md | TODO
| TODO
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./changes/changes-1.9.1.md | Changes by Version
==================
Release Notes.
Apollo 1.9.1
------------------
* [Remove spring dependencies from internal code](https://github.com/apolloconfig/apollo/pull/3937)
* [Fix issue: ingress syntax](https://github.com/apolloconfig/apollo/pull/3933)
------------------
All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/9?closed=1)
| Changes by Version
==================
Release Notes.
Apollo 1.9.1
------------------
* [Remove spring dependencies from internal code](https://github.com/apolloconfig/apollo/pull/3937)
* [Fix issue: ingress syntax](https://github.com/apolloconfig/apollo/pull/3933)
------------------
All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/9?closed=1)
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/resources/static/scripts/controller/config/DiffConfigController.js | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
diff_item_module.controller("DiffItemController",
['$scope', '$location', '$window', '$translate', 'toastr', 'AppService', 'AppUtil', 'ConfigService',
function ($scope, $location, $window, $translate, toastr, AppService, AppUtil, ConfigService) {
var params = AppUtil.parseParams($location.$$url);
$scope.pageContext = {
appId: params.appid,
env: params.env,
clusterName: params.clusterName,
namespaceName: params.namespaceName
};
var sourceItems = [];
$scope.diff = diff;
$scope.syncBtnDisabled = false;
$scope.showCommentDiff = false;
$scope.collectSelectedClusters = collectSelectedClusters;
$scope.syncItemNextStep = syncItemNextStep;
$scope.backToAppHomePage = backToAppHomePage;
$scope.switchSelect = switchSelect;
$scope.showText = showText;
$scope.itemsKeyedByKey = {};
$scope.syncData = {
syncToNamespaces: [],
syncItems: []
};
function diff() {
$scope.syncData = parseSyncSourceData();
if ($scope.syncData.syncToNamespaces.length < 2) {
toastr.warning($translate.instant('Config.Diff.PleaseChooseTwoCluster'));
return;
}
$scope.syncData.syncToNamespaces.forEach(function (namespace) {
ConfigService.find_items(namespace.appId,
namespace.env,
namespace.clusterName,
namespace.namespaceName).then(function (result) {
result.forEach(function (item) {
var itemsKeyedByClusterName = $scope.itemsKeyedByKey[item.key] || {};
itemsKeyedByClusterName[namespace.env + ':' + namespace.clusterName + ':' + namespace.namespaceName] = item;
$scope.itemsKeyedByKey[item.key] = itemsKeyedByClusterName;
});
});
});
$scope.syncItemNextStep(1);
}
var selectedClusters = [];
function collectSelectedClusters(data) {
selectedClusters = data;
}
function parseSyncSourceData() {
var syncData = {
syncToNamespaces: [],
syncItems: []
};
var namespaceName = $scope.pageContext.namespaceName;
selectedClusters.forEach(function (cluster) {
if (cluster.checked) {
cluster.clusterName = cluster.name;
cluster.namespaceName = namespaceName;
syncData.syncToNamespaces.push(cluster);
}
});
return syncData;
}
////// flow control ///////
$scope.syncItemStep = 1;
function syncItemNextStep(offset) {
$scope.syncItemStep += offset;
}
function backToAppHomePage() {
$window.location.href = AppUtil.prefixPath() + '/config.html?#appid=' + $scope.pageContext.appId;
}
function switchSelect(o) {
o.checked = !o.checked;
}
function showText(text) {
$scope.text = text;
AppUtil.showModal('#showTextModal');
}
}]);
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
diff_item_module.controller("DiffItemController",
['$scope', '$location', '$window', '$translate', 'toastr', 'AppService', 'AppUtil', 'ConfigService',
function ($scope, $location, $window, $translate, toastr, AppService, AppUtil, ConfigService) {
var params = AppUtil.parseParams($location.$$url);
$scope.pageContext = {
appId: params.appid,
env: params.env,
clusterName: params.clusterName,
namespaceName: params.namespaceName
};
var sourceItems = [];
$scope.diff = diff;
$scope.syncBtnDisabled = false;
$scope.showCommentDiff = false;
$scope.collectSelectedClusters = collectSelectedClusters;
$scope.syncItemNextStep = syncItemNextStep;
$scope.backToAppHomePage = backToAppHomePage;
$scope.switchSelect = switchSelect;
$scope.showText = showText;
$scope.itemsKeyedByKey = {};
$scope.syncData = {
syncToNamespaces: [],
syncItems: []
};
function diff() {
$scope.syncData = parseSyncSourceData();
if ($scope.syncData.syncToNamespaces.length < 2) {
toastr.warning($translate.instant('Config.Diff.PleaseChooseTwoCluster'));
return;
}
$scope.syncData.syncToNamespaces.forEach(function (namespace) {
ConfigService.find_items(namespace.appId,
namespace.env,
namespace.clusterName,
namespace.namespaceName).then(function (result) {
result.forEach(function (item) {
var itemsKeyedByClusterName = $scope.itemsKeyedByKey[item.key] || {};
itemsKeyedByClusterName[namespace.env + ':' + namespace.clusterName + ':' + namespace.namespaceName] = item;
$scope.itemsKeyedByKey[item.key] = itemsKeyedByClusterName;
});
});
});
$scope.syncItemNextStep(1);
}
var selectedClusters = [];
function collectSelectedClusters(data) {
selectedClusters = data;
}
function parseSyncSourceData() {
var syncData = {
syncToNamespaces: [],
syncItems: []
};
var namespaceName = $scope.pageContext.namespaceName;
selectedClusters.forEach(function (cluster) {
if (cluster.checked) {
cluster.clusterName = cluster.name;
cluster.namespaceName = namespaceName;
syncData.syncToNamespaces.push(cluster);
}
});
return syncData;
}
////// flow control ///////
$scope.syncItemStep = 1;
function syncItemNextStep(offset) {
$scope.syncItemStep += offset;
}
function backToAppHomePage() {
$window.location.href = AppUtil.prefixPath() + '/config.html?#appid=' + $scope.pageContext.appId;
}
function switchSelect(o) {
o.checked = !o.checked;
}
function showText(text) {
$scope.text = text;
AppUtil.showModal('#showTextModal');
}
}]);
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/resources/static/scripts/services/ServerConfigService.js | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
appService.service('ServerConfigService', ['$resource', '$q', 'AppUtil', function ($resource, $q, AppUtil) {
var server_config_resource = $resource('', {}, {
create_server_config: {
method: 'POST',
url: AppUtil.prefixPath() + '/server/config'
},
get_server_config_info: {
method: 'GET',
url: AppUtil.prefixPath() + '/server/config/:key'
}
});
return {
create: function (serverConfig) {
var d = $q.defer();
server_config_resource.create_server_config({}, serverConfig, function (result) {
d.resolve(result);
}, function (result) {
d.reject(result);
});
return d.promise;
},
getServerConfigInfo: function (key) {
var d = $q.defer();
server_config_resource.get_server_config_info({
key: key
}, function (result) {
d.resolve(result);
}, function (result) {
d.reject(result);
});
return d.promise;
}
}
}]);
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
appService.service('ServerConfigService', ['$resource', '$q', 'AppUtil', function ($resource, $q, AppUtil) {
var server_config_resource = $resource('', {}, {
create_server_config: {
method: 'POST',
url: AppUtil.prefixPath() + '/server/config'
},
get_server_config_info: {
method: 'GET',
url: AppUtil.prefixPath() + '/server/config/:key'
}
});
return {
create: function (serverConfig) {
var d = $q.defer();
server_config_resource.create_server_config({}, serverConfig, function (result) {
d.resolve(result);
}, function (result) {
d.reject(result);
});
return d.promise;
},
getServerConfigInfo: function (key) {
var d = $q.defer();
server_config_resource.get_server_config_info({
key: key
}, function (result) {
d.resolve(result);
}, function (result) {
d.reject(result);
});
return d.promise;
}
}
}]);
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./docs/en/usage/apollo-user-guide.md | TODO
| TODO
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./docs/en/design/apollo-introduction.md | TODO
| TODO
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/resources/static/vendor/ui-ace/worker-json.js | "no use strict";!function(e){function t(e,t){var n=e,r="";while(n){var i=t[n];if(typeof i=="string")return i+r;if(i)return i.location.replace(/\/*$/,"/")+(r||i.main||i.name);if(i===!1)return"";var s=n.lastIndexOf("/");if(s===-1)break;r=n.substr(s)+r,n=n.slice(0,s)}return e}if(typeof e.window!="undefined"&&e.document)return;if(e.require&&e.define)return;e.console||(e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console),e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){postMessage({type:"error",data:{message:e,data:i.data,file:t,line:n,col:r,stack:i.stack}})},e.normalizeModule=function(t,n){if(n.indexOf("!")!==-1){var r=n.split("!");return e.normalizeModule(t,r[0])+"!"+e.normalizeModule(t,r[1])}if(n.charAt(0)=="."){var i=t.split("/").slice(0,-1).join("/");n=(i?i+"/":"")+n;while(n.indexOf(".")!==-1&&s!=n){var s=n;n=n.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return n},e.require=function(r,i){i||(i=r,r=null);if(!i.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");i=e.normalizeModule(r,i);var s=e.require.modules[i];if(s)return s.initialized||(s.initialized=!0,s.exports=s.factory().exports),s.exports;if(!e.require.tlns)return console.log("unable to load "+i);var o=t(i,e.require.tlns);return o.slice(-3)!=".js"&&(o+=".js"),e.require.id=i,e.require.modules[i]={},importScripts(o),e.require(r,i)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){arguments.length==2?(r=n,typeof t!="string"&&(n=t,t=e.require.id)):arguments.length==1&&(r=t,n=[],t=e.require.id);if(typeof r!="function"){e.require.modules[t]={exports:r,initialized:!0};return}n.length||(n=["require","exports","module"]);var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.map(function(t){switch(t){case"require":return i;case"exports":return e.exports;case"module":return e;default:return i(t)}}));return t&&(e.exports=t),e}}},e.define.amd={},require.tlns={},e.initBaseUrls=function(t){for(var n in t)require.tlns[n]=t[n]},e.initSender=function(){var n=e.require("ace/lib/event_emitter").EventEmitter,r=e.require("ace/lib/oop"),i=function(){};return function(){r.implement(this,n),this.callback=function(e,t){postMessage({type:"call",id:t,data:e})},this.emit=function(e,t){postMessage({type:"event",name:e,data:t})}}.call(i.prototype),new i};var n=e.main=null,r=e.sender=null;e.onmessage=function(t){var i=t.data;if(i.event&&r)r._signal(i.event,i.data);else if(i.command)if(n[i.command])n[i.command].apply(n,i.args);else{if(!e[i.command])throw new Error("Unknown command:"+i.command);e[i.command].apply(e,i.args)}else if(i.init){e.initBaseUrls(i.tlns),require("ace/lib/es5-shim"),r=e.sender=e.initSender();var s=require(i.module)[i.classname];n=e.main=new s(r)}}}(this),define("ace/lib/oop",["require","exports","module"],function(e,t,n){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define("ace/range",["require","exports","module"],function(e,t,n){"use strict";var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e=="object"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e=="object"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?t<this.start.column?-1:t>this.end.column?1:0:e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.row<e)var n={row:e,column:0};if(this.start.row>t)var r={row:t+1,column:0};else if(this.start.row<e)var r={row:e,column:0};return i.fromPoints(r||this.start,n||this.end)},this.extend=function(e,t){var n=this.compare(e,t);if(n==0)return this;if(n==-1)var r={row:e,column:t};else var s={row:e,column:t};return i.fromPoints(r||this.start,s||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return i.fromPoints(this.start,this.end)},this.collapseRows=function(){return this.end.column==0?new i(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new i(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),n=e.documentToScreenPosition(this.end);return new i(t.row,t.column,n.row,n.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(i.prototype),i.fromPoints=function(e,t){return new i(e.row,e.column,t.row,t.column)},i.comparePoints=r,i.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=i}),define("ace/apply_delta",["require","exports","module"],function(e,t,n){"use strict";function r(e,t){throw console.log("Invalid Delta:",e),"Invalid Delta: "+t}function i(e,t){return t.row>=0&&t.row<e.length&&t.column>=0&&t.column<=e[t.row].length}function s(e,t){t.action!="insert"&&t.action!="remove"&&r(t,"delta.action must be 'insert' or 'remove'"),t.lines instanceof Array||r(t,"delta.lines must be an Array"),(!t.start||!t.end)&&r(t,"delta.start/end must be an present");var n=t.start;i(e,t.start)||r(t,"delta.start must be contained in document");var s=t.end;t.action=="remove"&&!i(e,s)&&r(t,"delta.end must contained in document for 'remove' actions");var o=s.row-n.row,u=s.column-(o==0?n.column:0);(o!=t.lines.length-1||t.lines[o].length!=u)&&r(t,"delta.range must match delta lines")}t.applyDelta=function(e,t,n){var r=t.start.row,i=t.start.column,s=e[r]||"";switch(t.action){case"insert":var o=t.lines;if(o.length===1)e[r]=s.substring(0,i)+t.lines[0]+s.substring(i);else{var u=[r,1].concat(t.lines);e.splice.apply(e,u),e[r]=s.substring(0,i)+e[r],e[r+t.lines.length-1]+=s.substring(i)}break;case"remove":var a=t.end.column,f=t.end.row;r===f?e[r]=s.substring(0,i)+s.substring(a):e.splice(r,f-r+1,s.substring(0,i)+e[f].substring(a))}}}),define("ace/lib/event_emitter",["require","exports","module"],function(e,t,n){"use strict";var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!="object"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;o<n.length;o++){n[o](t,this);if(t.propagationStopped)break}if(r&&!t.defaultPrevented)return r(t,this)},r._signal=function(e,t){var n=(this._eventRegistry||{})[e];if(!n)return;n=n.slice();for(var r=0;r<n.length;r++)n[r](t,this)},r.once=function(e,t){var n=this;t&&this.addEventListener(e,function r(){n.removeEventListener(e,r),t.apply(null,arguments)})},r.setDefaultHandler=function(e,t){var n=this._defaultHandlers;n||(n=this._defaultHandlers={_disabled_:{}});if(n[e]){var r=n[e],i=n._disabled_[e];i||(n._disabled_[e]=i=[]),i.push(r);var s=i.indexOf(t);s!=-1&&i.splice(s,1)}n[e]=t},r.removeDefaultHandler=function(e,t){var n=this._defaultHandlers;if(!n)return;var r=n._disabled_[e];if(n[e]==t){var i=n[e];r&&this.setDefaultHandler(e,r.pop())}else if(r){var s=r.indexOf(t);s!=-1&&r.splice(s,1)}},r.on=r.addEventListener=function(e,t,n){this._eventRegistry=this._eventRegistry||{};var r=this._eventRegistry[e];return r||(r=this._eventRegistry[e]=[]),r.indexOf(t)==-1&&r[n?"unshift":"push"](t),t},r.off=r.removeListener=r.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(!n)return;var r=n.indexOf(t);r!==-1&&n.splice(r,1)},r.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=r}),define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/event_emitter").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n=="undefined"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){function e(e,t,n){var r=n?e.column<=t.column:e.column<t.column;return e.row<t.row||e.row==t.row&&r}function t(t,n,r){var i=t.action=="insert",s=(i?1:-1)*(t.end.row-t.start.row),o=(i?1:-1)*(t.end.column-t.start.column),u=t.start,a=i?u:t.end;return e(n,u,r)?{row:n.row,column:n.column}:e(a,n,!r)?{row:n.row+s,column:n.column+(n.row==a.row?o:0)}:{row:u.row,column:u.column}}r.implement(this,i),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(e){if(e.start.row==e.end.row&&e.start.row!=this.row)return;if(e.start.row>this.row)return;var n=t(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(n.row,n.column,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:i,value:r})},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./apply_delta").applyDelta,s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=e("./anchor").Anchor,a=function(e){this.$lines=[""],e.length===0?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)};(function(){r.implement(this,s),this.setValue=function(e){var t=this.getLength()-1;this.remove(new o(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new u(this,e,t)},"aaa".split(/a/).length===0?this.$split=function(e){return e.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(e){return e.split(/\r\n|\r|\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal("changeNewLineMode")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e=="\r\n"||e=="\r"||e=="\n"},this.getLine=function(e){return this.$lines[e]||""},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},this.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{t=this.getLines(e.start.row,e.end.row),t[0]=(t[0]||"").substring(e.start.column);var n=t.length-1;e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column))}return t},this.insertLines=function(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)},this.removeLines=function(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)},this.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},this.insert=function(e,t){return this.getLength()<=1&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},this.insertInLine=function(e,t){var n=this.clippedPos(e.row,e.column),r=this.pos(e.row,e.column+t.length);return this.applyDelta({start:n,end:r,action:"insert",lines:[t]},!0),this.clonePos(r)},this.clippedPos=function(e,t){var n=this.getLength();e===undefined?e=n:e<0?e=0:e>=n&&(e=n-1,t=undefined);var r=this.getLine(e);return t==undefined&&(t=r.length),t=Math.min(Math.max(t,0),r.length),{row:e,column:t}},this.clonePos=function(e){return{row:e.row,column:e.column}},this.pos=function(e,t){return{row:e,column:t}},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},this.insertFullLines=function(e,t){e=Math.min(Math.max(e,0),this.getLength());var n=0;e<this.getLength()?(t=t.concat([""]),n=0):(t=[""].concat(t),e--,n=this.$lines[e].length),this.insertMergedLines({row:e,column:n},t)},this.insertMergedLines=function(e,t){var n=this.clippedPos(e.row,e.column),r={row:n.row+t.length-1,column:(t.length==1?n.column:0)+t[t.length-1].length};return this.applyDelta({start:n,end:r,action:"insert",lines:t}),this.clonePos(r)},this.remove=function(e){var t=this.clippedPos(e.start.row,e.start.column),n=this.clippedPos(e.end.row,e.end.column);return this.applyDelta({start:t,end:n,action:"remove",lines:this.getLinesForRange({start:t,end:n})}),this.clonePos(t)},this.removeInLine=function(e,t,n){var r=this.clippedPos(e,t),i=this.clippedPos(e,n);return this.applyDelta({start:r,end:i,action:"remove",lines:this.getLinesForRange({start:r,end:i})},!0),this.clonePos(r)},this.removeFullLines=function(e,t){e=Math.min(Math.max(0,e),this.getLength()-1),t=Math.min(Math.max(0,t),this.getLength()-1);var n=t==this.getLength()-1&&e>0,r=t<this.getLength()-1,i=n?e-1:e,s=n?this.getLine(i).length:0,u=r?t+1:t,a=r?0:this.getLine(u).length,f=new o(i,s,u,a),l=this.$lines.slice(e,t+1);return this.applyDelta({start:f.start,end:f.end,action:"remove",lines:this.getLinesForRange(f)}),l},this.removeNewLine=function(e){e<this.getLength()-1&&e>=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},this.replace=function(e,t){e instanceof o||(e=o.fromPoints(e.start,e.end));if(t.length===0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);var n;return t?n=this.insert(e.start,t):n=e.start,n},this.applyDeltas=function(e){for(var t=0;t<e.length;t++)this.applyDelta(e[t])},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--)this.revertDelta(e[t])},this.applyDelta=function(e,t){var n=e.action=="insert";if(n?e.lines.length<=1&&!e.lines[0]:!o.comparePoints(e.start,e.end))return;n&&e.lines.length>2e4&&this.$splitAndapplyLargeDelta(e,2e4),i(this.$lines,e,t),this._signal("change",e)},this.$splitAndapplyLargeDelta=function(e,t){var n=e.lines,r=n.length,i=e.start.row,s=e.start.column,o=0,u=0;do{o=u,u+=t-1;var a=n.slice(o,u);if(u>r){e.lines=a,e.start.row=i+o,e.start.column=s;break}a.push(""),this.applyDelta({start:this.pos(i+o,s),end:this.pos(i+u,s=0),action:e.action,lines:a},!0)}while(!0)},this.revertDelta=function(e){this.applyDelta({start:this.clonePos(e.start),end:this.clonePos(e.end),action:e.action=="insert"?"remove":"insert",lines:e.lines.slice()})},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i<s;i++){e-=n[i].length+r;if(e<0)return{row:i,column:e+n[i].length+r}}return{row:s-1,column:n[s-1].length}},this.positionToIndex=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length,i=0,s=Math.min(e.row,n.length);for(var o=t||0;o<s;++o)i+=n[o].length+r;return i+e.column}}).call(a.prototype),t.Document=a}),define("ace/lib/lang",["require","exports","module"],function(e,t,n){"use strict";t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){var n="";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)e[n]&&typeof e[n]=="object"?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=function s(e){if(typeof e!="object"||!e)return e;var t;if(Array.isArray(e)){t=[];for(var n=0;n<e.length;n++)t[n]=s(e[n]);return t}if(Object.prototype.toString.call(e)!=="[object Object]")return e;t={};for(var n in e)t[n]=s(e[n]);return t},t.arrayToMap=function(e){var t={};for(var n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},t.escapeHTML=function(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},r=function(e){return r.cancel(),t=setTimeout(n,e||0),r};return r.schedule=r,r.call=function(){return this.cancel(),e(),r},r.cancel=function(){return clearTimeout(t),t=null,r},r.isPending=function(){return t},r},t.delayedCall=function(e,t){var n=null,r=function(){n=null,e()},i=function(e){n==null&&(n=setTimeout(r,e||t))};return i.delay=function(e){n&&clearTimeout(n),n=setTimeout(r,e||t)},i.schedule=i,i.call=function(){this.cancel(),e()},i.cancel=function(){n&&clearTimeout(n),n=null},i.isPending=function(){return n},i}}),define("ace/worker/mirror",["require","exports","module","ace/range","ace/document","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../range").Range,i=e("../document").Document,s=e("../lib/lang"),o=t.Mirror=function(e){this.sender=e;var t=this.doc=new i(""),n=this.deferredUpdate=s.delayedCall(this.onUpdate.bind(this)),r=this;e.on("change",function(e){var i=e.data;if(i[0].start)t.applyDeltas(i);else for(var s=0;s<i.length;s+=2){if(Array.isArray(i[s+1]))var o={action:"insert",start:i[s],lines:i[s+1]};else var o={action:"remove",start:i[s],end:i[s+1]};t.applyDelta(o,!0)}if(r.$timeout)return n.schedule(r.$timeout);r.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(e){this.$timeout=e},this.setValue=function(e){this.doc.setValue(e),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(e){this.sender.callback(this.doc.getValue(),e)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(o.prototype)}),define("ace/mode/json/json_parse",["require","exports","module"],function(e,t,n){"use strict";var r,i,s={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},o,u=function(e){throw{name:"SyntaxError",message:e,at:r,text:o}},a=function(e){return e&&e!==i&&u("Expected '"+e+"' instead of '"+i+"'"),i=o.charAt(r),r+=1,i},f=function(){var e,t="";i==="-"&&(t="-",a("-"));while(i>="0"&&i<="9")t+=i,a();if(i==="."){t+=".";while(a()&&i>="0"&&i<="9")t+=i}if(i==="e"||i==="E"){t+=i,a();if(i==="-"||i==="+")t+=i,a();while(i>="0"&&i<="9")t+=i,a()}e=+t;if(!isNaN(e))return e;u("Bad number")},l=function(){var e,t,n="",r;if(i==='"')while(a()){if(i==='"')return a(),n;if(i==="\\"){a();if(i==="u"){r=0;for(t=0;t<4;t+=1){e=parseInt(a(),16);if(!isFinite(e))break;r=r*16+e}n+=String.fromCharCode(r)}else{if(typeof s[i]!="string")break;n+=s[i]}}else n+=i}u("Bad string")},c=function(){while(i&&i<=" ")a()},h=function(){switch(i){case"t":return a("t"),a("r"),a("u"),a("e"),!0;case"f":return a("f"),a("a"),a("l"),a("s"),a("e"),!1;case"n":return a("n"),a("u"),a("l"),a("l"),null}u("Unexpected '"+i+"'")},p,d=function(){var e=[];if(i==="["){a("["),c();if(i==="]")return a("]"),e;while(i){e.push(p()),c();if(i==="]")return a("]"),e;a(","),c()}}u("Bad array")},v=function(){var e,t={};if(i==="{"){a("{"),c();if(i==="}")return a("}"),t;while(i){e=l(),c(),a(":"),Object.hasOwnProperty.call(t,e)&&u('Duplicate key "'+e+'"'),t[e]=p(),c();if(i==="}")return a("}"),t;a(","),c()}}u("Bad object")};return p=function(){c();switch(i){case"{":return v();case"[":return d();case'"':return l();case"-":return f();default:return i>="0"&&i<="9"?f():h()}},function(e,t){var n;return o=e,r=0,i=" ",n=p(),c(),i&&u("Syntax error"),typeof t=="function"?function s(e,n){var r,i,o=e[n];if(o&&typeof o=="object")for(r in o)Object.hasOwnProperty.call(o,r)&&(i=s(o,r),i!==undefined?o[r]=i:delete o[r]);return t.call(e,n,o)}({"":n},""):n}}),define("ace/mode/json_worker",["require","exports","module","ace/lib/oop","ace/worker/mirror","ace/mode/json/json_parse"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../worker/mirror").Mirror,s=e("./json/json_parse"),o=t.JsonWorker=function(e){i.call(this,e),this.setTimeout(200)};r.inherits(o,i),function(){this.onUpdate=function(){var e=this.doc.getValue(),t=[];try{e&&s(e)}catch(n){var r=this.doc.indexToPosition(n.at-1);t.push({row:r.row,column:r.column,text:n.message,type:"error"})}this.sender.emit("annotate",t)}}.call(o.prototype)}),define("ace/lib/es5-shim",["require","exports","module"],function(e,t,n){function r(){}function w(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){}}function H(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function B(e){var t=typeof e;return e===null||t==="undefined"||t==="boolean"||t==="number"||t==="string"}function j(e){var t,n,r;if(B(e))return e;n=e.valueOf;if(typeof n=="function"){t=n.call(e);if(B(t))return t}r=e.toString;if(typeof r=="function"){t=r.call(e);if(B(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(t){var n=this;if(typeof n!="function")throw new TypeError("Function.prototype.bind called on incompatible "+n);var i=u.call(arguments,1),s=function(){if(this instanceof s){var e=n.apply(this,i.concat(u.call(arguments)));return Object(e)===e?e:this}return n.apply(t,i.concat(u.call(arguments)))};return n.prototype&&(r.prototype=n.prototype,s.prototype=new r,r.prototype=null),s});var i=Function.prototype.call,s=Array.prototype,o=Object.prototype,u=s.slice,a=i.bind(o.toString),f=i.bind(o.hasOwnProperty),l,c,h,p,d;if(d=f(o,"__defineGetter__"))l=i.bind(o.__defineGetter__),c=i.bind(o.__defineSetter__),h=i.bind(o.__lookupGetter__),p=i.bind(o.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,"XXX"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+t<n||(t=n-e);var r=this.slice(e,e+t),i=u.call(arguments,2),s=i.length;if(e===n)s&&this.push.apply(this,i);else{var o=Math.min(t,n-e),a=e+o,f=a+s-o,l=n-a,c=n-o;if(f<a)for(var h=0;h<l;++h)this[f+h]=this[a+h];else if(f>a)for(h=l;h--;)this[f+h]=this[a+h];if(s&&e===c)this.length=c,this.push.apply(this,i);else{this.length=c+s;for(h=0;h<s;++h)this[e+h]=i[h]}}return r};else{var v=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?v.apply(this,[e===void 0?0:e,t===void 0?this.length-e:t].concat(u.call(arguments,2))):[]}}Array.isArray||(Array.isArray=function(t){return a(t)=="[object Array]"});var m=Object("a"),g=m[0]!="a"||!(0 in m);Array.prototype.forEach||(Array.prototype.forEach=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=arguments[1],s=-1,o=r.length>>>0;if(a(t)!="[object Function]")throw new TypeError;while(++s<o)s in r&&t.call(i,r[s],s,n)}),Array.prototype.map||(Array.prototype.map=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0,s=Array(i),o=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var u=0;u<i;u++)u in r&&(s[u]=t.call(o,r[u],u,n));return s}),Array.prototype.filter||(Array.prototype.filter=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0,s=[],o,u=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var f=0;f<i;f++)f in r&&(o=r[f],t.call(u,o,f,n)&&s.push(o));return s}),Array.prototype.every||(Array.prototype.every=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o<i;o++)if(o in r&&!t.call(s,r[o],o,n))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o<i;o++)if(o in r&&t.call(s,r[o],o,n))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduce of empty array with no initial value");var s=0,o;if(arguments.length>=2)o=arguments[1];else do{if(s in r){o=r[s++];break}if(++s>=i)throw new TypeError("reduce of empty array with no initial value")}while(!0);for(;s<i;s++)s in r&&(o=t.call(void 0,o,r[s],s,n));return o}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduceRight of empty array with no initial value");var s,o=i-1;if(arguments.length>=2)s=arguments[1];else do{if(o in r){s=r[o--];break}if(--o<0)throw new TypeError("reduceRight of empty array with no initial value")}while(!0);do o in this&&(s=t.call(void 0,s,r[o],o,n));while(o--);return s});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(t){var n=g&&a(this)=="[object String]"?this.split(""):F(this),r=n.length>>>0;if(!r)return-1;var i=0;arguments.length>1&&(i=H(arguments[1])),i=i>=0?i:Math.max(0,r+i);for(;i<r;i++)if(i in n&&n[i]===t)return i;return-1};if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!=-1)Array.prototype.lastIndexOf=function(t){var n=g&&a(this)=="[object String]"?this.split(""):F(this),r=n.length>>>0;if(!r)return-1;var i=r-1;arguments.length>1&&(i=Math.min(i,H(arguments[1]))),i=i>=0?i:r-Math.abs(i);for(;i>=0;i--)if(i in n&&t===n[i])return i;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(t){return t.__proto__||(t.constructor?t.constructor.prototype:o)});if(!Object.getOwnPropertyDescriptor){var y="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(t,n){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(y+t);if(!f(t,n))return;var r,i,s;r={enumerable:!0,configurable:!0};if(d){var u=t.__proto__;t.__proto__=o;var i=h(t,n),s=p(t,n);t.__proto__=u;if(i||s)return i&&(r.get=i),s&&(r.set=s),r}return r.value=t[n],r}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(t){return Object.keys(t)});if(!Object.create){var b;Object.prototype.__proto__===null?b=function(){return{__proto__:null}}:b=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(t,n){var r;if(t===null)r=b();else{if(typeof t!="object")throw new TypeError("typeof prototype["+typeof t+"] != 'object'");var i=function(){};i.prototype=t,r=new i,r.__proto__=t}return n!==void 0&&Object.defineProperties(r,n),r}}if(Object.defineProperty){var E=w({}),S=typeof document=="undefined"||w(document.createElement("div"));if(!E||!S)var x=Object.defineProperty}if(!Object.defineProperty||x){var T="Property description must be an object: ",N="Object.defineProperty called on non-object: ",C="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(t,n,r){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(N+t);if(typeof r!="object"&&typeof r!="function"||r===null)throw new TypeError(T+r);if(x)try{return x.call(Object,t,n,r)}catch(i){}if(f(r,"value"))if(d&&(h(t,n)||p(t,n))){var s=t.__proto__;t.__proto__=o,delete t[n],t[n]=r.value,t.__proto__=s}else t[n]=r.value;else{if(!d)throw new TypeError(C);f(r,"get")&&l(t,n,r.get),f(r,"set")&&c(t,n,r.set)}return t}}Object.defineProperties||(Object.defineProperties=function(t,n){for(var r in n)f(n,r)&&Object.defineProperty(t,r,n[r]);return t}),Object.seal||(Object.seal=function(t){return t}),Object.freeze||(Object.freeze=function(t){return t});try{Object.freeze(function(){})}catch(k){Object.freeze=function(t){return function(n){return typeof n=="function"?n:t(n)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(t){return t}),Object.isSealed||(Object.isSealed=function(t){return!1}),Object.isFrozen||(Object.isFrozen=function(t){return!1}),Object.isExtensible||(Object.isExtensible=function(t){if(Object(t)===t)throw new TypeError;var n="";while(f(t,n))n+="?";t[n]=!0;var r=f(t,n);return delete t[n],r});if(!Object.keys){var L=!0,A=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],O=A.length;for(var M in{toString:null})L=!1;Object.keys=function I(e){if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError("Object.keys called on a non-object");var I=[];for(var t in e)f(e,t)&&I.push(t);if(L)for(var n=0,r=O;n<r;n++){var i=A[n];f(e,i)&&I.push(i)}return I}}Date.now||(Date.now=function(){return(new Date).getTime()});var _=" \n\f\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff";if(!String.prototype.trim||_.trim()){_="["+_+"]";var D=new RegExp("^"+_+_+"*"),P=new RegExp(_+_+"*$");String.prototype.trim=function(){return String(this).replace(D,"").replace(P,"")}}var F=function(e){if(e==null)throw new TypeError("can't convert "+e+" to object");return Object(e)}})
| "no use strict";!function(e){function t(e,t){var n=e,r="";while(n){var i=t[n];if(typeof i=="string")return i+r;if(i)return i.location.replace(/\/*$/,"/")+(r||i.main||i.name);if(i===!1)return"";var s=n.lastIndexOf("/");if(s===-1)break;r=n.substr(s)+r,n=n.slice(0,s)}return e}if(typeof e.window!="undefined"&&e.document)return;if(e.require&&e.define)return;e.console||(e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console),e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){postMessage({type:"error",data:{message:e,data:i.data,file:t,line:n,col:r,stack:i.stack}})},e.normalizeModule=function(t,n){if(n.indexOf("!")!==-1){var r=n.split("!");return e.normalizeModule(t,r[0])+"!"+e.normalizeModule(t,r[1])}if(n.charAt(0)=="."){var i=t.split("/").slice(0,-1).join("/");n=(i?i+"/":"")+n;while(n.indexOf(".")!==-1&&s!=n){var s=n;n=n.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return n},e.require=function(r,i){i||(i=r,r=null);if(!i.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");i=e.normalizeModule(r,i);var s=e.require.modules[i];if(s)return s.initialized||(s.initialized=!0,s.exports=s.factory().exports),s.exports;if(!e.require.tlns)return console.log("unable to load "+i);var o=t(i,e.require.tlns);return o.slice(-3)!=".js"&&(o+=".js"),e.require.id=i,e.require.modules[i]={},importScripts(o),e.require(r,i)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){arguments.length==2?(r=n,typeof t!="string"&&(n=t,t=e.require.id)):arguments.length==1&&(r=t,n=[],t=e.require.id);if(typeof r!="function"){e.require.modules[t]={exports:r,initialized:!0};return}n.length||(n=["require","exports","module"]);var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.map(function(t){switch(t){case"require":return i;case"exports":return e.exports;case"module":return e;default:return i(t)}}));return t&&(e.exports=t),e}}},e.define.amd={},require.tlns={},e.initBaseUrls=function(t){for(var n in t)require.tlns[n]=t[n]},e.initSender=function(){var n=e.require("ace/lib/event_emitter").EventEmitter,r=e.require("ace/lib/oop"),i=function(){};return function(){r.implement(this,n),this.callback=function(e,t){postMessage({type:"call",id:t,data:e})},this.emit=function(e,t){postMessage({type:"event",name:e,data:t})}}.call(i.prototype),new i};var n=e.main=null,r=e.sender=null;e.onmessage=function(t){var i=t.data;if(i.event&&r)r._signal(i.event,i.data);else if(i.command)if(n[i.command])n[i.command].apply(n,i.args);else{if(!e[i.command])throw new Error("Unknown command:"+i.command);e[i.command].apply(e,i.args)}else if(i.init){e.initBaseUrls(i.tlns),require("ace/lib/es5-shim"),r=e.sender=e.initSender();var s=require(i.module)[i.classname];n=e.main=new s(r)}}}(this),define("ace/lib/oop",["require","exports","module"],function(e,t,n){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define("ace/range",["require","exports","module"],function(e,t,n){"use strict";var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e=="object"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e=="object"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?t<this.start.column?-1:t>this.end.column?1:0:e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.row<e)var n={row:e,column:0};if(this.start.row>t)var r={row:t+1,column:0};else if(this.start.row<e)var r={row:e,column:0};return i.fromPoints(r||this.start,n||this.end)},this.extend=function(e,t){var n=this.compare(e,t);if(n==0)return this;if(n==-1)var r={row:e,column:t};else var s={row:e,column:t};return i.fromPoints(r||this.start,s||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return i.fromPoints(this.start,this.end)},this.collapseRows=function(){return this.end.column==0?new i(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new i(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),n=e.documentToScreenPosition(this.end);return new i(t.row,t.column,n.row,n.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(i.prototype),i.fromPoints=function(e,t){return new i(e.row,e.column,t.row,t.column)},i.comparePoints=r,i.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=i}),define("ace/apply_delta",["require","exports","module"],function(e,t,n){"use strict";function r(e,t){throw console.log("Invalid Delta:",e),"Invalid Delta: "+t}function i(e,t){return t.row>=0&&t.row<e.length&&t.column>=0&&t.column<=e[t.row].length}function s(e,t){t.action!="insert"&&t.action!="remove"&&r(t,"delta.action must be 'insert' or 'remove'"),t.lines instanceof Array||r(t,"delta.lines must be an Array"),(!t.start||!t.end)&&r(t,"delta.start/end must be an present");var n=t.start;i(e,t.start)||r(t,"delta.start must be contained in document");var s=t.end;t.action=="remove"&&!i(e,s)&&r(t,"delta.end must contained in document for 'remove' actions");var o=s.row-n.row,u=s.column-(o==0?n.column:0);(o!=t.lines.length-1||t.lines[o].length!=u)&&r(t,"delta.range must match delta lines")}t.applyDelta=function(e,t,n){var r=t.start.row,i=t.start.column,s=e[r]||"";switch(t.action){case"insert":var o=t.lines;if(o.length===1)e[r]=s.substring(0,i)+t.lines[0]+s.substring(i);else{var u=[r,1].concat(t.lines);e.splice.apply(e,u),e[r]=s.substring(0,i)+e[r],e[r+t.lines.length-1]+=s.substring(i)}break;case"remove":var a=t.end.column,f=t.end.row;r===f?e[r]=s.substring(0,i)+s.substring(a):e.splice(r,f-r+1,s.substring(0,i)+e[f].substring(a))}}}),define("ace/lib/event_emitter",["require","exports","module"],function(e,t,n){"use strict";var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!="object"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;o<n.length;o++){n[o](t,this);if(t.propagationStopped)break}if(r&&!t.defaultPrevented)return r(t,this)},r._signal=function(e,t){var n=(this._eventRegistry||{})[e];if(!n)return;n=n.slice();for(var r=0;r<n.length;r++)n[r](t,this)},r.once=function(e,t){var n=this;t&&this.addEventListener(e,function r(){n.removeEventListener(e,r),t.apply(null,arguments)})},r.setDefaultHandler=function(e,t){var n=this._defaultHandlers;n||(n=this._defaultHandlers={_disabled_:{}});if(n[e]){var r=n[e],i=n._disabled_[e];i||(n._disabled_[e]=i=[]),i.push(r);var s=i.indexOf(t);s!=-1&&i.splice(s,1)}n[e]=t},r.removeDefaultHandler=function(e,t){var n=this._defaultHandlers;if(!n)return;var r=n._disabled_[e];if(n[e]==t){var i=n[e];r&&this.setDefaultHandler(e,r.pop())}else if(r){var s=r.indexOf(t);s!=-1&&r.splice(s,1)}},r.on=r.addEventListener=function(e,t,n){this._eventRegistry=this._eventRegistry||{};var r=this._eventRegistry[e];return r||(r=this._eventRegistry[e]=[]),r.indexOf(t)==-1&&r[n?"unshift":"push"](t),t},r.off=r.removeListener=r.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(!n)return;var r=n.indexOf(t);r!==-1&&n.splice(r,1)},r.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=r}),define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/event_emitter").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n=="undefined"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){function e(e,t,n){var r=n?e.column<=t.column:e.column<t.column;return e.row<t.row||e.row==t.row&&r}function t(t,n,r){var i=t.action=="insert",s=(i?1:-1)*(t.end.row-t.start.row),o=(i?1:-1)*(t.end.column-t.start.column),u=t.start,a=i?u:t.end;return e(n,u,r)?{row:n.row,column:n.column}:e(a,n,!r)?{row:n.row+s,column:n.column+(n.row==a.row?o:0)}:{row:u.row,column:u.column}}r.implement(this,i),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(e){if(e.start.row==e.end.row&&e.start.row!=this.row)return;if(e.start.row>this.row)return;var n=t(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(n.row,n.column,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:i,value:r})},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./apply_delta").applyDelta,s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=e("./anchor").Anchor,a=function(e){this.$lines=[""],e.length===0?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)};(function(){r.implement(this,s),this.setValue=function(e){var t=this.getLength()-1;this.remove(new o(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new u(this,e,t)},"aaa".split(/a/).length===0?this.$split=function(e){return e.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(e){return e.split(/\r\n|\r|\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal("changeNewLineMode")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e=="\r\n"||e=="\r"||e=="\n"},this.getLine=function(e){return this.$lines[e]||""},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},this.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{t=this.getLines(e.start.row,e.end.row),t[0]=(t[0]||"").substring(e.start.column);var n=t.length-1;e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column))}return t},this.insertLines=function(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)},this.removeLines=function(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)},this.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},this.insert=function(e,t){return this.getLength()<=1&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},this.insertInLine=function(e,t){var n=this.clippedPos(e.row,e.column),r=this.pos(e.row,e.column+t.length);return this.applyDelta({start:n,end:r,action:"insert",lines:[t]},!0),this.clonePos(r)},this.clippedPos=function(e,t){var n=this.getLength();e===undefined?e=n:e<0?e=0:e>=n&&(e=n-1,t=undefined);var r=this.getLine(e);return t==undefined&&(t=r.length),t=Math.min(Math.max(t,0),r.length),{row:e,column:t}},this.clonePos=function(e){return{row:e.row,column:e.column}},this.pos=function(e,t){return{row:e,column:t}},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},this.insertFullLines=function(e,t){e=Math.min(Math.max(e,0),this.getLength());var n=0;e<this.getLength()?(t=t.concat([""]),n=0):(t=[""].concat(t),e--,n=this.$lines[e].length),this.insertMergedLines({row:e,column:n},t)},this.insertMergedLines=function(e,t){var n=this.clippedPos(e.row,e.column),r={row:n.row+t.length-1,column:(t.length==1?n.column:0)+t[t.length-1].length};return this.applyDelta({start:n,end:r,action:"insert",lines:t}),this.clonePos(r)},this.remove=function(e){var t=this.clippedPos(e.start.row,e.start.column),n=this.clippedPos(e.end.row,e.end.column);return this.applyDelta({start:t,end:n,action:"remove",lines:this.getLinesForRange({start:t,end:n})}),this.clonePos(t)},this.removeInLine=function(e,t,n){var r=this.clippedPos(e,t),i=this.clippedPos(e,n);return this.applyDelta({start:r,end:i,action:"remove",lines:this.getLinesForRange({start:r,end:i})},!0),this.clonePos(r)},this.removeFullLines=function(e,t){e=Math.min(Math.max(0,e),this.getLength()-1),t=Math.min(Math.max(0,t),this.getLength()-1);var n=t==this.getLength()-1&&e>0,r=t<this.getLength()-1,i=n?e-1:e,s=n?this.getLine(i).length:0,u=r?t+1:t,a=r?0:this.getLine(u).length,f=new o(i,s,u,a),l=this.$lines.slice(e,t+1);return this.applyDelta({start:f.start,end:f.end,action:"remove",lines:this.getLinesForRange(f)}),l},this.removeNewLine=function(e){e<this.getLength()-1&&e>=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},this.replace=function(e,t){e instanceof o||(e=o.fromPoints(e.start,e.end));if(t.length===0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);var n;return t?n=this.insert(e.start,t):n=e.start,n},this.applyDeltas=function(e){for(var t=0;t<e.length;t++)this.applyDelta(e[t])},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--)this.revertDelta(e[t])},this.applyDelta=function(e,t){var n=e.action=="insert";if(n?e.lines.length<=1&&!e.lines[0]:!o.comparePoints(e.start,e.end))return;n&&e.lines.length>2e4&&this.$splitAndapplyLargeDelta(e,2e4),i(this.$lines,e,t),this._signal("change",e)},this.$splitAndapplyLargeDelta=function(e,t){var n=e.lines,r=n.length,i=e.start.row,s=e.start.column,o=0,u=0;do{o=u,u+=t-1;var a=n.slice(o,u);if(u>r){e.lines=a,e.start.row=i+o,e.start.column=s;break}a.push(""),this.applyDelta({start:this.pos(i+o,s),end:this.pos(i+u,s=0),action:e.action,lines:a},!0)}while(!0)},this.revertDelta=function(e){this.applyDelta({start:this.clonePos(e.start),end:this.clonePos(e.end),action:e.action=="insert"?"remove":"insert",lines:e.lines.slice()})},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i<s;i++){e-=n[i].length+r;if(e<0)return{row:i,column:e+n[i].length+r}}return{row:s-1,column:n[s-1].length}},this.positionToIndex=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length,i=0,s=Math.min(e.row,n.length);for(var o=t||0;o<s;++o)i+=n[o].length+r;return i+e.column}}).call(a.prototype),t.Document=a}),define("ace/lib/lang",["require","exports","module"],function(e,t,n){"use strict";t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){var n="";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)e[n]&&typeof e[n]=="object"?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=function s(e){if(typeof e!="object"||!e)return e;var t;if(Array.isArray(e)){t=[];for(var n=0;n<e.length;n++)t[n]=s(e[n]);return t}if(Object.prototype.toString.call(e)!=="[object Object]")return e;t={};for(var n in e)t[n]=s(e[n]);return t},t.arrayToMap=function(e){var t={};for(var n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},t.escapeHTML=function(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},r=function(e){return r.cancel(),t=setTimeout(n,e||0),r};return r.schedule=r,r.call=function(){return this.cancel(),e(),r},r.cancel=function(){return clearTimeout(t),t=null,r},r.isPending=function(){return t},r},t.delayedCall=function(e,t){var n=null,r=function(){n=null,e()},i=function(e){n==null&&(n=setTimeout(r,e||t))};return i.delay=function(e){n&&clearTimeout(n),n=setTimeout(r,e||t)},i.schedule=i,i.call=function(){this.cancel(),e()},i.cancel=function(){n&&clearTimeout(n),n=null},i.isPending=function(){return n},i}}),define("ace/worker/mirror",["require","exports","module","ace/range","ace/document","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../range").Range,i=e("../document").Document,s=e("../lib/lang"),o=t.Mirror=function(e){this.sender=e;var t=this.doc=new i(""),n=this.deferredUpdate=s.delayedCall(this.onUpdate.bind(this)),r=this;e.on("change",function(e){var i=e.data;if(i[0].start)t.applyDeltas(i);else for(var s=0;s<i.length;s+=2){if(Array.isArray(i[s+1]))var o={action:"insert",start:i[s],lines:i[s+1]};else var o={action:"remove",start:i[s],end:i[s+1]};t.applyDelta(o,!0)}if(r.$timeout)return n.schedule(r.$timeout);r.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(e){this.$timeout=e},this.setValue=function(e){this.doc.setValue(e),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(e){this.sender.callback(this.doc.getValue(),e)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(o.prototype)}),define("ace/mode/json/json_parse",["require","exports","module"],function(e,t,n){"use strict";var r,i,s={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},o,u=function(e){throw{name:"SyntaxError",message:e,at:r,text:o}},a=function(e){return e&&e!==i&&u("Expected '"+e+"' instead of '"+i+"'"),i=o.charAt(r),r+=1,i},f=function(){var e,t="";i==="-"&&(t="-",a("-"));while(i>="0"&&i<="9")t+=i,a();if(i==="."){t+=".";while(a()&&i>="0"&&i<="9")t+=i}if(i==="e"||i==="E"){t+=i,a();if(i==="-"||i==="+")t+=i,a();while(i>="0"&&i<="9")t+=i,a()}e=+t;if(!isNaN(e))return e;u("Bad number")},l=function(){var e,t,n="",r;if(i==='"')while(a()){if(i==='"')return a(),n;if(i==="\\"){a();if(i==="u"){r=0;for(t=0;t<4;t+=1){e=parseInt(a(),16);if(!isFinite(e))break;r=r*16+e}n+=String.fromCharCode(r)}else{if(typeof s[i]!="string")break;n+=s[i]}}else n+=i}u("Bad string")},c=function(){while(i&&i<=" ")a()},h=function(){switch(i){case"t":return a("t"),a("r"),a("u"),a("e"),!0;case"f":return a("f"),a("a"),a("l"),a("s"),a("e"),!1;case"n":return a("n"),a("u"),a("l"),a("l"),null}u("Unexpected '"+i+"'")},p,d=function(){var e=[];if(i==="["){a("["),c();if(i==="]")return a("]"),e;while(i){e.push(p()),c();if(i==="]")return a("]"),e;a(","),c()}}u("Bad array")},v=function(){var e,t={};if(i==="{"){a("{"),c();if(i==="}")return a("}"),t;while(i){e=l(),c(),a(":"),Object.hasOwnProperty.call(t,e)&&u('Duplicate key "'+e+'"'),t[e]=p(),c();if(i==="}")return a("}"),t;a(","),c()}}u("Bad object")};return p=function(){c();switch(i){case"{":return v();case"[":return d();case'"':return l();case"-":return f();default:return i>="0"&&i<="9"?f():h()}},function(e,t){var n;return o=e,r=0,i=" ",n=p(),c(),i&&u("Syntax error"),typeof t=="function"?function s(e,n){var r,i,o=e[n];if(o&&typeof o=="object")for(r in o)Object.hasOwnProperty.call(o,r)&&(i=s(o,r),i!==undefined?o[r]=i:delete o[r]);return t.call(e,n,o)}({"":n},""):n}}),define("ace/mode/json_worker",["require","exports","module","ace/lib/oop","ace/worker/mirror","ace/mode/json/json_parse"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../worker/mirror").Mirror,s=e("./json/json_parse"),o=t.JsonWorker=function(e){i.call(this,e),this.setTimeout(200)};r.inherits(o,i),function(){this.onUpdate=function(){var e=this.doc.getValue(),t=[];try{e&&s(e)}catch(n){var r=this.doc.indexToPosition(n.at-1);t.push({row:r.row,column:r.column,text:n.message,type:"error"})}this.sender.emit("annotate",t)}}.call(o.prototype)}),define("ace/lib/es5-shim",["require","exports","module"],function(e,t,n){function r(){}function w(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){}}function H(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function B(e){var t=typeof e;return e===null||t==="undefined"||t==="boolean"||t==="number"||t==="string"}function j(e){var t,n,r;if(B(e))return e;n=e.valueOf;if(typeof n=="function"){t=n.call(e);if(B(t))return t}r=e.toString;if(typeof r=="function"){t=r.call(e);if(B(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(t){var n=this;if(typeof n!="function")throw new TypeError("Function.prototype.bind called on incompatible "+n);var i=u.call(arguments,1),s=function(){if(this instanceof s){var e=n.apply(this,i.concat(u.call(arguments)));return Object(e)===e?e:this}return n.apply(t,i.concat(u.call(arguments)))};return n.prototype&&(r.prototype=n.prototype,s.prototype=new r,r.prototype=null),s});var i=Function.prototype.call,s=Array.prototype,o=Object.prototype,u=s.slice,a=i.bind(o.toString),f=i.bind(o.hasOwnProperty),l,c,h,p,d;if(d=f(o,"__defineGetter__"))l=i.bind(o.__defineGetter__),c=i.bind(o.__defineSetter__),h=i.bind(o.__lookupGetter__),p=i.bind(o.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,"XXX"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+t<n||(t=n-e);var r=this.slice(e,e+t),i=u.call(arguments,2),s=i.length;if(e===n)s&&this.push.apply(this,i);else{var o=Math.min(t,n-e),a=e+o,f=a+s-o,l=n-a,c=n-o;if(f<a)for(var h=0;h<l;++h)this[f+h]=this[a+h];else if(f>a)for(h=l;h--;)this[f+h]=this[a+h];if(s&&e===c)this.length=c,this.push.apply(this,i);else{this.length=c+s;for(h=0;h<s;++h)this[e+h]=i[h]}}return r};else{var v=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?v.apply(this,[e===void 0?0:e,t===void 0?this.length-e:t].concat(u.call(arguments,2))):[]}}Array.isArray||(Array.isArray=function(t){return a(t)=="[object Array]"});var m=Object("a"),g=m[0]!="a"||!(0 in m);Array.prototype.forEach||(Array.prototype.forEach=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=arguments[1],s=-1,o=r.length>>>0;if(a(t)!="[object Function]")throw new TypeError;while(++s<o)s in r&&t.call(i,r[s],s,n)}),Array.prototype.map||(Array.prototype.map=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0,s=Array(i),o=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var u=0;u<i;u++)u in r&&(s[u]=t.call(o,r[u],u,n));return s}),Array.prototype.filter||(Array.prototype.filter=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0,s=[],o,u=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var f=0;f<i;f++)f in r&&(o=r[f],t.call(u,o,f,n)&&s.push(o));return s}),Array.prototype.every||(Array.prototype.every=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o<i;o++)if(o in r&&!t.call(s,r[o],o,n))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o<i;o++)if(o in r&&t.call(s,r[o],o,n))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduce of empty array with no initial value");var s=0,o;if(arguments.length>=2)o=arguments[1];else do{if(s in r){o=r[s++];break}if(++s>=i)throw new TypeError("reduce of empty array with no initial value")}while(!0);for(;s<i;s++)s in r&&(o=t.call(void 0,o,r[s],s,n));return o}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduceRight of empty array with no initial value");var s,o=i-1;if(arguments.length>=2)s=arguments[1];else do{if(o in r){s=r[o--];break}if(--o<0)throw new TypeError("reduceRight of empty array with no initial value")}while(!0);do o in this&&(s=t.call(void 0,s,r[o],o,n));while(o--);return s});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(t){var n=g&&a(this)=="[object String]"?this.split(""):F(this),r=n.length>>>0;if(!r)return-1;var i=0;arguments.length>1&&(i=H(arguments[1])),i=i>=0?i:Math.max(0,r+i);for(;i<r;i++)if(i in n&&n[i]===t)return i;return-1};if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!=-1)Array.prototype.lastIndexOf=function(t){var n=g&&a(this)=="[object String]"?this.split(""):F(this),r=n.length>>>0;if(!r)return-1;var i=r-1;arguments.length>1&&(i=Math.min(i,H(arguments[1]))),i=i>=0?i:r-Math.abs(i);for(;i>=0;i--)if(i in n&&t===n[i])return i;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(t){return t.__proto__||(t.constructor?t.constructor.prototype:o)});if(!Object.getOwnPropertyDescriptor){var y="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(t,n){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(y+t);if(!f(t,n))return;var r,i,s;r={enumerable:!0,configurable:!0};if(d){var u=t.__proto__;t.__proto__=o;var i=h(t,n),s=p(t,n);t.__proto__=u;if(i||s)return i&&(r.get=i),s&&(r.set=s),r}return r.value=t[n],r}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(t){return Object.keys(t)});if(!Object.create){var b;Object.prototype.__proto__===null?b=function(){return{__proto__:null}}:b=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(t,n){var r;if(t===null)r=b();else{if(typeof t!="object")throw new TypeError("typeof prototype["+typeof t+"] != 'object'");var i=function(){};i.prototype=t,r=new i,r.__proto__=t}return n!==void 0&&Object.defineProperties(r,n),r}}if(Object.defineProperty){var E=w({}),S=typeof document=="undefined"||w(document.createElement("div"));if(!E||!S)var x=Object.defineProperty}if(!Object.defineProperty||x){var T="Property description must be an object: ",N="Object.defineProperty called on non-object: ",C="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(t,n,r){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(N+t);if(typeof r!="object"&&typeof r!="function"||r===null)throw new TypeError(T+r);if(x)try{return x.call(Object,t,n,r)}catch(i){}if(f(r,"value"))if(d&&(h(t,n)||p(t,n))){var s=t.__proto__;t.__proto__=o,delete t[n],t[n]=r.value,t.__proto__=s}else t[n]=r.value;else{if(!d)throw new TypeError(C);f(r,"get")&&l(t,n,r.get),f(r,"set")&&c(t,n,r.set)}return t}}Object.defineProperties||(Object.defineProperties=function(t,n){for(var r in n)f(n,r)&&Object.defineProperty(t,r,n[r]);return t}),Object.seal||(Object.seal=function(t){return t}),Object.freeze||(Object.freeze=function(t){return t});try{Object.freeze(function(){})}catch(k){Object.freeze=function(t){return function(n){return typeof n=="function"?n:t(n)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(t){return t}),Object.isSealed||(Object.isSealed=function(t){return!1}),Object.isFrozen||(Object.isFrozen=function(t){return!1}),Object.isExtensible||(Object.isExtensible=function(t){if(Object(t)===t)throw new TypeError;var n="";while(f(t,n))n+="?";t[n]=!0;var r=f(t,n);return delete t[n],r});if(!Object.keys){var L=!0,A=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],O=A.length;for(var M in{toString:null})L=!1;Object.keys=function I(e){if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError("Object.keys called on a non-object");var I=[];for(var t in e)f(e,t)&&I.push(t);if(L)for(var n=0,r=O;n<r;n++){var i=A[n];f(e,i)&&I.push(i)}return I}}Date.now||(Date.now=function(){return(new Date).getTime()});var _=" \n\f\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff";if(!String.prototype.trim||_.trim()){_="["+_+"]";var D=new RegExp("^"+_+_+"*"),P=new RegExp(_+_+"*$");String.prototype.trim=function(){return String(this).replace(D,"").replace(P,"")}}var F=function(e){if(e==null)throw new TypeError("can't convert "+e+" to object");return Object(e)}})
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./SECURITY.md | # Security Policy
## Reporting a Vulnerability
If you have apprehensions regarding Apollo's security or you discover vulnerability or potential threat, don’t hesitate to get in touch with us by dropping a mail at apollo-config@googlegroups.com.
In the mail, specify the description of the issue or potential threat. You are also urged to recommend the way to reproduce and replicate the issue. The Apollo community will get back to you after assessing and analysing the findings.
PLEASE PAY ATTENTION to report the security issue on the security email before disclosing it on public domain.
| # Security Policy
## Reporting a Vulnerability
If you have apprehensions regarding Apollo's security or you discover vulnerability or potential threat, don’t hesitate to get in touch with us by dropping a mail at apollo-config@googlegroups.com.
In the mail, specify the description of the issue or potential threat. You are also urged to recommend the way to reproduce and replicate the issue. The Apollo community will get back to you after assessing and analysing the findings.
PLEASE PAY ATTENTION to report the security issue on the security email before disclosing it on public domain.
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/resources/static/vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js | /*!
* angular-translate - v2.18.1 - 2018-05-19
*
* Copyright (c) 2018 The angular-translate team, Pascal Precht; Licensed MIT
*/
!function(t,e){"function"==typeof define&&define.amd?define([],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():e()}(0,function(){function t(t){"use strict";var n;if(1===angular.version.major&&4<=angular.version.minor){var o=t.get("$cookies");n={get:function(t){return o.get(t)},put:function(t,e){o.put(t,e)}}}else{var r=t.get("$cookieStore");n={get:function(t){return r.get(t)},put:function(t,e){r.put(t,e)}}}return{get:function(t){return n.get(t)},set:function(t,e){n.put(t,e)},put:function(t,e){n.put(t,e)}}}return t.$inject=["$injector"],angular.module("pascalprecht.translate").factory("$translateCookieStorage",t),t.displayName="$translateCookieStorage","pascalprecht.translate"}); | /*!
* angular-translate - v2.18.1 - 2018-05-19
*
* Copyright (c) 2018 The angular-translate team, Pascal Precht; Licensed MIT
*/
!function(t,e){"function"==typeof define&&define.amd?define([],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():e()}(0,function(){function t(t){"use strict";var n;if(1===angular.version.major&&4<=angular.version.minor){var o=t.get("$cookies");n={get:function(t){return o.get(t)},put:function(t,e){o.put(t,e)}}}else{var r=t.get("$cookieStore");n={get:function(t){return r.get(t)},put:function(t,e){r.put(t,e)}}}return{get:function(t){return n.get(t)},set:function(t,e){n.put(t,e)},put:function(t,e){n.put(t,e)}}}return t.$inject=["$injector"],angular.module("pascalprecht.translate").factory("$translateCookieStorage",t),t.displayName="$translateCookieStorage","pascalprecht.translate"}); | -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/resources/static/scripts/directive/item-modal-directive.js | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
directive_module.directive('itemmodal', itemModalDirective);
function itemModalDirective($translate, toastr, $sce, AppUtil, EventManager, ConfigService) {
return {
restrict: 'E',
templateUrl: AppUtil.prefixPath() + '/views/component/item-modal.html',
transclude: true,
replace: true,
scope: {
appId: '=',
env: '=',
cluster: '=',
toOperationNamespace: '=',
item: '='
},
link: function (scope) {
var TABLE_VIEW_OPER_TYPE = {
CREATE: 'create',
UPDATE: 'update'
};
scope.doItem = doItem;
scope.collectSelectedClusters = collectSelectedClusters;
scope.showHiddenChars = showHiddenChars;
$('#itemModal').on('show.bs.modal', function (e) {
scope.showHiddenCharsContext = false;
scope.hiddenCharCounter = 0;
scope.valueWithHiddenChars = $sce.trustAsHtml('');
});
$("#valueEditor").textareafullscreen();
function doItem() {
if (!scope.item.value) {
scope.item.value = "";
}
if (scope.item.tableViewOperType == TABLE_VIEW_OPER_TYPE.CREATE) {
//check key unique
var hasRepeatKey = false;
scope.toOperationNamespace.items.forEach(function (item) {
if (!item.isDeleted && scope.item.key == item.item.key) {
toastr.error($translate.instant('ItemModal.KeyExists', { key: scope.item.key }));
hasRepeatKey = true;
}
});
if (hasRepeatKey) {
return;
}
scope.item.addItemBtnDisabled = true;
if (scope.toOperationNamespace.isBranch) {
ConfigService.create_item(scope.appId,
scope.env,
scope.toOperationNamespace.baseInfo.clusterName,
scope.toOperationNamespace.baseInfo.namespaceName,
scope.item).then(
function (result) {
toastr.success($translate.instant('ItemModal.AddedTips'));
scope.item.addItemBtnDisabled = false;
AppUtil.hideModal('#itemModal');
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: scope.toOperationNamespace
});
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('ItemModal.AddFailed'));
scope.item.addItemBtnDisabled = false;
});
} else {
if (selectedClusters.length == 0) {
toastr.error($translate.instant('ItemModal.PleaseChooseCluster'));
scope.item.addItemBtnDisabled = false;
return;
}
selectedClusters.forEach(function (cluster) {
ConfigService.create_item(scope.appId,
cluster.env,
cluster.name,
scope.toOperationNamespace.baseInfo.namespaceName,
scope.item).then(
function (result) {
scope.item.addItemBtnDisabled = false;
AppUtil.hideModal('#itemModal');
toastr.success(cluster.env + " , " + scope.item.key, $translate.instant('ItemModal.AddedTips'));
if (cluster.env == scope.env &&
cluster.name == scope.cluster) {
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: scope.toOperationNamespace
});
}
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('ItemModal.AddFailed'));
scope.item.addItemBtnDisabled = false;
});
});
}
} else {
if (!scope.item.comment) {
scope.item.comment = "";
}
ConfigService.update_item(scope.appId,
scope.env,
scope.toOperationNamespace.baseInfo.clusterName,
scope.toOperationNamespace.baseInfo.namespaceName,
scope.item).then(
function (result) {
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: scope.toOperationNamespace
});
AppUtil.hideModal('#itemModal');
toastr.success($translate.instant('ItemModal.ModifiedTips'));
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('ItemModal.ModifyFailed'));
});
}
}
var selectedClusters = [];
function collectSelectedClusters(data) {
selectedClusters = data;
}
function showHiddenChars() {
var value = scope.item.value;
if (!value) {
return;
}
var hiddenCharCounter = 0, valueWithHiddenChars = _.escape(value);
for (var i = 0; i < value.length; i++) {
var c = value[i];
if (isHiddenChar(c)) {
valueWithHiddenChars = valueWithHiddenChars.replace(c, viewHiddenChar);
hiddenCharCounter++;
}
}
scope.showHiddenCharsContext = true;
scope.hiddenCharCounter = hiddenCharCounter;
scope.valueWithHiddenChars = $sce.trustAsHtml(valueWithHiddenChars);
}
function isHiddenChar(c) {
return c == '\t' || c == '\n' || c == ' ';
}
function viewHiddenChar(c) {
if (c == '\t') {
return '<mark>#' + $translate.instant('ItemModal.Tabs') + '#</mark>';
} else if (c == '\n') {
return '<mark>#' + $translate.instant('ItemModal.NewLine') + '#</mark>';
} else if (c == ' ') {
return '<mark>#' + $translate.instant('ItemModal.Space') + '#</mark>';
}
}
}
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
directive_module.directive('itemmodal', itemModalDirective);
function itemModalDirective($translate, toastr, $sce, AppUtil, EventManager, ConfigService) {
return {
restrict: 'E',
templateUrl: AppUtil.prefixPath() + '/views/component/item-modal.html',
transclude: true,
replace: true,
scope: {
appId: '=',
env: '=',
cluster: '=',
toOperationNamespace: '=',
item: '='
},
link: function (scope) {
var TABLE_VIEW_OPER_TYPE = {
CREATE: 'create',
UPDATE: 'update'
};
scope.doItem = doItem;
scope.collectSelectedClusters = collectSelectedClusters;
scope.showHiddenChars = showHiddenChars;
$('#itemModal').on('show.bs.modal', function (e) {
scope.showHiddenCharsContext = false;
scope.hiddenCharCounter = 0;
scope.valueWithHiddenChars = $sce.trustAsHtml('');
});
$("#valueEditor").textareafullscreen();
function doItem() {
if (!scope.item.value) {
scope.item.value = "";
}
if (scope.item.tableViewOperType == TABLE_VIEW_OPER_TYPE.CREATE) {
//check key unique
var hasRepeatKey = false;
scope.toOperationNamespace.items.forEach(function (item) {
if (!item.isDeleted && scope.item.key == item.item.key) {
toastr.error($translate.instant('ItemModal.KeyExists', { key: scope.item.key }));
hasRepeatKey = true;
}
});
if (hasRepeatKey) {
return;
}
scope.item.addItemBtnDisabled = true;
if (scope.toOperationNamespace.isBranch) {
ConfigService.create_item(scope.appId,
scope.env,
scope.toOperationNamespace.baseInfo.clusterName,
scope.toOperationNamespace.baseInfo.namespaceName,
scope.item).then(
function (result) {
toastr.success($translate.instant('ItemModal.AddedTips'));
scope.item.addItemBtnDisabled = false;
AppUtil.hideModal('#itemModal');
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: scope.toOperationNamespace
});
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('ItemModal.AddFailed'));
scope.item.addItemBtnDisabled = false;
});
} else {
if (selectedClusters.length == 0) {
toastr.error($translate.instant('ItemModal.PleaseChooseCluster'));
scope.item.addItemBtnDisabled = false;
return;
}
selectedClusters.forEach(function (cluster) {
ConfigService.create_item(scope.appId,
cluster.env,
cluster.name,
scope.toOperationNamespace.baseInfo.namespaceName,
scope.item).then(
function (result) {
scope.item.addItemBtnDisabled = false;
AppUtil.hideModal('#itemModal');
toastr.success(cluster.env + " , " + scope.item.key, $translate.instant('ItemModal.AddedTips'));
if (cluster.env == scope.env &&
cluster.name == scope.cluster) {
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: scope.toOperationNamespace
});
}
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('ItemModal.AddFailed'));
scope.item.addItemBtnDisabled = false;
});
});
}
} else {
if (!scope.item.comment) {
scope.item.comment = "";
}
ConfigService.update_item(scope.appId,
scope.env,
scope.toOperationNamespace.baseInfo.clusterName,
scope.toOperationNamespace.baseInfo.namespaceName,
scope.item).then(
function (result) {
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: scope.toOperationNamespace
});
AppUtil.hideModal('#itemModal');
toastr.success($translate.instant('ItemModal.ModifiedTips'));
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('ItemModal.ModifyFailed'));
});
}
}
var selectedClusters = [];
function collectSelectedClusters(data) {
selectedClusters = data;
}
function showHiddenChars() {
var value = scope.item.value;
if (!value) {
return;
}
var hiddenCharCounter = 0, valueWithHiddenChars = _.escape(value);
for (var i = 0; i < value.length; i++) {
var c = value[i];
if (isHiddenChar(c)) {
valueWithHiddenChars = valueWithHiddenChars.replace(c, viewHiddenChar);
hiddenCharCounter++;
}
}
scope.showHiddenCharsContext = true;
scope.hiddenCharCounter = hiddenCharCounter;
scope.valueWithHiddenChars = $sce.trustAsHtml(valueWithHiddenChars);
}
function isHiddenChar(c) {
return c == '\t' || c == '\n' || c == ' ';
}
function viewHiddenChar(c) {
if (c == '\t') {
return '<mark>#' + $translate.instant('ItemModal.Tabs') + '#</mark>';
} else if (c == '\n') {
return '<mark>#' + $translate.instant('ItemModal.NewLine') + '#</mark>';
} else if (c == ' ') {
return '<mark>#' + $translate.instant('ItemModal.Space') + '#</mark>';
}
}
}
}
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/resources/static/views/component/user-selector.html | <select class="{{id}}" style="width: 450px;" ng-disabled="disabled">
<!--
~ Copyright 2021 Apollo Authors
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
</select>
| <select class="{{id}}" style="width: 450px;" ng-disabled="disabled">
<!--
~ Copyright 2021 Apollo Authors
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
</select>
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/resources/static/scripts/services/UserService.js | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
appService.service('UserService', ['$resource', '$q', 'AppUtil', function ($resource, $q, AppUtil) {
var user_resource = $resource('', {}, {
load_user: {
method: 'GET',
url: AppUtil.prefixPath() + '/user'
},
find_users: {
method: 'GET',
url: AppUtil.prefixPath() + '/users'
},
create_or_update_user: {
method: 'POST',
url: AppUtil.prefixPath() + '/users'
}
});
return {
load_user: function () {
var finished = false;
var d = $q.defer();
user_resource.load_user({},
function (result) {
finished = true;
d.resolve(result);
},
function (result) {
finished = true;
d.reject(result);
});
return d.promise;
},
find_users: function (keyword) {
var d = $q.defer();
user_resource.find_users({
keyword: keyword
},
function (result) {
d.resolve(result);
},
function (result) {
d.reject(result);
});
return d.promise;
},
createOrUpdateUser: function (user) {
var d = $q.defer();
user_resource.create_or_update_user({}, user,
function (result) {
d.resolve(result);
},
function (result) {
d.reject(result);
});
return d.promise;
}
}
}]);
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
appService.service('UserService', ['$resource', '$q', 'AppUtil', function ($resource, $q, AppUtil) {
var user_resource = $resource('', {}, {
load_user: {
method: 'GET',
url: AppUtil.prefixPath() + '/user'
},
find_users: {
method: 'GET',
url: AppUtil.prefixPath() + '/users'
},
create_or_update_user: {
method: 'POST',
url: AppUtil.prefixPath() + '/users'
}
});
return {
load_user: function () {
var finished = false;
var d = $q.defer();
user_resource.load_user({},
function (result) {
finished = true;
d.resolve(result);
},
function (result) {
finished = true;
d.reject(result);
});
return d.promise;
},
find_users: function (keyword) {
var d = $q.defer();
user_resource.find_users({
keyword: keyword
},
function (result) {
d.resolve(result);
},
function (result) {
d.reject(result);
});
return d.promise;
},
createOrUpdateUser: function (user) {
var d = $q.defer();
user_resource.create_or_update_user({}, user,
function (result) {
d.resolve(result);
},
function (result) {
d.reject(result);
});
return d.promise;
}
}
}]);
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/resources/static/namespace.html | <!--
~ Copyright 2021 Apollo Authors
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<!doctype html>
<html ng-app="namespace">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" href="./img/config.png">
<!-- styles -->
<link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css">
<link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
<link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css">
<link rel="stylesheet" type="text/css" href="styles/common-style.css">
<title>{{'Namespace.Title' | translate }}</title>
</head>
<body>
<apollonav></apollonav>
<div class="container-fluid apollo-container hidden" ng-controller="LinkNamespaceController">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel">
<header class="panel-heading">
<div class="row">
<div class="col-md-6">{{'Namespace.Title' | translate }}
<small><a target="_blank"
href="https://www.apolloconfig.com/#/zh/design/apollo-core-concept-namespace">
{{'Namespace.UnderstandMore' | translate }}
</a> </small>
</div>
<div class="col-md-6 text-right">
<button type="button" class="btn btn-info"
ng-click="back()">{{'Common.ReturnToIndex' | translate }} </button>
</div>
</div>
</header>
<div class="panel-body">
<div class="alert alert-info no-radius">
<strong>Tips:</strong>
<ul ng-show="type == 'link'">
<li>{{'Namespace.Link.Tips1' | translate }}</li>
<li>{{'Namespace.Link.Tips2' | translate }}</li>
</ul>
<ul ng-show="type == 'create' && appNamespace.isPublic">
<li>{{'Namespace.CreatePublic.Tips1' | translate }}</li>
<li>{{'Namespace.CreatePublic.Tips2' | translate }}</li>
<li>{{'Namespace.CreatePublic.Tips3' | translate }}</li>
<li>{{'Namespace.CreatePublic.Tips4' | translate }}</li>
</ul>
<ul ng-show="type == 'create' && !appNamespace.isPublic">
<li>{{'Namespace.CreatePrivate.Tips1' | translate }}</li>
<li>{{'Namespace.CreatePrivate.Tips2' | translate }}</li>
<li>{{'Namespace.CreatePrivate.Tips3' | translate }}</li>
<li>{{'Namespace.CreatePrivate.Tips4' | translate }}</li>
</ul>
</div>
<div class="row text-right" style="padding-right: 20px;">
<div class="btn-group btn-group-sm" role="group" aria-label="...">
<button type="button" class="btn btn-default" ng-class="{active:type=='link'}"
ng-click="switchType('link')">{{'Namespace.AssociationPublicNamespace' | translate }}
</button>
<button type="button" class="btn btn-default" ng-class="{active:type=='create'}"
ng-click="switchType('create')">{{'Namespace.CreateNamespace' | translate }}
</button>
</div>
</div>
<form class="form-horizontal" name="namespaceForm" valdr-type="AppNamespace"
style="margin-top: 30px;" ng-show="step == 1" ng-submit="createNamespace()">
<div class="form-group">
<label class="col-sm-3 control-label">{{'Common.AppId' | translate }}</label>
<div class="col-sm-6" valdr-form-group>
<label class="form-control-static" ng-bind="appId"></label>
</div>
</div>
<div class="form-horizontal" ng-show="type == 'link'">
<div class="form-group">
<label class="col-sm-3 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Namespace.ChooseCluster' | translate }}
</label>
<div class="col-sm-6" valdr-form-group>
<apolloclusterselector apollo-app-id="appId" apollo-default-all-checked="true"
apollo-select="collectSelectedClusters"></apolloclusterselector>
</div>
</div>
</div>
<div class="form-group" ng-show="type == 'create'">
<label class="col-sm-3 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Namespace.NamespaceName' | translate }}
</label>
<div class="col-sm-5" valdr-form-group>
<div ng-class="{'input-group':appNamespace.isPublic && appendNamespacePrefix}">
<span class="input-group-addon"
ng-show="appNamespace.isPublic && appendNamespacePrefix"
ng-bind="appBaseInfo.namespacePrefix"></span>
<input type="text" name="namespaceName" class="form-control"
ng-model="appNamespace.name">
</div>
</div>
<div class="col-sm-2">
<select class="form-control" name="format" ng-model="appNamespace.format">
<option value="properties">properties</option>
<option value="xml">xml</option>
<option value="json">json</option>
<option value="yml">yml</option>
<option value="yaml">yaml</option>
<option value="txt">txt</option>
</select>
</div>
<span ng-show="appNamespace.isPublic && appendNamespacePrefix"
ng-bind="concatNamespace()" style="line-height: 34px;"></span>
</div>
<div class="form-group" ng-show="type == 'create' && appNamespace.isPublic">
<label class="col-sm-3 control-label">
{{'Namespace.AutoAddDepartmentPrefix' | translate }}
</label>
<div class="col-sm-6" valdr-form-group>
<div>
<label class="checkbox-inline">
<input type="checkbox" ng-model="appendNamespacePrefix" />
{{appBaseInfo.namespacePrefix}}
</label>
</div>
<small>{{'Namespace.AutoAddDepartmentPrefixTips' | translate }}</small>
</div>
</div>
<div class="form-group"
ng-show="type == 'create' && (pageSetting.canAppAdminCreatePrivateNamespace || hasRootPermission)">
<label class="col-sm-3 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Namespace.NamespaceType' | translate }}
</label>
<div class="col-sm-4" valdr-form-group>
<label class="radio-inline">
<input type="radio" name="namespaceType" value="true" ng-value="true"
ng-model="appNamespace.isPublic"> {{'Namespace.NamespaceType.Public' | translate }}
</label>
<label class="radio-inline">
<input type="radio" name="namespaceType" value="false" ng-value="false"
ng-model="appNamespace.isPublic"> {{'Namespace.NamespaceType.Private' | translate }}
</label>
</div>
</div>
<div class="form-group" ng-show="type == 'create'" valdr-form-group>
<label class="col-sm-3 control-label">{{'Namespace.Remark' | translate }}</label>
<div class="col-sm-7" valdr-form-group>
<textarea class="form-control" rows="3" name="comment"
ng-model="appNamespace.comment"></textarea>
</div>
</div>
<div class="form-group" ng-show="type == 'link'">
<label class="col-sm-3 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Namespace.Namespace' | translate }}
</label>
<div class="col-sm-4" valdr-form-group>
<select id="namespaces">
<option></option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-10">
<button type="submit" class="btn btn-primary"
ng-disabled="(type == 'create' && namespaceForm.$invalid) || submitBtnDisabled">
{{'Common.Submit' | translate }}
</button>
</div>
</div>
</form>
<div class="row text-center" ng-show="step == 2">
<img src="img/sync-succ.png" style="height: 100px; width: 100px">
<h3>{{'Common.Created' | translate }}</h3>
</div>
</div>
</div>
</div>
</div>
</div>
<div ng-include="'views/common/footer.html'"></div>
<!--angular-->
<script src="vendor/angular/angular.min.js"></script>
<script src="vendor/angular/angular-resource.min.js"></script>
<script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script>
<script src="vendor/angular/loading-bar.min.js"></script>
<script src="vendor/angular/angular-cookies.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script>
<!-- jquery.js -->
<script src="vendor/jquery.min.js" type="text/javascript"></script>
<script src="vendor/select2/select2.min.js" type="text/javascript"></script>
<!-- bootstrap.js -->
<script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="vendor/valdr/valdr.min.js" type="text/javascript"></script>
<script src="vendor/valdr/valdr-message.min.js" type="text/javascript"></script>
<script type="application/javascript" src="scripts/app.js"></script>
<script type="application/javascript" src="scripts/services/AppService.js"></script>
<script type="application/javascript" src="scripts/services/EnvService.js"></script>
<script type="application/javascript" src="scripts/services/UserService.js"></script>
<script type="application/javascript" src="scripts/services/CommonService.js"></script>
<script type="application/javascript" src="scripts/services/NamespaceService.js"></script>
<script type="application/javascript" src="scripts/services/PermissionService.js"></script>
<script type="application/javascript" src="scripts/AppUtils.js"></script>
<!--directive-->
<script type="application/javascript" src="scripts/directive/directive.js"></script>
<script type="application/javascript" src="scripts/controller/NamespaceController.js"></script>
<script src="scripts/valdr.js" type="text/javascript"></script>
</body>
</html>
| <!--
~ Copyright 2021 Apollo Authors
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<!doctype html>
<html ng-app="namespace">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" href="./img/config.png">
<!-- styles -->
<link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css">
<link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
<link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css">
<link rel="stylesheet" type="text/css" href="styles/common-style.css">
<title>{{'Namespace.Title' | translate }}</title>
</head>
<body>
<apollonav></apollonav>
<div class="container-fluid apollo-container hidden" ng-controller="LinkNamespaceController">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel">
<header class="panel-heading">
<div class="row">
<div class="col-md-6">{{'Namespace.Title' | translate }}
<small><a target="_blank"
href="https://www.apolloconfig.com/#/zh/design/apollo-core-concept-namespace">
{{'Namespace.UnderstandMore' | translate }}
</a> </small>
</div>
<div class="col-md-6 text-right">
<button type="button" class="btn btn-info"
ng-click="back()">{{'Common.ReturnToIndex' | translate }} </button>
</div>
</div>
</header>
<div class="panel-body">
<div class="alert alert-info no-radius">
<strong>Tips:</strong>
<ul ng-show="type == 'link'">
<li>{{'Namespace.Link.Tips1' | translate }}</li>
<li>{{'Namespace.Link.Tips2' | translate }}</li>
</ul>
<ul ng-show="type == 'create' && appNamespace.isPublic">
<li>{{'Namespace.CreatePublic.Tips1' | translate }}</li>
<li>{{'Namespace.CreatePublic.Tips2' | translate }}</li>
<li>{{'Namespace.CreatePublic.Tips3' | translate }}</li>
<li>{{'Namespace.CreatePublic.Tips4' | translate }}</li>
</ul>
<ul ng-show="type == 'create' && !appNamespace.isPublic">
<li>{{'Namespace.CreatePrivate.Tips1' | translate }}</li>
<li>{{'Namespace.CreatePrivate.Tips2' | translate }}</li>
<li>{{'Namespace.CreatePrivate.Tips3' | translate }}</li>
<li>{{'Namespace.CreatePrivate.Tips4' | translate }}</li>
</ul>
</div>
<div class="row text-right" style="padding-right: 20px;">
<div class="btn-group btn-group-sm" role="group" aria-label="...">
<button type="button" class="btn btn-default" ng-class="{active:type=='link'}"
ng-click="switchType('link')">{{'Namespace.AssociationPublicNamespace' | translate }}
</button>
<button type="button" class="btn btn-default" ng-class="{active:type=='create'}"
ng-click="switchType('create')">{{'Namespace.CreateNamespace' | translate }}
</button>
</div>
</div>
<form class="form-horizontal" name="namespaceForm" valdr-type="AppNamespace"
style="margin-top: 30px;" ng-show="step == 1" ng-submit="createNamespace()">
<div class="form-group">
<label class="col-sm-3 control-label">{{'Common.AppId' | translate }}</label>
<div class="col-sm-6" valdr-form-group>
<label class="form-control-static" ng-bind="appId"></label>
</div>
</div>
<div class="form-horizontal" ng-show="type == 'link'">
<div class="form-group">
<label class="col-sm-3 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Namespace.ChooseCluster' | translate }}
</label>
<div class="col-sm-6" valdr-form-group>
<apolloclusterselector apollo-app-id="appId" apollo-default-all-checked="true"
apollo-select="collectSelectedClusters"></apolloclusterselector>
</div>
</div>
</div>
<div class="form-group" ng-show="type == 'create'">
<label class="col-sm-3 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Namespace.NamespaceName' | translate }}
</label>
<div class="col-sm-5" valdr-form-group>
<div ng-class="{'input-group':appNamespace.isPublic && appendNamespacePrefix}">
<span class="input-group-addon"
ng-show="appNamespace.isPublic && appendNamespacePrefix"
ng-bind="appBaseInfo.namespacePrefix"></span>
<input type="text" name="namespaceName" class="form-control"
ng-model="appNamespace.name">
</div>
</div>
<div class="col-sm-2">
<select class="form-control" name="format" ng-model="appNamespace.format">
<option value="properties">properties</option>
<option value="xml">xml</option>
<option value="json">json</option>
<option value="yml">yml</option>
<option value="yaml">yaml</option>
<option value="txt">txt</option>
</select>
</div>
<span ng-show="appNamespace.isPublic && appendNamespacePrefix"
ng-bind="concatNamespace()" style="line-height: 34px;"></span>
</div>
<div class="form-group" ng-show="type == 'create' && appNamespace.isPublic">
<label class="col-sm-3 control-label">
{{'Namespace.AutoAddDepartmentPrefix' | translate }}
</label>
<div class="col-sm-6" valdr-form-group>
<div>
<label class="checkbox-inline">
<input type="checkbox" ng-model="appendNamespacePrefix" />
{{appBaseInfo.namespacePrefix}}
</label>
</div>
<small>{{'Namespace.AutoAddDepartmentPrefixTips' | translate }}</small>
</div>
</div>
<div class="form-group"
ng-show="type == 'create' && (pageSetting.canAppAdminCreatePrivateNamespace || hasRootPermission)">
<label class="col-sm-3 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Namespace.NamespaceType' | translate }}
</label>
<div class="col-sm-4" valdr-form-group>
<label class="radio-inline">
<input type="radio" name="namespaceType" value="true" ng-value="true"
ng-model="appNamespace.isPublic"> {{'Namespace.NamespaceType.Public' | translate }}
</label>
<label class="radio-inline">
<input type="radio" name="namespaceType" value="false" ng-value="false"
ng-model="appNamespace.isPublic"> {{'Namespace.NamespaceType.Private' | translate }}
</label>
</div>
</div>
<div class="form-group" ng-show="type == 'create'" valdr-form-group>
<label class="col-sm-3 control-label">{{'Namespace.Remark' | translate }}</label>
<div class="col-sm-7" valdr-form-group>
<textarea class="form-control" rows="3" name="comment"
ng-model="appNamespace.comment"></textarea>
</div>
</div>
<div class="form-group" ng-show="type == 'link'">
<label class="col-sm-3 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Namespace.Namespace' | translate }}
</label>
<div class="col-sm-4" valdr-form-group>
<select id="namespaces">
<option></option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-10">
<button type="submit" class="btn btn-primary"
ng-disabled="(type == 'create' && namespaceForm.$invalid) || submitBtnDisabled">
{{'Common.Submit' | translate }}
</button>
</div>
</div>
</form>
<div class="row text-center" ng-show="step == 2">
<img src="img/sync-succ.png" style="height: 100px; width: 100px">
<h3>{{'Common.Created' | translate }}</h3>
</div>
</div>
</div>
</div>
</div>
</div>
<div ng-include="'views/common/footer.html'"></div>
<!--angular-->
<script src="vendor/angular/angular.min.js"></script>
<script src="vendor/angular/angular-resource.min.js"></script>
<script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script>
<script src="vendor/angular/loading-bar.min.js"></script>
<script src="vendor/angular/angular-cookies.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script>
<!-- jquery.js -->
<script src="vendor/jquery.min.js" type="text/javascript"></script>
<script src="vendor/select2/select2.min.js" type="text/javascript"></script>
<!-- bootstrap.js -->
<script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="vendor/valdr/valdr.min.js" type="text/javascript"></script>
<script src="vendor/valdr/valdr-message.min.js" type="text/javascript"></script>
<script type="application/javascript" src="scripts/app.js"></script>
<script type="application/javascript" src="scripts/services/AppService.js"></script>
<script type="application/javascript" src="scripts/services/EnvService.js"></script>
<script type="application/javascript" src="scripts/services/UserService.js"></script>
<script type="application/javascript" src="scripts/services/CommonService.js"></script>
<script type="application/javascript" src="scripts/services/NamespaceService.js"></script>
<script type="application/javascript" src="scripts/services/PermissionService.js"></script>
<script type="application/javascript" src="scripts/AppUtils.js"></script>
<!--directive-->
<script type="application/javascript" src="scripts/directive/directive.js"></script>
<script type="application/javascript" src="scripts/controller/NamespaceController.js"></script>
<script src="scripts/valdr.js" type="text/javascript"></script>
</body>
</html>
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/resources/static/scripts/controller/config/ConfigNamespaceController.js | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
application_module.controller("ConfigNamespaceController",
['$rootScope', '$scope', '$translate', 'toastr', 'AppUtil', 'EventManager', 'ConfigService',
'PermissionService', 'UserService', 'NamespaceBranchService', 'NamespaceService',
controller]);
function controller($rootScope, $scope, $translate, toastr, AppUtil, EventManager, ConfigService,
PermissionService, UserService, NamespaceBranchService, NamespaceService) {
$scope.rollback = rollback;
$scope.preDeleteItem = preDeleteItem;
$scope.deleteItem = deleteItem;
$scope.editItem = editItem;
$scope.createItem = createItem;
$scope.preRevokeItem = preRevokeItem;
$scope.revokeItem = revokeItem;
$scope.closeTip = closeTip;
$scope.showText = showText;
$scope.createBranch = createBranch;
$scope.preCreateBranch = preCreateBranch;
$scope.preDeleteBranch = preDeleteBranch;
$scope.deleteBranch = deleteBranch;
$scope.showNoModifyPermissionDialog = showNoModifyPermissionDialog;
$scope.lockCheck = lockCheck;
$scope.emergencyPublish = emergencyPublish;
init();
function init() {
initRole();
initUser();
initPublishInfo();
}
function initRole() {
PermissionService.get_app_role_users($rootScope.pageContext.appId)
.then(function (result) {
var masterUsers = '';
result.masterUsers.forEach(function (user) {
masterUsers += _.escape(user.userId) + ',';
});
$scope.masterUsers = masterUsers.substring(0, masterUsers.length - 1);
}, function (result) {
});
}
function initUser() {
UserService.load_user().then(function (result) {
$scope.currentUser = result.userId;
});
}
function initPublishInfo() {
NamespaceService.getNamespacePublishInfo($rootScope.pageContext.appId)
.then(function (result) {
if (!result) {
return;
}
$scope.hasNotPublishNamespace = false;
var namespacePublishInfo = [];
Object.keys(result).forEach(function (env) {
if (env.indexOf("$") >= 0) {
return;
}
var envPublishInfo = result[env];
Object.keys(envPublishInfo).forEach(function (cluster) {
var clusterPublishInfo = envPublishInfo[cluster];
if (clusterPublishInfo) {
$scope.hasNotPublishNamespace = true;
if (Object.keys(envPublishInfo).length > 1) {
namespacePublishInfo.push("[" + env + ", " + cluster + "]");
} else {
namespacePublishInfo.push("[" + env + "]");
}
}
})
});
$scope.namespacePublishInfo = namespacePublishInfo;
});
}
EventManager.subscribe(EventManager.EventType.REFRESH_NAMESPACE,
function (context) {
if (context.namespace) {
refreshSingleNamespace(context.namespace);
} else {
refreshAllNamespaces(context);
}
});
function refreshAllNamespaces(context) {
if ($rootScope.pageContext.env == '') {
return;
}
ConfigService.load_all_namespaces($rootScope.pageContext.appId,
$rootScope.pageContext.env,
$rootScope.pageContext.clusterName).then(
function (result) {
$scope.namespaces = result;
$('.config-item-container').removeClass('hide');
initPublishInfo();
//If there is a namespace parameter in the URL, expand the corresponding namespace directly
if (context && context.firstLoad && $rootScope.pageContext.namespaceName) {
refreshSingleNamespace({
baseInfo: {
namespaceName: $rootScope.pageContext.namespaceName
},
searchInfo: {
showSearchInput: true,
searchItemKey: $rootScope.pageContext.item,
}
});
}
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Config.LoadingAllNamespaceError'));
});
}
function refreshSingleNamespace(namespace) {
if ($rootScope.pageContext.env == '') {
return;
}
const showSearchItemInput = namespace.searchInfo ? namespace.searchInfo.showSearchInput : false;
const searchItemKey = namespace.searchInfo ? namespace.searchInfo.searchItemKey : '';
ConfigService.load_namespace($rootScope.pageContext.appId,
$rootScope.pageContext.env,
$rootScope.pageContext.clusterName,
namespace.baseInfo.namespaceName).then(
function (result) {
$scope.namespaces.forEach(function (namespace, index) {
if (namespace.baseInfo.namespaceName === result.baseInfo.namespaceName) {
result.showNamespaceBody = true;
result.initialized = true;
result.show = namespace.show;
$scope.namespaces[index] = result;
result.showSearchItemInput = showSearchItemInput;
result.searchItemKey = searchItemKey;
}
});
initPublishInfo();
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Config.LoadingAllNamespaceError'));
});
}
function rollback() {
EventManager.emit(EventManager.EventType.ROLLBACK_NAMESPACE);
}
$scope.tableViewOperType = '', $scope.item = {};
$scope.toOperationNamespace;
var toDeleteItemId = 0;
function preDeleteItem(namespace, item) {
if (!lockCheck(namespace)) {
return;
}
$scope.config = {};
$scope.config.key = _.escape(item.key);
$scope.config.value = _.escape(item.value);
$scope.toOperationNamespace = namespace;
toDeleteItemId = item.id;
$("#deleteConfirmDialog").modal("show");
}
function deleteItem() {
ConfigService.delete_item($rootScope.pageContext.appId,
$rootScope.pageContext.env,
$scope.toOperationNamespace.baseInfo.clusterName,
$scope.toOperationNamespace.baseInfo.namespaceName,
toDeleteItemId).then(
function (result) {
toastr.success($translate.instant('Config.Deleted'));
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: $scope.toOperationNamespace
});
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Config.DeleteFailed'));
});
}
function preRevokeItem(namespace) {
if (!lockCheck(namespace)) {
return;
}
$scope.toOperationNamespace = namespace;
toRevokeItemId = namespace.baseInfo.id;
$("#revokeItemConfirmDialog").modal("show");
}
function revokeItem() {
ConfigService.revoke_item($rootScope.pageContext.appId,
$rootScope.pageContext.env,
$scope.toOperationNamespace.baseInfo.clusterName,
$scope.toOperationNamespace.baseInfo.namespaceName).then(
function (result) {
toastr.success($translate.instant('Revoke.RevokeSuccessfully'));
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: $scope.toOperationNamespace
});
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Revoke.RevokeFailed'));
}
);
}
//修改配置
function editItem(namespace, toEditItem) {
if (!lockCheck(namespace)) {
return;
}
$scope.item = _.clone(toEditItem);
if (namespace.isBranch || namespace.isLinkedNamespace) {
var existedItem = false;
namespace.items.forEach(function (item) {
if (!item.isDeleted && item.item.key == toEditItem.key) {
existedItem = true;
}
});
if (!existedItem) {
$scope.item.lineNum = 0;
$scope.item.tableViewOperType = 'create';
} else {
$scope.item.tableViewOperType = 'update';
}
} else {
$scope.item.tableViewOperType = 'update';
}
$scope.toOperationNamespace = namespace;
AppUtil.showModal('#itemModal');
}
//新增配置
function createItem(namespace) {
if (!lockCheck(namespace)) {
return;
}
$scope.item = {
tableViewOperType: 'create'
};
$scope.toOperationNamespace = namespace;
AppUtil.showModal('#itemModal');
}
var selectedClusters = [];
$scope.collectSelectedClusters = function (data) {
selectedClusters = data;
};
function lockCheck(namespace) {
if (namespace.lockOwner && $scope.currentUser != namespace.lockOwner) {
$scope.lockOwner = namespace.lockOwner;
$('#namespaceLockedDialog').modal('show');
return false;
}
return true;
}
function closeTip(clusterName) {
var hideTip = JSON.parse(localStorage.getItem("hideTip"));
if (!hideTip) {
hideTip = {};
hideTip[$rootScope.pageContext.appId] = {};
}
if (!hideTip[$rootScope.pageContext.appId]) {
hideTip[$rootScope.pageContext.appId] = {};
}
hideTip[$rootScope.pageContext.appId][clusterName] = true;
$rootScope.hideTip = hideTip;
localStorage.setItem("hideTip", JSON.stringify(hideTip));
}
function showText(text) {
$scope.text = text;
$('#showTextModal').modal('show');
}
function showNoModifyPermissionDialog() {
$("#modifyNoPermissionDialog").modal('show');
}
var toCreateBranchNamespace = {};
function preCreateBranch(namespace) {
toCreateBranchNamespace = namespace;
AppUtil.showModal("#createBranchTips");
}
function createBranch() {
NamespaceBranchService.createBranch($rootScope.pageContext.appId,
$rootScope.pageContext.env,
$rootScope.pageContext.clusterName,
toCreateBranchNamespace.baseInfo.namespaceName)
.then(function (result) {
toastr.success($translate.instant('Config.GrayscaleCreated'));
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: toCreateBranchNamespace
});
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Config.GrayscaleCreateFailed'));
})
}
function preDeleteBranch(branch) {
//normal delete
branch.branchStatus = 0;
$scope.toDeleteBranch = branch;
AppUtil.showModal('#deleteBranchDialog');
}
function deleteBranch() {
NamespaceBranchService.deleteBranch($rootScope.pageContext.appId,
$rootScope.pageContext.env,
$rootScope.pageContext.clusterName,
$scope.toDeleteBranch.baseInfo.namespaceName,
$scope.toDeleteBranch.baseInfo.clusterName
)
.then(function (result) {
toastr.success($translate.instant('Config.BranchDeleted'));
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: $scope.toDeleteBranch.parentNamespace
});
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Config.BranchDeleteFailed'));
})
}
EventManager.subscribe(EventManager.EventType.EMERGENCY_PUBLISH,
function (context) {
AppUtil.showModal("#emergencyPublishAlertDialog");
$scope.emergencyPublishContext = context;
});
function emergencyPublish() {
if ($scope.emergencyPublishContext.mergeAndPublish) {
EventManager.emit(EventManager.EventType.MERGE_AND_PUBLISH_NAMESPACE,
{
branch: $scope.emergencyPublishContext.namespace,
isEmergencyPublish: true
});
} else {
EventManager.emit(EventManager.EventType.PUBLISH_NAMESPACE,
{
namespace: $scope.emergencyPublishContext.namespace,
isEmergencyPublish: true
});
}
}
EventManager.subscribe(EventManager.EventType.DELETE_NAMESPACE_FAILED, function (context) {
$scope.deleteNamespaceContext = context;
if (context.reason == 'master_instance') {
AppUtil.showModal('#deleteNamespaceDenyForMasterInstanceDialog');
} else if (context.reason == 'branch_instance') {
AppUtil.showModal('#deleteNamespaceDenyForBranchInstanceDialog');
} else if (context.reason == 'public_namespace') {
var otherAppAssociatedNamespaces = context.otherAppAssociatedNamespaces;
var namespaceTips = [];
otherAppAssociatedNamespaces.forEach(function (namespace) {
var appId = namespace.appId;
var clusterName = namespace.clusterName;
var url = AppUtil.prefixPath() + '/config.html?#/appid=' + appId + '&env=' + $scope.pageContext.env + '&cluster='
+ clusterName;
namespaceTips.push("<a target='_blank' href=\'" + url + "\'>AppId = " + appId + ", Cluster = " + clusterName
+ ", Namespace = " + namespace.namespaceName + "</a>");
});
$scope.deleteNamespaceContext.detailReason = $translate.instant('Config.DeleteNamespaceFailedTips') + "<br>" + namespaceTips.join("<br>");
AppUtil.showModal('#deleteNamespaceDenyForPublicNamespaceDialog');
}
});
EventManager.subscribe(EventManager.EventType.SYNTAX_CHECK_TEXT_FAILED, function (context) {
$scope.syntaxCheckContext = context;
AppUtil.showModal('#syntaxCheckFailedDialog');
});
new Clipboard('.clipboard');
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
application_module.controller("ConfigNamespaceController",
['$rootScope', '$scope', '$translate', 'toastr', 'AppUtil', 'EventManager', 'ConfigService',
'PermissionService', 'UserService', 'NamespaceBranchService', 'NamespaceService',
controller]);
function controller($rootScope, $scope, $translate, toastr, AppUtil, EventManager, ConfigService,
PermissionService, UserService, NamespaceBranchService, NamespaceService) {
$scope.rollback = rollback;
$scope.preDeleteItem = preDeleteItem;
$scope.deleteItem = deleteItem;
$scope.editItem = editItem;
$scope.createItem = createItem;
$scope.preRevokeItem = preRevokeItem;
$scope.revokeItem = revokeItem;
$scope.closeTip = closeTip;
$scope.showText = showText;
$scope.createBranch = createBranch;
$scope.preCreateBranch = preCreateBranch;
$scope.preDeleteBranch = preDeleteBranch;
$scope.deleteBranch = deleteBranch;
$scope.showNoModifyPermissionDialog = showNoModifyPermissionDialog;
$scope.lockCheck = lockCheck;
$scope.emergencyPublish = emergencyPublish;
init();
function init() {
initRole();
initUser();
initPublishInfo();
}
function initRole() {
PermissionService.get_app_role_users($rootScope.pageContext.appId)
.then(function (result) {
var masterUsers = '';
result.masterUsers.forEach(function (user) {
masterUsers += _.escape(user.userId) + ',';
});
$scope.masterUsers = masterUsers.substring(0, masterUsers.length - 1);
}, function (result) {
});
}
function initUser() {
UserService.load_user().then(function (result) {
$scope.currentUser = result.userId;
});
}
function initPublishInfo() {
NamespaceService.getNamespacePublishInfo($rootScope.pageContext.appId)
.then(function (result) {
if (!result) {
return;
}
$scope.hasNotPublishNamespace = false;
var namespacePublishInfo = [];
Object.keys(result).forEach(function (env) {
if (env.indexOf("$") >= 0) {
return;
}
var envPublishInfo = result[env];
Object.keys(envPublishInfo).forEach(function (cluster) {
var clusterPublishInfo = envPublishInfo[cluster];
if (clusterPublishInfo) {
$scope.hasNotPublishNamespace = true;
if (Object.keys(envPublishInfo).length > 1) {
namespacePublishInfo.push("[" + env + ", " + cluster + "]");
} else {
namespacePublishInfo.push("[" + env + "]");
}
}
})
});
$scope.namespacePublishInfo = namespacePublishInfo;
});
}
EventManager.subscribe(EventManager.EventType.REFRESH_NAMESPACE,
function (context) {
if (context.namespace) {
refreshSingleNamespace(context.namespace);
} else {
refreshAllNamespaces(context);
}
});
function refreshAllNamespaces(context) {
if ($rootScope.pageContext.env == '') {
return;
}
ConfigService.load_all_namespaces($rootScope.pageContext.appId,
$rootScope.pageContext.env,
$rootScope.pageContext.clusterName).then(
function (result) {
$scope.namespaces = result;
$('.config-item-container').removeClass('hide');
initPublishInfo();
//If there is a namespace parameter in the URL, expand the corresponding namespace directly
if (context && context.firstLoad && $rootScope.pageContext.namespaceName) {
refreshSingleNamespace({
baseInfo: {
namespaceName: $rootScope.pageContext.namespaceName
},
searchInfo: {
showSearchInput: true,
searchItemKey: $rootScope.pageContext.item,
}
});
}
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Config.LoadingAllNamespaceError'));
});
}
function refreshSingleNamespace(namespace) {
if ($rootScope.pageContext.env == '') {
return;
}
const showSearchItemInput = namespace.searchInfo ? namespace.searchInfo.showSearchInput : false;
const searchItemKey = namespace.searchInfo ? namespace.searchInfo.searchItemKey : '';
ConfigService.load_namespace($rootScope.pageContext.appId,
$rootScope.pageContext.env,
$rootScope.pageContext.clusterName,
namespace.baseInfo.namespaceName).then(
function (result) {
$scope.namespaces.forEach(function (namespace, index) {
if (namespace.baseInfo.namespaceName === result.baseInfo.namespaceName) {
result.showNamespaceBody = true;
result.initialized = true;
result.show = namespace.show;
$scope.namespaces[index] = result;
result.showSearchItemInput = showSearchItemInput;
result.searchItemKey = searchItemKey;
}
});
initPublishInfo();
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Config.LoadingAllNamespaceError'));
});
}
function rollback() {
EventManager.emit(EventManager.EventType.ROLLBACK_NAMESPACE);
}
$scope.tableViewOperType = '', $scope.item = {};
$scope.toOperationNamespace;
var toDeleteItemId = 0;
function preDeleteItem(namespace, item) {
if (!lockCheck(namespace)) {
return;
}
$scope.config = {};
$scope.config.key = _.escape(item.key);
$scope.config.value = _.escape(item.value);
$scope.toOperationNamespace = namespace;
toDeleteItemId = item.id;
$("#deleteConfirmDialog").modal("show");
}
function deleteItem() {
ConfigService.delete_item($rootScope.pageContext.appId,
$rootScope.pageContext.env,
$scope.toOperationNamespace.baseInfo.clusterName,
$scope.toOperationNamespace.baseInfo.namespaceName,
toDeleteItemId).then(
function (result) {
toastr.success($translate.instant('Config.Deleted'));
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: $scope.toOperationNamespace
});
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Config.DeleteFailed'));
});
}
function preRevokeItem(namespace) {
if (!lockCheck(namespace)) {
return;
}
$scope.toOperationNamespace = namespace;
toRevokeItemId = namespace.baseInfo.id;
$("#revokeItemConfirmDialog").modal("show");
}
function revokeItem() {
ConfigService.revoke_item($rootScope.pageContext.appId,
$rootScope.pageContext.env,
$scope.toOperationNamespace.baseInfo.clusterName,
$scope.toOperationNamespace.baseInfo.namespaceName).then(
function (result) {
toastr.success($translate.instant('Revoke.RevokeSuccessfully'));
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: $scope.toOperationNamespace
});
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Revoke.RevokeFailed'));
}
);
}
//修改配置
function editItem(namespace, toEditItem) {
if (!lockCheck(namespace)) {
return;
}
$scope.item = _.clone(toEditItem);
if (namespace.isBranch || namespace.isLinkedNamespace) {
var existedItem = false;
namespace.items.forEach(function (item) {
if (!item.isDeleted && item.item.key == toEditItem.key) {
existedItem = true;
}
});
if (!existedItem) {
$scope.item.lineNum = 0;
$scope.item.tableViewOperType = 'create';
} else {
$scope.item.tableViewOperType = 'update';
}
} else {
$scope.item.tableViewOperType = 'update';
}
$scope.toOperationNamespace = namespace;
AppUtil.showModal('#itemModal');
}
//新增配置
function createItem(namespace) {
if (!lockCheck(namespace)) {
return;
}
$scope.item = {
tableViewOperType: 'create'
};
$scope.toOperationNamespace = namespace;
AppUtil.showModal('#itemModal');
}
var selectedClusters = [];
$scope.collectSelectedClusters = function (data) {
selectedClusters = data;
};
function lockCheck(namespace) {
if (namespace.lockOwner && $scope.currentUser != namespace.lockOwner) {
$scope.lockOwner = namespace.lockOwner;
$('#namespaceLockedDialog').modal('show');
return false;
}
return true;
}
function closeTip(clusterName) {
var hideTip = JSON.parse(localStorage.getItem("hideTip"));
if (!hideTip) {
hideTip = {};
hideTip[$rootScope.pageContext.appId] = {};
}
if (!hideTip[$rootScope.pageContext.appId]) {
hideTip[$rootScope.pageContext.appId] = {};
}
hideTip[$rootScope.pageContext.appId][clusterName] = true;
$rootScope.hideTip = hideTip;
localStorage.setItem("hideTip", JSON.stringify(hideTip));
}
function showText(text) {
$scope.text = text;
$('#showTextModal').modal('show');
}
function showNoModifyPermissionDialog() {
$("#modifyNoPermissionDialog").modal('show');
}
var toCreateBranchNamespace = {};
function preCreateBranch(namespace) {
toCreateBranchNamespace = namespace;
AppUtil.showModal("#createBranchTips");
}
function createBranch() {
NamespaceBranchService.createBranch($rootScope.pageContext.appId,
$rootScope.pageContext.env,
$rootScope.pageContext.clusterName,
toCreateBranchNamespace.baseInfo.namespaceName)
.then(function (result) {
toastr.success($translate.instant('Config.GrayscaleCreated'));
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: toCreateBranchNamespace
});
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Config.GrayscaleCreateFailed'));
})
}
function preDeleteBranch(branch) {
//normal delete
branch.branchStatus = 0;
$scope.toDeleteBranch = branch;
AppUtil.showModal('#deleteBranchDialog');
}
function deleteBranch() {
NamespaceBranchService.deleteBranch($rootScope.pageContext.appId,
$rootScope.pageContext.env,
$rootScope.pageContext.clusterName,
$scope.toDeleteBranch.baseInfo.namespaceName,
$scope.toDeleteBranch.baseInfo.clusterName
)
.then(function (result) {
toastr.success($translate.instant('Config.BranchDeleted'));
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: $scope.toDeleteBranch.parentNamespace
});
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Config.BranchDeleteFailed'));
})
}
EventManager.subscribe(EventManager.EventType.EMERGENCY_PUBLISH,
function (context) {
AppUtil.showModal("#emergencyPublishAlertDialog");
$scope.emergencyPublishContext = context;
});
function emergencyPublish() {
if ($scope.emergencyPublishContext.mergeAndPublish) {
EventManager.emit(EventManager.EventType.MERGE_AND_PUBLISH_NAMESPACE,
{
branch: $scope.emergencyPublishContext.namespace,
isEmergencyPublish: true
});
} else {
EventManager.emit(EventManager.EventType.PUBLISH_NAMESPACE,
{
namespace: $scope.emergencyPublishContext.namespace,
isEmergencyPublish: true
});
}
}
EventManager.subscribe(EventManager.EventType.DELETE_NAMESPACE_FAILED, function (context) {
$scope.deleteNamespaceContext = context;
if (context.reason == 'master_instance') {
AppUtil.showModal('#deleteNamespaceDenyForMasterInstanceDialog');
} else if (context.reason == 'branch_instance') {
AppUtil.showModal('#deleteNamespaceDenyForBranchInstanceDialog');
} else if (context.reason == 'public_namespace') {
var otherAppAssociatedNamespaces = context.otherAppAssociatedNamespaces;
var namespaceTips = [];
otherAppAssociatedNamespaces.forEach(function (namespace) {
var appId = namespace.appId;
var clusterName = namespace.clusterName;
var url = AppUtil.prefixPath() + '/config.html?#/appid=' + appId + '&env=' + $scope.pageContext.env + '&cluster='
+ clusterName;
namespaceTips.push("<a target='_blank' href=\'" + url + "\'>AppId = " + appId + ", Cluster = " + clusterName
+ ", Namespace = " + namespace.namespaceName + "</a>");
});
$scope.deleteNamespaceContext.detailReason = $translate.instant('Config.DeleteNamespaceFailedTips') + "<br>" + namespaceTips.join("<br>");
AppUtil.showModal('#deleteNamespaceDenyForPublicNamespaceDialog');
}
});
EventManager.subscribe(EventManager.EventType.SYNTAX_CHECK_TEXT_FAILED, function (context) {
$scope.syntaxCheckContext = context;
AppUtil.showModal('#syntaxCheckFailedDialog');
});
new Clipboard('.clipboard');
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/resources/static/config/history.html | <!--
~ Copyright 2021 Apollo Authors
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<!doctype html>
<html ng-app="release_history">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" href="../img/config.png">
<!-- styles -->
<link rel="stylesheet" type="text/css" href="../vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../vendor/angular/angular-toastr-1.4.1.min.css">
<link rel="stylesheet" type="text/css" media='all' href="../vendor/angular/loading-bar.min.css">
<link rel="stylesheet" type="text/css" href="../styles/common-style.css">
<link rel="stylesheet" type="text/css" href="../vendor/select2/select2.min.css">
<title>{{'Config.History.Title' | translate }}</title>
</head>
<body>
<apollonav></apollonav>
<div class="container-fluid apollo-container" ng-controller="ReleaseHistoryController">
<section class="release-history panel col-md-12 no-radius hidden">
<div class="panel-heading row">
<div class="operation-caption-container col-md-3">
<div class="operation-caption release-operation-normal text-center" style="left:0;">
<small>{{'Config.History.MasterVersionPublish' | translate }}</small>
</div>
<div class="operation-caption release-operation-rollback text-center" style="left: 110px;">
<small>{{'Config.History.MasterVersionRollback' | translate }}</small>
</div>
<div class="operation-caption release-operation-gray text-center" style="left: 220px;">
<small>{{'Config.History.GrayscaleOperator' | translate }}</small>
</div>
</div>
<div class="col-md-6 text-center">
<h4>{{'Config.History.PublishHistory' | translate }}</h4>
<small>({{'Common.AppId' | translate }}:{{pageContext.appId}},
{{'Common.Environment' | translate }}:{{pageContext.env}},
{{'Common.Cluster' | translate }}:{{pageContext.clusterName}},
{{'Common.Namespace' | translate }}:{{pageContext.namespaceName}})
</small>
</div>
<div class="pull-right back-btn">
<a type="button" class="btn btn-info"
href="{{ '/config.html' | prefixPath }}?#/appid={{pageContext.appId}}">{{'Common.ReturnToIndex' | translate }}
</a>
</div>
</div>
<div class="release-history-container panel-body row"
ng-show="!isConfigHidden && releaseHistories && releaseHistories.length > 0">
<div class="release-history-list col-md-3">
<div class="media hover" ng-class="{'active': releaseHistory.id == selectedReleaseHistory}"
ng-repeat="releaseHistory in releaseHistories"
ng-click="showReleaseHistoryDetail(releaseHistory)">
<div class="release-operation"
ng-class="{'release-operation-normal': releaseHistory.operation == 0 || releaseHistory.operation == 5,
'release-operation-gray': releaseHistory.operation == 2 || releaseHistory.operation == 3 ||
releaseHistory.operation == 4 || releaseHistory.operation == 7 || releaseHistory.operation == 8,
'release-operation-rollback': releaseHistory.operation == 1 || releaseHistory.operation == 6}">
</div>
<h4 class="media-left text-center" ng-bind="releaseHistory.operatorDisplayName + '(' + releaseHistory.operator + ')'">
</h4>
<div class="media-body">
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 0">
{{'Config.History.OperationType0' | translate }}</h5>
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 1">
{{'Config.History.OperationType1' | translate }}</h5>
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 2">
{{'Config.History.OperationType2' | translate }}</h5>
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 3">
{{'Config.History.OperationType3' | translate }}</h5>
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 4">
{{'Config.History.OperationType4' | translate }}</h5>
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 5">
{{'Config.History.OperationType5' | translate }}</h5>
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 6">
{{'Config.History.OperationType6' | translate }}</h5>
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 7">
{{'Config.History.OperationType7' | translate }}</h5>
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 8">
{{'Config.History.OperationType8' | translate }}</h5>
<h6 class="col-md-5 text-right" ng-bind="releaseHistory.releaseTimeFormatted"></h6>
<span class="label label-warning no-radius emergency-publish"
ng-if="releaseHistory.operationContext.isEmergencyPublish">{{'Config.History.UrgentPublish' | translate }}</span>
</div>
</div>
<div class="load-more media panel-heading text-center hover" ng-show="!hasLoadAll"
ng-click="findReleaseHistory()">
{{'Config.History.LoadMore' | translate }}
</div>
</div>
<!--properties mode info-->
<div class="release-info col-md-9 panel panel-default no-radius" ng-show="!isTextNamespace">
<div class="panel-heading">
<span ng-bind="history.releaseTitle"></span>
<span class="label label-warning no-radius" ng-if="history.isReleaseAbandoned">{{'Config.History.Abandoned' | translate }}</span>
<span class="pull-right" ng-bind="history.releaseTime | date: 'yyyy-MM-dd HH:mm:ss'"></span>
<div class="row" style="padding-top: 10px;">
<div class="col-md-5">
<small ng-show="history.releaseComment" ng-bind="history.releaseComment"></small>
</div>
<div class="col-md-7 text-right">
<button type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom"
title="{{'Config.History.RollbackToTips' | translate }}"
ng-show="namespace.hasReleasePermission && !history.isReleaseAbandoned
&& (history.operation == 0 || history.operation == 1 || history.operation == 4)"
ng-click="preRollback()">
<img src="../img/rollback.png">
{{'Config.History.RollbackTo' | translate }}
</button>
<div class="btn-group">
<button type="button" class="btn btn-default btn-sm"
ng-class="{'active':history.viewType == 'diff'}" data-tooltip="tooltip"
data-placement="bottom" title="{{'Config.History.ChangedItemTips' | translate }}"
ng-click="switchConfigViewType(history, 'diff')">{{'Config.History.ChangedItem' | translate }}
</button>
<button type="button" class="btn btn-default btn-sm"
ng-class="{'active':history.viewType == 'all'}" data-tooltip="tooltip"
data-placement="bottom" title="{{'Config.History.AllItemTips' | translate }}"
ng-click="switchConfigViewType(history, 'all')">{{'Config.History.AllItem' | translate }}
</button>
</div>
</div>
</div>
</div>
<div class="panel-body config">
<section ng-show="history.viewType=='diff'">
<h4 class="section-title">{{'Config.History.ChangedItem' | translate }}</h4>
<div ng-show="history.changes && history.changes.length > 0">
<table class="no-margin table table-striped table-hover table-bordered">
<thead>
<tr>
<th>{{'Config.History.ChangeType' | translate }}</th>
<th>{{'Config.History.ChangeKey' | translate }}</th>
<th>{{'Config.History.ChangeOldValue' | translate }}</th>
<th>{{'Config.History.ChangeNewValue' | translate }}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="change in history.changes">
<td width="10%">
<span
ng-show="change.type == 'ADDED'">{{'Config.History.ChangeTypeNew' | translate }}</span>
<span
ng-show="change.type == 'MODIFIED'">{{'Config.History.ChangeTypeModify' | translate }}</span>
<span
ng-show="change.type == 'DELETED'">{{'Config.History.ChangeTypeDelete' | translate }}</span>
</td>
<td class="cursor-pointer" width="20%"
ng-click="showText(change.entity.firstEntity.key)">
<span ng-bind="change.entity.firstEntity.key | limitTo: 250"></span>
<span
ng-bind="change.entity.firstEntity.key.length > 250 ? '...' :''"></span>
</td>
<td class="cursor-pointer" width="35%"
ng-click="showText(change.entity.firstEntity.value)">
<span ng-bind="change.entity.firstEntity.value | limitTo: 250"></span>
<span
ng-bind="change.entity.firstEntity.value.length > 250 ? '...' :''"></span>
</td>
<td class="cursor-pointer" width="35%"
ng-click="showText(change.entity.secondEntity.value)">
<span ng-bind="change.entity.secondEntity.value | limitTo: 250"></span>
<span
ng-bind="change.entity.secondEntity.value.length > 250 ? '...' :''"></span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="text-center empty-container"
ng-show="!history.changes || history.changes.length == 0">
<h5>{{'Config.History.NoChange' | translate }}</h5>
</div>
</section>
<section ng-show="history.viewType=='all'">
<h4 class="section-title">{{'Config.History.AllItem' | translate }}</h4>
<table class="no-margin table table-striped table-hover table-bordered"
ng-show="history.configuration && history.configuration.length > 0">
<thead>
<tr>
<th>{{'Config.History.ChangeKey' | translate }}</th>
<th>{{'Config.History.ChangeValue' | translate }}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in history.configuration">
<td class="cursor-pointer" width="30%" ng-click="showText(item.firstEntity)">
<span ng-bind="item.firstEntity | limitTo: 250"></span>
<span ng-bind="item.firstEntity.length > 250 ? '...' :''"></span>
</td>
<td class="cursor-pointer" width="70%" ng-click="showText(item.secondEntity)">
<span ng-bind="item.secondEntity | limitTo: 250"></span>
<span ng-bind="item.secondEntity.length > 250 ? '...' :''"></span>
</td>
</tr>
</tbody>
</table>
<div class="text-center empty-container"
ng-show="history.viewType=='all' && (!history.configuration || history.configuration.length == 0)">
<h5>{{'Config.History.NoItem' | translate }}</h5>
</div>
</section>
<section
ng-show="history.branchName != history.clusterName && history.operation != 8 && history.operation != 7">
<hr>
<h4 class="section-title">{{'Config.History.GrayscaleRule' | translate }}</h4>
<table class="no-margin table table-striped table-hover table-bordered"
ng-show="history.operationContext.rules">
<thead>
<tr>
<th>{{'Config.History.GrayscaleAppId' | translate }}</th>
<th>{{'Config.History.GrayscaleIp' | translate }}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="rule in history.operationContext.rules">
<td width="20%" ng-bind="rule.clientAppId"></td>
<td width="80%" ng-bind="rule.clientIpList.join(', ')"></td>
</tr>
</tbody>
</table>
<h5 class="text-center empty-container" ng-show="!history.operationContext.rules">
{{'Config.History.NoGrayscaleRule' | translate }}
</h5>
</section>
</div>
</div>
<!--text mode-->
<div class="release-info col-md-9"
ng-show="isTextNamespace && history.changes && history.changes.length > 0">
<apollodiff ng-repeat="change in history.changes" old-str="change.entity.firstEntity.value"
new-str="change.entity.secondEntity.value" apollo-id="'releaseStrDiff'">
</apollodiff>
</div>
</div>
<div class="panel-body" ng-show="isConfigHidden || !releaseHistories || releaseHistories.length == 0">
<h4 class="text-center empty-container" ng-show="isConfigHidden">
{{'Config.History.NoPermissionTips' | translate }}</h4>
<h4 class="text-center empty-container" ng-show="!isConfigHidden">
{{'Config.History.NoPublishHistory' | translate }}</h4>
</div>
</section>
<showtextmodal text="text"></showtextmodal>
<rollbackmodal app-id="pageContext.appId" env="pageContext.env" cluster="pageContext.clusterName">
</rollbackmodal>
<apolloconfirmdialog apollo-dialog-id="'rollbackAlertDialog'"
apollo-title="'Config.RollbackAlert.DialogTitle' | translate"
apollo-detail="'Config.RollbackAlert.DialogContent' | translate" apollo-show-cancel-btn="true"
apollo-confirm="rollback">
</apolloconfirmdialog>
</div>
<div ng-include="'../views/common/footer.html'"></div>
<!-- jquery.js -->
<script src="../vendor/jquery.min.js" type="text/javascript"></script>
<script src="../vendor/select2/select2.min.js" type="text/javascript"></script>
<!--angular-->
<script src="../vendor/angular/angular.min.js"></script>
<script src="../vendor/angular/angular-resource.min.js"></script>
<script src="../vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script>
<script src="../vendor/angular/loading-bar.min.js"></script>
<script src="../vendor/angular/angular-cookies.min.js"></script>
<script src="../vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script>
<script src="../vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script>
<script src="../vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script>
<!-- bootstrap.js -->
<script src="../vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../vendor/diff.min.js" type="text/javascript"></script>
<!--biz-->
<script type="application/javascript" src="../scripts/app.js"></script>
<script type="application/javascript" src="../scripts/services/AppService.js"></script>
<script type="application/javascript" src="../scripts/services/EnvService.js"></script>
<script type="application/javascript" src="../scripts/services/ReleaseService.js"></script>
<script type="application/javascript" src="../scripts/services/UserService.js"></script>
<script type="application/javascript" src="../scripts/services/CommonService.js"></script>
<script type="application/javascript" src="../scripts/services/ReleaseHistoryService.js"></script>
<script type="application/javascript" src="../scripts/services/ConfigService.js"></script>
<script type="application/javascript" src="../scripts/services/PermissionService.js"></script>
<script type="application/javascript" src="../scripts/services/EventManager.js"></script>
<script type="application/javascript" src="../scripts/AppUtils.js"></script>
<script type="application/javascript" src="../scripts/controller/config/ReleaseHistoryController.js"></script>
<script type="application/javascript" src="../scripts/PageCommon.js"></script>
<script type="application/javascript" src="../scripts/directive/directive.js"></script>
<script type="application/javascript" src="../scripts/directive/show-text-modal-directive.js"></script>
<script type="application/javascript" src="../scripts/directive/diff-directive.js"></script>
<script type="application/javascript" src="../scripts/directive/rollback-modal-directive.js"></script>
</body>
</html> | <!--
~ Copyright 2021 Apollo Authors
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<!doctype html>
<html ng-app="release_history">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" href="../img/config.png">
<!-- styles -->
<link rel="stylesheet" type="text/css" href="../vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../vendor/angular/angular-toastr-1.4.1.min.css">
<link rel="stylesheet" type="text/css" media='all' href="../vendor/angular/loading-bar.min.css">
<link rel="stylesheet" type="text/css" href="../styles/common-style.css">
<link rel="stylesheet" type="text/css" href="../vendor/select2/select2.min.css">
<title>{{'Config.History.Title' | translate }}</title>
</head>
<body>
<apollonav></apollonav>
<div class="container-fluid apollo-container" ng-controller="ReleaseHistoryController">
<section class="release-history panel col-md-12 no-radius hidden">
<div class="panel-heading row">
<div class="operation-caption-container col-md-3">
<div class="operation-caption release-operation-normal text-center" style="left:0;">
<small>{{'Config.History.MasterVersionPublish' | translate }}</small>
</div>
<div class="operation-caption release-operation-rollback text-center" style="left: 110px;">
<small>{{'Config.History.MasterVersionRollback' | translate }}</small>
</div>
<div class="operation-caption release-operation-gray text-center" style="left: 220px;">
<small>{{'Config.History.GrayscaleOperator' | translate }}</small>
</div>
</div>
<div class="col-md-6 text-center">
<h4>{{'Config.History.PublishHistory' | translate }}</h4>
<small>({{'Common.AppId' | translate }}:{{pageContext.appId}},
{{'Common.Environment' | translate }}:{{pageContext.env}},
{{'Common.Cluster' | translate }}:{{pageContext.clusterName}},
{{'Common.Namespace' | translate }}:{{pageContext.namespaceName}})
</small>
</div>
<div class="pull-right back-btn">
<a type="button" class="btn btn-info"
href="{{ '/config.html' | prefixPath }}?#/appid={{pageContext.appId}}">{{'Common.ReturnToIndex' | translate }}
</a>
</div>
</div>
<div class="release-history-container panel-body row"
ng-show="!isConfigHidden && releaseHistories && releaseHistories.length > 0">
<div class="release-history-list col-md-3">
<div class="media hover" ng-class="{'active': releaseHistory.id == selectedReleaseHistory}"
ng-repeat="releaseHistory in releaseHistories"
ng-click="showReleaseHistoryDetail(releaseHistory)">
<div class="release-operation"
ng-class="{'release-operation-normal': releaseHistory.operation == 0 || releaseHistory.operation == 5,
'release-operation-gray': releaseHistory.operation == 2 || releaseHistory.operation == 3 ||
releaseHistory.operation == 4 || releaseHistory.operation == 7 || releaseHistory.operation == 8,
'release-operation-rollback': releaseHistory.operation == 1 || releaseHistory.operation == 6}">
</div>
<h4 class="media-left text-center" ng-bind="releaseHistory.operatorDisplayName + '(' + releaseHistory.operator + ')'">
</h4>
<div class="media-body">
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 0">
{{'Config.History.OperationType0' | translate }}</h5>
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 1">
{{'Config.History.OperationType1' | translate }}</h5>
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 2">
{{'Config.History.OperationType2' | translate }}</h5>
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 3">
{{'Config.History.OperationType3' | translate }}</h5>
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 4">
{{'Config.History.OperationType4' | translate }}</h5>
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 5">
{{'Config.History.OperationType5' | translate }}</h5>
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 6">
{{'Config.History.OperationType6' | translate }}</h5>
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 7">
{{'Config.History.OperationType7' | translate }}</h5>
<h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 8">
{{'Config.History.OperationType8' | translate }}</h5>
<h6 class="col-md-5 text-right" ng-bind="releaseHistory.releaseTimeFormatted"></h6>
<span class="label label-warning no-radius emergency-publish"
ng-if="releaseHistory.operationContext.isEmergencyPublish">{{'Config.History.UrgentPublish' | translate }}</span>
</div>
</div>
<div class="load-more media panel-heading text-center hover" ng-show="!hasLoadAll"
ng-click="findReleaseHistory()">
{{'Config.History.LoadMore' | translate }}
</div>
</div>
<!--properties mode info-->
<div class="release-info col-md-9 panel panel-default no-radius" ng-show="!isTextNamespace">
<div class="panel-heading">
<span ng-bind="history.releaseTitle"></span>
<span class="label label-warning no-radius" ng-if="history.isReleaseAbandoned">{{'Config.History.Abandoned' | translate }}</span>
<span class="pull-right" ng-bind="history.releaseTime | date: 'yyyy-MM-dd HH:mm:ss'"></span>
<div class="row" style="padding-top: 10px;">
<div class="col-md-5">
<small ng-show="history.releaseComment" ng-bind="history.releaseComment"></small>
</div>
<div class="col-md-7 text-right">
<button type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom"
title="{{'Config.History.RollbackToTips' | translate }}"
ng-show="namespace.hasReleasePermission && !history.isReleaseAbandoned
&& (history.operation == 0 || history.operation == 1 || history.operation == 4)"
ng-click="preRollback()">
<img src="../img/rollback.png">
{{'Config.History.RollbackTo' | translate }}
</button>
<div class="btn-group">
<button type="button" class="btn btn-default btn-sm"
ng-class="{'active':history.viewType == 'diff'}" data-tooltip="tooltip"
data-placement="bottom" title="{{'Config.History.ChangedItemTips' | translate }}"
ng-click="switchConfigViewType(history, 'diff')">{{'Config.History.ChangedItem' | translate }}
</button>
<button type="button" class="btn btn-default btn-sm"
ng-class="{'active':history.viewType == 'all'}" data-tooltip="tooltip"
data-placement="bottom" title="{{'Config.History.AllItemTips' | translate }}"
ng-click="switchConfigViewType(history, 'all')">{{'Config.History.AllItem' | translate }}
</button>
</div>
</div>
</div>
</div>
<div class="panel-body config">
<section ng-show="history.viewType=='diff'">
<h4 class="section-title">{{'Config.History.ChangedItem' | translate }}</h4>
<div ng-show="history.changes && history.changes.length > 0">
<table class="no-margin table table-striped table-hover table-bordered">
<thead>
<tr>
<th>{{'Config.History.ChangeType' | translate }}</th>
<th>{{'Config.History.ChangeKey' | translate }}</th>
<th>{{'Config.History.ChangeOldValue' | translate }}</th>
<th>{{'Config.History.ChangeNewValue' | translate }}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="change in history.changes">
<td width="10%">
<span
ng-show="change.type == 'ADDED'">{{'Config.History.ChangeTypeNew' | translate }}</span>
<span
ng-show="change.type == 'MODIFIED'">{{'Config.History.ChangeTypeModify' | translate }}</span>
<span
ng-show="change.type == 'DELETED'">{{'Config.History.ChangeTypeDelete' | translate }}</span>
</td>
<td class="cursor-pointer" width="20%"
ng-click="showText(change.entity.firstEntity.key)">
<span ng-bind="change.entity.firstEntity.key | limitTo: 250"></span>
<span
ng-bind="change.entity.firstEntity.key.length > 250 ? '...' :''"></span>
</td>
<td class="cursor-pointer" width="35%"
ng-click="showText(change.entity.firstEntity.value)">
<span ng-bind="change.entity.firstEntity.value | limitTo: 250"></span>
<span
ng-bind="change.entity.firstEntity.value.length > 250 ? '...' :''"></span>
</td>
<td class="cursor-pointer" width="35%"
ng-click="showText(change.entity.secondEntity.value)">
<span ng-bind="change.entity.secondEntity.value | limitTo: 250"></span>
<span
ng-bind="change.entity.secondEntity.value.length > 250 ? '...' :''"></span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="text-center empty-container"
ng-show="!history.changes || history.changes.length == 0">
<h5>{{'Config.History.NoChange' | translate }}</h5>
</div>
</section>
<section ng-show="history.viewType=='all'">
<h4 class="section-title">{{'Config.History.AllItem' | translate }}</h4>
<table class="no-margin table table-striped table-hover table-bordered"
ng-show="history.configuration && history.configuration.length > 0">
<thead>
<tr>
<th>{{'Config.History.ChangeKey' | translate }}</th>
<th>{{'Config.History.ChangeValue' | translate }}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in history.configuration">
<td class="cursor-pointer" width="30%" ng-click="showText(item.firstEntity)">
<span ng-bind="item.firstEntity | limitTo: 250"></span>
<span ng-bind="item.firstEntity.length > 250 ? '...' :''"></span>
</td>
<td class="cursor-pointer" width="70%" ng-click="showText(item.secondEntity)">
<span ng-bind="item.secondEntity | limitTo: 250"></span>
<span ng-bind="item.secondEntity.length > 250 ? '...' :''"></span>
</td>
</tr>
</tbody>
</table>
<div class="text-center empty-container"
ng-show="history.viewType=='all' && (!history.configuration || history.configuration.length == 0)">
<h5>{{'Config.History.NoItem' | translate }}</h5>
</div>
</section>
<section
ng-show="history.branchName != history.clusterName && history.operation != 8 && history.operation != 7">
<hr>
<h4 class="section-title">{{'Config.History.GrayscaleRule' | translate }}</h4>
<table class="no-margin table table-striped table-hover table-bordered"
ng-show="history.operationContext.rules">
<thead>
<tr>
<th>{{'Config.History.GrayscaleAppId' | translate }}</th>
<th>{{'Config.History.GrayscaleIp' | translate }}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="rule in history.operationContext.rules">
<td width="20%" ng-bind="rule.clientAppId"></td>
<td width="80%" ng-bind="rule.clientIpList.join(', ')"></td>
</tr>
</tbody>
</table>
<h5 class="text-center empty-container" ng-show="!history.operationContext.rules">
{{'Config.History.NoGrayscaleRule' | translate }}
</h5>
</section>
</div>
</div>
<!--text mode-->
<div class="release-info col-md-9"
ng-show="isTextNamespace && history.changes && history.changes.length > 0">
<apollodiff ng-repeat="change in history.changes" old-str="change.entity.firstEntity.value"
new-str="change.entity.secondEntity.value" apollo-id="'releaseStrDiff'">
</apollodiff>
</div>
</div>
<div class="panel-body" ng-show="isConfigHidden || !releaseHistories || releaseHistories.length == 0">
<h4 class="text-center empty-container" ng-show="isConfigHidden">
{{'Config.History.NoPermissionTips' | translate }}</h4>
<h4 class="text-center empty-container" ng-show="!isConfigHidden">
{{'Config.History.NoPublishHistory' | translate }}</h4>
</div>
</section>
<showtextmodal text="text"></showtextmodal>
<rollbackmodal app-id="pageContext.appId" env="pageContext.env" cluster="pageContext.clusterName">
</rollbackmodal>
<apolloconfirmdialog apollo-dialog-id="'rollbackAlertDialog'"
apollo-title="'Config.RollbackAlert.DialogTitle' | translate"
apollo-detail="'Config.RollbackAlert.DialogContent' | translate" apollo-show-cancel-btn="true"
apollo-confirm="rollback">
</apolloconfirmdialog>
</div>
<div ng-include="'../views/common/footer.html'"></div>
<!-- jquery.js -->
<script src="../vendor/jquery.min.js" type="text/javascript"></script>
<script src="../vendor/select2/select2.min.js" type="text/javascript"></script>
<!--angular-->
<script src="../vendor/angular/angular.min.js"></script>
<script src="../vendor/angular/angular-resource.min.js"></script>
<script src="../vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script>
<script src="../vendor/angular/loading-bar.min.js"></script>
<script src="../vendor/angular/angular-cookies.min.js"></script>
<script src="../vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script>
<script src="../vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script>
<script src="../vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script>
<!-- bootstrap.js -->
<script src="../vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../vendor/diff.min.js" type="text/javascript"></script>
<!--biz-->
<script type="application/javascript" src="../scripts/app.js"></script>
<script type="application/javascript" src="../scripts/services/AppService.js"></script>
<script type="application/javascript" src="../scripts/services/EnvService.js"></script>
<script type="application/javascript" src="../scripts/services/ReleaseService.js"></script>
<script type="application/javascript" src="../scripts/services/UserService.js"></script>
<script type="application/javascript" src="../scripts/services/CommonService.js"></script>
<script type="application/javascript" src="../scripts/services/ReleaseHistoryService.js"></script>
<script type="application/javascript" src="../scripts/services/ConfigService.js"></script>
<script type="application/javascript" src="../scripts/services/PermissionService.js"></script>
<script type="application/javascript" src="../scripts/services/EventManager.js"></script>
<script type="application/javascript" src="../scripts/AppUtils.js"></script>
<script type="application/javascript" src="../scripts/controller/config/ReleaseHistoryController.js"></script>
<script type="application/javascript" src="../scripts/PageCommon.js"></script>
<script type="application/javascript" src="../scripts/directive/directive.js"></script>
<script type="application/javascript" src="../scripts/directive/show-text-modal-directive.js"></script>
<script type="application/javascript" src="../scripts/directive/diff-directive.js"></script>
<script type="application/javascript" src="../scripts/directive/rollback-modal-directive.js"></script>
</body>
</html> | -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/resources/static/scripts/directive/diff-directive.js | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
directive_module.directive('apollodiff',
function ($compile, $window, AppUtil) {
return {
restrict: 'E',
templateUrl: AppUtil.prefixPath() + '/views/component/diff.html',
transclude: true,
replace: true,
scope: {
oldStr: '=',
newStr: '=',
apolloId: '='
},
link: function (scope, element, attrs) {
scope.$watch('oldStr', makeDiff);
scope.$watch('newStr', makeDiff);
function makeDiff() {
var displayArea = document.getElementById(scope.apolloId);
if (!displayArea) {
return;
}
//clear
displayArea.innerHTML = '';
var color = '',
span = null,
pre = '';
var oldStr = scope.oldStr == undefined ? '' : scope.oldStr;
var newStr = scope.newStr == undefined ? '' : scope.newStr;
var diff = JsDiff.diffLines(oldStr, newStr),
fragment = document.createDocumentFragment();
diff.forEach(function (part) {
// green for additions, red for deletions
// grey for common parts
color = part.added ? 'green' :
part.removed ? 'red' : 'grey';
span = document.createElement('span');
span.style.color = color;
pre = part.added ? '+' :
part.removed ? '-' : '';
span.appendChild(document.createTextNode(pre + part.value));
fragment.appendChild(span);
});
displayArea.appendChild(fragment);
}
}
}
});
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
directive_module.directive('apollodiff',
function ($compile, $window, AppUtil) {
return {
restrict: 'E',
templateUrl: AppUtil.prefixPath() + '/views/component/diff.html',
transclude: true,
replace: true,
scope: {
oldStr: '=',
newStr: '=',
apolloId: '='
},
link: function (scope, element, attrs) {
scope.$watch('oldStr', makeDiff);
scope.$watch('newStr', makeDiff);
function makeDiff() {
var displayArea = document.getElementById(scope.apolloId);
if (!displayArea) {
return;
}
//clear
displayArea.innerHTML = '';
var color = '',
span = null,
pre = '';
var oldStr = scope.oldStr == undefined ? '' : scope.oldStr;
var newStr = scope.newStr == undefined ? '' : scope.newStr;
var diff = JsDiff.diffLines(oldStr, newStr),
fragment = document.createDocumentFragment();
diff.forEach(function (part) {
// green for additions, red for deletions
// grey for common parts
color = part.added ? 'green' :
part.removed ? 'red' : 'grey';
span = document.createElement('span');
span.style.color = color;
pre = part.added ? '+' :
part.removed ? '-' : '';
span.appendChild(document.createTextNode(pre + part.value));
fragment.appendChild(span);
});
displayArea.appendChild(fragment);
}
}
}
});
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-core/src/main/java/com/ctrip/framework/foundation/internals/ServiceBootstrap.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.foundation.internals;
import com.ctrip.framework.apollo.core.spi.Ordered;
import com.google.common.collect.Lists;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.ServiceLoader;
public class ServiceBootstrap {
public static <S> S loadFirst(Class<S> clazz) {
Iterator<S> iterator = loadAll(clazz);
if (!iterator.hasNext()) {
throw new IllegalStateException(String.format(
"No implementation defined in /META-INF/services/%s, please check whether the file exists and has the right implementation class!",
clazz.getName()));
}
return iterator.next();
}
public static <S> Iterator<S> loadAll(Class<S> clazz) {
ServiceLoader<S> loader = ServiceLoader.load(clazz);
return loader.iterator();
}
public static <S extends Ordered> List<S> loadAllOrdered(Class<S> clazz) {
Iterator<S> iterator = loadAll(clazz);
List<S> candidates = Lists.newArrayList(iterator);
Collections.sort(candidates, new Comparator<S>() {
@Override
public int compare(S o1, S o2) {
// the smaller order has higher priority
return Integer.compare(o1.getOrder(), o2.getOrder());
}
});
return candidates;
}
public static <S extends Ordered> S loadPrimary(Class<S> clazz) {
List<S> candidates = loadAllOrdered(clazz);
if (candidates.isEmpty()) {
throw new IllegalStateException(String.format(
"No implementation defined in /META-INF/services/%s, please check whether the file exists and has the right implementation class!",
clazz.getName()));
}
return candidates.get(0);
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.foundation.internals;
import com.ctrip.framework.apollo.core.spi.Ordered;
import com.google.common.collect.Lists;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.ServiceLoader;
public class ServiceBootstrap {
public static <S> S loadFirst(Class<S> clazz) {
Iterator<S> iterator = loadAll(clazz);
if (!iterator.hasNext()) {
throw new IllegalStateException(String.format(
"No implementation defined in /META-INF/services/%s, please check whether the file exists and has the right implementation class!",
clazz.getName()));
}
return iterator.next();
}
public static <S> Iterator<S> loadAll(Class<S> clazz) {
ServiceLoader<S> loader = ServiceLoader.load(clazz);
return loader.iterator();
}
public static <S extends Ordered> List<S> loadAllOrdered(Class<S> clazz) {
Iterator<S> iterator = loadAll(clazz);
List<S> candidates = Lists.newArrayList(iterator);
Collections.sort(candidates, new Comparator<S>() {
@Override
public int compare(S o1, S o2) {
// the smaller order has higher priority
return Integer.compare(o1.getOrder(), o2.getOrder());
}
});
return candidates;
}
public static <S extends Ordered> S loadPrimary(Class<S> clazz) {
List<S> candidates = loadAllOrdered(clazz);
if (candidates.isEmpty()) {
throw new IllegalStateException(String.format(
"No implementation defined in /META-INF/services/%s, please check whether the file exists and has the right implementation class!",
clazz.getName()));
}
return candidates.get(0);
}
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-client/src/test/resources/spring/XmlConfigPlaceholderTest1.xml | <?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2021 Apollo Authors
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:apollo="http://www.ctrip.com/schema/apollo"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.ctrip.com/schema/apollo http://www.ctrip.com/schema/apollo.xsd">
<apollo:config />
<bean class="com.ctrip.framework.apollo.spring.XmlConfigPlaceholderTest.TestXmlBean">
<property name="timeout" value="${timeout:100}"/>
<property name="batch" value="${batch:200}"/>
</bean>
</beans>
| <?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2021 Apollo Authors
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:apollo="http://www.ctrip.com/schema/apollo"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.ctrip.com/schema/apollo http://www.ctrip.com/schema/apollo.xsd">
<apollo:config />
<bean class="com.ctrip.framework.apollo.spring.XmlConfigPlaceholderTest.TestXmlBean">
<property name="timeout" value="${timeout:100}"/>
<property name="batch" value="${batch:200}"/>
</bean>
</beans>
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/repository/ConsumerRepository.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.openapi.repository;
import com.ctrip.framework.apollo.openapi.entity.Consumer;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public interface ConsumerRepository extends PagingAndSortingRepository<Consumer, Long> {
Consumer findByAppId(String appId);
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.openapi.repository;
import com.ctrip.framework.apollo.openapi.entity.Consumer;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public interface ConsumerRepository extends PagingAndSortingRepository<Consumer, Long> {
Consumer findByAppId(String appId);
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./.git/hooks/pre-commit.sample | #!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --
| #!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-client/src/test/java/com/ctrip/framework/apollo/spring/JavaConfigPlaceholderTest.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.spring;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.PropertiesCompatibleConfigFile;
import com.ctrip.framework.apollo.core.ConfigConsts;
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
import java.util.List;
import java.util.Properties;
import org.junit.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.stereotype.Component;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public class JavaConfigPlaceholderTest extends AbstractSpringIntegrationTest {
private static final String TIMEOUT_PROPERTY = "timeout";
private static final int DEFAULT_TIMEOUT = 100;
private static final String BATCH_PROPERTY = "batch";
private static final int DEFAULT_BATCH = 200;
private static final String FX_APOLLO_NAMESPACE = "FX.apollo";
private static final String JSON_PROPERTY = "jsonProperty";
private static final String OTHER_JSON_PROPERTY = "otherJsonProperty";
@Test
public void testPropertySourceWithNoNamespace() throws Exception {
int someTimeout = 1000;
int someBatch = 2000;
Config config = mock(Config.class);
when(config.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
when(config.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
check(someTimeout, someBatch, AppConfig1.class);
}
@Test
public void testPropertySourceWithNoConfig() throws Exception {
Config config = mock(Config.class);
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
check(DEFAULT_TIMEOUT, DEFAULT_BATCH, AppConfig1.class);
}
@Test
public void testApplicationPropertySource() throws Exception {
int someTimeout = 1000;
int someBatch = 2000;
Config config = mock(Config.class);
when(config.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
when(config.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
check(someTimeout, someBatch, AppConfig2.class);
}
@Test
public void testPropertiesCompatiblePropertySource() throws Exception {
int someTimeout = 1000;
int someBatch = 2000;
Properties properties = mock(Properties.class);
when(properties.getProperty(TIMEOUT_PROPERTY)).thenReturn(String.valueOf(someTimeout));
when(properties.getProperty(BATCH_PROPERTY)).thenReturn(String.valueOf(someBatch));
PropertiesCompatibleConfigFile configFile = mock(PropertiesCompatibleConfigFile.class);
when(configFile.asProperties()).thenReturn(properties);
mockConfigFile("application.yaml", configFile);
check(someTimeout, someBatch, AppConfig9.class);
}
@Test
public void testPropertiesCompatiblePropertySourceWithNonNormalizedCase() throws Exception {
int someTimeout = 1000;
int someBatch = 2000;
Properties properties = mock(Properties.class);
when(properties.getProperty(TIMEOUT_PROPERTY)).thenReturn(String.valueOf(someTimeout));
when(properties.getProperty(BATCH_PROPERTY)).thenReturn(String.valueOf(someBatch));
PropertiesCompatibleConfigFile configFile = mock(PropertiesCompatibleConfigFile.class);
when(configFile.asProperties()).thenReturn(properties);
mockConfigFile("application.yaml", configFile);
check(someTimeout, someBatch, AppConfig10.class);
}
@Test
public void testMultiplePropertySources() throws Exception {
int someTimeout = 1000;
int someBatch = 2000;
Config application = mock(Config.class);
when(application.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, application);
Config fxApollo = mock(Config.class);
when(application.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(FX_APOLLO_NAMESPACE, fxApollo);
check(someTimeout, someBatch, AppConfig3.class);
}
@Test
public void testMultiplePropertiesCompatiblePropertySourcesWithSameProperties() throws Exception {
int someTimeout = 1000;
int anotherTimeout = someTimeout + 1;
int someBatch = 2000;
Properties properties = mock(Properties.class);
when(properties.getProperty(TIMEOUT_PROPERTY)).thenReturn(String.valueOf(someTimeout));
when(properties.getProperty(BATCH_PROPERTY)).thenReturn(String.valueOf(someBatch));
PropertiesCompatibleConfigFile configFile = mock(PropertiesCompatibleConfigFile.class);
when(configFile.asProperties()).thenReturn(properties);
mockConfigFile("application.yml", configFile);
Config fxApollo = mock(Config.class);
when(fxApollo.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(anotherTimeout));
mockConfig(FX_APOLLO_NAMESPACE, fxApollo);
check(someTimeout, someBatch, AppConfig11.class);
}
@Test
public void testMultiplePropertySourcesCoverWithSameProperties() throws Exception {
//Multimap does not maintain the strict input order of namespace.
int someTimeout = 1000;
int anotherTimeout = someTimeout + 1;
int someBatch = 2000;
Config fxApollo = mock(Config.class);
when(fxApollo.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
when(fxApollo.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(FX_APOLLO_NAMESPACE, fxApollo);
Config application = mock(Config.class);
when(application.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(anotherTimeout));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, application);
check(someTimeout, someBatch, AppConfig6.class);
}
@Test
public void testMultiplePropertySourcesCoverWithSamePropertiesWithPropertiesCompatiblePropertySource() throws Exception {
//Multimap does not maintain the strict input order of namespace.
int someTimeout = 1000;
int anotherTimeout = someTimeout + 1;
int someBatch = 2000;
Config fxApollo = mock(Config.class);
when(fxApollo.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
when(fxApollo.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(FX_APOLLO_NAMESPACE, fxApollo);
Config application = mock(Config.class);
when(application.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(anotherTimeout));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, application);
check(someTimeout, someBatch, AppConfig6.class);
}
@Test
public void testMultiplePropertySourcesWithSamePropertiesWithWeight() throws Exception {
int someTimeout = 1000;
int anotherTimeout = someTimeout + 1;
int someBatch = 2000;
Config application = mock(Config.class);
when(application.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
when(application.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, application);
Config fxApollo = mock(Config.class);
when(fxApollo.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(anotherTimeout));
mockConfig(FX_APOLLO_NAMESPACE, fxApollo);
check(anotherTimeout, someBatch, AppConfig2.class, AppConfig4.class);
}
@Test
public void testApplicationPropertySourceWithValueInjectedAsParameter() throws Exception {
int someTimeout = 1000;
int someBatch = 2000;
Config config = mock(Config.class);
when(config.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
when(config.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig5.class);
TestJavaConfigBean2 bean = context.getBean(TestJavaConfigBean2.class);
assertEquals(someTimeout, bean.getTimeout());
assertEquals(someBatch, bean.getBatch());
}
@Test
public void testApplicationPropertySourceWithValueInjectedAsConstructorArgs() throws Exception {
int someTimeout = 1000;
int someBatch = 2000;
Config config = mock(Config.class);
when(config.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
when(config.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig7.class);
TestJavaConfigBean3 bean = context.getBean(TestJavaConfigBean3.class);
assertEquals(someTimeout, bean.getTimeout());
assertEquals(someBatch, bean.getBatch());
}
@Test
public void testNestedProperty() throws Exception {
String a = "a";
String b = "b";
int someValue = 1234;
Config config = mock(Config.class);
when(config.getProperty(eq(a), anyString())).thenReturn(a);
when(config.getProperty(eq(b), anyString())).thenReturn(b);
when(config.getProperty(eq(String.format("%s.%s", a, b)), anyString()))
.thenReturn(String.valueOf(someValue));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(NestedPropertyConfig1.class);
TestNestedPropertyBean bean = context.getBean(TestNestedPropertyBean.class);
assertEquals(someValue, bean.getNestedProperty());
}
@Test
public void testNestedPropertyWithDefaultValue() throws Exception {
String a = "a";
String b = "b";
String c = "c";
int someValue = 1234;
Config config = mock(Config.class);
when(config.getProperty(eq(a), anyString())).thenReturn(a);
when(config.getProperty(eq(b), anyString())).thenReturn(b);
when(config.getProperty(eq(c), anyString())).thenReturn(String.valueOf(someValue));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(NestedPropertyConfig1.class);
TestNestedPropertyBean bean = context.getBean(TestNestedPropertyBean.class);
assertEquals(someValue, bean.getNestedProperty());
}
@Test
public void testNestedPropertyWithNestedDefaultValue() throws Exception {
String a = "a";
String b = "b";
Config config = mock(Config.class);
when(config.getProperty(eq(a), anyString())).thenReturn(a);
when(config.getProperty(eq(b), anyString())).thenReturn(b);
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(NestedPropertyConfig1.class);
TestNestedPropertyBean bean = context.getBean(TestNestedPropertyBean.class);
assertEquals(100, bean.getNestedProperty());
}
@Test
public void testMultipleNestedProperty() throws Exception {
String a = "a";
String b = "b";
String nestedKey = "c.d";
String nestedProperty = String.format("${%s}", nestedKey);
int someValue = 1234;
Config config = mock(Config.class);
when(config.getProperty(eq(a), anyString())).thenReturn(a);
when(config.getProperty(eq(b), anyString())).thenReturn(b);
when(config.getProperty(eq(String.format("%s.%s", a, b)), anyString())).thenReturn(nestedProperty);
when(config.getProperty(eq(nestedKey), anyString())).thenReturn(String.valueOf(someValue));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(NestedPropertyConfig1.class);
TestNestedPropertyBean bean = context.getBean(TestNestedPropertyBean.class);
assertEquals(someValue, bean.getNestedProperty());
}
@Test
public void testMultipleNestedPropertyWithDefaultValue() throws Exception {
String a = "a";
String b = "b";
String nestedKey = "c.d";
int someValue = 1234;
String nestedProperty = String.format("${%s:%d}", nestedKey, someValue);
Config config = mock(Config.class);
when(config.getProperty(eq(a), anyString())).thenReturn(a);
when(config.getProperty(eq(b), anyString())).thenReturn(b);
when(config.getProperty(eq(String.format("%s.%s", a, b)), anyString())).thenReturn(nestedProperty);
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(NestedPropertyConfig1.class);
TestNestedPropertyBean bean = context.getBean(TestNestedPropertyBean.class);
assertEquals(someValue, bean.getNestedProperty());
}
@Test
public void testApolloJsonValue() {
String someJson = "[{\"a\":\"astring\", \"b\":10},{\"a\":\"astring2\", \"b\":20}]";
String otherJson = "[{\"a\":\"otherString\", \"b\":10},{\"a\":\"astring2\", \"b\":20}]";
Config config = mock(Config.class);
when(config.getProperty(eq(JSON_PROPERTY), anyString())).thenReturn(someJson);
when(config.getProperty(eq(OTHER_JSON_PROPERTY), anyString())).thenReturn(otherJson);
when(config.getProperty(eq("a"), anyString())).thenReturn(JSON_PROPERTY);
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
AppConfig8.class);
TestJsonPropertyBean testJsonPropertyBean = context.getBean(TestJsonPropertyBean.class);
assertEquals(2, testJsonPropertyBean.getJsonBeanList().size());
assertEquals("astring", testJsonPropertyBean.getJsonBeanList().get(0).getA());
assertEquals(10, testJsonPropertyBean.getJsonBeanList().get(0).getB());
assertEquals("astring2", testJsonPropertyBean.getJsonBeanList().get(1).getA());
assertEquals(20, testJsonPropertyBean.getJsonBeanList().get(1).getB());
assertEquals(testJsonPropertyBean.getJsonBeanList(), testJsonPropertyBean.getEmbeddedJsonBeanList());
assertEquals("otherString", testJsonPropertyBean.getOtherJsonBeanList().get(0).getA());
assertEquals(10, testJsonPropertyBean.getOtherJsonBeanList().get(0).getB());
assertEquals("astring2", testJsonPropertyBean.getOtherJsonBeanList().get(1).getA());
assertEquals(20, testJsonPropertyBean.getOtherJsonBeanList().get(1).getB());
}
@Test(expected = BeanCreationException.class)
public void testApolloJsonValueWithInvalidJson() throws Exception {
String someInvalidJson = "someInvalidJson";
Config config = mock(Config.class);
when(config.getProperty(eq(JSON_PROPERTY), anyString())).thenReturn(someInvalidJson);
when(config.getProperty(eq(OTHER_JSON_PROPERTY), anyString())).thenReturn(someInvalidJson);
when(config.getProperty(eq("a"), anyString())).thenReturn(JSON_PROPERTY);
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
new AnnotationConfigApplicationContext(AppConfig8.class).getBean(TestJsonPropertyBean.class);
}
@Test(expected = BeanCreationException.class)
public void testApolloJsonValueWithNoPropertyValue() throws Exception {
Config config = mock(Config.class);
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
new AnnotationConfigApplicationContext(AppConfig8.class);
}
private void check(int expectedTimeout, int expectedBatch, Class<?>... annotatedClasses) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(annotatedClasses);
TestJavaConfigBean bean = context.getBean(TestJavaConfigBean.class);
assertEquals(expectedTimeout, bean.getTimeout());
assertEquals(expectedBatch, bean.getBatch());
}
@Configuration
@EnableApolloConfig
static class AppConfig1 {
@Bean
TestJavaConfigBean testJavaConfigBean() {
return new TestJavaConfigBean();
}
}
@Configuration
@EnableApolloConfig("application")
static class AppConfig2 {
@Bean
TestJavaConfigBean testJavaConfigBean() {
return new TestJavaConfigBean();
}
}
@Configuration
@EnableApolloConfig({"application", "FX.apollo"})
static class AppConfig3 {
@Bean
TestJavaConfigBean testJavaConfigBean() {
return new TestJavaConfigBean();
}
}
@Configuration
@EnableApolloConfig(value = "FX.apollo", order = 10)
static class AppConfig4 {
}
@Configuration
@EnableApolloConfig
static class AppConfig5 {
@Bean
TestJavaConfigBean2 testJavaConfigBean2(@Value("${timeout:100}") int timeout, @Value("${batch:200}") int batch) {
TestJavaConfigBean2 bean = new TestJavaConfigBean2();
bean.setTimeout(timeout);
bean.setBatch(batch);
return bean;
}
}
@Configuration
@EnableApolloConfig({"FX.apollo", "application"})
static class AppConfig6 {
@Bean
TestJavaConfigBean testJavaConfigBean() {
return new TestJavaConfigBean();
}
}
@Configuration
@ComponentScan(
includeFilters = {@Filter(type = FilterType.ANNOTATION, value = {Component.class})},
excludeFilters = {@Filter(type = FilterType.ANNOTATION, value = {Configuration.class})})
@EnableApolloConfig
static class AppConfig7 {
}
@Configuration
@EnableApolloConfig
static class NestedPropertyConfig1 {
@Bean
TestNestedPropertyBean testNestedPropertyBean() {
return new TestNestedPropertyBean();
}
}
@Configuration
@EnableApolloConfig
static class AppConfig8 {
@Bean
TestJsonPropertyBean testJavaConfigBean() {
return new TestJsonPropertyBean();
}
}
@Configuration
@EnableApolloConfig("application.yaml")
static class AppConfig9 {
@Bean
TestJavaConfigBean testJavaConfigBean() {
return new TestJavaConfigBean();
}
}
@Configuration
@EnableApolloConfig("application.yaMl")
static class AppConfig10 {
@Bean
TestJavaConfigBean testJavaConfigBean() {
return new TestJavaConfigBean();
}
}
@Configuration
@EnableApolloConfig({"application.yml", "FX.apollo"})
static class AppConfig11 {
@Bean
TestJavaConfigBean testJavaConfigBean() {
return new TestJavaConfigBean();
}
}
@Component
static class TestJavaConfigBean {
@Value("${timeout:100}")
private int timeout;
private int batch;
@Value("${batch:200}")
public void setBatch(int batch) {
this.batch = batch;
}
public int getTimeout() {
return timeout;
}
public int getBatch() {
return batch;
}
}
static class TestJavaConfigBean2 {
private int timeout;
private int batch;
public int getTimeout() {
return timeout;
}
public void setTimeout(int timeout) {
this.timeout = timeout;
}
public int getBatch() {
return batch;
}
public void setBatch(int batch) {
this.batch = batch;
}
}
@Component
static class TestJavaConfigBean3 {
private final int timeout;
private final int batch;
@Autowired
public TestJavaConfigBean3(@Value("${timeout:100}") int timeout,
@Value("${batch:200}") int batch) {
this.timeout = timeout;
this.batch = batch;
}
public int getTimeout() {
return timeout;
}
public int getBatch() {
return batch;
}
}
static class TestNestedPropertyBean {
@Value("${${a}.${b}:${c:100}}")
private int nestedProperty;
public int getNestedProperty() {
return nestedProperty;
}
}
static class TestJsonPropertyBean {
@ApolloJsonValue("${jsonProperty}")
private List<JsonBean> jsonBeanList;
private List<JsonBean> otherJsonBeanList;
@ApolloJsonValue("${${a}}")
private List<JsonBean> embeddedJsonBeanList;
public List<JsonBean> getJsonBeanList() {
return jsonBeanList;
}
@ApolloJsonValue("${otherJsonProperty}")
public void setOtherJsonBeanList(List<JsonBean> otherJsonBeanList) {
this.otherJsonBeanList = otherJsonBeanList;
}
public List<JsonBean> getOtherJsonBeanList() {
return otherJsonBeanList;
}
public List<JsonBean> getEmbeddedJsonBeanList() {
return embeddedJsonBeanList;
}
}
static class JsonBean {
private String a;
private int b;
String getA() {
return a;
}
public void setA(String a) {
this.a = a;
}
int getB() {
return b;
}
public void setB(int b) {
this.b = b;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
JsonBean jsonBean = (JsonBean) o;
if (b != jsonBean.b) {
return false;
}
return a != null ? a.equals(jsonBean.a) : jsonBean.a == null;
}
@Override
public int hashCode() {
int result = a != null ? a.hashCode() : 0;
result = 31 * result + b;
return result;
}
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.spring;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.PropertiesCompatibleConfigFile;
import com.ctrip.framework.apollo.core.ConfigConsts;
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
import java.util.List;
import java.util.Properties;
import org.junit.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.stereotype.Component;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public class JavaConfigPlaceholderTest extends AbstractSpringIntegrationTest {
private static final String TIMEOUT_PROPERTY = "timeout";
private static final int DEFAULT_TIMEOUT = 100;
private static final String BATCH_PROPERTY = "batch";
private static final int DEFAULT_BATCH = 200;
private static final String FX_APOLLO_NAMESPACE = "FX.apollo";
private static final String JSON_PROPERTY = "jsonProperty";
private static final String OTHER_JSON_PROPERTY = "otherJsonProperty";
@Test
public void testPropertySourceWithNoNamespace() throws Exception {
int someTimeout = 1000;
int someBatch = 2000;
Config config = mock(Config.class);
when(config.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
when(config.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
check(someTimeout, someBatch, AppConfig1.class);
}
@Test
public void testPropertySourceWithNoConfig() throws Exception {
Config config = mock(Config.class);
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
check(DEFAULT_TIMEOUT, DEFAULT_BATCH, AppConfig1.class);
}
@Test
public void testApplicationPropertySource() throws Exception {
int someTimeout = 1000;
int someBatch = 2000;
Config config = mock(Config.class);
when(config.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
when(config.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
check(someTimeout, someBatch, AppConfig2.class);
}
@Test
public void testPropertiesCompatiblePropertySource() throws Exception {
int someTimeout = 1000;
int someBatch = 2000;
Properties properties = mock(Properties.class);
when(properties.getProperty(TIMEOUT_PROPERTY)).thenReturn(String.valueOf(someTimeout));
when(properties.getProperty(BATCH_PROPERTY)).thenReturn(String.valueOf(someBatch));
PropertiesCompatibleConfigFile configFile = mock(PropertiesCompatibleConfigFile.class);
when(configFile.asProperties()).thenReturn(properties);
mockConfigFile("application.yaml", configFile);
check(someTimeout, someBatch, AppConfig9.class);
}
@Test
public void testPropertiesCompatiblePropertySourceWithNonNormalizedCase() throws Exception {
int someTimeout = 1000;
int someBatch = 2000;
Properties properties = mock(Properties.class);
when(properties.getProperty(TIMEOUT_PROPERTY)).thenReturn(String.valueOf(someTimeout));
when(properties.getProperty(BATCH_PROPERTY)).thenReturn(String.valueOf(someBatch));
PropertiesCompatibleConfigFile configFile = mock(PropertiesCompatibleConfigFile.class);
when(configFile.asProperties()).thenReturn(properties);
mockConfigFile("application.yaml", configFile);
check(someTimeout, someBatch, AppConfig10.class);
}
@Test
public void testMultiplePropertySources() throws Exception {
int someTimeout = 1000;
int someBatch = 2000;
Config application = mock(Config.class);
when(application.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, application);
Config fxApollo = mock(Config.class);
when(application.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(FX_APOLLO_NAMESPACE, fxApollo);
check(someTimeout, someBatch, AppConfig3.class);
}
@Test
public void testMultiplePropertiesCompatiblePropertySourcesWithSameProperties() throws Exception {
int someTimeout = 1000;
int anotherTimeout = someTimeout + 1;
int someBatch = 2000;
Properties properties = mock(Properties.class);
when(properties.getProperty(TIMEOUT_PROPERTY)).thenReturn(String.valueOf(someTimeout));
when(properties.getProperty(BATCH_PROPERTY)).thenReturn(String.valueOf(someBatch));
PropertiesCompatibleConfigFile configFile = mock(PropertiesCompatibleConfigFile.class);
when(configFile.asProperties()).thenReturn(properties);
mockConfigFile("application.yml", configFile);
Config fxApollo = mock(Config.class);
when(fxApollo.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(anotherTimeout));
mockConfig(FX_APOLLO_NAMESPACE, fxApollo);
check(someTimeout, someBatch, AppConfig11.class);
}
@Test
public void testMultiplePropertySourcesCoverWithSameProperties() throws Exception {
//Multimap does not maintain the strict input order of namespace.
int someTimeout = 1000;
int anotherTimeout = someTimeout + 1;
int someBatch = 2000;
Config fxApollo = mock(Config.class);
when(fxApollo.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
when(fxApollo.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(FX_APOLLO_NAMESPACE, fxApollo);
Config application = mock(Config.class);
when(application.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(anotherTimeout));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, application);
check(someTimeout, someBatch, AppConfig6.class);
}
@Test
public void testMultiplePropertySourcesCoverWithSamePropertiesWithPropertiesCompatiblePropertySource() throws Exception {
//Multimap does not maintain the strict input order of namespace.
int someTimeout = 1000;
int anotherTimeout = someTimeout + 1;
int someBatch = 2000;
Config fxApollo = mock(Config.class);
when(fxApollo.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
when(fxApollo.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(FX_APOLLO_NAMESPACE, fxApollo);
Config application = mock(Config.class);
when(application.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(anotherTimeout));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, application);
check(someTimeout, someBatch, AppConfig6.class);
}
@Test
public void testMultiplePropertySourcesWithSamePropertiesWithWeight() throws Exception {
int someTimeout = 1000;
int anotherTimeout = someTimeout + 1;
int someBatch = 2000;
Config application = mock(Config.class);
when(application.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
when(application.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, application);
Config fxApollo = mock(Config.class);
when(fxApollo.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(anotherTimeout));
mockConfig(FX_APOLLO_NAMESPACE, fxApollo);
check(anotherTimeout, someBatch, AppConfig2.class, AppConfig4.class);
}
@Test
public void testApplicationPropertySourceWithValueInjectedAsParameter() throws Exception {
int someTimeout = 1000;
int someBatch = 2000;
Config config = mock(Config.class);
when(config.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
when(config.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig5.class);
TestJavaConfigBean2 bean = context.getBean(TestJavaConfigBean2.class);
assertEquals(someTimeout, bean.getTimeout());
assertEquals(someBatch, bean.getBatch());
}
@Test
public void testApplicationPropertySourceWithValueInjectedAsConstructorArgs() throws Exception {
int someTimeout = 1000;
int someBatch = 2000;
Config config = mock(Config.class);
when(config.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
when(config.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig7.class);
TestJavaConfigBean3 bean = context.getBean(TestJavaConfigBean3.class);
assertEquals(someTimeout, bean.getTimeout());
assertEquals(someBatch, bean.getBatch());
}
@Test
public void testNestedProperty() throws Exception {
String a = "a";
String b = "b";
int someValue = 1234;
Config config = mock(Config.class);
when(config.getProperty(eq(a), anyString())).thenReturn(a);
when(config.getProperty(eq(b), anyString())).thenReturn(b);
when(config.getProperty(eq(String.format("%s.%s", a, b)), anyString()))
.thenReturn(String.valueOf(someValue));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(NestedPropertyConfig1.class);
TestNestedPropertyBean bean = context.getBean(TestNestedPropertyBean.class);
assertEquals(someValue, bean.getNestedProperty());
}
@Test
public void testNestedPropertyWithDefaultValue() throws Exception {
String a = "a";
String b = "b";
String c = "c";
int someValue = 1234;
Config config = mock(Config.class);
when(config.getProperty(eq(a), anyString())).thenReturn(a);
when(config.getProperty(eq(b), anyString())).thenReturn(b);
when(config.getProperty(eq(c), anyString())).thenReturn(String.valueOf(someValue));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(NestedPropertyConfig1.class);
TestNestedPropertyBean bean = context.getBean(TestNestedPropertyBean.class);
assertEquals(someValue, bean.getNestedProperty());
}
@Test
public void testNestedPropertyWithNestedDefaultValue() throws Exception {
String a = "a";
String b = "b";
Config config = mock(Config.class);
when(config.getProperty(eq(a), anyString())).thenReturn(a);
when(config.getProperty(eq(b), anyString())).thenReturn(b);
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(NestedPropertyConfig1.class);
TestNestedPropertyBean bean = context.getBean(TestNestedPropertyBean.class);
assertEquals(100, bean.getNestedProperty());
}
@Test
public void testMultipleNestedProperty() throws Exception {
String a = "a";
String b = "b";
String nestedKey = "c.d";
String nestedProperty = String.format("${%s}", nestedKey);
int someValue = 1234;
Config config = mock(Config.class);
when(config.getProperty(eq(a), anyString())).thenReturn(a);
when(config.getProperty(eq(b), anyString())).thenReturn(b);
when(config.getProperty(eq(String.format("%s.%s", a, b)), anyString())).thenReturn(nestedProperty);
when(config.getProperty(eq(nestedKey), anyString())).thenReturn(String.valueOf(someValue));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(NestedPropertyConfig1.class);
TestNestedPropertyBean bean = context.getBean(TestNestedPropertyBean.class);
assertEquals(someValue, bean.getNestedProperty());
}
@Test
public void testMultipleNestedPropertyWithDefaultValue() throws Exception {
String a = "a";
String b = "b";
String nestedKey = "c.d";
int someValue = 1234;
String nestedProperty = String.format("${%s:%d}", nestedKey, someValue);
Config config = mock(Config.class);
when(config.getProperty(eq(a), anyString())).thenReturn(a);
when(config.getProperty(eq(b), anyString())).thenReturn(b);
when(config.getProperty(eq(String.format("%s.%s", a, b)), anyString())).thenReturn(nestedProperty);
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(NestedPropertyConfig1.class);
TestNestedPropertyBean bean = context.getBean(TestNestedPropertyBean.class);
assertEquals(someValue, bean.getNestedProperty());
}
@Test
public void testApolloJsonValue() {
String someJson = "[{\"a\":\"astring\", \"b\":10},{\"a\":\"astring2\", \"b\":20}]";
String otherJson = "[{\"a\":\"otherString\", \"b\":10},{\"a\":\"astring2\", \"b\":20}]";
Config config = mock(Config.class);
when(config.getProperty(eq(JSON_PROPERTY), anyString())).thenReturn(someJson);
when(config.getProperty(eq(OTHER_JSON_PROPERTY), anyString())).thenReturn(otherJson);
when(config.getProperty(eq("a"), anyString())).thenReturn(JSON_PROPERTY);
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
AppConfig8.class);
TestJsonPropertyBean testJsonPropertyBean = context.getBean(TestJsonPropertyBean.class);
assertEquals(2, testJsonPropertyBean.getJsonBeanList().size());
assertEquals("astring", testJsonPropertyBean.getJsonBeanList().get(0).getA());
assertEquals(10, testJsonPropertyBean.getJsonBeanList().get(0).getB());
assertEquals("astring2", testJsonPropertyBean.getJsonBeanList().get(1).getA());
assertEquals(20, testJsonPropertyBean.getJsonBeanList().get(1).getB());
assertEquals(testJsonPropertyBean.getJsonBeanList(), testJsonPropertyBean.getEmbeddedJsonBeanList());
assertEquals("otherString", testJsonPropertyBean.getOtherJsonBeanList().get(0).getA());
assertEquals(10, testJsonPropertyBean.getOtherJsonBeanList().get(0).getB());
assertEquals("astring2", testJsonPropertyBean.getOtherJsonBeanList().get(1).getA());
assertEquals(20, testJsonPropertyBean.getOtherJsonBeanList().get(1).getB());
}
@Test(expected = BeanCreationException.class)
public void testApolloJsonValueWithInvalidJson() throws Exception {
String someInvalidJson = "someInvalidJson";
Config config = mock(Config.class);
when(config.getProperty(eq(JSON_PROPERTY), anyString())).thenReturn(someInvalidJson);
when(config.getProperty(eq(OTHER_JSON_PROPERTY), anyString())).thenReturn(someInvalidJson);
when(config.getProperty(eq("a"), anyString())).thenReturn(JSON_PROPERTY);
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
new AnnotationConfigApplicationContext(AppConfig8.class).getBean(TestJsonPropertyBean.class);
}
@Test(expected = BeanCreationException.class)
public void testApolloJsonValueWithNoPropertyValue() throws Exception {
Config config = mock(Config.class);
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, config);
new AnnotationConfigApplicationContext(AppConfig8.class);
}
private void check(int expectedTimeout, int expectedBatch, Class<?>... annotatedClasses) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(annotatedClasses);
TestJavaConfigBean bean = context.getBean(TestJavaConfigBean.class);
assertEquals(expectedTimeout, bean.getTimeout());
assertEquals(expectedBatch, bean.getBatch());
}
@Configuration
@EnableApolloConfig
static class AppConfig1 {
@Bean
TestJavaConfigBean testJavaConfigBean() {
return new TestJavaConfigBean();
}
}
@Configuration
@EnableApolloConfig("application")
static class AppConfig2 {
@Bean
TestJavaConfigBean testJavaConfigBean() {
return new TestJavaConfigBean();
}
}
@Configuration
@EnableApolloConfig({"application", "FX.apollo"})
static class AppConfig3 {
@Bean
TestJavaConfigBean testJavaConfigBean() {
return new TestJavaConfigBean();
}
}
@Configuration
@EnableApolloConfig(value = "FX.apollo", order = 10)
static class AppConfig4 {
}
@Configuration
@EnableApolloConfig
static class AppConfig5 {
@Bean
TestJavaConfigBean2 testJavaConfigBean2(@Value("${timeout:100}") int timeout, @Value("${batch:200}") int batch) {
TestJavaConfigBean2 bean = new TestJavaConfigBean2();
bean.setTimeout(timeout);
bean.setBatch(batch);
return bean;
}
}
@Configuration
@EnableApolloConfig({"FX.apollo", "application"})
static class AppConfig6 {
@Bean
TestJavaConfigBean testJavaConfigBean() {
return new TestJavaConfigBean();
}
}
@Configuration
@ComponentScan(
includeFilters = {@Filter(type = FilterType.ANNOTATION, value = {Component.class})},
excludeFilters = {@Filter(type = FilterType.ANNOTATION, value = {Configuration.class})})
@EnableApolloConfig
static class AppConfig7 {
}
@Configuration
@EnableApolloConfig
static class NestedPropertyConfig1 {
@Bean
TestNestedPropertyBean testNestedPropertyBean() {
return new TestNestedPropertyBean();
}
}
@Configuration
@EnableApolloConfig
static class AppConfig8 {
@Bean
TestJsonPropertyBean testJavaConfigBean() {
return new TestJsonPropertyBean();
}
}
@Configuration
@EnableApolloConfig("application.yaml")
static class AppConfig9 {
@Bean
TestJavaConfigBean testJavaConfigBean() {
return new TestJavaConfigBean();
}
}
@Configuration
@EnableApolloConfig("application.yaMl")
static class AppConfig10 {
@Bean
TestJavaConfigBean testJavaConfigBean() {
return new TestJavaConfigBean();
}
}
@Configuration
@EnableApolloConfig({"application.yml", "FX.apollo"})
static class AppConfig11 {
@Bean
TestJavaConfigBean testJavaConfigBean() {
return new TestJavaConfigBean();
}
}
@Component
static class TestJavaConfigBean {
@Value("${timeout:100}")
private int timeout;
private int batch;
@Value("${batch:200}")
public void setBatch(int batch) {
this.batch = batch;
}
public int getTimeout() {
return timeout;
}
public int getBatch() {
return batch;
}
}
static class TestJavaConfigBean2 {
private int timeout;
private int batch;
public int getTimeout() {
return timeout;
}
public void setTimeout(int timeout) {
this.timeout = timeout;
}
public int getBatch() {
return batch;
}
public void setBatch(int batch) {
this.batch = batch;
}
}
@Component
static class TestJavaConfigBean3 {
private final int timeout;
private final int batch;
@Autowired
public TestJavaConfigBean3(@Value("${timeout:100}") int timeout,
@Value("${batch:200}") int batch) {
this.timeout = timeout;
this.batch = batch;
}
public int getTimeout() {
return timeout;
}
public int getBatch() {
return batch;
}
}
static class TestNestedPropertyBean {
@Value("${${a}.${b}:${c:100}}")
private int nestedProperty;
public int getNestedProperty() {
return nestedProperty;
}
}
static class TestJsonPropertyBean {
@ApolloJsonValue("${jsonProperty}")
private List<JsonBean> jsonBeanList;
private List<JsonBean> otherJsonBeanList;
@ApolloJsonValue("${${a}}")
private List<JsonBean> embeddedJsonBeanList;
public List<JsonBean> getJsonBeanList() {
return jsonBeanList;
}
@ApolloJsonValue("${otherJsonProperty}")
public void setOtherJsonBeanList(List<JsonBean> otherJsonBeanList) {
this.otherJsonBeanList = otherJsonBeanList;
}
public List<JsonBean> getOtherJsonBeanList() {
return otherJsonBeanList;
}
public List<JsonBean> getEmbeddedJsonBeanList() {
return embeddedJsonBeanList;
}
}
static class JsonBean {
private String a;
private int b;
String getA() {
return a;
}
public void setA(String a) {
this.a = a;
}
int getB() {
return b;
}
public void setB(int b) {
this.b = b;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
JsonBean jsonBean = (JsonBean) o;
if (b != jsonBean.b) {
return false;
}
return a != null ? a.equals(jsonBean.a) : jsonBean.a == null;
}
@Override
public int hashCode() {
int result = a != null ? a.hashCode() : 0;
result = 31 * result + b;
return result;
}
}
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-client/src/test/resources/yaml/orderedcase.yaml | #
# Copyright 2021 Apollo Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
k2: "someValue"
k4: "anotherValue"
k1: "yetAnotherValue" | #
# Copyright 2021 Apollo Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
k2: "someValue"
k4: "anotherValue"
k1: "yetAnotherValue" | -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/ConfigServerEurekaServerConfigure.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.configservice;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
import org.springframework.context.annotation.Configuration;
/**
* Start Eureka Server annotations according to configuration
*
* @author Zhiqiang Lin(linzhiqiang0514@163.com)
*/
@Configuration
@EnableEurekaServer
@ConditionalOnProperty(name = "apollo.eureka.server.enabled", havingValue = "true", matchIfMissing = true)
public class ConfigServerEurekaServerConfigure {
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.configservice;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
import org.springframework.context.annotation.Configuration;
/**
* Start Eureka Server annotations according to configuration
*
* @author Zhiqiang Lin(linzhiqiang0514@163.com)
*/
@Configuration
@EnableEurekaServer
@ConditionalOnProperty(name = "apollo.eureka.server.enabled", havingValue = "true", matchIfMissing = true)
public class ConfigServerEurekaServerConfigure {
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/utils/ReleaseMessageKeyGenerator.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.biz.utils;
import com.google.common.base.Joiner;
import com.ctrip.framework.apollo.core.ConfigConsts;
public class ReleaseMessageKeyGenerator {
private static final Joiner STRING_JOINER = Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR);
public static String generate(String appId, String cluster, String namespace) {
return STRING_JOINER.join(appId, cluster, namespace);
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.biz.utils;
import com.google.common.base.Joiner;
import com.ctrip.framework.apollo.core.ConfigConsts;
public class ReleaseMessageKeyGenerator {
private static final Joiner STRING_JOINER = Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR);
public static String generate(String appId, String cluster, String namespace) {
return STRING_JOINER.join(appId, cluster, namespace);
}
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/resources/static/vendor/angular/angular-toastr-1.4.1.tpls.min.js | !function () {
"use strict";
function t(t, e, s, n, o, r, a) {
function i(t) {
if (t)d(t.toastId); else for (var e = 0; e < O.length; e++)d(O[e].toastId)
}
function l(t, e, s) {
var n = m().iconClasses.error;
return g(n, t, e, s)
}
function c(t, e, s) {
var n = m().iconClasses.info;
return g(n, t, e, s)
}
function u(t, e, s) {
var n = m().iconClasses.success;
return g(n, t, e, s)
}
function p(t, e, s) {
var n = m().iconClasses.warning;
return g(n, t, e, s)
}
function d(e, s) {
function n(t) {
for (var e = 0; e < O.length; e++)if (O[e].toastId === t)return O[e]
}
function o() {
return !O.length
}
var i = n(e);
i && !i.deleting && (i.deleting = !0, i.isOpened = !1, t.leave(i.el).then(function () {
i.scope.options.onHidden && i.scope.options.onHidden(s), i.scope.$destroy();
var t = O.indexOf(i);
delete B[i.scope.message], O.splice(t, 1);
var e = r.maxOpened;
e && O.length >= e && O[e - 1].open.resolve(), o() && (h.remove(), h = null, T = a.defer())
}))
}
function g(t, e, s, n) {
return angular.isObject(s) && (n = s, s = null), v({iconClass: t, message: e, optionsOverride: n, title: s})
}
function m() {
return angular.extend({}, r)
}
function f(e) {
if (h)return T.promise;
h = angular.element("<div></div>"), h.attr("id", e.containerId), h.addClass(e.positionClass), h.css({"pointer-events": "auto"});
var s = angular.element(document.querySelector(e.target));
if (!s || !s.length)throw"Target for toasts doesn't exist";
return t.enter(h, s).then(function () {
T.resolve()
}), T.promise
}
function v(s) {
function r(t, e, s) {
s.allowHtml ? (t.scope.allowHtml = !0, t.scope.title = o.trustAsHtml(e.title), t.scope.message = o.trustAsHtml(e.message)) : (t.scope.title = e.title, t.scope.message = e.message), t.scope.toastType = t.iconClass, t.scope.toastId = t.toastId, t.scope.options = {
extendedTimeOut: s.extendedTimeOut,
messageClass: s.messageClass,
onHidden: s.onHidden,
onShown: s.onShown,
progressBar: s.progressBar,
tapToDismiss: s.tapToDismiss,
timeOut: s.timeOut,
titleClass: s.titleClass,
toastClass: s.toastClass
}, s.closeButton && (t.scope.options.closeHtml = s.closeHtml)
}
function i() {
function t(t) {
for (var e = ["containerId", "iconClasses", "maxOpened", "newestOnTop", "positionClass", "preventDuplicates", "preventOpenDuplicates", "templates"], s = 0, n = e.length; n > s; s++)delete t[e[s]];
return t
}
var e = {toastId: C++, isOpened: !1, scope: n.$new(), open: a.defer()};
return e.iconClass = s.iconClass, s.optionsOverride && (p = angular.extend(p, t(s.optionsOverride)), e.iconClass = s.optionsOverride.iconClass || e.iconClass), r(e, s, p), e.el = l(e.scope), e
}
function l(t) {
var s = angular.element("<div toast></div>"), n = e.get("$compile");
return n(s)(t)
}
function c() {
return p.maxOpened && O.length <= p.maxOpened || !p.maxOpened
}
function u() {
var t = p.preventDuplicates && s.message === w, e = p.preventOpenDuplicates && B[s.message];
return t || e ? !0 : (w = s.message, B[s.message] = !0, !1)
}
var p = m();
if (!u()) {
var g = i();
if (O.push(g), p.autoDismiss && p.maxOpened > 0)for (var v = O.slice(0, O.length - p.maxOpened), T = 0, $ = v.length; $ > T; T++)d(v[T].toastId);
return c() && g.open.resolve(), g.open.promise.then(function () {
f(p).then(function () {
if (g.isOpened = !0, p.newestOnTop)t.enter(g.el, h).then(function () {
g.scope.init()
}); else {
var e = h[0].lastChild ? angular.element(h[0].lastChild) : null;
t.enter(g.el, h, e).then(function () {
g.scope.init()
})
}
})
}), g
}
}
var h, C = 0, O = [], w = "", B = {}, T = a.defer(), $ = {
clear: i,
error: l,
info: c,
remove: d,
success: u,
warning: p
};
return $
}
angular.module("toastr", []).factory("toastr", t), t.$inject = ["$animate", "$injector", "$document", "$rootScope", "$sce", "toastrConfig", "$q"]
}(), function () {
"use strict";
angular.module("toastr").constant("toastrConfig", {
allowHtml: !1,
autoDismiss: !1,
closeButton: !1,
closeHtml: "<button>×</button>",
containerId: "toast-container",
extendedTimeOut: 1e3,
iconClasses: {error: "toast-error", info: "toast-info", success: "toast-success", warning: "toast-warning"},
maxOpened: 0,
messageClass: "toast-message",
newestOnTop: !0,
onHidden: null,
onShown: null,
positionClass: "toast-top-right",
preventDuplicates: !1,
preventOpenDuplicates: !1,
progressBar: !1,
tapToDismiss: !0,
target: "body",
templates: {toast: "directives/toast/toast.html", progressbar: "directives/progressbar/progressbar.html"},
timeOut: 5e3,
titleClass: "toast-title",
toastClass: "toast"
})
}(), function () {
"use strict";
function t(t) {
function e(t, e, s, n) {
function o() {
var t = (i - (new Date).getTime()) / a * 100;
e.css("width", t + "%")
}
var r, a, i;
n.progressBar = t, t.start = function (t) {
r && clearInterval(r), a = parseFloat(t), i = (new Date).getTime() + a, r = setInterval(o, 10)
}, t.stop = function () {
r && clearInterval(r)
}, t.$on("$destroy", function () {
clearInterval(r)
})
}
return {
replace: !0, require: "^toast", templateUrl: function () {
return t.templates.progressbar
}, link: e
}
}
angular.module("toastr").directive("progressBar", t), t.$inject = ["toastrConfig"]
}(), function () {
"use strict";
function t() {
this.progressBar = null, this.startProgressBar = function (t) {
this.progressBar && this.progressBar.start(t)
}, this.stopProgressBar = function () {
this.progressBar && this.progressBar.stop()
}
}
angular.module("toastr").controller("ToastController", t)
}(), function () {
"use strict";
function t(t, e, s, n) {
function o(s, o, r, a) {
function i(t) {
return a.startProgressBar(t), e(function () {
a.stopProgressBar(), n.remove(s.toastId)
}, t, 1)
}
function l() {
s.progressBar = !1, a.stopProgressBar()
}
function c() {
return s.options.closeHtml
}
var u;
if (s.toastClass = s.options.toastClass, s.titleClass = s.options.titleClass, s.messageClass = s.options.messageClass, s.progressBar = s.options.progressBar, c()) {
var p = angular.element(s.options.closeHtml), d = t.get("$compile");
p.addClass("toast-close-button"), p.attr("ng-click", "close()"), d(p)(s), o.prepend(p)
}
s.init = function () {
s.options.timeOut && (u = i(s.options.timeOut)), s.options.onShown && s.options.onShown()
}, o.on("mouseenter", function () {
l(), u && e.cancel(u)
}), s.tapToast = function () {
s.options.tapToDismiss && s.close(!0)
}, s.close = function (t) {
n.remove(s.toastId, t)
}, o.on("mouseleave", function () {
(0 !== s.options.timeOut || 0 !== s.options.extendedTimeOut) && (s.$apply(function () {
s.progressBar = s.options.progressBar
}), u = i(s.options.extendedTimeOut))
})
}
return {
replace: !0, templateUrl: function () {
return s.templates.toast
}, controller: "ToastController", link: o
}
}
angular.module("toastr").directive("toast", t), t.$inject = ["$injector", "$interval", "toastrConfig", "toastr"]
}(), angular.module("toastr").run(["$templateCache", function (t) {
t.put("directives/progressbar/progressbar.html", '<div class="toast-progress"></div>\n'), t.put("directives/toast/toast.html", '<div class="{{toastClass}} {{toastType}}" ng-click="tapToast()">\n <div ng-switch on="allowHtml">\n <div ng-switch-default ng-if="title" class="{{titleClass}}">{{title}}</div>\n <div ng-switch-default class="{{messageClass}}">{{message}}</div>\n <div ng-switch-when="true" ng-if="title" class="{{titleClass}}" ng-bind-html="title"></div>\n <div ng-switch-when="true" class="{{messageClass}}" ng-bind-html="message"></div>\n </div>\n <progress-bar ng-if="progressBar"></progress-bar>\n</div>\n')
}]);
| !function () {
"use strict";
function t(t, e, s, n, o, r, a) {
function i(t) {
if (t)d(t.toastId); else for (var e = 0; e < O.length; e++)d(O[e].toastId)
}
function l(t, e, s) {
var n = m().iconClasses.error;
return g(n, t, e, s)
}
function c(t, e, s) {
var n = m().iconClasses.info;
return g(n, t, e, s)
}
function u(t, e, s) {
var n = m().iconClasses.success;
return g(n, t, e, s)
}
function p(t, e, s) {
var n = m().iconClasses.warning;
return g(n, t, e, s)
}
function d(e, s) {
function n(t) {
for (var e = 0; e < O.length; e++)if (O[e].toastId === t)return O[e]
}
function o() {
return !O.length
}
var i = n(e);
i && !i.deleting && (i.deleting = !0, i.isOpened = !1, t.leave(i.el).then(function () {
i.scope.options.onHidden && i.scope.options.onHidden(s), i.scope.$destroy();
var t = O.indexOf(i);
delete B[i.scope.message], O.splice(t, 1);
var e = r.maxOpened;
e && O.length >= e && O[e - 1].open.resolve(), o() && (h.remove(), h = null, T = a.defer())
}))
}
function g(t, e, s, n) {
return angular.isObject(s) && (n = s, s = null), v({iconClass: t, message: e, optionsOverride: n, title: s})
}
function m() {
return angular.extend({}, r)
}
function f(e) {
if (h)return T.promise;
h = angular.element("<div></div>"), h.attr("id", e.containerId), h.addClass(e.positionClass), h.css({"pointer-events": "auto"});
var s = angular.element(document.querySelector(e.target));
if (!s || !s.length)throw"Target for toasts doesn't exist";
return t.enter(h, s).then(function () {
T.resolve()
}), T.promise
}
function v(s) {
function r(t, e, s) {
s.allowHtml ? (t.scope.allowHtml = !0, t.scope.title = o.trustAsHtml(e.title), t.scope.message = o.trustAsHtml(e.message)) : (t.scope.title = e.title, t.scope.message = e.message), t.scope.toastType = t.iconClass, t.scope.toastId = t.toastId, t.scope.options = {
extendedTimeOut: s.extendedTimeOut,
messageClass: s.messageClass,
onHidden: s.onHidden,
onShown: s.onShown,
progressBar: s.progressBar,
tapToDismiss: s.tapToDismiss,
timeOut: s.timeOut,
titleClass: s.titleClass,
toastClass: s.toastClass
}, s.closeButton && (t.scope.options.closeHtml = s.closeHtml)
}
function i() {
function t(t) {
for (var e = ["containerId", "iconClasses", "maxOpened", "newestOnTop", "positionClass", "preventDuplicates", "preventOpenDuplicates", "templates"], s = 0, n = e.length; n > s; s++)delete t[e[s]];
return t
}
var e = {toastId: C++, isOpened: !1, scope: n.$new(), open: a.defer()};
return e.iconClass = s.iconClass, s.optionsOverride && (p = angular.extend(p, t(s.optionsOverride)), e.iconClass = s.optionsOverride.iconClass || e.iconClass), r(e, s, p), e.el = l(e.scope), e
}
function l(t) {
var s = angular.element("<div toast></div>"), n = e.get("$compile");
return n(s)(t)
}
function c() {
return p.maxOpened && O.length <= p.maxOpened || !p.maxOpened
}
function u() {
var t = p.preventDuplicates && s.message === w, e = p.preventOpenDuplicates && B[s.message];
return t || e ? !0 : (w = s.message, B[s.message] = !0, !1)
}
var p = m();
if (!u()) {
var g = i();
if (O.push(g), p.autoDismiss && p.maxOpened > 0)for (var v = O.slice(0, O.length - p.maxOpened), T = 0, $ = v.length; $ > T; T++)d(v[T].toastId);
return c() && g.open.resolve(), g.open.promise.then(function () {
f(p).then(function () {
if (g.isOpened = !0, p.newestOnTop)t.enter(g.el, h).then(function () {
g.scope.init()
}); else {
var e = h[0].lastChild ? angular.element(h[0].lastChild) : null;
t.enter(g.el, h, e).then(function () {
g.scope.init()
})
}
})
}), g
}
}
var h, C = 0, O = [], w = "", B = {}, T = a.defer(), $ = {
clear: i,
error: l,
info: c,
remove: d,
success: u,
warning: p
};
return $
}
angular.module("toastr", []).factory("toastr", t), t.$inject = ["$animate", "$injector", "$document", "$rootScope", "$sce", "toastrConfig", "$q"]
}(), function () {
"use strict";
angular.module("toastr").constant("toastrConfig", {
allowHtml: !1,
autoDismiss: !1,
closeButton: !1,
closeHtml: "<button>×</button>",
containerId: "toast-container",
extendedTimeOut: 1e3,
iconClasses: {error: "toast-error", info: "toast-info", success: "toast-success", warning: "toast-warning"},
maxOpened: 0,
messageClass: "toast-message",
newestOnTop: !0,
onHidden: null,
onShown: null,
positionClass: "toast-top-right",
preventDuplicates: !1,
preventOpenDuplicates: !1,
progressBar: !1,
tapToDismiss: !0,
target: "body",
templates: {toast: "directives/toast/toast.html", progressbar: "directives/progressbar/progressbar.html"},
timeOut: 5e3,
titleClass: "toast-title",
toastClass: "toast"
})
}(), function () {
"use strict";
function t(t) {
function e(t, e, s, n) {
function o() {
var t = (i - (new Date).getTime()) / a * 100;
e.css("width", t + "%")
}
var r, a, i;
n.progressBar = t, t.start = function (t) {
r && clearInterval(r), a = parseFloat(t), i = (new Date).getTime() + a, r = setInterval(o, 10)
}, t.stop = function () {
r && clearInterval(r)
}, t.$on("$destroy", function () {
clearInterval(r)
})
}
return {
replace: !0, require: "^toast", templateUrl: function () {
return t.templates.progressbar
}, link: e
}
}
angular.module("toastr").directive("progressBar", t), t.$inject = ["toastrConfig"]
}(), function () {
"use strict";
function t() {
this.progressBar = null, this.startProgressBar = function (t) {
this.progressBar && this.progressBar.start(t)
}, this.stopProgressBar = function () {
this.progressBar && this.progressBar.stop()
}
}
angular.module("toastr").controller("ToastController", t)
}(), function () {
"use strict";
function t(t, e, s, n) {
function o(s, o, r, a) {
function i(t) {
return a.startProgressBar(t), e(function () {
a.stopProgressBar(), n.remove(s.toastId)
}, t, 1)
}
function l() {
s.progressBar = !1, a.stopProgressBar()
}
function c() {
return s.options.closeHtml
}
var u;
if (s.toastClass = s.options.toastClass, s.titleClass = s.options.titleClass, s.messageClass = s.options.messageClass, s.progressBar = s.options.progressBar, c()) {
var p = angular.element(s.options.closeHtml), d = t.get("$compile");
p.addClass("toast-close-button"), p.attr("ng-click", "close()"), d(p)(s), o.prepend(p)
}
s.init = function () {
s.options.timeOut && (u = i(s.options.timeOut)), s.options.onShown && s.options.onShown()
}, o.on("mouseenter", function () {
l(), u && e.cancel(u)
}), s.tapToast = function () {
s.options.tapToDismiss && s.close(!0)
}, s.close = function (t) {
n.remove(s.toastId, t)
}, o.on("mouseleave", function () {
(0 !== s.options.timeOut || 0 !== s.options.extendedTimeOut) && (s.$apply(function () {
s.progressBar = s.options.progressBar
}), u = i(s.options.extendedTimeOut))
})
}
return {
replace: !0, templateUrl: function () {
return s.templates.toast
}, controller: "ToastController", link: o
}
}
angular.module("toastr").directive("toast", t), t.$inject = ["$injector", "$interval", "toastrConfig", "toastr"]
}(), angular.module("toastr").run(["$templateCache", function (t) {
t.put("directives/progressbar/progressbar.html", '<div class="toast-progress"></div>\n'), t.put("directives/toast/toast.html", '<div class="{{toastClass}} {{toastType}}" ng-click="tapToast()">\n <div ng-switch on="allowHtml">\n <div ng-switch-default ng-if="title" class="{{titleClass}}">{{title}}</div>\n <div ng-switch-default class="{{messageClass}}">{{message}}</div>\n <div ng-switch-when="true" ng-if="title" class="{{titleClass}}" ng-bind-html="title"></div>\n <div ng-switch-when="true" class="{{messageClass}}" ng-bind-html="message"></div>\n </div>\n <progress-bar ng-if="progressBar"></progress-bar>\n</div>\n')
}]);
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/BizDBPropertySourceTest.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.biz.service;
import com.google.common.collect.Lists;
import com.ctrip.framework.apollo.biz.AbstractUnitTest;
import com.ctrip.framework.apollo.biz.MockBeanFactory;
import com.ctrip.framework.apollo.biz.entity.ServerConfig;
import com.ctrip.framework.apollo.biz.repository.ServerConfigRepository;
import com.ctrip.framework.apollo.core.ConfigConsts;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.springframework.test.util.ReflectionTestUtils;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public class BizDBPropertySourceTest extends AbstractUnitTest {
@Mock
private ServerConfigRepository serverConfigRepository;
private BizDBPropertySource propertySource;
private String clusterConfigKey = "clusterKey";
private String clusterConfigValue = "clusterValue";
private String dcConfigKey = "dcKey";
private String dcConfigValue = "dcValue";
private String defaultKey = "defaultKey";
private String defaultValue = "defaultValue";
@Before
public void initTestData() {
propertySource = spy(new BizDBPropertySource());
ReflectionTestUtils.setField(propertySource, "serverConfigRepository", serverConfigRepository);
List<ServerConfig> configs = Lists.newLinkedList();
//cluster config
String cluster = "cluster";
configs.add(MockBeanFactory.mockServerConfig(clusterConfigKey, clusterConfigValue, cluster));
String dc = "dc";
configs.add(MockBeanFactory.mockServerConfig(clusterConfigKey, clusterConfigValue + "dc", dc));
configs.add(MockBeanFactory.mockServerConfig(clusterConfigKey, clusterConfigValue + ConfigConsts.CLUSTER_NAME_DEFAULT,
ConfigConsts.CLUSTER_NAME_DEFAULT));
//dc config
configs.add(MockBeanFactory.mockServerConfig(dcConfigKey, dcConfigValue, dc));
configs.add(MockBeanFactory.mockServerConfig(dcConfigKey, dcConfigValue + ConfigConsts.CLUSTER_NAME_DEFAULT,
ConfigConsts.CLUSTER_NAME_DEFAULT));
//default config
configs.add(MockBeanFactory.mockServerConfig(defaultKey, defaultValue, ConfigConsts.CLUSTER_NAME_DEFAULT));
System.setProperty(ConfigConsts.APOLLO_CLUSTER_KEY, cluster);
when(propertySource.getCurrentDataCenter()).thenReturn(dc);
when(serverConfigRepository.findAll()).thenReturn(configs);
}
@After
public void clear() {
System.clearProperty(ConfigConsts.APOLLO_CLUSTER_KEY);
}
@Test
public void testGetClusterConfig() {
propertySource.refresh();
assertEquals(propertySource.getProperty(clusterConfigKey), clusterConfigValue);
}
@Test
public void testGetDcConfig() {
propertySource.refresh();
assertEquals(propertySource.getProperty(dcConfigKey), dcConfigValue);
}
@Test
public void testGetDefaultConfig() {
propertySource.refresh();
assertEquals(propertySource.getProperty(defaultKey), defaultValue);
}
@Test
public void testGetNull() {
propertySource.refresh();
assertNull(propertySource.getProperty("noKey"));
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.biz.service;
import com.google.common.collect.Lists;
import com.ctrip.framework.apollo.biz.AbstractUnitTest;
import com.ctrip.framework.apollo.biz.MockBeanFactory;
import com.ctrip.framework.apollo.biz.entity.ServerConfig;
import com.ctrip.framework.apollo.biz.repository.ServerConfigRepository;
import com.ctrip.framework.apollo.core.ConfigConsts;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.springframework.test.util.ReflectionTestUtils;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public class BizDBPropertySourceTest extends AbstractUnitTest {
@Mock
private ServerConfigRepository serverConfigRepository;
private BizDBPropertySource propertySource;
private String clusterConfigKey = "clusterKey";
private String clusterConfigValue = "clusterValue";
private String dcConfigKey = "dcKey";
private String dcConfigValue = "dcValue";
private String defaultKey = "defaultKey";
private String defaultValue = "defaultValue";
@Before
public void initTestData() {
propertySource = spy(new BizDBPropertySource());
ReflectionTestUtils.setField(propertySource, "serverConfigRepository", serverConfigRepository);
List<ServerConfig> configs = Lists.newLinkedList();
//cluster config
String cluster = "cluster";
configs.add(MockBeanFactory.mockServerConfig(clusterConfigKey, clusterConfigValue, cluster));
String dc = "dc";
configs.add(MockBeanFactory.mockServerConfig(clusterConfigKey, clusterConfigValue + "dc", dc));
configs.add(MockBeanFactory.mockServerConfig(clusterConfigKey, clusterConfigValue + ConfigConsts.CLUSTER_NAME_DEFAULT,
ConfigConsts.CLUSTER_NAME_DEFAULT));
//dc config
configs.add(MockBeanFactory.mockServerConfig(dcConfigKey, dcConfigValue, dc));
configs.add(MockBeanFactory.mockServerConfig(dcConfigKey, dcConfigValue + ConfigConsts.CLUSTER_NAME_DEFAULT,
ConfigConsts.CLUSTER_NAME_DEFAULT));
//default config
configs.add(MockBeanFactory.mockServerConfig(defaultKey, defaultValue, ConfigConsts.CLUSTER_NAME_DEFAULT));
System.setProperty(ConfigConsts.APOLLO_CLUSTER_KEY, cluster);
when(propertySource.getCurrentDataCenter()).thenReturn(dc);
when(serverConfigRepository.findAll()).thenReturn(configs);
}
@After
public void clear() {
System.clearProperty(ConfigConsts.APOLLO_CLUSTER_KEY);
}
@Test
public void testGetClusterConfig() {
propertySource.refresh();
assertEquals(propertySource.getProperty(clusterConfigKey), clusterConfigValue);
}
@Test
public void testGetDcConfig() {
propertySource.refresh();
assertEquals(propertySource.getProperty(dcConfigKey), dcConfigValue);
}
@Test
public void testGetDefaultConfig() {
propertySource.refresh();
assertEquals(propertySource.getProperty(defaultKey), defaultValue);
}
@Test
public void testGetNull() {
propertySource.refresh();
assertNull(propertySource.getProperty("noKey"));
}
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-mockserver/src/test/resources/mockdata-application.properties | #
# Copyright 2021 Apollo Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
key1=value1
key2=value2
| #
# Copyright 2021 Apollo Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
key1=value1
key2=value2
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/GrayReleaseRuleDTO.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.common.dto;
import com.google.common.collect.Sets;
import java.util.Set;
public class GrayReleaseRuleDTO extends BaseDTO {
private String appId;
private String clusterName;
private String namespaceName;
private String branchName;
private Set<GrayReleaseRuleItemDTO> ruleItems;
private Long releaseId;
public GrayReleaseRuleDTO(String appId, String clusterName, String namespaceName, String branchName) {
this.appId = appId;
this.clusterName = clusterName;
this.namespaceName = namespaceName;
this.branchName = branchName;
this.ruleItems = Sets.newHashSet();
}
public String getAppId() {
return appId;
}
public String getClusterName() {
return clusterName;
}
public String getNamespaceName() {
return namespaceName;
}
public String getBranchName() {
return branchName;
}
public Set<GrayReleaseRuleItemDTO> getRuleItems() {
return ruleItems;
}
public void setRuleItems(Set<GrayReleaseRuleItemDTO> ruleItems) {
this.ruleItems = ruleItems;
}
public void addRuleItem(GrayReleaseRuleItemDTO ruleItem) {
this.ruleItems.add(ruleItem);
}
public Long getReleaseId() {
return releaseId;
}
public void setReleaseId(Long releaseId) {
this.releaseId = releaseId;
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.common.dto;
import com.google.common.collect.Sets;
import java.util.Set;
public class GrayReleaseRuleDTO extends BaseDTO {
private String appId;
private String clusterName;
private String namespaceName;
private String branchName;
private Set<GrayReleaseRuleItemDTO> ruleItems;
private Long releaseId;
public GrayReleaseRuleDTO(String appId, String clusterName, String namespaceName, String branchName) {
this.appId = appId;
this.clusterName = clusterName;
this.namespaceName = namespaceName;
this.branchName = branchName;
this.ruleItems = Sets.newHashSet();
}
public String getAppId() {
return appId;
}
public String getClusterName() {
return clusterName;
}
public String getNamespaceName() {
return namespaceName;
}
public String getBranchName() {
return branchName;
}
public Set<GrayReleaseRuleItemDTO> getRuleItems() {
return ruleItems;
}
public void setRuleItems(Set<GrayReleaseRuleItemDTO> ruleItems) {
this.ruleItems = ruleItems;
}
public void addRuleItem(GrayReleaseRuleItemDTO ruleItem) {
this.ruleItems.add(ruleItem);
}
public Long getReleaseId() {
return releaseId;
}
public void setReleaseId(Long releaseId) {
this.releaseId = releaseId;
}
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-buildtools/pom.xml | <?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2021 Apollo Authors
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo</artifactId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apollo-buildtools</artifactId>
<name>Apollo BuildTools</name>
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target</outputDirectory>
<resources>
<resource>
<directory>src/main/scripts</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
| <?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2021 Apollo Authors
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo</artifactId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apollo-buildtools</artifactId>
<name>Apollo BuildTools</name>
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target</outputDirectory>
<resources>
<resource>
<directory>src/main/scripts</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/txtresolver/PropertyResolver.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.portal.component.txtresolver;
import com.ctrip.framework.apollo.common.dto.ItemChangeSets;
import com.ctrip.framework.apollo.common.dto.ItemDTO;
import com.ctrip.framework.apollo.common.exception.BadRequestException;
import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.google.common.base.Strings;
import org.springframework.stereotype.Component;
import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* normal property file resolver.
* update comment and blank item implement by create new item and delete old item.
* update normal key/value item implement by update.
*/
@Component("propertyResolver")
public class PropertyResolver implements ConfigTextResolver {
private static final String KV_SEPARATOR = "=";
private static final String ITEM_SEPARATOR = "\n";
@Override
public ItemChangeSets resolve(long namespaceId, String configText, List<ItemDTO> baseItems) {
Map<Integer, ItemDTO> oldLineNumMapItem = BeanUtils.mapByKey("lineNum", baseItems);
Map<String, ItemDTO> oldKeyMapItem = BeanUtils.mapByKey("key", baseItems);
//remove comment and blank item map.
oldKeyMapItem.remove("");
String[] newItems = configText.split(ITEM_SEPARATOR);
Set<String> repeatKeys = new HashSet<>();
if (isHasRepeatKey(newItems, repeatKeys)) {
throw new BadRequestException(String.format("Config text has repeated keys: %s, please check your input.", repeatKeys.toString()));
}
ItemChangeSets changeSets = new ItemChangeSets();
Map<Integer, String> newLineNumMapItem = new HashMap<>();//use for delete blank and comment item
int lineCounter = 1;
for (String newItem : newItems) {
newItem = newItem.trim();
newLineNumMapItem.put(lineCounter, newItem);
ItemDTO oldItemByLine = oldLineNumMapItem.get(lineCounter);
//comment item
if (isCommentItem(newItem)) {
handleCommentLine(namespaceId, oldItemByLine, newItem, lineCounter, changeSets);
//blank item
} else if (isBlankItem(newItem)) {
handleBlankLine(namespaceId, oldItemByLine, lineCounter, changeSets);
//normal item
} else {
handleNormalLine(namespaceId, oldKeyMapItem, newItem, lineCounter, changeSets);
}
lineCounter++;
}
deleteCommentAndBlankItem(oldLineNumMapItem, newLineNumMapItem, changeSets);
deleteNormalKVItem(oldKeyMapItem, changeSets);
return changeSets;
}
private boolean isHasRepeatKey(String[] newItems, @NotNull Set<String> repeatKeys) {
Set<String> keys = new HashSet<>();
int lineCounter = 1;
for (String item : newItems) {
if (!isCommentItem(item) && !isBlankItem(item)) {
String[] kv = parseKeyValueFromItem(item);
if (kv != null) {
String key = kv[0].toLowerCase();
if(!keys.add(key)){
repeatKeys.add(key);
}
} else {
throw new BadRequestException("line:" + lineCounter + " key value must separate by '='");
}
}
lineCounter++;
}
return !repeatKeys.isEmpty();
}
private String[] parseKeyValueFromItem(String item) {
int kvSeparator = item.indexOf(KV_SEPARATOR);
if (kvSeparator == -1) {
return null;
}
String[] kv = new String[2];
kv[0] = item.substring(0, kvSeparator).trim();
kv[1] = item.substring(kvSeparator + 1).trim();
return kv;
}
private void handleCommentLine(Long namespaceId, ItemDTO oldItemByLine, String newItem, int lineCounter, ItemChangeSets changeSets) {
String oldComment = oldItemByLine == null ? "" : oldItemByLine.getComment();
//create comment. implement update comment by delete old comment and create new comment
if (!(isCommentItem(oldItemByLine) && newItem.equals(oldComment))) {
changeSets.addCreateItem(buildCommentItem(0L, namespaceId, newItem, lineCounter));
}
}
private void handleBlankLine(Long namespaceId, ItemDTO oldItem, int lineCounter, ItemChangeSets changeSets) {
if (!isBlankItem(oldItem)) {
changeSets.addCreateItem(buildBlankItem(0L, namespaceId, lineCounter));
}
}
private void handleNormalLine(Long namespaceId, Map<String, ItemDTO> keyMapOldItem, String newItem,
int lineCounter, ItemChangeSets changeSets) {
String[] kv = parseKeyValueFromItem(newItem);
if (kv == null) {
throw new BadRequestException("line:" + lineCounter + " key value must separate by '='");
}
String newKey = kv[0];
String newValue = kv[1].replace("\\n", "\n"); //handle user input \n
ItemDTO oldItem = keyMapOldItem.get(newKey);
if (oldItem == null) {//new item
changeSets.addCreateItem(buildNormalItem(0L, namespaceId, newKey, newValue, "", lineCounter));
} else if (!newValue.equals(oldItem.getValue()) || lineCounter != oldItem.getLineNum()) {//update item
changeSets.addUpdateItem(
buildNormalItem(oldItem.getId(), namespaceId, newKey, newValue, oldItem.getComment(),
lineCounter));
}
keyMapOldItem.remove(newKey);
}
private boolean isCommentItem(ItemDTO item) {
return item != null && "".equals(item.getKey())
&& (item.getComment().startsWith("#") || item.getComment().startsWith("!"));
}
private boolean isCommentItem(String line) {
return line != null && (line.startsWith("#") || line.startsWith("!"));
}
private boolean isBlankItem(ItemDTO item) {
return item != null && "".equals(item.getKey()) && "".equals(item.getComment());
}
private boolean isBlankItem(String line) {
return Strings.nullToEmpty(line).trim().isEmpty();
}
private void deleteNormalKVItem(Map<String, ItemDTO> baseKeyMapItem, ItemChangeSets changeSets) {
//surplus item is to be deleted
for (Map.Entry<String, ItemDTO> entry : baseKeyMapItem.entrySet()) {
changeSets.addDeleteItem(entry.getValue());
}
}
private void deleteCommentAndBlankItem(Map<Integer, ItemDTO> oldLineNumMapItem,
Map<Integer, String> newLineNumMapItem,
ItemChangeSets changeSets) {
for (Map.Entry<Integer, ItemDTO> entry : oldLineNumMapItem.entrySet()) {
int lineNum = entry.getKey();
ItemDTO oldItem = entry.getValue();
String newItem = newLineNumMapItem.get(lineNum);
//1. old is blank by now is not
//2.old is comment by now is not exist or modified
if ((isBlankItem(oldItem) && !isBlankItem(newItem))
|| isCommentItem(oldItem) && (newItem == null || !newItem.equals(oldItem.getComment()))) {
changeSets.addDeleteItem(oldItem);
}
}
}
private ItemDTO buildCommentItem(Long id, Long namespaceId, String comment, int lineNum) {
return buildNormalItem(id, namespaceId, "", "", comment, lineNum);
}
private ItemDTO buildBlankItem(Long id, Long namespaceId, int lineNum) {
return buildNormalItem(id, namespaceId, "", "", "", lineNum);
}
private ItemDTO buildNormalItem(Long id, Long namespaceId, String key, String value, String comment, int lineNum) {
ItemDTO item = new ItemDTO(key, value, comment, lineNum);
item.setId(id);
item.setNamespaceId(namespaceId);
return item;
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.portal.component.txtresolver;
import com.ctrip.framework.apollo.common.dto.ItemChangeSets;
import com.ctrip.framework.apollo.common.dto.ItemDTO;
import com.ctrip.framework.apollo.common.exception.BadRequestException;
import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.google.common.base.Strings;
import org.springframework.stereotype.Component;
import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* normal property file resolver.
* update comment and blank item implement by create new item and delete old item.
* update normal key/value item implement by update.
*/
@Component("propertyResolver")
public class PropertyResolver implements ConfigTextResolver {
private static final String KV_SEPARATOR = "=";
private static final String ITEM_SEPARATOR = "\n";
@Override
public ItemChangeSets resolve(long namespaceId, String configText, List<ItemDTO> baseItems) {
Map<Integer, ItemDTO> oldLineNumMapItem = BeanUtils.mapByKey("lineNum", baseItems);
Map<String, ItemDTO> oldKeyMapItem = BeanUtils.mapByKey("key", baseItems);
//remove comment and blank item map.
oldKeyMapItem.remove("");
String[] newItems = configText.split(ITEM_SEPARATOR);
Set<String> repeatKeys = new HashSet<>();
if (isHasRepeatKey(newItems, repeatKeys)) {
throw new BadRequestException(String.format("Config text has repeated keys: %s, please check your input.", repeatKeys.toString()));
}
ItemChangeSets changeSets = new ItemChangeSets();
Map<Integer, String> newLineNumMapItem = new HashMap<>();//use for delete blank and comment item
int lineCounter = 1;
for (String newItem : newItems) {
newItem = newItem.trim();
newLineNumMapItem.put(lineCounter, newItem);
ItemDTO oldItemByLine = oldLineNumMapItem.get(lineCounter);
//comment item
if (isCommentItem(newItem)) {
handleCommentLine(namespaceId, oldItemByLine, newItem, lineCounter, changeSets);
//blank item
} else if (isBlankItem(newItem)) {
handleBlankLine(namespaceId, oldItemByLine, lineCounter, changeSets);
//normal item
} else {
handleNormalLine(namespaceId, oldKeyMapItem, newItem, lineCounter, changeSets);
}
lineCounter++;
}
deleteCommentAndBlankItem(oldLineNumMapItem, newLineNumMapItem, changeSets);
deleteNormalKVItem(oldKeyMapItem, changeSets);
return changeSets;
}
private boolean isHasRepeatKey(String[] newItems, @NotNull Set<String> repeatKeys) {
Set<String> keys = new HashSet<>();
int lineCounter = 1;
for (String item : newItems) {
if (!isCommentItem(item) && !isBlankItem(item)) {
String[] kv = parseKeyValueFromItem(item);
if (kv != null) {
String key = kv[0].toLowerCase();
if(!keys.add(key)){
repeatKeys.add(key);
}
} else {
throw new BadRequestException("line:" + lineCounter + " key value must separate by '='");
}
}
lineCounter++;
}
return !repeatKeys.isEmpty();
}
private String[] parseKeyValueFromItem(String item) {
int kvSeparator = item.indexOf(KV_SEPARATOR);
if (kvSeparator == -1) {
return null;
}
String[] kv = new String[2];
kv[0] = item.substring(0, kvSeparator).trim();
kv[1] = item.substring(kvSeparator + 1).trim();
return kv;
}
private void handleCommentLine(Long namespaceId, ItemDTO oldItemByLine, String newItem, int lineCounter, ItemChangeSets changeSets) {
String oldComment = oldItemByLine == null ? "" : oldItemByLine.getComment();
//create comment. implement update comment by delete old comment and create new comment
if (!(isCommentItem(oldItemByLine) && newItem.equals(oldComment))) {
changeSets.addCreateItem(buildCommentItem(0L, namespaceId, newItem, lineCounter));
}
}
private void handleBlankLine(Long namespaceId, ItemDTO oldItem, int lineCounter, ItemChangeSets changeSets) {
if (!isBlankItem(oldItem)) {
changeSets.addCreateItem(buildBlankItem(0L, namespaceId, lineCounter));
}
}
private void handleNormalLine(Long namespaceId, Map<String, ItemDTO> keyMapOldItem, String newItem,
int lineCounter, ItemChangeSets changeSets) {
String[] kv = parseKeyValueFromItem(newItem);
if (kv == null) {
throw new BadRequestException("line:" + lineCounter + " key value must separate by '='");
}
String newKey = kv[0];
String newValue = kv[1].replace("\\n", "\n"); //handle user input \n
ItemDTO oldItem = keyMapOldItem.get(newKey);
if (oldItem == null) {//new item
changeSets.addCreateItem(buildNormalItem(0L, namespaceId, newKey, newValue, "", lineCounter));
} else if (!newValue.equals(oldItem.getValue()) || lineCounter != oldItem.getLineNum()) {//update item
changeSets.addUpdateItem(
buildNormalItem(oldItem.getId(), namespaceId, newKey, newValue, oldItem.getComment(),
lineCounter));
}
keyMapOldItem.remove(newKey);
}
private boolean isCommentItem(ItemDTO item) {
return item != null && "".equals(item.getKey())
&& (item.getComment().startsWith("#") || item.getComment().startsWith("!"));
}
private boolean isCommentItem(String line) {
return line != null && (line.startsWith("#") || line.startsWith("!"));
}
private boolean isBlankItem(ItemDTO item) {
return item != null && "".equals(item.getKey()) && "".equals(item.getComment());
}
private boolean isBlankItem(String line) {
return Strings.nullToEmpty(line).trim().isEmpty();
}
private void deleteNormalKVItem(Map<String, ItemDTO> baseKeyMapItem, ItemChangeSets changeSets) {
//surplus item is to be deleted
for (Map.Entry<String, ItemDTO> entry : baseKeyMapItem.entrySet()) {
changeSets.addDeleteItem(entry.getValue());
}
}
private void deleteCommentAndBlankItem(Map<Integer, ItemDTO> oldLineNumMapItem,
Map<Integer, String> newLineNumMapItem,
ItemChangeSets changeSets) {
for (Map.Entry<Integer, ItemDTO> entry : oldLineNumMapItem.entrySet()) {
int lineNum = entry.getKey();
ItemDTO oldItem = entry.getValue();
String newItem = newLineNumMapItem.get(lineNum);
//1. old is blank by now is not
//2.old is comment by now is not exist or modified
if ((isBlankItem(oldItem) && !isBlankItem(newItem))
|| isCommentItem(oldItem) && (newItem == null || !newItem.equals(oldItem.getComment()))) {
changeSets.addDeleteItem(oldItem);
}
}
}
private ItemDTO buildCommentItem(Long id, Long namespaceId, String comment, int lineNum) {
return buildNormalItem(id, namespaceId, "", "", comment, lineNum);
}
private ItemDTO buildBlankItem(Long id, Long namespaceId, int lineNum) {
return buildNormalItem(id, namespaceId, "", "", "", lineNum);
}
private ItemDTO buildNormalItem(Long id, Long namespaceId, String key, String value, String comment, int lineNum) {
ItemDTO item = new ItemDTO(key, value, comment, lineNum);
item.setId(id);
item.setNamespaceId(namespaceId);
return item;
}
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-client-config-data/src/test/java/com/ctrip/framework/apollo/config/data/system/ApolloClientSystemPropertiesCompatibleTest.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.config.data.system;
import com.ctrip.framework.apollo.core.ApolloClientSystemConsts;
import com.ctrip.framework.apollo.spring.boot.ApolloApplicationContextInitializer;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author vdisk <vdisk@foxmail.com>
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = ApolloClientPropertyCompatibleTestConfiguration.class,
webEnvironment = SpringBootTest.WebEnvironment.NONE)
public class ApolloClientSystemPropertiesCompatibleTest {
@Autowired
private ConfigurableEnvironment environment;
@Test
public void testSystemPropertiesCompatible() {
System.setProperty(ApolloClientSystemConsts.DEPRECATED_APOLLO_CACHE_DIR, "test-3/cacheDir");
System
.setProperty(ApolloClientSystemConsts.DEPRECATED_APOLLO_ACCESS_KEY_SECRET, "test-3-secret");
System.setProperty(ApolloClientSystemConsts.DEPRECATED_APOLLO_CONFIG_SERVICE,
"https://test-3-config-service");
Assert.assertEquals("test-3/cacheDir",
this.environment.getProperty(ApolloClientSystemConsts.APOLLO_CACHE_DIR));
Assert.assertEquals("test-3-secret",
this.environment.getProperty(ApolloClientSystemConsts.APOLLO_ACCESS_KEY_SECRET));
Assert.assertEquals("https://test-3-config-service",
this.environment.getProperty(ApolloClientSystemConsts.APOLLO_CONFIG_SERVICE));
System.clearProperty(ApolloClientSystemConsts.DEPRECATED_APOLLO_CACHE_DIR);
System.clearProperty(ApolloClientSystemConsts.DEPRECATED_APOLLO_ACCESS_KEY_SECRET);
System.clearProperty(ApolloClientSystemConsts.DEPRECATED_APOLLO_CONFIG_SERVICE);
}
@After
public void clearProperty() {
for (String propertyName : ApolloApplicationContextInitializer.APOLLO_SYSTEM_PROPERTIES) {
System.clearProperty(propertyName);
}
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.config.data.system;
import com.ctrip.framework.apollo.core.ApolloClientSystemConsts;
import com.ctrip.framework.apollo.spring.boot.ApolloApplicationContextInitializer;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author vdisk <vdisk@foxmail.com>
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = ApolloClientPropertyCompatibleTestConfiguration.class,
webEnvironment = SpringBootTest.WebEnvironment.NONE)
public class ApolloClientSystemPropertiesCompatibleTest {
@Autowired
private ConfigurableEnvironment environment;
@Test
public void testSystemPropertiesCompatible() {
System.setProperty(ApolloClientSystemConsts.DEPRECATED_APOLLO_CACHE_DIR, "test-3/cacheDir");
System
.setProperty(ApolloClientSystemConsts.DEPRECATED_APOLLO_ACCESS_KEY_SECRET, "test-3-secret");
System.setProperty(ApolloClientSystemConsts.DEPRECATED_APOLLO_CONFIG_SERVICE,
"https://test-3-config-service");
Assert.assertEquals("test-3/cacheDir",
this.environment.getProperty(ApolloClientSystemConsts.APOLLO_CACHE_DIR));
Assert.assertEquals("test-3-secret",
this.environment.getProperty(ApolloClientSystemConsts.APOLLO_ACCESS_KEY_SECRET));
Assert.assertEquals("https://test-3-config-service",
this.environment.getProperty(ApolloClientSystemConsts.APOLLO_CONFIG_SERVICE));
System.clearProperty(ApolloClientSystemConsts.DEPRECATED_APOLLO_CACHE_DIR);
System.clearProperty(ApolloClientSystemConsts.DEPRECATED_APOLLO_ACCESS_KEY_SECRET);
System.clearProperty(ApolloClientSystemConsts.DEPRECATED_APOLLO_CONFIG_SERVICE);
}
@After
public void clearProperty() {
for (String propertyName : ApolloApplicationContextInitializer.APOLLO_SYSTEM_PROPERTIES) {
System.clearProperty(propertyName);
}
}
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-core/src/main/java/com/ctrip/framework/foundation/spi/provider/NetworkProvider.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.foundation.spi.provider;
/**
* Provider for network related properties
*/
public interface NetworkProvider extends Provider {
/**
* @return the host address, i.e. ip
*/
String getHostAddress();
/**
* @return the host name
*/
String getHostName();
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.foundation.spi.provider;
/**
* Provider for network related properties
*/
public interface NetworkProvider extends Provider {
/**
* @return the host address, i.e. ip
*/
String getHostAddress();
/**
* @return the host name
*/
String getHostName();
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/BizDBPropertySource.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.biz.service;
import com.google.common.base.Strings;
import com.google.common.collect.Maps;
import com.ctrip.framework.apollo.biz.entity.ServerConfig;
import com.ctrip.framework.apollo.biz.repository.ServerConfigRepository;
import com.ctrip.framework.apollo.common.config.RefreshablePropertySource;
import com.ctrip.framework.apollo.core.ConfigConsts;
import com.ctrip.framework.foundation.Foundation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.Objects;
/**
* @author Jason Song(song_s@ctrip.com)
*/
@Component
public class BizDBPropertySource extends RefreshablePropertySource {
private static final Logger logger = LoggerFactory.getLogger(BizDBPropertySource.class);
@Autowired
private ServerConfigRepository serverConfigRepository;
public BizDBPropertySource(String name, Map<String, Object> source) {
super(name, source);
}
public BizDBPropertySource() {
super("DBConfig", Maps.newConcurrentMap());
}
String getCurrentDataCenter() {
return Foundation.server().getDataCenter();
}
@Override
protected void refresh() {
Iterable<ServerConfig> dbConfigs = serverConfigRepository.findAll();
Map<String, Object> newConfigs = Maps.newHashMap();
//default cluster's configs
for (ServerConfig config : dbConfigs) {
if (Objects.equals(ConfigConsts.CLUSTER_NAME_DEFAULT, config.getCluster())) {
newConfigs.put(config.getKey(), config.getValue());
}
}
//data center's configs
String dataCenter = getCurrentDataCenter();
for (ServerConfig config : dbConfigs) {
if (Objects.equals(dataCenter, config.getCluster())) {
newConfigs.put(config.getKey(), config.getValue());
}
}
//cluster's config
if (!Strings.isNullOrEmpty(System.getProperty(ConfigConsts.APOLLO_CLUSTER_KEY))) {
String cluster = System.getProperty(ConfigConsts.APOLLO_CLUSTER_KEY);
for (ServerConfig config : dbConfigs) {
if (Objects.equals(cluster, config.getCluster())) {
newConfigs.put(config.getKey(), config.getValue());
}
}
}
//put to environment
for (Map.Entry<String, Object> config: newConfigs.entrySet()){
String key = config.getKey();
Object value = config.getValue();
if (this.source.get(key) == null) {
logger.info("Load config from DB : {} = {}", key, value);
} else if (!Objects.equals(this.source.get(key), value)) {
logger.info("Load config from DB : {} = {}. Old value = {}", key,
value, this.source.get(key));
}
this.source.put(key, value);
}
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.biz.service;
import com.google.common.base.Strings;
import com.google.common.collect.Maps;
import com.ctrip.framework.apollo.biz.entity.ServerConfig;
import com.ctrip.framework.apollo.biz.repository.ServerConfigRepository;
import com.ctrip.framework.apollo.common.config.RefreshablePropertySource;
import com.ctrip.framework.apollo.core.ConfigConsts;
import com.ctrip.framework.foundation.Foundation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.Objects;
/**
* @author Jason Song(song_s@ctrip.com)
*/
@Component
public class BizDBPropertySource extends RefreshablePropertySource {
private static final Logger logger = LoggerFactory.getLogger(BizDBPropertySource.class);
@Autowired
private ServerConfigRepository serverConfigRepository;
public BizDBPropertySource(String name, Map<String, Object> source) {
super(name, source);
}
public BizDBPropertySource() {
super("DBConfig", Maps.newConcurrentMap());
}
String getCurrentDataCenter() {
return Foundation.server().getDataCenter();
}
@Override
protected void refresh() {
Iterable<ServerConfig> dbConfigs = serverConfigRepository.findAll();
Map<String, Object> newConfigs = Maps.newHashMap();
//default cluster's configs
for (ServerConfig config : dbConfigs) {
if (Objects.equals(ConfigConsts.CLUSTER_NAME_DEFAULT, config.getCluster())) {
newConfigs.put(config.getKey(), config.getValue());
}
}
//data center's configs
String dataCenter = getCurrentDataCenter();
for (ServerConfig config : dbConfigs) {
if (Objects.equals(dataCenter, config.getCluster())) {
newConfigs.put(config.getKey(), config.getValue());
}
}
//cluster's config
if (!Strings.isNullOrEmpty(System.getProperty(ConfigConsts.APOLLO_CLUSTER_KEY))) {
String cluster = System.getProperty(ConfigConsts.APOLLO_CLUSTER_KEY);
for (ServerConfig config : dbConfigs) {
if (Objects.equals(cluster, config.getCluster())) {
newConfigs.put(config.getKey(), config.getValue());
}
}
}
//put to environment
for (Map.Entry<String, Object> config: newConfigs.entrySet()){
String key = config.getKey();
Object value = config.getValue();
if (this.source.get(key) == null) {
logger.info("Load config from DB : {} = {}", key, value);
} else if (!Objects.equals(this.source.get(key), value)) {
logger.info("Load config from DB : {} = {}. Old value = {}", key,
value, this.source.get(key));
}
this.source.put(key, value);
}
}
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ClusterController.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.adminservice.controller;
import com.ctrip.framework.apollo.biz.entity.Cluster;
import com.ctrip.framework.apollo.biz.service.ClusterService;
import com.ctrip.framework.apollo.common.dto.ClusterDTO;
import com.ctrip.framework.apollo.common.exception.BadRequestException;
import com.ctrip.framework.apollo.common.exception.NotFoundException;
import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.core.ConfigConsts;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;
@RestController
public class ClusterController {
private final ClusterService clusterService;
public ClusterController(final ClusterService clusterService) {
this.clusterService = clusterService;
}
@PostMapping("/apps/{appId}/clusters")
public ClusterDTO create(@PathVariable("appId") String appId,
@RequestParam(value = "autoCreatePrivateNamespace", defaultValue = "true") boolean autoCreatePrivateNamespace,
@Valid @RequestBody ClusterDTO dto) {
Cluster entity = BeanUtils.transform(Cluster.class, dto);
Cluster managedEntity = clusterService.findOne(appId, entity.getName());
if (managedEntity != null) {
throw new BadRequestException("cluster already exist.");
}
if (autoCreatePrivateNamespace) {
entity = clusterService.saveWithInstanceOfAppNamespaces(entity);
} else {
entity = clusterService.saveWithoutInstanceOfAppNamespaces(entity);
}
return BeanUtils.transform(ClusterDTO.class, entity);
}
@DeleteMapping("/apps/{appId}/clusters/{clusterName:.+}")
public void delete(@PathVariable("appId") String appId,
@PathVariable("clusterName") String clusterName, @RequestParam String operator) {
Cluster entity = clusterService.findOne(appId, clusterName);
if (entity == null) {
throw new NotFoundException("cluster not found for clusterName " + clusterName);
}
if(ConfigConsts.CLUSTER_NAME_DEFAULT.equals(entity.getName())){
throw new BadRequestException("can not delete default cluster!");
}
clusterService.delete(entity.getId(), operator);
}
@GetMapping("/apps/{appId}/clusters")
public List<ClusterDTO> find(@PathVariable("appId") String appId) {
List<Cluster> clusters = clusterService.findParentClusters(appId);
return BeanUtils.batchTransform(ClusterDTO.class, clusters);
}
@GetMapping("/apps/{appId}/clusters/{clusterName:.+}")
public ClusterDTO get(@PathVariable("appId") String appId,
@PathVariable("clusterName") String clusterName) {
Cluster cluster = clusterService.findOne(appId, clusterName);
if (cluster == null) {
throw new NotFoundException("cluster not found for name " + clusterName);
}
return BeanUtils.transform(ClusterDTO.class, cluster);
}
@GetMapping("/apps/{appId}/cluster/{clusterName}/unique")
public boolean isAppIdUnique(@PathVariable("appId") String appId,
@PathVariable("clusterName") String clusterName) {
return clusterService.isClusterNameUnique(appId, clusterName);
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.adminservice.controller;
import com.ctrip.framework.apollo.biz.entity.Cluster;
import com.ctrip.framework.apollo.biz.service.ClusterService;
import com.ctrip.framework.apollo.common.dto.ClusterDTO;
import com.ctrip.framework.apollo.common.exception.BadRequestException;
import com.ctrip.framework.apollo.common.exception.NotFoundException;
import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.core.ConfigConsts;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;
@RestController
public class ClusterController {
private final ClusterService clusterService;
public ClusterController(final ClusterService clusterService) {
this.clusterService = clusterService;
}
@PostMapping("/apps/{appId}/clusters")
public ClusterDTO create(@PathVariable("appId") String appId,
@RequestParam(value = "autoCreatePrivateNamespace", defaultValue = "true") boolean autoCreatePrivateNamespace,
@Valid @RequestBody ClusterDTO dto) {
Cluster entity = BeanUtils.transform(Cluster.class, dto);
Cluster managedEntity = clusterService.findOne(appId, entity.getName());
if (managedEntity != null) {
throw new BadRequestException("cluster already exist.");
}
if (autoCreatePrivateNamespace) {
entity = clusterService.saveWithInstanceOfAppNamespaces(entity);
} else {
entity = clusterService.saveWithoutInstanceOfAppNamespaces(entity);
}
return BeanUtils.transform(ClusterDTO.class, entity);
}
@DeleteMapping("/apps/{appId}/clusters/{clusterName:.+}")
public void delete(@PathVariable("appId") String appId,
@PathVariable("clusterName") String clusterName, @RequestParam String operator) {
Cluster entity = clusterService.findOne(appId, clusterName);
if (entity == null) {
throw new NotFoundException("cluster not found for clusterName " + clusterName);
}
if(ConfigConsts.CLUSTER_NAME_DEFAULT.equals(entity.getName())){
throw new BadRequestException("can not delete default cluster!");
}
clusterService.delete(entity.getId(), operator);
}
@GetMapping("/apps/{appId}/clusters")
public List<ClusterDTO> find(@PathVariable("appId") String appId) {
List<Cluster> clusters = clusterService.findParentClusters(appId);
return BeanUtils.batchTransform(ClusterDTO.class, clusters);
}
@GetMapping("/apps/{appId}/clusters/{clusterName:.+}")
public ClusterDTO get(@PathVariable("appId") String appId,
@PathVariable("clusterName") String clusterName) {
Cluster cluster = clusterService.findOne(appId, clusterName);
if (cluster == null) {
throw new NotFoundException("cluster not found for name " + clusterName);
}
return BeanUtils.transform(ClusterDTO.class, cluster);
}
@GetMapping("/apps/{appId}/cluster/{clusterName}/unique")
public boolean isAppIdUnique(@PathVariable("appId") String appId,
@PathVariable("clusterName") String clusterName) {
return clusterService.isClusterNameUnique(appId, clusterName);
}
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/integration/AbstractBaseIntegrationTest.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.configservice.integration;
import com.ctrip.framework.apollo.biz.service.BizDBPropertySource;
import com.google.gson.Gson;
import com.ctrip.framework.apollo.ConfigServiceTestConfiguration;
import com.ctrip.framework.apollo.biz.config.BizConfig;
import com.ctrip.framework.apollo.biz.entity.Namespace;
import com.ctrip.framework.apollo.biz.entity.Release;
import com.ctrip.framework.apollo.biz.entity.ReleaseMessage;
import com.ctrip.framework.apollo.biz.repository.ReleaseMessageRepository;
import com.ctrip.framework.apollo.biz.repository.ReleaseRepository;
import com.ctrip.framework.apollo.biz.utils.ReleaseKeyGenerator;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import java.time.Duration;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.PostConstruct;
/**
* @author Jason Song(song_s@ctrip.com)
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = AbstractBaseIntegrationTest.TestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT)
public abstract class AbstractBaseIntegrationTest {
@Autowired
private ReleaseMessageRepository releaseMessageRepository;
@Autowired
private ReleaseRepository releaseRepository;
private static final Gson GSON = new Gson();
protected RestTemplate restTemplate = (new TestRestTemplate(new RestTemplateBuilder()
.setConnectTimeout(Duration.ofSeconds(5)))).getRestTemplate();
@PostConstruct
private void postConstruct() {
restTemplate.setErrorHandler(new DefaultResponseErrorHandler());
}
@Value("${local.server.port}")
int port;
protected String getHostUrl() {
return "localhost:" + port;
}
@Configuration
@Import(ConfigServiceTestConfiguration.class)
protected static class TestConfiguration {
@Bean
public BizConfig bizConfig(final BizDBPropertySource bizDBPropertySource) {
return new TestBizConfig(bizDBPropertySource);
}
}
protected void sendReleaseMessage(String message) {
ReleaseMessage releaseMessage = new ReleaseMessage(message);
releaseMessageRepository.save(releaseMessage);
}
public Release buildRelease(String name, String comment, Namespace namespace,
Map<String, String> configurations, String owner) {
Release release = new Release();
release.setReleaseKey(ReleaseKeyGenerator.generateReleaseKey(namespace));
release.setDataChangeCreatedTime(new Date());
release.setDataChangeCreatedBy(owner);
release.setDataChangeLastModifiedBy(owner);
release.setName(name);
release.setComment(comment);
release.setAppId(namespace.getAppId());
release.setClusterName(namespace.getClusterName());
release.setNamespaceName(namespace.getNamespaceName());
release.setConfigurations(GSON.toJson(configurations));
release = releaseRepository.save(release);
return release;
}
protected void periodicSendMessage(ExecutorService executorService, String message, AtomicBoolean stop) {
executorService.submit(() -> {
//wait for the request connected to server
while (!stop.get() && !Thread.currentThread().isInterrupted()) {
try {
TimeUnit.MILLISECONDS.sleep(100);
} catch (InterruptedException e) {
}
//double check
if (stop.get()) {
break;
}
sendReleaseMessage(message);
}
});
}
private static class TestBizConfig extends BizConfig {
public TestBizConfig(final BizDBPropertySource propertySource) {
super(propertySource);
}
@Override
public int appNamespaceCacheScanInterval() {
//should be short enough to update the AppNamespace cache in time
return 1;
}
@Override
public TimeUnit appNamespaceCacheScanIntervalTimeUnit() {
return TimeUnit.MILLISECONDS;
}
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.configservice.integration;
import com.ctrip.framework.apollo.biz.service.BizDBPropertySource;
import com.google.gson.Gson;
import com.ctrip.framework.apollo.ConfigServiceTestConfiguration;
import com.ctrip.framework.apollo.biz.config.BizConfig;
import com.ctrip.framework.apollo.biz.entity.Namespace;
import com.ctrip.framework.apollo.biz.entity.Release;
import com.ctrip.framework.apollo.biz.entity.ReleaseMessage;
import com.ctrip.framework.apollo.biz.repository.ReleaseMessageRepository;
import com.ctrip.framework.apollo.biz.repository.ReleaseRepository;
import com.ctrip.framework.apollo.biz.utils.ReleaseKeyGenerator;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import java.time.Duration;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.PostConstruct;
/**
* @author Jason Song(song_s@ctrip.com)
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = AbstractBaseIntegrationTest.TestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT)
public abstract class AbstractBaseIntegrationTest {
@Autowired
private ReleaseMessageRepository releaseMessageRepository;
@Autowired
private ReleaseRepository releaseRepository;
private static final Gson GSON = new Gson();
protected RestTemplate restTemplate = (new TestRestTemplate(new RestTemplateBuilder()
.setConnectTimeout(Duration.ofSeconds(5)))).getRestTemplate();
@PostConstruct
private void postConstruct() {
restTemplate.setErrorHandler(new DefaultResponseErrorHandler());
}
@Value("${local.server.port}")
int port;
protected String getHostUrl() {
return "localhost:" + port;
}
@Configuration
@Import(ConfigServiceTestConfiguration.class)
protected static class TestConfiguration {
@Bean
public BizConfig bizConfig(final BizDBPropertySource bizDBPropertySource) {
return new TestBizConfig(bizDBPropertySource);
}
}
protected void sendReleaseMessage(String message) {
ReleaseMessage releaseMessage = new ReleaseMessage(message);
releaseMessageRepository.save(releaseMessage);
}
public Release buildRelease(String name, String comment, Namespace namespace,
Map<String, String> configurations, String owner) {
Release release = new Release();
release.setReleaseKey(ReleaseKeyGenerator.generateReleaseKey(namespace));
release.setDataChangeCreatedTime(new Date());
release.setDataChangeCreatedBy(owner);
release.setDataChangeLastModifiedBy(owner);
release.setName(name);
release.setComment(comment);
release.setAppId(namespace.getAppId());
release.setClusterName(namespace.getClusterName());
release.setNamespaceName(namespace.getNamespaceName());
release.setConfigurations(GSON.toJson(configurations));
release = releaseRepository.save(release);
return release;
}
protected void periodicSendMessage(ExecutorService executorService, String message, AtomicBoolean stop) {
executorService.submit(() -> {
//wait for the request connected to server
while (!stop.get() && !Thread.currentThread().isInterrupted()) {
try {
TimeUnit.MILLISECONDS.sleep(100);
} catch (InterruptedException e) {
}
//double check
if (stop.get()) {
break;
}
sendReleaseMessage(message);
}
});
}
private static class TestBizConfig extends BizConfig {
public TestBizConfig(final BizDBPropertySource propertySource) {
super(propertySource);
}
@Override
public int appNamespaceCacheScanInterval() {
//should be short enough to update the AppNamespace cache in time
return 1;
}
@Override
public TimeUnit appNamespaceCacheScanIntervalTimeUnit() {
return TimeUnit.MILLISECONDS;
}
}
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./scripts/apollo-on-kubernetes/kubernetes/apollo-env-fat/service-apollo-admin-server-fat.yaml | #
# Copyright 2021 Apollo Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
# configmap for apollo-admin-server-fat
kind: ConfigMap
apiVersion: v1
metadata:
namespace: sre
name: configmap-apollo-admin-server-fat
data:
application-github.properties: |
spring.datasource.url = jdbc:mysql://service-mysql-for-apollo-fat-env.sre:3306/ApolloConfigDB?characterEncoding=utf8
spring.datasource.username = FillInCorrectUser
spring.datasource.password = FillInCorrectPassword
eureka.service.url = http://statefulset-apollo-config-server-fat-0.service-apollo-meta-server-fat:8080/eureka/,http://statefulset-apollo-config-server-fat-1.service-apollo-meta-server-fat:8080/eureka/
---
kind: Service
apiVersion: v1
metadata:
namespace: sre
name: service-apollo-admin-server-fat
labels:
app: service-apollo-admin-server-fat
spec:
ports:
- protocol: TCP
port: 8090
targetPort: 8090
selector:
app: pod-apollo-admin-server-fat
type: ClusterIP
sessionAffinity: ClientIP
---
kind: Deployment
apiVersion: apps/v1
metadata:
namespace: sre
name: deployment-apollo-admin-server-fat
labels:
app: deployment-apollo-admin-server-fat
spec:
replicas: 2
selector:
matchLabels:
app: pod-apollo-admin-server-fat
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: pod-apollo-admin-server-fat
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- pod-apollo-admin-server-fat
topologyKey: kubernetes.io/hostname
volumes:
- name: volume-configmap-apollo-admin-server-fat
configMap:
name: configmap-apollo-admin-server-fat
items:
- key: application-github.properties
path: application-github.properties
containers:
- image: apolloconfig/apollo-adminservice:1.10.0-SNAPSHOT
securityContext:
privileged: true
imagePullPolicy: IfNotPresent
name: container-apollo-admin-server-fat
ports:
- protocol: TCP
containerPort: 8090
volumeMounts:
- name: volume-configmap-apollo-admin-server-fat
mountPath: /apollo-adminservice/config/application-github.properties
subPath: application-github.properties
env:
- name: APOLLO_ADMIN_SERVICE_NAME
value: "service-apollo-admin-server-fat.sre"
readinessProbe:
tcpSocket:
port: 8090
initialDelaySeconds: 10
periodSeconds: 5
livenessProbe:
tcpSocket:
port: 8090
initialDelaySeconds: 120
periodSeconds: 10
dnsPolicy: ClusterFirst
restartPolicy: Always
| #
# Copyright 2021 Apollo Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
# configmap for apollo-admin-server-fat
kind: ConfigMap
apiVersion: v1
metadata:
namespace: sre
name: configmap-apollo-admin-server-fat
data:
application-github.properties: |
spring.datasource.url = jdbc:mysql://service-mysql-for-apollo-fat-env.sre:3306/ApolloConfigDB?characterEncoding=utf8
spring.datasource.username = FillInCorrectUser
spring.datasource.password = FillInCorrectPassword
eureka.service.url = http://statefulset-apollo-config-server-fat-0.service-apollo-meta-server-fat:8080/eureka/,http://statefulset-apollo-config-server-fat-1.service-apollo-meta-server-fat:8080/eureka/
---
kind: Service
apiVersion: v1
metadata:
namespace: sre
name: service-apollo-admin-server-fat
labels:
app: service-apollo-admin-server-fat
spec:
ports:
- protocol: TCP
port: 8090
targetPort: 8090
selector:
app: pod-apollo-admin-server-fat
type: ClusterIP
sessionAffinity: ClientIP
---
kind: Deployment
apiVersion: apps/v1
metadata:
namespace: sre
name: deployment-apollo-admin-server-fat
labels:
app: deployment-apollo-admin-server-fat
spec:
replicas: 2
selector:
matchLabels:
app: pod-apollo-admin-server-fat
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: pod-apollo-admin-server-fat
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- pod-apollo-admin-server-fat
topologyKey: kubernetes.io/hostname
volumes:
- name: volume-configmap-apollo-admin-server-fat
configMap:
name: configmap-apollo-admin-server-fat
items:
- key: application-github.properties
path: application-github.properties
containers:
- image: apolloconfig/apollo-adminservice:1.10.0-SNAPSHOT
securityContext:
privileged: true
imagePullPolicy: IfNotPresent
name: container-apollo-admin-server-fat
ports:
- protocol: TCP
containerPort: 8090
volumeMounts:
- name: volume-configmap-apollo-admin-server-fat
mountPath: /apollo-adminservice/config/application-github.properties
subPath: application-github.properties
env:
- name: APOLLO_ADMIN_SERVICE_NAME
value: "service-apollo-admin-server-fat.sre"
readinessProbe:
tcpSocket:
port: 8090
initialDelaySeconds: 10
periodSeconds: 5
livenessProbe:
tcpSocket:
port: 8090
initialDelaySeconds: 120
periodSeconds: 10
dnsPolicy: ClusterFirst
restartPolicy: Always
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseHistoryService.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.biz.service;
import com.ctrip.framework.apollo.biz.entity.Audit;
import com.ctrip.framework.apollo.biz.entity.ReleaseHistory;
import com.ctrip.framework.apollo.biz.repository.ReleaseHistoryRepository;
import com.google.gson.Gson;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.Map;
import java.util.Set;
/**
* @author Jason Song(song_s@ctrip.com)
*/
@Service
public class ReleaseHistoryService {
private static final Gson GSON = new Gson();
private final ReleaseHistoryRepository releaseHistoryRepository;
private final AuditService auditService;
public ReleaseHistoryService(
final ReleaseHistoryRepository releaseHistoryRepository,
final AuditService auditService) {
this.releaseHistoryRepository = releaseHistoryRepository;
this.auditService = auditService;
}
public Page<ReleaseHistory> findReleaseHistoriesByNamespace(String appId, String clusterName,
String namespaceName, Pageable
pageable) {
return releaseHistoryRepository.findByAppIdAndClusterNameAndNamespaceNameOrderByIdDesc(appId, clusterName,
namespaceName, pageable);
}
public Page<ReleaseHistory> findByReleaseIdAndOperation(long releaseId, int operation, Pageable page) {
return releaseHistoryRepository.findByReleaseIdAndOperationOrderByIdDesc(releaseId, operation, page);
}
public Page<ReleaseHistory> findByPreviousReleaseIdAndOperation(long previousReleaseId, int operation, Pageable page) {
return releaseHistoryRepository.findByPreviousReleaseIdAndOperationOrderByIdDesc(previousReleaseId, operation, page);
}
public Page<ReleaseHistory> findByReleaseIdAndOperationInOrderByIdDesc(long releaseId, Set<Integer> operations, Pageable page) {
return releaseHistoryRepository.findByReleaseIdAndOperationInOrderByIdDesc(releaseId, operations, page);
}
@Transactional
public ReleaseHistory createReleaseHistory(String appId, String clusterName, String
namespaceName, String branchName, long releaseId, long previousReleaseId, int operation,
Map<String, Object> operationContext, String operator) {
ReleaseHistory releaseHistory = new ReleaseHistory();
releaseHistory.setAppId(appId);
releaseHistory.setClusterName(clusterName);
releaseHistory.setNamespaceName(namespaceName);
releaseHistory.setBranchName(branchName);
releaseHistory.setReleaseId(releaseId);
releaseHistory.setPreviousReleaseId(previousReleaseId);
releaseHistory.setOperation(operation);
if (operationContext == null) {
releaseHistory.setOperationContext("{}"); //default empty object
} else {
releaseHistory.setOperationContext(GSON.toJson(operationContext));
}
releaseHistory.setDataChangeCreatedTime(new Date());
releaseHistory.setDataChangeCreatedBy(operator);
releaseHistory.setDataChangeLastModifiedBy(operator);
releaseHistoryRepository.save(releaseHistory);
auditService.audit(ReleaseHistory.class.getSimpleName(), releaseHistory.getId(),
Audit.OP.INSERT, releaseHistory.getDataChangeCreatedBy());
return releaseHistory;
}
@Transactional
public int batchDelete(String appId, String clusterName, String namespaceName, String operator) {
return releaseHistoryRepository.batchDelete(appId, clusterName, namespaceName, operator);
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.biz.service;
import com.ctrip.framework.apollo.biz.entity.Audit;
import com.ctrip.framework.apollo.biz.entity.ReleaseHistory;
import com.ctrip.framework.apollo.biz.repository.ReleaseHistoryRepository;
import com.google.gson.Gson;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.Map;
import java.util.Set;
/**
* @author Jason Song(song_s@ctrip.com)
*/
@Service
public class ReleaseHistoryService {
private static final Gson GSON = new Gson();
private final ReleaseHistoryRepository releaseHistoryRepository;
private final AuditService auditService;
public ReleaseHistoryService(
final ReleaseHistoryRepository releaseHistoryRepository,
final AuditService auditService) {
this.releaseHistoryRepository = releaseHistoryRepository;
this.auditService = auditService;
}
public Page<ReleaseHistory> findReleaseHistoriesByNamespace(String appId, String clusterName,
String namespaceName, Pageable
pageable) {
return releaseHistoryRepository.findByAppIdAndClusterNameAndNamespaceNameOrderByIdDesc(appId, clusterName,
namespaceName, pageable);
}
public Page<ReleaseHistory> findByReleaseIdAndOperation(long releaseId, int operation, Pageable page) {
return releaseHistoryRepository.findByReleaseIdAndOperationOrderByIdDesc(releaseId, operation, page);
}
public Page<ReleaseHistory> findByPreviousReleaseIdAndOperation(long previousReleaseId, int operation, Pageable page) {
return releaseHistoryRepository.findByPreviousReleaseIdAndOperationOrderByIdDesc(previousReleaseId, operation, page);
}
public Page<ReleaseHistory> findByReleaseIdAndOperationInOrderByIdDesc(long releaseId, Set<Integer> operations, Pageable page) {
return releaseHistoryRepository.findByReleaseIdAndOperationInOrderByIdDesc(releaseId, operations, page);
}
@Transactional
public ReleaseHistory createReleaseHistory(String appId, String clusterName, String
namespaceName, String branchName, long releaseId, long previousReleaseId, int operation,
Map<String, Object> operationContext, String operator) {
ReleaseHistory releaseHistory = new ReleaseHistory();
releaseHistory.setAppId(appId);
releaseHistory.setClusterName(clusterName);
releaseHistory.setNamespaceName(namespaceName);
releaseHistory.setBranchName(branchName);
releaseHistory.setReleaseId(releaseId);
releaseHistory.setPreviousReleaseId(previousReleaseId);
releaseHistory.setOperation(operation);
if (operationContext == null) {
releaseHistory.setOperationContext("{}"); //default empty object
} else {
releaseHistory.setOperationContext(GSON.toJson(operationContext));
}
releaseHistory.setDataChangeCreatedTime(new Date());
releaseHistory.setDataChangeCreatedBy(operator);
releaseHistory.setDataChangeLastModifiedBy(operator);
releaseHistoryRepository.save(releaseHistory);
auditService.audit(ReleaseHistory.class.getSimpleName(), releaseHistory.getId(),
Audit.OP.INSERT, releaseHistory.getDataChangeCreatedBy());
return releaseHistory;
}
@Transactional
public int batchDelete(String appId, String clusterName, String namespaceName, String operator) {
return releaseHistoryRepository.batchDelete(appId, clusterName, namespaceName, operator);
}
}
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./scripts/apollo-on-kubernetes/kubernetes/kubectl-apply.sh | #
# Copyright 2021 Apollo Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# create namespace
kubectl create namespace sre
# dev-env
kubectl apply -f apollo-env-dev/service-mysql-for-apollo-dev-env.yaml --record && \
kubectl apply -f apollo-env-dev/service-apollo-config-server-dev.yaml --record && \
kubectl apply -f apollo-env-dev/service-apollo-admin-server-dev.yaml --record
# fat-env
kubectl apply -f apollo-env-fat/service-mysql-for-apollo-fat-env.yaml --record && \
kubectl apply -f apollo-env-fat/service-apollo-config-server-fat.yaml --record && \
kubectl apply -f apollo-env-fat/service-apollo-admin-server-fat.yaml --record
# uat-env
kubectl apply -f apollo-env-uat/service-mysql-for-apollo-uat-env.yaml --record && \
kubectl apply -f apollo-env-uat/service-apollo-config-server-uat.yaml --record && \
kubectl apply -f apollo-env-uat/service-apollo-admin-server-uat.yaml --record
# prod-env
kubectl apply -f apollo-env-prod/service-mysql-for-apollo-prod-env.yaml --record && \
kubectl apply -f apollo-env-prod/service-apollo-config-server-prod.yaml --record && \
kubectl apply -f apollo-env-prod/service-apollo-admin-server-prod.yaml --record
# portal
kubectl apply -f service-apollo-portal-server.yaml --record
| #
# Copyright 2021 Apollo Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# create namespace
kubectl create namespace sre
# dev-env
kubectl apply -f apollo-env-dev/service-mysql-for-apollo-dev-env.yaml --record && \
kubectl apply -f apollo-env-dev/service-apollo-config-server-dev.yaml --record && \
kubectl apply -f apollo-env-dev/service-apollo-admin-server-dev.yaml --record
# fat-env
kubectl apply -f apollo-env-fat/service-mysql-for-apollo-fat-env.yaml --record && \
kubectl apply -f apollo-env-fat/service-apollo-config-server-fat.yaml --record && \
kubectl apply -f apollo-env-fat/service-apollo-admin-server-fat.yaml --record
# uat-env
kubectl apply -f apollo-env-uat/service-mysql-for-apollo-uat-env.yaml --record && \
kubectl apply -f apollo-env-uat/service-apollo-config-server-uat.yaml --record && \
kubectl apply -f apollo-env-uat/service-apollo-admin-server-uat.yaml --record
# prod-env
kubectl apply -f apollo-env-prod/service-mysql-for-apollo-prod-env.yaml --record && \
kubectl apply -f apollo-env-prod/service-apollo-config-server-prod.yaml --record && \
kubectl apply -f apollo-env-prod/service-apollo-admin-server-prod.yaml --record
# portal
kubectl apply -f service-apollo-portal-server.yaml --record
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./apollo-buildtools/.gitignore | /target/
| /target/
| -1 |
apolloconfig/apollo | 3,850 | feat: public namespace basic function | ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | youabcd | 2021-07-26T14:44:38Z | 2021-10-09T01:20:18Z | 982a01f9bb7ce5eed4c9370bc94e7d78f125d24d | 3d0925fb8312c3fd2d09ec18d970b96727920963 | feat: public namespace basic function. ## What's the purpose of this PR
Created a basic administration page for public namespaces. All public namespaces are displayed on the page and click items to jump to the actual editing page.As shown in the figure below:

The original left column of the page in English mode was not aligned, now it is modified to be aligned.

## Which issue(s) this PR fixes:
Fixes #1926
## Brief changelog
**first commit**
The function in namespaceController is called to take out and display all the public namespaces in the database.
**second commit**
Make simple changes to the page style.
**third commit**
Based on the suggestions to make changes. | ./doc/images/apollo-home-screenshot.jpg |