Skip to content

Commit 527f8f7

Browse files
authored
Merge pull request #3163 from julesyan/feature/show-job-info
Add job information to tooltip
2 parents a97e8e1 + 015611e commit 527f8f7

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

src/api/IBMi.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,10 @@ export default class IBMi {
11951195
return this.sqlJob !== undefined;
11961196
}
11971197

1198+
public getSqlJobId() {
1199+
return this.sqlJob?.id;
1200+
}
1201+
11981202
/**
11991203
* Generates path to a temp file on the IBM i
12001204
* @param {string} key Key to the temp file to be re-used

src/commands/actions.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import path from "path";
2-
import { commands, Disposable, l10n, TreeItem, Uri, window, WorkspaceFolder } from "vscode";
2+
import { commands, Disposable, env, l10n, TreeItem, Uri, window, WorkspaceFolder } from "vscode";
33
import IBMi from "../api/IBMi";
44
import { Tools } from "../api/Tools";
55
import Instance from "../Instance";
@@ -176,5 +176,16 @@ export function registerActionsCommands(instance: Instance): Disposable[] {
176176
}
177177
}
178178
}),
179+
180+
commands.registerCommand(`code-for-ibmi.copyJobId`, async () => {
181+
const connection = instance.getConnection();
182+
const sqlJobId = connection?.getSqlJobId();
183+
if (sqlJobId) {
184+
await env.clipboard.writeText(sqlJobId);
185+
window.showInformationMessage(`Job ID copied: ${sqlJobId}`);
186+
} else {
187+
window.showWarningMessage(`No job ID available`);
188+
}
189+
}),
179190
]
180191
}

src/instantiate.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ async function updateConnectedBar() {
115115
const actionsMenuItem = systemReadOnly ? `` : `[$(file-binary) Actions](command:code-for-ibmi.environment.actions.focus)`;
116116
const debugRunning = await isDebugEngineRunning();
117117
const connectedBarItemTooltips: String[] = systemReadOnly ? [`[System-wide read only](https://codefori.github.io/docs/settings/system/)`] : [];
118+
const sqlJobId = connection.getSqlJobId();
119+
const sqlJobInfo = sqlJobId ? `[$(database) Job: ${sqlJobId}](command:code-for-ibmi.copyJobId)` : `$(database) Job: Not available`;
120+
118121
connectedBarItemTooltips.push(
119122
`[$(settings-gear) Settings](command:code-for-ibmi.showAdditionalSettings)`,
120123
terminalMenuItem,
@@ -123,7 +126,8 @@ async function updateConnectedBar() {
123126
debugPTFInstalled(connection) ?
124127
`[$(${debugRunning ? "bug" : "debug"}) Debugger ${((await getDebugServiceDetails(connection)).version)} (${debugRunning ? "on" : "off"})](command:ibmiDebugBrowser.focus)`
125128
:
126-
`[$(debug) No debug PTF](https://codefori.github.io/docs/developing/debug/#required-ptfs)`
129+
`[$(debug) No debug PTF](https://codefori.github.io/docs/developing/debug/#required-ptfs)`,
130+
sqlJobInfo
127131
);
128132
connectedBarItem.tooltip = new vscode.MarkdownString(connectedBarItemTooltips.join(`\n\n---\n\n`), true);
129133
connectedBarItem.tooltip.isTrusted = true;

0 commit comments

Comments
 (0)