Base solution for your next web application

Activities of "rpollak"

How can I remove the concept of friendships from chat? I don't want users to be able to block each other, and I don't want users to have to friend each other as a requirement for chat. I actually don't want the concept of friendship in the application at all. My application is meant for employees to collaborate, not social interactions. Is there a simple way to remove these requirements? If not, is there a simple way to automatically have every user be friends with all other users?

I realize this is likely more of an Angular question than an ASP.Net Zero question, but I am having trouble finding an answer on my own and not sure if the ASP.Net Zero AppComponent used in the AppRoutingModule will affect the answer. I would appreciate some guidance if anyone can help me.

Using ASP.NET Zero v7.1.0 (ASP.NET CORE & Angular), what modifications should I make to main-routing.module.ts if I want to have a component (MainRootComponent) show for the following route: 'http://localhost:4200/app/main'

I understand how to add additional paths inside of 'main', but I am wondering how to get 'main' itself to show a component.

Here is one of my attempts:

import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { DashboardComponent } from './dashboard/dashboard.component';
import { MainRootComponent} from './main-root.component';

@NgModule({
    imports: [
        RouterModule.forChild([
            {
                path: '',
                children: [
                    { path: '', component: MainRootComponent, data: { permission: 'Pages.Tenant.Dashboard' }, pathMatch: 'full' },
                    { path: 'dashboard', component: DashboardComponent, data: { permission: 'Pages.Tenant.Dashboard' } }
                ]
            }
        ])
    ],
    exports: [
        RouterModule
    ]
})
export class MainRoutingModule { }
Question

Is there a way to prevent an audited entity from creating an EntityChangeSet in the database if there are not any EntityPropertyChanges to document?

If not, is there a way to detect if ObjectMapper has changed any properties before running UpdateAsync?

I apologize if this information is in the documentation. I was unable to find it.

I'm trying to create an Angular component similar to the UsersComponent. I created a modal following the example of the CreateOrEditUserModalComponent, but when I attempt to display the modal, I get the following error: "ERROR TypeError: Cannot read property 'show' of undefined"

Here is my modal:

import { Component, ViewChild, EventEmitter, ElementRef, Output, Injector } from '@angular/core';
import { AppComponentBase } from '@shared/common/app-component-base';
import { ModalDirective } from 'ngx-bootstrap';
import { PartEditDto, PartServiceProxy, CreateOrUpdatePartInput } from '@shared/service-proxies/service-proxies';
import * as _ from 'lodash';
import { finalize } from 'rxjs/operators';

@Component({
    selector: 'createOrEditPartModal',
    templateUrl: './create-or-edit-part-modal.component.html'
})
export class CreateOrEditPartModalComponent extends AppComponentBase {

    @ViewChild('numberInput') numberInput: ElementRef;
    @ViewChild('descriptionInput') descriptionInput: ElementRef;
    @ViewChild('materialInput') materialInput: ElementRef;
    @ViewChild('createOrEditModal') modal: ModalDirective;

    @Output() modalSave: EventEmitter<any> = new EventEmitter<any> ();

    active = false;
    saving = false;

    part: PartEditDto = new PartEditDto();

    constructor(
        injector: Injector,
        private _partService: PartServiceProxy
    ) {
        super(injector);
    }

    show(partId?: number): void {
        if (!partId) {
            this.active = true;
        }

        this._partService.getPartForEdit(partId).subscribe(partResult => {
            this.part = partResult.part;

            if (partId) {
                this.active = true;
            }

            this.modal.show();
        });
    }

    onShown(): void {
        document.getElementById('Number').focus();
    }

    save(): void {
        let input = new CreateOrUpdatePartInput();

        input.part = this.part;

        this.saving = true;
        this._partService.createOrUpdatePart(input)
            .pipe(finalize(() => { this.saving = false; }))
            .subscribe(() => {
                this.notify.info(this.l('SavedSuccessfully'));
                this.close();
                this.modalSave.emit(null);
            });
    }

    close(): void {
        this.active = false;
        this.modal.hide();
    }
}

Here are the declarations in 'main.module.ts':

declarations: [
        DashboardComponent,
        PartsComponent,
        CreateOrEditPartModalComponent
    ]

Finally, here is the component where 'createOrEditPartModal' is undefined:

import { Component, Injector, ViewChild, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { appModuleAnimation } from '@shared/animations/routerTransition';
import { AppComponentBase } from '@shared/common/app-component-base';
import { PartServiceProxy } from '@shared/service-proxies/service-proxies';
import { LazyLoadEvent } from 'primeng/components/common/lazyloadevent';
import { Paginator } from 'primeng/components/paginator/paginator';
import { Table } from 'primeng/components/table/table';
import { finalize } from 'rxjs/operators';
import { CreateOrEditPartModalComponent } from './create-or-edit-part-modal.component';

@Component({
    templateUrl: './parts.component.html',
    encapsulation: ViewEncapsulation.None,
    animations: [appModuleAnimation()]
})
export class PartsComponent extends AppComponentBase {

    @ViewChild('createOrEditPartModal') createOrEditPartModal: CreateOrEditPartModalComponent;
    @ViewChild('dataTable') dataTable: Table;
    @ViewChild('paginator') paginator: Paginator;

    //Filters
    filterText = '';

    constructor(
        injector: Injector,
        private _partServiceProxy: PartServiceProxy,
        private _activatedRoute: ActivatedRoute
    ) {
        super(injector);
        this.filterText = this._activatedRoute.snapshot.queryParams['filterText'] || '';
    }

    getParts(event?: LazyLoadEvent) {
        if (this.primengTableHelper.shouldResetPaging(event)) {
            this.paginator.changePage(0);

            return;
        }

        this.primengTableHelper.showLoadingIndicator();

        this._partServiceProxy.getParts(
            this.filterText,
            this.primengTableHelper.getSorting(this.dataTable),
            this.primengTableHelper.getMaxResultCount(this.paginator, event),
            this.primengTableHelper.getSkipCount(this.paginator, event)
        ).pipe(finalize(() => this.primengTableHelper.hideLoadingIndicator())).subscribe(result => {
            this.primengTableHelper.totalRecordsCount = result.totalCount;
            this.primengTableHelper.records = result.items;
            this.primengTableHelper.hideLoadingIndicator();
        });
    }

    reloadPage(): void {
        this.paginator.changePage(this.paginator.getPage());
    }

    createPart(): void {
        this.createOrEditPartModal.show();
    }
}

I cannot figure out what I am doing incorrectly. Is there an obvious mistake?

Showing 1 to 4 of 4 entries