mirror of
https://github.com/portainer/portainer.git
synced 2025-08-04 21:35:23 +02:00
refactor(app): introduce new project structure for the frontend (#1623)
This commit is contained in:
parent
e6422a6d75
commit
27dceadba1
354 changed files with 1518 additions and 1755 deletions
37
app/docker/views/configs/edit/configController.js
Normal file
37
app/docker/views/configs/edit/configController.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
angular.module('portainer.docker')
|
||||
.controller('ConfigController', ['$scope', '$transition$', '$state', '$document', 'ConfigService', 'Notifications', 'CodeMirrorService',
|
||||
function ($scope, $transition$, $state, $document, ConfigService, Notifications, CodeMirrorService) {
|
||||
|
||||
$scope.removeConfig = function removeConfig(configId) {
|
||||
ConfigService.remove(configId)
|
||||
.then(function success(data) {
|
||||
Notifications.success('Config successfully removed');
|
||||
$state.go('docker.configs', {});
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to remove config');
|
||||
});
|
||||
};
|
||||
|
||||
function initEditor() {
|
||||
$document.ready(function() {
|
||||
var webEditorElement = $document[0].getElementById('config-editor');
|
||||
if (webEditorElement) {
|
||||
$scope.editor = CodeMirrorService.applyCodeMirrorOnElement(webEditorElement, false, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initView() {
|
||||
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');
|
||||
});
|
||||
}
|
||||
|
||||
initView();
|
||||
}]);
|
Loading…
Add table
Add a link
Reference in a new issue