Dashboard
User notifications
Toasts provide a brief notification to the user. They appear temporarily and shouldn't interrupt the user experience. They also don't require user input to disappear.
success
▸ success(msg
): void
Use to display a toast message of type success.
ddClient.desktopUI.toast.success("message");
warning
▸ warning(msg
): void
Use to display a toast message of type warning.
ddClient.desktopUI.toast.warning("message");
error
▸ error(msg
): void
Use to display a toast message of type error.
ddClient.desktopUI.toast.error("message");
For more details about method parameters and the return types available, see Toast API reference.
Deprecated user notifications
These methods are deprecated and will be removed in a future version. Use the methods specified above.
window.ddClient.toastSuccess("message");
window.ddClient.toastWarning("message");
window.ddClient.toastError("message");
Open a file selection dialog
This function opens a file selector dialog that asks the user to select a file or folder.
▸ showOpenDialog(dialogProperties
): Promise
<
OpenDialogResult
>:
The dialogProperties
parameter is a list of flags passed to Electron to customize the dialog's behaviour. For example, you can pass multiSelections
to allow a user to select multiple files. See
Electron's documentation for a full list.
const result = await ddClient.desktopUI.dialog.showOpenDialog({
properties: ["openDirectory"],
});
if (!result.canceled) {
console.log(result.paths);
}
Open a URL
This function opens an external URL with the system default browser.
▸ openExternal(url
): void
ddClient.host.openExternal("https://docker.com");
The URL must have the protocol
http
orhttps
.
For more details about method parameters and the return types available, see Desktop host API reference.
Deprecated user notifications
This method is deprecated and will be removed in a future version. Use the methods specified above.
window.ddClient.openExternal("https://docker.com");
Navigation to Dashboard routes
From your extension, you can also navigate to other parts of the Docker Desktop Dashboard.