mirror of
https://github.com/dkmstr/openuds.git
synced 2024-12-22 13:34:04 +03:00
Dashboard upgrade & enhacements
This commit is contained in:
parent
cc72b3742f
commit
00e85357cf
File diff suppressed because one or more lines are too long
@ -129,6 +129,12 @@ gui.authenticators.link = (event) ->
|
||||
"xls"
|
||||
"permissions"
|
||||
]
|
||||
|
||||
onRefresh: (tbl) ->
|
||||
gui.doLog 'Refresh called for authenticators'
|
||||
clearDetails()
|
||||
return
|
||||
|
||||
onRowDeselect: (deselected, dtable) ->
|
||||
clearDetails()
|
||||
return
|
||||
|
@ -275,6 +275,11 @@ gui.calendars.link = ->
|
||||
icon: 'calendars'
|
||||
container: "calendars-placeholder"
|
||||
rowSelect: "single"
|
||||
|
||||
onRefresh: (tbl) ->
|
||||
clearRules()
|
||||
return
|
||||
|
||||
onRowSelect: (selected) ->
|
||||
clearRules()
|
||||
$("#detail-placeholder").removeClass "hidden"
|
||||
|
@ -5,16 +5,42 @@ gui.connectivity =
|
||||
|
||||
gui.connectivity.link = (event) ->
|
||||
"use strict"
|
||||
|
||||
clearDetails = ->
|
||||
$("#detail-placeholder").addClass "hidden"
|
||||
|
||||
api.templates.get "connectivity", (tmpl) ->
|
||||
gui.clearWorkspace()
|
||||
gui.appendToWorkspace api.templates.evaluate(tmpl,
|
||||
transports: "transports-placeholder"
|
||||
networks: "networks-placeholder"
|
||||
transport_info: 'transports-info-placeholder'
|
||||
)
|
||||
gui.connectivity.transports.table
|
||||
icon: 'transports'
|
||||
rowSelect: "single"
|
||||
container: "transports-placeholder"
|
||||
rowSelect: "multi"
|
||||
|
||||
onRefresh: (tbl) ->
|
||||
clearDetails()
|
||||
|
||||
onRowDeselect: (deselected, dtable) ->
|
||||
if dtable.rows({selected: true}).count() != 1
|
||||
clearDetails()
|
||||
return
|
||||
|
||||
onRowSelect: (selected) ->
|
||||
if selected.length > 1
|
||||
clearDetails()
|
||||
return
|
||||
|
||||
clearDetails()
|
||||
$("#detail-placeholder").removeClass "hidden"
|
||||
$('#detail-placeholder a[href="#transports-info-placeholder"]').tab('show')
|
||||
|
||||
# Load osmanager "info"
|
||||
gui.methods.typedShow gui.connectivity.transports, selected[0], '#transports-info-placeholder .well', gettext('Error accessing data')
|
||||
|
||||
buttons: [
|
||||
"new"
|
||||
"edit"
|
||||
@ -28,7 +54,7 @@ gui.connectivity.link = (event) ->
|
||||
|
||||
gui.connectivity.networks.table
|
||||
icon: 'networks'
|
||||
rowSelect: "single"
|
||||
rowSelect: "multi"
|
||||
container: "networks-placeholder"
|
||||
buttons: [
|
||||
"new"
|
||||
|
@ -18,6 +18,9 @@ gui.osmanagers.link = (event) ->
|
||||
container: "osmanagers-placeholder"
|
||||
rowSelect: "multi"
|
||||
|
||||
onRefresh: (tbl) ->
|
||||
clearDetails()
|
||||
|
||||
onRowDeselect: (deselected, dtable) ->
|
||||
if dtable.rows({selected: true}).count() != 1
|
||||
clearDetails()
|
||||
|
@ -3,6 +3,9 @@ gui.providers = new GuiElement(api.providers, "provi")
|
||||
gui.providers.link = (event) ->
|
||||
"use strict"
|
||||
|
||||
maintenanceText = (icon, text) ->
|
||||
'<span class="fa ' + icon + '"> </span> <span class="label-tbl-button">' + text + '</span>'
|
||||
|
||||
# Button definition to trigger "Test" action
|
||||
testButton = testButton:
|
||||
text: gettext("Test")
|
||||
@ -59,12 +62,16 @@ gui.providers.link = (event) ->
|
||||
onCheck: (check, items) -> # Check if item can be deleted
|
||||
true
|
||||
|
||||
onRefresh: (tbl) ->
|
||||
clearDetails()
|
||||
return
|
||||
|
||||
onData: (data) ->
|
||||
$.each data, (index, value) ->
|
||||
if value.maintenance_mode is true
|
||||
value.maintenance_state = gettext('In Maintenance')
|
||||
else
|
||||
value.maintenance_state = gettext('Normal')
|
||||
value.maintenance_state = gettext('Active')
|
||||
|
||||
return
|
||||
|
||||
@ -146,7 +153,7 @@ gui.providers.link = (event) ->
|
||||
"edit"
|
||||
{
|
||||
permission: api.permissions.MANAGEMENT
|
||||
text: gettext("Maintenance")
|
||||
text: maintenanceText('fa-ambulance', gettext("Maintenance"))
|
||||
css: "disabled"
|
||||
click: (vals, value, btn, tbl, refreshFnc) ->
|
||||
|
||||
@ -170,12 +177,19 @@ gui.providers.link = (event) ->
|
||||
|
||||
select: (vals, value, btn, tbl, refreshFnc) ->
|
||||
unless vals.length == 1
|
||||
$(btn).removeClass("btn-warning").addClass "disabled"
|
||||
$(btn).empty().append(gettext("Maintenance"))
|
||||
$(btn).removeClass("btn-warning").removeClass("btn-info").addClass "disabled"
|
||||
$(btn).empty().append(maintenanceText('fa-ambulance', gettext("Maintenance")))
|
||||
return
|
||||
val = vals[0]
|
||||
$(btn).removeClass("disabled").addClass "btn-warning"
|
||||
$(btn).empty().append('<div>' + (if val.maintenance_mode is false then gettext('Enter maintenance Mode') else gettext('Exit Maintenance Mode')) + '</div>')
|
||||
if val.maintenance_mode is false
|
||||
content = maintenanceText('fa-ambulance', gettext('Enter maintenance Mode'))
|
||||
cls = 'btn-warning'
|
||||
else
|
||||
content = maintenanceText('fa-truck',gettext('Exit Maintenance Mode'))
|
||||
cls = 'btn-info'
|
||||
|
||||
$(btn).removeClass("disabled").addClass(cls)
|
||||
$(btn).empty().append(content)
|
||||
return
|
||||
}
|
||||
"delete"
|
||||
|
@ -83,6 +83,8 @@
|
||||
# 1.- the selected item data (single object, as got from api...get)
|
||||
# 2.- the event that fired this (new, delete, edit, ..)
|
||||
# 4.- the DataTable that raised the event
|
||||
# onRefesh: ...
|
||||
#
|
||||
table: (tblParams) ->
|
||||
"use strict"
|
||||
tblParams = tblParams or {}
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
gui.config.dataTableButtons =
|
||||
new:
|
||||
text: "<span class=\"fa fa-pencil\"></span> " + gettext("New") + ""
|
||||
text: "<span class=\"fa fa-file\"></span> <span class=\"label-tbl-button\">" + gettext("New") + "</span>"
|
||||
css: "btn btn-action btn-tables"
|
||||
|
||||
edit:
|
||||
|
@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* hoverIntent v1.8.0 // 2014.06.29 // jQuery v1.9.1+
|
||||
* http://cherne.net/brian/resources/jquery.hoverIntent.html
|
||||
*
|
||||
* You may use hoverIntent under the terms of the MIT license. Basically that
|
||||
* means you are free to use hoverIntent as long as this header is left intact.
|
||||
* Copyright 2007, 2014 Brian Cherne
|
||||
*/
|
||||
(function($){$.fn.hoverIntent=function(handlerIn,handlerOut,selector){var cfg={interval:100,sensitivity:6,timeout:0};if(typeof handlerIn==="object"){cfg=$.extend(cfg,handlerIn)}else{if($.isFunction(handlerOut)){cfg=$.extend(cfg,{over:handlerIn,out:handlerOut,selector:selector})}else{cfg=$.extend(cfg,{over:handlerIn,out:handlerIn,selector:handlerOut})}}var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if(Math.sqrt((pX-cX)*(pX-cX)+(pY-cY)*(pY-cY))<cfg.sensitivity){$(ob).off("mousemove.hoverIntent",track);ob.hoverIntent_s=true;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=false;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=$.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type==="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).on("mousemove.hoverIntent",track);if(!ob.hoverIntent_s){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).off("mousemove.hoverIntent",track);if(ob.hoverIntent_s){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.on({"mouseenter.hoverIntent":handleHover,"mouseleave.hoverIntent":handleHover},cfg.selector)}})(jQuery);
|
@ -74,6 +74,7 @@
|
||||
<script src="{% get_static_prefix %}adm/js/bootstrap-select.min.js"></script>
|
||||
<script src="{% get_static_prefix %}adm/js/jquery.validate.min.js"></script>
|
||||
<script src="{% get_static_prefix %}adm/js/jquery.blockUI.js"></script>
|
||||
<script src="{% get_static_prefix %}adm/js/jquery.hoverIntent.minified.js"></script>
|
||||
|
||||
<!-- Flot charts -->
|
||||
<script src="{% get_static_prefix %}adm/js/flot/jquery.flot.min.js"></script>
|
||||
@ -126,15 +127,41 @@
|
||||
<script src="{% get_static_prefix %}adm/js/base64.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function showHideTooltip() {
|
||||
console.log("ShowHide");
|
||||
if( $('.side-nav').attr('class').indexOf('full') != -1) {
|
||||
$('.side-nav li').find('img').tooltip('destroy');
|
||||
} else {
|
||||
$('.side-nav li').each(function(index, element) {
|
||||
var $element = $(element).find('a').eq(0);
|
||||
var title = $element.find('.menu-lnk').eq(0).text();
|
||||
$element.find('img').eq(0).tooltip({
|
||||
placement: 'right',
|
||||
title: title,
|
||||
container: 'body',
|
||||
delay: {
|
||||
show: 200,
|
||||
hide: 100
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$('.side-nav').hover(function(){
|
||||
$('.side-nav').addClass('full');
|
||||
//showHideTooltip();
|
||||
}, function (){
|
||||
$('.side-nav').removeClass('full');
|
||||
$('.side-nav > ul > li.dropdown').removeClass('open');
|
||||
//showHideTooltip();
|
||||
showHideTooltip();
|
||||
$('.side-nav').hoverIntent({
|
||||
over: function() {
|
||||
$('.side-nav').addClass('full');
|
||||
showHideTooltip();
|
||||
},
|
||||
out: function() {
|
||||
$('.side-nav').removeClass('full');
|
||||
$('.side-nav > ul > li.dropdown').removeClass('open');
|
||||
showHideTooltip();
|
||||
},
|
||||
timeout: 200,
|
||||
interval: 500
|
||||
});
|
||||
|
||||
// set default error function
|
||||
|
@ -9,7 +9,7 @@
|
||||
</div><!-- /HEAD PANEL -->
|
||||
|
||||
<div class="widget-body collapse in"> <!-- CONTENT PANEL -->
|
||||
<table class="table table-striped table-hover dt-responsive" id="{{ table_id }}" width="100%">
|
||||
<table class="table table-striped table-hover" id="{{ table_id }}" width="100%">
|
||||
</table>
|
||||
</div><!-- /CONTENT PANEL -->
|
||||
|
||||
|
@ -27,4 +27,21 @@
|
||||
<div class="col-lg-6" id="{{ networks }}">
|
||||
</div>
|
||||
</div>
|
||||
<div id="detail-placeholder" class="row hidden">
|
||||
<div class="col-xs-12">
|
||||
<ul class="bottom_tabs nav nav-tabs">
|
||||
<li class="active"><a href="#{{ transport_info }}" data-toggle="tab">{% endverbatim %}{% trans 'Overview' %}{% verbatim %}</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade in active" id="{{ transport_info }}">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="well">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endverbatim %}
|
@ -68,6 +68,12 @@ body {
|
||||
}
|
||||
}
|
||||
|
||||
.widget-icon.fa-refresh {
|
||||
&:hover {
|
||||
animation: 2s linear 0s normal none infinite running fa-spin;
|
||||
}
|
||||
}
|
||||
|
||||
.panel-icon {
|
||||
margin-left: 0.6em !important;
|
||||
cursor: pointer;
|
||||
|
@ -1719,8 +1719,9 @@ dn=ou=[^,]*,.*?ou=([^,]*)
|
||||
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/collapse.js"></script>
|
||||
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/tab.js"></script>
|
||||
<!-- endbuild -->
|
||||
|
||||
|
||||
|
||||
<script src="js/jquery.hoverIntent.minified.js"></script>
|
||||
<script src="js/datatables.min.js"></script>
|
||||
<script src="js/bootstrap-switch.min.js"></script>
|
||||
<script src="js/jquery.bootstrap-touchspin.js"></script>
|
||||
@ -1730,16 +1731,43 @@ dn=ou=[^,]*,.*?ou=([^,]*)
|
||||
<!-- endbuild -->
|
||||
|
||||
<script>
|
||||
function showHideTooltip() {
|
||||
console.log("ShowHide");
|
||||
if( $('.side-nav').attr('class').indexOf('full') != -1) {
|
||||
$('.side-nav li').find('img').tooltip('destroy');
|
||||
} else {
|
||||
$('.side-nav li').each(function(index, element) {
|
||||
var $element = $(element).find('a').eq(0);
|
||||
var title = $element.find('.menu-lnk').eq(0).text();
|
||||
$element.find('img').eq(0).tooltip({
|
||||
placement: 'right',
|
||||
title: title,
|
||||
container: 'body',
|
||||
delay: {
|
||||
show: 200,
|
||||
hide: 100
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$('input:checkbox').bootstrapSwitch();
|
||||
$('.side-nav').hover(function(){
|
||||
$('.side-nav').addClass('full');
|
||||
//showHideTooltip();
|
||||
}, function (){
|
||||
$('.side-nav').removeClass('full');
|
||||
$('.side-nav > ul > li.dropdown').removeClass('open');
|
||||
//showHideTooltip();
|
||||
});
|
||||
showHideTooltip();
|
||||
$('input:checkbox').bootstrapSwitch();
|
||||
$('.side-nav').hoverIntent({
|
||||
over: function() {
|
||||
$('.side-nav').addClass('full');
|
||||
showHideTooltip();
|
||||
},
|
||||
out: function() {
|
||||
$('.side-nav').removeClass('full');
|
||||
$('.side-nav > ul > li.dropdown').removeClass('open');
|
||||
showHideTooltip();
|
||||
},
|
||||
timeout: 500,
|
||||
interval: 800
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* hoverIntent v1.8.0 // 2014.06.29 // jQuery v1.9.1+
|
||||
* http://cherne.net/brian/resources/jquery.hoverIntent.html
|
||||
*
|
||||
* You may use hoverIntent under the terms of the MIT license. Basically that
|
||||
* means you are free to use hoverIntent as long as this header is left intact.
|
||||
* Copyright 2007, 2014 Brian Cherne
|
||||
*/
|
||||
(function($){$.fn.hoverIntent=function(handlerIn,handlerOut,selector){var cfg={interval:100,sensitivity:6,timeout:0};if(typeof handlerIn==="object"){cfg=$.extend(cfg,handlerIn)}else{if($.isFunction(handlerOut)){cfg=$.extend(cfg,{over:handlerIn,out:handlerOut,selector:selector})}else{cfg=$.extend(cfg,{over:handlerIn,out:handlerIn,selector:handlerOut})}}var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if(Math.sqrt((pX-cX)*(pX-cX)+(pY-cY)*(pY-cY))<cfg.sensitivity){$(ob).off("mousemove.hoverIntent",track);ob.hoverIntent_s=true;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=false;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=$.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type==="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).on("mousemove.hoverIntent",track);if(!ob.hoverIntent_s){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).off("mousemove.hoverIntent",track);if(ob.hoverIntent_s){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.on({"mouseenter.hoverIntent":handleHover,"mouseleave.hoverIntent":handleHover},cfg.selector)}})(jQuery);
|
Loading…
Reference in New Issue
Block a user