Skip to content

Commit

Permalink
[MNOE-226] Impac config refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
alexnoox committed Oct 26, 2016
1 parent 824b115 commit 0bf3e7d
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 60 deletions.
65 changes: 65 additions & 0 deletions src/app/impac.config.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
angular.module 'mnoEnterpriseAngular'

#======================================================================================
# IMPAC-ROUTES: Configuring routes
#======================================================================================
.config((ImpacRoutesProvider, IMPAC_CONFIG) ->
mnoHub = IMPAC_CONFIG.paths.mnohub_api
impacPrefix = "/impac"

data =
mnoHub: mnoHub
impacPrefix: impacPrefix
impacApi: "#{IMPAC_CONFIG.protocol}://#{IMPAC_CONFIG.host}/api"
dashboards:
index: "#{mnoHub}#{impacPrefix}/dashboards"
widgets:
index: "#{mnoHub}#{impacPrefix}/widgets"
create: "#{mnoHub}#{impacPrefix}/dashboards/:dashboard_id/widgets"
kpis:
index: "#{mnoHub}#{impacPrefix}/kpis"
create: "#{mnoHub}#{impacPrefix}/dashboards/:dashboard_id/kpis"
update: "#{mnoHub}#{impacPrefix}/kpis/:id"
del: "#{mnoHub}#{impacPrefix}/kpis/:id"
alerts:
index: "#{mnoHub}#{impacPrefix}/alerts"
create: "#{mnoHub}#{impacPrefix}/kpis/:kpi_id/alerts"
del: "#{mnoHub}#{impacPrefix}/alerts/:id"

ImpacRoutesProvider.configureRoutes(data)
)

#======================================================================================
# IMPAC-THEMING: Configuring colour theme, layout, labels, descriptions, and features
#======================================================================================
.config((ImpacThemingProvider) ->
options =
dataNotFoundConfig:
linkUrl: '#/marketplace'
dhbErrorsConfig:
firstTimeCreated:
note: ''

ImpacThemingProvider.configure(options)
)

#======================================================================================
# IMPAC-ASSETS: Configuring assets
#======================================================================================
.config((ImpacAssetsProvider) ->
options =
defaultImagesPath: '/dashboard/images'

ImpacAssetsProvider.configure(options)
)

#======================================================================================
# IMPAC-LINKING: Configuring linking
#======================================================================================
.run((ImpacLinking, ImpacConfigSvc) ->
data =
user: ImpacConfigSvc.getUserData
organizations: ImpacConfigSvc.getOrganizations

ImpacLinking.linkData(data)
)
52 changes: 0 additions & 52 deletions src/app/index.config.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -59,55 +59,3 @@ angular.module 'mnoEnterpriseAngular'
$translateProvider.useSanitizeValueStrategy('sanitizeParameters')
$translateProvider.useMissingTranslationHandlerLog()
)

#======================================================================================
# IMPAC-ROUTES: Configuring routes
#======================================================================================
.config (ImpacRoutesProvider, IMPAC_CONFIG) ->
mnoHub = IMPAC_CONFIG.paths.mnohub_api
impacPrefix = "/impac"

data =
mnoHub: mnoHub
impacPrefix: impacPrefix
impacApi: "#{IMPAC_CONFIG.protocol}://#{IMPAC_CONFIG.host}/api"
dashboards:
index: "#{mnoHub}#{impacPrefix}/dashboards"
widgets:
index: "#{mnoHub}#{impacPrefix}/widgets"
create: "#{mnoHub}#{impacPrefix}/dashboards/:dashboard_id/widgets"
kpis:
index: "#{mnoHub}#{impacPrefix}/kpis"
create: "#{mnoHub}#{impacPrefix}/dashboards/:dashboard_id/kpis"
update: "#{mnoHub}#{impacPrefix}/kpis/:id"
del: "#{mnoHub}#{impacPrefix}/kpis/:id"
alerts:
index: "#{mnoHub}#{impacPrefix}/alerts"
create: "#{mnoHub}#{impacPrefix}/kpis/:kpi_id/alerts"
del: "#{mnoHub}#{impacPrefix}/alerts/:id"

ImpacRoutesProvider.configureRoutes(data)


#======================================================================================
# IMPAC-THEMING: Configuring colour theme, layout, labels, descriptions, and features
#======================================================================================
.config (ImpacThemingProvider) ->
options =
dataNotFoundConfig:
linkUrl: '#/marketplace'
dhbErrorsConfig:
firstTimeCreated:
note: ''

ImpacThemingProvider.configure(options)

#======================================================================================
# IMPAC-ASSETS: Configuring assests
#======================================================================================
.config (ImpacAssetsProvider) ->
options =
defaultImagesPath: '/dashboard/images'

ImpacAssetsProvider.configure(options)

8 changes: 0 additions & 8 deletions src/app/index.run.coffee
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
angular.module 'mnoEnterpriseAngular'
# Impac configuration
.run((ImpacLinking, ImpacConfigSvc) ->
data =
user: ImpacConfigSvc.getUserData
organizations: ImpacConfigSvc.getOrganizations

ImpacLinking.linkData(data)
)

# xeditable-anugular configuration
.run((editableOptions) ->
Expand Down

0 comments on commit 0bf3e7d

Please sign in to comment.