Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit bc058cca authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Polish new modules.

parent 35799c60
""" Main Controller to run the application with some privileges.
"""
from gluon import current
from auth import ADMIN, USER
@auth.requires(True, requires_login=not request.is_local)
def index():
......
......@@ -25,6 +25,7 @@ from model_app import App
from model_core import Core
from model_harvester import Harvester
from model_report import Report
from model_selector import Selector
from plugin_dbui import (configure_forms,
configure_grids,
......@@ -95,6 +96,7 @@ App.define_tables(db, T)
Core.define_tables(db, T)
Harvester.define_tables(db, T)
Report.define_tables(db, T)
Selector.define_tables(virtdb, db, T)
# ............................................................................
#
......
......@@ -18,7 +18,7 @@ class AppUI(object):
T (gluon.languages.translator): language translator
"""
AppUI.preferences(db, T)
AppUI.preferences(db, T)
@staticmethod
def preferences(db, T):
......
......@@ -258,6 +258,7 @@ class CoreUI(object):
"pages",
fieldLabel=T("Volume / pages"))
session = current.globalenv["session"]
if session.role == USER:
mdf.configure_field("id_status", hidden=True)
......
......@@ -3,6 +3,7 @@
"""
from auth import ADMIN
from gluon import current
from harvest_tools import DRY_RUN
from plugin_dbui import (FieldsModifier,
FormModifier)
......@@ -61,6 +62,7 @@ class SelectorUI(object):
emptyText=tr_select,
xtype="xcomboboxuserreset")
session = current.globalenv["session"]
if session.role != ADMIN:
virtdb.check_selector.mode.default = T(DRY_RUN)
mdf.configure_field("mode", hidden=True)
......
......@@ -9,7 +9,7 @@ from gluon.html import URL
from plugin_dbui import (Node,
Panel,
to_gridPanel,
PanelWithUrlSelector,
to_panelWithUrlSelector,
ViewportModifier,
Window)
......@@ -43,16 +43,18 @@ class ViewportUi(object):
virtual database with the definition of selectors
"""
session = current.globalenv["session"]
nodes = [
ViewportUi.help_node(db, T),
ViewportUi.app_node(db, T),
ViewportUi.wizard_node(db, T, virtdb),
ViewportUi.configure_harvester_node(db, T),
ViewportUi.configure_list_node(db, T),
ViewportUi.configure_metric_node(db, T),
ViewportUi.data_institute_node(db, T),
ViewportUi.data_publication_node(db, T),
ViewportUi.harvester_node(db, T, virtdb),
ViewportUi.help_node(db, T, session),
ViewportUi.app_node(db, T, session),
ViewportUi.wizard_node(db, T, session, virtdb),
ViewportUi.configure_harvester_node(db, T, session),
ViewportUi.configure_list_node(db, T, session),
ViewportUi.configure_metric_node(db, T, session),
ViewportUi.data_institute_node(db, T, session),
ViewportUi.data_publication_node(db, T, session),
ViewportUi.harvester_node(db, T, session, virtdb),
ViewportUi.report_node(db, T, virtdb)]
mdf = ViewportModifier()
......@@ -64,6 +66,7 @@ class ViewportUi(object):
if current.auth is not None:
mdf.configure(logged=False, plugins=["pViewportLogin"])
session = current.globalenv["session"]
if session.role in (ADMIN, USER):
mdf.configure(logged=True)
mdf.default_node(T("Data publications"), T("publications"))
......@@ -72,12 +75,13 @@ class ViewportUi(object):
mdf.default_node(T("Reports"), T("dashboard"))
@staticmethod
def app_node(db, T):
def app_node(db, T, session):
"""To deal with preferences for the application.
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
session (gluon.storage.Storage):
Returns:
dbui.Node:
......@@ -85,6 +89,7 @@ class ViewportUi(object):
"""
node = None
if session.role == ADMIN:
node = Node(T("Application"))
......@@ -110,12 +115,13 @@ class ViewportUi(object):
return node
@staticmethod
def configure_harvester_node(db, T):
def configure_harvester_node(db, T, session):
"""To configure harvesters.
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
session (gluon.storage.Storage):
Returns:
dbui.Node:
......@@ -123,6 +129,7 @@ class ViewportUi(object):
"""
node = None
if session.role in (ADMIN, USER):
node = Node(T("Configure harvesters"))
......@@ -139,12 +146,13 @@ class ViewportUi(object):
return node
@staticmethod
def configure_list_node(db, T):
def configure_list_node(db, T, session):
"""To configure list.
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
session (gluon.storage.Storage):
Returns:
dbui.Node:
......@@ -152,6 +160,7 @@ class ViewportUi(object):
"""
node = None
if session.role == ADMIN:
node = Node(T("Configure lists"))
......@@ -166,12 +175,13 @@ class ViewportUi(object):
return node
@staticmethod
def configure_metric_node(db, T):
def configure_metric_node(db, T, session):
"""To configure metrics.
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
session (gluon.storage.Storage):
Returns:
dbui.Node:
......@@ -179,6 +189,7 @@ class ViewportUi(object):
"""
node = None
if session.role == ADMIN:
node = Node(T("Configure graphs and metrics"))
......@@ -190,7 +201,7 @@ class ViewportUi(object):
return node
@staticmethod
def data_institute_node(db, T):
def data_institute_node(db, T, session):
"""To define data for the institute, affiliation_keys, projects
and teams.
......@@ -198,6 +209,7 @@ class ViewportUi(object):
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
configuration of the selector panel.
session (gluon.storage.Storage):
Returns:
dbui.Node:
......@@ -205,6 +217,7 @@ class ViewportUi(object):
"""
node = None
if session.role == ADMIN:
node = Node(T("Data institute"))
......@@ -219,12 +232,13 @@ class ViewportUi(object):
return node
@staticmethod
def data_publication_node(db, T):
def data_publication_node(db, T, session):
"""To define data for publications.
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
session (gluon.storage.Storage):
Returns:
dbui.Node:
......@@ -232,6 +246,7 @@ class ViewportUi(object):
"""
node = None
if session.role in (ADMIN, USER):
node = Node(T("Data publications"))
......@@ -254,12 +269,13 @@ class ViewportUi(object):
return node
@staticmethod
def harvester_node(db, T, virtdb):
def harvester_node(db, T, session, virtdb):
"""To run harvester.
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
session (gluon.storage.Storage):
virtdb (pyDAL.DAL):
virtual database with the definition of selectors
......@@ -269,23 +285,24 @@ class ViewportUi(object):
"""
node = None
if session.role in (ADMIN, USER):
node = Node(T("Harvest"))
free_panel = PanelWithUrlSelector(
free_panel = to_panelWithUrlSelector(
virtdb.free_harvester_selector,
baseUrl=URL("harvest", "free_run"),
selectorTitle="Fill all fields",
timeout=ONE_HOUR)
harvester_panel = PanelWithUrlSelector(
harvester_panel = to_panelWithUrlSelector(
virtdb.harvester_selector,
baseUrl=URL("harvest", "run"),
extField="format",
timeout=ONE_HOUR)
run_all_panel = PanelWithUrlSelector(
run_all_panel = to_panelWithUrlSelector(
virtdb.run_all_harvesters_selector,
baseUrl=URL("harvest", "run_all"),
extField="format",
......@@ -301,12 +318,13 @@ class ViewportUi(object):
return node
@staticmethod
def help_node(db, T):
def help_node(db, T, session):
"""To deal with documentation and version.
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
session (gluon.storage.Storage):
Returns:
dbui.Node:
......@@ -394,18 +412,18 @@ class ViewportUi(object):
plugins=["pPanelLoaderException"],
autoScroll=True)
graph_panel = PanelWithUrlSelector(
graph_panel = to_panelWithUrlSelector(
virtdb.graph_selector,
baseUrl=URL("graphs", "index"),
extField="format")
list_panel = PanelWithUrlSelector(
list_panel = to_panelWithUrlSelector(
virtdb.list_selector,
baseUrl=URL("lists", "index"),
extField="format",
plugins=["pMathJax"])
metric_panel = PanelWithUrlSelector(
metric_panel = to_panelWithUrlSelector(
virtdb.metric_selector,
baseUrl=URL("metrics", "index"),
extField="format")
......@@ -419,12 +437,13 @@ class ViewportUi(object):
return node
@staticmethod
def wizard_node(db, T, virtdb):
def wizard_node(db, T, session, virtdb):
"""To run wizards.
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
session (gluon.storage.Storage):
virtdb (pyDAL.DAL):
virtual database with the definition of selectors
......@@ -434,26 +453,27 @@ class ViewportUi(object):
"""
node = None
session = current.globalenv["session"]
if session.role in (ADMIN, USER):
node = Node(T("Wizards"))
author_panel = PanelWithUrlSelector(
author_panel = to_panelWithUrlSelector(
virtdb.authors_selector,
baseUrl=URL("wizards", "extract_authors"))
check_panel = PanelWithUrlSelector(
check_panel = to_panelWithUrlSelector(
virtdb.check_selector,
baseUrl=URL("wizards", "check_validate"),
extField="format",
timeout=ONE_HOUR)
edit_panel = PanelWithUrlSelector(
edit_panel = to_panelWithUrlSelector(
virtdb.edit_insert_selector,
baseUrl=URL("harvest", "edit_insert"),
selectorTitle="Fill all fields")
marc12_panel = PanelWithUrlSelector(
marc12_panel = to_panelWithUrlSelector(
virtdb.marc12_selector,
selectorTitle="Fill all fields",
baseUrl=URL("harvest", "insert_marcxml"))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment