Added copy server support, allowing the duplication of existing servers with the option to make certain modifications. #6085 (#7106)

Added copy server support, allowing the duplication of existing servers with the option to make certain modifications. #6085
This commit is contained in:
Akshay Joshi
2024-01-08 12:16:49 +05:30
committed by GitHub
parent 5e710f7ee3
commit 30509d1bc1
14 changed files with 143 additions and 26 deletions

View File

@@ -11,6 +11,7 @@ import CloudWizard from './CloudWizard';
import getApiInstance from '../../../../static/js/api_instance';
import { BROWSER_PANELS } from '../../../../browser/static/js/constants';
import pgAdmin from 'sources/pgadmin';
import current_user from 'pgadmin.user_management.current_user';
// Cloud Wizard
define('pgadmin.misc.cloud', [
@@ -43,7 +44,7 @@ define('pgadmin.misc.cloud', [
priority: 15,
label: gettext('Deploy Cloud Instance...'),
icon: 'wcTabIcon icon-server',
enable: true,
enable: 'canCreate',
data: {action: 'create'},
category: 'register',
node: 'server_group',
@@ -55,7 +56,7 @@ define('pgadmin.misc.cloud', [
priority: 15,
label: gettext('Deploy Cloud Instance...'),
icon: 'wcTabIcon icon-server',
enable: true,
enable: 'canCreate',
data: {action: 'create'},
category: 'register',
node: 'server',
@@ -64,6 +65,10 @@ define('pgadmin.misc.cloud', [
pgBrowser.add_menus(menus);
return this;
},
canCreate: function(node){
let serverOwner = node.user_id;
return (serverOwner == current_user.id || _.isUndefined(serverOwner));
},
// Callback to draw Wizard Dialog
start_cloud_wizard: function() {