My First Admin Widget
This is an introduction to Alkami’s Admin widget template. You’ll create and build a new Admin widget and then add a connection to the FirstAdminWidget service so that you can call one of the public service contract methods. This will verify that the service is running and allow you to use a Razor view to see some helpful information.
The example source for this tutorial is located in the latest version of the Alkami Samples package under FirstAdminWidget, typically in C:\AlkamiSDK\Samples\FirstAdminWidget.
Run the following upgrade command to get the latest samples.
Alkami’s Admin Portal
You’ll create a new Admin widget from the template and then add functionality that will let you test and configure the USBFI.Client.Widget.FirstWidget provider service. You will dress up the UI with Iris components, look at TypeScript and Knockout.js and consider other features that might be nice additions to this widget.
Alkami’s Admin Widget Template
Install the template
Create and Build the Widget
Run As Administrator
Visual Studio must run as an Administrator to locally deploy and debug.
-
Upgrade to the latest version of SDK Templates by running this command in Powershell
-
Open Visual Studio
Create a new project and select Alkami Client Widget Template
-
Name the project USBFI.Admin.Widget.MyMoney. This widget will belong to the My Money feature set, which includes the My Money service and My Money client widget.
-
Select any location on your hard drive and uncheck all ckeck boxes if any.
-
Build the solution and verify it succeeds.
Update the admin portal menu
- Go to the
insert_menu_item.sql
script at the root of the project and open it to edit the contents. - Edit the display name to
FirstAdminWidget
, which is friendlier than the default value and leave all the other values as they are. - Save and Execute the script in your local SQL server’s DeveloperDynamic database instance.
Widget content and artifacts
-
Setup
nuspec
file There.nuspec
file contains the following main sections: metadata and files.-
The metadata must be completely filled out with fully qualified URLs and values for the blank fields. Visual Studio will fail to package your project if these fields are not completed.
-
The files section will look something like the following. It must define all the files to be packaged. You must uncomment the bin files line out of the box. Additional line items might be needed if the widget depends on any other microservices.
NOTE: This example uses the wildcard notation of
src="bin\USBFI.*"
so the package will target any libraries beginning with USBFI. This will be helpful in the next steps when you add the My Money service integration to the widget.USBFI.Admin.Widget.FirstAdminWidget.nuspec
-
-
Edit the AlkamiManifest.xml and add the BankIdentifier for your financial instituition.
-
Edit the iconName and displaySettings.
-
In the Visual Studio window, read the entire AlkamiManifest_explained.txt to understand the requirements.
-
After editing, the AlkamiManifest.xml might look something like this, where the GUID and other values are specific to your package and FI.
AlkamiManifest.xml
Deploy the widget to your local environment
- With the
.nuspec
file andAlkamiManifest.xml
properly configured, right-click the project or solution or click BUILD from the Visual Studio menu to rebuild the project/solution. - In your browser, go to https://admin-developer.dev.alkamitech.com.
- Go to Setup > First Admin Widget.
Add A New Feature
With a templated widget now in place, you can add new functionality to use your new admin widget. For this tutorial, you will integrate this new admin widget with the existing USBFI My Money provider-based service so that you can view the service’s settings and prepare for additional features.
Install the First Admin Widget service Client and Data NuGet packages
To administer the service, you’ll have to talk to the service, much like a familiar member-facing client widget.
- Use the NuGet Package Manager in Visual Studio to add the Client and Data packages. This lets you create a proxy and connect with the running service.
Update the USBFIFirstAdminWidgetModel
The My Money service contracts and data have been added and now you can start using some of those service data models to build out your admin widget models.
Edit the existing model to look like as follows, where the Setting type is using USBFI.MS.MyMoney.Data.ProviderSettings, available from the NuGet packages you just added.
USBFIFirstAdminWidgetModel.cs
Add the My Money service client to the controller
Edit the USBFIFirstAdminWidgetController.cs and add the following lines of code so your controller looks like the one in the
following screenshot.
USBFIFirstAdminWidgetController.cs
Your controller now has a proxy to the USBFI My Money service, which will allow you to call any of it’s available contract methods.
Update the USBFIFirstAdminWidgetController.cs
Next, you’ll call the My Money service’s GetSettingsAsync() method, use the response data to populate the newly refactored USBFIFirstAdminWidgetModel and then return a new Razor view model.
- Edit the controller to look like the following updated class.
USBFIFirstAdminWidgetController.cs
Design an Iris UI
The Views of an admin widget are split into folders for the widget and a second folder called Shared that is responsible for loading the layout and extending the left side navigation.
Update the widget’s navigation _SideBar.cshtml
-
Rename the header to a user-friendly representation of your widget such as My Money Administration.
-
Change the link text to read Home and the _SideBar.cshtml should now look as follows:
_SideBar.cshtml
Add Iris to the Index view
Alkami has layouts that define certain frontend frameworks and dependencies.
You’ll use a specific layout for Alkami’s Iris design system.
Each layout specifies sections that must be rendered.
The Index.cshtml
must have matching sections for each of the rendered section.
You can add partials as well, in this case a _SideBar
that contains the links. The typical Title, Scripts, and Styles are present, but might change for each layout.
For more available layouts, see the C:\Orb\WebClientAdmin\Views\Shared
folder.
- Replace the contents of the
Views/Shared/_Layout.cshtml
with what’s in this snippet._Layout.cshtml
Use Iris components to quickly build a view
You’ll be adding code to the part of the file just after where the @sections
are defined, starting with some content headers.
-
Add an Iris title content header and a brief description about what this screen will do.
Index.cshtml
-
Add another content header with the column names inside a new row: Name, Current Value, Default Value
Index.cshtml
-
Add a foreach loop to iterate over the available settings and for each setting, create a new Iris record with comfortable spacing.
Index.cshtml
-
Rebuild the solution and refresh the browser to see the changes.
Next Steps
This example is the beginning of a feature set that might be useful to administrators. Other things to consider are:
-
Exercising the My Money service logic
The service has a Loan Decision feature that takes member credit scores and returns an approval amount. A simple submission form will allow an admin user to send values to the service for testing and verification of any adjusted settings.
-
TypeScript:
Knockout.js
andVue.js
Many of Alkami’s admin widgets are written using TypeScript and
Knockout.js
and we’ve also writeVue.js
applications. There are layouts available for each of these libraries.