導覽

目錄

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字串完整的容器 ID,例如 46b57e400d801762e9e115734bf902a2450d89669d85881058a46136520aca28。您可以使用 docker ps 命令中的 --no-trunc 旗標來顯示完整的容器 ID。

傳回

Promise<void>

如果容器不存在,則會失敗的 promise。

如需所有導覽方法的詳細資訊,請參閱導覽 API 參考

已淘汰的導覽方法

這些方法已淘汰,將在 zukünftigen 版本中移除。請使用方法上面指定的方法。

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();