Base solution for your next web application

Activities of "john_kattenhorn"

Question

Hi,

Sorry if this sounds like a too simple question :-)

I've extended Tenant but I'd like the edit or create to go to new pages rather than dialogue panel.

I figure I need to modify:

vm.editTenant and vm.createTenant js funcitons in index.js, is there a sample in AbpBoilerPlate that would give me a correct implementation of the navigation.

Thanks

John

Answer

OK, I've made some headway, but I think I've not done the routing correctly :

if (abp.auth.hasPermission('Pages.Tenants')) {
            $urlRouterProvider.otherwise("/host/tenants"); // Entrance page for the host
            $stateProvider.state('host.tenants', {
                url: '/tenants',
                templateUrl: '~/App/host/views/tenants/index.cshtml',
                menu: 'Organisations'
            });

            $stateProvider.state('host.tenants.create', {
                url: '/tenants/create',
                templateUrl: '~/App/host/views/tenants/create.cshtml'
            });

            $stateProvider.state('host.tenants.edit', {
                url: '/tenants/edit/:tenantId',
                templateUrl: '~/App/host/views/tenants/edit.cshtml'                
            });

        }

On the create button I have:

<div class="col-xs-6 text-right">
            <button ng-if="vm.permissions.create" class="btn btn-primary blue" href="#/tenants/create/"><i class="fa fa-plus"></i> @L("CreateNewTenant")</button>
        </div>

I think I have the navigation routes wrong maybe, I'm just going to have some dinner and then I will come back to it :-)

Answer

So I'm still stuck, I've read up on the ui-router and it looks really clever, I like it but I cannot make it work for me. I get on JS errors it simple refuses to do anything.

Here is the snippet from the app.js

if (abp.auth.hasPermission('Pages.Tenants')) {
            $urlRouterProvider.otherwise("/host/tenants"); // Entrance page for the host
            $stateProvider.state('host.tenants', {
                url: '/tenants',
                templateUrl: '~/App/host/views/tenants/index.cshtml',
                menu: 'Organisations'
            });

            $stateProvider.state('host.tenants.create', {
                url: '/create',
                templateUrl: '~/App/host/views/tenants/create.cshtml'
            });

            $stateProvider.state('host.tenants.edit', {
                url: '/edit/:tenantId',
                templateUrl: '~/App/host/views/tenants/edit.cshtml'                
            });

        }

        if (abp.auth.hasPermission('Pages.Administration.Host.Settings')) {
            $stateProvider.state('host.settings', {
                url: '/settings',
                templateUrl: '~/App/host/views/settings/index.cshtml',
                menu: 'Administration.Settings.Host'
            });
        }

I'm hoping that the nesting of host.tenants and host.tenants.create and host.tenants.edit gove the urls #/host/tenant, #/host/tenant/create and #host/tenant/edit respectively.

This is how I'm trying to call the create function (it doesn't work even if you try the url manually though).

<div class="col-xs-6 text-right">
            <a ng-if="vm.permissions.create" class="btn btn-primary blue" ng-href="#/host/tenants/create/"><i class="fa fa-plus"></i> @L("CreateNewTenant")</a>
        </div>

The Create.cshtml

<div ng-controller="host.views.tenants.create as vm">
    <div class="row margin-bottom-5">
        <div class="col-xs-6">
            <div class="page-head">
                <div class="page-title">
                    <h1>
                        <span>PAGE_NAME</span> <small>PAGE_NAME_INFO</small>
                    </h1>
                </div>
            </div>
        </div>
        <div class="col-xs-6 text-right">
            <button class="btn btn-primary blue" @*ng-click="vm.doIt1()"*@><i class="fa fa-plus"></i> ACTION_ONE</button>
            <button class="btn btn-primary blue" @*ng-click="vm.doIt2()"*@><i class="fa fa-plus"></i> ACTION_TWO</button>
        </div>
    </div>
    <div class="portlet light">
        <div class="portlet-body">
            <p>PAGE_CONTENT_HERE</p>
        </div>
    </div>
</div>

The create js file :

(function () {

    appModule.controller('host.views.tenants.create', [
         '$scope', '$modal', 'uiGridConstants', 'abp.services.app.tenant',
         function ($scope, $modal, uiGridConstants, tenantService) {
             var vm = this;

             $scope.$on('$viewContentLoaded', function () {
                 Metronic.initAjax();
             });
             

            //start from here...
        }
    ]);
})();

I'd really appreciate some help on this as I've now spent an entire day on this function and it's running late.

Thanks

Answer

Thanks ever so much, it's probably something to do with my lack of experience for AngularJS but I really appreciate your help.

Answer

I went with the conversion of the tenants to abstract and it worked a treat!

What is the right way to control navigation on the save and cancel, should I use $state.go ?

Thanks again!

John

Hi,

As you've probably seen from my previous posts elsewhere I needed to be able to login Externally using Azure Active Directory.

I've spent the day doing some research into the best way forward and having looked the implementation for Twitter / Facebook etc, I think I'm going to adopt this approach for WAAD.

I'll setup a feature branch now and implement there and then define a PR to see what you think.

Thanks

John

PS. It's none of my business but should the External login stuff back to Module-Zero as there are so many people looking for it.

Hi,

Before we had ASP.NET Zero we had to do this all ourselves, as a UK based company are date formats are different to most other places.

Is there anything in the framework to ease our pain for SPA and MPA or should we just use our own mix-and-match of workarounds ?

Thanks

John

Hi,

It was more around the POST'ing of values back, we've found that if we display in UK Format then we cannot post back as the binder doesn't like the date due to the month being on the wrong place.

I've solved it for now but wanted to get some best practice advice really.

Thanks

John

Hi,

I have the requirement to add a setting to enable on a per-tenant basis NewRelic DevOps integration. Part of this requires inserting a script into the layout page which I only want to insert if the setting is set in the Tenant Manager.

I think I've got most of the steps needed but I'm a little stuck as to how to make the settings manager available to the page in the same way as LocalisationManager is e.g. @L("")

Do I need to extend WebViewPageBase ? If so how could I inject the settings manager into it so I can do something like :

SettingManager.GetSettingValueForTenantAsync<bool>(AppSettings.DevOps.UseNewRelic, tenant.Id))

Any guidance would be most appreciated.

Answer

We've been using Hangfire with ABP for a while now and it took a while to figure out the Castle Windsor issues but it works fine now.

We use it as a WebJob in Azure as we didn't want to affect the performance of App whilst the jobs was running.

Let me know if you want us to share some code and I'll see what I can do.

Showing 1 to 10 of 14 entries