Initial Settings & Connecting to your Qlik Site

Initial configuration of your exported code

Settings

All Motor Mashups include a settings/index.js file in the src folder. Here, you can edit some initial settings of your mashup, including connection to your Qlik app and some theming. You can find an example of this below.

Settings file Example

// Settings/index.js

export const footer = {
  footerText: "Copyright Motor © 2021",
};

export const qlikConfig = {
  //Enter your Qlik config here..
  host: "juno-ui.eu.qlikcloud.com", // Qlik Sense Host
  secure: true, // Whether your host is secure of not (HTTPS / HTTP)
  port: null, // Qlik Sense site port
  prefix: "", // Prefix
  appId: "0294cf88-eb02-484a-b315-cf06b45ac347", // Application Id
  webIntId: "4Tx-ydWxSQEM_q1ajlYBVzGgVUVJUo-i", // Web Integration Id, for connection to Qlik cloud
  qcs: true, // whether you are connecting to a Qlik Cloud site or not
};

export const appSettings = {
  theme: "light", // light or dark
  showThemeSwitch: true, // Show the toggle to change theme
  
  /* Note that the login component is only available when connecting to Qlik cloud */
  
  logo: "/static/media/motor-red.99524ab9.png", // Path to logo used for the Login box
  logoHeight: "40px", // Login logo height
  logoWidth: "120px", // Login logo width
  buttonColor: '#FF7171', // Button color
  buttonFontColor: 'white', // Button font color
  body: "Please login to get started 🎉'", // Login text
  loginfontFamily: '"NoirPro", sans-serif', //Login & Not Connected modal font
  NotConnectedheader: "Connection lost", // Not Connected header text
  NotConnectedBody: "Please refresh to continue", // Not Connected body text 
};

In this example, we have 3 objects that we are using in our application:

  • footer: To edit the footer text

  • qlikConfig: Used in the Motor component to connect to your Qlik Sense site

  • appSettings: Settings used both in the Motor component (to theme the Login & Not Connected components) and to change some theme settings of our mashup

Connecting to your Qlik Site

You can connect to your Qlik site by updating the qlikConfig object with the details of your Qlik Sense instance.

The Motor Component

The Motor component will use the qlikConfig and appSettings objects to connect to your Qlik Sense site and apply some customisations.

This is imported into the root of your React project, so you can find it in src/index.js. This will be looking something like the below. Note we are passing the config into our Motor component along with specific customisations to theme the Login & Not Connected components.

The Motor component will pass the connection to your Qlik app as context to all of the hooks in the @motor-js/engine package.

import React from "react";
import ReactDOM from "react-dom";
import { Motor } from "@motor-js/engine";

import reportWebVitals from "./reportWebVitals";
import App from "./containers/App";
import { qlikConfig, appSettings } from "settings";
import Store from "store";

ReactDOM.render(
  <Motor 
    config={qlikConfig}
    logo={appSettings.logo}
    logoHeight={appSettings.logoHeight}
    logoWidth={appSettings.logoWidth}
    buttonColor={appSettings.buttonColor}
    buttonFontColor={appSettings.buttonFontColor}
    body={appSettings.body}
    loginfontFamily={appSettings.loginfontFamily}
    NotConnectedheader={appSettings.NotConnectedheader}
    NotConnectedBody={appSettings.NotConnectedBody}
  >
    <Store>
      <App />
    </Store>
  </Motor>,
  document.getElementById("root")
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

Connecting to Qlik Sense Cloud

Please find an example below connecting to a Qlik Sense Cloud instance. You need to set the qcs property to true and add a webIntId generated from you QSC server.


import { Motor } from '@motor-js/core'

<Motor
  config={{
    host: 'qlikhost.eu.qlikcloud.com',
    secure: true,
    port: null,
    prefix: '',
    appId: '39e218c1-42ee-4f38-9451-1b8f850505d5',
    webIntId: '...',
    qcs: true,
  }}>
>
// ...
</Motor>

Hosting Externally, pointing to Qlik Sense Enterprise

Motor currently doesn't handle authentication to Qlik Sense Enterprise. You will need to configure this yourself depending on your choice of authentication method. You can see an example of this below:

For more details of how to connect to your Qlik Site, see Motor.

Having trouble connecting? Send our support team a note at hello@motor-js.io!

Last updated