Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

You can add constants to Mnoe-angular that come from Mnoe, allowing access to important backend information on the frontend. (Currently Mnoe v4.0 and Mnoe-angular v2.0)





1 - Adding a New Constant


1.1 - Mnoe-angular

In Mnoe-angular, add your new setting to the following file. You can set sensible defaults here in the event that the configuration has not been loaded/fetched from MnoHub yet.

src/app/index.default-config.coffee
# For backward compatibility with the mnoe backend

# Define null/default values for all the constants so that if the backend hasn't been upgraded

# to define this constants you don't get errors like:

#   Uncaught Error: [$injector:unpr] Unknown provider: INTERCOM_IDProvider <- INTERCOM_ID <- AnalyticsSvc

angular.module('mnoEnterprise.defaultConfiguration', [])

  .constant('IMPAC_CONFIG', {})

  .constant('I18N_CONFIG', {})

  .constant('PRICING_CONFIG', {enabled: true})

  .constant('PAYMENT_CONFIG', {disabled: false})

  .constant('ORGANIZATION_MANAGEMENT', {enabled: true})

  .constant('USER_MANAGEMENT', {enabled: true})

  .constant('DOCK_CONFIG', {enabled: true})

  .constant('DEVELOPER_SECTION_CONFIG', {enabled: false})

  .constant('ONBOARDING_WIZARD_CONFIG', {enabled: false})

  .constant('REVIEWS_CONFIG', {enabled: false})

  .constant('QUESTIONS_CONFIG', {enabled: false})

  .constant('MARKETPLACE_CONFIG', {enabled: true, comparison: {enabled: false}})

  .constant('AUDIT_LOG', {enabled: false})

  .constant('GOOGLE_TAG_CONTAINER_ID', null)

  .constant('APP_NAME', null)

  .constant('INTERCOM_ID', null)

  .constant('URL_CONFIG', {})





1.2 - Mnoe

In Mnoe add your constant to the following file. Note: This is served to the frontend via the MnoEnterprise::ConfigController#show method. Instance variables can be added to the controller and used in this view.

api/app/views/mno_enterprise/config/show.js.coffee
# Configuration module

#

angular.module('mnoEnterprise.configuration', [])

  .constant('IMPAC_CONFIG', <%= Settings.impac.to_json.html_safe %>)

  .constant('I18N_CONFIG', {

    enabled: <%= Settings.system.i18n.enabled %>,

    available_locales: <%= @available_locales.to_json.html_safe %>,

    preferred_locale: <%= Settings.system.i18n.preferred_locale.to_json.html_safe %>

  })

  .constant('ADMIN_PANEL_CONFIG', <%= Hash(Settings.admin_panel).to_json.html_safe %>)

  .constant('DASHBOARD_CONFIG', <%= Hash(Settings.dashboard).to_json.html_safe %>)

  .constant('GOOGLE_TAG_CONTAINER_ID', <%= MnoEnterprise.google_tag_container.to_json.html_safe %>)

  .constant('INTERCOM_ID', <%= MnoEnterprise.intercom_app_id.to_json.html_safe %>)

  .constant('APP_NAME', <%= MnoEnterprise.app_name.to_json.html_safe %>)

  .constant('URL_CONFIG', <%= Hash(Settings.url_config).to_json.html_safe %>)



  • No labels