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

[host] toggle reseller and list profils

This commit is contained in:
Martin Geno 2016-10-18 21:11:56 +02:00
parent e1139d0fc0
commit 52c93ca76e
6 changed files with 45 additions and 16 deletions

View File

@ -8,11 +8,7 @@ angular.module('warehost')
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);
@ -23,12 +19,9 @@ angular.module('warehost')
session.set(res);
alert.set(res);
if(res.data.data){
resetObj();
$scope.isAdding = false;
load();
}
}
resetObj();
load();
$rootScope.$on('warehost.session',load);

View File

@ -8,11 +8,7 @@ angular.module('warehost')
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);
@ -23,12 +19,9 @@ angular.module('warehost')
session.set(res);
alert.set(res);
if(res.data.data){
resetObj();
$scope.isAdding = false;
load();
}
}
resetObj();
load();
$rootScope.$on('warehost.session',load);

View File

@ -0,0 +1,10 @@
.container
h1 Profiles
table.table.table-bordered(ng-table="tableParams")
tr(ng-hide='group.$hideRows',ng-repeat="item in $data")
td(data-title="'UserID'", filter="{'login.ID': 'text'}") {{item.login.ID}}
td(data-title="'User'", filter="{'login.username': 'text'}") {{item.login.username}}
td(data-title="'ProfilID'", filter="{'ID': 'text'}") {{item.ID}}
td(data-title="'Reseller'", filter="{'reseller': 'components/ngfilter-boolean.html'}")
span.glyphicon.glyphicon-ok(aria-hidden="true",ng-if="item.reseller",ng-click="toggle(item)")
span.glyphicon.glyphicon-lock(aria-hidden="true",ng-if="!item.reseller",ng-click="toggle(item)")

View File

@ -0,0 +1,32 @@
'use strict';
angular.module('warehost')
.controller('ProfilAdminHostCtrl',function(session,config,alert,NgTableParams,$rootScope,$scope,$http){
$scope.tableParams = new NgTableParams({
sorting: { 'fqdn': 'asc' },
total: 0,
count: config.table.count
}, { dataset: [] });
alert.set({});
function load(){
$http.get(config.api+'/host/profils').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){
load();
}
}
load();
$rootScope.$on('warehost.session',load);
$scope.toggle = function(a){
$http.patch(config.api+'/host/profil/'+a.ID,a).then(submitresult);
};
});

View File

@ -60,8 +60,8 @@ angular.module('warehost')
url:'/profil',
views:{
'@app':{
templateUrl: 'app/host/admin/domain.html',
controller:'DomainAdminHostCtrl'
templateUrl: 'app/host/admin/profil.html',
controller:'ProfilAdminHostCtrl'
}
}
})

View File

@ -60,6 +60,7 @@
<!-- injector:js -->
<script src="app/host/admin/database.js"></script>
<script src="app/host/admin/domain.js"></script>
<script src="app/host/admin/profil.js"></script>
<script src="app/host/database.js"></script>
<script src="app/host/domain.js"></script>
<script src="app/host/index.js"></script>