Base solution for your next web application

Activities of "paulg"

I guess newbie questions aren't answered. Fixed this by moving the below line to the right place:

new AppMenuItem('Games', 'Pages.Games', 'flaticon-more', '/app/main/games/games'),

Not sure why it was placed on top.

Something looks wrong at the beginning of the file.

        new AppMenuItem('Games', 'Pages.Games', 'flaticon-more', '/app/main/games/games'),
        import { PermissionCheckerService } from 'abp-ng2-module';

import { AppSessionService } from '@shared/common/session/app-session.service';

import { Injectable } from '@angular/core'; import { AppMenu } from './app-menu'; import { AppMenuItem } from './app-menu-item';

@Injectable() export class AppNavigationService { constructor( private _permissionCheckerService: PermissionCheckerService, private _appSessionService: AppSessionService ) {}

getMenu(): AppMenu {
    return new AppMenu('MainMenu', 'MainMenu', [
        new AppMenuItem(
            'Dashboard',
            'Pages.Administration.Host.Dashboard',
            'flaticon-line-graph',
            '/app/admin/hostDashboard'
        ),
        new AppMenuItem('Dashboard', 'Pages.Tenant.Dashboard', 'flaticon-line-graph', '/app/main/dashboard'),
        new AppMenuItem('Tenants', 'Pages.Tenants', 'flaticon-list-3', '/app/admin/tenants'),
        new AppMenuItem('Editions', 'Pages.Editions', 'flaticon-app', '/app/admin/editions'),
        new AppMenuItem(
            'Administration',
            '',
            'flaticon-interface-8',
            '',
            [],
            [
                new AppMenuItem(
                    'OrganizationUnits',
                    'Pages.Administration.OrganizationUnits',
                    'flaticon-map',
                    '/app/admin/organization-units'
                ),
                new AppMenuItem('Roles', 'Pages.Administration.Roles', 'flaticon-suitcase', '/app/admin/roles'),
                new AppMenuItem('Users', 'Pages.Administration.Users', 'flaticon-users', '/app/admin/users'),
                new AppMenuItem(
                    'Languages',
                    'Pages.Administration.Languages',
                    'flaticon-tabs',
                    '/app/admin/languages',
                    ['/app/admin/languages/{name}/texts']
                ),
                new AppMenuItem(
                    'AuditLogs',
                    'Pages.Administration.AuditLogs',
                    'flaticon-folder-1',
                    '/app/admin/auditLogs'
                ),
                new AppMenuItem(
                    'Maintenance',
                    'Pages.Administration.Host.Maintenance',
                    'flaticon-lock',
                    '/app/admin/maintenance'
                ),
                new AppMenuItem(
                    'Subscription',
                    'Pages.Administration.Tenant.SubscriptionManagement',
                    'flaticon-refresh',
                    '/app/admin/subscription-management'
                ),
                new AppMenuItem(
                    'VisualSettings',
                    'Pages.Administration.UiCustomization',
                    'flaticon-medical',
                    '/app/admin/ui-customization'
                ),
                new AppMenuItem(
                    'WebhookSubscriptions',
                    'Pages.Administration.WebhookSubscription',
                    'flaticon2-world',
                    '/app/admin/webhook-subscriptions'
                ),
                new AppMenuItem(
                    'DynamicProperties',
                    'Pages.Administration.DynamicProperties',
                    'flaticon-interface-8',
                    '/app/admin/dynamic-property'
                ),
                new AppMenuItem(
                    'Settings',
                    'Pages.Administration.Host.Settings',
                    'flaticon-settings',
                    '/app/admin/hostSettings'
                ),
                new AppMenuItem(
                    'Settings',
                    'Pages.Administration.Tenant.Settings',
                    'flaticon-settings',
                    '/app/admin/tenantSettings'
                ),
            ]
        ),
        new AppMenuItem(
            'DemoUiComponents',
            'Pages.DemoUiComponents',
            'flaticon-shapes',
            '/app/admin/demo-ui-components'
        ),
    ]);
}

checkChildMenuItemPermission(menuItem): boolean {
    for (let i = 0; i < menuItem.items.length; i++) {
        let subMenuItem = menuItem.items[i];

        if (subMenuItem.permissionName === '' || subMenuItem.permissionName === null) {
            if (subMenuItem.route) {
                return true;
            }
        } else if (this._permissionCheckerService.isGranted(subMenuItem.permissionName)) {
            return true;
        }

        if (subMenuItem.items && subMenuItem.items.length) {
            let isAnyChildItemActive = this.checkChildMenuItemPermission(subMenuItem);
            if (isAnyChildItemActive) {
                return true;
            }
        }
    }
    return false;
}

showMenuItem(menuItem: AppMenuItem): boolean {
    if (
        menuItem.permissionName === 'Pages.Administration.Tenant.SubscriptionManagement' &&
        this._appSessionService.tenant &&
        !this._appSessionService.tenant.edition
    ) {
        return false;
    }

    let hideMenuItem = false;

    if (menuItem.requiresAuthentication && !this._appSessionService.user) {
        hideMenuItem = true;
    }

    if (menuItem.permissionName && !this._permissionCheckerService.isGranted(menuItem.permissionName)) {
        hideMenuItem = true;
    }

    if (this._appSessionService.tenant || !abp.multiTenancy.ignoreFeatureCheckForHostUsers) {
        if (menuItem.hasFeatureDependency() && !menuItem.featureDependencySatisfied()) {
            hideMenuItem = true;
        }
    }

    if (!hideMenuItem && menuItem.items && menuItem.items.length) {
        return this.checkChildMenuItemPermission(menuItem);
    }

    return !hideMenuItem;
}

/**
 * Returns all menu items recursively
 */
getAllMenuItems(): AppMenuItem[] {
    let menu = this.getMenu();
    let allMenuItems: AppMenuItem[] = [];
    menu.items.forEach((menuItem) => {
        allMenuItems = allMenuItems.concat(this.getAllMenuItemsRecursive(menuItem));
    });

    return allMenuItems;
}

private getAllMenuItemsRecursive(menuItem: AppMenuItem): AppMenuItem[] {
    if (!menuItem.items) {
        return [menuItem];
    }

    let menuItems = [menuItem];
    menuItem.items.forEach((subMenu) => {
        menuItems = menuItems.concat(this.getAllMenuItemsRecursive(subMenu));
    });

    return menuItems;
}

}

This was resolved by installing VS 2019, from VS 2017.

Great, thank you! This works now.

The only code I have put on Tenants > _CreateModal.cshtml is the following code:

<span>Location:</span>
<input type="text" id="txtPlaces" style="width: 250px" placeholder="Enter a location" />

No other changes. The script tags are on the index page, also no other modifications here. I am basically using a brand new aspnetzero, and just trying to get the code in my first post to work. I am able to do that on the index page, but I dont know which of this code need to go on the Modal page in order for it to work on the Modal page.

Thanks, so I now have all the code on the Index page, and the input box on the modal page. That doesn't work. Can you be more specific on how to get this working? I'm new to this and would appreciate specifics :).

Answer

I did add a language from the list. For me, this worked after cleaning up browser history.

Hi, I did the commands myself and the table is now created and everything works:

PM> add-migration cmdlet Add-Migration at command pipeline position 1 Supply values for the following parameters: Name: 1 To undo this action, use Remove-Migration. PM> update-database Applying migration '20180829074808_1'. Done. PM>

I wasn't sure what to supply for Name, so I just tried "1". Can you explain how this worked? And why doesn't the RAD Tool work for these commands?

Answer

I can also add that I downloaded the latest version of aspnetzero last night, and I installed it on another PC. I am not working on the same instance as when I posted this back in April. If you don't understand my problem, it is simple to recreate by just adding a new language, then select it, and see what happens :).

Showing 1 to 10 of 15 entries