Add congiguration.controller.js

This commit is contained in:
Damien CORNEAU 2016-09-27 17:59:03 +09:00
parent 6adb5225ab
commit 7e88eef244

View file

@ -11,36 +11,41 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
'use strict';
(function() {
angular.module('zeppelinWebApp').controller('ConfigurationCtrl', function($scope, $rootScope, $http,
baseUrlSrv, ngToast) {
$scope.configrations = [];
$scope._ = _;
angular.module('zeppelinWebApp').controller('ConfigurationCtrl', ConfigurationCtrl);
var getConfigurations = function() {
$http.get(baseUrlSrv.getRestApiBase() + '/configurations/all').
success(function(data, status, headers, config) {
$scope.configurations = data.body;
}).
error(function(data, status, headers, config) {
if (status === 401) {
ngToast.danger({
content: 'You don\'t have permission on this page',
verticalPosition: 'bottom',
timeout: '3000'
});
setTimeout(function() {
window.location.replace('/');
}, 3000);
}
console.log('Error %o %o', status, data.message);
});
};
ConfigurationCtrl.$inject = ['$scope', '$rootScope', '$http', 'baseUrlSrv', 'ngToast'];
var init = function() {
getConfigurations();
};
function ConfigurationCtrl($scope, $rootScope, $http, baseUrlSrv, ngToast) {
$scope.configrations = [];
$scope._ = _;
init();
});
var getConfigurations = function() {
$http.get(baseUrlSrv.getRestApiBase() + '/configurations/all').
success(function(data, status, headers, config) {
$scope.configurations = data.body;
}).
error(function(data, status, headers, config) {
if (status === 401) {
ngToast.danger({
content: 'You don\'t have permission on this page',
verticalPosition: 'bottom',
timeout: '3000'
});
setTimeout(function() {
window.location.replace('/');
}, 3000);
}
console.log('Error %o %o', status, data.message);
});
};
var init = function() {
getConfigurations();
};
init();
}
})();