Planning Analytics

 View Only

PAjs – Hot Promoting Processes; Get, Post, Patch and Delete

By Edward Stuart posted Thu November 17, 2022 07:19 AM

  

Previously, we covered listing AdminHosts and Servers, then we looked at logging into a TM1 Server and where the GitHub project is hosted:

https://github.com/EddStuart/PAjs

We now move onto working with these AdminHosts and Servers by using the Planning Analytics with Watson REST API to promote a process from one model to another.

To start with I select my AdminHost:


Then the 24Retail model:


Then I login to the model with my credentials:


On the main server screen I select ActiveSession and see the following:

At present, each of the navigation options on the left pane will display the results of the REST API call in a READ only manner (via a GET request).

The response we receive from the server arrives in a series of key-value pairs, I have listed the “Key” aspect as the row 'title' on the left and the “Value” aspect is displayed in a HTML input element with the existing value loaded from the server.

In the future this will be an input field that can post a change back to the TM1 Server or additional functionality will be added around it.

Note the console.log response for the above example:

We can use this 'default' behaviour (running a GET request against each section) to get a feel for what the REST API will return when we look at each component, I should note that the “ActiveConfiguration” section has been flattened to focus on the reduction in the number of clicks, so this will not display as the response would traditionally.

When I select “Processes” I see a different response where each process name is listed in it's own box/ button:

This is because I have added an array of those items that have been updated in PAjs and set a condition to render the page differently if the activeItem (the item selected in the left menu) is found in this array, as more and more sections are updated these will potentially be rendered differently and will require splitting off in the item.js file

Back to the UI and when I select a Process:

I am now on the Process page, note that as we are not looking to replicate existing functionality I have not listed out the process details such as; Name, PrologProcedure, MetadataProcedure, HasSecurityAccess etc..

The intent at this time is to work with the process as a whole; Copy (Post), Update (Patch) or Delete (Delete) the process:

When I select each option, the other two options disappear and we see our AdminHost listing again:

We select the AdminHost we want to move the process too and then our currently running Planning Analytics servers are displayed

Before I Copy this process across, I am going to confirm the existing Process listing for the SustainabilityScope3 model:

I can also check this via PAjs as you would expect:

We can see that the process “Copy_Product_SupplyChain” does not exist on the SustainabilityScope3 model.

I navigate back to the 24Retail model and the “Copy_Product_SupplyChain” process, select “Copy Process to another model”

And select the SustainabilityScope3 model and our process has now been copied. As it stands there is not a confirmation response to confirm the process has been copied, this will be added in due course.

If you attempt to copy over a process that already exists then you would see an error message to that effect. To confirm this, I will now copy the process again:

We have some work to do to tidy up the error message but we understand what the issue is. Note that backslashes are used to escape characters and these will get cleaned up.

So, we should now have our new process on the SustainabilityScope3 model:

Excellent, our process has been copied between the 24Retail server and the SustainabilityScope3 server.

*Note, to maintain compatibility with Architect/ Perspectives we have to ensure we take the UIData and VariablesUIData which do not get pulled from a default GET request. This topic will be covered in more detail in a future blog.

Now, what if I’ve made changes to our process in the 24Retail model and I now want to copy those changes across?

I make changes to my process:

As you should expect, when I select the Update button in PAjs and navigate to my AdminHost, I can select the model I want to update the process for:

Again I don’t have any feedback to the user at present to confirm this has occurred.

When I review the process:

We can see all the changes we’ve made. Excellent!

Finally, we can delete a process:

And our result is not displayed on the screen but the process has been deleted:

So there we have it, we have been able to Copy, Update and Delete a process using the REST API and most importantly we’ve been able to make all of these changes between Models without any downtime or impact on our users.

Where could this go?
- We can update the process to update multiple processes at a time.
- We could also deploy processes to multiple models and servers
- We could build an application that syncs processes between models
- We could dig into the Process details and customise each process deployment to each model with additional model specific variables
and so on and so forth

Keep an eye on the PAjs project to see the latest updates, thanks for reading and my next post should be out next week


#PlanningAnalyticswithWatson
0 comments
21 views

Permalink