Skip to content

Commit c6bed3e

Browse files
committed
v3.29.1
1 parent 752fc04 commit c6bed3e

7 files changed

Lines changed: 317 additions & 6 deletions

File tree

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nyx_ui2",
3-
"version": "0.1.0",
3+
"version": "3.29.1",
44
"private": true,
55
"scripts": {
66
"serve": "vue-cli-service serve",
@@ -56,8 +56,8 @@
5656
"@vue/cli-plugin-eslint": "^5.0.9",
5757
"@vue/cli-service": "^5.0.9",
5858
"element-theme-chalk": "^2.13.0",
59-
"eslint": "^9.21.0",
60-
"eslint-plugin-vue": "^10.0.0",
59+
"eslint": "^8.57.0",
60+
"eslint-plugin-vue": "^9.33.0",
6161
"sass": "^1.77.8",
6262
"sass-loader": "^13.3.3",
6363
"style-loader": "^4.0.0",

src/components/Logout.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ export default {
5757
confirmButtonText: "OK",
5858
dangerouslyUseHTMLString: true
5959
}
60-
);
60+
).catch(() => {
61+
// User closed the dialog - no action needed
62+
});
6163
},
6264
logout() {
6365
console.log("BEFCOMMIT");

src/components/tableEditor/LambdaEditor.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
:before-close="closeDialog"
77
:close-on-click-modal="false"
88
class="lambda-editor"
9+
append-to-body
910
>
1011

1112
<!-- <h1>{{locEditMode}}</h1> -->
Lines changed: 294 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,294 @@
1+
<template>
2+
<el-dialog
3+
width="80%"
4+
:title="title"
5+
:visible.sync="dialogFormVisible"
6+
:before-close="closeDialog"
7+
:close-on-click-modal="false"
8+
class="sql-editor"
9+
append-to-body
10+
>
11+
<el-card v-if="record" shadow="never">
12+
<el-form>
13+
<el-row>
14+
<el-col :span="24">
15+
<el-form-item label="SQL Query" :label-width="formLabelWidth">
16+
<editor
17+
v-if="sqlQuery"
18+
:key="editorKey"
19+
ref="aceEditorComponent"
20+
v-model="sqlQuery"
21+
id="sqlEditor"
22+
@init="editorInit"
23+
lang="sql"
24+
theme="chrome"
25+
width="100%"
26+
height="200"
27+
style="border: solid 1px #c0c4cc;"
28+
></editor>
29+
</el-form-item>
30+
</el-col>
31+
</el-row>
32+
</el-form>
33+
</el-card>
34+
35+
<span slot="footer" class="dialog-footer">
36+
<el-button @click="closeDialog">Cancel</el-button>
37+
<el-button
38+
type="primary"
39+
:disabled="!hasChanged"
40+
@click="saveRecord()"
41+
>Save</el-button>
42+
</span>
43+
</el-dialog>
44+
</template>
45+
46+
<script>
47+
export default {
48+
name: "SQLEditor",
49+
data: () => ({
50+
dialogFormVisible: false,
51+
formLabelWidth: "120px",
52+
sqlQuery: "",
53+
originalQuery: "",
54+
queryFieldPath: null, // Store the path to the query field
55+
_keyListener: null,
56+
aceEditor: null, // Store ace editor instance
57+
editorKey: 0 // Key to force re-render
58+
}),
59+
components: {
60+
editor: require("vue2-ace-editor")
61+
},
62+
computed: {
63+
hasChanged: function() {
64+
return this.sqlQuery !== this.originalQuery;
65+
},
66+
title: function() {
67+
if (this.record && this.record._id) {
68+
return `SQL Query Editor (${this.record._id})`;
69+
}
70+
return "SQL Query Editor";
71+
}
72+
},
73+
props: {
74+
record: {
75+
type: Object,
76+
required: true
77+
},
78+
config: {
79+
type: Object
80+
},
81+
editMode: {
82+
type: String
83+
}
84+
},
85+
watch: {
86+
record: {
87+
handler: function() {
88+
this.prepareData();
89+
},
90+
deep: true,
91+
immediate: true
92+
},
93+
aceEditor: {
94+
handler: function(newEditor) {
95+
if (newEditor && this.sqlQuery) {
96+
this.$nextTick(() => {
97+
newEditor.setValue(this.sqlQuery, -1);
98+
});
99+
}
100+
}
101+
}
102+
},
103+
created: function() {
104+
this.dialogFormVisible = true;
105+
},
106+
mounted: function() {
107+
// Load data after component is fully mounted
108+
this.$nextTick(() => {
109+
this.prepareData();
110+
});
111+
112+
// Fallback: Try to access editor from refs if @init didn't fire
113+
setTimeout(() => {
114+
if (!this.aceEditor && this.sqlQuery && this.$refs.aceEditorComponent) {
115+
const editorComponent = this.$refs.aceEditorComponent;
116+
if (editorComponent && editorComponent.editor) {
117+
this.aceEditor = editorComponent.editor;
118+
this.aceEditor.setValue(this.sqlQuery, -1);
119+
}
120+
}
121+
}, 500);
122+
123+
this._keyListener = function(e) {
124+
if (e.key === "s" && (e.ctrlKey || e.metaKey)) {
125+
e.preventDefault();
126+
if (this.hasChanged) {
127+
this.saveRecord();
128+
}
129+
}
130+
};
131+
document.addEventListener("keydown", this._keyListener.bind(this));
132+
},
133+
beforeDestroy: function() {
134+
if (this._keyListener) {
135+
document.removeEventListener("keydown", this._keyListener);
136+
}
137+
},
138+
methods: {
139+
editorInit: function(editor) {
140+
require("brace/ext/language_tools");
141+
require("brace/mode/sql");
142+
require("brace/theme/chrome");
143+
require("brace/snippets/sql");
144+
editor.setOptions({
145+
enableBasicAutocompletion: true,
146+
enableSnippets: true,
147+
enableLiveAutocompletion: true
148+
});
149+
150+
// Store editor reference
151+
this.aceEditor = editor;
152+
153+
// Set initial value if already loaded
154+
if (this.sqlQuery) {
155+
editor.setValue(this.sqlQuery, -1);
156+
}
157+
158+
// Set up change listener to update v-model
159+
editor.on('change', () => {
160+
this.sqlQuery = editor.getValue();
161+
});
162+
},
163+
prepareData: function() {
164+
// Try different possible locations for the query field
165+
let query = "";
166+
this.queryFieldPath = null;
167+
168+
if (!this.record) {
169+
return;
170+
}
171+
172+
// Try _source.query (most common case)
173+
if (this.record._source && this.record._source.query !== undefined) {
174+
query = this.record._source.query;
175+
this.queryFieldPath = "_source.query";
176+
}
177+
// Try direct query property
178+
else if (this.record.query !== undefined) {
179+
query = this.record.query;
180+
this.queryFieldPath = "query";
181+
}
182+
// Try looking in all _source fields for anything with 'query' in the name
183+
else if (this.record._source) {
184+
for (let key in this.record._source) {
185+
if (key.toLowerCase().includes('query') || key.toLowerCase().includes('sql')) {
186+
query = this.record._source[key];
187+
this.queryFieldPath = `_source.${key}`;
188+
break;
189+
}
190+
}
191+
}
192+
193+
// Try looking in root level for any field with query or sql
194+
if (!this.queryFieldPath) {
195+
for (let key in this.record) {
196+
if (key !== '_source' && key !== '_id' && key !== '_index' &&
197+
(key.toLowerCase().includes('query') || key.toLowerCase().includes('sql'))) {
198+
query = this.record[key];
199+
this.queryFieldPath = key;
200+
break;
201+
}
202+
}
203+
}
204+
205+
// Handle multi-line queries (with >- YAML format)
206+
if (typeof query === 'string') {
207+
query = query.trim();
208+
}
209+
210+
this.sqlQuery = query || "";
211+
this.originalQuery = query || "";
212+
213+
// Force editor re-render with new data
214+
this.editorKey++;
215+
216+
// Manually update ace editor if it's already initialized
217+
if (this.aceEditor && this.sqlQuery) {
218+
this.$nextTick(() => {
219+
this.aceEditor.setValue(this.sqlQuery, -1);
220+
});
221+
}
222+
},
223+
closeDialog: function() {
224+
if (this.hasChanged) {
225+
this.$confirm(
226+
"You have unsaved changes. Are you sure you want to close?",
227+
"Warning",
228+
{
229+
confirmButtonText: "OK",
230+
cancelButtonText: "Cancel",
231+
type: "warning"
232+
}
233+
)
234+
.then(() => {
235+
this.dialogFormVisible = false;
236+
this.$emit("dialogclose");
237+
})
238+
.catch(() => {});
239+
} else {
240+
this.dialogFormVisible = false;
241+
this.$emit("dialogclose");
242+
}
243+
},
244+
saveRecord: function() {
245+
// Update the record with the new query
246+
let updatedRecord = JSON.parse(JSON.stringify(this.record));
247+
248+
// Use the stored field path to save to the correct location
249+
if (this.queryFieldPath) {
250+
if (this.queryFieldPath.startsWith("_source.")) {
251+
const fieldName = this.queryFieldPath.substring(8); // Remove "_source."
252+
if (!updatedRecord._source) updatedRecord._source = {};
253+
updatedRecord._source[fieldName] = this.sqlQuery;
254+
} else {
255+
updatedRecord[this.queryFieldPath] = this.sqlQuery;
256+
}
257+
} else {
258+
// Fallback to default behavior
259+
if (updatedRecord._source) {
260+
updatedRecord._source.query = this.sqlQuery;
261+
} else {
262+
updatedRecord.query = this.sqlQuery;
263+
}
264+
}
265+
266+
this.$store.commit({
267+
type: "updateRecord",
268+
data: updatedRecord
269+
});
270+
271+
this.$notify({
272+
title: "Success",
273+
message: "SQL query updated successfully",
274+
type: "success",
275+
position: "bottom-right"
276+
});
277+
278+
this.originalQuery = this.sqlQuery;
279+
this.dialogFormVisible = false;
280+
this.$emit("dialogcloseupdated");
281+
}
282+
}
283+
};
284+
</script>
285+
286+
<style>
287+
.sql-editor .el-dialog__body {
288+
padding: 20px;
289+
}
290+
.sql-editor .el-form-item__label {
291+
color: #464646;
292+
font-weight: 600;
293+
}
294+
</style>

src/store/store.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Vuex from 'vuex'
33
import axios from "axios";
44
import moment from 'moment';
55
import _ from "lodash";
6+
import packageJson from '../../package.json';
67

78
import { extractURLParts } from "../globalfunctions";
89

@@ -52,7 +53,7 @@ export default new Vuex.Store({
5253
apiurl: "api/v1/",
5354
apiVersion: "",
5455
kibanaurl: "/kibana/",
55-
version: "v3.28.7",
56+
version: `v${packageJson.version}`,
5657
devMode: false,
5758
menus: [],
5859
menuOpen: true,

versions.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Version History
22

3+
## V3.29.1 16/May/2026
4+
* Fixed uncaught error when closing version info dialog
5+
* Store now dynamically reads version from package.json
6+
7+
## V3.29.0 16/May/2026
8+
* SQLEditor: Fixed dialog rendering with append-to-body
9+
* SQLEditor: Added record ID to dialog title
10+
* SQLEditor: Fixed ace editor initialization and data loading
11+
* LambdaEditor: Added append-to-body for proper dialog display
12+
313
## V3.28.6 27/Apr/2026
414
* Jupylab path updated
515
* better external address handling

vue.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22

33
module.exports = {
44
lintOnSave: false,
5-
transpileDependencies: []
5+
transpileDependencies: [],
6+
chainWebpack: config => {
7+
config.plugins.delete('eslint');
8+
}
69
};

0 commit comments

Comments
 (0)