From 538d209f912c46d062b10f39bf7da38a11b455c3 Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Mon, 17 Oct 2016 12:50:31 +0200 Subject: [PATCH] [host] starting developing --- public/app/host/database.jade | 22 ++++++++++++++++++++++ public/app/host/database.js | 34 ++++++++++++++++++++++++++++++++++ public/app/host/domain.jade | 27 +++++++++++++++++++++++++++ public/app/host/domain.js | 34 ++++++++++++++++++++++++++++++++++ public/app/host/index.js | 31 ++++++++++++++++++++++++++++++- public/app/host/menu.jade | 6 ++++++ public/app/host/menu.js | 15 +++++++++++++++ public/app/web/domain.js | 1 - public/app/web/list.js | 2 +- public/app/web/permission.js | 2 +- public/index.html | 3 +++ 11 files changed, 173 insertions(+), 4 deletions(-) create mode 100644 public/app/host/database.jade create mode 100644 public/app/host/database.js create mode 100644 public/app/host/domain.jade create mode 100644 public/app/host/domain.js create mode 100644 public/app/host/menu.js diff --git a/public/app/host/database.jade b/public/app/host/database.jade new file mode 100644 index 0000000..bbfedbc --- /dev/null +++ b/public/app/host/database.jade @@ -0,0 +1,22 @@ +.container + h1 Database + 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="domain") Domain + input.form-control(id="domain",name="domain",ng-model="obj.domain",ng-minlength="3") + 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="'Database/User'") + span(ng-if="!item.isEditing") warehost_user{{item.profil}}_db{{item.ID}} + 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="delete(item)") + span.glyphicon.glyphicon-trash diff --git a/public/app/host/database.js b/public/app/host/database.js new file mode 100644 index 0000000..2559453 --- /dev/null +++ b/public/app/host/database.js @@ -0,0 +1,34 @@ +'use strict'; + +angular.module('warehost') + .controller('DatabaseHostCtrl',function(session,config,alert,NgTableParams,$scope,$http,$stateParams){ + $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').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(); + + }); diff --git a/public/app/host/domain.jade b/public/app/host/domain.jade new file mode 100644 index 0000000..fecf50b --- /dev/null +++ b/public/app/host/domain.jade @@ -0,0 +1,27 @@ +.container + h1 Domains + 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="domain") Domain + input.form-control(id="domain",name="domain",ng-model="obj.fqdn",ng-minlength="3") + 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") {{item.fqdn}} + td(data-title="'Funktions'") + a(ng-if="item.mail") + span.glyphicon.glyphicon-envelope(aria-hidden="true") + | Mail + |   + a(ng-if="item.web") + span.glyphicon.glyphicon-globe(aria-hidden="true") + | Web + td(data-title="'Option'") + .btn-group.btn-group-xs + span.btn.btn-default(ng-click="delete(item)") + span.glyphicon.glyphicon-trash diff --git a/public/app/host/domain.js b/public/app/host/domain.js new file mode 100644 index 0000000..9bac7ad --- /dev/null +++ b/public/app/host/domain.js @@ -0,0 +1,34 @@ +'use strict'; + +angular.module('warehost') + .controller('DomainHostCtrl',function(session,config,alert,NgTableParams,$scope,$http,$stateParams){ + $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').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(); + + }); diff --git a/public/app/host/index.js b/public/app/host/index.js index 5deb3ff..8fcef75 100644 --- a/public/app/host/index.js +++ b/public/app/host/index.js @@ -5,7 +5,7 @@ angular.module('warehost') .state('app.host', { url:'/host', views:{ - 'menu':{templateUrl:'app/host/menu.html'} + 'menu':{templateUrl:'app/host/menu.html',controller:'MenuHostCtrl'} } }) .state('app.host.index', { @@ -18,5 +18,34 @@ angular.module('warehost') } } } + }) + .state('app.host.signup', { + url:'/', + views:{ + '@app':{ + templateUrl: 'app/home.html', + controller:function(alert){ + alert.set({}); + } + } + } + }) + .state('app.host.domain', { + url:'/domain', + views:{ + '@app':{ + templateUrl: 'app/host/domain.html', + controller:'DomainHostCtrl' + } + } + }) + .state('app.host.database', { + url:'/database', + views:{ + '@app':{ + templateUrl: 'app/host/database.html', + controller:'DatabaseHostCtrl' + } + } }); }]); diff --git a/public/app/host/menu.jade b/public/app/host/menu.jade index d6f94fe..ff15e1c 100644 --- a/public/app/host/menu.jade +++ b/public/app/host/menu.jade @@ -1,3 +1,9 @@ .navbar-text Hosting li a(ui-sref="app.host.index",ui-sref-active="active") Home +li(ng-if='!profil.ID') + a(ui-sref="app.host.signup",ui-sref-active="active") Signup +li(ng-if='profil.ID') + a(ui-sref="app.host.domain",ui-sref-active="active") Domains +li(ng-if='profil.ID') + a(ui-sref="app.host.database",ui-sref-active="active") Databases diff --git a/public/app/host/menu.js b/public/app/host/menu.js new file mode 100644 index 0000000..54f95cf --- /dev/null +++ b/public/app/host/menu.js @@ -0,0 +1,15 @@ +'use strict'; + +angular.module('warehost') + .controller('MenuHostCtrl',function(session,config,alert,$scope,$http){ + $scope.profil = {}; + alert.set({}); + function load(){ + $http.get(config.api+'/host/profil').then(function(res){ + session.set(res); + $scope.profil = res.data.data; + }); + } + load(); + + }); diff --git a/public/app/web/domain.js b/public/app/web/domain.js index 759418e..8fa8007 100644 --- a/public/app/web/domain.js +++ b/public/app/web/domain.js @@ -3,7 +3,6 @@ angular.module('warehost') .controller('DomainWebCtrl',function(session,config,alert,NgTableParams,$scope,$http,$stateParams){ $scope.tableParams = new NgTableParams({ - sorting: { 'invited.username': 'asc' }, total: 0, count: config.table.count }, { dataset: [] }); diff --git a/public/app/web/list.js b/public/app/web/list.js index 41da1d6..6cf0475 100644 --- a/public/app/web/list.js +++ b/public/app/web/list.js @@ -3,7 +3,7 @@ angular.module('warehost') .controller('ListWebCtrl',function(session,config,alert,NgTableParams,$scope,$rootScope,$http){ $scope.tableParams = new NgTableParams({ - sorting: { 'invited.username': 'asc' }, + sorting: { 'website.name': 'asc' }, total: 0, count: config.table.count }, { dataset: [] }); diff --git a/public/app/web/permission.js b/public/app/web/permission.js index b8ffdbd..270c9d7 100644 --- a/public/app/web/permission.js +++ b/public/app/web/permission.js @@ -3,7 +3,7 @@ angular.module('warehost') .controller('PermissionWebCtrl',function(session,config,alert,NgTableParams,$scope,$http,$stateParams){ $scope.tableParams = new NgTableParams({ - sorting: { 'invited.username': 'asc' }, + sorting: { 'login.username': 'asc' }, total: 0, count: config.table.count }, { dataset: [] }); diff --git a/public/index.html b/public/index.html index 3b75687..baeb535 100644 --- a/public/index.html +++ b/public/index.html @@ -58,7 +58,10 @@ + + +