Configurations



Settings

The settings concept allows us to store most settings in a general way in a single table.

Settings are stored in table core.setting where column setting_key is primary key and column setting_value has the value for the setting.

Settings are grouped using column group_key which links to table core.setting_group.

Function core.get_seting_value is used in code to read setting from table.

SELECT * FROM core.setting       ORDER BY setting_key
SELECT * FROM core.setting_ex    ORDER BY group_key, setting_key
SELECT * FROM core.setting_group
 
SELECT core.get_setting_value('zys_debug_logging')

Note that you have identical core.setting tables in both STG and PROD but the data in the tables is different. You can also have have the same setting keys in both databases with different setting values (columns setting_key and setting_value), one example being the zys settings where you could f.e. have different database stats or index maintenance settings in STG and PROD.




To edit the navigation open System Settings, head to App navigation, and then click the button which will open a config modal. After implementing your changes, click save and refresh the app.

Note: To edit the the JSON config the user must have Development Mode feature enabled.

properties

The app navigation is an array of modules, with each module containing the following properties…

name (string)

The name property sets the name of the module in the navigation bar. The property is translated and the translation key should be used.

index (number)

The dropdown menu of modules is sorted by their index.

color (string)

The following colors are available for you to choose from:

  • blue
  • indigo
  • purple
  • pink
  • red
  • orange
  • yellow
  • green
  • teal
  • cyan
  • gray

homepage (string)

When a module is selected, or the AGR logo is clicked, the user will be redirected to the homepage. The default homepage is the dashboard. However, since not all modules will have access to the dashboard and others might want a custom homepage this property gives you the freedom to select your own.

Sets the navigation bar of the module. The example below will result in the navigation bar shown here:

inst

{
    "navigation": [
        {
            "caption": "ITEMS",
            "path": "items",
            "feature": "items"
        },
        {
            "caption": "NAV_REPORTS",
            "path": "reports",
            "feature": "reports"
        },
        {
            "caption": "NAV_PLANS",
            "path": "workspaces/list/plans",
            "feature": "plans",
            "icon": "thumbs-up"
        },
        {
            "caption": "ORDERS",
            "path": "orders",
            "feature": "orders",
            "submenu": [
            {
                "caption": "NAV_REPORTS",
                "path": "reports",
                "feature": "reports"
            },
            {
                "divider": "true"
            },
            {
                "caption": "NAV_PLANS",
                "path": "workspaces/list/plans",
                "feature": "plans"
            }
            ]
        }
    ]
}
  • caption (string): The name of the feature, i.e. the translation key.
  • path (string): The path of the feature.
  • feature (string | string[]): The feature(s) required to access the feature.
  • divider (boolean): Turns the object into a dropdown divider.
  • icon (string): Name of a font-awesome icon, e.g. “thumbs-up”, without the fa- prefix. Adds an icon in front of the caption, but the caption is not required, i.e. you may use only an icon if you want to. Any icon from this list may be used: https://fontawesome.com/v4.7.0/cheatsheet/.
  • submenu (array): To turn a button in the navigation bar to a dropdown menu. The array holds the dropdown items.

full example (array)

The example below is an example from a bm initial load, to show the navigation with multiple modules. It does not include dropdowns or icons, so be sure to check those out in the navigation section above.

[
  {
    "name": "INVENTORY",
    "index": 0,
    "color": "blue",
    "homepage": "dashboard",
    "navigation": [
      {
        "caption": "ITEMS",
        "path": "items",
        "feature": "items"
      },
      {
        "caption": "NAV_REPORTS",
        "path": "reports",
        "feature": "reports"
      },
      {
        "caption": "NAV_PLANS",
        "path": "workspaces/list/plans",
        "feature": [
          "plans",
          "purchasePlans"
        ]
      },
      {
        "caption": "NAV_ORDERS",
        "path": "orders",
        "feature": "orders"
      },
      {
        "caption": "NAV_COUNTING",
        "path": "counting",
        "feature": "counting"
      }
    ]
  },
  {
    "name": "PLANNING",
    "index": 1,
    "color": "green",
    "navigation": [
      {
        "caption": "NAV_MERCHANDISE_FINANCIAL",
        "path": "workspaces/dm/dm",
        "feature": "dm"
      },
      {
        "caption": "NAV_LOCATION_FINANCIAL_PLANNING",
        "path": "workspaces/dm/dm",
        "feature": "dm"
      },
      {
        "caption": "NAV_LOCATION_CLUSTERING",
        "path": "workspaces/lm/lm",
        "feature": "lm"
      }
    ]
  },
  {
    "name": "ASSORTMENT",
    "index": 2,
    "color": "orange",
    "navigation": [
      {
        "caption": "NAV_RANGE_MANAGER",
        "path": "workspaces/rm/rm",
        "feature": "rm"
      },
      {
        "caption": "NAV_OPTION_MANAGER",
        "path": "workspaces/om/om",
        "feature": "om"
      },
      {
        "caption": "NAV_PURCHASE_PLANS",
        "path": "workspaces/ppm/ppm",
        "feature": "ppm"
      }
    ]
  }
]




Translations

Since version 6.2 translations have been moved to the cloud. This means that new translations and languages can be added to the system without releasing a new update.

To Enable this feature (retrieval of translations from the cloud) you have to set the cloud_translations setting in [core].[setting] to true. This can also be done in system settings from within the client application.

Global translations for all running AGR systems are stored in the “AGR Pool” cloud service at pool.agrdynamics.com/api. When translations are added or updated there they become available in all clients running AGR 6.2 or later.

The technical flow of how communications to the AGR Pool translations are handled are as follows:

  1. When the client application is opened in a browser it immediately requests all translations from the database which are a prerequisite for the app to work properly. The translations returned are a merge of those that exist in [dbo].[translations] and [dbo].[translation_override].
  2. As well as returning translations immediately a background task is also started which checks if there exists any new translations in the cloud (AGR Pool). This is done by comparing the translations checksum from the cloud with the translations_checksum value stored in [core].[setting]
  3. If these two values differ then:
    1. All translations are retrieved from the cloud (AGR Pool).
    2. All translations in [dbo].[translations] are deleted and replaced with those retrieved from the cloud.
    3. The new checksum value from the cloud is written to translations_checksum in [core].[setting]

Adding a Local Translation

Translations added to [dbo].[translation_override] take precedence over those in the cloud/[dbo].[translations].

INSERT INTO dbo.translation_override VALUES
('MY_NEW_REPORT_COLUMN', 'My new report column', 'en'),
('MY_NEW_REPORT_COLUMN', 'Nýji skýrsludálkurinn minn', 'is')

Don’t add translations to [dbo].[translations], it is harmless but your changes will be temporary as these translations are regularly overwritten with new data.

Adding Cloud Translations

Adding global translations might eventually be made available in a separate web application. Currently there are two inferior ways to add and update cloud translations.

  1. Use AGR client: Gain access to the cloud MSSQL database and directly insert translations in the translations table.
  2. Use Swagger: Login and gain access to the AGR Pool API endpoints at pool.agrdynamics.com/api

It is suggested to edit translations through the cloud database (method 1) since it is more user-friendly.

Updating / Add Translations through the AGR client

  1. Go to the AGR application and add /translations to the URL (e.g. r62.daily.local/translations).
    1. To update a translation, click the edit pen and sign in with credentials from DEV.
    2. To add a new translation row, click the plus icon in the far right corner.
  2. You can use the Google Translate feature by selecting the field you want to fill, click the magic button and type in the API key which you get from the DEV team.

create

  1. Changes can be undone by clicking the Info button and then Clear. See example below.

create

  1. When the translations have been added/updated, click the Save button.

Note: the caption in e.g. mbe_columns needs to correspond to the translation key (dbo.translations).

Updating Translations with Swagger

Go to pool.agrdynamics.com/api and ask the DEV team for login credentials.

  1. Log In using the POST /api/login route supplying the correct username and password, your response should look something like:
{ "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." }
  1. Copy the access_token value without the surrounding quote marks, e.g eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
  2. Click the Authorize button on top of the page and paste the access_token value.
  3. To test if you have authorization try out the GET /api/users endpoint.
  4. To add a single translation use the POST /api/translations endpoint.

Placeholders

If the translation needs to have a dynamic value you can use the translation placeholders. You add %s anywehere in the translation and that value will be replaced with whatever you put after the , in the translation key. F.ex:

INSERT INTO dbo.translations VALUES
('GOT_X_MINUTES', 'Got %s minues', 'en')

GOT_X_MINUTES,10 -> Got %s minutes -> Got 10 minutes