web: As containers are starting/stopping on overview page show waiting

Show a throbber as containers on the overview page are starting
or stopping.

We cannot use /events or container state to track the waiting state,
as docker doesn't seem to give us anything useful here. So we do this
ourselves.

The small-spinner.gif looks *really* ugly, so we use an alternate
throbber here, at least for now.

Along with previous commits this, fixes #301, closes #317

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
web: Add $cockpit.debugging control knob

$cockpit.debugging can be set from the javascript console to one of
these values:

 * 'rest'
 * 'channel'
 * 'dbus'

... to see the relevant debugging logs. Or set to 'all' to see
everything.

Set cookie like this to see debugging information during the loading
of the page:

document.cookie = "debugging=all;" + document.cookie

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
web: Add 'resource' debugging knob for $cockpit.debugging

This will show cgroup monitoring samples in the javascript
console as they come in.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
web: Cleanup cockpit-docker.js javascript console debugging

Warnings go to console.warn(). Events are already logged via
rest_debug() and remove some other noise.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
web: Switch overview display of memory back to MiB

Use base-2 suffixes for memory display on overview containers page.
This fixes a regression.

Closes #351
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
agent: Convert non-UTF8 with replacement char in CockpitTextStream

When we encounter non-UTF8 in text-stream channels, replace the bad
characters with the unicode replacement character U+FFFD. This
usually shows up as a diamond with a question mark in it in modern
fonts.

This allows us to not be so fragile with the text-stream channels,
and close unexpectedly.

The terminal stuff didn't really need this, because it seems that
terminal escape codes are all ASCII clean.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
web: Show a usable terminal in container details

Show a usable terminal in container details, where you can type
see output, scroll, etc.

Disconnects when container stops, hides cursor. Reconnects when
container starts and shows cursor.

For now we show the terminal when the docker container has a tty.
But this seems like the default. When no tty Docker's /attach
command uses a strange binary framing, which we can't handle on
our text-stream socket.

Closes #346
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
web: Fix memory danger indication for containers.

This slipped through review, sorry.

Closes #348

Signed-off-by: Stef Walter <stefw@redhat.com>
 * Make sure to only pass boolean to toggleClass('bar-row-danger', x)
web: Implement slider for choosing a container memory limit

This implements the memory row as described by the mockup here:

https://github.com/cockpit-project/cockpit-design/blob/f1d6e8c560d6230bad24e4ac11c8916dc75d9e52/docker/docker-run-hires.png

The only difference is that the total memory is not shown, as the
container is not actually being allocated a portion of the memory. This
is about setting a limit.

Fixes #295
Closes #353
web: Implement CPU priority slider

This is done on a logarithmic scale. Defaults to 'default' priority.

Fixes #296
Closes #353
web: Reset CPU and Memory limit check boxes in run dialog

Reset the check boxes whenever the page is displayed for consistent
behavior.