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

[host] add web and mail

This commit is contained in:
Martin Geno 2016-10-22 21:34:20 +02:00
parent 52c93ca76e
commit 822e7fe3fe
10 changed files with 261 additions and 8 deletions

View File

@ -1,5 +1,5 @@
.navbar-brand .navbar-brand
padding 13.5px 15px 12.5px padding 4.5px 15px 2.5px
> img > img
display inline display inline

View File

@ -29,11 +29,10 @@
span.glyphicon.glyphicon-ok(aria-hidden="true",ng-if="item.active") span.glyphicon.glyphicon-ok(aria-hidden="true",ng-if="item.active")
span.glyphicon.glyphicon-lock(aria-hidden="true",ng-if="!item.active") span.glyphicon.glyphicon-lock(aria-hidden="true",ng-if="!item.active")
td(data-title="'Funktions'") td(data-title="'Funktions'")
a(ng-if="item.mail && !item.isEditing && item.active") a(ng-if="item.mail && !item.isEditing && item.active",ui-sref="app.host.mail({domainid:item.ID})")
span.glyphicon.glyphicon-envelope(aria-hidden="true") span.glyphicon.glyphicon-envelope(aria-hidden="true")
| Mail | Mail
|   a(ng-if="item.web && !item.isEditing && item.active",ui-sref="app.host.web({domainid:item.ID})")
a(ng-if="item.web && !item.isEditing && item.active")
span.glyphicon.glyphicon-globe(aria-hidden="true") span.glyphicon.glyphicon-globe(aria-hidden="true")
| Web | Web
td(data-title="'Option'") td(data-title="'Option'")

View File

@ -49,11 +49,10 @@
span.glyphicon.glyphicon-ok(aria-hidden="true",ng-if="item.active") span.glyphicon.glyphicon-ok(aria-hidden="true",ng-if="item.active")
span.glyphicon.glyphicon-lock(aria-hidden="true",ng-if="!item.active") span.glyphicon.glyphicon-lock(aria-hidden="true",ng-if="!item.active")
td(data-title="'Funktions'") td(data-title="'Funktions'")
a(ng-if="item.mail && !item.isEditing && item.active") a(ng-if="item.mail && !item.isEditing && item.active",ui-sref="app.host.mail({domainid:item.ID})")
span.glyphicon.glyphicon-envelope(aria-hidden="true") span.glyphicon.glyphicon-envelope(aria-hidden="true")
| Mail | Mail
|   a(ng-if="item.web && !item.isEditing && item.active",ui-sref="app.host.web({domainid:item.ID})")
a(ng-if="item.web && !item.isEditing && item.active")
span.glyphicon.glyphicon-globe(aria-hidden="true") span.glyphicon.glyphicon-globe(aria-hidden="true")
| Web | Web
td(data-title="'Option'") td(data-title="'Option'")

View File

@ -39,6 +39,24 @@ angular.module('warehost')
} }
} }
}) })
.state('app.host.web', {
url:'/domain/:domainid/web',
views:{
'@app':{
templateUrl: 'app/host/web.html',
controller:'WebDomainHostCtrl'
}
}
})
.state('app.host.mail', {
url:'/domain/:domainid/mail',
views:{
'@app':{
templateUrl: 'app/host/mail.html',
controller:'MailDomainHostCtrl'
}
}
})
.state('app.host.database', { .state('app.host.database', {
url:'/database', url:'/database',
views:{ views:{

47
public/app/host/mail.jade Normal file
View File

@ -0,0 +1,47 @@
.container
h1 Mail
a.btn.btn-default(ng-click="isAdding=true")
span.glyphicon.glyphicon-plus
form.well(ng-submit="add()",name="addform",ng-if="isAdding")
.form-group
label(for="name") Name
.input-group
input.form-control(id="name",name="name",ng-model="obj.name")
span.input-group-addon @{{domain.fqdn}}
.form-group
ui-select(ng-model="obj.login",theme="bootstrap")
ui-select-match {{$select.selected.username}}
ui-select-choices(repeat="item in loginlist | filter: $select.search")
div(ng-bind-html="item.username | highlight: $select.search")
button.btn.btn-primary(type="submit")
span.glyphicon.glyphicon-floppy-disk
| Save
table.table.table-bordered(ng-table="tableParams")
tr(ng-hide='group.$hideRows',ng-repeat="item in $data")
td(data-title="'Mail-Adresse'")
span(ng-if="!item.isEditing") {{item.name}}@{{item.domain.fqdn}}
h4(ng-if="item.isEditing") {{item.name}}@{{item.domain.fqdn}}
form(name="myform",ng-if="item.isEditing")
.form-group
label(for="name") Name
.input-group
input.form-control(id="name",name="name",ng-model="item.name")
span.input-group-addon @{{item.domain.fqdn}}
.form-group
ui-select(ng-model="item.login",theme="bootstrap")
ui-select-match {{$select.selected.username}}
ui-select-choices(repeat="i in loginlist | filter: $select.search")
div(ng-bind-html="i.username | highlight: $select.search")
button.btn.btn-primary(type="submit",ng-click="edit(item)")
span.glyphicon.glyphicon-floppy-disk
| Save
td(data-title="'Postfach'")
span(ng-repeat="i in loginlist",ng-if="i.ID == item.login.Int64") {{i.username}}
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

53
public/app/host/mail.js Normal file
View File

@ -0,0 +1,53 @@
'use strict';
angular.module('warehost')
.controller('MailDomainHostCtrl',function(session,config,alert,NgTableParams,$rootScope,$scope,$http,$stateParams){
$scope.tableParams = new NgTableParams({
sorting: { 'name': 'asc' },
total: 0,
count: config.table.count
}, { dataset: [] });
alert.set({});
$scope.obj = {};
$scope.domain = {};
$scope.loginlist = [];
function resetObj(){
$scope.obj = {};
}
function load(){
$http.get(config.api+'/user').then(function(res){
$scope.loginlist = res.data.data;
$http.get(config.api+'/host/domain/'+$stateParams.domainid).then(function(res){
$scope.domain = res.data.data;
$http.get(config.api+'/host/domain/'+$stateParams.domainid+'/mail').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/'+$stateParams.domainid+'/mail/'+a.ID,a).then(submitresult);
};
$scope.delete = function(a){
$http.delete(config.api+'/host/domain/'+$stateParams.domainid+'/mail/'+a.ID).then(submitresult);
};
$scope.add = function(){
$http.post(config.api+'/host/domain/'+$stateParams.domainid+'/mail',$scope.obj).then(submitresult);
};
});

79
public/app/host/web.jade Normal file
View File

@ -0,0 +1,79 @@
.container
h1 Web
a.btn.btn-default(ng-click="isAdding=true")
span.glyphicon.glyphicon-plus
form.well(ng-submit="add()",name="addform",ng-if="isAdding")
.form-group
label(for="subdomain") Subdomain
.input-group
input.form-control(id="subdomain",name="subdomain",ng-model="obj.subdomain")
span.input-group-addon .{{domain.fqdn}}
.form-group
label
input(type="checkbox",ng-model="obj.php")
| PHP
.form-group
label
input(type="checkbox",ng-model="obj.ssl")
| SSL
.form-group
label
input(type="checkbox",ng-model="obj.sslredirect")
| SSL-Redirect
.form-group
label(for="redirect") Redirect
input.form-control(id="redirect",name="redirect",ng-model="obj.redirect")
.form-group
label(for="proxy") Proxy
input.form-control(id="proxy",name="proxy",ng-model="obj.proxy")
button.btn.btn-primary(type="submit")
span.glyphicon.glyphicon-floppy-disk
| Save
table.table.table-bordered(ng-table="tableParams")
tr(ng-hide='group.$hideRows',ng-repeat="item in $data")
td(data-title="'Domain'")
span(ng-if="!item.isEditing")
span(ng-if="item.subdomain != ''") {{item.subdomain}}.
| {{item.domain.fqdn}}
h4(ng-if="item.isEditing") {{item.subdomain}}.{{item.domain.fqdn}}
form(name="myform",ng-if="item.isEditing")
.form-group
label(for="subdomain") Subdomain
.input-group
input.form-control(id="subdomain",name="subdomain",ng-model="item.subdomain")
span.input-group-addon .{{item.domain.fqdn}}
.form-group
label
input(type="checkbox",ng-model="item.php")
| PHP
.form-group
label
input(type="checkbox",ng-model="item.ssl")
| SSL
.form-group
label
input(type="checkbox",ng-model="item.sslredirect")
| SSL-Redirect
.form-group
label(for="redirect") Redirect
input.form-control(id="redirect",name="redirect",ng-model="item.redirect")
.form-group
label(for="proxy") Proxy
input.form-control(id="proxy",name="proxy",ng-model="item.proxy")
button.btn.btn-primary(type="submit",ng-click="edit(item)")
span.glyphicon.glyphicon-floppy-disk
| Save
td(data-title="'Options'")
span.glyphicon.glyphicon-cd(ng-if="item.php")
span.glyphicon.glyphicon-lock(ng-if="item.ssl")
span.glyphicon.glyphicon-share(ng-if="item.sslredirect")
span.glyphicon.glyphicon-share-alt(ng-if="item.redirect")
span.glyphicon.glyphicon-send(ng-if="item.proxy")
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

49
public/app/host/web.js Normal file
View File

@ -0,0 +1,49 @@
'use strict';
angular.module('warehost')
.controller('WebDomainHostCtrl',function(session,config,alert,NgTableParams,$rootScope,$scope,$http,$stateParams){
$scope.tableParams = new NgTableParams({
sorting: { 'subdomain': 'asc' },
total: 0,
count: config.table.count
}, { dataset: [] });
alert.set({});
$scope.obj = {};
$scope.domain = {};
function resetObj(){
$scope.obj = {};
}
function load(){
$http.get(config.api+'/host/domain/'+$stateParams.domainid).then(function(res){
$scope.domain = res.data.data;
$http.get(config.api+'/host/domain/'+$stateParams.domainid+'/web').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/'+$stateParams.domainid+'/web/'+a.ID,a).then(submitresult);
};
$scope.delete = function(a){
$http.delete(config.api+'/host/domain/'+$stateParams.domainid+'/web/'+a.ID).then(submitresult);
};
$scope.add = function(){
$http.post(config.api+'/host/domain/'+$stateParams.domainid+'/web',$scope.obj).then(submitresult);
};
});

View File

@ -31,10 +31,17 @@
.form-group(ng-class="{'has-error': (item.newPassword != item.repeatPassword && myform.repeatPassword.$dirty)}") .form-group(ng-class="{'has-error': (item.newPassword != item.repeatPassword && myform.repeatPassword.$dirty)}")
label(for="repeatPassword") Again Password label(for="repeatPassword") Again Password
input.form-control(id="repeatPassword",type="password",name="repeatPassword",ng-model="item.repeatPassword") input.form-control(id="repeatPassword",type="password",name="repeatPassword",ng-model="item.repeatPassword")
.form-group
label
input(type="checkbox",ng-model="item.active")
| Active
.form-group .form-group
label label
input(type="checkbox",ng-model="item.superadmin") input(type="checkbox",ng-model="item.superadmin")
| Administrator | Administrator
td(data-title="'Active'", filter="{'active': 'components/ngfilter-boolean.html'}")
span.glyphicon.glyphicon-ok(ng-if="item.active")
span.glyphicon.glyphicon-remove(ng-if="!item.active")
td(data-title="'Administrator'", filter="{'superadmin': 'components/ngfilter-boolean.html'}") td(data-title="'Administrator'", filter="{'superadmin': 'components/ngfilter-boolean.html'}")
span.glyphicon.glyphicon-ok(ng-if="item.superadmin") span.glyphicon.glyphicon-ok(ng-if="item.superadmin")
span.glyphicon.glyphicon-remove(ng-if="!item.superadmin") span.glyphicon.glyphicon-remove(ng-if="!item.superadmin")

View File

@ -22,7 +22,7 @@
<link rel="stylesheet" href="bower_components/angular-markdown-editor-ghiscoding/styles/angular-markdown-editor.css" /> <link rel="stylesheet" href="bower_components/angular-markdown-editor-ghiscoding/styles/angular-markdown-editor.css" />
<!-- endbower --> <!-- endbower -->
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css" /> <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="bower_components/bootswatch/paper/bootstrap.min.css" /> <link rel="stylesheet" href="bower_components/bootswatch/simplex/bootstrap.min.css" />
<!-- endbuild --> <!-- endbuild -->
<!-- build:css({.tmp,public}) app/app.css --> <!-- build:css({.tmp,public}) app/app.css -->
<link rel="stylesheet" href="app/app.css"> <link rel="stylesheet" href="app/app.css">
@ -64,7 +64,9 @@
<script src="app/host/database.js"></script> <script src="app/host/database.js"></script>
<script src="app/host/domain.js"></script> <script src="app/host/domain.js"></script>
<script src="app/host/index.js"></script> <script src="app/host/index.js"></script>
<script src="app/host/mail.js"></script>
<script src="app/host/menu.js"></script> <script src="app/host/menu.js"></script>
<script src="app/host/web.js"></script>
<script src="app/index.js"></script> <script src="app/index.js"></script>
<script src="app/invite.js"></script> <script src="app/invite.js"></script>
<script src="app/main.js"></script> <script src="app/main.js"></script>