導覽
目錄
ddClient.desktopUI.navigate 可啟用 Docker Desktop 特定畫面的導覽,例如容器標籤頁、映像檔標籤頁,或特定容器的記錄檔。
例如,導覽至特定容器的記錄檔
const id = '8c7881e6a107';
try {
await ddClient.desktopUI.navigate.viewContainerLogs(id);
} catch (e) {
console.error(e);
ddClient.desktopUI.toast.error(
`Failed to navigate to logs for container "${id}".`
);
}參數
| 名稱 | 類型 | 描述 |
|---|---|---|
id | string | 完整的容器 ID,例如 46b57e400d801762e9e115734bf902a2450d89669d85881058a46136520aca28。您可以使用 docker ps 命令中的 --no-trunc 旗標來顯示完整的容器 ID。 |
回傳
Promise<void>
如果容器不存在,則此 Promise 將會失敗。
如需有關所有導覽方法的詳細資訊,請參閱 Navigation API 參考文件。
已棄用的導覽方法
這些方法已棄用,並將在未來版本中移除。請使用上述指定的方法。
window.ddClient.navigateToContainers();
// id - the full container id, e.g. `46b57e400d801762e9e115734bf902a2450d89669d85881058a46136520aca28`
window.ddClient.navigateToContainer(id);
window.ddClient.navigateToContainerLogs(id);
window.ddClient.navigateToContainerInspect(id);
window.ddClient.navigateToContainerStats(id);
window.ddClient.navigateToImages();
window.ddClient.navigateToImage(id, tag);
window.ddClient.navigateToVolumes();
window.ddClient.navigateToVolume(volume);
window.ddClient.navigateToDevEnvironments();