mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 05:45:22 +02:00
refactor(code-editor): introduce code-editor component (#1674)
* refactor(code-editor): introduce code-editor component * refactor(code-editor): add some extra validation
This commit is contained in:
parent
eb43579378
commit
9b80b6adb2
13 changed files with 104 additions and 94 deletions
|
@ -1,6 +1,6 @@
|
|||
angular.module('portainer.docker')
|
||||
.controller('ConfigController', ['$scope', '$transition$', '$state', '$document', 'ConfigService', 'Notifications', 'CodeMirrorService',
|
||||
function ($scope, $transition$, $state, $document, ConfigService, Notifications, CodeMirrorService) {
|
||||
.controller('ConfigController', ['$scope', '$transition$', '$state', 'ConfigService', 'Notifications',
|
||||
function ($scope, $transition$, $state, ConfigService, Notifications) {
|
||||
|
||||
$scope.removeConfig = function removeConfig(configId) {
|
||||
ConfigService.remove(configId)
|
||||
|
@ -13,20 +13,10 @@ function ($scope, $transition$, $state, $document, ConfigService, Notifications,
|
|||
});
|
||||
};
|
||||
|
||||
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');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue