Table first draft

This commit is contained in:
Frédéric Vachon 2015-01-20 14:29:10 -05:00
parent e1de293602
commit 3186a97f01
9 changed files with 28 additions and 33 deletions

View File

@ -1,16 +1,13 @@
'use strict';
angular.module('adagios.live.getservices', [])
angular.module('adagios.live')
.factory('GetServices', ['$http', function ($http) {
alert('Salut');
$http.post("/rest/status/json/services/").
success(function(data, status, headers, config) {
alert(data);
}).
error(function(data, status, headers, config) {
alert('Request error');
});
.factory('GetServices', ['$http', function ($http, columns) {
return data;
return function (columns) {
return $http.get('/rest/status/json/services/?fields=' + columns)
.error(function (data, status, headers, config) {
console.error('GetServices : GET Request failed');
});
};
}]);

View File

@ -0,0 +1,3 @@
'use strict';
angular.module('adagios.live', []);

View File

@ -1,19 +1,9 @@
'use strict';
angular.module('adagios.live', [])
angular.module('adagios.live')
.factory('GetProblems', ['$http', function ($http) {
var problem_number = 44;
return problem_number;
}])
.factory('GetServices', ['$http', function ($http) {
$http.post("/rest/status/json/services", "host_name")
.success(function(data, status, headers, config) {
return data;
})
.error(function(data, status, headers, config) {
alert('request error');
});
}]);

View File

@ -22,7 +22,9 @@
<!-- Application -->
<script src="app.js"></script>
<!-- COMPONENTS -->
<script src="components/live/live.js"></script>
<script src="components/live/notifications.js"></script>
<script src="components/live/get_services.js"></script>
<script src="components/ng-justgage/ng-justgage.js"></script>
<!-- MODULES -->
<!-- Sidebar -->>

View File

@ -7,7 +7,7 @@ angular.module('adagios.table.entry', ['adagios.table.entry.column_duration',
])
.controller('EntryCtrl', ['$scope', '$http', function ($scope, $http) {
noop;
return;
}])
.directive('entry', function () {

View File

@ -1,15 +1,15 @@
<div ng-app="adagios.table" ng-controller="TableCtrl" id="table">
<table>
<table class="table">
<thead>
<tr>
<th ng-repeat="(key, value) in entries[0]">
<cell cell_type="header" > {{key}} </cell>
{{key}}
</th>
</tr>
</thead>
<tr ng-repeat="entry in entries">
<td ng-repeat="(key, value) in entry">
<cell cell_type="{{key}}" > {{value}} </cell>
{{value}}
</td>
</tr>
</table>

View File

@ -3,14 +3,15 @@
angular.module('adagios.table', ['ngRoute', 'adagios.table.entry', 'adagios.live'])
.controller('TableCtrl', ['$scope', '$http', 'GetServices', function ($scope, $http, GetServices) {
$scope.entries = GetServices;
console.log(new GetServices(['host_name', 'last_check'])
.success(function (data) {
$scope.entries = data;
}));
}])
.directive('servicetable', function () {
.directive('servicesTable', function () {
return {
restrict: 'E',
templateUrl: "table/table.html"
};
});

View File

@ -19,6 +19,6 @@
</div>
<servicetable></servicetable>
<services-table></services-table>
</div>

View File

@ -9,10 +9,12 @@ module.exports = function (config) {
'app/bower_components/angular/angular.js',
'app/bower_components/angular-route/angular-route.js',
'app/bower_components/angular-mocks/angular-mocks.js',
'app/components/live/live.js',
'app/components/**/*.js',
'app/navbar/**/*.js',
'app/topbar/**/*.js',
'app/sidebar/**/*.js',
'app/tactical/**/*.js'
'app/tactical/**/*.js',
'app/table/**/*.js'
],
autoWatch : true,