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: Use HTML ids of image/container ids for locating container rows

These should be unique enough for us to use them directly. This
allows us to highlight them using jQuery straight from unrelated
code like the graph plotting code.
web: Return the element we're going to plot in

So that we can use it to catch events and stuff.
WIP hit detection