core-dashboard-worona
Advanced tools
Comparing version 1.3.19 to 1.3.20
{ | ||
"name": "core-dashboard-worona", | ||
"version": "1.3.19", | ||
"version": "1.3.20", | ||
"description": "Core Package of Worona Dashboard", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -0,1 +1,2 @@ | ||
/* eslint-disable no-undef */ | ||
import update from 'react/lib/update'; | ||
@@ -6,2 +7,4 @@ import { mapValues } from 'lodash'; | ||
const cdn = window.location.host.startsWith('pre') ? 'precdn' : 'cdn'; | ||
export default (state = {}, action) => { | ||
@@ -11,11 +14,17 @@ let pkgAssets; | ||
case types.PACKAGE_ASSETS_LOAD_REQUESTED: | ||
pkgAssets = mapValues(action.pkg.assets, item => flow( | ||
keyBy(key => (action.pkg.local ? `http://localhost:4000/packages/${key}` : | ||
`https://cdn.worona.io/packages/${key}`)), | ||
mapValuesFp(() => false) | ||
)(item)); | ||
pkgAssets = mapValues(action.pkg.assets, item => | ||
flow( | ||
keyBy( | ||
key => | ||
action.pkg.local | ||
? `http://localhost:4000/packages/${key}` | ||
: `https://${cdn}.worona.io/packages/${key}`, | ||
), | ||
mapValuesFp(() => false), | ||
)(item)); | ||
return update(state, { $merge: { [action.pkg.name]: pkgAssets } }); | ||
case types.PACKAGE_ASSET_FILE_DOWNLOADED: | ||
return update(state, | ||
{ $merge: { [action.pkgName]: { [action.assetType]: { [action.path]: true } } } }); | ||
return update(state, { | ||
$merge: { [action.pkgName]: { [action.assetType]: { [action.path]: true } } }, | ||
}); | ||
default: | ||
@@ -22,0 +31,0 @@ return state; |
@@ -21,3 +21,4 @@ /* eslint-disable no-constant-condition, no-undef, global-require, import/no-dynamic-require */ | ||
export const requireRemotePackage = pkg => new Promise((resolve, reject) => { | ||
SystemJS.import(`https://cdn.worona.io/packages/${pkg.main}`) | ||
const cdn = window.location.host.startsWith('pre') ? 'precdn' : 'cdn'; | ||
SystemJS.import(`https://${cdn}.worona.io/packages/${pkg.main}`) | ||
.then(module => resolve(module)) | ||
@@ -24,0 +25,0 @@ .catch(error => reject(error)); |
@@ -1,2 +0,2 @@ | ||
/* eslint-disable no-constant-condition, array-callback-return */ | ||
/* eslint-disable no-constant-condition, array-callback-return, no-undef */ | ||
import request from 'superagent'; | ||
@@ -25,4 +25,5 @@ import { isRemote, isDev, getDevelopmentPackages } from 'worona-deps'; | ||
const env = isDev ? 'dev' : 'prod'; | ||
const cdn = window.location.host.startsWith('pre') ? 'precdn' : 'cdn'; | ||
const res = isRemote ? | ||
yield call(request.get, `https://cdn.worona.io/api/v1/settings/core/dashboard/${env}`) : | ||
yield call(request.get, `https://${cdn}.worona.io/api/v1/settings/core/dashboard/${env}`) : | ||
defaultPackages; | ||
@@ -29,0 +30,0 @@ // Normalize the result using normalizr. |
58676
1172