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

[host] make domain and database admin accessable

This commit is contained in:
Martin Geno 2016-10-18 20:33:55 +02:00
parent bd2f5b6698
commit e1139d0fc0
11 changed files with 258 additions and 36 deletions

View File

@ -0,0 +1,29 @@
.container
h1 Database
table.table.table-bordered(ng-table="tableParams")
tr(ng-hide='group.$hideRows',ng-repeat="item in $data")
td(data-title="'User'", filter="{'profil.login.username': 'text'}") {{item.profil.login.username}}
td(data-title="'Database/User'")
span(ng-if="!item.isEditing") warehost_user{{item.profil.ID}}_db{{item.ID}}
h4(ng-if="item.isEditing") Database: warehost_user{{item.profil.ID}}_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'")
span.glyphicon.glyphicon-lock(ng-if="item.password")
span(ng-if="!item.isEditing") {{item.comment}}
td(data-title="'Option'")
.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.glyphicon.glyphicon-trash

View File

@ -0,0 +1,41 @@
'use strict';
angular.module('warehost')
.controller('DatabaseAdminHostCtrl',function(session,config,alert,NgTableParams,$scope,$rootScope,$http){
$scope.tableParams = new NgTableParams({
sorting: { 'ID': 'asc' },
total: 0,
count: config.table.count
}, { dataset: [] });
alert.set({});
$scope.obj = {};
function resetObj(){
$scope.obj = {};
}
function load(){
$http.get(config.api+'/host/database?filter=all').then(function(res){
session.set(res);
$scope.tableParams.settings({dataset: angular.copy(res.data.data),total: (res.data.data).length});
});
}
function submitresult(res){
session.set(res);
alert.set(res);
if(res.data.data){
resetObj();
$scope.isAdding = false;
load();
}
}
resetObj();
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);
};
});

View File

@ -0,0 +1,46 @@
.container
h1 Domains
table.table.table-bordered(ng-table="tableParams")
tr(ng-hide='group.$hideRows',ng-repeat="item in $data")
td(data-title="'User'", filter="{'profil.login.username': 'text'}") {{item.profil.login.username}}
td(data-title="'Domain'", filter="{'fqdn': 'text'}")
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.active")
| Active
.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="'Active'", filter="{'active': 'components/ngfilter-boolean.html'}")
span.glyphicon.glyphicon-ok(aria-hidden="true",ng-if="item.active")
span.glyphicon.glyphicon-lock(aria-hidden="true",ng-if="!item.active")
td(data-title="'Funktions'")
a(ng-if="item.mail && !item.isEditing && item.active")
span.glyphicon.glyphicon-envelope(aria-hidden="true")
| Mail
|  
a(ng-if="item.web && !item.isEditing && item.active")
span.glyphicon.glyphicon-globe(aria-hidden="true")
| Web
td(data-title="'Option'")
.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.glyphicon.glyphicon-trash

View File

@ -0,0 +1,42 @@
'use strict';
angular.module('warehost')
.controller('DomainAdminHostCtrl',function(session,config,alert,NgTableParams,$rootScope,$scope,$http){
$scope.tableParams = new NgTableParams({
sorting: { 'fqdn': 'asc' },
total: 0,
count: config.table.count
}, { dataset: [] });
alert.set({});
$scope.obj = {};
function resetObj(){
$scope.obj = {};
}
function load(){
$http.get(config.api+'/host/domain?filter=all').then(function(res){
session.set(res);
$scope.tableParams.settings({dataset: angular.copy(res.data.data),total: (res.data.data).length});
});
}
function submitresult(res){
session.set(res);
alert.set(res);
if(res.data.data){
resetObj();
$scope.isAdding = false;
load();
}
}
resetObj();
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);
};
});

View File

@ -15,8 +15,8 @@
table.table.table-bordered(ng-table="tableParams")
tr(ng-hide='group.$hideRows',ng-repeat="item in $data")
td(data-title="'Database/User'")
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}}
span(ng-if="!item.isEditing") warehost_user{{item.profil.ID}}_db{{item.ID}}
h4(ng-if="item.isEditing") Database: warehost_user{{item.profil.ID}}_db{{item.ID}}
form(name="myform",ng-if="item.isEditing")
.form-group
label(for="password") Password

View File

@ -6,6 +6,10 @@
.form-group
label(for="domain") Domain
input.form-control(id="domain",name="domain",ng-model="obj.fqdn",ng-minlength="3")
.form-group(ng-if="session.login.superadmin")
label
input(type="checkbox",ng-model="obj.active")
| Active
.form-group
label
input(type="checkbox",ng-model="obj.web")
@ -19,13 +23,17 @@
| Save
table.table.table-bordered(ng-table="tableParams")
tr(ng-hide='group.$hideRows',ng-repeat="item in $data")
td(data-title="'Domain'")
td(data-title="'Domain'", filter="{'fqdn': 'text'}")
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(ng-if="session.login.superadmin")
label
input(type="checkbox",ng-model="item.active")
| Active
.form-group
label
input(type="checkbox",ng-model="item.web")
@ -37,12 +45,15 @@
button.btn.btn-primary(type="submit",ng-click="edit(item)")
span.glyphicon.glyphicon-floppy-disk
| Save
td(data-title="'Active'", filter="{'active': 'components/ngfilter-boolean.html'}")
span.glyphicon.glyphicon-ok(aria-hidden="true",ng-if="item.active")
span.glyphicon.glyphicon-lock(aria-hidden="true",ng-if="!item.active")
td(data-title="'Funktions'")
a(ng-if="item.mail && !item.isEditing")
a(ng-if="item.mail && !item.isEditing && item.active")
span.glyphicon.glyphicon-envelope(aria-hidden="true")
| Mail
|  
a(ng-if="item.web && !item.isEditing")
a(ng-if="item.web && !item.isEditing && item.active")
span.glyphicon.glyphicon-globe(aria-hidden="true")
| Web
td(data-title="'Option'")

View File

@ -1,4 +1,4 @@
'use strict';
'use strict';
angular.module('warehost')
.config(['$stateProvider',function ($stateProvider) {
$stateProvider
@ -47,5 +47,40 @@ angular.module('warehost')
controller:'DatabaseHostCtrl'
}
}
})
.state('app.host.A', {
url:'/admin',
views:{
'@app':{
templateUrl: 'app/admin.html',
}
}
})
.state('app.host.A.profil', {
url:'/profil',
views:{
'@app':{
templateUrl: 'app/host/admin/domain.html',
controller:'DomainAdminHostCtrl'
}
}
})
.state('app.host.A.domain', {
url:'/domain',
views:{
'@app':{
templateUrl: 'app/host/admin/domain.html',
controller:'DomainAdminHostCtrl'
}
}
})
.state('app.host.A.database', {
url:'/database',
views:{
'@app':{
templateUrl: 'app/host/admin/database.html',
controller:'DatabaseAdminHostCtrl'
}
}
});
}]);

View File

@ -1,9 +1,24 @@
.navbar-text Hosting
li
ui.nav.navbar-nav
.navbar-text Hosting
li
a(ui-sref="app.host.index",ui-sref-active="active") Home
li(ng-if='!profil.ID')
li(ng-if='!profil.ID')
a(ui-sref="app.host.signup",ui-sref-active="active") Signup
li(ng-if='profil.ID')
li(ng-if='profil.ID')
a(ui-sref="app.host.domain",ui-sref-active="active") Domains
li(ng-if='profil.ID')
li(ng-if='profil.ID')
a(ui-sref="app.host.database",ui-sref-active="active") Databases
ui.nav.navbar-nav.navbar-right
li.dropdown(ng-if="session.login.superadmin")
a.dropdown-toggle(data-toggle="dropdown",role="button",aria-haspopup="true",aria-expanded="false")
span.glyphicon.glyphicon-console
| Admin
span.caret
ul.dropdown-menu
li
a(ui-sref="app.host.A.profil") Profiles
li
a(ui-sref="app.host.A.domain") Domains
li
a(ui-sref="app.host.A.database") Databases

View File

@ -10,7 +10,6 @@
span.icon-bar
span.icon-bar
.navbar-collapse.collapse(uib-collapse="!isOpen")
ui.nav.navbar-nav(ui-view="menu")
ui.nav.navbar-nav.navbar-right(ng-if="session.login.active")
li.dropdown(ng-if="modules.length>0")
a.dropdown-toggle(data-toggle="dropdown",role="button",aria-haspopup="true",aria-expanded="false")
@ -55,6 +54,7 @@
.input-group-btn
button.btn.btn-default(type="submit")
span.glyphicon.glyphicon-log-in
div(ui-view="menu")
div(style="margin-top:53px;")
.container(ng-if="error.msg")
.alert.alert-danger(style="margin-top:20px;") {{error.msg}}

View File

@ -1,5 +1,6 @@
.navbar-text Website
li.dropdown
ui.nav.navbar-nav
.navbar-text Website
li.dropdown
a.dropdown-toggle(data-toggle="dropdown",role="button",aria-haspopup="true",aria-expanded="false") {{website.name||'Websites'}}
span.caret
ul.dropdown-menu
@ -10,11 +11,11 @@ li.dropdown
li.dropdown-header Websites:
li(ng-repeat="item in list")
a(ui-sref="app.webS.page({websiteid:item.website.ID})") {{item.website.name}}
li(ng-if="website.name")
li(ng-if="website.name")
a(ui-sref="app.webS.menu({websiteid:website.ID})") Menu
li(ng-if="website.name")
li(ng-if="website.name")
a(ui-sref="app.webS.page({websiteid:website.ID})") Pages
li(ng-if="website.name")
li(ng-if="website.name")
a(ui-sref="app.webS.domain({websiteid:website.ID})") Domains
li(ng-if="website.name")
li(ng-if="website.name")
a(ui-sref="app.webS.permission({websiteid:website.ID})") Permissions

View File

@ -58,6 +58,8 @@
<!-- build:js({.tmp,public}) app/app.js -->
<script src="app/app.js"></script>
<!-- injector:js -->
<script src="app/host/admin/database.js"></script>
<script src="app/host/admin/domain.js"></script>
<script src="app/host/database.js"></script>
<script src="app/host/domain.js"></script>
<script src="app/host/index.js"></script>