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

View File

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

View File

@ -1,19 +1,9 @@
'use strict'; 'use strict';
angular.module('adagios.live', []) angular.module('adagios.live')
.factory('GetProblems', ['$http', function ($http) { .factory('GetProblems', ['$http', function ($http) {
var problem_number = 44; var problem_number = 44;
return problem_number; 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 --> <!-- Application -->
<script src="app.js"></script> <script src="app.js"></script>
<!-- COMPONENTS --> <!-- COMPONENTS -->
<script src="components/live/live.js"></script>
<script src="components/live/notifications.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> <script src="components/ng-justgage/ng-justgage.js"></script>
<!-- MODULES --> <!-- MODULES -->
<!-- Sidebar -->> <!-- Sidebar -->>

View File

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

View File

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

View File

@ -3,14 +3,15 @@
angular.module('adagios.table', ['ngRoute', 'adagios.table.entry', 'adagios.live']) angular.module('adagios.table', ['ngRoute', 'adagios.table.entry', 'adagios.live'])
.controller('TableCtrl', ['$scope', '$http', 'GetServices', function ($scope, $http, GetServices) { .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 { return {
restrict: 'E', restrict: 'E',
templateUrl: "table/table.html" templateUrl: "table/table.html"
}; };
}); });

View File

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

View File

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