Exemplo n.º 1
0
def directoryservice_home(request):

    view = appPool.hook_app_index('directoryservice', request)
    view = [_f for _f in view if _f]
    if view:
        return view[0]

    try:
        activedirectory = models.ActiveDirectory.objects.order_by("-id")[0]
    except Exception:
        activedirectory = models.ActiveDirectory.objects.create()

    try:
        ldap = models.LDAP.objects.order_by("-id")[0]
    except Exception:
        ldap = models.LDAP.objects.create()

    try:
        nis = models.NIS.objects.order_by("-id")[0]
    except Exception:
        nis = models.NIS.objects.create()

    try:
        ks = models.KerberosSettings.objects.order_by("-id")[0]
    except Exception:
        ks = models.KerberosSettings.objects.create()

    return render(request, 'directoryservice/index.html', {
        'focus_form': request.GET.get('tab', 'directoryservice'),
        'activedirectory': activedirectory,
        'ldap': ldap,
        'nis': nis,
        'kerberossettings': ks,
    })
Exemplo n.º 2
0
    def adminInterface(self, request):
        from freenasUI.network.models import GlobalConfiguration
        from freenasUI.system.models import Advanced, Settings
        from freenasUI.middleware.client import client

        view = appPool.hook_app_index('freeadmin', request)
        view = filter(None, view)
        if view:
            return view[0]

        try:
            console = Advanced.objects.all().order_by('-id')[0].adv_consolemsg
        except:
            console = False
        try:
            hostname = GlobalConfiguration.objects.order_by(
                '-id')[0].get_hostname()
        except:
            hostname = None

        try:
            settings = Settings.objects.all().order_by('-id')[0]
            wizard = not settings.stg_wizardshown
            if settings.stg_wizardshown is False:
                settings.stg_wizardshown = True
                settings.save()
        except:
            wizard = False
        sw_version = get_sw_version()

        try:
            with client as c:
                middleware_token = c.call('auth.generate_token', timeout=10)
        except Exception:
            middleware_token = None
            extra_data = {
                'sw_version': sw_version,
            }
            if os.path.exists('/var/log/middlewared.log'):
                with open('/var/log/middlewared.log', 'r') as f:
                    extra_data['middlewaredlog'] = f.read()[-10240:]
            rollbar.report_exc_info(
                sys.exc_info(),
                request,
                extra_data=extra_data,
            )

        return render(
            request, 'freeadmin/index.html', {
                'consolemsg': console,
                'hostname': hostname,
                'sw_name': get_sw_name(),
                'sw_version': sw_version,
                'cache_hash': hashlib.md5(sw_version).hexdigest(),
                'css_hook': appPool.get_base_css(request),
                'js_hook': appPool.get_base_js(request),
                'menu_hook': appPool.get_top_menu(request),
                'wizard': wizard,
                'middleware_token': middleware_token,
            })
Exemplo n.º 3
0
    def adminInterface(self, request):
        from freenasUI.network.models import GlobalConfiguration
        from freenasUI.system.models import Advanced

        view = appPool.hook_app_index("freeadmin", request)
        view = filter(None, view)
        if view:
            return view[0]

        try:
            console = Advanced.objects.all().order_by("-id")[0].adv_consolemsg
        except:
            console = False
        try:
            hostname = GlobalConfiguration.objects.order_by("-id")[0].gc_hostname
        except:
            hostname = None
        sw_version = get_sw_version()
        return render(
            request,
            "freeadmin/index.html",
            {
                "consolemsg": console,
                "hostname": hostname,
                "sw_name": get_sw_name(),
                "sw_version": sw_version,
                "cache_hash": hashlib.md5(sw_version).hexdigest(),
                "css_hook": appPool.get_base_css(request),
                "js_hook": appPool.get_base_js(request),
                "menu_hook": appPool.get_top_menu(request),
            },
        )
Exemplo n.º 4
0
    def adminInterface(self, request):
        from freenasUI.network.models import GlobalConfiguration
        from freenasUI.system.models import Advanced

        view = appPool.hook_app_index('freeadmin', request)
        view = filter(None, view)
        if view:
            return view[0]

        try:
            console = Advanced.objects.all().order_by('-id')[0].adv_consolemsg
        except:
            console = False
        try:
            hostname = GlobalConfiguration.objects.order_by(
                '-id')[0].gc_hostname
        except:
            hostname = None
        sw_version = get_sw_version()
        return render(request, 'freeadmin/index.html', {
            'consolemsg': console,
            'hostname': hostname,
            'sw_name': get_sw_name(),
            'sw_version': sw_version,
            'cache_hash': hashlib.md5(sw_version).hexdigest(),
            'css_hook': appPool.get_base_css(request),
            'js_hook': appPool.get_base_js(request),
            'menu_hook': appPool.get_top_menu(request),
        })
Exemplo n.º 5
0
def directoryservice_home(request):

    view = appPool.hook_app_index('directoryservice', request)
    view = [_f for _f in view if _f]
    if view:
        return view[0]

    try:
        activedirectory = models.ActiveDirectory.objects.order_by("-id")[0]
    except Exception:
        activedirectory = models.ActiveDirectory.objects.create()

    try:
        ldap = models.LDAP.objects.order_by("-id")[0]
    except Exception:
        ldap = models.LDAP.objects.create()

    try:
        nis = models.NIS.objects.order_by("-id")[0]
    except Exception:
        nis = models.NIS.objects.create()

    try:
        ks = models.KerberosSettings.objects.order_by("-id")[0]
    except Exception:
        ks = models.KerberosSettings.objects.create()

    return render(request, 'directoryservice/index.html', {
        'focus_form': request.GET.get('tab', 'directoryservice'),
        'activedirectory': activedirectory,
        'ldap': ldap,
        'nis': nis,
        'kerberossettings': ks,
    })
Exemplo n.º 6
0
    def adminInterface(self, request):
        from freenasUI.network.models import GlobalConfiguration
        from freenasUI.system.models import Advanced

        view = appPool.hook_app_index('freeadmin', request)
        view = filter(None, view)
        if view:
            return view[0]

        try:
            console = Advanced.objects.all().order_by('-id')[0].adv_consolemsg
        except:
            console = False
        try:
            hostname = GlobalConfiguration.objects.order_by(
                '-id')[0].gc_hostname
        except:
            hostname = None
        sw_version = get_sw_version()
        return render(
            request, 'freeadmin/index.html', {
                'consolemsg': console,
                'hostname': hostname,
                'sw_name': get_sw_name(),
                'sw_version': sw_version,
                'cache_hash': hashlib.md5(sw_version).hexdigest(),
                'css_hook': appPool.get_base_css(request),
                'js_hook': appPool.get_base_js(request),
                'menu_hook': appPool.get_top_menu(request),
            })
Exemplo n.º 7
0
    def adminInterface(self, request):
        from freenasUI.network.models import GlobalConfiguration
        from freenasUI.system.models import Advanced, Settings
        from freenasUI.middleware.client import client

        view = appPool.hook_app_index('freeadmin', request)
        view = filter(None, view)
        if view:
            return view[0]

        try:
            console = Advanced.objects.all().order_by('-id')[0].adv_consolemsg
        except:
            console = False
        try:
            hostname = GlobalConfiguration.objects.order_by(
                '-id')[0].get_hostname()
        except:
            hostname = None

        try:
            settings = Settings.objects.all().order_by('-id')[0]
            wizard = not settings.stg_wizardshown
            if settings.stg_wizardshown is False:
                settings.stg_wizardshown = True
                settings.save()
        except:
            wizard = False
        sw_version = get_sw_version()

        try:
            with client as c:
                middleware_token = c.call('auth.generate_token', timeout=10)
        except Exception:
            middleware_token = None
            extra_data = {
                'sw_version': sw_version,
            }
            if os.path.exists('/var/log/middlewared.log'):
                with open('/var/log/middlewared.log', 'r') as f:
                    extra_data['middlewaredlog'] = f.read()[-10240:]
            rollbar.report_exc_info(
                sys.exc_info(),
                request,
                extra_data=extra_data,
            )

        return render(request, 'freeadmin/index.html', {
            'consolemsg': console,
            'hostname': hostname,
            'sw_name': get_sw_name(),
            'sw_version': sw_version,
            'cache_hash': hashlib.md5(sw_version).hexdigest(),
            'css_hook': appPool.get_base_css(request),
            'js_hook': appPool.get_base_js(request),
            'menu_hook': appPool.get_top_menu(request),
            'wizard': wizard,
            'middleware_token': middleware_token,
        })
Exemplo n.º 8
0
def index(request):

    view = appPool.hook_app_index('reporting', request)
    view = [_f for _f in view if _f]
    if view:
        return view[0]

    return render(request, "reporting/index.html")
Exemplo n.º 9
0
def index(request):

    view = appPool.hook_app_index('reporting', request)
    view = filter(None, view)
    if view:
        return view[0]

    return render(request, "reporting/index.html")
Exemplo n.º 10
0
def index(request):

    view = appPool.hook_app_index('reporting', request)
    view = [_f for _f in view if _f]
    if view:
        return view[0]

    return render(request, "reporting/index.html")
Exemplo n.º 11
0
def index(request):

    view = appPool.hook_app_index('reporting', request)
    view = filter(None, view)
    if view:
        return view[0]

    return render(request, "reporting/index.html")
Exemplo n.º 12
0
def index(request):

    view = appPool.hook_app_index("sharing", request)
    view = filter(None, view)
    if view:
        return view[0]

    return render(request, "services/index.html", {"toggleCore": request.GET.get("toggleCore")})
Exemplo n.º 13
0
def home(request):

    view = appPool.hook_app_index("tasks", request)
    view = filter(None, view)
    if view:
        return view[0]

    return render(request, "tasks/index.html", {"tab": request.GET.get("tab", "tasks.CronJob")})
Exemplo n.º 14
0
def login_wrapper(
    request,
    template_name='registration/login.html',
    redirect_field_name=REDIRECT_FIELD_NAME,
    authentication_form=ExtendedAuthForm,
    current_app=None, extra_context=None,
):
    """
    Wrapper to login to do not allow login and redirect to
    shutdown, reboot or logout pages,
    instead redirect to /
    """

    auth_token = request.GET.get('auth_token')
    if auth_token:
        user = authenticate(auth_token=auth_token)
        if user:
            auth_login(request, user, 'freenasUI.middleware.auth.AuthTokenBackend')

    # Overload hook_app_index to shortcut passive node
    # Doing that in another layer will use too many reasources
    view = appPool.hook_app_index('account_login', request)
    view = [_f for _f in view if _f]
    if view:
        return view[0]

    if extra_context is None:
        extra_context = {}
    extra_context.update({
        'sw_login_version': get_sw_login_version(),
        'sw_version_footer': get_sw_version(strip_build_num=True).split('-', 1)[-1],
        'sw_name': get_sw_name(),
        'sw_year': get_sw_year(),
    })
    if not models.bsdUsers.has_root_password():
        authentication_form = forms.NewPasswordForm
        extra_context.update({
            'reset_password': True,
        })
    response = login(
        request,
        template_name='registration/login.html',
        redirect_field_name=redirect_field_name,
        authentication_form=authentication_form,
        current_app=current_app,
        extra_context=extra_context,
    )
    if response.status_code in (301, 302) and response._headers.get(
        'location', ('', '')
    )[1] in (
        reverse('system_reboot'),
        reverse('system_shutdown'),
        reverse('account_logout'),
    ):
        response._headers['location'] = ('Location', '/legacy/')
    elif request.user.is_authenticated:
        return HttpResponseRedirect('/legacy/')
    return response
Exemplo n.º 15
0
def login_wrapper(
    request,
    template_name='registration/login.html',
    redirect_field_name=REDIRECT_FIELD_NAME,
    authentication_form=ExtendedAuthForm,
    current_app=None,
    extra_context=None,
):
    """
    Wrapper to login to do not allow login and redirect to
    shutdown, reboot or logout pages,
    instead redirect to /
    """

    auth_token = request.GET.get('auth_token')
    if auth_token:
        user = authenticate(auth_token=auth_token)
        if user:
            auth_login(request, user,
                       'freenasUI.middleware.auth.AuthTokenBackend')

    # Overload hook_app_index to shortcut passive node
    # Doing that in another layer will use too many reasources
    view = appPool.hook_app_index('account_login', request)
    view = [_f for _f in view if _f]
    if view:
        return view[0]

    if extra_context is None:
        extra_context = {}
    extra_context.update({
        'sw_login_version': get_sw_login_version(),
        'sw_name': get_sw_name(),
    })
    if not models.bsdUsers.has_root_password():
        authentication_form = forms.NewPasswordForm
        extra_context.update({
            'reset_password': True,
        })
    response = login(
        request,
        template_name='registration/login.html',
        redirect_field_name=redirect_field_name,
        authentication_form=authentication_form,
        current_app=current_app,
        extra_context=extra_context,
    )
    if response.status_code in (301, 302) and response._headers.get(
            'location', ('', ''))[1] in (
                reverse('system_reboot'),
                reverse('system_shutdown'),
                reverse('account_logout'),
            ):
        response._headers['location'] = ('Location', '/')
    elif request.user.is_authenticated:
        return HttpResponseRedirect('/')
    return response
Exemplo n.º 16
0
def home(request):

    view = appPool.hook_app_index("account", request)
    view = filter(None, view)
    if view:
        return view[0]

    focus_form = request.GET.get("tab", "passform")
    return render(request, "account/index.html", {"focus_form": focus_form})
Exemplo n.º 17
0
def home(request):

    view = appPool.hook_app_index("storage", request)
    view = filter(None, view)
    if view:
        return view[0]

    tabs = appPool.hook_app_tabs("storage", request)
    return render(request, "storage/index.html", {"focused_tab": request.GET.get("tab", None), "hook_tabs": tabs})
Exemplo n.º 18
0
    def adminInterface(self, request):
        from freenasUI.network.models import GlobalConfiguration
        from freenasUI.system.models import Advanced, Settings
        from freenasUI.middleware.client import client

        view = appPool.hook_app_index('freeadmin', request)
        view = [_f for _f in view if _f]
        if view:
            return view[0]

        try:
            console = Advanced.objects.all().order_by('-id')[0].adv_consolemsg
        except:
            console = False
        try:
            hostname = GlobalConfiguration.objects.order_by(
                '-id')[0].get_hostname()
        except:
            hostname = None

        try:
            settings = Settings.objects.all().order_by('-id')[0]
            wizard = not settings.stg_wizardshown
            if settings.stg_wizardshown is False:
                settings.stg_wizardshown = True
                settings.save()
        except:
            wizard = False
        sw_version = get_sw_version()
        sw_version_footer = get_sw_version(strip_build_num=True).split('-',
                                                                       1)[-1]

        try:
            with client as c:
                middleware_token = c.call('auth.generate_token', timeout=10)
        except Exception:
            middleware_token = None
            extra_log_files = (('/var/log/middlewared.log',
                                'middlewared_log'), )
            self.trace.rollbar_report(sys.exc_info(), request, sw_version,
                                      extra_log_files)

        return render(
            request, 'freeadmin/index.html', {
                'consolemsg': console,
                'hostname': hostname,
                'sw_name': get_sw_name(),
                'sw_version': sw_version,
                'sw_version_footer': sw_version_footer,
                'cache_hash': hashlib.md5(
                    sw_version.encode('utf8')).hexdigest(),
                'css_hook': appPool.get_base_css(request),
                'js_hook': appPool.get_base_js(request),
                'menu_hook': appPool.get_top_menu(request),
                'wizard': wizard,
                'middleware_token': middleware_token,
            })
Exemplo n.º 19
0
def index(request):

    view = appPool.hook_app_index('sharing', request)
    view = [_f for _f in view if _f]
    if view:
        return view[0]

    return render(request, 'services/index.html', {
        'toggleCore': request.GET.get('toggleCore'),
    })
Exemplo n.º 20
0
def index(request):

    view = appPool.hook_app_index('sharing', request)
    view = filter(None, view)
    if view:
        return view[0]

    return render(request, 'services/index.html', {
        'toggleCore': request.GET.get('toggleCore'),
    })
Exemplo n.º 21
0
def index(request):

    view = appPool.hook_app_index('sharing', request)
    view = [_f for _f in view if _f]
    if view:
        return view[0]

    return render(request, 'services/index.html', {
        'toggleCore': request.GET.get('toggleCore'),
    })
Exemplo n.º 22
0
def home(request):

    view = appPool.hook_app_index('tasks', request)
    view = filter(None, view)
    if view:
        return view[0]

    return render(request, 'tasks/index.html', {
        'tab': request.GET.get('tab', 'tasks.CronJob'),
    })
Exemplo n.º 23
0
def home(request):

    view = appPool.hook_app_index('sharing', request)
    view = filter(None, view)
    if view:
        return view[0]

    return render(request, 'sharing/index.html', {
        'focus_form': request.GET.get('tab', ''),
    })
Exemplo n.º 24
0
def index(request):

    view = appPool.hook_app_index('sharing', request)
    view = filter(None, view)
    if view:
        return view[0]

    return render(request, 'services/index.html', {
        'toggleCore': request.GET.get('toggleCore'),
    })
Exemplo n.º 25
0
def home(request):

    view = appPool.hook_app_index('account', request)
    view = [_f for _f in view if _f]
    if view:
        return view[0]

    focus_form = request.GET.get('tab', 'passform')
    return render(request, 'account/index.html', {
        'focus_form': focus_form,
    })
Exemplo n.º 26
0
def home(request):

    view = appPool.hook_app_index('account', request)
    view = filter(None, view)
    if view:
        return view[0]

    focus_form = request.GET.get('tab', 'passform')
    return render(request, 'account/index.html', {
        'focus_form': focus_form,
    })
Exemplo n.º 27
0
def home(request):

    view = appPool.hook_app_index('tasks', request)
    view = filter(None, view)
    if view:
        return view[0]

    tabs = appPool.hook_app_tabs('tasks', request)
    return render(request, 'tasks/index.html', {
        'focused_tab': request.GET.get('tab', 'tasks.CronJob'),
        'hook_tabs': tabs,
    })
Exemplo n.º 28
0
def home(request):

    view = appPool.hook_app_index('storage', request)
    view = filter(None, view)
    if view:
        return view[0]

    tabs = appPool.hook_app_tabs('storage', request)
    return render(request, 'storage/index.html', {
        'focused_tab': request.GET.get("tab", 'storage.Volumes.View'),
        'hook_tabs': tabs,
    })
Exemplo n.º 29
0
def home(request):

    view = appPool.hook_app_index('tasks', request)
    view = [_f for _f in view if _f]
    if view:
        return view[0]

    tabs = appPool.hook_app_tabs('tasks', request)
    return render(request, 'tasks/index.html', {
        'focused_tab': request.GET.get('tab', 'tasks.CronJob'),
        'hook_tabs': tabs,
    })
Exemplo n.º 30
0
def home(request):

    view = appPool.hook_app_index('storage', request)
    view = filter(None, view)
    if view:
        return view[0]

    tabs = appPool.hook_app_tabs('storage', request)
    return render(request, 'storage/index.html', {
        'focused_tab': request.GET.get("tab", 'storage.Volumes.View'),
        'hook_tabs': tabs,
    })
Exemplo n.º 31
0
def login_wrapper(
    request,
    template_name='registration/login.html',
    redirect_field_name=REDIRECT_FIELD_NAME,
    authentication_form=ExtendedAuthForm,
    current_app=None, extra_context=None,
):
    """
    Wrapper to login to do not allow login and redirect to
    shutdown, reboot or logout pages,
    instead redirect to /
    """

    # Overload hook_app_index to shortcut passive node
    # Doing that in another layer will use too many reasources
    view = appPool.hook_app_index('account_login', request)
    view = filter(None, view)
    if view:
        return view[0]

    if extra_context is None:
        extra_context = {}
    extra_context.update({
        'sw_login_version': get_sw_login_version(),
        'sw_name': get_sw_name(),
    })
    if not models.bsdUsers.has_root_password():
        authentication_form = forms.NewPasswordForm
        extra_context.update({
            'reset_password': True,
        })
    response = login(
        request,
        template_name='registration/login.html',
        redirect_field_name=redirect_field_name,
        authentication_form=authentication_form,
        current_app=current_app,
        extra_context=extra_context,
    )
    if response.status_code in (301, 302) and response._headers.get(
        'location', ('', '')
    )[1] in (
        reverse('system_reboot'),
        reverse('system_shutdown'),
        reverse('account_logout'),
    ):
        response._headers['location'] = ('Location', '/')
    elif request.user.is_authenticated():
        return HttpResponseRedirect('/')
    return response
Exemplo n.º 32
0
def home(request):

    if not utils.vm_enabled():
        return render(request, 'vm/disabled.html')

    view = appPool.hook_app_index('vm', request)
    view = list(filter(None, view))
    if view:
        return view[0]

    tabs = appPool.hook_app_tabs('vm', request)
    return render(request, 'vm/index.html', {
        'focused_tab': request.GET.get('tab', 'vm.VM'),
        'hook_tabs': tabs,
    })
Exemplo n.º 33
0
def home(request):

    if not utils.vm_enabled():
        return render(request, 'vm/disabled.html')

    view = appPool.hook_app_index('vm', request)
    view = list(filter(None, view))
    if view:
        return view[0]

    tabs = appPool.hook_app_tabs('vm', request)
    return render(request, 'vm/index.html', {
        'focused_tab': request.GET.get('tab', 'vm.VM'),
        'hook_tabs': tabs,
    })
Exemplo n.º 34
0
    def adminInterface(self, request):
        from freenasUI.network.models import GlobalConfiguration
        from freenasUI.system.models import Advanced, Settings

        view = appPool.hook_app_index('freeadmin', request)
        view = [_f for _f in view if _f]
        if view:
            return view[0]

        try:
            console = Advanced.objects.all().order_by('-id')[0].adv_consolemsg
        except:
            console = False
        try:
            hostname = GlobalConfiguration.objects.order_by(
                '-id')[0].get_hostname()
        except:
            hostname = None

        try:
            settings = Settings.objects.all().order_by('-id')[0]
            wizard = not settings.stg_wizardshown
            if settings.stg_wizardshown is False:
                settings.stg_wizardshown = True
                settings.save()
        except:
            wizard = False
        sw_version = get_sw_version()
        version = get_sw_version(strip_build_num=True)
        sw_version_footer = version.split('-', 1)[-1]
        sw_version_major = version.split('-')[1]

        return render(
            request, 'freeadmin/index.html', {
                'consolemsg': console,
                'hostname': hostname,
                'sw_name': get_sw_name(),
                'sw_year': get_sw_year(),
                'sw_version': sw_version,
                'sw_version_footer': sw_version_footer,
                'sw_version_major': sw_version_major,
                'cache_hash': hashlib.md5(
                    sw_version.encode('utf8')).hexdigest(),
                'css_hook': appPool.get_base_css(request),
                'js_hook': appPool.get_base_js(request),
                'menu_hook': appPool.get_top_menu(request),
                'wizard': wizard,
            })
Exemplo n.º 35
0
def home(request):

    view = appPool.hook_app_index('storage', request)
    view = [_f for _f in view if _f]
    if view:
        return view[0]

    try:
        resilver = models.Resilver.objects.order_by('-id')[0]
    except Exception:
        resilver = models.Resilver.objects.create()

    tabs = appPool.hook_app_tabs('storage', request)
    return render(request, 'storage/index.html', {
        'focused_tab': request.GET.get("tab", 'storage.Volumes.View'),
        'hook_tabs': tabs,
        'resilver_edit_url': f'{resilver.get_edit_url()}?inline=true'
    })
Exemplo n.º 36
0
def home(request):

    view = appPool.hook_app_index('storage', request)
    view = [_f for _f in view if _f]
    if view:
        return view[0]

    try:
        resilver = models.Resilver.objects.order_by('-id')[0]
    except Exception:
        resilver = models.Resilver.objects.create()

    tabs = appPool.hook_app_tabs('storage', request)
    return render(request, 'storage/index.html', {
        'focused_tab': request.GET.get("tab", 'storage.Volumes.View'),
        'hook_tabs': tabs,
        'resilver_edit_url': f'{resilver.get_edit_url()}?inline=true'
    })
Exemplo n.º 37
0
    def adminInterface(self, request):
        from freenasUI.network.models import GlobalConfiguration
        from freenasUI.system.models import Advanced, Settings

        view = appPool.hook_app_index('freeadmin', request)
        view = [_f for _f in view if _f]
        if view:
            return view[0]

        try:
            console = Advanced.objects.all().order_by('-id')[0].adv_consolemsg
        except:
            console = False
        try:
            hostname = GlobalConfiguration.objects.order_by(
                '-id')[0].get_hostname()
        except:
            hostname = None

        try:
            settings = Settings.objects.all().order_by('-id')[0]
            wizard = not settings.stg_wizardshown
            if settings.stg_wizardshown is False:
                settings.stg_wizardshown = True
                settings.save()
        except:
            wizard = False
        sw_version = get_sw_version()
        sw_version_footer = get_sw_version(strip_build_num=True).split('-', 1)[-1]

        return render(request, 'freeadmin/index.html', {
            'consolemsg': console,
            'hostname': hostname,
            'sw_name': get_sw_name(),
            'sw_year': get_sw_year(),
            'sw_version': sw_version,
            'sw_version_footer': sw_version_footer,
            'cache_hash': hashlib.md5(sw_version.encode('utf8')).hexdigest(),
            'css_hook': appPool.get_base_css(request),
            'js_hook': appPool.get_base_js(request),
            'menu_hook': appPool.get_top_menu(request),
            'wizard': wizard,
        })
Exemplo n.º 38
0
def home(request):

    view = appPool.hook_app_index('sharing', request)
    view = filter(None, view)
    if view:
        return view[0]

    tab = request.GET.get('tab', '')

    # Redirect from services node
    if tab == 'services.ISCSI':
        tab = 'sharing.ISCSI.iSCSITargetGlobalConfiguration'

    if tab.startswith('sharing.ISCSI'):
        ntab = 'sharing.ISCSI'
    else:
        ntab = ''

    return render(request, 'sharing/index.html', {
        'focus_form': tab,
        'ntab': ntab,
    })