Use new based theme on bootstrap

This commit is contained in:
ssamson-tis 2015-07-03 16:18:48 +02:00
parent 464c9dd9b1
commit ba022d64d3
16 changed files with 442 additions and 667 deletions

View File

@ -296,7 +296,7 @@ class BackupStat:
self.db=sqlite3.connect(self.dbpath)
self.initdb()
else:
self.db=sqlite3.connect(self.dbpath)
self.db=sqlite3.connect(self.dbpath,check_same_thread=False)
if not "'TYPE'" in str(self.db.execute("select * from stats").description):
self.updatedb()

BIN
static/images/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
static/images/tisbackup.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -0,0 +1,51 @@
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
// IT'S JUST JUNK FOR OUR DOCS!
// ++++++++++++++++++++++++++++++++++++++++++
/*!
* Copyright 2014-2015 Twitter, Inc.
*
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
* details, see https://creativecommons.org/licenses/by/3.0/.
*/
// Intended to prevent false-positive bug reports about Bootstrap not working properly in old versions of IE due to folks testing using IE's unreliable emulation modes.
(function () {
'use strict';
function emulatedIEMajorVersion() {
var groups = /MSIE ([0-9.]+)/.exec(window.navigator.userAgent)
if (groups === null) {
return null
}
var ieVersionNum = parseInt(groups[1], 10)
var ieMajorVersion = Math.floor(ieVersionNum)
return ieMajorVersion
}
function actualNonEmulatedIEMajorVersion() {
// Detects the actual version of IE in use, even if it's in an older-IE emulation mode.
// IE JavaScript conditional compilation docs: https://msdn.microsoft.com/library/121hztk3%28v=vs.94%29.aspx
// @cc_on docs: https://msdn.microsoft.com/library/8ka90k2e%28v=vs.94%29.aspx
var jscriptVersion = new Function('/*@cc_on return @_jscript_version; @*/')() // jshint ignore:line
if (jscriptVersion === undefined) {
return 11 // IE11+ not in emulation mode
}
if (jscriptVersion < 9) {
return 8 // IE8 (or lower; haven't tested on IE<8)
}
return jscriptVersion // IE9 or IE10 in any mode, or IE11 in non-IE11 mode
}
var ua = window.navigator.userAgent
if (ua.indexOf('Opera') > -1 || ua.indexOf('Presto') > -1) {
return // Opera, which might pretend to be IE
}
var emulated = emulatedIEMajorVersion()
if (emulated === null) {
return // Not IE
}
var nonEmulated = actualNonEmulatedIEMajorVersion()
if (emulated !== nonEmulated) {
window.alert('WARNING: You appear to be using IE' + nonEmulated + ' in IE' + emulated + ' emulation mode.\nIE emulation modes can behave significantly differently from ACTUAL older versions of IE.\nPLEASE DON\'T FILE BOOTSTRAP BUGS based on testing in IE emulation modes!')
}
})();

View File

@ -0,0 +1,23 @@
/*!
* IE10 viewport hack for Surface/desktop Windows 8 bug
* Copyright 2014-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
// See the Getting Started docs for more information:
// http://getbootstrap.com/getting-started/#support-ie10-width
(function () {
'use strict';
if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
var msViewportStyle = document.createElement('style')
msViewportStyle.appendChild(
document.createTextNode(
'@-ms-viewport{width:auto!important}'
)
)
document.querySelector('head').appendChild(msViewportStyle)
}
})();

File diff suppressed because one or more lines are too long

5
static/js/offcanvas.js Normal file
View File

@ -0,0 +1,5 @@
$(document).ready(function () {
$('[data-toggle="offcanvas"]').click(function () {
$('.row-offcanvas').toggleClass('active')
});
});

View File

@ -0,0 +1,59 @@
/*
* Style tweaks
* --------------------------------------------------
*/
html,
body {
overflow-x: hidden; /* Prevent scroll on narrow devices */
}
body {
padding-top: 70px;
}
footer {
padding: 30px 0;
}
/*
* Off Canvas
* --------------------------------------------------
*/
@media screen and (max-width: 767px) {
.row-offcanvas {
position: relative;
-webkit-transition: all .25s ease-out;
-o-transition: all .25s ease-out;
transition: all .25s ease-out;
}
.row-offcanvas-right {
right: 0;
}
.row-offcanvas-left {
left: 0;
}
.row-offcanvas-right
.sidebar-offcanvas {
right: -50%; /* 6 columns */
}
.row-offcanvas-left
.sidebar-offcanvas {
left: -50%; /* 6 columns */
}
.row-offcanvas-right.active {
right: 50%; /* 6 columns */
}
.row-offcanvas-left.active {
left: 50%; /* 6 columns */
}
.sidebar-offcanvas {
position: absolute;
top: 0;
width: 50%; /* 6 columns */
}
}

View File

@ -1,449 +0,0 @@
/*
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License
*/
body {
margin: 0;
padding: 0;
background: #FFFFFF url(/static/images/img01.jpg) repeat-x left top;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #787878;
}
h1, h2, h3 {
margin: 0;
padding: 0;
font-weight: normal;
color: #32639A;
}
h1 {
font-size: 2em;
}
h2 {
font-size: 2.4em;
}
h3 {
font-size: 1.6em;
}
p, ul, ol {
margin-top: 0;
line-height: 180%;
}
ul, ol {
}
.error {
color: red;
font-size: 1.4em;
}
.info {
color: orange;
font-size: 1.3em;
margin-top: 5px;
}
.center-img{
vertical-align: middle;
}
a {
text-decoration: none;
color: #4486C7;
}
a:hover {
}
#wrapper {
width: 960px;
margin: 0 auto;
padding: 0;
}
/* Header */
#header {
width: 940px;
height: 148px;
margin: 0 auto;
background: url(/static/images/logo-tis.png) no-repeat left 20px;
}
/* Logo */
#logo {
float: left;
margin: 0;
padding-top: 30px;
color: #000000;
}
#logo h1, #logo p {
margin: 0;
padding: 0;
}
#logo h1 {
float: left;
padding-left: 80px;
letter-spacing: -1px;
font-size: 3.8em;
}
#logo p {
float: left;
margin: 0;
padding: 26px 0 0 10px;
font: normal 14px Georgia, "Times New Roman", Times, serif;
font-style: italic;
color: #FFFFFF;
}
#logo a {
border: none;
background: none;
text-decoration: none;
color: #FFFFFF;
}
/* Menu */
#menu {
float: left;
width: 100%;
height: 49px;
margin: 0 auto;
padding: 0;
position: relative;
}
#menu ul {
float: left;
margin: 0;
padding: 0;
list-style: none;
left:50%;
line-height: normal;
position: relative;
}
#menu ul li{
float: left;
position:relative;
right:50%;
}
#menu li {
position: relative;
}
#menu a {
display: block;
width: 155px;
height: 33px;
padding-top: 16px;
text-decoration: none;
text-align: center;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: bold;
color: #FFFFFF;
border: none;
}
#menu a:hover, #menu .current_page_item a {
background: #659CEF url(/static/images/img03.jpg) repeat-x left bottom;
text-decoration: none;
}
#menu .current_page_item a {
background: #FBFBFC url(/static/images/img02.jpg) repeat-x left bottom;
padding-left: 0;
color: #30476A;
}
/* Page */
#page {
width: 100%;
margin: 0 auto;
padding: 0;
}
#page-bgtop {
padding: 20px px;
}
#page-bgbtm {
}
/* Content */
#content {
width: 100%;
float: left;
padding: 30px 0px 0px 0px;
}
#content h2{
margin-left: 30px;
}
#content h3{
margin-left: 60px;
}
h4{
padding-left: 150px;
}
.post {
margin-bottom: 15px;
}
.post-bgtop {
}
.post-bgbtm {
}
.post .title {
margin-bottom: 10px;
padding: 12px 0 0 0px;
letter-spacing: -.5px;
color: #32639A;
}
.post .title a {
color: #32639A;
border: none;
}
.post .meta {
height: 30px;
background: #D8E7FE;
margin: 0px;
padding: 0px 0px 0px 0px;
text-align: left;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: bold;
}
.post .meta .date {
float: left;
height: 24px;
padding: 3px 15px;
color: #4A81DE;
}
.post .meta .posted {
float: right;
height: 24px;
padding: 3px 15px;
background: #A8CF64;
color: #FFFFFF;
}
.post .meta a {
color: #FFFFFF;
}
.post .entry {
padding: 0px 0px 20px 0px;
padding-bottom: 20px;
text-align: justify;
}
.links {
padding-top: 20px;
font-size: 12px;
font-weight: bold;
}
/* Sidebar */
#sidebar {
float: right;
width: 280px;
padding: 0px;
color: #787878;
background: #FFFFFF;
}
#sidebar ul {
margin: 0;
padding: 0;
list-style: none;
}
#sidebar li {
margin: 0;
padding: 0;
border-left: 1px solid #E2E2E2;
}
#sidebar li ul {
margin: 0px 0px;
padding-bottom: 30px;
}
#sidebar li li {
line-height: 35px;
border-bottom: 1px dashed #D1D1D1;
margin: 0px 30px;
border-left: none;
}
#sidebar li li span {
display: block;
margin-top: -20px;
padding: 0;
font-size: 11px;
font-style: italic;
}
#sidebar h2 {
height: 38px;
padding-left: 30px;
letter-spacing: -.5px;
font-size: 1.8em;
}
#sidebar p {
margin: 0 0px;
padding: 0px 30px 20px 30px;
text-align: justify;
}
#sidebar a {
border: none;
}
#sidebar a:hover {
text-decoration: underline;
color: #8A8A8A;
}
/* Footer */
#footer {
height: 50px;
margin: 0 auto;
padding: 0px 0 15px 0;
background: #D8E7FE;
border-top: 1px solid #D3DEF0;
font-family: Arial, Helvetica, sans-serif;
}
#footer p {
margin: 0;
padding-top: 20px;
line-height: normal;
font-size: 10px;
text-transform: uppercase;
text-align: center;
color: #A0A0A0;
}
#footer a {
color: #5389E0;
}
td.loading {
/*text-align: center;*/
vertical-align: center;
}
table.sample {
border-width: 1px;
border-spacing: 1px;
border-style: outset;
border-color: green;
border-collapse: collapse;
background-color: white;
}
table.sample th {
border-width: 1px;
padding: 1px;
border-style: inset;
border-color: gray;
background-color: white;
-moz-border-radius: ;
}
table.sample td {
border-width: 1px;
padding: 1px;
border-style: inset;
border-color: gray;
background-color: white;
-moz-border-radius: ;
}
/*Tables*/
#table-design {
margin: 0 auto;
background-color: whiteSmoke;
border-radius: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
}
#table-design td, #table-design th {
}
#table-design th {
color: #333;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 16px;
font-style: normal;
font-weight: normal;
padding: 0 20px;
}
#table-design td {
padding: 0 20px;
line-height: 20px;
color: #0084B4;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 14px;
border-bottom: 1px solid #fff;
border-top: 1px solid #fff;
}
#table-design tr:hover {
background-color: #fff;
}
P.message {
display: inline;
margin: 0 auto;
margin-left: auto;
margin-right: auto;
/*width: 6em;*/
background-color: whiteSmoke;
border-radius: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
font-size: 14px;
color: #0084B4;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
#mouter{
position:relative;
left:50%;
float:left;
clear:both;
margin:10px 0;
text-align:left;
}
#minner{
background-color: whiteSmoke;
border-radius: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
padding:5px 20px;
position:relative;
left:-50%;
text-align:left;
font-size: 14px;
color: #0084B4;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

View File

@ -1,71 +1,106 @@
{% extends "layout.html" %}
{% block content %}
<div class="accordion" id="accordion2">
{% if backup_list['rsync_ssh_list']|count != 0 %}
<h2 class="title">Rsync+ssh</h2>
<table id="table-design">
<thead>
<th>Server</th>
<th>Backup</th>
<th>Directory</th>
</thead>
</tbody>
{% for entry in backup_list['rsync_ssh_list'] %}
<tr>
<td>{{ entry[0] }}</td>
<td>{{ entry[1] }}</td>
<td>{{ entry[3] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse1"><h2 >Type: rsync+ssh</h2></a>
</div>
<div id="collapse1" class="accordion-body collapse in">
<div class="accordion-inner">
<table class="table table-bordered">
<thead>
<th>Server</th>
<th>Backup</th>
<th>Directory</th>
</thead>
</tbody>
{% for entry in backup_list['rsync_ssh_list'] %}
<tr>
<td>{{ entry[0] }}</td>
<td>{{ entry[1] }}</td>
<td>{{ entry[3] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
{% if backup_list['rsync_btrfs_list']|count != 0 %}
<h2 class="title">rsync+btrfs+ssh</h2>
<table id="table-design">
<thead>
<th>Server</th>
<th>Backup</th>
<th>Directory</th>
</thead>
</tbody>
{% for entry in backup_list['rsync_btrfs_list'] %}
<tr>
<td>{{ entry[0] }}</td>
<td>{{ entry[1] }}</td>
<td>{{ entry[3] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse2"><h2 >Type: rsync+btrfs+ssh</h2></a>
</div>
<div id="collapse2" class="accordion-body collapse ">
<div class="accordion-inner">
<table class="table table-bordered">
<thead>
<th>Server</th>
<th>Backup</th>
<th>Directory</th>
</thead>
</tbody>
{% for entry in backup_list['rsync_btrfs_list'] %}
<tr>
<td>{{ entry[0] }}</td>
<td>{{ entry[1] }}</td>
<td>{{ entry[3] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
{% if backup_list['rsync_list']|count != 0 %}
<h2 class="title">Rsync</h2>
<table id="table-design">
<thead>
<th>Server</th>
<th>Backup</th>
<th>Directory</th>
</thead>
</tbody>
{% for entry in backup_list['rsync_list'] %}
<tr>
<td>{{ entry[0] }}</td>
<td>{{ entry[1] }}</td>
<td>{{ entry[3] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse3"><h2>Type: rsync</h2></a>
</div>
<div id="collapse3" class="accordion-body collapse ">
<div class="accordion-inner">
<table class="table table-bordered">
<thead>
<th>Server</th>
<th>Backup</th>
<th>Directory</th>
</thead>
</tbody>
{% for entry in backup_list['rsync_list'] %}
<tr>
<td>{{ entry[0] }}</td>
<td>{{ entry[1] }}</td>
<td>{{ entry[3] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
{% if backup_list['pgsql_list']|count != 0 %}
<h2 class="title">pgSQL</h2>
<table id="table-design">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse4"><h2>Type: pgsql</h2></a>
</div>
<div id="collapse4" class="accordion-body collapse ">
<div class="accordion-inner">
<table class="table table-bordered">
<thead>
<th>Server</th>
<th>Backup</th>
@ -81,12 +116,20 @@
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
{% if backup_list['mysql_list']|count != 0 %}
<h2 class="title">SQL Server</h2>
<table id="table-design">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse5"><h2>Type: mysql</h2></a>
</div>
<div id="collapse5" class="accordion-body collapse ">
<div class="accordion-inner">
<table class="table table-bordered">
<thead>
<th>Server</th>
<th>Backup</th>
@ -102,11 +145,19 @@
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
{% if backup_list['sqlserver_list']|count != 0 %}
<h2 class="title">SQL Server</h2>
<table id="table-design">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse6"><h2>Type: SQLserver</h2></a>
</div>
<div id="collapse6" class="accordion-body collapse ">
<div class="accordion-inner">
<table class="table table-bordered">
<thead>
<th>Server</th>
<th>Backup</th>
@ -122,11 +173,19 @@
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
{% if backup_list['xva_list']|count != 0 %}
<h2 class="title">XVA</h2>
<table id="table-design">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse7"><h2>Type: Exports XVA</h2></a>
</div>
<div id="collapse7" class="accordion-body collapse ">
<div class="accordion-inner">
<table class="table table-bordered">
<thead>
<th>Server</th>
<th>Backup</th>
@ -140,11 +199,19 @@
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
{% if backup_list['metadata_list']|count != 0 %}
<h2 class="title">XCP Metadata</h2>
<table id="table-design">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse8"><h2>Type: XCP Metadata</h2></a>
</div>
<div id="collapse8" class="accordion-body collapse ">
<div class="accordion-inner">
<table class="table table-bordered">
<thead>
<th>Server</th>
<th>Backup</th>
@ -158,11 +225,19 @@
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
{% if backup_list['switch_list']|count != 0 %}
<h2 class="title">Switchs</h2>
<table id="table-design">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse9"><h2>Type: Switchs</h2></a>
</div>
<div id="collapse9" class="accordion-body collapse ">
<div class="accordion-inner">
<table class="table table-bordered">
<thead>
<th>Server</th>
<th>Backup</th>
@ -176,24 +251,12 @@
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
{% if backup_list['null_list']|count != 0 %}
<h2 class="title">Null</h2>
<table id="table-design">
<thead>
<th>Server</th>
<th>Backup</th>
</thead>
<tbody>
{% for entry in backup_list['null_list'] %}
<tr>
<td>{{ entry[0] }}</td>
<td>{{ entry[1] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
{% endblock %}

View File

@ -42,6 +42,12 @@
<p> Select backups to save : <br/> <br/>
Select all <input type="checkbox" id="selectall" checked="true"><br /><br/>
{% for entry in sections|sort %}
<div class="col-xs-6 col-md-4">
<div class="form-group">
<div class="checkbox"><label><input type="checkbox" class="checkbox1" value="{{entry}}" checked>{{entry}}</label></div>
</div>
</div>
<input type="checkbox" name="sections" class="checkbox1" value="{{entry}}" checked="true">{{entry}} <br />
{% endfor %}
<p>

View File

@ -1,5 +1,7 @@
{% extends "layout.html" %}
{% block content %}
<link rel="stylesheet" type="text/css" href="/static/styles/jquery.dataTables.css">
<script type=text/javascript src="/static/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var oTable = $('#table-design').dataTable( {
@ -59,7 +61,6 @@
{ "mData":"TYPE" , "bVisible": false }
],
"fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) {
//humanFileSize(aaData[1]['written_bytes'], true)
var total_bytes = 0;
var total_time = 0;
for (var i = iStart; i < iEnd; i++) {
@ -158,7 +159,7 @@
}
};
</script>
<table style='text-align: center;' cellpadding="0" cellspacing="0" border="0" class="display" id="table-design">
<table style='text-align: center;' cellpadding="0" cellspacing="0" border="0" class="display" id="table-design">
<thead style='text-align: center;'>
<tr>
<th>Backup start</th>
@ -191,33 +192,40 @@
</tr>
</tfoot>
</table>
<br / >
<p>Nomber of rows per page : <input id="inputDatabaseName" value=25 size=4 style="text-align:center" ></p>
<p>
Backup start<input type="checkbox" onclick="fnShowHide( 0 );"/>
Backup end<input type="checkbox" onclick="fnShowHide( 1 );"/>
Server name<input type="checkbox" onclick="fnShowHide( 2 );"/>
Backup name<input type="checkbox" onclick="fnShowHide( 3 );"/>
Backup duration<input type="checkbox" onclick="fnShowHide( 4 );"/>
Status<input type="checkbox" onclick="fnShowHide( 5 );"/>
<br />
Written bytes<input type="checkbox" onclick="fnShowHide( 6 );"/>
Written files count<input type="checkbox" onclick="fnShowHide( 7 );"/>
Total files count<input type="checkbox" onclick="fnShowHide( 8 );"/>
Total bytes <input type="checkbox" onclick="fnShowHide( 9 );"/>
<br />
Backup location<input type="checkbox" onclick="fnShowHide( 10 );"/>
Description<input type="checkbox" onclick="fnShowHide( 11 );"/>
Log<input type="checkbox" onclick="fnShowHide( 12 );"/>
Type<input type="checkbox" onclick="fnShowHide( 13 );"/>
<form class="form-horizontal">
<div class="col-xs-6 col-md-4">
<div class="form-group">
<div class="checkbox"><label><input type="checkbox" onclick="fnShowHide( 0 );" checked> Backup start</label></div>
<div class="checkbox"><label><input type="checkbox" onclick="fnShowHide( 1 );"/> Backup end</label></div>
<div class="checkbox"><label><input type="checkbox" onclick="fnShowHide( 2 );" checked> Server name</label></div>
<div class="checkbox"><label><input type="checkbox" onclick="fnShowHide( 3 );" checked> Backup name</label></div>
<div class="checkbox"><label><input type="checkbox" onclick="fnShowHide( 4 );" checked> Backup duration</label></div>
</div>
</div>
<div class="col-xs-6 col-md-4">
<div class="form-group">
<div class="checkbox"><label><input type="checkbox" onclick="fnShowHide( 6 );"checked> Written bytes</label></div>
<div class="checkbox"><label><input type="checkbox" onclick="fnShowHide( 7 );"/> Written files count</label></div>
<div class="checkbox"><label><input type="checkbox" onclick="fnShowHide( 8 );"/> Total files count</label></div>
<div class="checkbox"><label><input type="checkbox" onclick="fnShowHide( 9 );"/> Total bytes</label></div>
</div>
</div>
<div class="col-xs-6 col-md-4">
<div class="form-group">
<div class="checkbox"><label><input type="checkbox" onclick="fnShowHide( 10 );"> Backup location</label></div>
<div class="checkbox"><label><input type="checkbox" onclick="fnShowHide( 11);">Description </label></div>
<div class="checkbox"><label><input type="checkbox" onclick="fnShowHide( 12);"> Log</label></div>
<div class="checkbox"><label><input type="checkbox" onclick="fnShowHide( 13 );">Type </label></div>
<div class="checkbox"><label><input type="checkbox" onclick="fnShowHide( 5 );"checked> Status</label></div>
</div>
</div>
</form>
</p>
<script>
$('input:checkbox').attr('checked', false);
$('input:checkbox:eq(0)').attr('checked', true);
$('input:checkbox:eq(2)').attr('checked', true);
$('input:checkbox:eq(3)').attr('checked', true);
$('input:checkbox:eq(4)').attr('checked', true);
$('input:checkbox:eq(5)').attr('checked', true);
$('input:checkbox:eq(6)').attr('checked', true);
</script>
{% endblock %}

View File

@ -1,103 +1,102 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License
<!DOCTYPE html>
<html lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="/static/images/favicon.ico">
Name : Indication
Description: A two-column, fixed-width design with dark color scheme.
Version : 1.0
Released : 20090910
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Tisbackup GUI</title>
<!-- Styles -->
<link rel="stylesheet" type="text/css" href="/static/styles/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="/static/styles/style.css">
<link rel="stylesheet" type="text/css" href="/static/styles/bootstrap.min.css">
<!-- Scripts -->
<script type=text/javascript src="/static/js/jquery.min.js"></script>
<script type=text/javascript src="/static/js/jquery.dataTables.js"></script>
<script type=text/javascript src="/static/js/bootbox.js"></script>
<script type=text/javascript src="/static/js/bootstrap.min.js"></script>
</head>
<body background='/static/images/bg_body.gif'>
<div id="wrapper">
<div id="header">
<div id="logo">
<h1><a href="/">TIS Backup GUI</a></h1>
<p> design by Hübert</p>
</div>
</div>
<!-- end #header -->
<div id="menu">
<ul>
<li><a href="/">Backups</a></li>
<li><a href="/export_backup">Export Backup</a></li>
<li><a href="/last_backups">Last Backups</a></li>
</ul>
</div>
<!-- end #menu -->
<div id="page">
<div id="page-bgtop">
<div id="page-bgbtm">
<div id="choix_conf" style="float:right;margin-top:5px;">
Choix du fichier de configuration :
<select id="config">
</select> </div>
<div id="content">
<div class="post">
{% block content %}
<div id="mouter">
<div id="minner">
<p>Hello World</p>
</div>
</div>
{% endblock %}
</div>
<!-- Bootstrap core CSS -->
<link href="/static/styles/bootstrap.css" rel="stylesheet">
<div style="clear: both;">&nbsp;</div>
</div>
<!-- Custom styles for this template -->
<link href="/static/styles/offcanvas.css" rel="stylesheet">
<script src="/static/js/jquery.js"></script>
<script src="/static/js/bootstrap.js"></script>
<div style="clear: both;">&nbsp;</div>
</head>
<body>
<nav class="navbar navbar-fixed-top navbar-inverse">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!--<a class="navbar-brand" href="#">TIS Backup GUI</a>-->
<a class="navbar-brand" href="#"><img style=" margin-top:-13px;"
src="/static/images/tisbackup.png"></a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li {% if request.path == "/" %}class="active"{% endif %} ><a href="/">Backups</a></li>
<li {% if request.path == "/export_backup" %}class="active"{% endif %}><a href="/export_backup">Export Backups</a></li>
<li {% if request.path == "/last_backups" %}class="active"{% endif %}><a href="/last_backups">Last backups</a></li>
<li ><select class="form-control hidden" id="choix_conf" style=" margin-top:8px;">
</select>
</li>
</ul>
</div><!-- /.nav-collapse -->
</div><!-- /.container -->
</nav><!-- /.navbar -->
<!-- end #page -->
</div>
</div>
<!-- end #footer -->
</div>
<div id="footer">
<p>Copyright (c) 2012 Tranquil IT Systems. All rights reserved. Design by <a href="http://www.tranquil-it-systems.fr/">TIS</a>.</p>
</div>
<script>
function configs(){
$.getJSON("/config_number/", function(data) {
if ( data.configs.length == 1){
$("#choix_conf").hide();
return 0;
}
$.each(data.configs, function(key,val){
if (key == data.config_number)
$('#config').append('<option vaulue="'+key+'" selected>'+val+'</option>');
else
$('#config').append('<option vaulue="'+key+'">'+val+'</option>');
});
});
$( "#config" ).change(function() {
$.get( "/config_number/"+this.selectedIndex, function( data ) {location.reload();});
});
};
configs();
</script>
<div class="container">
<div class="row">
{% block content %}
{% endblock %}
</body>
</html>
</div><!--/row-->
<hr>
<footer>
<p>Copyright (c) 2015 Tranquil IT Systems. All rights reserved. Design by TIS.</p>
</footer>
</div><!--/.container-->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="/static/js/jquery.js"></script> -->
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="/static/js/ie10-viewport-bug-workaround.js"></script>
<script src="/static/js/offcanvas.js"></script>
<script>
function configs(){
$.getJSON("/config_number/", function(data) {
if ( data.configs.length > 1){
$('#choix_conf').removeClass('hidden');
$("#choix_conf").show();
$.each(data.configs, function(key,val){
if (key == data.config_number)
$('#choix_conf').append('<option vaulue="'+key+'" selected>'+val+'</option>');
else
$('#choix_conf').append('<option vaulue="'+key+'">'+val+'</option>');
});
}
});
$( "#choix_conf" ).change(function() {
$.get( "/config_number/"+this.selectedIndex, function( data ) {location.reload();});
});
};
configs();
</script>
</body></html>

View File

@ -30,19 +30,28 @@ from flask import request, Flask, session, g, redirect, url_for, abort, render_
from urlparse import urlparse
import json
import glob
from uwsgidecorators import *
import time
from huey.api import Huey, create_task
from huey.backends.sqlite_backend import SqliteQueue,SqliteDataStore
from tisbackup import tis_backup
import logging
import re
CONFIG = uwsgi.opt['config_tisbackup'].split(",")
"""CONFIG = uwsgi.opt['config_tisbackup'].split(",")
SECTIONS = uwsgi.opt['sections']
ADMIN_EMAIL = uwsgi.opt.get('ADMIN_EMAIL',uwsgi.opt.get('admin_email'))
spooler = uwsgi.opt['spooler']
"""
CONFIG="/home/homes/ssamson/projects/tisbackup/configtest.ini".split(",")
ADMIN_EMAIL="toot@test.fr"
SECTIONS=''
tisbackup_config_file= CONFIG[0]
config_number=0
cp = ConfigParser()
cp.read(tisbackup_config_file)
backup_base_dir = cp.get('global','backup_base_dir')
@ -54,6 +63,10 @@ app = Flask(__name__)
app.secret_key = 'fsiqefiuqsefARZ4Zfesfe34234dfzefzfe'
app.config['PROPAGATE_EXCEPTIONS'] = True
queue = SqliteQueue('tisbackups',os.path.join(tisbackup_root_dir,"tasks.sqlite"))
result_store = SqliteDataStore('tisbackups',os.path.join(tisbackup_root_dir,"tasks.sqlite"))
huey = Huey(queue,result_store)
def read_config():
config_file = CONFIG[config_number]
cp = ConfigParser()
@ -233,7 +246,7 @@ def check_mount_disk(partition_name, refresh):
@app.route('/status.json')
def export_backup_status():
exports = dbstat.query('select * from stats where TYPE="EXPORT" and backup_start>="%s"' % mindate)
return jsonify(data=exports,finish= ( len(os.listdir(spooler)) == 0 ))
return jsonify(data=exports,finish=True)
@app.route('/backups.json')
def last_backup_json():
@ -261,7 +274,7 @@ def export_backup():
if section.count > 0:
sections.append(section[1])
noJobs = ( len(os.listdir(spooler)) == 0 )
noJobs = True
if "start" in request.args.keys() or not noJobs:
start=True
if "sections" in request.args.keys():
@ -291,13 +304,8 @@ def raise_error(strError, strInfo):
error = strError
info = strInfo
def cleanup():
if os.path.isdir(spooler):
print "cleanup ", spooler
rmtree(spooler)
os.mkdir(spooler)
@spool
@huey.task()
def run_export_backup(args):
#Log
logger = logging.getLogger('tisbackup')
@ -323,9 +331,10 @@ def run_export_backup(args):
os.system("/bin/umount %s" % mount_point)
os.rmdir(mount_point)
cleanup()
if __name__ == "__main__":
read_config()
app.debug=True
app.run(host='0.0.0.0',port=8000, debug=True)
from os import environ
if 'WINGDB_ACTIVE' in environ:
app.debug = False
app.run(use_reloader=True)