MCPcopy Create free account
hub / github.com/explorerhq/sql-explorer / constructor

Method constructor

explorer/src/js/explorer.js:60–105  ·  view source on GitHub ↗
(queryId)

Source from the content-addressed store, hash-verified

58
59export class ExplorerEditor {
60 constructor(queryId) {
61
62 selectConnection();
63
64 const aa = document.getElementById('assistant_accordion');
65 const pa = document.getElementById('nav-preview');
66 if (aa) {
67 // Expand the assistant only if a new query is being created
68 // and no results are yet being shown
69 const expand = !pa && queryId === 'new';
70 setUpAssistant(expand);
71 }
72
73 this.queryId = queryId;
74 this.$rows = $("#rows");
75 this.$form = $("form");
76 this.$snapshotField = $("#id_snapshot");
77 this.docChanged = false;
78
79 this.$submit = $("#refresh_play_button, #save_button");
80 if (!this.$submit.length) {
81 this.$submit = $("#refresh_button");
82 }
83
84 this.editor = editorFromTextArea(document.getElementById("id_sql"));
85
86 window.editor = this.editor;
87
88 document.addEventListener('submitEventFromCM', (e) => {
89 this.$submit.click();
90 });
91
92 document.addEventListener('formatEventFromCM', (e) => {
93 this.formatSql();
94 });
95
96 document.addEventListener('docChanged', (e) => {
97 this.docChanged = true;
98 });
99
100 this.bind();
101
102 if (cookie.get("schema_sidebar_open") === 'true') {
103 this.showSchema(true);
104 }
105 }
106
107 getParams() {
108 let o = false;

Callers

nothing calls this directly

Calls 7

formatSqlMethod · 0.95
bindMethod · 0.95
showSchemaMethod · 0.95
setUpAssistantFunction · 0.90
selectConnectionFunction · 0.85
editorFromTextAreaFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected