1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

Initial commit

This commit is contained in:
Retspen 2015-02-27 10:53:51 +02:00
commit 4d48e79341
87 changed files with 5637 additions and 0 deletions

25
templates/compute.html Normal file
View file

@ -0,0 +1,25 @@
{% load static %}
{% load i18n %}
{% include 'header.html' %}
<body>
<div class="container-fluid">
<div class="row">
{% include 'sidebar.html' %}
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<button type="button" class="btn btn-success pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
<h1 class="page-header">Computes</h1>
<div class="alert alert-danger alert-dismissible" role="danger">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<strong>Error:</strong> Better check yourself, you're not looking too good.
</div>
</div>
</div>
</div>
{% include 'footer.html' %}

234
templates/computes.html Normal file
View file

@ -0,0 +1,234 @@
{% load static %}
{% load i18n %}
{% include 'header.html' %}
<body>
<div class="container-fluid">
<div class="row">
{% include 'sidebar.html' %}
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<button type="button" class="btn btn-success pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
<h1 class="page-header">Computes</h1>
<div class="alert alert-danger alert-dismissible" role="danger">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<strong>Error:</strong> Better check yourself, you're not looking too good.
</div>
<div class="row">
{% if computes_info %}
{% for compute in computes_info %}
<div id="{{ compute.name }}" class="col-xs-6 col-sm-4">
<div class="panel {% ifequal compute.status 1 %}panel-success{% else %}panel-danger{% endifequal %} panel-data">
<div class="panel-heading">
{% ifequal compute.status 1 %}
<h3 class="panel-title">
<a href="{% url 'compute' compute.id %}"><strong>{{ compute.name }}</strong></a>
<a data-toggle="modal" href="#editHost{{ compute.id }}" class="pull-right"
title="{% trans "Edit" %}">
<span class="glyphicon glyphicon-cog"></span>
</a>
</h3>
{% else %}
<h3 class="panel-title"><strong>{{ compute.name }}</strong>
<a data-toggle="modal" href="#editHost{{ compute.id }}" class="pull-right"
title="{% trans "Edit" %}">
<span class="glyphicon glyphicon-cog"></span>
</a>
</h3>
{% endifequal %}
</div>
<div class="panel-body">
<p>
<form action="" method="post" role="form">{% csrf_token %}
<input type="hidden" name="host_id" value="{{ compute.id }}">
<button type="submit" class="pull-right btn btn-xs btn-danger" name="host_del"
title="{% trans "Delete" %}"
onclick="return confirm('{% trans "Are you sure?" %}')">
<span class="glyphicon glyphicon-trash"></span>
</button>
</form>
</p>
<p>
{% ifequal compute.type 1 %}
tcp://{{ compute.hostname }}
{% endifequal %}
{% ifequal compute.type 2 %}
ssh://{{ compute.hostname }}
{% endifequal %}
{% ifequal compute.type 3 %}
tls://{{ compute.hostname }}
{% endifequal %}
{% ifequal compute.type 4 %}
socket://
{% endifequal %}
</p>
<!-- Modal Edit -->
<div class="modal fade" id="editHost{{ compute.id }}" tabindex="-1" role="dialog"
aria-labelledby="editHostLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<h4 class="modal-title">{% trans "Edit connection" %}</h4>
</div>
{% ifequal compute.type 1 %}
<div class="modal-body">
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
<div class="form-group">
<label class="col-sm-4 control-label">{% trans "Label" %}</label>
<div class="col-sm-6">
<input type="hidden" name="host_id" value="{{ compute.id }}">
<input type="text" name="name" class="form-control"
value="{{ compute.name }}" maxlength="20" required
pattern="[a-z0-9\.\-_]+">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">{% trans "FQDN / IP" %}</label>
<div class="col-sm-6">
<input type="text" name="hostname" class="form-control"
value="{{ compute.hostname }}" required
pattern="[a-z0-9\.\-_]+">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">{% trans "Username" %}</label>
<div class="col-sm-6">
<input type="text" name="login" class="form-control"
value="{{ compute.login }}">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">{% trans "Password" %}</label>
<div class="col-sm-6">
<input type="password" name="password" class="form-control"
value="{{ compute.password }}">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">{% trans "Close" %}</button>
<button type="submit" class="btn btn-primary"
name="host_edit">{% trans "Edit" %}</button>
</div>
{% endifequal %}
{% ifequal compute.type 2 %}
<div class="modal-body">
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
<p class="modal-body">{% trans "Need create ssh <a href='https://github.com/retspen/webvirtmgr/wiki/Setup-SSH-Authorization'>authorization key</a>. If you have another SSH port on your server, you can add IP:PORT like '192.168.1.1:2222'." %}</p>
<div class="form-group">
<label class="col-sm-4 control-label">{% trans "Label" %}</label>
<div class="col-sm-6">
<input type="hidden" name="host_id" value="{{ host.id }}">
<input type="text" name="name" class="form-control"
value="{{ host.name }}" maxlength="20" required
pattern="[a-z0-9\.\-_]+">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">{% trans "FQDN / IP" %}</label>
<div class="col-sm-6">
<input type="text" name="hostname" class="form-control"
value="{{ host.hostname }}" required
pattern="[a-z0-9\:\.\-_]+">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">{% trans "Username" %}</label>
<div class="col-sm-6">
<input type="text" name="login" class="form-control"
value="{{ host.login }}">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">{% trans "Close" %}</button>
<button type="submit" class="btn btn-primary"
name="host_edit">{% trans "Edit" %}</button>
</div>
{% endifequal %}
{% ifequal compute.type 3 %}
<div class="modal-body">
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
<div class="form-group">
<label class="col-sm-4 control-label">{% trans "Label" %}</label>
<div class="col-sm-6">
<input type="hidden" name="host_id" value="{{ host.id }}">
<input type="text" name="name" class="form-control"
value="{{ host.name }}" maxlength="20" required
pattern="[a-z0-9\.\-_]+">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">{% trans "FQDN / IP" %}</label>
<div class="col-sm-6">
<input type="text" name="hostname" class="form-control"
value="{{ host.hostname }}" required
pattern="[a-z0-9\:\.\-_]+">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">{% trans "Username" %}</label>
<div class="col-sm-6">
<input type="text" name="login" class="form-control"
placeholder="{% trans "Name" %}">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">{% trans "Password" %}</label>
<div class="col-sm-6">
<input type="password" name="password" class="form-control"
value="{{ host.password }}">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">{% trans "Close" %}</button>
<button type="submit" class="btn btn-primary"
name="host_tls_add">{% trans "Add" %}</button>
</div>
{% endifequal %}
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
</div>
</div>
{% endfor %}
{% else %}
<div class="col-sm-12">
<div class="well">
<h4>{% trans "You have no connection" %}</h4>
</div>
</div>
{% endif %}
</div>
</div>
</div>
</div>
{% include 'footer.html' %}

17
templates/dashboard.html Normal file
View file

@ -0,0 +1,17 @@
{% load static %}
{% include 'header.html' %}
<body>
<div class="container-fluid">
<div class="row">
{% include 'sidebar.html' %}
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 class="page-header">Dashboard</h1>
</div>
</div>
</div>
{% include 'footer.html' %}

3
templates/footer.html Normal file
View file

@ -0,0 +1,3 @@
{% load static %}
<script src="{% static "js/jquery.min.js" %}"></script>
<script src="{% static "js/bootstrap.min.js" %}"></script>

17
templates/header.html Normal file
View file

@ -0,0 +1,17 @@
{% load static %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="{% static "favicon.ico" %}">
<title>Dashboard Template for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="{% static "css/dashboard.css" %}" rel="stylesheet">
</head>

110
templates/instances.html Normal file
View file

@ -0,0 +1,110 @@
{% load static %}
{% load i18n %}
{% include 'header.html' %}
<body>
<div class="container-fluid">
<div class="row">
{% include 'sidebar.html' %}
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<button type="button" class="btn btn-success pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
<h1 class="page-header">Instances</h1>
<div class="alert alert-danger alert-dismissible" role="danger">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<strong>Error:</strong> Better check yourself, you're not looking too good.
</div>
<div class="table-responsive">
<table class="table">
<thead>
<tr class="active">
<th>Name</th>
<th>Host</th>
<th>Status</th>
<th style="width:164px;">Actions</th>
</tr>
</thead>
<tbody>
{% for host, inst in all_host_vms.items %}
{% for vm, info in inst.items %}
<tr>
<td>
<span class="glyphicon glyphicon-th" aria-hidden="true"></span> <a href="{% url 'instance' host.0 vm %}">{{ vm }}</a>
</td>
<td>
<span class="glyphicon glyphicon-tasks" aria-hidden="true"></span> <a href="{% url 'compute' host.0 %}">{{ host.1 }}</a>
</td>
<td>{% ifequal info.status 1 %}
<span class="label label-success">{% trans "Running" %}</span>
{% endifequal %}
{% ifequal info.status 5 %}
<span class="label label-danger">{% trans "Shutoff" %}</span>
{% endifequal %}
{% ifequal info.status 3 %}
<span class="label label-warning">{% trans "Suspend" %}</span>
{% endifequal %}
</td>
<td><form action="" method="post" role="form">{% csrf_token %}
<input type="hidden" name="name" value="{{ info.name }}"/>
<input type="hidden" name="compute" value="{{ host.0 }}"/>
{% ifequal info.status 5 %}
<button class="btn btn-sm btn-default" type="submit" name="start" title="Start">
<span class="glyphicon glyphicon-play"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}">
<span class="glyphicon glyphicon-pause"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Destroy" %}">
<span class="glyphicon glyphicon-stop"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</button>
{% endifequal %}
{% ifequal info.status 3 %}
<button class="btn btn-sm btn-default" type="submit" name="resume"
title="{% trans "Resume" %}">
<span class="glyphicon glyphicon-play"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}">
<span class="glyphicon glyphicon-pause"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Destroy" %}">
<span class="glyphicon glyphicon-stop"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</button>
{% endifequal %}
{% ifequal info.status 1 %}
<button class="btn btn-sm btn-default disabled" title="{% trans "Start" %}">
<span class="glyphicon glyphicon-play"></span>
</button>
<button class="btn btn-sm btn-default" type="submit" name="suspend"
title="{% trans "Suspend" %}">
<span class="glyphicon glyphicon-pause"></span>
</button>
<button class="btn btn-sm btn-default" type="submit" name="destroy"
title="{% trans "Destroy" %}" onclick="return confirm('Are you sure?')">
<span class="glyphicon glyphicon-stop"></span>
</button>
<a href="#" class="btn btn-sm btn-default"
onclick='open_console("{{ host.0 }}-{{ info.uuid }}")' title="{% trans "Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</a>
{% endifequal %}
</form>
</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% include 'footer.html' %}

15
templates/sidebar.html Normal file
View file

@ -0,0 +1,15 @@
{% load i18n %}
{% load tags_active %}
<div class="col-sm-3 col-md-2 sidebar">
<a class="logo" href="{% url 'instances' %}">WebVirtCloud</a>
<hr>
<ul class="nav nav-sidebar">
<li {% active request "^/instance" %}><a href="{% url 'instances' %}"><span class="glyphicon glyphicon-th" aria-hidden="true"></span></a></li>
<li {% active request "^/compute" %}><a href="{% url 'computes' %}"><span class="glyphicon glyphicon-tasks" aria-hidden="true"></span></a></li>
<li {% active request "^/accaunt" %}><a href="#"><span class="glyphicon glyphicon-user" aria-hidden="true"></span></a></li>
<li class="bottom-sticky">
<a href="#"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span></a>
<a href="{% url 'logout' %}"><span class="glyphicon glyphicon-log-out" aria-hidden="true"></span></a>
</li>
</ul>
</div>