WASM Service Interface

UX-WASM-Services Project

The services in this project act as interfaces to the REST-WebAPI-Core website.

They accept Shared types from the user experience Blazor components, package them to json, make the required API call, convert the returned json back into a C# type, and return the result.

They are initialized as Singleton services in the UX-WASM-xxx client website’s program.cs, or the UX-MAUI-xxx client native applications MauiProgram.cs, as part of start up.

The usage of these classes and services will be described in the context of the customizable components that use them.

Classes

FormBuilder

This is the most complex of the classes provided by trellispark. Its purpose is to load a selected version of instance data for the current user and return all the information required to build the user experience.

This service also maintains the validation status of the current page. The Validation Messages are cleared whenever the user loads a new instance. When the page is validated a set of Validation Messages are generated for any invalid controls. Before the page can be submitted for saving or processing all the Validation Messages must be addressed and cleared. All validation related functions are accessible through the form builders local Validator object. 

This service is used extensively by the trellispark Blazor components.

Notification

This class is a wrapper for the Telerik Notifications used by the trellispark Blazor components to notify the user on the status of their interactions with the user experience.

Services

ExecuteCommand

This service is used to request execution of a Command or Event on behalf of the current user against the currently selected instance data.

ExecuteSQL

This service is used to request execution of a stored procedure in the Data at Rest Record Storage database on behalf of the current user against the currently selected instance data.

The stored procedure must already exist within the database and will only accept the very restrictive allowed parameters. No dynamic SQL can be prepared or executed from the user experience.

InstanceState

This is a wrapper for the BackgroundForm (an instance of the FormBuilder class) that is used to render the currently selected instance data.

It also provides a PopupForm that is used during the right-click processing of the GI_ChildList Blazor component to load the selected row and determine which Commands/Events are available to the currently selected user.

It is also a placeholder for future functionality such as the WizardForm.

PowerBI

This service is used to interface with Microsoft PowerBI and provide two endpoints:

  • Get a PBIEmbedConfig which will provide a security context for displaying a PowerBI dashboard within the user experience.
  • Call RefreshDataset to cause a dashboard to refresh its dataset from the Data at Rest Record Storage database.

ProcessDocument

This service is used to create documents within the user experience. The CommandName parameter can be set to any of the following:

  • GetHTMLandPDF: Returns both the HTML and PDF versions of the document in the b64HTML and b64PDF strings respectively.
  • GetHTML: Returns the HTML version of the document in the b64HTML string.
  • GetPDF: Uses the b64HTML string as input to generate and return a PDF document in the b64PDF string.

The HTML generation uses the specified DocumentTemplateGUID to validate that the user has permission to generate this document on the current instance. The HTML generation processes uses an internally generated deep XML from the current instance along with the XSLT from the document template to create the HTML.

The XSLT processor uses the Microsoft System.Xml.Xsl.XslCompiledTransform package for the processing so the XSLT must be using version 1.0 version of XSLT.

ProcessStripe

This service is used to create a Stripe Payment session using the specified current InstanceGUID and the FieldDefinitionGUID.

The REST-WebAPI-Core uses the FieldDefinitionGUID to extract all of the Stripe configuration data inside the REST API on the server so as not to expose sensitive information in the client. If the Stripe Payment Session, then the current instance data is updated. Otherwise, an ErrorMessage will be returned.

UserState

This service is used to control all aspects the state of the user within the user experience. Key functions include:

  • CallURLParams: Used to decode any parameters passed in the initial URL when the UX website is entered. This will then control actions such as joining workspaces/portals, deep linking to existing instances etc.
  • Configuration: Used to control loading of configuration parameters as the user enters the website and then navigates into a workspace. Also used to read/modify the user’s parameters.
  • CallAPI: Used for all user-level REST-WebAPI-Core requests including SignUp, SignIn, EnterWorkspace, etc.
  • Log: Used to log events to the database and if connected to Application Insights.

Validator 

This service is used to track validation errors on the page the user is currently on. To call methods within this service ensure to go through the form builder which contains a Validator object that updates as the user navigates the user experience. 

Bookmark

This service is used to handle Create, Update, and Delete (CUD) operations for user bookmarks. This service only contains one function that requires a BookmarkInformation object to be passed.

  • CallAPI: Used to me a request to REST-WebAPI-Core which will perform the requested action for the bookmark.

WASM MAUI Services

These services are used to implement the Shared Interfaces to determine what functionality is available on the WASM (website) side.

GI_WASM_Settings

This service implements the IGI_Settings service and does not allow any additional functionality for the website.

GI_WASM_Map

This service implements the IGI_Map service and does not allow any additional functionality for the website.

GI_WASM_Storage

This service implements the IGI_Storage service and does not allow any additional functionality for the website.

GI_WASM_Contact

This service implements the IGI_Contact service and does not allow any additional functionality for the website.

Updated on March 25, 2024

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support

Leave a Comment