mirror of
https://github.com/portainer/portainer.git
synced 2025-08-01 20:05:23 +02:00
feat(configs): add support for docker configs (#996)
This commit is contained in:
parent
ade66414a4
commit
407f0f5807
30 changed files with 932 additions and 20 deletions
45
app/components/config/configController.js
Normal file
45
app/components/config/configController.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
angular.module('config', [])
|
||||
.controller('ConfigController', ['$scope', '$transition$', '$state', '$document', 'ConfigService', 'Notifications', 'CodeMirrorService',
|
||||
function ($scope, $transition$, $state, $document, ConfigService, Notifications, CodeMirrorService) {
|
||||
|
||||
$scope.removeConfig = function removeConfig(configId) {
|
||||
$('#loadingViewSpinner').show();
|
||||
ConfigService.remove(configId)
|
||||
.then(function success(data) {
|
||||
Notifications.success('Config successfully removed');
|
||||
$state.go('configs', {});
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to remove config');
|
||||
})
|
||||
.finally(function final() {
|
||||
$('#loadingViewSpinner').hide();
|
||||
});
|
||||
};
|
||||
|
||||
function initEditor() {
|
||||
$document.ready(function() {
|
||||
var webEditorElement = $document[0].getElementById('config-editor');
|
||||
if (webEditorElement) {
|
||||
$scope.editor = CodeMirrorService.applyCodeMirrorOnElement(webEditorElement, false, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initView() {
|
||||
$('#loadingViewSpinner').show();
|
||||
ConfigService.config($transition$.params().id)
|
||||
.then(function success(data) {
|
||||
$scope.config = data;
|
||||
initEditor();
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to retrieve config details');
|
||||
})
|
||||
.finally(function final() {
|
||||
$('#loadingViewSpinner').hide();
|
||||
});
|
||||
}
|
||||
|
||||
initView();
|
||||
}]);
|
Loading…
Add table
Add a link
Reference in a new issue