Skip to content

DevCore Manager Package

The foundation of the DevCore Framework is the devcore package. This package provides essential services necessary for mobile or desktop device management applications.

The DevCore is a VueJS/Vuetify extension that provides structure for your device management application. It provide the essential authentication, routing and data management services to manage one or more devices.

The DevCore provides the following features:

  • Setup and configuration of VueJS and Vuetify frameworks
  • Application structure with navigation bars, data display panels, dashboards and widgets and data editing forms
  • User authentication, login and access control
  • Dashboards and data and graphical widgets with dynamic live updating
  • Data property editor to view and modify device data
  • User navigation and request routing
  • Collection of core VueJS UI components for management applications
  • Device claim, release and management
  • Ability to connect to local HTTP device agents or cloud services

Using the DevCore as a foundation, you can elimiate countless months of developer time in creating a device management solution.

Installation

The DevCore package is installed from NPM DevCore.

bash
npm install @embedthis/devcore

Rebuilding from Source

The DevCore can be rebuilt from source that can be downloaded from the Builder or GitHub.

To build, type:

bash
make

After building the framework/dist directory will contain the devcore package. The apps/standard/ui/dist directory will contain the standard app which uses the devcore package.

Using the DevCore

The DevCore package is imported in the app's main routine. To initialize the framework, import the createManager API. For example:

js
import {createManager} from '@embedthis/devcore'

const manager = createManager({
    components: { ... },            //  Additional VueJS components
    display: Display,               //  UI Display definition
    router,                         //  VueJS router
    schema: Schema,                 //  Database schema
    vue,                            //  Vue instance
    vuetify,                        //  Vuetify instance
    widgets: {graph: GraphWidget},  //  Additional dashboard widgets
}, {
    api: Connect.api,               //  Backend URL prefix. Use "/api" for local and Connect.js when cloud-based.
    cognito: Connect.cognito,       //  Cognito config when cloud-based
    profile: Ioto.profile,          //  Execution profile
    tunnel: 'generic',              //  Tunnel requests via 'generic' controller when cloud-based
})

The createManager API accepts configured VueJS, Vuetify and Vue Router instances. You can configure these as you wish, but a typical setup would look like the following. Assuming the main components is sourced from src/main.js:

js
import * as components from 'vuetify/components'
import * as directives from 'vuetify/directives'
import Display from '../theme/display.json'

let vue = createApp(Main)
let router = createRouter({
    history: createWebHashHistory(),
    routes: [],
})
let vuetify = createVuetify(
    vuetifyProps({
        components: components,
        directives: directives,
        icons: AdditionalIcons,
    })
)
vue.use(vuetify)

A Manager instance is created with arguments (first parameter) that define the UI display, VueJS components and other configuration options. Here is a table of the createManager first parameter arguments.

PropertyDescription
componentsA map of VueJS components
displayThe display.json5 UI route definition file
schemaThe device database schema
modelsA map of REST data models
widgetsA map of additional dashboard widgets
routerA configured VueJS router instance
vueA configured VueJS instance
vuetifyA configured Vuetify instance

The Manager constructor also takes an "options" argument (second parameter) that supplies additional app configuration information.

The following properties should be provided via the options:

PropertyDescription
apiBackend API URL prefix. Use "/api" for local and Connect.js when cloud-based.
buildBuild version number. Single number build version.
cognitoAWS Cognito user authentication configuration. Set to connect.cognito when cloud-based.
hostAPI host name override. Use when the API host name is not the same as the app host name.
profileOperational profile (dev, prod)

API Endpoint

When a device app is hosted by the cloud, the Ioto service adds a Connect.js configuration file to the app site that can be imported from the top level of your app. The Connect.js script provides the api endpoint address and the AWS Cognito user authentication endpoint configuration. Both are required for cloud-based device apps.

Here is a sample Connect.js:

js
{
    "api": "https://xxxxxxxxxx.execute-api.ap-southeast-1.amazonaws.com",
    "builder": "https://api.admin.embedthis.com",
    "cognito": {
        "userPoolId": "ap-southeast-2_xxxxxxxxx",
        "clientId": "xxxxxxxxxxxxxxxxxxxxxxxxxx"
    }
}

This file should be imported and the "api" and "cognito" properties used in the Manager options. For example:

js
import Connect from '../Connect.js'
createManager({
    ...
}, {
    ...
    api: Connect.api,                   //  Backend cloud service API
    cognito: Connect.cognito,           //  Cognito config
})

DevCore Exports

The DevCore package exports a suite of configured service objects and support functions.

Service Objects

NameDescription
AuthPrimary authentication service
FeedbackUser UI informational feedback service
ProgressUser activity progress bar service
RestREST HTTP service
RoutesNavigational routes service
RulesInput valiation rules
StateGlobal application state service

Support Functions

NameSignatureDescription
cancan(role)Can the logged in user perform the given role
createManagercreateManager(params, options)Create and initialiate a manager instance
getVuegetVue()Return the initialized Vue instance
getModelgetModel(model)Return the schema data model definition
getModelsgetModels()Return a list of the schema data models
getRoutegetRoute()Return the Vue Router object for the current UI page
getRoutePathgetRoutePath()Return the current Vue router URL
getRoutergetRouter()Return the Vue router instance
navigatenavigate(url, query)Navigate the UI to the given URL
vuetifyPropsvuetifyProps(params)Convert the given params to Vuetify constructor args