Skip to content

Commit

Permalink
Add warning messages
Browse files Browse the repository at this point in the history
Signed-off-by: worksofliam <[email protected]>
  • Loading branch information
worksofliam committed Jun 3, 2024
1 parent b7652bd commit 9c266cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/locale/ids/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,10 @@
"sandbox.noPassword": "Connection to {0} ended as no password was provided.",
"save": "Save",
"service.certificate.exists": "Remote service certificate exists",
"uriOpen.openError": "Error opening file",
"uriOpen.hostMismatch": "A file on another host is trying to be opened. Do you want to open on the current connection instead?",
"uriOpen.missingPath": "The provided URI is missing the path attribute.",
"uriOpen.noConnection": "You must have an active connection to open a file.",
"shortcut": "shortcut",
"size": "Size",
"skip": "Skip",
Expand Down
15 changes: 11 additions & 4 deletions src/uri/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ export async function registerUriHandler(context: ExtensionContext) {
if (queryData.host) {
const host = Array.isArray(queryData.host) ? queryData.host[0] : queryData.host;
if (host !== connection.currentHost) {
// TODO: host does not match requested host, do you still want to open?
return;
const chosen = await window.showInformationMessage(t(`uriOpen.openError`), {
detail: t(`uriOpen.hostMismatch`),
modal: true
}, `Open`);

if (chosen !== `Open`) {
return;
}
}
}

Expand All @@ -31,12 +37,13 @@ export async function registerUriHandler(context: ExtensionContext) {
commands.executeCommand(`code-for-ibmi.openEditable`, path);
}
} else {
// TODO: error message: missing path
window.showWarningMessage(t(`uriOpen.missingPath`));
}
} else {
// TODO: error message: no connection
window.showWarningMessage(t(`uriOpen.noConnection`));
}
break;

case `/connect`:
if (connection === undefined) {
const save = queryData.save === `true`;
Expand Down

0 comments on commit 9c266cd

Please sign in to comment.