sum7/warehost-frontend
sum7
/
warehost-frontend
Archived
1
0
Fork 0

[host] add modify and delete of database and domain

This commit is contained in:
Martin Geno 2016-10-17 23:43:14 +02:00
parent 538d209f91
commit bd2f5b6698
14 changed files with 99 additions and 19 deletions

View File

@ -4,8 +4,11 @@
span.glyphicon.glyphicon-plus span.glyphicon.glyphicon-plus
form.well(ng-submit="add()",name="addform",ng-if="isAdding") form.well(ng-submit="add()",name="addform",ng-if="isAdding")
.form-group .form-group
label(for="domain") Domain label(for="password") Password
input.form-control(id="domain",name="domain",ng-model="obj.domain",ng-minlength="3") input.form-control(id="password",name="password",ng-model="obj.password",ng-minlength="3")
.form-group
label(for="comment") Comment
input.form-control(id="comment",name="comment",ng-model="obj.comment")
button.btn.btn-primary(type="submit") button.btn.btn-primary(type="submit")
span.glyphicon.glyphicon-floppy-disk span.glyphicon.glyphicon-floppy-disk
| Save | Save
@ -13,10 +16,25 @@
tr(ng-hide='group.$hideRows',ng-repeat="item in $data") tr(ng-hide='group.$hideRows',ng-repeat="item in $data")
td(data-title="'Database/User'") td(data-title="'Database/User'")
span(ng-if="!item.isEditing") warehost_user{{item.profil}}_db{{item.ID}} span(ng-if="!item.isEditing") warehost_user{{item.profil}}_db{{item.ID}}
h4(ng-if="item.isEditing") Database: warehost_user{{item.profil}}_db{{item.ID}}
form(name="myform",ng-if="item.isEditing")
.form-group
label(for="password") Password
input.form-control(id="password",name="password",ng-model="item.password",ng-minlength="3")
.form-group
label(for="comment") Comment
input.form-control(id="comment",name="comment",ng-model="item.comment")
button.btn.btn-primary(type="submit",ng-click="edit(item)")
span.glyphicon.glyphicon-floppy-disk
| Save
td(data-title="'Kommentar'") td(data-title="'Kommentar'")
span.glyphicon.glyphicon-lock(ng-if="item.password") span.glyphicon.glyphicon-lock(ng-if="item.password")
span(ng-if="!item.isEditing") {{item.comment}} span(ng-if="!item.isEditing") {{item.comment}}
td(data-title="'Option'") td(data-title="'Option'")
.btn-group.btn-group-xs .btn-group.btn-group-xs
span.btn.btn-default(ng-click="item.isEditing = true",ng-if="!item.isEditing")
span.glyphicon.glyphicon-pencil
span.btn.btn-default(ng-click="edit(item)",ng-if="item.isEditing")
span.glyphicon.glyphicon-remove-circle
span.btn.btn-default(ng-click="delete(item)") span.btn.btn-default(ng-click="delete(item)")
span.glyphicon.glyphicon-trash span.glyphicon.glyphicon-trash

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('warehost') angular.module('warehost')
.controller('DatabaseHostCtrl',function(session,config,alert,NgTableParams,$scope,$http,$stateParams){ .controller('DatabaseHostCtrl',function(session,config,alert,NgTableParams,$scope,$rootScope,$http){
$scope.tableParams = new NgTableParams({ $scope.tableParams = new NgTableParams({
sorting: { 'ID': 'asc' }, sorting: { 'ID': 'asc' },
total: 0, total: 0,
@ -30,5 +30,15 @@ angular.module('warehost')
} }
resetObj(); resetObj();
load(); load();
$rootScope.$on('warehost.session',load);
$scope.edit = function(obj){
$http.patch(config.api+'/host/database/'+obj.ID,obj).then(submitresult);
};
$scope.delete = function(obj){
$http.delete(config.api+'/host/database/'+obj.ID).then(submitresult);
};
$scope.add = function(){
$http.post(config.api+'/host/database',$scope.obj).then(submitresult);
};
}); });

View File

@ -6,6 +6,14 @@
.form-group .form-group
label(for="domain") Domain label(for="domain") Domain
input.form-control(id="domain",name="domain",ng-model="obj.fqdn",ng-minlength="3") input.form-control(id="domain",name="domain",ng-model="obj.fqdn",ng-minlength="3")
.form-group
label
input(type="checkbox",ng-model="obj.web")
| Web
.form-group
label
input(type="checkbox",ng-model="obj.mail")
| Mail
button.btn.btn-primary(type="submit") button.btn.btn-primary(type="submit")
span.glyphicon.glyphicon-floppy-disk span.glyphicon.glyphicon-floppy-disk
| Save | Save
@ -13,15 +21,35 @@
tr(ng-hide='group.$hideRows',ng-repeat="item in $data") tr(ng-hide='group.$hideRows',ng-repeat="item in $data")
td(data-title="'Domain'") td(data-title="'Domain'")
span(ng-if="!item.isEditing") {{item.fqdn}} span(ng-if="!item.isEditing") {{item.fqdn}}
h4(ng-if="item.isEditing") Domain: {{item.fqdn}}
form(name="myform",ng-if="item.isEditing")
.form-group
label(for="domain") Domain
input.form-control(id="domain",name="domain",ng-model="item.fqdn",ng-minlength="3")
.form-group
label
input(type="checkbox",ng-model="item.web")
| Web
.form-group
label
input(type="checkbox",ng-model="item.mail")
| Mail
button.btn.btn-primary(type="submit",ng-click="edit(item)")
span.glyphicon.glyphicon-floppy-disk
| Save
td(data-title="'Funktions'") td(data-title="'Funktions'")
a(ng-if="item.mail") a(ng-if="item.mail && !item.isEditing")
span.glyphicon.glyphicon-envelope(aria-hidden="true") span.glyphicon.glyphicon-envelope(aria-hidden="true")
| Mail | Mail
|   |  
a(ng-if="item.web") a(ng-if="item.web && !item.isEditing")
span.glyphicon.glyphicon-globe(aria-hidden="true") span.glyphicon.glyphicon-globe(aria-hidden="true")
| Web | Web
td(data-title="'Option'") td(data-title="'Option'")
.btn-group.btn-group-xs .btn-group.btn-group-xs
span.btn.btn-default(ng-click="item.isEditing = true",ng-if="!item.isEditing")
span.glyphicon.glyphicon-pencil
span.btn.btn-default(ng-click="edit(item)",ng-if="item.isEditing")
span.glyphicon.glyphicon-remove-circle
span.btn.btn-default(ng-click="delete(item)") span.btn.btn-default(ng-click="delete(item)")
span.glyphicon.glyphicon-trash span.glyphicon.glyphicon-trash

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('warehost') angular.module('warehost')
.controller('DomainHostCtrl',function(session,config,alert,NgTableParams,$scope,$http,$stateParams){ .controller('DomainHostCtrl',function(session,config,alert,NgTableParams,$rootScope,$scope,$http){
$scope.tableParams = new NgTableParams({ $scope.tableParams = new NgTableParams({
sorting: { 'fqdn': 'asc' }, sorting: { 'fqdn': 'asc' },
total: 0, total: 0,
@ -30,5 +30,16 @@ angular.module('warehost')
} }
resetObj(); resetObj();
load(); load();
$rootScope.$on('warehost.session',load);
$scope.edit = function(a){
$http.patch(config.api+'/host/domain/'+a.ID,a).then(submitresult);
};
$scope.delete = function(a){
$http.delete(config.api+'/host/domain/'+a.ID).then(submitresult);
};
$scope.add = function(){
$http.post(config.api+'/host/domain',$scope.obj).then(submitresult);
};
}); });

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('warehost') angular.module('warehost')
.controller('MenuHostCtrl',function(session,config,alert,$scope,$http){ .controller('MenuHostCtrl',function(session,config,alert,$scope,$rootScope,$http){
$scope.profil = {}; $scope.profil = {};
alert.set({}); alert.set({});
function load(){ function load(){
@ -11,5 +11,6 @@ angular.module('warehost')
}); });
} }
load(); load();
$rootScope.$on('warehost.session',load);
}); });

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('warehost') angular.module('warehost')
.controller('InviteCtrl',function(session,config,alert,NgTableParams,$scope,$http){ .controller('InviteCtrl',function(session,config,alert,NgTableParams,$scope,$rootScope,$http){
$scope.tableParams = new NgTableParams({ $scope.tableParams = new NgTableParams({
sorting: { 'invited.username': 'asc' }, sorting: { 'invited.username': 'asc' },
total: 0, total: 0,
@ -39,10 +39,11 @@ angular.module('warehost')
} }
resetObj(); resetObj();
load(); load();
$rootScope.$on('warehost.session',load);
$scope.edit = function(a){ $scope.edit = function(a){
a.invited.password = a.newPassword; a.invited.password = a.newPassword;
$http.put(config.api+'/user/'+a.invited.ID,a.invited).then(submitresult); $http.patch(config.api+'/user/'+a.invited.ID,a.invited).then(submitresult);
}; };
$scope.delete = function(a){ $scope.delete = function(a){
$http.delete(config.api+'/user/'+a.invited.ID).then(submitresult); $http.delete(config.api+'/user/'+a.invited.ID).then(submitresult);
@ -51,6 +52,6 @@ angular.module('warehost')
$http.post(config.api+'/invite',$scope.obj).then(submitresult); $http.post(config.api+'/invite',$scope.obj).then(submitresult);
}; };
$scope.toggleAdmin = function(){ $scope.toggleAdmin = function(){
$http.put(config.api+'/invitor').then(submitresult); $http.patch(config.api+'/invitor').then(submitresult);
}; };
}); });

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('warehost') angular.module('warehost')
.controller('UserCtrl',function(session,config,alert,NgTableParams,$scope,$http){ .controller('UserCtrl',function(session,config,alert,NgTableParams,$scope,$rootScope,$http){
$scope.tableParams = new NgTableParams({ $scope.tableParams = new NgTableParams({
sorting: { 'invited.username': 'asc' }, sorting: { 'invited.username': 'asc' },
total: 0, total: 0,
@ -31,10 +31,11 @@ angular.module('warehost')
} }
resetObj(); resetObj();
load(); load();
$rootScope.$on('warehost.session',load);
$scope.edit = function(a){ $scope.edit = function(a){
a.password = a.newPassword; a.password = a.newPassword;
$http.put(config.api+'/user/'+a.ID,a).then(submitresult); $http.patch(config.api+'/user/'+a.ID,a).then(submitresult);
}; };
$scope.delete = function(a){ $scope.delete = function(a){
$http.delete(config.api+'/user/'+a.ID).then(submitresult); $http.delete(config.api+'/user/'+a.ID).then(submitresult);

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('warehost') angular.module('warehost')
.controller('DomainWebCtrl',function(session,config,alert,NgTableParams,$scope,$http,$stateParams){ .controller('DomainWebCtrl',function(session,config,alert,NgTableParams,$scope,$rootScope,$http,$stateParams){
$scope.tableParams = new NgTableParams({ $scope.tableParams = new NgTableParams({
total: 0, total: 0,
count: config.table.count count: config.table.count
@ -29,6 +29,7 @@ angular.module('warehost')
} }
resetObj(); resetObj();
load(); load();
$rootScope.$on('warehost.session',load);
$scope.delete = function(a){ $scope.delete = function(a){
$http.delete(config.api+'/web/website/'+$stateParams.websiteid+'/domain/'+a.name).then(submitresult); $http.delete(config.api+'/web/website/'+$stateParams.websiteid+'/domain/'+a.name).then(submitresult);

View File

@ -30,10 +30,11 @@ angular.module('warehost')
} }
resetObj(); resetObj();
load(); load();
$rootScope.$on('warehost.session',load);
$rootScope.$on('warehost.web.website.update',load); $rootScope.$on('warehost.web.website.update',load);
$scope.edit = function(a){ $scope.edit = function(a){
$http.put(config.api+'/web/website/'+a.website.ID,a.website).then(submitresult); $http.patch(config.api+'/web/website/'+a.website.ID,a.website).then(submitresult);
}; };
$scope.delete = function(a){ $scope.delete = function(a){
$http.delete(config.api+'/web/website/'+a.website.ID).then(submitresult); $http.delete(config.api+'/web/website/'+a.website.ID).then(submitresult);

View File

@ -19,6 +19,7 @@ angular.module('warehost')
}); });
} }
load(); load();
$rootScope.$on('warehost.session',load);
$rootScope.$on('warehost.web.website.update',load); $rootScope.$on('warehost.web.website.update',load);
$scope.add = function(){ $scope.add = function(){
$http.post(config.api+'/web/website',{name:window.prompt('Name:')}).then(function(res){ $http.post(config.api+'/web/website',{name:window.prompt('Name:')}).then(function(res){

View File

@ -28,6 +28,7 @@ angular.module('warehost')
} }
resetObj(); resetObj();
load(); load();
$rootScope.$on('warehost.session',load);
$scope.edit = function(a){ $scope.edit = function(a){
$scope.obj = a; $scope.obj = a;
@ -37,7 +38,7 @@ angular.module('warehost')
}; };
$scope.save = function(){ $scope.save = function(){
if($scope.obj.ID){ if($scope.obj.ID){
$http.put(config.api+'/web/website/'+$stateParams.websiteid+'/page/'+$scope.obj.ID,$scope.obj).then(submitresult); $http.patch(config.api+'/web/website/'+$stateParams.websiteid+'/page/'+$scope.obj.ID,$scope.obj).then(submitresult);
}else{ }else{
$http.post(config.api+'/web/website/'+$stateParams.websiteid+'/page',$scope.obj).then(submitresult); $http.post(config.api+'/web/website/'+$stateParams.websiteid+'/page',$scope.obj).then(submitresult);
} }

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('warehost') angular.module('warehost')
.controller('PermissionWebCtrl',function(session,config,alert,NgTableParams,$scope,$http,$stateParams){ .controller('PermissionWebCtrl',function(session,config,alert,NgTableParams,$scope,$rootScope,$http,$stateParams){
$scope.tableParams = new NgTableParams({ $scope.tableParams = new NgTableParams({
sorting: { 'login.username': 'asc' }, sorting: { 'login.username': 'asc' },
total: 0, total: 0,
@ -34,6 +34,7 @@ angular.module('warehost')
} }
resetObj(); resetObj();
load(); load();
$rootScope.$on('warehost.session',load);
$scope.delete = function(a){ $scope.delete = function(a){
$http.delete(config.api+'/web/website/'+$stateParams.websiteid+'/permission/'+a.login.ID).then(submitresult); $http.delete(config.api+'/web/website/'+$stateParams.websiteid+'/permission/'+a.login.ID).then(submitresult);

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('warehost') angular.module('warehost')
.controller('WebmenuWebCtrl',function(session,config,alert,$scope,$stateParams,$http){ .controller('WebmenuWebCtrl',function(session,config,alert,$scope,$rootScope,$stateParams,$http){
$scope.data = []; $scope.data = [];
alert.set({}); alert.set({});
@ -23,7 +23,7 @@ angular.module('warehost')
}else{ }else{
$scope.obj.parentid = {Int64: 0, Valid: false}; $scope.obj.parentid = {Int64: 0, Valid: false};
} }
$http.put(config.api+'/web/website/'+$stateParams.websiteid+'/menu/'+$scope.obj.ID,$scope.obj).then(submitresult); $http.patch(config.api+'/web/website/'+$stateParams.websiteid+'/menu/'+$scope.obj.ID,$scope.obj).then(submitresult);
} }
}; };
@ -41,13 +41,14 @@ angular.module('warehost')
} }
} }
load(); load();
$rootScope.$on('warehost.session',load);
$scope.edit = function(a){ $scope.edit = function(a){
$scope.obj = a.$modelValue; $scope.obj = a.$modelValue;
}; };
$scope.save = function(){ $scope.save = function(){
if($scope.obj.ID){ if($scope.obj.ID){
$http.put(config.api+'/web/website/'+$stateParams.websiteid+'/menu/'+$scope.obj.ID,$scope.obj).then(submitresult); $http.patch(config.api+'/web/website/'+$stateParams.websiteid+'/menu/'+$scope.obj.ID,$scope.obj).then(submitresult);
}else{ }else{
$http.post(config.api+'/web/website/'+$stateParams.websiteid+'/menu',$scope.obj).then(submitresult); $http.post(config.api+'/web/website/'+$stateParams.websiteid+'/menu',$scope.obj).then(submitresult);
} }

View File

@ -6,6 +6,10 @@ angular.module('session', [])
return $rootScope.session; return $rootScope.session;
}, },
set: function (res){ set: function (res){
/*
if($rootScope.session != undefined && $rootScope.session.profil == undefined && res.data.session != undefined){
$rootScope.$broadcast('warehost.session');
}*/
$rootScope.session = res.data.session; $rootScope.session = res.data.session;
} }
}; };