Sample Application

Create a custom application on the platform

On OBTO platform, it is quite easy to create an application. In this documentation we will be making an ISSUE TRACKER application. Follow these steps to create an application: -

  1. On the navigation bar, navigate to Configure > under Configure navigate to App Manager.

  1. The App manager application opens up.

  1. Click on create to create an application and the modal form opens up.

  1. Provide Name and Description of the application and check what do you want to include in your application (UI Template, Client Policy etc).

  1. Now you have successfully created an application.

  2. To access your application, refresh the page and you will see your application listed there. Click on view, it will navigate to a new tab and open your application.

  1. Now it’s time to put some code into this application. We will start with UI TEMPLATE (HTML).

  2. To access UI TEMPLATE: -

    1. Navigate to Scripts > UI Templates.

  1. Right click on this row and click Edit.

  2. Form to edit HTML opens up.

  3. Below image shows only the half part of the form. Select mode as HTML and then just start writing the HTML.

  1. Below image shows the other part of the form to write CSS. Select mode as CSS.

  1. Now in this editor, we will build a form to create an issue.

  2. Let’s add some HTML in it. Below image shows the HTML form we have created for issue tracker application.

  1. Now you would be thinking where is the <!DOCTYPE html>, <head> , <body> tags. Don’t worry it has been automatically handled by the platform. You have to just write the main part of the HTML. That means the part inside the <body> tag. Remember your application is running inside the platform as a directive.

  2. Below image shows how the form looks on the platform.

  1. Let’s write logic to submit this form.

  2. The logic to submit this is form will be written in CLIENT POLICY.

  1. Let’s add some code to this CLIENT POLICY. Below image shows the form logic in the CLIENT POLICY.

  1. So, this client policy is basically a controller (A normal AngularJS controller).

  2. ‘obto' contains the AngularJS objects and APIs like scope, http, rootscope.

  3. $scope.issue object contains the form data linked through ng-model concept in AngularJS.

  4. We are setting the issues’s status to new and priority to low by default.

  5. $scope.createIssue is a function that gets called when clicked on ‘Create Issue’ button.

  6. Also notice that we are using async await concept which means platform provides the latest javascript features.

  7. Inside HTTP POST request the url - ‘createissue.bto’ point to a REST API that we will discuss later in this documentation.

  8. Now in order to save this data we need a Collection (Table).

  9. Follow the steps to Create Collection.

  10. Now a Collection (Table) needs fields (Columns). Follow the steps to Create Fields.

  11. Below image shows the collection named – pltf_issue_tracker (use this snake_case convention to name collections).

  1. Now in order to save data to this collection we need a REST endpoint which is called ROUTE which is ‘/createissue.bto’ as shown above.

  2. Follow these steps to create a ROUTE.

  3. Below image shows the route created to save data to the collection – pltf_issue_tracker.

  1. In the above code, you can see it’s normal NodeJS code.

  2. At line no. 3, domain is what you create when registering to the platform.

  3. Issue is the request payload which contains the issue information.

  4. We attach domain property to issue information as data in database is separated on domain basis.

  5. At line 23, we use database driver (behind the scenes it uses native mongo db drivers) provided by the platform.

  6. We pass to it the name of the collection - ‘pltf_issue_tracker’, data to save - ‘issue’, createOptions which is just additional configuration you want while saving the data and at last comes the callback which gets called when the database operation of inserting a record is completed.

  7. So, at last, let’s use the application and create an issue.

  8. Let's fill up the form.

  1. And the Issue has been successfully created.

  1. Let’s see if the data actually got saved in the collection.

  2. Yes, it got saved.

  3. You can see the short description, description, status, priority.

So, that’s it, this was whole tutorial where you learnt how to make a custom application on the platform and you saw how smoothly and easily you can create an application.

Last updated