From 00fd1faa215fbb1a5f87395af88e5b7deb464351 Mon Sep 17 00:00:00 2001 From: lbwexler Date: Thu, 14 Jun 2018 14:35:52 -0400 Subject: [PATCH 1/3] Enhance RenderApp method --- core/XH.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/core/XH.js b/core/XH.js index 25ce4ba625..f8caa8f6b5 100644 --- a/core/XH.js +++ b/core/XH.js @@ -128,16 +128,15 @@ class XhModel { /** * Main entry point. Initialize and render application code. * - * @param {Object} appModelClass - class containing main application state and logic. - * Should be a subclass of BaseAppModel. - * @param {Object} appComponentClass - class describing main application view. - * Should extend Component and be decorated with @HoistComponent. + * @param {BaseAppModel} config.modelClass - object containing main application state and logic. + * @param {Object} config.componentClass - class describing main application view. + * This class should extend Component and be decorated with @HoistComponent. */ - renderApp(appModelClass, appComponentClass) { - this.appModel = new appModelClass(); - + renderApp({appModel, componentClass}) { + this.appModel = appModel; + const rootView = appContainer( - elem(appComponentClass, {model: this.appModel}) + elem(componentClass, {model: this.appModel}) ); ReactDOM.render(rootView, document.getElementById('root')); From 7bcea3228f8e541353cdf3dc95367477ade182ce Mon Sep 17 00:00:00 2001 From: lbwexler Date: Thu, 14 Jun 2018 18:34:04 -0400 Subject: [PATCH 2/3] AppModel -> App --- admin/App.js | 217 ++++++++++++++++------- admin/AppComponent.js | 84 +++++++++ admin/AppModel.js | 173 ------------------ admin/index.js | 2 - app/AppContainer.js | 6 +- app/impl/LoginPanel.js | 2 +- app/index.js | 1 - cmp/button/LogoutButton.js | 2 +- app/HoistAppModel.js => core/HoistApp.js | 23 ++- core/XH.js | 25 ++- core/index.js | 1 + mobile/cmp/button/LogoutButton.js | 2 +- mobile/cmp/navigator/RouteNavigator.js | 2 +- 13 files changed, 275 insertions(+), 265 deletions(-) create mode 100644 admin/AppComponent.js delete mode 100644 admin/AppModel.js delete mode 100644 admin/index.js rename app/HoistAppModel.js => core/HoistApp.js (79%) diff --git a/admin/App.js b/admin/App.js index 2e2b164674..ccd6346a95 100644 --- a/admin/App.js +++ b/admin/App.js @@ -4,81 +4,172 @@ * * Copyright © 2018 Extremely Heavy Industries Inc. */ +import {XH, HoistApp} from '@xh/hoist/core'; +import {action} from '@xh/hoist/mobx'; +import {TabContainerModel} from '@xh/hoist/cmp/tab'; -import {Component} from 'react'; -import {navbar, navbarGroup, navbarHeading, button} from '@xh/hoist/kit/blueprint'; -import {XH, HoistComponent} from '@xh/hoist/core'; -import {lockoutPanel} from '@xh/hoist/app'; -import {tabContainer} from '@xh/hoist/cmp/tab'; -import {frame, panel} from '@xh/hoist/cmp/layout'; -import {logoutButton, themeToggleButton, refreshButton} from '@xh/hoist/cmp/button'; -import {Icon} from '@xh/hoist/icon'; +import {AppComponent} from './AppComponent'; +import {AboutPanel} from './tabs/about/AboutPanel'; +import {ActivityPanel} from './tabs/activity/ActivityPanel'; +import {ConfigPanel} from './tabs/configs/ConfigPanel'; +import {ClientErrorPanel} from './tabs/clienterrors/ClientErrorPanel'; +import {FeedbackPanel} from './tabs/feedback/FeedbackPanel'; +import {EhCachePanel} from './tabs/ehcache/EhCachePanel'; +import {LogLevelPanel} from './tabs/logging/LogLevelPanel'; +import {LogViewer} from './tabs/logging/viewer/LogViewer'; +import {MonitorResultsPanel} from './tabs/monitor/MonitorResultsPanel'; +import {MonitorEditorPanel} from './tabs/monitor/MonitorEditorPanel'; +import {PreferencePanel} from './tabs/preferences/PreferencePanel'; +import {UserPreferencePanel} from './tabs/preferences/UserPreferencePanel'; +import {ServicePanel} from './tabs/services/ServicePanel'; +import {UserPanel} from './tabs/users/UserPanel'; -import './App.scss'; +@HoistApp +export class App { -@HoistComponent() -export class App extends Component { - render() { - if (!XH.getUser().isHoistAdmin) { - return lockoutPanel({message: 'Access to this area requires administrator permissions.'}); - } + tabs = this.createTabContainer(); - return panel({ - tbar: this.renderNavBar(), - item: frame({ - cls: 'xh-admin-app-frame', - item: tabContainer({model: XH.appModel.tabs}) - }) - }); + checkAccess(user) { + const role = 'HOIST_ADMIN', + hasAccess = user.hasRole(role), + message = hasAccess ? '' : `Admin console access requires the "${role}" role.`; + return {hasAccess, message}; + } + + get viewClass() {return AppComponent} + + @action + requestRefresh() { + this.tabs.requestRefresh(); + } + + getRoutes() { + return [ + { + name: 'default', + path: '/admin', + forwardTo: 'default.general', + children: this.getTabRoutes() + } + ]; } - //------------------ + //------------------------ // Implementation - //------------------ - renderNavBar() { - return navbar({ - items: [ - navbarGroup({ - align: 'left', - items: [ - Icon.gears({size: '2x'}), - navbarHeading(`${XH.appName} Admin`) - ] - }), - navbarGroup({ - align: 'right', - items: [ - button({ - icon: Icon.mail(), - text: 'Contact', - onClick: this.onContactClick - }), - button({ - icon: Icon.openExternal(), - title: 'Open app...', - onClick: this.onOpenAppClick - }), - themeToggleButton(), - logoutButton(), - refreshButton({ - intent: 'success', - onClick: this.onRefreshClick - }) - ] - }) - ] + //------------------------ + createTabContainer() { + return new TabContainerModel({ + id: 'default', + useRoutes: true, + children: this.createTabs() }); } - onContactClick = () => { - window.open('https://xh.io/contact'); + //------------------------ + // For override / extension + //------------------------ + getTabRoutes() { + return [ + { + name: 'general', + path: '/general', + forwardTo: 'default.general.about', + children: [ + {name: 'about', path: '/about'}, + {name: 'config', path: '/config'}, + {name: 'services', path: '/services'}, + {name: 'ehCache', path: '/ehCache'}, + {name: 'users', path: '/users'} + ] + }, + { + name: 'logging', + path: '/logging', + forwardTo: 'default.logging.viewer', + children: [ + {name: 'viewer', path: '/viewer'}, + {name: 'levels', path: '/levels'} + ] + }, + { + name: 'monitor', + path: '/monitor', + forwardTo: 'default.monitor.status', + children: [ + {name: 'status', path: '/status'}, + {name: 'editMonitors', path: '/editMonitors'} + ] + }, { + name: 'clientActivity', + path: '/clientActivity', + forwardTo: 'default.clientActivity.activity', + children: [ + {name: 'activity', path: '/activity'}, + {name: 'clientErrors', path: '/clientErrors'}, + {name: 'feedback', path: '/feedback'} + ] + }, + { + name: 'preferences', + path: '/preferences', + forwardTo: 'default.preferences.prefs', + children: [ + {name: 'prefs', path: '/prefs'}, + {name: 'userPrefs', path: '/userPrefs'} + ] + } + ]; } - onOpenAppClick = () => { - window.open('/app'); + createTabs() { + return [ + { + id: 'general', + switcherPosition: 'left', + children: [ + {id: 'about', component: AboutPanel}, + {id: 'config', component: ConfigPanel}, + {id: 'services', component: ServicePanel}, + {id: 'ehCache', name: 'Caches', component: EhCachePanel}, + {id: 'users', component: UserPanel} + ] + }, { + id: 'logging', + switcherPosition: 'left', + children: [ + {id: 'viewer', component: LogViewer}, + {id: 'levels', component: LogLevelPanel} + ] + }, + { + id: 'monitor', + switcherPosition: 'left', + children: [ + {id: 'status', component: MonitorResultsPanel}, + {id: 'editMonitors', component: MonitorEditorPanel} + ] + }, + { + id: 'clientActivity', + switcherPosition: 'left', + children: [ + {id: 'activity', component: ActivityPanel}, + {id: 'clientErrors', component: ClientErrorPanel}, + {id: 'feedback', component: FeedbackPanel} + ] + }, + { + id: 'preferences', + switcherPosition: 'left', + children: [ + {id: 'prefs', component: PreferencePanel}, + {id: 'userPrefs', component: UserPreferencePanel, reloadOnShow: true} + ] + } + ]; } - onRefreshClick = () => { - XH.appModel.requestRefresh(); + destroy() { + XH.safeDestroy(this.tabs); } -} \ No newline at end of file +} diff --git a/admin/AppComponent.js b/admin/AppComponent.js new file mode 100644 index 0000000000..8d8f11cf4d --- /dev/null +++ b/admin/AppComponent.js @@ -0,0 +1,84 @@ +/* + * This file belongs to Hoist, an application development toolkit + * developed by Extremely Heavy Industries (www.xh.io | info@xh.io) + * + * Copyright © 2018 Extremely Heavy Industries Inc. + */ + +import {Component} from 'react'; +import {navbar, navbarGroup, navbarHeading, button} from '@xh/hoist/kit/blueprint'; +import {XH, HoistComponent} from '@xh/hoist/core'; +import {lockoutPanel} from '@xh/hoist/app'; +import {tabContainer} from '@xh/hoist/cmp/tab'; +import {frame, panel} from '@xh/hoist/cmp/layout'; +import {logoutButton, themeToggleButton, refreshButton} from '@xh/hoist/cmp/button'; +import {Icon} from '@xh/hoist/icon'; + +import './App.scss'; + +@HoistComponent() +export class AppComponent extends Component { + render() { + if (!XH.getUser().isHoistAdmin) { + return lockoutPanel({message: 'Access to this area requires administrator permissions.'}); + } + + return panel({ + tbar: this.renderNavBar(), + item: frame({ + cls: 'xh-admin-app-frame', + item: tabContainer({model: XH.app.tabs}) + }) + }); + } + + //------------------ + // Implementation + //------------------ + renderNavBar() { + return navbar({ + items: [ + navbarGroup({ + align: 'left', + items: [ + Icon.gears({size: '2x'}), + navbarHeading(`${XH.appName} Admin`) + ] + }), + navbarGroup({ + align: 'right', + items: [ + button({ + icon: Icon.mail(), + text: 'Contact', + onClick: this.onContactClick + }), + button({ + icon: Icon.openExternal(), + title: 'Open app...', + onClick: this.onOpenAppClick + }), + themeToggleButton(), + logoutButton(), + refreshButton({ + intent: 'success', + onClick: this.onRefreshClick + }) + ] + }) + ] + }); + } + + onContactClick = () => { + window.open('https://xh.io/contact'); + } + + onOpenAppClick = () => { + window.open('/app'); + } + + onRefreshClick = () => { + XH.app.requestRefresh(); + } +} \ No newline at end of file diff --git a/admin/AppModel.js b/admin/AppModel.js deleted file mode 100644 index d98385768f..0000000000 --- a/admin/AppModel.js +++ /dev/null @@ -1,173 +0,0 @@ -/* - * This file belongs to Hoist, an application development toolkit - * developed by Extremely Heavy Industries (www.xh.io | info@xh.io) - * - * Copyright © 2018 Extremely Heavy Industries Inc. - */ -import {XH} from '@xh/hoist/core'; -import {HoistAppModel} from '@xh/hoist/app'; -import {action} from '@xh/hoist/mobx'; -import {TabContainerModel} from '@xh/hoist/cmp/tab'; - -import {AboutPanel} from './tabs/about/AboutPanel'; -import {ActivityPanel} from './tabs/activity/ActivityPanel'; -import {ConfigPanel} from './tabs/configs/ConfigPanel'; -import {ClientErrorPanel} from './tabs/clienterrors/ClientErrorPanel'; -import {FeedbackPanel} from './tabs/feedback/FeedbackPanel'; -import {EhCachePanel} from './tabs/ehcache/EhCachePanel'; -import {LogLevelPanel} from './tabs/logging/LogLevelPanel'; -import {LogViewer} from './tabs/logging/viewer/LogViewer'; -import {MonitorResultsPanel} from './tabs/monitor/MonitorResultsPanel'; -import {MonitorEditorPanel} from './tabs/monitor/MonitorEditorPanel'; -import {PreferencePanel} from './tabs/preferences/PreferencePanel'; -import {UserPreferencePanel} from './tabs/preferences/UserPreferencePanel'; -import {ServicePanel} from './tabs/services/ServicePanel'; -import {UserPanel} from './tabs/users/UserPanel'; - -@HoistAppModel -export class AppModel { - - tabs = this.createTabContainer(); - - checkAccess(user) { - const role = 'HOIST_ADMIN', - hasAccess = user.hasRole(role), - message = hasAccess ? '' : `Admin console access requires the "${role}" role.`; - return {hasAccess, message}; - } - - @action - requestRefresh() { - this.tabs.requestRefresh(); - } - - getRoutes() { - return [ - { - name: 'default', - path: '/admin', - forwardTo: 'default.general', - children: this.getTabRoutes() - } - ]; - } - - //------------------------ - // Implementation - //------------------------ - createTabContainer() { - return new TabContainerModel({ - id: 'default', - useRoutes: true, - children: this.createTabs() - }); - } - - //------------------------ - // For override / extension - //------------------------ - getTabRoutes() { - return [ - { - name: 'general', - path: '/general', - forwardTo: 'default.general.about', - children: [ - {name: 'about', path: '/about'}, - {name: 'config', path: '/config'}, - {name: 'services', path: '/services'}, - {name: 'ehCache', path: '/ehCache'}, - {name: 'users', path: '/users'} - ] - }, - { - name: 'logging', - path: '/logging', - forwardTo: 'default.logging.viewer', - children: [ - {name: 'viewer', path: '/viewer'}, - {name: 'levels', path: '/levels'} - ] - }, - { - name: 'monitor', - path: '/monitor', - forwardTo: 'default.monitor.status', - children: [ - {name: 'status', path: '/status'}, - {name: 'editMonitors', path: '/editMonitors'} - ] - }, { - name: 'clientActivity', - path: '/clientActivity', - forwardTo: 'default.clientActivity.activity', - children: [ - {name: 'activity', path: '/activity'}, - {name: 'clientErrors', path: '/clientErrors'}, - {name: 'feedback', path: '/feedback'} - ] - }, - { - name: 'preferences', - path: '/preferences', - forwardTo: 'default.preferences.prefs', - children: [ - {name: 'prefs', path: '/prefs'}, - {name: 'userPrefs', path: '/userPrefs'} - ] - } - ]; - } - - createTabs() { - return [ - { - id: 'general', - switcherPosition: 'left', - children: [ - {id: 'about', component: AboutPanel}, - {id: 'config', component: ConfigPanel}, - {id: 'services', component: ServicePanel}, - {id: 'ehCache', name: 'Caches', component: EhCachePanel}, - {id: 'users', component: UserPanel} - ] - }, { - id: 'logging', - switcherPosition: 'left', - children: [ - {id: 'viewer', component: LogViewer}, - {id: 'levels', component: LogLevelPanel} - ] - }, - { - id: 'monitor', - switcherPosition: 'left', - children: [ - {id: 'status', component: MonitorResultsPanel}, - {id: 'editMonitors', component: MonitorEditorPanel} - ] - }, - { - id: 'clientActivity', - switcherPosition: 'left', - children: [ - {id: 'activity', component: ActivityPanel}, - {id: 'clientErrors', component: ClientErrorPanel}, - {id: 'feedback', component: FeedbackPanel} - ] - }, - { - id: 'preferences', - switcherPosition: 'left', - children: [ - {id: 'prefs', component: PreferencePanel}, - {id: 'userPrefs', component: UserPreferencePanel, reloadOnShow: true} - ] - } - ]; - } - - destroy() { - XH.safeDestroy(this.tabs); - } -} diff --git a/admin/index.js b/admin/index.js deleted file mode 100644 index b4f69253f7..0000000000 --- a/admin/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export * from './App'; -export * from './AppModel'; \ No newline at end of file diff --git a/app/AppContainer.js b/app/AppContainer.js index 669d7538db..26f4287868 100644 --- a/app/AppContainer.js +++ b/app/AppContainer.js @@ -40,6 +40,8 @@ import {lockoutPanel} from './'; * standardized loginPanel component to prompt for a username and password. Once the user is * confirmed, this container will again mask until Hoist has completed its initialization, at * which point the app's UI will be rendered. + * + * @private */ @observer @ContextMenuTarget @@ -107,7 +109,7 @@ export class AppContainer extends Component { { text: 'Logout', icon: Icon.logout(), - hidden: !XH.appModel.enableLogout, + hidden: !XH.app.enableLogout, action: () => XH.identityService.logoutAsync() } ] @@ -136,7 +138,7 @@ export class AppContainer extends Component { vspacer(20), logoutButton({ text: 'Logout', - omit: !XH.appModel.enableLogout + omit: !XH.app.enableLogout }) ); } diff --git a/app/impl/LoginPanel.js b/app/impl/LoginPanel.js index 27f4d47535..99f93e0456 100644 --- a/app/impl/LoginPanel.js +++ b/app/impl/LoginPanel.js @@ -33,7 +33,7 @@ export class LoginPanel extends Component { } render() { - const {loginMessage} = XH.appModel; + const {loginMessage} = XH.app; return viewport({ alignItems: 'center', diff --git a/app/index.js b/app/index.js index bda3fbf30c..373e1872e9 100644 --- a/app/index.js +++ b/app/index.js @@ -6,5 +6,4 @@ */ export * from './AppContainer'; -export * from './HoistAppModel'; export * from './LockoutPanel'; \ No newline at end of file diff --git a/cmp/button/LogoutButton.js b/cmp/button/LogoutButton.js index a5d9946a43..cb9e64dc07 100644 --- a/cmp/button/LogoutButton.js +++ b/cmp/button/LogoutButton.js @@ -29,7 +29,7 @@ export class LogoutButton extends Component { }; render() { - if (!XH.appModel.enableLogout) return null; + if (!XH.app.enableLogout) return null; const {icon, title, intent, onClick, ...rest} = this.props; return button({ diff --git a/app/HoistAppModel.js b/core/HoistApp.js similarity index 79% rename from app/HoistAppModel.js rename to core/HoistApp.js index 494589ba80..7d78b759b7 100644 --- a/app/HoistAppModel.js +++ b/core/HoistApp.js @@ -5,26 +5,35 @@ * Copyright © 2018 Extremely Heavy Industries Inc. */ import {defaultMethods} from '@xh/hoist/utils/ClassUtils'; -import {HoistModel} from '@xh/hoist/core'; +import {HoistModel} from './HoistModel'; /** * Mixin to apply to top app-level model for a HoistApp. This model will be initialized by Hoist * after the framework has successfully initialized and will remain available to all code via the - * XH.appModel getter. + * XH.app getter. * * Applications should specify this class to provide application level state and services and * customize important metadata. Initialization of all resources (e.g. application level services) * should be done in initApp(). * - * An class decorated with this function should be provided to XH.renderApp() in the main + * A class decorated with this function should be provided to XH.renderApp() in the main * application bootstrap file. */ -export function HoistAppModel(C) { - C.isHoistAppModel = true; +export function HoistApp(C) { + C.isHoistApp = true; C = HoistModel()(C); defaultMethods(C, { + + /** + * Component class for rendering this app. Should be a subclass of Component + * and decorated with @HoistComponent. + */ + viewClass: { + get() {return null} + }, + /** * Should applications display a logout option - i.e. for apps using form-based auth * where logging out is a supported operation. Expected to be false for SSO apps. @@ -42,14 +51,14 @@ export function HoistAppModel(C) { }, /** - * Application-level AppModel must implement with appropriate logic to determine if the + * App must implement this method with appropriate logic to determine if the * current user should be able to access the UI, typically based on the user's roles. * @param {Object} user - current user, as returned by XH.getUser(). */ checkAccess(user) { return { hasAccess: false, - message: 'Required access control not implemented - see AppModel.checkAccess().' + message: 'Required access control not implemented - see App.checkAccess().' }; }, diff --git a/core/XH.js b/core/XH.js index f8caa8f6b5..7dea2d0dbc 100644 --- a/core/XH.js +++ b/core/XH.js @@ -108,13 +108,13 @@ class XhModel { /** Updated App version available, as reported by server. */ @observable updateVersion = null; - /** Top level model for the App - set in `renderApp()` below. */ - appModel = null; + /** Currently running HoistApp - set in `renderApp()` below. */ + app = null; /** Router model for the App - used for route based navigation. */ routerModel = new RouterModel(); - /** Set by output of AppModel.checkAccess() if that initial auth check fails. */ + /** Set by output of app.checkAccess() if that initial auth check fails. */ accessDeniedMessage = null; /** @@ -128,15 +128,14 @@ class XhModel { /** * Main entry point. Initialize and render application code. * - * @param {BaseAppModel} config.modelClass - object containing main application state and logic. - * @param {Object} config.componentClass - class describing main application view. - * This class should extend Component and be decorated with @HoistComponent. + * @param {Object} app - object containing main application state and logic. Should + * be an instance of a class decorated with @HoistApp. */ - renderApp({appModel, componentClass}) { - this.appModel = appModel; + renderApp(app) { + this.app = app; const rootView = appContainer( - elem(componentClass, {model: this.appModel}) + elem(app.viewClass, {model: app}) ); ReactDOM.render(rootView, document.getElementById('root')); @@ -257,7 +256,7 @@ class XhModel { const authUser = await this.getAuthUserFromServerAsync(); if (!authUser) { - if (this.appModel.requireSSO) { + if (this.app.requireSSO) { throw XH.exception('Failed to authenticate user via SSO.'); } else { this.setLoadState(LoadState.LOGIN_REQUIRED); @@ -287,14 +286,14 @@ class XhModel { this.initLocalState(); - const access = this.appModel.checkAccess(XH.getUser()); + const access = this.app.checkAccess(XH.getUser()); if (!access.hasAccess) { this.accessDeniedMessage = access.message || 'Access denied.'; this.setLoadState(LoadState.ACCESS_DENIED); return; } - await this.appModel.initAsync(); + await this.app.initAsync(); this.initRouterModel(); this.setLoadState(LoadState.COMPLETE); } catch (e) { @@ -336,7 +335,7 @@ class XhModel { } initRouterModel() { - this.routerModel.init(this.appModel.getRoutes()); + this.routerModel.init(this.app.getRoutes()); } @action diff --git a/core/index.js b/core/index.js index 0a51aa649a..c71bf28961 100644 --- a/core/index.js +++ b/core/index.js @@ -8,6 +8,7 @@ export * from './elem'; export * from './mixins/Reactive'; export * from './mixins/EventTarget'; +export * from './HoistApp'; export * from './HoistComponent'; export * from './HoistModel'; export * from './HoistService'; diff --git a/mobile/cmp/button/LogoutButton.js b/mobile/cmp/button/LogoutButton.js index eb73ca6314..014c347b08 100644 --- a/mobile/cmp/button/LogoutButton.js +++ b/mobile/cmp/button/LogoutButton.js @@ -27,7 +27,7 @@ export class LogoutButton extends Component { }; render() { - if (!XH.appModel.enableLogout) return null; + if (!XH.app.enableLogout) return null; const {icon, onClick, ...rest} = this.props; return toolbarButton({ diff --git a/mobile/cmp/navigator/RouteNavigator.js b/mobile/cmp/navigator/RouteNavigator.js index b04a7d8f76..4ad535dd99 100644 --- a/mobile/cmp/navigator/RouteNavigator.js +++ b/mobile/cmp/navigator/RouteNavigator.js @@ -45,7 +45,7 @@ export class RouteNavigator extends Component { console.log(state); const currentRouteName = state.name.split('.').pop(), - route = this.findRouteCfgRecursive(XH.appModel.getRoutes(), currentRouteName), + route = this.findRouteCfgRecursive(XH.app.getRoutes(), currentRouteName), {name, pageFactory} = route ? route : {}; if (pageFactory) { From 23100347767dec1ab780ca58c20838b1e16decab Mon Sep 17 00:00:00 2001 From: lbwexler Date: Thu, 14 Jun 2018 19:20:45 -0400 Subject: [PATCH 3/3] Comments from ATM code review --- admin/App.js | 2 +- core/HoistApp.js | 4 ++-- core/XH.js | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/admin/App.js b/admin/App.js index ccd6346a95..b10c9f3215 100644 --- a/admin/App.js +++ b/admin/App.js @@ -36,7 +36,7 @@ export class App { return {hasAccess, message}; } - get viewClass() {return AppComponent} + get componentClass() {return AppComponent} @action requestRefresh() { diff --git a/core/HoistApp.js b/core/HoistApp.js index 7d78b759b7..939186c685 100644 --- a/core/HoistApp.js +++ b/core/HoistApp.js @@ -8,7 +8,7 @@ import {defaultMethods} from '@xh/hoist/utils/ClassUtils'; import {HoistModel} from './HoistModel'; /** - * Mixin to apply to top app-level model for a HoistApp. This model will be initialized by Hoist + * Mixin for defining a Hoist Application. An instance of this class will be initialized by Hoist * after the framework has successfully initialized and will remain available to all code via the * XH.app getter. * @@ -30,7 +30,7 @@ export function HoistApp(C) { * Component class for rendering this app. Should be a subclass of Component * and decorated with @HoistComponent. */ - viewClass: { + componentClass: { get() {return null} }, diff --git a/core/XH.js b/core/XH.js index 7dea2d0dbc..8ed401f963 100644 --- a/core/XH.js +++ b/core/XH.js @@ -45,7 +45,7 @@ import '../styles/XH.scss'; * Available to applications via import as 'XH'- installed as window.XH for troubleshooting purposes. */ @HoistModel() -class XhModel { +class XHClass { constructor() { this.aliasMethods(); @@ -135,7 +135,7 @@ class XhModel { this.app = app; const rootView = appContainer( - elem(app.viewClass, {model: app}) + elem(app.componentClass, {model: app}) ); ReactDOM.render(rootView, document.getElementById('root')); @@ -397,7 +397,7 @@ class XhModel { }); } } -export const XH = window.XH = new XhModel(); +export const XH = window.XH = new XHClass(); /** * Enumeration of possible Load States for Hoist.