Exemplo n.º 1
0
        public async Task <IViewComponentResult> InvokeAsync(UsuarioADE usuario, AreaComponente Area = AreaComponente.Usuario)
        {
            string view  = Area.GetDescription();
            NavTab model = Area == AreaComponente.Admin ? NavTabAdmin : NavTab;

            model.LoadType = usuario == null || usuario != null && usuario.Id == "N/A" ? LoadType.Skeleton : LoadType.Full;
            return(View(view, model));
        }
Exemplo n.º 2
0
        public ActionResult TopRefresh(string tab)
        {
            Current.NavTab = NavTab.GetByName(tab);

            var vd = new TopRefreshModel
            {
                Tab = tab
            };

            return(View(vd));
        }
Exemplo n.º 3
0
 public NavTabViewComponent(IHostingEnvironment env, IConfiguration configuration)
 {
     this.env           = env;
     this.Configuration = configuration;
     if (NavTab == null)
     {
         NavTab = DesserializarNavTab();
     }
     if (NavTabAdmin == null)
     {
         NavTabAdmin = DesserializarNavTab("admin-nav-tab.json", false);
     }
 }
Exemplo n.º 4
0
        public void Configure(
            IApplicationBuilder appBuilder,
            IHostApplicationLifetime appLifetime,
            IOptions <OpserverSettings> settings,
            SecurityManager securityManager,
            IEnumerable <StatusModule> modules
            )
        {
            //appBuilder.UseStaticFiles()
            //          .UseExceptional()
            //          //.UseMiniProfiler()
            //          .UseAuthentication()
            //          .Use(async (httpContext, next)  =>
            //          {
            //              Current.SetContext(new Current.CurrentContext(securityManager.CurrentProvider, httpContext));
            //              await next();
            //          })
            //          .UseAuthorization()
            //          .UseRouting()
            //          .UseEndpoints(endpoints => endpoints.MapDefaultControllerRoute());

            appBuilder.UseStaticFiles()
            .UseExceptional()
            .UseRouting()
            .UseMiniProfiler()
            .UseAuthentication()
            .UseAuthorization()
            .Use(async(httpContext, next) =>
            {
                Current.SetContext(new Current.CurrentContext(securityManager.CurrentProvider, httpContext));
                await next();
            })
            .UseResponseCaching()
            .UseEndpoints(endpoints => {
                endpoints.MapDefaultControllerRoute();
            });
            appLifetime.ApplicationStopping.Register(OnShutdown);
            NavTab.ConfigureAll(modules); // TODO: UseNavTabs() or something
            Cache.Configure(settings);
        }
Exemplo n.º 5
0
        public void Configure(
            IApplicationBuilder appBuilder,
            IOptions <OpserverSettings> settings,
            SecurityManager securityManager,
            IEnumerable <StatusModule> modules
            )
        {
            appBuilder
            .UseForwardedHeaders()
            .UseResponseCompression()
            .UseStaticFiles(new StaticFileOptions
            {
                OnPrepareResponse = ctx =>
                {
                    if (ctx.Context.Request.Query.ContainsKey("v"))           // If cache-breaker versioned, cache for a year
                    {
                        ctx.Context.Response.Headers[HeaderNames.CacheControl] = StaticContentCacheControl;
                    }
                }
            })
            .UseExceptional()
            .UseRouting()
            .UseMiniProfiler()
            .UseAuthentication()
            .UseAuthorization()
            .Use((httpContext, next) =>
            {
                httpContext.Response.Headers[HeaderNames.CacheControl] = DefaultCacheControl;

                Current.SetContext(new Current.CurrentContext(securityManager.CurrentProvider, httpContext, modules));
                return(next());
            })
            .UseResponseCaching()
            .UseEndpoints(endpoints => endpoints.MapDefaultControllerRoute());
            NavTab.ConfigureAll(modules); // TODO: UseNavTabs() or something
            Cache.Configure(settings);
        }
Exemplo n.º 6
0
        /// <summary>
        /// OnNavigate  - tab changing code
        /// </summary>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            //setting current tab as selected
            NavTab.ItemsSource = TabList;

            //check if SM has saved tab
            if (SuspensionManager.SessionState.ContainsKey("CurrentTab"))
            {
                NavTab.SelectedIndex = Convert.ToInt32(SuspensionManager.SessionState["CurrentTab"]);
                NavTab.ScrollIntoView(NavTab.SelectedItem);
            }
            else
            {
                NavTab.SelectedIndex = 0;
            }

            //should be in onLaunched but sometimes it doesnt work there
            if (ApplicationData.Current.LocalSettings.Values.ContainsKey("BgId"))
            {
                BgId = (int)(ApplicationData.Current.LocalSettings.Values["BgId"]);
            }

            SetImage();
        }