web: Allow specifying specific factors to format bytes

Add a new $cockpit.format_bytes(number, [factor]) function, which
also accepts suffixes as the optional factor, and returns suffixes
separately from the number.

See cockpit-util.js for documentation.

Fixes #319
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
web: Use $cockpit.format_bytes() for Docker memory sizes

Fixes #319
Closes #325
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
web: Don't show bar-row min-width if value is zero

When a bar-row goes to actual zero, make the blue part of the
bar hidden.
web: When memory usage is zero it's unknown => '?'

Display a question mark when memory usage is zero for a running
container, and hence unknown. The system probably doesn't support
displaying memory usage.

Closes #326
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
Signed-off-by: Marius Vollmer <marius.vollmer@redhat.com>
web: Remove bar graph flicker by not recreating them

Don't recreate entire rows and cells and contents in the containers
and images tables. Just update the contents if a row already exists
for the container.

This allows us to simply update value="x/y" for the bar row div
rather than replacing it and causing animations all over the place.

Also simpler.

Fixes #320
Closes #331
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
web: Remove Container overview table 'Status' header

The column is filled with buttons, doesn't make sense and causes
the buttons to flow with a strange margin.

Closes #343
web: Hover over containers and images in overview page

Make them look clickable with the right pointer as well.

Upstream patternfly now has .table-hover as of their commit:
456368a5595774340f133e2d35da518a4d5ca59a

Fixes #289
Closes #344
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
web: Add startsWith and endsWith polyfills from MDN.

And use them.  This unbreaks the broken-since-forever "service:"
prefix recognition in the search box.

Reviewed-by: Stef Walter <stefw@redhat.com>
web: Add walking resource graphs to container overview.

Closes #327

Reviewed-by: Stef Walter <stefw@redhat.com>
web: Explicitly use empty string for CPU column when stopped.

Otherwise, it remains at "0%" when stopping a container, because
$(..).text(undefined) doesn't have any effect.

Closes #350

Reviewed-by: Stef Walter <stefw@redhat.com>
Enable/disable start/stop/restart buttons based on container state.

Fixes #294
Closes #330

Reviewed-by: Stef Walter <stefw@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.
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