mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-03 01:17:56 +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__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
__updated__ = '2016-04-18'
|
__updated__ = '2016-10-14'
|
||||||
|
|
||||||
|
|
||||||
# a few constants
|
# a few constants
|
||||||
@ -189,6 +189,8 @@ class BaseModelHandler(Handler):
|
|||||||
'description': _(type_.description()),
|
'description': _(type_.description()),
|
||||||
'icon': type_.icon().replace('\n', '')
|
'icon': type_.icon().replace('\n', '')
|
||||||
})
|
})
|
||||||
|
if hasattr(type_, 'group'):
|
||||||
|
res['group'] = _(type_.group) # Add group info is it is contained
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def processTableFields(self, title, fields, row_style): # pylint: disable=no-self-use
|
def processTableFields(self, title, fields, row_style): # pylint: disable=no-self-use
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
'''
|
'''
|
||||||
from __future__ import unicode_literals
|
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.util import OsDetector
|
||||||
from uds.core import Module
|
from uds.core import Module
|
||||||
@ -40,10 +40,12 @@ from uds.core.transports import protocols
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
__updated__ = '2016-01-20'
|
__updated__ = '2016-10-14'
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
DIRECT_GROUP = _('Direct')
|
||||||
|
TUNNELED_GROUP = _('Tunneled')
|
||||||
|
|
||||||
class Transport(Module):
|
class Transport(Module):
|
||||||
'''
|
'''
|
||||||
@ -74,6 +76,9 @@ class Transport(Module):
|
|||||||
# Protocol "type". This is not mandatory, but will help
|
# Protocol "type". This is not mandatory, but will help
|
||||||
protocol = protocols.NONE
|
protocol = protocols.NONE
|
||||||
|
|
||||||
|
# For allowing grouping transport on dashboard "new" menu, and maybe other places
|
||||||
|
group = DIRECT_GROUP
|
||||||
|
|
||||||
def __init__(self, environment, values):
|
def __init__(self, environment, values):
|
||||||
super(Transport, self).__init__(environment, values)
|
super(Transport, self).__init__(environment, values)
|
||||||
self.initialize(values)
|
self.initialize(values)
|
||||||
|
File diff suppressed because one or more lines are too long
@ -50,7 +50,7 @@ gui.connectivity.link = (event) ->
|
|||||||
return
|
return
|
||||||
|
|
||||||
buttons: [
|
buttons: [
|
||||||
"new"
|
"new_grouped"
|
||||||
"edit"
|
"edit"
|
||||||
"delete"
|
"delete"
|
||||||
"xls"
|
"xls"
|
||||||
|
@ -324,32 +324,47 @@
|
|||||||
btn = null
|
btn = null
|
||||||
switch value
|
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 self.rest.permission() >= api.permissions.MANAGEMENT
|
||||||
if not api.tools.isEmpty(self.types)
|
if not api.tools.isEmpty(self.types)
|
||||||
menuId = gui.genRamdonId("dd-")
|
menuId = gui.genRamdonId("dd-")
|
||||||
ordered = []
|
ordered = []
|
||||||
$.each self.types, (k, v) ->
|
$.each self.types, (k, v) ->
|
||||||
ordered.push
|
val =
|
||||||
type: k
|
type: k
|
||||||
css: v.css
|
css: v.css
|
||||||
name: v.name
|
name: v.name
|
||||||
description: v.description
|
description: v.description
|
||||||
|
group: if v.group? then v.group else null
|
||||||
|
|
||||||
|
ordered.push val
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
ordered = ordered.sort((a, b) ->
|
ordered = ordered.sort((a, b) ->
|
||||||
a.name.localeCompare b.name
|
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 =
|
btn =
|
||||||
type: "div"
|
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
|
label: gui.config.dataTableButtons["new"].text
|
||||||
css: gui.config.dataTableButtons["new"].css
|
css: gui.config.dataTableButtons["new"].css
|
||||||
id: menuId
|
id: menuId
|
||||||
tableId: tableId
|
tableId: tableId
|
||||||
columns: columns
|
columns: columns
|
||||||
menu: ordered
|
menu: if not grouped then ordered else groups
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
btn =
|
btn =
|
||||||
|
@ -213,6 +213,7 @@
|
|||||||
{% js_template 'comp/modal' %}
|
{% js_template 'comp/modal' %}
|
||||||
{% js_template 'comp/responsive_table' %}
|
{% js_template 'comp/responsive_table' %}
|
||||||
{% js_template 'comp/dropdown' %}
|
{% js_template 'comp/dropdown' %}
|
||||||
|
{% js_template 'comp/dropdown_grouped' %}
|
||||||
|
|
||||||
<!-- overview -->
|
<!-- overview -->
|
||||||
{% js_template 'comp/overview_record' %}
|
{% 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.ui.UserInterface import gui
|
||||||
from uds.core.transports.BaseTransport import Transport
|
from uds.core.transports.BaseTransport import Transport
|
||||||
|
from uds.core.transports.BaseTransport import TUNNELED_GROUP
|
||||||
|
|
||||||
from uds.core.transports import protocols
|
from uds.core.transports import protocols
|
||||||
from uds.core.util import connection
|
from uds.core.util import connection
|
||||||
from uds.core.util import OsDetector
|
from uds.core.util import OsDetector
|
||||||
@ -64,6 +66,7 @@ class HTML5RDPTransport(Transport):
|
|||||||
ownLink = True
|
ownLink = True
|
||||||
supportedOss = OsDetector.allOss
|
supportedOss = OsDetector.allOss
|
||||||
protocol = protocols.RDP
|
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)
|
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)
|
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.managers.UserPrefsManager import CommonPrefs
|
||||||
from uds.core.ui.UserInterface import gui
|
from uds.core.ui.UserInterface import gui
|
||||||
from uds.core.transports.BaseTransport import Transport
|
from uds.core.transports.BaseTransport import Transport
|
||||||
|
from uds.core.transports.BaseTransport import TUNNELED_GROUP
|
||||||
from uds.core.transports import protocols
|
from uds.core.transports import protocols
|
||||||
from uds.models import TicketStore
|
from uds.models import TicketStore
|
||||||
from uds.core.util import connection
|
from uds.core.util import connection
|
||||||
@ -65,6 +66,7 @@ class TSNXTransport(Transport):
|
|||||||
iconFile = 'nx.png'
|
iconFile = 'nx.png'
|
||||||
needsJava = True # If this transport needs java for rendering
|
needsJava = True # If this transport needs java for rendering
|
||||||
protocol = protocols.NX
|
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)
|
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)
|
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.managers.UserPrefsManager import CommonPrefs
|
||||||
from uds.core.ui.UserInterface import gui
|
from uds.core.ui.UserInterface import gui
|
||||||
from uds.core.transports.BaseTransport import Transport
|
from uds.core.transports.BaseTransport import Transport
|
||||||
|
from uds.core.transports.BaseTransport import TUNNELED_GROUP
|
||||||
from uds.core.transports import protocols
|
from uds.core.transports import protocols
|
||||||
from uds.models import TicketStore
|
from uds.models import TicketStore
|
||||||
from uds.core.util import OsDetector
|
from uds.core.util import OsDetector
|
||||||
@ -47,7 +48,7 @@ import logging
|
|||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
|
|
||||||
__updated__ = '2016-07-21'
|
__updated__ = '2016-10-14'
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -65,6 +66,7 @@ class TRDPTransport(BaseRDPTransport):
|
|||||||
typeDescription = _('RDP Transport with tunneled connection')
|
typeDescription = _('RDP Transport with tunneled connection')
|
||||||
needsJava = True # If this transport needs java for rendering
|
needsJava = True # If this transport needs java for rendering
|
||||||
protocol = protocols.RDP
|
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)
|
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)
|
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 django.utils.translation import ugettext_noop as _
|
||||||
from uds.core.ui.UserInterface import gui
|
from uds.core.ui.UserInterface import gui
|
||||||
from uds.core.transports.BaseTransport import Transport
|
from uds.core.transports.BaseTransport import Transport
|
||||||
|
from uds.core.transports.BaseTransport import TUNNELED_GROUP
|
||||||
from uds.core.transports import protocols
|
from uds.core.transports import protocols
|
||||||
from uds.core.util import OsDetector
|
from uds.core.util import OsDetector
|
||||||
from uds.core.util import tools
|
from uds.core.util import tools
|
||||||
@ -46,7 +47,7 @@ import logging
|
|||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
|
|
||||||
__updated__ = '2016-05-27'
|
__updated__ = '2016-10-14'
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -61,6 +62,7 @@ class TSPICETransport(BaseSpiceTransport):
|
|||||||
typeDescription = _('SPICE Transport for tunneled connection (EXPERIMENTAL)')
|
typeDescription = _('SPICE Transport for tunneled connection (EXPERIMENTAL)')
|
||||||
needsJava = True # If this transport needs java for rendering
|
needsJava = True # If this transport needs java for rendering
|
||||||
protocol = protocols.SPICE
|
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)
|
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 django.utils.translation import ugettext_noop as _
|
||||||
from uds.core.ui.UserInterface import gui
|
from uds.core.ui.UserInterface import gui
|
||||||
from uds.core.transports.BaseTransport import Transport
|
from uds.core.transports.BaseTransport import Transport
|
||||||
|
from uds.core.transports.BaseTransport import TUNNELED_GROUP
|
||||||
from uds.core.transports import protocols
|
from uds.core.transports import protocols
|
||||||
from uds.core.util import OsDetector
|
from uds.core.util import OsDetector
|
||||||
from uds.core.util import tools
|
from uds.core.util import tools
|
||||||
@ -45,7 +46,7 @@ import logging
|
|||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
|
|
||||||
__updated__ = '2016-09-07'
|
__updated__ = '2016-10-14'
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ class TX2GOTransport(BaseX2GOTransport):
|
|||||||
typeType = 'TX2GOTransport'
|
typeType = 'TX2GOTransport'
|
||||||
typeDescription = _('X2Go Transport for tunneled connection (EXPERIMENTAL)')
|
typeDescription = _('X2Go Transport for tunneled connection (EXPERIMENTAL)')
|
||||||
protocol = protocols.SPICE
|
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)
|
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)
|
||||||
|
|
||||||
|
@ -360,6 +360,56 @@ span.tag {
|
|||||||
padding-bottom: 4px;
|
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 */
|
/* theme */
|
||||||
|
|
||||||
@import "_theme";
|
@import "_theme";
|
||||||
|
Loading…
Reference in New Issue
Block a user