I have been using Umbraco for some time as the main CMS of choice when developing new sites for our clients. As part of our development, we create travel sites for small to medium sized tour operators that link to the desktop software product we have written via web services. The aim of this is for the user to edit information about their products on their desktop without having to touch the website or CMS in any way as we use a combination of nightly calls to the web services of the desktop software and the Umbraco content service to present the information from the desktop product on the website with the correct formatting.
Currently, the update process is triggered by a scheduled task on the server which calls a url to trigger the update process:
/umbraco/webservices.aspx?type=product
This is also the way in which our clients can manually trigger updates to their website. However, this is reasonably insecure as ultimately anyone who has access to the website can trigger and update at any point. We would therefore like to port over our update process to a set of WebApi methods instead which will have a parameter passed along to them to identify that the user is allowed to run an update (or is the automatic process triggered by the server).
With regards to the WebApi method, I pretty much have this sorted but I am really struggling with regards to implementing a custom dashboard in the Umbraco back office that consists of a simple button that will trigger the update process, display a loading screen whilst the process is running and then finally display a popup notification when the process is complete.
I have attended the Umbraco Level 2 certification course last year and so far have been following the documentation I was given there but it doesn't really explain the process in any depth or detail so therefore I will need to some pointers or direction on how this can be done as the Umbraco documentation also isn't very clear on this sort of thing.
My controller is stored in my controllers folder and is as follows:
public class AxumController : UmbracoApiController
{
private AxumController(){
// setup global variables here
}
public string GetAllGroupTours(){
try{
// web service calls and update logic go here
}catch(Exception){
Log.Error("Exception", ex);
throw;
}
// Return a string with the number of updates that have been conducted
return "" + webservice_tours.Count + " tours have been updated";
}
}
As I mentioned I am pretty happy with this however it is the Angular side of things that is a little confusing.
I have the following two files setup:
AxumSynchronisation.service.js
angular.module("umbraco.services").factory("AxumSynchronisationService", function ($http) {
return {
getAll: function () {
return $http.get("/umbraco/api/Axum/GetAllGroupTours");
}
}
})
The question now is, how do i wire this up to my dashboard html so that it is initialised when a button is clicked and what is the best practice for triggering the built in Umbraco loading screen and notification bubbles?
Any help would be greatly appreciated as like I mention the documentation for this is somewhat lacking.
You can combine all the things you learned in the Umbraco Level 2 masterclass exercise.
Change your AxumSynchronisation.controller.js to add the getAll function to the scope, that way you can trigger it from your view (see below). This is what the L2 exercise does when deleting a like. Also, add an info object like what's done in the L2 customeditor exercise.
Thanks for the response. I have modified my code to reflect your comments above and now have a button that is displayed however, when I click it, nothing happens.
You absolute legend! Well spotted and thanks for your help.
That's all I really needed as a lot of the documentation I was given from Level 2 had bits missing at the time (think it may have been updated now). Anyway at least now I have a foundation to build on top of. Sebastiaan to the rescue again!
Yeah depends a bit on when you did the certification of course. All the v7 stuff has been continually updated based on all the feedback we got! Glad to hear it's working now.
Custom dashboard - Umbraco update service
Hi all,
I have been using Umbraco for some time as the main CMS of choice when developing new sites for our clients. As part of our development, we create travel sites for small to medium sized tour operators that link to the desktop software product we have written via web services. The aim of this is for the user to edit information about their products on their desktop without having to touch the website or CMS in any way as we use a combination of nightly calls to the web services of the desktop software and the Umbraco content service to present the information from the desktop product on the website with the correct formatting.
Currently, the update process is triggered by a scheduled task on the server which calls a url to trigger the update process:
This is also the way in which our clients can manually trigger updates to their website. However, this is reasonably insecure as ultimately anyone who has access to the website can trigger and update at any point. We would therefore like to port over our update process to a set of WebApi methods instead which will have a parameter passed along to them to identify that the user is allowed to run an update (or is the automatic process triggered by the server).
With regards to the WebApi method, I pretty much have this sorted but I am really struggling with regards to implementing a custom dashboard in the Umbraco back office that consists of a simple button that will trigger the update process, display a loading screen whilst the process is running and then finally display a popup notification when the process is complete.
I have attended the Umbraco Level 2 certification course last year and so far have been following the documentation I was given there but it doesn't really explain the process in any depth or detail so therefore I will need to some pointers or direction on how this can be done as the Umbraco documentation also isn't very clear on this sort of thing.
My controller is stored in my controllers folder and is as follows:
As I mentioned I am pretty happy with this however it is the Angular side of things that is a little confusing.
I have the following two files setup:
AxumSynchronisation.service.js
AxumSynchronisation.controller.js
The question now is, how do i wire this up to my dashboard html so that it is initialised when a button is clicked and what is the best practice for triggering the built in Umbraco loading screen and notification bubbles?
Any help would be greatly appreciated as like I mention the documentation for this is somewhat lacking.
You can combine all the things you learned in the Umbraco Level 2 masterclass exercise.
Change your
AxumSynchronisation.controller.js
to add thegetAll
function to the scope, that way you can trigger it from your view (see below). This is what the L2 exercise does when deleting a like. Also, add aninfo
object like what's done in the L2 customeditor exercise.In your view handle the button click to execute that new
$scope.getAll
:<input type="button" ng-click="getall()" />
Also add an info span to show the message when done (see the
$scope.info
above):<span ng-bind="info"></span>
Hi Sebastiaan,
Thanks for the response. I have modified my code to reflect your comments above and now have a button that is displayed however, when I click it, nothing happens.
Any ideas why?
The following is how I have everything setup now (the names are different because i deleted everything prior out of sheer frustration):
axumupdateservice.html
AxumUpdateService.controller.js
AxumUpdateService.service.js
package.manifest
getAll
is with a capital a, make sure to update your view:<input type="button" ng-click="getAll()" />
.As always, use the debugging tools in your browser as well, it would've told you that I had a bug in my code ;-)
You absolute legend! Well spotted and thanks for your help. That's all I really needed as a lot of the documentation I was given from Level 2 had bits missing at the time (think it may have been updated now). Anyway at least now I have a foundation to build on top of. Sebastiaan to the rescue again!
Yeah depends a bit on when you did the certification of course. All the v7 stuff has been continually updated based on all the feedback we got! Glad to hear it's working now.
is working on a reply...