Starts in:
1 DAY
22 HRS
17 MIN
36 SEC
Starts in:
1 D
22 H
17 M
36 S
Open Closed

How to hide the menu bar in identity server? #2761


User avatar
0
nhontran created

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v3.3.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Hi, I would like to hide this identity server menu bar in staging and production by checking the environment

I have tried this but it does not work:

    Configure<AbpToolbarOptions>(options =>
    {
        var toolbar = options.Contributors.FirstOrDefault(x => x.GetType() == typeof(AccountModuleToolbarContributor));
        if (toolbar != null)
        {
            options.Contributors.Remove(toolbar);
        }
    });

any help would be appreciated.


1 Answer(s)
  • User Avatar
    0
    muhammedaltug created

    Hello

    Language selection, User menu and Full screen items added by theme lepton via NavItemsService

    You can remove these items using NavItemsService.

    Example:

    1. Declare a variable in environments which named environmentName
    // environment.ts
    export const environmentName = 'dev'
    
    // environment.prod.ts
    export const environmentName = 'prod'
    
    1. Inject NavItemsService in your app.component.ts and check your environment and delete item
    //app.component.ts
    import { Component } from '@angular/core';
    import { NavItemsService } from '@abp/ng.theme.shared';
    import { environmentName } from '../environments/environment';
    import { eThemeLeptonComponents } from '@volo/abp.ng.theme.lepton';
    @Component({
      selector: 'app-root',
      template: `
        &lt;abp-loader-bar&gt;&lt;/abp-loader-bar&gt;
        &lt;abp-dynamic-layout&gt;&lt;/abp-dynamic-layout&gt;
      `,
    })
    export class AppComponent {
      constructor(private navItems: NavItemsService) {
        // Check environment is prod
        if (environmentName.match('prod')) {
          navItems.removeItem(eThemeLeptonComponents.CurrentUser);
        }
      }
    }
    
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06