<!DOCTYPE html>
<!--
 * This file is part of Cockpit.
 *
 * Copyright (C) 2015 Red Hat, Inc.
 *
 * Cockpit is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * Cockpit is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
-->
<html>
<head>
<title translate="yes">Dashboard</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="dashboard.css" rel="stylesheet">
    <link href="../../static/branding.css" rel="stylesheet">
    <script src="../base1/jquery.js"></script>
    <script src="../base1/cockpit.js"></script>
    <script src="../*/po.js"></script>
    <script src="../manifests.js"></script>
    <script src="../dashboard/dashboard.js"></script>
</head>
<body class="pf-m-redhat-font" hidden>

    <div id="dashboard" class="container-fluid page-ct">
        <div class="row" role="presentation">
            <div class="col-md-12">
                <div id="dashboard-toolbar" class="pull-right zoom-controls">
                    <div class="dropdown">
                        <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                            <span></span>
                            <i class="fa fa-caret-down pf-c-context-selector__toggle-icon" aria-hidden="true"></i>
                        </button>
                        <ul class="dropdown-menu" role="menu">
                            <li role="presentation"><a tabindex="0" role="menuitem"
                                data-action="goto-now" translate >Go to now</a></li>
                            <li role="presentation" class="divider"></li>
                            <li role="presentation"><a tabindex="0" role="menuitem"
                                data-range="300" translate >5 minutes</a></li>
                            <li role="presentation"><a tabindex="0" role="menuitem"
                                data-range="3600" translate>1 hour</a></li>
                            <li role="presentation"><a tabindex="0" role="menuitem"
                                data-range="21600" translate>6 hours</a></li>
                            <li role="presentation"><a tabindex="0" role="menuitem"
                                data-range="86400" translate>1 day</a></li>
                            <li role="presentation"><a tabindex="0" role="menuitem"
                                data-range="604800" translate>1 week</a></li>
                        </ul>
                    </div>
                    <button class="pf-c-button pf-m-secondary" data-action="zoom-out">
                        <span class="glyphicon glyphicon-zoom-out"></span>
                    </button>
                    <div class="btn-group">
                        <button class="pf-c-button pf-m-secondary" data-action="scroll-left">
                            <span class="fa fa-angle-left" />
                        </button>
                        <button class="pf-c-button pf-m-secondary" data-action="scroll-right">
                            <span class="fa fa-angle-right" />
                        </button>
                    </div>
                </div>
                <ul class="nav nav-tabs">
                    <li data-monitor-id="0"><a role="link" tabindex="0"><span translate="yes">CPU</span></a></li>
                    <li data-monitor-id="1"><a role="link" tabindex="0"><span translate="yes">Memory</span></a></li>
                    <li data-monitor-id="2"><a role="link" tabindex="0"><span translate="yes" context="label">Network</span></a></li>
                    <li data-monitor-id="3"><a role="link" tabindex="0"><span translate="yes">Disk I/O</span></a></li>
                </ul>
                <br>
                <div class="dashboard-plot zoomable-plot" id="dashboard-plot-0"></div>
                <div class="dashboard-plot zoomable-plot" id="dashboard-plot-1"></div>
                <div class="dashboard-plot zoomable-plot" id="dashboard-plot-2"></div>
                <div class="dashboard-plot zoomable-plot" id="dashboard-plot-3"></div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default" id="dashboard-hosts">
                    <div class="panel-heading">
                        <h2 class="panel-title" translate>Servers</h2>
                        <div class="panel-actions">
                            <button class="pf-c-button pf-m-secondary"
                                id="dashboard-enable-edit" aria-label="Edit Server" title="Edit Server">
                                <span class="fa fa-check" />
                            </button>
                            <button class="pf-c-button pf-m-primary servers-privileged"
                                id="dashboard-add" aria-label="Add Server" title="Add Server">
                                <span class="fa fa-plus" />
                            </button>
                        </div>
                    </div>
                    <div class="list-group">
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script id="dashboard-hosts-tmpl" type="x-template/mustache">
        {{#machines}}
            {{! state can be 'failed' or 'connected' }}
            <a data-address="{{address}}" class="list-group-item {{state}}"
                data-color="{{ color }}" target="_parent" href="/@{{address}}">
                <button class="pf-c-button pf-m-danger delete-button servers-privileged delete-{{address}} btn-sm">
                    <span class='pficon pficon-delete' />
                </button>
                <button class="pf-c-button pf-m-secondary edit-button servers-privileged btn-sm">
                    <span class="pficon pficon-edit" />
                </button>
                <img class="host-avatar {{avatar_display}}" role="{{aria_role}}" alt="{{alt_text}}" title="{{alt_text}}" src="{{render_avatar}}">
                <div class="spinner {{connecting_display}}"></div>
                <div class="os">{{os}}</div>
                <span class="host-label">{{label}}
                    <span class="reconnecting {{connecting_display}}"
                        translate="yes">Lost connection. Trying to reconnect</span></span>
            </a>
        {{/machines}}
    </script>

    <div class="modal" id="dashboard_setup_server_dialog" tabindex="-1" role="dialog"
        data-backdrop="static">
        <div class="modal-dialog">
            <div class="modal-content">
            </div>
        </div>
    </div>

    <div class="modal" id="host-edit-dialog" tabindex="-1" role="dialog" data-backdrop="static">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title" translate>Edit Server</h4>
                </div>
                <div class="modal-body">
                <div>
                    <input data-role="none" type="file" id="host-edit-file-input" hidden/>
                    <table class="form-table-ct">
                        <tr>
                            <td class="top" translate="yes">Host Name</td>
                            <td>
                                <input class="form-control" id="host-edit-name"/>
                            </td>
                            <td></td>
                        </tr>
                        <tr id="host-edit-user-row">
                            <td class="top" translate="yes">User</td>
                            <td>
                                <input class="form-control" id="host-edit-user"/>
                            </td>
                            <td>
                                <a tabindex="0" role="button" data-toggle="popover"
                                    data-trigger="focus" data-placement="bottom" translate="data-content"
                                    data-content="Leave blank to connect to this machine as the currently logged in user. If you enter a different username, that user will always be used when connecting to this machine.">
                                    <span class="fa fa-lg fa-info-circle"></span>
                                </a>
                            </td>
                        </tr>
                        <tr>
                            <td translate="yes">Color</td>
                            <td id="host-edit-colorpicker">
                            </td>
                            <td></td>
                        </tr>
                        <tr>
                            <td class="top" translate="yes">Avatar</td>
                            <td>
                                <div id="host-edit-avatar"></div>
                                <div id="host-edit-fail"></div>
                            </td>
                            <td></td>
                        </tr>
                    </table>
                </div>
                </div>
                <div class="modal-footer">
                    <button class="pf-c-button pf-m-primary" id="host-edit-apply" translate="yes">Set</button>
                    <button class="pf-c-button pf-m-link" data-dismiss="modal" translate="yes">Cancel</button>
                    <div class="pull-right"><a role="link" tabindex="0" id="host-edit-sync-users" translate="yes">Synchronize users</a></div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
