mirror of
https://github.com/dkmstr/openuds.git
synced 2024-12-22 13:34:04 +03:00
* Added support for multi-level new menu items (for transport for
example, they are going too long...) * Fixed all transports to include group
This commit is contained in:
parent
649a3515fc
commit
387b7f51d4
@ -54,7 +54,7 @@ import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
__updated__ = '2016-04-18'
|
||||
__updated__ = '2016-10-14'
|
||||
|
||||
|
||||
# a few constants
|
||||
@ -189,6 +189,8 @@ class BaseModelHandler(Handler):
|
||||
'description': _(type_.description()),
|
||||
'icon': type_.icon().replace('\n', '')
|
||||
})
|
||||
if hasattr(type_, 'group'):
|
||||
res['group'] = _(type_.group) # Add group info is it is contained
|
||||
return res
|
||||
|
||||
def processTableFields(self, title, fields, row_style): # pylint: disable=no-self-use
|
||||
|
@ -32,7 +32,7 @@
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import ugettext_noop as _
|
||||
|
||||
from uds.core.util import OsDetector
|
||||
from uds.core import Module
|
||||
@ -40,10 +40,12 @@ from uds.core.transports import protocols
|
||||
|
||||
import logging
|
||||
|
||||
__updated__ = '2016-01-20'
|
||||
__updated__ = '2016-10-14'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
DIRECT_GROUP = _('Direct')
|
||||
TUNNELED_GROUP = _('Tunneled')
|
||||
|
||||
class Transport(Module):
|
||||
'''
|
||||
@ -74,6 +76,9 @@ class Transport(Module):
|
||||
# Protocol "type". This is not mandatory, but will help
|
||||
protocol = protocols.NONE
|
||||
|
||||
# For allowing grouping transport on dashboard "new" menu, and maybe other places
|
||||
group = DIRECT_GROUP
|
||||
|
||||
def __init__(self, environment, values):
|
||||
super(Transport, self).__init__(environment, values)
|
||||
self.initialize(values)
|
||||
|
File diff suppressed because one or more lines are too long
@ -50,7 +50,7 @@ gui.connectivity.link = (event) ->
|
||||
return
|
||||
|
||||
buttons: [
|
||||
"new"
|
||||
"new_grouped"
|
||||
"edit"
|
||||
"delete"
|
||||
"xls"
|
||||
|
@ -324,32 +324,47 @@
|
||||
btn = null
|
||||
switch value
|
||||
|
||||
when "new"
|
||||
when "new", "new_grouped"
|
||||
grouped = if value is "new_grouped" then true else false
|
||||
if self.rest.permission() >= api.permissions.MANAGEMENT
|
||||
if not api.tools.isEmpty(self.types)
|
||||
menuId = gui.genRamdonId("dd-")
|
||||
ordered = []
|
||||
$.each self.types, (k, v) ->
|
||||
ordered.push
|
||||
val =
|
||||
type: k
|
||||
css: v.css
|
||||
name: v.name
|
||||
description: v.description
|
||||
group: if v.group? then v.group else null
|
||||
|
||||
ordered.push val
|
||||
|
||||
return
|
||||
|
||||
ordered = ordered.sort((a, b) ->
|
||||
a.name.localeCompare b.name
|
||||
)
|
||||
|
||||
groups = {}
|
||||
if grouped
|
||||
for val in ordered
|
||||
if not groups[val.group]?
|
||||
groups[val.group] = []
|
||||
groups[val.group].push val
|
||||
|
||||
gui.doLog "********** GROUPSS", groups
|
||||
|
||||
btn =
|
||||
type: "div"
|
||||
content: api.templates.evaluate("tmpl_comp_dropdown",
|
||||
content: api.templates.evaluate(
|
||||
if not grouped then "tmpl_comp_dropdown" else "tmpl_comp_dropdown_grouped",
|
||||
label: gui.config.dataTableButtons["new"].text
|
||||
css: gui.config.dataTableButtons["new"].css
|
||||
id: menuId
|
||||
tableId: tableId
|
||||
columns: columns
|
||||
menu: ordered
|
||||
menu: if not grouped then ordered else groups
|
||||
)
|
||||
else
|
||||
btn =
|
||||
|
@ -213,6 +213,7 @@
|
||||
{% js_template 'comp/modal' %}
|
||||
{% js_template 'comp/responsive_table' %}
|
||||
{% js_template 'comp/dropdown' %}
|
||||
{% js_template 'comp/dropdown_grouped' %}
|
||||
|
||||
<!-- overview -->
|
||||
{% js_template 'comp/overview_record' %}
|
||||
|
@ -0,0 +1,21 @@
|
||||
{% load i18n %}
|
||||
{% verbatim %}
|
||||
<div class="dropdown">
|
||||
<button class="{{ css }} dropdown-toggle" type="button" data-toggle="dropdown">
|
||||
{{{ label }}}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropDownMenu">
|
||||
{{# each menu }}
|
||||
<li class="dropdown-submenu">
|
||||
<a href="#">{{ @key }}</a>
|
||||
<ul class="dropdown-menu">
|
||||
{{# each this }}
|
||||
<li role="presentation"><a role="menuitem" tabindex="-1" data-toggle="tooltip" title="{{ description }}" href="#" data-type="{{ type }}"><span class="{{ css }}"></span> {{ name }}</a></li>
|
||||
{{/ each }}
|
||||
</ul>
|
||||
</li>
|
||||
{{/ each }}
|
||||
</ul>
|
||||
</div>
|
||||
{% endverbatim %}
|
@ -39,6 +39,8 @@ from django.http import HttpResponseRedirect
|
||||
|
||||
from uds.core.ui.UserInterface import gui
|
||||
from uds.core.transports.BaseTransport import Transport
|
||||
from uds.core.transports.BaseTransport import TUNNELED_GROUP
|
||||
|
||||
from uds.core.transports import protocols
|
||||
from uds.core.util import connection
|
||||
from uds.core.util import OsDetector
|
||||
@ -64,6 +66,7 @@ class HTML5RDPTransport(Transport):
|
||||
ownLink = True
|
||||
supportedOss = OsDetector.allOss
|
||||
protocol = protocols.RDP
|
||||
group = TUNNELED_GROUP
|
||||
|
||||
guacamoleServer = gui.TextField(label=_('Tunnel Server'), order=1, tooltip=_('Host of the tunnel server (use http/https & port if needed) as accesible from users'), defvalue='https://', length=64, required=True, tab=gui.TUNNEL_TAB)
|
||||
useEmptyCreds = gui.CheckBoxField(label=_('Empty creds'), order=2, tooltip=_('If checked, the credentials used to connect will be emtpy'), tab=gui.CREDENTIALS_TAB)
|
||||
|
@ -37,6 +37,7 @@ from django.utils.translation import ugettext_noop as _
|
||||
from uds.core.managers.UserPrefsManager import CommonPrefs
|
||||
from uds.core.ui.UserInterface import gui
|
||||
from uds.core.transports.BaseTransport import Transport
|
||||
from uds.core.transports.BaseTransport import TUNNELED_GROUP
|
||||
from uds.core.transports import protocols
|
||||
from uds.models import TicketStore
|
||||
from uds.core.util import connection
|
||||
@ -65,6 +66,7 @@ class TSNXTransport(Transport):
|
||||
iconFile = 'nx.png'
|
||||
needsJava = True # If this transport needs java for rendering
|
||||
protocol = protocols.NX
|
||||
group = TUNNELED_GROUP
|
||||
|
||||
tunnelServer = gui.TextField(label=_('Tunnel server'), order=1, tooltip=_('IP or Hostname of tunnel server sent to client device ("public" ip) and port. (use HOST:PORT format)'), tab=gui.TUNNEL_TAB)
|
||||
tunnelCheckServer = gui.TextField(label=_('Tunnel host check'), order=2, tooltip=_('If not empty, this server will be used to check if service is running before assigning it to user. (use HOST:PORT format)'), tab=gui.TUNNEL_TAB)
|
||||
|
@ -35,6 +35,7 @@ from django.utils.translation import ugettext_noop as _
|
||||
from uds.core.managers.UserPrefsManager import CommonPrefs
|
||||
from uds.core.ui.UserInterface import gui
|
||||
from uds.core.transports.BaseTransport import Transport
|
||||
from uds.core.transports.BaseTransport import TUNNELED_GROUP
|
||||
from uds.core.transports import protocols
|
||||
from uds.models import TicketStore
|
||||
from uds.core.util import OsDetector
|
||||
@ -47,7 +48,7 @@ import logging
|
||||
import random
|
||||
import string
|
||||
|
||||
__updated__ = '2016-07-21'
|
||||
__updated__ = '2016-10-14'
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -65,6 +66,7 @@ class TRDPTransport(BaseRDPTransport):
|
||||
typeDescription = _('RDP Transport with tunneled connection')
|
||||
needsJava = True # If this transport needs java for rendering
|
||||
protocol = protocols.RDP
|
||||
group = TUNNELED_GROUP
|
||||
|
||||
tunnelServer = gui.TextField(label=_('Tunnel server'), order=1, tooltip=_('IP or Hostname of tunnel server sent to client device ("public" ip) and port. (use HOST:PORT format)'), tab=gui.TUNNEL_TAB)
|
||||
tunnelCheckServer = gui.TextField(label=_('Tunnel host check'), order=2, tooltip=_('If not empty, this server will be used to check if service is running before assigning it to user. (use HOST:PORT format)'), tab=gui.TUNNEL_TAB)
|
||||
|
@ -34,6 +34,7 @@
|
||||
from django.utils.translation import ugettext_noop as _
|
||||
from uds.core.ui.UserInterface import gui
|
||||
from uds.core.transports.BaseTransport import Transport
|
||||
from uds.core.transports.BaseTransport import TUNNELED_GROUP
|
||||
from uds.core.transports import protocols
|
||||
from uds.core.util import OsDetector
|
||||
from uds.core.util import tools
|
||||
@ -46,7 +47,7 @@ import logging
|
||||
import random
|
||||
import string
|
||||
|
||||
__updated__ = '2016-05-27'
|
||||
__updated__ = '2016-10-14'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -61,6 +62,7 @@ class TSPICETransport(BaseSpiceTransport):
|
||||
typeDescription = _('SPICE Transport for tunneled connection (EXPERIMENTAL)')
|
||||
needsJava = True # If this transport needs java for rendering
|
||||
protocol = protocols.SPICE
|
||||
group = TUNNELED_GROUP
|
||||
|
||||
tunnelServer = gui.TextField(label=_('Tunnel server'), order=1, tooltip=_('IP or Hostname of tunnel server sent to client device ("public" ip) and port. (use HOST:PORT format)'), tab=gui.TUNNEL_TAB)
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
from django.utils.translation import ugettext_noop as _
|
||||
from uds.core.ui.UserInterface import gui
|
||||
from uds.core.transports.BaseTransport import Transport
|
||||
from uds.core.transports.BaseTransport import TUNNELED_GROUP
|
||||
from uds.core.transports import protocols
|
||||
from uds.core.util import OsDetector
|
||||
from uds.core.util import tools
|
||||
@ -45,7 +46,7 @@ import logging
|
||||
import random
|
||||
import string
|
||||
|
||||
__updated__ = '2016-09-07'
|
||||
__updated__ = '2016-10-14'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -59,6 +60,7 @@ class TX2GOTransport(BaseX2GOTransport):
|
||||
typeType = 'TX2GOTransport'
|
||||
typeDescription = _('X2Go Transport for tunneled connection (EXPERIMENTAL)')
|
||||
protocol = protocols.SPICE
|
||||
groups = TUNNELED_GROUP
|
||||
|
||||
tunnelServer = gui.TextField(label=_('Tunnel server'), order=1, tooltip=_('IP or Hostname of tunnel server sent to client device ("public" ip) and port. (use HOST:PORT format)'), tab=gui.TUNNEL_TAB)
|
||||
|
||||
|
@ -175,7 +175,7 @@ body {
|
||||
padding-left: $sidebar-size;
|
||||
-webkit-transition: padding 0.3s; /* For Safari 3.1 to 6.0 */
|
||||
transition: padding 0.3s;
|
||||
|
||||
|
||||
&.full {
|
||||
padding-left: $sidebar-size-collapsed;
|
||||
}
|
||||
@ -194,7 +194,7 @@ body {
|
||||
border-radius: 0;
|
||||
border-color: $navbar-default-border;
|
||||
border-style: solid;
|
||||
border-width: 0 1px 0 0;
|
||||
border-width: 0 1px 0 0;
|
||||
background-color: $navbar-default-bg;
|
||||
-webkit-transition: width 0.3s; /* For Safari 3.1 to 6.0 */
|
||||
transition: width 0.3s;
|
||||
@ -360,6 +360,56 @@ span.tag {
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
/* submenus */
|
||||
.dropdown-submenu {
|
||||
position: relative;
|
||||
>.dropdown-menu {
|
||||
top: 0;
|
||||
left: 100%;
|
||||
margin-top: -6px;
|
||||
margin-left: -1px;
|
||||
-webkit-border-radius: 0 6px 6px 6px;
|
||||
-moz-border-radius: 0 6px 6px 6px;
|
||||
border-radius: 0 6px 6px 6px;
|
||||
}
|
||||
&:hover {
|
||||
>.dropdown-menu {
|
||||
display: block;
|
||||
}
|
||||
>a {
|
||||
&:after {
|
||||
border-left-color: #ffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
>a {
|
||||
&:after {
|
||||
display: block;
|
||||
content: " ";
|
||||
float: right;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-color: transparent;
|
||||
border-style: solid;
|
||||
border-width: 5px 0 5px 5px;
|
||||
border-left-color: #cccccc;
|
||||
margin-top: 5px;
|
||||
margin-right: -10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.dropdown-submenu.pull-left {
|
||||
float: none;
|
||||
>.dropdown-menu {
|
||||
left: -100%;
|
||||
margin-left: 10px;
|
||||
-webkit-border-radius: 6px 0 6px 6px;
|
||||
-moz-border-radius: 6px 0 6px 6px;
|
||||
border-radius: 6px 0 6px 6px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* theme */
|
||||
|
||||
@import "_theme";
|
||||
|
Loading…
Reference in New Issue
Block a user