Skip to content

Commit

Permalink
Merge pull request #461 from KxSystems/v.1.9.0-dev-to-main
Browse files Browse the repository at this point in the history
V.1.9.0 dev to main
  • Loading branch information
Philip-Carneiro-KX authored Nov 18, 2024
2 parents 50beb02 + f79e4e7 commit 53061c2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 18 deletions.
27 changes: 23 additions & 4 deletions src/classes/localConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,31 @@ export class LocalConnection {
if (err || !conn) {
ext.serverProvider.reload();

window.showErrorMessage(
`Connection to server ${this.options.host}:${this.options.port} failed! Details: ${err?.message}`,
);
if (this.connLabel.endsWith("[local]")) {
window
.showErrorMessage(
`Connection to server ${this.options.host}:${this.options.port} failed.`,
"Start q process",
)
.then((res) => {
if (res) {
commands.executeCommand(
"kdb.startLocalProcess",
ext.connectionsList.find(
(conn) => conn.label === this.connLabel,
),
);
}
});
} else {
window.showErrorMessage(
`Connection to server ${this.options.host}:${this.options.port} failed.`,
);
}

kdbOutputLog(
`Connection to server ${this.options.host}:${this.options.port} failed! Details: ${err?.message}`,
"ERROR",
"CONNECTION",
);
return;
}
Expand Down
30 changes: 16 additions & 14 deletions src/webview/components/kdbNewConnectionView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export class KdbNewConnectionView extends LitElement {

handleMessage(event: { data: any }) {
const message = event.data;
console.log(message);
if (message.command === "editConnection") {
this.connectionData = message.data;
this.labels = message.labels;
Expand Down Expand Up @@ -366,7 +367,7 @@ export class KdbNewConnectionView extends LitElement {
<sl-select
id="selectLabel"
class="dropdown larger"
.value="${live(this.labels[pos])}"
value="${live(this.labels[pos])}"
@sl-change="${(event: Event) => {
this.updateLabelValue(pos, event);
}}">
Expand All @@ -389,26 +390,27 @@ export class KdbNewConnectionView extends LitElement {
}

renderLblDropdownOptions(pos: number) {
console.log(this.labels);
return html`
<sl-select placeholder="No Label Selected">
<sl-option> No Label Selected </sl-option>
${repeat(
this.lblNamesList,
(lbl) => lbl.name,
(lbl) => html`
<sl-option
.value="${live(lbl.name)}"
?selected="${lbl.name === this.labels[pos]}">
<sl-option> No Label Selected </sl-option>
${repeat(
this.lblNamesList,
(lbl) => lbl,
(lbl) => {
console.log(lbl.name);
console.log(lbl.name === this.labels[pos]);
return html`
<sl-option .value="${lbl.name}">
<span>
<div
style="width: 10px; height: 10px; background: ${lbl.color
.colorHex}; border-radius: 50%; float: left; margin-right: 10px; margin-top: 3px;"></div>
${lbl.name}
</span>
</sl-option>
`,
)}
</sl-select>
`;
},
)}
`;
}

Expand Down Expand Up @@ -998,7 +1000,7 @@ export class KdbNewConnectionView extends LitElement {
},
});
setTimeout(() => {
this.labels.unshift(this.newLblName);
this.labels.push(this.newLblName);
this.closeModal();
}, 500);
}
Expand Down

0 comments on commit 53061c2

Please sign in to comment.