Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "rucksackdigital"

Have you re-run npm run create-bundles ?

What does console.log(data); show? At first glance your code looks correct, as I'mdoing something similar, however, what is your Create() method returning? You may also want to try just returning a number right away (skip all your logic), to see if it's a problem with your return value or your javascript to help with troubleshooting

Hello,

running v7.0 with MVC/jQuery. I've read through the ABP docs on exception handling and understand the basic premise but am struggling to find a solution to effectively showing errors other than the standard "An Internal Error Has Occurred."

As an example scenario, if I use the RadTool to scaffold a new entity, FooBar, with the following methods in my Application Service:

          [AbpAuthorize(AppPermissions.Pages_FooBars_Edit)]
		 private async Task Update(CreateOrEditFooBarDto input)
         {
            throw new UserFriendlyException("This is an Update Exception");
            var fooBar = await _fooBarRepository.FirstOrDefaultAsync((int)input.Id);
             ObjectMapper.Map(input, fooBar);
         }
         
          [AbpAuthorize(AppPermissions.Pages_FooBars_Create)]
		 private async Task Create(CreateOrEditFooBarDto input)
         {
            throw new UserFriendlyException("This is a test exception");
            var fooBar = ObjectMapper.Map<FooBar>(input);

			
			if (AbpSession.TenantId != null)
			{
				fooBar.TenantId = (int?) AbpSession.TenantId;
			}
		

            await _fooBarRepository.InsertAsync(fooBar);
         }

		 [AbpAuthorize(AppPermissions.Pages_FooBars_Delete)]
         public async Task Delete(EntityDto input)
         {
            throw new UserFriendlyException("This is a Deletion Exception");
            await _fooBarRepository.DeleteAsync(input.Id);
         } 
         
         [AbpAuthorize(AppPermissions.Pages_FooBars_Edit)]
		 public async Task<GetFooBarForEditOutput> GetFooBarForEdit(EntityDto input)
         {
            throw new UserFriendlyException("This is an Edit Exception");
            var fooBar = await _fooBarRepository.FirstOrDefaultAsync(input.Id);
           
		    var output = new GetFooBarForEditOutput {FooBar = ObjectMapper.Map<CreateOrEditFooBarDto>(fooBar)};
			
            return output;
         }

A sample snippet from the js:

{
                            text: app.localize('Edit'),
                            visible: function () {
                                return _permissions.edit;
                            },
                            action: function (data) {
                                _createOrEditModal.open({ id: data.record.fooBar.id });
                            }
                        }, 
						{
                            text: app.localize('Delete'),
                            visible: function () {
                                return _permissions.delete;
                            },
                            action: function (data) {
                                deleteFooBar(data.record.fooBar);
                            }
                        }]

Any service calls that return ajax, work as expected; attempting to Delete, Update, or Create shows my user-friendly error message, as expected. Calls that expect a View or a PartialView, such as _createOrEditModal.open({ id: data.record.fooBar.id }); return the generic "internal error" message.

So, is there a built-in way to catch UserFriendlyExceptions in this manner? I'm not sure if the framework supports returning either json or text/html, and if the modal manager is capable of catching that.

Or - is it something where I need to have a separate service I call before opening the modal, to perform whatever pre-edit validations I am looking to perform?

I ran into a similar problem using UTC as my clockProvider on the server side. The resolution I found was, before submitting from client side to server side for processing, you need to specify the format of the datetime object.

Below is jQuery but gives you the idea:

$('.datetime-picker').datetimepicker({
                minDate: new Date(),
                locale: abp.localization.currentLanguage.name,
                format: 'L LT'
            });

to render you Datetime field selector to your end user. Before posting to server:

var formattedDate = $("#Notification_AutoBroadcastDate").data("DateTimePicker").date().format("YYYY-MM-DDTHH:mmZ");

and return formattedDate to your server for processing, which will include the timezone offset.

If you do not include the timezone offset when submitting to server, it is assumed to be a UTC date.

@ryancyq not sure why I never thought to do a simple association. That works quite nicely, thanks for the feedback. I ended up creating an Xyz entity with IMustHaveTenant enforced, linked to an XyzOU derived class and doing tenantId validation one save

Hello,

I've built out a new entity that extends the OrganizationUnit with a new field, and some additional new table as references. Everything is working smoothly, however I'd like to enforce tenantId requirements on my entity with IMustHaveTenant. The issue I'm running is when running add-migration, VS insists on trying to add tenantId to the abporganizationunits table, even though it's already there. I've tried adding [NotMapped] annotation to the tenantID in my class but that doesnt' seem to work.

Is there a way to do this that I'm missing, or should I just add checks for tenantId.HasValue in my domain service (which is what I'm doing now), before progressing with business logic?

Looks to have been opened by @KevinFarrow already, https://github.com/aspnetzero/aspnet-zero-core/issues/2402

ASP.NET Core w/ Angular project base, out-of-box validation for input types does not appear to be functioning correctly.

Example: AppFeatures.MaxContactCount, inputType: new SingleLineStringInputType(new NumericValueValidator(0, int.MaxValue))

In the Core+Angular solution, the footer in Theme 12 is hidden behind the sidebar nav. Screenshot below. Note that if you make the footer fixed the problem is resolved.

The hangfire configuration documentation link in the Getting Started section appears to be broken:

URL: https://docs.aspnetzero.com/documents/aspnet-core-angular/latest/Hangfire Reference page: https://docs.aspnetzero.com/documents/aspnet-core-angular/latest/Getting-Started-Angular

Showing 21 to 30 of 31 entries