mirror of
https://github.com/louislam/dockge.git
synced 2026-05-21 22:12:17 +00:00
Compare commits
3 Commits
dependabot
...
codemirror
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f16b00908d | ||
|
|
3b9f0b9a4f | ||
|
|
ca9c8b4ba1 |
@@ -63,8 +63,8 @@
|
|||||||
|
|
||||||
<!-- URLs -->
|
<!-- URLs -->
|
||||||
<div v-if="urls.length > 0" class="mb-3">
|
<div v-if="urls.length > 0" class="mb-3">
|
||||||
<a v-for="(url, index) in urls" :key="index" target="_blank" :href="url.url">
|
<a v-for="(urlItem, index) in urls" :key="index" target="_blank" :href="urlItem.url">
|
||||||
<span class="badge bg-secondary me-2">{{ url.display }}</span>
|
<span class="badge bg-secondary me-2">{{ urlItem.display }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -98,8 +98,8 @@
|
|||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<label for="name" class="form-label">{{ $t("dockgeAgent") }}</label>
|
<label for="name" class="form-label">{{ $t("dockgeAgent") }}</label>
|
||||||
<select v-model="stack.endpoint" class="form-select">
|
<select v-model="stack.endpoint" class="form-select">
|
||||||
<option v-for="(agent, endpoint) in $root.agentList" :key="endpoint" :value="endpoint" :disabled="$root.agentStatusList[endpoint] != 'online'">
|
<option v-for="(agent, agentEndpoint) in $root.agentList" :key="agentEndpoint" :value="agentEndpoint" :disabled="$root.agentStatusList[agentEndpoint] != 'online'">
|
||||||
({{ $root.agentStatusList[endpoint] }}) {{ (agent.name !== '') ? agent.name : agent.url || $t("Current") }}
|
({{ $root.agentStatusList[agentEndpoint] }}) {{ (agent.name !== '') ? agent.name : agent.url || $t("Current") }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@@ -221,15 +221,6 @@
|
|||||||
<NetworkInput />
|
<NetworkInput />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="shadow-box big-padding mb-3">
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="name" class="form-label"> Search Templates</label>
|
|
||||||
<input id="name" v-model="name" type="text" class="form-control" placeholder="Search..." required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<prism-editor v-if="false" v-model="yamlConfig" class="yaml-editor" :highlight="highlighter" line-numbers @input="yamlCodeChange"></prism-editor>
|
|
||||||
</div>-->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -250,9 +241,9 @@ import CodeMirror from "vue-codemirror6";
|
|||||||
import { yaml } from "@codemirror/lang-yaml";
|
import { yaml } from "@codemirror/lang-yaml";
|
||||||
import { python } from "@codemirror/lang-python";
|
import { python } from "@codemirror/lang-python";
|
||||||
import { dracula as editorTheme } from "thememirror";
|
import { dracula as editorTheme } from "thememirror";
|
||||||
import { lineNumbers, EditorView } from "@codemirror/view";
|
import { lineNumbers, EditorView, Decoration, ViewPlugin } from "@codemirror/view";
|
||||||
import { parseDocument, Document } from "yaml";
|
import { parseDocument, Document } from "yaml";
|
||||||
|
import { RangeSetBuilder } from "@codemirror/state";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
||||||
import {
|
import {
|
||||||
COMBINED_TERMINAL_COLS,
|
COMBINED_TERMINAL_COLS,
|
||||||
@@ -282,11 +273,43 @@ let yamlErrorTimeout = null;
|
|||||||
|
|
||||||
let serviceStatusTimeout = null;
|
let serviceStatusTimeout = null;
|
||||||
let dockerStatsTimeout = null;
|
let dockerStatsTimeout = null;
|
||||||
let prismjsSymbolDefinition = {
|
|
||||||
"symbol": {
|
// Highlight $VAR and ${VAR}
|
||||||
pattern: /(?<!\$)\$(\{[^{}]*\}|\w+)/,
|
const variableHighlight = ViewPlugin.fromClass(class {
|
||||||
|
constructor(view) {
|
||||||
|
this.decorations = this.buildDecorations(view);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
update(update) {
|
||||||
|
if (update.docChanged || update.viewportChanged) {
|
||||||
|
this.decorations = this.buildDecorations(update.view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildDecorations(view) {
|
||||||
|
const builder = new RangeSetBuilder();
|
||||||
|
|
||||||
|
for (const { from, to } of view.visibleRanges) {
|
||||||
|
const text = view.state.doc.sliceString(from, to);
|
||||||
|
const variableRegex = /\$\{?[A-Za-z0-9_]+\}?/g;
|
||||||
|
let match;
|
||||||
|
while ((match = variableRegex.exec(text)) !== null) {
|
||||||
|
const start = from + match.index;
|
||||||
|
const end = start + match[0].length;
|
||||||
|
|
||||||
|
builder.add(
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
Decoration.mark({ class: "cm-variable-highlight" })
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.finish();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
decorations: v => v.decorations
|
||||||
|
});
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -312,6 +335,7 @@ export default {
|
|||||||
const extensions = [
|
const extensions = [
|
||||||
editorTheme,
|
editorTheme,
|
||||||
yaml(),
|
yaml(),
|
||||||
|
variableHighlight,
|
||||||
lineNumbers(),
|
lineNumbers(),
|
||||||
EditorView.focusChangeEffect.of(focusEffectHandler)
|
EditorView.focusChangeEffect.of(focusEffectHandler)
|
||||||
];
|
];
|
||||||
@@ -319,11 +343,13 @@ export default {
|
|||||||
const extensionsEnv = [
|
const extensionsEnv = [
|
||||||
editorTheme,
|
editorTheme,
|
||||||
python(),
|
python(),
|
||||||
|
variableHighlight,
|
||||||
lineNumbers(),
|
lineNumbers(),
|
||||||
EditorView.focusChangeEffect.of(focusEffectHandler)
|
EditorView.focusChangeEffect.of(focusEffectHandler)
|
||||||
];
|
];
|
||||||
|
|
||||||
return { extensions,
|
return {
|
||||||
|
extensions,
|
||||||
extensionsEnv,
|
extensionsEnv,
|
||||||
editorFocus };
|
editorFocus };
|
||||||
},
|
},
|
||||||
@@ -778,7 +804,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
checkYAML() {
|
checkYAML() {
|
||||||
|
// TODO: implement validation
|
||||||
},
|
},
|
||||||
|
|
||||||
addContainer() {
|
addContainer() {
|
||||||
@@ -858,6 +884,11 @@ export default {
|
|||||||
height: 200px;
|
height: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.cm-variable-highlight) {
|
||||||
|
color: #fe6000;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
.editor-box {
|
.editor-box {
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|||||||
Reference in New Issue
Block a user