Skip to content

Commit

Permalink
docker: Fix regression that removed the "waiting" spinner
Browse files Browse the repository at this point in the history
We used to show a spinner when we were performing an action
on an image or container. Lets show this properly again.

Closes #5686
  • Loading branch information
stefwalter authored and larskarlitski committed Jan 9, 2017
1 parent 807ba73 commit d0fe711
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
24 changes: 19 additions & 5 deletions pkg/docker/containers-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,20 @@ var ContainerList = React.createClass({
var rows = filtered.map(function (container) {
var isRunning = !!container.State.Running;

var state;
if (this.props.client.waiting[container.Id]) {
state = { element: <div className="spinner"></div>, tight: true }
} else {
state = util.render_container_status(container.State)
}

var columns = [
{ name: container.Name.replace(/^\//, ''), header: true },
docker.truncate_id(container.Image),
util.render_container_cmdline(container),
util.format_cpu_usage(container.CpuUsage),
util.format_memory_and_limit(container.MemoryUsage, container.MemoryLimit),
util.render_container_status(container.State)
state,
];

var startStopActions = [];
Expand Down Expand Up @@ -509,16 +516,23 @@ var ImageList = React.createClass({
);
}

var element;
if (this.props.client.waiting[image.Id]) {
element = <div className="spinner"></div>
} else {
element = <button className="btn btn-default btn-control-ct fa fa-play"
onClick={ this.showRunImageDialog.bind(this) }
data-image={image.Id} />
}

var columns = [
{ name: image.RepoTags[0], header: true },
vulnerabilityColumn,
moment.unix(image.Created).fromNow(),
cockpit.format_bytes(image.VirtualSize),
{
element: <button className="btn btn-default btn-control-ct fa fa-play"
onClick={ this.showRunImageDialog.bind(this) }
data-image={image.Id} />,
tight: true
element: element,
tight: true
}
];

Expand Down
4 changes: 4 additions & 0 deletions pkg/docker/docker.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
width: 5px;
}

div.spinner {
display: inline-block;
}

/*
* For showing and filtering disabled unimportant rows in a table
*
Expand Down
2 changes: 1 addition & 1 deletion pkg/docker/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
}), document.querySelector('#image-details .content'));

var waiting = !!(this.client.waiting[this.image_id]);
$('#image-details-buttons div.waiting').toggle(info && waiting);
$('#image-details-buttons div.spinner').toggle(info && waiting);
$('#image-details-buttons button').toggle(info && !waiting);

if (info) {
Expand Down

0 comments on commit d0fe711

Please sign in to comment.