* chore(project): install prettier and lint-staged * chore(project): apply prettier to html too * chore(project): git ignore eslintcache * chore(project): add a comment about format script * chore(prettier): update printWidth * chore(prettier): remove useTabs option * chore(prettier): add HTML validation * refactor(prettier): fix closing tags * feat(prettier): define angular parser for html templates * style(prettier): run prettier on codebase Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
import { StatusVersionViewModel, StatusViewModel } from '../../models/status';
|
|
|
|
angular.module('portainer.app').factory('StatusService', [
|
|
'$q',
|
|
'Status',
|
|
function StatusServiceFactory($q, Status) {
|
|
'use strict';
|
|
var service = {};
|
|
|
|
service.status = function () {
|
|
var deferred = $q.defer();
|
|
|
|
Status.get()
|
|
.$promise.then(function success(data) {
|
|
var status = new StatusViewModel(data);
|
|
deferred.resolve(status);
|
|
})
|
|
.catch(function error(err) {
|
|
deferred.reject({ msg: 'Unable to retrieve application status', err: err });
|
|
});
|
|
|
|
return deferred.promise;
|
|
};
|
|
|
|
service.version = function () {
|
|
var deferred = $q.defer();
|
|
|
|
Status.version()
|
|
.$promise.then(function success(data) {
|
|
var status = new StatusVersionViewModel(data);
|
|
deferred.resolve(status);
|
|
})
|
|
.catch(function error(err) {
|
|
deferred.reject({ msg: 'Unable to retrieve application version info', err: err });
|
|
});
|
|
|
|
return deferred.promise;
|
|
};
|
|
|
|
return service;
|
|
},
|
|
]);
|