Skip to content

Add a new app ​

This guide will explain the steps involved in setting up a new app in Luna. Examples use a hypothetical Timesheets app, restricted to users with a Timesheets role.

App table ​

In order for an app to be added to Luna it needs to be added to the <TEAM_ENV_NAME>-apps-table. A good way to prevent an app in development from showing in production is by simply not adding it to the production-apps-table, and then release it by adding it to the table.

Use the create-app script to create a new app record in the apps table, run through the Luna CLI: luna -e <TEAM_ENV_NAME> script run cli-scripts-legacy/index.js --modules cli-scripts-legacy -- create-app -e <TEAM_ENV_NAME> This will ask a series of questions, examples of answers are provided below:

  1. const appName = await inquirerUtils.input(`Enter the new app you want to create`); - Timesheets
  2. const domain = await inquirerUtils.input(`Enter the domain the app is in. eg. client/andi`); - andi
  3. const iconName = await inquirerUtils.input(`Enter the the iconName of app. eg. createEvents`); - timesheets
  4. const ordinal = await inquirerUtils.input(`Enter the ordinal number, Default 0`); - 0
  5. const uri = await inquirerUtils.input(`Enter the the uri of app. eg. /profile`); - timesheets
  6. const type = await inquirerUtils.input(`Enter the type of the app. eg. APP`); - APP
  7. const active = await inquirerUtils.confirm(`Do you want the app to be active?`); - Y

App icon ​

The app icon that appears in the navbar on Luna needs to be added to an S3 bucket as a svg file. Ensure this is done across all environments. The name of the icon will have to be the same that is specified in the apps-table when specifying iconName (see above).

env-app-icons-and-digital-luna-bucket The read access will need to be public for the icon.

User permissions ​

Users will have permissions for a nav item to appear in Luna. These are handled in the <TEAM_ENV_NAME>-user-roles-table and can be updated via CLI-script. For the Timesheets example, only users with the Timesheets role should be able to navigate to the tab, so these permissions go in a _Timesheets.js file.

module.exports = {
    "roleName": "Timesheets",
    "type": "role",
    "permissions": [],
    "permissions": [
        {
        "action": "read",
        "subject": "App",
        "fields": [
            "timesheets"
        ]
    },
  ],
};

For more information on user permissions see documentation

Adding the app to Luna ​

Add a new gateway with root route on the FE in luna/clients/luna-front-end/src/routes/Routes.jsx:

jsx
    <Gateway path='/timesheets'>
        <AuthRoute
            action={TIMESHEETS_UPDATE_ACTION}
            navigateTo='/'
            path='/'
            subject={TIMESHEETS_SUBJECT}>
            <TitledRoute component={TimesheetsLanding} path='/' title='Timesheets' />
        </AuthRoute>
    </Gateway>

Made with ❤️ by the Luna team