导航

目录

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}".`
  );
}

参数

名称类型描述
idstring完整的容器 ID,例如 46b57e400d801762e9e115734bf902a2450d89669d85881058a46136520aca28。你可以使用 docker ps 命令中的 --no-trunc 标志来显示完整的容器 ID。

返回值

Promise<void>

如果容器不存在,则此 Promise 将失败。

有关所有导航方法的更多详情,请参阅导航 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();
页面选项