Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
{
  "name": "OMS Applications",
  "code": "omsapplications",
  "pages": [{
    "name": "Applications",
    "code": "applications",
    "module_link": "all/applicationsController.js",
    "icon": "fa fa-ticket"
  }]
}

The meaning of the name parameters is how the service will be called in the modules listing. In the pages array, you are able to provide frontend pages and their controller. Please note that the module_link again is relative to your service, so the url to your service will be appended automatically. And the code is the entry in the baseUrlRepository - to understand what exactly that is have a look at this code:

...

the following:

getModules.json
ParameterRequiredDescription
nameYes

Module friendly name

(no limitations, can be changed in time

example: OMS Events module)

codeyes

Module internal name - This will be the entry for the service in the baseUrlRepository (see below)

(no spaces, all lowercase, cannot be changed once registered,

example: oms_events)

pagesyes

JSON array containing frontend pages data

Each entity inside the array should contain the following attributes:

name - Frontend friendly name (example: List events)

code - Frontend internal name (example: applications) - This one should be the same with the AngularJS module name defined in the module

module_link - relative (to your service) pathto the module controller JS file



To understand more of what is happening above, have a look at the actual controller, which in our example sits in /all/applicationsController.js

Code Block
linenumberstrue
(() => {
  'use strict';
  const baseUrl = baseUrlRepository['omsapplications'];
  const apiUrl = `${baseUrl}api/`;

  /** @ngInject */
  function config($stateProvider) {
    // State
    $stateProvider
      .state('app.applications', {
        url: '/applications',
        data: { pageTitle: 'Applications' },
        views: {
          'pageContent@app': {
            templateUrl: `${baseUrl}all/welcome.html`,
            controller: 'WelcomeController as vm',
          },
        },
      });
  }

  function WelcomeController($scope, $http) {
    alert("our first controller");
  }


  angular
    .module('app.applications', [])
    .config(config)
    .controller('WelcomeController', WelcomeController);
})()

These are the contents of /all/applicationsController.js. In this example, const baseUrl would end up being "http://localhost/services/applications/". This is injected by the registry and the core automatically, you do not have to care about this. And actually you also can not care about this, as the registry sets the url for you, based on what you put in the docker-compose.yml. This is already everything you need to start your own frontend! Also you will find the name of your controller here, hint: .modue('app.applications', []). If you fuck up this configuration, you will blow the complete frontend by activating your module until https://oms-project.atlassian.net/projects/CORE/issues/CORE-22 is implemented, so you will know when you put something wrong in here.

Backend

This is what lives inside the cloud and is only exposing an API to the client. You can write the backend in whatever language you want, but we recommend to choose node.js or php/laravel, as we have other services written in those languages and thus other people being able to help you and to maintain your code. Again, we first have to start off with adding a docker-compose.yml entry (or asking someone to do that for you):

...