Duplication feature (Closes: #935)

This commit is contained in:
Xavier Guimard 2016-02-15 12:13:07 +00:00
parent 2b6db9cd89
commit 82e306346f
5 changed files with 31 additions and 1 deletions

View File

@ -14,6 +14,10 @@
buttons=[{
"title": "addVhost",
"icon": "plus-sign"
},{
"title": "duplicate",
"action": "duplicateVhost",
"icon": "copy"
},{
"title": "deleteEntry",
"icon": "minus-sign"

View File

@ -379,6 +379,18 @@
});
};
$scope.duplicateVhost = function() {
var name = $scope.domain ? ('.' + $scope.domain.data) : '.example.com';
$scope.message = {
"title": 'virtualHostName',
"field": 'hostname'
};
$scope.showModal('prompt.html', name).then(function() {
var name = $scope.result;
return $scope.duplicateNode(name, 'virtualHost');
});
};
$scope.addSamlIDP = function() {
$scope.newTemplateNode('samlIDPMetaDataNode', 'samlPartnerName', 'idp-example');
};
@ -424,6 +436,18 @@
return t;
};
$scope.duplicateNode = function(name, type) {
var cs = $scope.currentScope;
while (cs.$modelValue.title != type + 's') {
cs = cs.$parentNodeScope;
}
var t = JSON.parse(JSON.stringify($scope.currentNode));
t.id = type + "s/" + 'new__' + name;
t.title = name;
cs.$modelValue.nodes.push(t);
return t;
}
$scope.del = function(a, i) {
a.splice(i, 1);
};

File diff suppressed because one or more lines are too long

View File

@ -165,6 +165,7 @@
"domain": "Domain",
"download": "Download",
"downloadIt": "Download it",
"duplicate": "Duplicate",
"edit": "Edit",
"editContent": "Edit content",
"emptyConf": "Empty configuration",

View File

@ -165,6 +165,7 @@
"domain": "Domaine",
"download": "Télécharger",
"downloadIt": "Télécharger",
"duplicate": "Dupliquer",
"edit": "Éditer",
"editContent": "Éditer le contenu",
"emptyConf": "Configuration vide",