Commit 21492011 by Jason Song Committed by GitHub

Merge pull request #522 from lepdou/fix_0119

add emergency publish confirm dialog
parents 5b2072cd a9047e47
...@@ -229,7 +229,7 @@ ...@@ -229,7 +229,7 @@
cluster="pageContext.clusterName"> cluster="pageContext.clusterName">
</mergeandpublishmodal> </mergeandpublishmodal>
<publishdenymodal></publishdenymodal> <publishdenymodal env="pageContext.env"></publishdenymodal>
<apolloconfirmdialog apollo-dialog-id="'deleteConfirmDialog'" apollo-title="'删除配置'" <apolloconfirmdialog apollo-dialog-id="'deleteConfirmDialog'" apollo-title="'删除配置'"
apollo-detail="'确定要删除配置吗?'" apollo-detail="'确定要删除配置吗?'"
...@@ -256,6 +256,10 @@ ...@@ -256,6 +256,10 @@
apollo-detail="'确定要回滚吗?'" apollo-detail="'确定要回滚吗?'"
apollo-show-cancel-btn="true" apollo-confirm="rollback"></apolloconfirmdialog> apollo-show-cancel-btn="true" apollo-confirm="rollback"></apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'emergencyPublishAlertDialog'" apollo-title="'紧急发布'"
apollo-detail="'确定要紧急发布吗?'"
apollo-show-cancel-btn="true" apollo-confirm="emergencyPublish"></apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'deleteBranchDialog'" apollo-title="'删除灰度'" <apolloconfirmdialog apollo-dialog-id="'deleteBranchDialog'" apollo-title="'删除灰度'"
apollo-detail="'删除灰度会丢失灰度的配置,确定要删除吗?'" apollo-detail="'删除灰度会丢失灰度的配置,确定要删除吗?'"
apollo-show-cancel-btn="true" apollo-confirm="deleteBranch"></apolloconfirmdialog> apollo-show-cancel-btn="true" apollo-confirm="deleteBranch"></apolloconfirmdialog>
......
...@@ -19,6 +19,7 @@ function controller($rootScope, $scope, toastr, AppUtil, EventManager, ConfigSer ...@@ -19,6 +19,7 @@ function controller($rootScope, $scope, toastr, AppUtil, EventManager, ConfigSer
$scope.deleteBranch = deleteBranch; $scope.deleteBranch = deleteBranch;
$scope.showNoModifyPermissionDialog = showNoModifyPermissionDialog; $scope.showNoModifyPermissionDialog = showNoModifyPermissionDialog;
$scope.lockCheck = lockCheck; $scope.lockCheck = lockCheck;
$scope.emergencyPublish = emergencyPublish;
init(); init();
...@@ -312,6 +313,30 @@ function controller($rootScope, $scope, toastr, AppUtil, EventManager, ConfigSer ...@@ -312,6 +313,30 @@ function controller($rootScope, $scope, toastr, AppUtil, EventManager, ConfigSer
} }
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
});
}
}
new Clipboard('.clipboard'); new Clipboard('.clipboard');
} }
......
...@@ -7,6 +7,7 @@ function publishDenyDirective(AppUtil, EventManager) { ...@@ -7,6 +7,7 @@ function publishDenyDirective(AppUtil, EventManager) {
transclude: true, transclude: true,
replace: true, replace: true,
scope: { scope: {
env: "="
}, },
link: function (scope) { link: function (scope) {
var MODAL_ID = "#publishDenyModal"; var MODAL_ID = "#publishDenyModal";
...@@ -22,19 +23,11 @@ function publishDenyDirective(AppUtil, EventManager) { ...@@ -22,19 +23,11 @@ function publishDenyDirective(AppUtil, EventManager) {
function emergencyPublish() { function emergencyPublish() {
AppUtil.hideModal(MODAL_ID); AppUtil.hideModal(MODAL_ID);
if (scope.mergeAndPublish) { EventManager.emit(EventManager.EventType.EMERGENCY_PUBLISH,
EventManager.emit(EventManager.EventType.MERGE_AND_PUBLISH_NAMESPACE,
{ {
branch: scope.toReleaseNamespace, mergeAndPublish: scope.mergeAndPublish,
isEmergencyPublish: true namespace: scope.toReleaseNamespace
}); });
} else {
EventManager.emit(EventManager.EventType.PUBLISH_NAMESPACE,
{
namespace: scope.toReleaseNamespace,
isEmergencyPublish: true
});
}
} }
} }
......
...@@ -132,7 +132,8 @@ appService.service('EventManager', [function () { ...@@ -132,7 +132,8 @@ appService.service('EventManager', [function () {
ROLLBACK_NAMESPACE: 'rollback_namespace', ROLLBACK_NAMESPACE: 'rollback_namespace',
EDIT_GRAY_RELEASE_RULES: 'edit_gray_release_rules', EDIT_GRAY_RELEASE_RULES: 'edit_gray_release_rules',
UPDATE_GRAY_RELEASE_RULES: 'update_gray_release_rules', UPDATE_GRAY_RELEASE_RULES: 'update_gray_release_rules',
PUBLISH_DENY: 'publish_deny' PUBLISH_DENY: 'publish_deny',
EMERGENCY_PUBLISH: 'emergency_publish'
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment