Skip to content

Commit

Permalink
Hide Integration/Logs/Console when image is being downloaded
Browse files Browse the repository at this point in the history
Large images which take some time download and already show tabs the
console but clicking on it would result in a JavaScript error as the
Container object would not yet be available.

This also corrects Container.Names into Container.Name as this is what
the rest of the UI expects.

Closes:  #1408
  • Loading branch information
jelly authored and martinpitt committed Oct 18, 2023
1 parent 6dc14c1 commit c78f68c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
36 changes: 19 additions & 17 deletions src/Containers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -454,21 +454,24 @@ class Containers extends React.Component {
renderer: ContainerDetails,
data: { container }
});
tabs.push({
name: _("Integration"),
renderer: ContainerIntegration,
data: { container, localImages }
});
tabs.push({
name: _("Logs"),
renderer: ContainerLogs,
data: { containerId: container.Id, containerStatus: container.State.Status, width: this.state.width, system: container.isSystem }
});
tabs.push({
name: _("Console"),
renderer: ContainerTerminal,
data: { containerId: container.Id, containerStatus: container.State.Status, width: this.state.width, system: container.isSystem, tty }
});

if (!container.isDownloading) {
tabs.push({
name: _("Integration"),
renderer: ContainerIntegration,
data: { container, localImages }
});
tabs.push({
name: _("Logs"),
renderer: ContainerLogs,
data: { containerId: container.Id, containerStatus: container.State.Status, width: this.state.width, system: container.isSystem }
});
tabs.push({
name: _("Console"),
renderer: ContainerTerminal,
data: { containerId: container.Id, containerStatus: container.State.Status, width: this.state.width, system: container.isSystem, tty }
});
}
}

if (healthcheck) {
Expand All @@ -480,8 +483,7 @@ class Containers extends React.Component {
}

return {
expandedContent: <ListingPanel colSpan='4'
tabRenderers={tabs} />,
expandedContent: <ListingPanel colSpan='4' tabRenderers={tabs} />,
columns,
initiallyExpanded: document.location.hash.substr(1) === container.Id,
props: {
Expand Down
2 changes: 1 addition & 1 deletion src/ImageRunModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ export class ImageRunModal extends React.Component {
tempImage.isSystem = isSystem;
tempImage.State = { Status: _("downloading") };
tempImage.Created = new Date();
tempImage.Names = [tempImage.name];
tempImage.Name = tempImage.name;
tempImage.Image = createConfig.image;
tempImage.isDownloading = true;

Expand Down

0 comments on commit c78f68c

Please sign in to comment.