1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-04 13:25:26 +02:00

feat(configs): add support for docker configs (#996)

This commit is contained in:
Thomas Kooi 2017-11-06 09:47:31 +01:00 committed by Anthony Lapenna
parent ade66414a4
commit 407f0f5807
30 changed files with 932 additions and 20 deletions

View file

@ -2,8 +2,11 @@ angular.module('portainer.services')
.factory('CodeMirrorService', function CodeMirrorService() {
'use strict';
var codeMirrorOptions = {
lineNumbers: true,
var codeMirrorGenericOptions = {
lineNumbers: true
};
var codeMirrorYAMLOptions = {
mode: 'text/x-yaml',
gutters: ['CodeMirror-lint-markers'],
lint: true
@ -11,8 +14,18 @@ angular.module('portainer.services')
var service = {};
service.applyCodeMirrorOnElement = function(element) {
var cm = CodeMirror.fromTextArea(element, codeMirrorOptions);
service.applyCodeMirrorOnElement = function(element, yamlLint, readOnly) {
var options = codeMirrorGenericOptions;
if (yamlLint) {
options = codeMirrorYAMLOptions;
}
if (readOnly) {
options.readOnly = true;
}
var cm = CodeMirror.fromTextArea(element, options);
cm.setSize('100%', 500);
return cm;
};