Goin from a bare initialized ember addon towards a dunlop powered addon having all the goodies

This commit is contained in:
2018-12-12 10:34:15 -05:00
parent 5fa7ebe1df
commit c25d9e1247
10 changed files with 1279 additions and 9 deletions
+15
View File
@@ -16,6 +16,21 @@ Tasks this addon does:
* `git clone <repository-url>` this repository
* `cd ember-panda-adapter`
* `npm install`
* `npm link ember-cli-dunlop` and add to package.json and maybe after
other npm installs
* `ember install ember-data@2.16.3`
* `ember install ember-cli-coffeescript`
* `ember install ember-cli-emblem`
* `ember install ember-get-config`
* `ember install ember-simple-auth`
* `ember install semantic-ui-ember`
* `ember install ember-semantic-ui-calendar`
* `ember install active-model-adapter`
## Setting up the dummy app
* Make sure that the globals are loaded (dunlop pattern)
* `mkdir tests/dummy/app/initializers/`
* `cp ../ember-cli-dunlop/tests/dummy/app/initializers/globals.coffee tests/dummy/app/initializers/`
## Running
+6
View File
@@ -0,0 +1,6 @@
# ember-simple-auth's routes/application.js conflicts with the routes/application.js
# that results from compilation of our routes/application.coffee.
# ESA's application route doesn't seem to be necessary.
# https://github.com/simplabs/ember-simple-auth/issues/851
echo "deleting ember-simple-auth's application route to workaround incompatibility with coffeescript..."
rm -f node_modules/ember-simple-auth/app/routes/application.js
+1078 -2
View File
File diff suppressed because it is too large Load Diff
+13 -3
View File
@@ -15,16 +15,22 @@
"scripts": {
"build": "ember build",
"start": "ember server",
"test": "ember try:each"
"test": "ember try:each",
"postinstall": "sh esa-coffee-workaround.sh; npm link ember-cli-dunlop"
},
"dependencies": {
"ember-cli-babel": "^6.6.0"
"ember-cli-babel": "^6.6.0",
"ember-cli-dunlop": "^0.0.0",
"ember-semantic-ui-calendar": "^2.0.0"
},
"devDependencies": {
"active-model-adapter": "^2.2.0",
"broccoli-asset-rev": "^2.4.5",
"ember-ajax": "^3.0.0",
"ember-cli": "~2.16.2",
"ember-cli-coffeescript": "^1.16.1",
"ember-cli-dependency-checker": "^2.0.0",
"ember-cli-emblem": "^0.10.0",
"ember-cli-eslint": "^4.0.0",
"ember-cli-htmlbars": "^2.0.1",
"ember-cli-htmlbars-inline-precompile": "^1.0.0",
@@ -33,12 +39,16 @@
"ember-cli-shims": "^1.1.0",
"ember-cli-sri": "^2.1.0",
"ember-cli-uglify": "^2.0.0",
"ember-data": "^2.16.3",
"ember-disable-prototype-extensions": "^1.1.2",
"ember-export-application-global": "^2.0.0",
"ember-get-config": "^0.2.4",
"ember-load-initializers": "^1.0.0",
"ember-resolver": "^4.0.0",
"ember-simple-auth": "^1.7.0",
"ember-source": "~2.16.0",
"loader.js": "^4.2.3"
"loader.js": "^4.2.3",
"semantic-ui-ember": "^3.0.3"
},
"engines": {
"node": "^4.5 || 6.* || >= 7.*"
+118
View File
@@ -0,0 +1,118 @@
window.client_id ||= "client#{Math.round(Math.random()*10000)}"
state_names =
planned: 'Planned'
active: 'Active'
overdue: 'Overdue'
all_completed: 'Completed'
inquiry: 'Issue'
default_globals =
flash_message: ''
preload_resources_fulfilled: true
first_day_of_week: 1
current_user: null
workflow_action_definition:
value_type_options: ['boolean', 'date', 'number', 'select', 'string', 'text', 'timestamp']
workflow_action_offset:
offset_unit_options: ['day']
location_planning:
filter_scopes:
with_changed_planning: 'Aangepaste planning'
is_instructed: 'Allinq aangestuurd'
is_not_instructed: 'Allinq niet aangestuurd'
with_unequal_number_of_cards: '# cards verschil'
with_more_netcap_cards_than_calculated: 'NetCap overschot'
with_less_netcap_cards_than_calculated: 'NetCap tekort'
migration_window_planning:
filter_scopes:
epots_ready_without_work_order: 'ePOTS ready zonder work-order'
with_changed_planning: 'Aangepaste HAN planning'
#with_remarks: 'Meldingen!'
with_non_active_dslam_cards: 'Inactieve DSLAM cards'
with_work_order: 'Met work order'
without_work_order: 'Zonder work order'
with_different_target_week: 'Andere forecast week'
with_different_target_date: 'Andere forecast dag'
with_work_order_epots_ready_not_realized: 'Met work-order, ePOTS ready niet opgeleverd'
time_formatting: 'YYYY-MM-DD HH:mm'
date_formatting: 'DD-MM-YYYY'
state_names: state_names
project_instance_states: [
'planned'
'active'
'overdue'
'all_completed'
].map (state) -> {id: state, label: state_names[state]}
attention_incident:
sources: [
{id: 'allinq-daily-report', label: 'Allinq daily report'}
{id: 'work-order-epots-ready-existence-check', label: 'ePOTS ready daily check'}
{id: 'work-order-create-epots-ready-check', label: 'work-order create ePOTS ready check'}
{id: 'kanvas-f107-source-file', label: 'Kanvas F107 source file HAN HOST-1 -> Kanvas host-name'}
]
format_date:
compact_month: (->
date: (jsdate, settings) ->
return '' unless jsdate
current_year = new Date().getFullYear()
mdate = moment(jsdate)
if jsdate.getFullYear() isnt current_year
mdate.format('D MMM YYYY')
else
mdate.format('D MMM')
) #.property()
# overloaded by adapters/epots/config/settings.yml
coarsing_date:
quarter_threshold: 147 # 21 weeks
month_threshold: 98 # 14 weeks
week_threshold: 49 # 7 weeks
week_days: [
{name: 'monday', index: 1}
{name: 'tuesday', index: 2}
{name: 'wednesday', index: 3}
{name: 'thursday', index: 4}
{name: 'friday', index: 5}
{name: 'saturday', index: 6}
{name: 'sunday', index: 0}
]
project:
instance_scope_options: ['instance', 'batch']
workflow_group:
batch_element_threshold_unit_options: ['businessday', 'day', 'week']
project_instance_action:
states: ['pending', 'planned', 'overdue', 'rejected', 'completed']
project_instance_group:
states: ['pending', 'processing', 'overdue', 'completed']
#if window.app_globals
# for key, value of window.app_globals
# debugger
# Globals[key] = value
default_globals.attention_incident.source = {}
for s in default_globals.attention_incident.sources
default_globals.attention_incident.source[s.id] = s.label
export globals = Ember.Object.create default_globals, window.app_globals
initialize = (application) ->
application.register 'service:globals', globals, instantiate: false #, singleton: true
application.inject 'controller', 'globals', 'service:globals'
application.inject 'component', 'globals', 'service:globals'
application.inject 'component', 'router', 'router:main'
#application.inject 'component', 'store', 'store:main'
application.inject 'component', 'store', 'service:store'
application.inject 'view', 'globals', 'service:globals'
application.inject 'router', 'globals', 'service:globals'
GlobalsInitializer =
name: 'globals'
initialize: initialize
export {initialize, state_names}
export default GlobalsInitializer
@@ -0,0 +1,6 @@
import Ember from 'ember'
import DunlopApplicationRoute from 'ember-cli-dunlop/mixins/application-route'
export default Ember.Route.extend DunlopApplicationRoute,
_loadCurrentUser: ->
@get('initial_resources_resolve')()
@@ -0,0 +1,26 @@
= flash-message
= partial 'global/top-menu'
.ui.main
/bread-crumbs linkable=false
/= bread-crumbs tagName='ul' outputStyle='foundation' linkable=false as |component rrr|
= bread-crumb route=rrr breadCrumbs=component
span= rrr.title
= outlet 'error-handling'
if globals.flash.alert
.ui.negative.floating.message
i.close.icon{action (mut globals.flash.alert) ''}
= globals.flash.alert
if globals.flash.notice
.ui.floating.info.message
i.close.icon{action (mut globals.flash.notice) ''}
= globals.flash.notice
if globals.initial_resources_fulfilled
= outlet
else
.ui.icon.message
i.notched.circle.loading.icon
.content
.header Initial resources not loaded...
p Loading resources globally required before continuing with the application.
/button.basic.button{ action 'debug'} debug
= outlet 'modal'
@@ -1,3 +0,0 @@
<h2 id="title">Welcome to Ember</h2>
{{outlet}}
@@ -0,0 +1,11 @@
.ui.inverted.menu.fixed
/.ui.container
= link-to 'index' class='header item'
span ember-panda-adapter dummy&nbsp;
/= link-to 'table-filters.test1' class='item'
span Filters
/= link-to 'table-ordering.test1' class='item'
span Tables
/= link-to 'helpers' class='item'
span Helpers
+6 -1
View File
@@ -5,8 +5,12 @@ module.exports = function(environment) {
let ENV = {
modulePrefix: 'dummy',
environment,
rootURL: '/',
rootURL: '/dunlop-app-namespace/app/',
locationType: 'auto',
applicationName: "Panda",
apiHost: '',
apiNamespace: 'dunlop-app-namespace/api/v1',
exportApplicationGlobal: true,
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
@@ -30,6 +34,7 @@ module.exports = function(environment) {
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
ENV.apiHost = "http://localhost:3009"; // when using the stand alone ember server implementation with rails server explicitly as api host (foreman run web)
}
if (environment === 'test') {