Skip to content

Commit

Permalink
Merge pull request #312 from ar4s/fix/gui
Browse files Browse the repository at this point in the history
Fix/gui
  • Loading branch information
mkurek committed Oct 17, 2014
2 parents 0e2a4c4 + 455e00a commit 5f5c11b
Show file tree
Hide file tree
Showing 39 changed files with 4,772 additions and 1,284 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
'python-ceilometerclient>=1.0.10',
'python-novaclient==2.17.0',
'django-simple-history',
'djangorestframework==2.4.3',
],
entry_points={
'django.pluggable_app': [
Expand Down
20 changes: 12 additions & 8 deletions src/ralph_scrooge/fixtures/initial_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,34 +41,38 @@
pk: 1
fields:
name: 'Asset'
color: '#428bca'
color: '#ff5722'
icon_class: 'fa-desktop'

- model: ralph_scrooge.PricingObjectType
pk: 2
fields:
name: 'Virtual'
color: '#f68c1f'
color: '#259b24'
icon_class: 'fa-cubes'

- model: ralph_scrooge.PricingObjectType
pk: 3
fields:
name: 'IP Address'
color: '#25963e'
name: 'OpenStack Tenant'
color: '#009688'
icon_class: 'fa-cloud-upload'

- model: ralph_scrooge.PricingObjectType
pk: 4
fields:
name: 'OpenStack Tenant'
color: '#35468b'
name: 'IP Address'
color: '#03a9f4'
icon_class: 'fa-sitemap'

- model: ralph_scrooge.PricingObjectType
pk: 254
fields:
name: 'Dummy'
color: '#eeeeee'
color: '#9e9e9e'

- model: ralph_scrooge.PricingObjectType
pk: 255
fields:
name: 'Unknown'
color: '#cccccc'
color: '#795548'
25 changes: 10 additions & 15 deletions src/ralph_scrooge/media/scrooge/app/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
var app = angular.module('app', [
'ngRoute',
'ngCookies',
'ngScrollbar',
'angular-loading-bar',

'scrooge.directives',
'scrooge.controllers',
'ang_controllers',
'ang_directives',
'ang_services',
Expand All @@ -10,7 +14,6 @@ var app = angular.module('app', [

app.config(['$routeProvider', '$httpProvider', '$provide',
function($routeProvider, $httpProvider, $provide) {

// we want Sentry to log our exceptions...
//$provide.decorator("$exceptionHandler", function($delegate) {
// Raven.config('', {}).install();
Expand Down Expand Up @@ -40,23 +43,15 @@ app.config(['$routeProvider', '$httpProvider', '$provide',
}
}
});
$routeProvider.
when('/components/', {
$routeProvider
.when('/components/', {
templateUrl: '/static/scrooge/partials/components.html',
controller: 'componentsCtrl',
}).
when('/allocation/client/', {
})
.when('/allocation/client/', {
templateUrl: '/static/scrooge/partials/allocationclient.html',
controller: 'allocationClientCtrl',
}).
otherwise({redirectTo: '/components/'});
})
.otherwise({redirectTo: '/components/'});
}
]);

app.run(function($http, $cookies, $rootScope) {
$http.defaults.headers.common['x-csrftoken'] = $cookies.csrftoken;

$http.get('/api/current_user/').success(function (data) {
$rootScope.$broadcast('event:user-loggedin', data);
});
});
13 changes: 13 additions & 0 deletions src/ralph_scrooge/media/scrooge/app/controllers/menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var scrooge = angular.module('scrooge.controllers', ['scrooge.services']);

scrooge.controller('MainMenuCtrl', ['$scope', '$location', 'MainMenu', function ($scope, $location, MainMenu){
$scope.items = MainMenu.items.get();
$scope.setActive = function(obj){
$scope.active_url = obj.href;
$scope.url = '#' + $location.url();
}

$scope.isActive = function(obj){
return '#' + $location.url() == obj.href;
}
}]);
9 changes: 9 additions & 0 deletions src/ralph_scrooge/media/scrooge/app/directives/menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var scrooge = angular.module('scrooge.directives', []);

scrooge.directive('mainMenu', function() {
return {
restrict: 'EA',
templateUrl: '/static/scrooge/partials/main_menu.html',
controller: 'MainMenuCtrl',
};
});
7 changes: 0 additions & 7 deletions src/ralph_scrooge/media/scrooge/app/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ var ang_services = angular.module('ang_services', ['ngResource']);

ang_services.factory('stats', ['$http', function ($http) {
return {
contentReady: 0,
currentMenu: false,
currentTab: false,
menuReady: false,
Expand Down Expand Up @@ -90,7 +89,6 @@ ang_services.factory('stats', ['$http', function ($http) {
return false
},
getComponentsData: function () {
self.contentReady += 1
$http({
method: 'GET',
url: '/scrooge/components/'
Expand All @@ -102,15 +100,12 @@ ang_services.factory('stats', ['$http', function ($http) {
}).
success(function(data, status, headers, config) {
self.components.content = data
self.contentReady -= 1
self.components.contentStats.table = data[0].name
}).
error(function(data, status, headers, config) {
self.contentReady -= 1
});
},
getAllocationClientData: function () {
self.contentReady += 1
$http({
method: 'GET',
url: '/scrooge/allocateclient/'
Expand All @@ -132,10 +127,8 @@ ang_services.factory('stats', ['$http', function ($http) {
}
})
}
self.contentReady -= 1
}).
error(function(data, status, headers, config) {
self.contentReady -= 1
});
},
saveAllocation: function (tab) {
Expand Down
13 changes: 13 additions & 0 deletions src/ralph_scrooge/media/scrooge/app/services/menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var scrooge = angular.module('scrooge.services', ['ngResource']);

scrooge.factory('MainMenu', ['$resource', function ($resource) {
return {
'items': $resource('/scrooge/rest/menu', {}, {
get: {
method: 'GET',
cache: true,
isArray: true,
}
})
}
}]);
Loading

0 comments on commit 5f5c11b

Please sign in to comment.