From f47e9384c1b5daf11bfa2157daa1af268ab4bd5b Mon Sep 17 00:00:00 2001 From: dlowder-salesforce Date: Tue, 7 Jun 2016 13:56:39 -0700 Subject: [PATCH 01/15] Remove unneeded dependencies --- package.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/package.json b/package.json index 7e633ba..aa1ed22 100644 --- a/package.json +++ b/package.json @@ -16,10 +16,6 @@ "url": "https://github.com/ForceDotComLabs/react.force.data/issues" }, "homepage": "https://github.com/ForceDotComLabs/react.force.data#readme", - "peerDependencies": { - "react-native": ">=0.20.0", - "react.force": "git+ssh://git@github.com/ForceDotComLabs/react.force.git" - }, "dependencies": { "lodash.findindex": "^4.4.0", "lodash.keys": "^4.0.7", From 5b384bc7a1ce08b50aaaff037f5068caecd0ef12 Mon Sep 17 00:00:00 2001 From: Kapil Date: Thu, 9 Jun 2016 23:08:39 -0700 Subject: [PATCH 02/15] chatter data helpers --- src/addToChatterQueue.js | 13 +++++++++ src/cacheChatterData.js | 27 ++++++++++++++++++ src/chatterQuery.js | 57 +++++++++++++++++++++++++++++++++++++ src/chatterQueue.js | 29 +++++++++++++++++++ src/getByChatterUserId.js | 8 ++++++ src/getCachedChatterData.js | 11 +++++++ src/index.js | 10 +++++-- 7 files changed, 152 insertions(+), 3 deletions(-) create mode 100644 src/addToChatterQueue.js create mode 100644 src/cacheChatterData.js create mode 100644 src/chatterQuery.js create mode 100644 src/chatterQueue.js create mode 100644 src/getByChatterUserId.js create mode 100644 src/getCachedChatterData.js diff --git a/src/addToChatterQueue.js b/src/addToChatterQueue.js new file mode 100644 index 0000000..353f369 --- /dev/null +++ b/src/addToChatterQueue.js @@ -0,0 +1,13 @@ +import chatterQueue from './chatterQueue'; + +module.exports = (opts) => { + return new Promise ( + (resolve, reject) => { + if(!opts.cachedChatterData || opts.nocache){ + chatterQueue.add(opts.id); + } else { + console.log('skipping: already cached'); + } + resolve(opts); + }) +} diff --git a/src/cacheChatterData.js b/src/cacheChatterData.js new file mode 100644 index 0000000..aeed7ea --- /dev/null +++ b/src/cacheChatterData.js @@ -0,0 +1,27 @@ +// import chatterQuery +import query from './query'; + +//let CACHE = {}; + +const notify = (ids,sobjs) => { + sobjs.forEach((sobj)=>{ + set(sobj); + }); +}; + +query.addListener(notify); + +let cache = {}; + +const get = (id)=>{ + return cache[id]; +}; + +const set = (sobj)=>{ + cache[sobj.Id] = sobj; +}; + +module.exports = { + get:get, + set:set +}; diff --git a/src/chatterQuery.js b/src/chatterQuery.js new file mode 100644 index 0000000..0120fef --- /dev/null +++ b/src/chatterQuery.js @@ -0,0 +1,57 @@ +import {forceClient} from 'react.force'; +import union from 'lodash.union'; +import remove from 'lodash.remove'; +import trim from 'lodash.trim'; + +import utils from './utils'; + +let queryCount = 0; + +const listeners = []; + +const broadcast = (records) => { + const ids = records.map((record)=>{ + return record.id; + }); + listeners.forEach((listener)=>{ + listener(ids, records); + }); +} + +module.exports = (opts) => { + return new Promise( + (resolve, reject) => { + if(!opts.noCache && opts.cachedChatterData ){ + opts.chatterData = opts.cachedChatterData; + resolve(opts); + return; + } + + queryCount++; + forceClient.bulkChatterUserPics(opts.ids, + (response)=>{ + if(!response.hasErrors && response.results.length){ + const records = response.results.map((r, index) => { + let result = r.result; + result.id = opts.ids[index]; + return result; + }); + broadcast(records); + } + resolve(opts); + }, + (error) => { + reject('Error: query'); + } + ); + } + ); +}; + +module.exports.addListener = (listener) => { + listeners.push(listener); +}; + +module.exports.getQueryCount = () => { + return queryCount; +}; diff --git a/src/chatterQueue.js b/src/chatterQueue.js new file mode 100644 index 0000000..25f7684 --- /dev/null +++ b/src/chatterQueue.js @@ -0,0 +1,29 @@ +let chatterQueue = []; +import keys from 'lodash.keys'; +import chatterQuery from './chatterQuery'; + +import batchRunByType from './batchRunByType'; + +const get = () => { + return chatterQueue.splice(0, chatterQueue.length); +} +const add = (id) => { + if(!id){ + return; + } + if(chatterQueue.indexOf(id) < 0){ + chatterQueue.push(id); + } + setTimeout(()=>{ + if(chatterQueue && chatterQueue.length !== 0){ + console.log('TRIGGER QUERY !!!'); + const ids = get() + return chatterQuery({ids:ids}); + } + },300); +}; + +module.exports = { + add:add, + get:get +}; diff --git a/src/getByChatterUserId.js b/src/getByChatterUserId.js new file mode 100644 index 0000000..f99d2eb --- /dev/null +++ b/src/getByChatterUserId.js @@ -0,0 +1,8 @@ +import getCachedChatterData from './getCachedChatterData'; +import addToChatterQueue from './addToChatterQueue'; + + +module.exports = (id, noCache) => { + return getCachedChatterData({id:id, noCache:!!noCache}) + .then(addToChatterQueue); +}; diff --git a/src/getCachedChatterData.js b/src/getCachedChatterData.js new file mode 100644 index 0000000..832aa06 --- /dev/null +++ b/src/getCachedChatterData.js @@ -0,0 +1,11 @@ +import cacheChatterData from './cacheChatterData'; + +module.exports = (opts) => { + return new Promise( + (resolve, reject) => { + const id = opts.id; + const item = cacheChatterData.get(id); + opts.cacheChatterData = item; + resolve(opts); + }) +} diff --git a/src/index.js b/src/index.js index c5d0e77..5cff684 100644 --- a/src/index.js +++ b/src/index.js @@ -23,7 +23,6 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ - import getDefaultLayout from './getDefaultLayout'; import getCompactLayout from './getCompactLayout'; import getCompactLayoutFieldNames from './getCompactLayoutFieldNames'; @@ -41,6 +40,9 @@ import requestWithTypeAndId from './requestWithTypeAndId'; import clearCache from './clearCache'; +import chatterQuery from './chatterQuery'; +import getByChatterUserId from './getByChatterUserId'; + module.exports = { getByTypeAndId:getByTypeAndId, getDefaultLayout:getDefaultLayout, @@ -49,5 +51,7 @@ module.exports = { query:query, utils:utils, requestWithTypeAndId:requestWithTypeAndId, - clearCache:clearCache -}; \ No newline at end of file + clearCache:clearCache, + chatterQuery: chatterQuery, + getByChatterUserId: getByChatterUserId +}; From 6c4c87e189b7185931e9e467464706e693ab954e Mon Sep 17 00:00:00 2001 From: Kapil Date: Tue, 14 Jun 2016 14:37:16 -0700 Subject: [PATCH 03/15] updated cacheChatterData.js --- src/cacheChatterData.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cacheChatterData.js b/src/cacheChatterData.js index aeed7ea..db5f654 100644 --- a/src/cacheChatterData.js +++ b/src/cacheChatterData.js @@ -1,5 +1,5 @@ // import chatterQuery -import query from './query'; +import query from './chatterQuery'; //let CACHE = {}; From 6977e5e157051007eec67d4d0bfb51334eea3351 Mon Sep 17 00:00:00 2001 From: Kapil Date: Wed, 15 Jun 2016 20:47:21 -0700 Subject: [PATCH 04/15] fixed bug in getCachedSobj --- src/addToQueue.js | 2 +- src/chatterQuery.js | 2 -- src/chatterQueue.js | 2 -- src/getCachedCompactLayout.js | 4 ++-- src/getCachedDefaultLayout.js | 2 +- src/getCachedSobj.js | 9 ++++++--- src/getCompactLayout.js | 4 ++-- src/getDefaultLayout.js | 6 +++--- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/addToQueue.js b/src/addToQueue.js index 610db2c..d531328 100644 --- a/src/addToQueue.js +++ b/src/addToQueue.js @@ -38,4 +38,4 @@ module.exports = (opts) => { resolve(opts); } ); -}; \ No newline at end of file +}; diff --git a/src/chatterQuery.js b/src/chatterQuery.js index 0120fef..65cb529 100644 --- a/src/chatterQuery.js +++ b/src/chatterQuery.js @@ -3,8 +3,6 @@ import union from 'lodash.union'; import remove from 'lodash.remove'; import trim from 'lodash.trim'; -import utils from './utils'; - let queryCount = 0; const listeners = []; diff --git a/src/chatterQueue.js b/src/chatterQueue.js index 25f7684..e9389f9 100644 --- a/src/chatterQueue.js +++ b/src/chatterQueue.js @@ -2,8 +2,6 @@ let chatterQueue = []; import keys from 'lodash.keys'; import chatterQuery from './chatterQuery'; -import batchRunByType from './batchRunByType'; - const get = () => { return chatterQueue.splice(0, chatterQueue.length); } diff --git a/src/getCachedCompactLayout.js b/src/getCachedCompactLayout.js index e606345..2c7ed00 100644 --- a/src/getCachedCompactLayout.js +++ b/src/getCachedCompactLayout.js @@ -23,7 +23,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ - + import { AsyncStorage } from 'react-native'; import cacheCompact from './cacheCompact'; @@ -38,4 +38,4 @@ module.exports = (opts) => { resolve(opts); } ); -}; \ No newline at end of file +}; diff --git a/src/getCachedDefaultLayout.js b/src/getCachedDefaultLayout.js index f97513a..0f10be5 100644 --- a/src/getCachedDefaultLayout.js +++ b/src/getCachedDefaultLayout.js @@ -36,4 +36,4 @@ module.exports = (opts) => { resolve(opts); } ); -}; \ No newline at end of file +}; diff --git a/src/getCachedSobj.js b/src/getCachedSobj.js index 8a4a350..0b12784 100644 --- a/src/getCachedSobj.js +++ b/src/getCachedSobj.js @@ -23,7 +23,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ - + import cache from './cache'; import storage from './storage'; @@ -31,7 +31,6 @@ import storage from './storage'; module.exports = (opts) => { return new Promise( (resolve, reject) => { - if(opts.noCache){ resolve(opts); return; @@ -45,12 +44,16 @@ module.exports = (opts) => { return; } + storage.getItem(id, (item)=>{ if(item){ opts.cachedSobj = item; resolve(opts); + } else { + resolve(opts); } + return; }); } ); -}; \ No newline at end of file +}; diff --git a/src/getCompactLayout.js b/src/getCompactLayout.js index 3d70468..1edf020 100644 --- a/src/getCompactLayout.js +++ b/src/getCompactLayout.js @@ -56,7 +56,7 @@ module.exports = (opts) => { return; } requested.push(opts.type); - forceClient.compactLayout(opts.type, + forceClient.compactLayout(opts.type, (response) => { opts.compactLayout = response; pull(requested,opts.type); @@ -70,4 +70,4 @@ module.exports = (opts) => { module.exports.addListener = (listener) => { listeners.push(listener); -}; \ No newline at end of file +}; diff --git a/src/getDefaultLayout.js b/src/getDefaultLayout.js index fdb624d..c389516 100644 --- a/src/getDefaultLayout.js +++ b/src/getDefaultLayout.js @@ -23,7 +23,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ - + import {forceClient} from 'react.force'; import pull from 'lodash.pull'; @@ -51,7 +51,7 @@ module.exports = (opts) => { return; } requested.push(opts.type); - forceClient.defaultLayout(opts.type, + forceClient.defaultLayout(opts.type, (response) => { opts.defaultLayout = response; pull(requested,opts.type); @@ -65,4 +65,4 @@ module.exports = (opts) => { module.exports.addListener = (listener) => { listeners.push(listener); -}; \ No newline at end of file +}; From 561ef9f2acccdcf3168ea29e835988bbf2e6d448 Mon Sep 17 00:00:00 2001 From: Kapil Date: Sat, 25 Jun 2016 18:02:54 -0700 Subject: [PATCH 05/15] started report container --- src/chatterQueue.js | 2 +- src/getByReportId.js | 7 +++++++ src/reportQuery.js | 47 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/getByReportId.js create mode 100644 src/reportQuery.js diff --git a/src/chatterQueue.js b/src/chatterQueue.js index e9389f9..4cfdd9d 100644 --- a/src/chatterQueue.js +++ b/src/chatterQueue.js @@ -15,7 +15,7 @@ const add = (id) => { setTimeout(()=>{ if(chatterQueue && chatterQueue.length !== 0){ console.log('TRIGGER QUERY !!!'); - const ids = get() + const ids = get(); return chatterQuery({ids:ids}); } },300); diff --git a/src/getByReportId.js b/src/getByReportId.js new file mode 100644 index 0000000..6106664 --- /dev/null +++ b/src/getByReportId.js @@ -0,0 +1,7 @@ +import getCachedReportData from './getCachedReportData'; +import doReportQuery from './reportQuery'; + +module.exports = (id, noCache) => { + return getCachedReportData({id:id, noCache:!!noCache}) + .then(doReportQuery); +}; diff --git a/src/reportQuery.js b/src/reportQuery.js new file mode 100644 index 0000000..2128638 --- /dev/null +++ b/src/reportQuery.js @@ -0,0 +1,47 @@ +import {forceClient} from 'react.force'; +import union from 'lodash.union'; +import remove from 'lodash.remove'; +import trim from 'lodash.trim'; + +let queryCount = 0; + +const listeners = []; + +const broadcast = (reportResponse) => { + const reportId = response.attributes.reportId; + listeners.forEach((listener)=>{ + listener(reportId, reportResponse); + }); +} + +module.exports = (opts) => { + return new Promise( + (resolve, reject) => { + if(!opts.noCache && opts.cachedReportData ){ + console.log('skipping report request for cached data'); + opts.reportData = opts.cachedReportData; + resolve(opts); + return; + } + + queryCount++; + forceClient.reportData(opts.id, + (response)=>{ + broadcast(response); + resolve(opts); + }, + (error) => { + reject('Error: query'); + } + ); + } + ); +}; + +module.exports.addListener = (listener) => { + listeners.push(listener); +}; + +module.exports.getQueryCount = () => { + return queryCount; +}; From b7319a0885d91545cf9797f498fbd491f42a0088 Mon Sep 17 00:00:00 2001 From: Sreya Basuroy Date: Mon, 27 Jun 2016 09:36:11 -0700 Subject: [PATCH 06/15] add reportContainer files --- src/addToReportQueue.js | 13 ++++++++++++ src/cacheReportData.js | 31 ++++++++++++++++++++++++++++ src/getByReportId.js | 3 +++ src/getCachedReportData.js | 11 ++++++++++ src/index.js | 9 +++++++- src/reportQuery.js | 42 +++++++++++++++++++++++++++++++++----- src/reportQueue.js | 27 ++++++++++++++++++++++++ 7 files changed, 130 insertions(+), 6 deletions(-) create mode 100644 src/addToReportQueue.js create mode 100644 src/cacheReportData.js create mode 100644 src/getCachedReportData.js create mode 100644 src/reportQueue.js diff --git a/src/addToReportQueue.js b/src/addToReportQueue.js new file mode 100644 index 0000000..58c0511 --- /dev/null +++ b/src/addToReportQueue.js @@ -0,0 +1,13 @@ +import reportQueue from './reportQueue'; + +module.exports = (opts) => { + return new Promise ( + (resolve, reject) => { + if(!opts.cachedReportData || opts.nocache){ + reportQueue.add(opts.id); + } else { + console.log('skipping: already cached'); + } + resolve(opts); + }) +} diff --git a/src/cacheReportData.js b/src/cacheReportData.js new file mode 100644 index 0000000..d2aa349 --- /dev/null +++ b/src/cacheReportData.js @@ -0,0 +1,31 @@ +// import reportQuery +import query from './reportQuery'; + +//let CACHE = {}; + +const notify = (id,sobjs) => { + for (var sobj in sobjs) { + set(sobj); + } + //set(sobj); + /*sobjs.forEach((sobj)=>{ + set(sobj); + });*/ +}; + +query.addListener(notify); + +let cache = {}; + +const get = (id)=>{ + return cache[id]; +}; + +const set = (sobj)=>{ + cache[sobj.Id] = sobj; +}; + +module.exports = { + get:get, + set:set +}; diff --git a/src/getByReportId.js b/src/getByReportId.js index 6106664..1afdc5f 100644 --- a/src/getByReportId.js +++ b/src/getByReportId.js @@ -1,7 +1,10 @@ import getCachedReportData from './getCachedReportData'; +import addToReportQueue from './addToReportQueue'; import doReportQuery from './reportQuery'; + module.exports = (id, noCache) => { return getCachedReportData({id:id, noCache:!!noCache}) + //.then(addToReportQueue); .then(doReportQuery); }; diff --git a/src/getCachedReportData.js b/src/getCachedReportData.js new file mode 100644 index 0000000..d9d4739 --- /dev/null +++ b/src/getCachedReportData.js @@ -0,0 +1,11 @@ +import cacheReportData from './cacheReportData'; + +module.exports = (opts) => { + return new Promise( + (resolve, reject) => { + const id = opts.id; + const item = cacheReportData.get(id); + opts.cacheReportData = item; + resolve(opts); + }) +} diff --git a/src/index.js b/src/index.js index 5cff684..9e1290a 100644 --- a/src/index.js +++ b/src/index.js @@ -43,6 +43,11 @@ import clearCache from './clearCache'; import chatterQuery from './chatterQuery'; import getByChatterUserId from './getByChatterUserId'; +import reportQuery from './reportQuery'; +import getByReportId from './getByReportId'; + + + module.exports = { getByTypeAndId:getByTypeAndId, getDefaultLayout:getDefaultLayout, @@ -53,5 +58,7 @@ module.exports = { requestWithTypeAndId:requestWithTypeAndId, clearCache:clearCache, chatterQuery: chatterQuery, - getByChatterUserId: getByChatterUserId + reportQuery: reportQuery, + getByChatterUserId: getByChatterUserId, + getByReportId: getByReportId }; diff --git a/src/reportQuery.js b/src/reportQuery.js index 2128638..4eda27f 100644 --- a/src/reportQuery.js +++ b/src/reportQuery.js @@ -7,8 +7,17 @@ let queryCount = 0; const listeners = []; +/*const broadcast = (records) => { + const ids = records.map((record)=>{ + return record.id; + }); + listeners.forEach((listener)=>{ + listener(ids, records); + }); +}*/ + const broadcast = (reportResponse) => { - const reportId = response.attributes.reportId; + const reportId = reportResponse.attributes.reportId; listeners.forEach((listener)=>{ listener(reportId, reportResponse); }); @@ -25,13 +34,36 @@ module.exports = (opts) => { } queryCount++; + forceClient.reportData(opts.id, (response)=>{ - broadcast(response); - resolve(opts); + //if(response){ + broadcast(response); + resolve(opts); + /*let groupings = response.groupingsDown.groupings, + factMap = response.factMap, + dataSource, + sumOfEntities; + + //console.log("****REPORTRESPONSE: " + JSON.stringify(response)); + dataSource = groupings.map(function(grouping, index){ + let mappedObject = Object.assign(grouping, factMap[grouping.key + '!T']); + mappedObject.position = grouping.key; + return mappedObject; + }).find(function(dataBlob){ + return dataBlob.value === this.props.entityId; + }.bind(this));*/ + + /*this.setState({ + reportApiResponse: response, + detailColumnMap : response.reportMetadata.detailColumns, + dataSource: this.getDataSource(dataSource.rows) + });*/ + //} }, - (error) => { - reject('Error: query'); + (error)=> { + reject('Error: query'); + ///console.warn(error); } ); } diff --git a/src/reportQueue.js b/src/reportQueue.js new file mode 100644 index 0000000..e41d70e --- /dev/null +++ b/src/reportQueue.js @@ -0,0 +1,27 @@ +let reportQueue = []; +import keys from 'lodash.keys'; +import reportQuery from './reportQuery'; + +const get = () => { + return reportQueue.splice(0, reportQueue.length); +} +const add = (id) => { + if(!id){ + return; + } + if(reportQueue.indexOf(id) < 0){ + reportQueue.push(id); + } + setTimeout(()=>{ + if(reportQueue && reportQueue.length !== 0){ + console.log('TRIGGER QUERY !!!'); + const ids = get() + return reportQuery({ids:ids}); + } + },300); +}; + +module.exports = { + add:add, + get:get +}; From 5122e027cc2ce991b0df8b244a2f6b15bc91cb04 Mon Sep 17 00:00:00 2001 From: Kapil Date: Mon, 27 Jun 2016 21:08:50 -0700 Subject: [PATCH 07/15] added data flow of btlogocontainer --- src/addToBtLogoQueue.js | 13 +++++++++ src/btLogoQuery.js | 53 +++++++++++++++++++++++++++++++++++ src/btLogoQueue.js | 27 ++++++++++++++++++ src/cacheBtLogoData.js | 24 ++++++++++++++++ src/cacheChatterData.js | 3 -- src/chatterQuery.js | 2 +- src/getBtLogoByCompanyName.js | 7 +++++ src/getByChatterUserId.js | 1 - src/getCachedBtLogoData.js | 11 ++++++++ src/getCachedChatterData.js | 2 +- src/index.js | 7 ++++- 11 files changed, 143 insertions(+), 7 deletions(-) create mode 100644 src/addToBtLogoQueue.js create mode 100644 src/btLogoQuery.js create mode 100644 src/btLogoQueue.js create mode 100644 src/cacheBtLogoData.js create mode 100644 src/getBtLogoByCompanyName.js create mode 100644 src/getCachedBtLogoData.js diff --git a/src/addToBtLogoQueue.js b/src/addToBtLogoQueue.js new file mode 100644 index 0000000..5c7f004 --- /dev/null +++ b/src/addToBtLogoQueue.js @@ -0,0 +1,13 @@ +import btLogoQueue from './btLogoQueue'; + +module.exports = (opts) => { + return new Promise ( + (resolve, reject) => { + if(!opts.cachedBtLogoData || opts.nocache){ + btLogoQueue.add(opts.id); + } else { + console.log('skipping: already cached'); + } + resolve(opts); + }) +} diff --git a/src/btLogoQuery.js b/src/btLogoQuery.js new file mode 100644 index 0000000..f8b8d9a --- /dev/null +++ b/src/btLogoQuery.js @@ -0,0 +1,53 @@ +import {btClient} from 'react.force'; +import union from 'lodash.union'; +import remove from 'lodash.remove'; +import trim from 'lodash.trim'; + +let queryCount = 0; + +const listeners = []; + +const broadcast = (records) => { + const ids = records.map((record)=>{ + return record.id; + }); + listeners.forEach((listener)=>{ + listener(ids, records); + }); +} + +module.exports = (opts) => { + return new Promise( + (resolve, reject) => { + if(!opts.noCache && opts.cachedBtLogoData ){ + opts.btLogoData = opts.cachedBtLogoData; + resolve(opts); + return; + } + + queryCount++; + btClient.btLogoBatchRequest(opts.ids, (response)=>{ + if(!response.hasErrors && response.companyLogoResponseItems.length){ + const records = response.companyLogoResponseItems.map((r, index) => { + let result = r; + result.id = opts.ids[index]; + return result; + }); + broadcast(records); + } + resolve(opts); + }, + (error)=>{ + reject('Error: bluetail query'); + }) + } + ); +}; + +module.exports.addListener = (listener) => { + listeners.push(listener); +}; + +module.exports.getQueryCount = () => { + return queryCount; +}; diff --git a/src/btLogoQueue.js b/src/btLogoQueue.js new file mode 100644 index 0000000..47e73e3 --- /dev/null +++ b/src/btLogoQueue.js @@ -0,0 +1,27 @@ +let btLogoQueue = []; +import keys from 'lodash.keys'; +import btLogoQuery from './btLogoQuery'; + +const get = () => { + return btLogoQueue.splice(0, btLogoQueue.length); +} +const add = (id) => { + if(!id){ + return; + } + if(btLogoQueue.indexOf(id) < 0){ + btLogoQueue.push(id); + } + setTimeout(()=>{ + if(btLogoQueue && btLogoQueue.length !== 0){ + console.log('TRIGGER QUERY !!!'); + const ids = get(); + return btLogoQuery({ids:ids}); + } + },300); +}; + +module.exports = { + add:add, + get:get +}; diff --git a/src/cacheBtLogoData.js b/src/cacheBtLogoData.js new file mode 100644 index 0000000..9333315 --- /dev/null +++ b/src/cacheBtLogoData.js @@ -0,0 +1,24 @@ +import query from './btLogoQuery'; + +const notify = (companyName,blueTailBlobs) => { + blueTailBlobs.forEach((blueTailBlob)=>{ + set(blueTailBlob, companyName); + }); +}; + +query.addListener(notify); + +let cache = {}; + +const get = (companyName)=>{ + return cache[companyName]; +}; + +const set = (blueTailBlob, companyName)=>{ + cache[companyName] = blueTailBlob; +}; + +module.exports = { + get:get, + set:set +}; diff --git a/src/cacheChatterData.js b/src/cacheChatterData.js index db5f654..2ac4ca1 100644 --- a/src/cacheChatterData.js +++ b/src/cacheChatterData.js @@ -1,8 +1,5 @@ -// import chatterQuery import query from './chatterQuery'; -//let CACHE = {}; - const notify = (ids,sobjs) => { sobjs.forEach((sobj)=>{ set(sobj); diff --git a/src/chatterQuery.js b/src/chatterQuery.js index 65cb529..136b0e9 100644 --- a/src/chatterQuery.js +++ b/src/chatterQuery.js @@ -39,7 +39,7 @@ module.exports = (opts) => { resolve(opts); }, (error) => { - reject('Error: query'); + reject('Error: chatter query'); } ); } diff --git a/src/getBtLogoByCompanyName.js b/src/getBtLogoByCompanyName.js new file mode 100644 index 0000000..43bc949 --- /dev/null +++ b/src/getBtLogoByCompanyName.js @@ -0,0 +1,7 @@ +import getCachedBtLogoData from './getCachedBtLogoData'; +import addToBtLogoQueue from './addToBtLogoQueue'; + +module.exports = (id, noCache) => { + return getCachedBtLogoData({id:id, noCache:!!noCache}) + .then(addToBtLogoQueue); +}; diff --git a/src/getByChatterUserId.js b/src/getByChatterUserId.js index f99d2eb..ca8b525 100644 --- a/src/getByChatterUserId.js +++ b/src/getByChatterUserId.js @@ -1,7 +1,6 @@ import getCachedChatterData from './getCachedChatterData'; import addToChatterQueue from './addToChatterQueue'; - module.exports = (id, noCache) => { return getCachedChatterData({id:id, noCache:!!noCache}) .then(addToChatterQueue); diff --git a/src/getCachedBtLogoData.js b/src/getCachedBtLogoData.js new file mode 100644 index 0000000..95f5e05 --- /dev/null +++ b/src/getCachedBtLogoData.js @@ -0,0 +1,11 @@ +import cacheBtLogoData from './cacheBtLogoData'; + +module.exports = (opts) => { + return new Promise( + (resolve, reject) => { + const id = opts.id; + const item = cacheBtLogoData.get(id); + opts.cachedBtLogoData = item; + resolve(opts); + }) +} diff --git a/src/getCachedChatterData.js b/src/getCachedChatterData.js index 832aa06..b64e216 100644 --- a/src/getCachedChatterData.js +++ b/src/getCachedChatterData.js @@ -5,7 +5,7 @@ module.exports = (opts) => { (resolve, reject) => { const id = opts.id; const item = cacheChatterData.get(id); - opts.cacheChatterData = item; + opts.cachedChatterData = item; resolve(opts); }) } diff --git a/src/index.js b/src/index.js index 5cff684..6d979b1 100644 --- a/src/index.js +++ b/src/index.js @@ -43,6 +43,9 @@ import clearCache from './clearCache'; import chatterQuery from './chatterQuery'; import getByChatterUserId from './getByChatterUserId'; +import getBtLogoByCompanyName from './getBtLogoByCompanyName'; +import btLogoQuery from './btLogoQuery'; + module.exports = { getByTypeAndId:getByTypeAndId, getDefaultLayout:getDefaultLayout, @@ -53,5 +56,7 @@ module.exports = { requestWithTypeAndId:requestWithTypeAndId, clearCache:clearCache, chatterQuery: chatterQuery, - getByChatterUserId: getByChatterUserId + getByChatterUserId: getByChatterUserId, + getBtLogoByCompanyName: getBtLogoByCompanyName, + btLogoQuery: btLogoQuery }; From 8b19cbb2be0f6de81b10823cce2d5dd5ef886bc5 Mon Sep 17 00:00:00 2001 From: Sreya Basuroy Date: Tue, 28 Jun 2016 09:34:42 -0700 Subject: [PATCH 08/15] add comments --- src/cacheReportData.js | 7 +------ src/getByReportId.js | 2 -- src/reportQuery.js | 40 ++++------------------------------------ 3 files changed, 5 insertions(+), 44 deletions(-) diff --git a/src/cacheReportData.js b/src/cacheReportData.js index d2aa349..185b55c 100644 --- a/src/cacheReportData.js +++ b/src/cacheReportData.js @@ -1,16 +1,11 @@ // import reportQuery import query from './reportQuery'; -//let CACHE = {}; - const notify = (id,sobjs) => { + //store report in cache for (var sobj in sobjs) { set(sobj); } - //set(sobj); - /*sobjs.forEach((sobj)=>{ - set(sobj); - });*/ }; query.addListener(notify); diff --git a/src/getByReportId.js b/src/getByReportId.js index 1afdc5f..c667fe8 100644 --- a/src/getByReportId.js +++ b/src/getByReportId.js @@ -1,10 +1,8 @@ import getCachedReportData from './getCachedReportData'; -import addToReportQueue from './addToReportQueue'; import doReportQuery from './reportQuery'; module.exports = (id, noCache) => { return getCachedReportData({id:id, noCache:!!noCache}) - //.then(addToReportQueue); .then(doReportQuery); }; diff --git a/src/reportQuery.js b/src/reportQuery.js index 4eda27f..ef0b8cc 100644 --- a/src/reportQuery.js +++ b/src/reportQuery.js @@ -7,16 +7,8 @@ let queryCount = 0; const listeners = []; -/*const broadcast = (records) => { - const ids = records.map((record)=>{ - return record.id; - }); - listeners.forEach((listener)=>{ - listener(ids, records); - }); -}*/ - const broadcast = (reportResponse) => { + //only one report to send back const reportId = reportResponse.attributes.reportId; listeners.forEach((listener)=>{ listener(reportId, reportResponse); @@ -27,43 +19,19 @@ module.exports = (opts) => { return new Promise( (resolve, reject) => { if(!opts.noCache && opts.cachedReportData ){ - console.log('skipping report request for cached data'); opts.reportData = opts.cachedReportData; resolve(opts); return; } queryCount++; - forceClient.reportData(opts.id, (response)=>{ - //if(response){ - broadcast(response); - resolve(opts); - /*let groupings = response.groupingsDown.groupings, - factMap = response.factMap, - dataSource, - sumOfEntities; - - //console.log("****REPORTRESPONSE: " + JSON.stringify(response)); - dataSource = groupings.map(function(grouping, index){ - let mappedObject = Object.assign(grouping, factMap[grouping.key + '!T']); - mappedObject.position = grouping.key; - return mappedObject; - }).find(function(dataBlob){ - return dataBlob.value === this.props.entityId; - }.bind(this));*/ - - /*this.setState({ - reportApiResponse: response, - detailColumnMap : response.reportMetadata.detailColumns, - dataSource: this.getDataSource(dataSource.rows) - });*/ - //} + broadcast(response); + resolve(opts); }, (error)=> { - reject('Error: query'); - ///console.warn(error); + console.warn(error); } ); } From cda6de67f6d852b5a5bc9268824f2344eaa56829 Mon Sep 17 00:00:00 2001 From: Sreya Basuroy Date: Tue, 28 Jun 2016 13:58:52 -0700 Subject: [PATCH 09/15] update reportId --- src/cacheReportData.js | 10 ++++------ src/getByReportId.js | 4 +++- src/reportQuery.js | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/cacheReportData.js b/src/cacheReportData.js index 185b55c..1e1917a 100644 --- a/src/cacheReportData.js +++ b/src/cacheReportData.js @@ -1,11 +1,8 @@ // import reportQuery import query from './reportQuery'; -const notify = (id,sobjs) => { - //store report in cache - for (var sobj in sobjs) { - set(sobj); - } +const notify = (id,sobj) => { + set(sobj); }; query.addListener(notify); @@ -17,7 +14,8 @@ const get = (id)=>{ }; const set = (sobj)=>{ - cache[sobj.Id] = sobj; + let reportId = sobj.attributes.reportId; + cache[reportId] = sobj; }; module.exports = { diff --git a/src/getByReportId.js b/src/getByReportId.js index c667fe8..37a5258 100644 --- a/src/getByReportId.js +++ b/src/getByReportId.js @@ -1,8 +1,10 @@ import getCachedReportData from './getCachedReportData'; import doReportQuery from './reportQuery'; +import addToReportQueue from './addToReportQueue'; module.exports = (id, noCache) => { return getCachedReportData({id:id, noCache:!!noCache}) - .then(doReportQuery); + //.then(doReportQuery); + .then(addToReportQueue); }; diff --git a/src/reportQuery.js b/src/reportQuery.js index ef0b8cc..5a5119c 100644 --- a/src/reportQuery.js +++ b/src/reportQuery.js @@ -18,14 +18,14 @@ const broadcast = (reportResponse) => { module.exports = (opts) => { return new Promise( (resolve, reject) => { - if(!opts.noCache && opts.cachedReportData ){ + if(!opts.noCache && opts.cachedReportData){ opts.reportData = opts.cachedReportData; resolve(opts); return; } queryCount++; - forceClient.reportData(opts.id, + forceClient.reportData(opts.ids[0], (response)=>{ broadcast(response); resolve(opts); From 37ef18aba785bf323a630e6e5fc00f50b258df61 Mon Sep 17 00:00:00 2001 From: Kapil Date: Tue, 28 Jun 2016 17:40:03 -0700 Subject: [PATCH 10/15] added report data files --- src/addToReportQueue.js | 13 +++++++++++++ src/cacheReportData.js | 24 ++++++++++++++++++++++++ src/getByReportId.js | 7 +++++-- src/getCachedReportData.js | 12 ++++++++++++ src/index.js | 7 ++++++- src/reportQuery.js | 12 ++++++------ src/reportQueue.js | 27 +++++++++++++++++++++++++++ 7 files changed, 93 insertions(+), 9 deletions(-) create mode 100755 src/addToReportQueue.js create mode 100755 src/cacheReportData.js mode change 100644 => 100755 src/getByReportId.js create mode 100755 src/getCachedReportData.js mode change 100644 => 100755 src/reportQuery.js create mode 100755 src/reportQueue.js diff --git a/src/addToReportQueue.js b/src/addToReportQueue.js new file mode 100755 index 0000000..58c0511 --- /dev/null +++ b/src/addToReportQueue.js @@ -0,0 +1,13 @@ +import reportQueue from './reportQueue'; + +module.exports = (opts) => { + return new Promise ( + (resolve, reject) => { + if(!opts.cachedReportData || opts.nocache){ + reportQueue.add(opts.id); + } else { + console.log('skipping: already cached'); + } + resolve(opts); + }) +} diff --git a/src/cacheReportData.js b/src/cacheReportData.js new file mode 100755 index 0000000..1e1917a --- /dev/null +++ b/src/cacheReportData.js @@ -0,0 +1,24 @@ +// import reportQuery +import query from './reportQuery'; + +const notify = (id,sobj) => { + set(sobj); +}; + +query.addListener(notify); + +let cache = {}; + +const get = (id)=>{ + return cache[id]; +}; + +const set = (sobj)=>{ + let reportId = sobj.attributes.reportId; + cache[reportId] = sobj; +}; + +module.exports = { + get:get, + set:set +}; diff --git a/src/getByReportId.js b/src/getByReportId.js old mode 100644 new mode 100755 index 6106664..53e7495 --- a/src/getByReportId.js +++ b/src/getByReportId.js @@ -1,7 +1,10 @@ import getCachedReportData from './getCachedReportData'; -import doReportQuery from './reportQuery'; +// import doReportQuery from './reportQuery'; +import addToReportQueue from './addToReportQueue'; + module.exports = (id, noCache) => { return getCachedReportData({id:id, noCache:!!noCache}) - .then(doReportQuery); + //.then(doReportQuery); + .then(addToReportQueue); }; diff --git a/src/getCachedReportData.js b/src/getCachedReportData.js new file mode 100755 index 0000000..a2884db --- /dev/null +++ b/src/getCachedReportData.js @@ -0,0 +1,12 @@ +import cacheReportData from './cacheReportData'; + +module.exports = (opts) => { + return new Promise( + (resolve, reject) => { + const id = opts.id; + const item = cacheReportData.get(id); + opts.cachedReportData = item; + debugger; + resolve(opts); + }) +} diff --git a/src/index.js b/src/index.js index 6d979b1..f0b321f 100644 --- a/src/index.js +++ b/src/index.js @@ -46,6 +46,9 @@ import getByChatterUserId from './getByChatterUserId'; import getBtLogoByCompanyName from './getBtLogoByCompanyName'; import btLogoQuery from './btLogoQuery'; +import getByReportId from './getByReportId'; +import reportQuery from './reportQuery'; + module.exports = { getByTypeAndId:getByTypeAndId, getDefaultLayout:getDefaultLayout, @@ -58,5 +61,7 @@ module.exports = { chatterQuery: chatterQuery, getByChatterUserId: getByChatterUserId, getBtLogoByCompanyName: getBtLogoByCompanyName, - btLogoQuery: btLogoQuery + btLogoQuery: btLogoQuery, + reportQuery: reportQuery, + getByReportId: getByReportId }; diff --git a/src/reportQuery.js b/src/reportQuery.js old mode 100644 new mode 100755 index 2128638..5a5119c --- a/src/reportQuery.js +++ b/src/reportQuery.js @@ -8,7 +8,8 @@ let queryCount = 0; const listeners = []; const broadcast = (reportResponse) => { - const reportId = response.attributes.reportId; + //only one report to send back + const reportId = reportResponse.attributes.reportId; listeners.forEach((listener)=>{ listener(reportId, reportResponse); }); @@ -17,21 +18,20 @@ const broadcast = (reportResponse) => { module.exports = (opts) => { return new Promise( (resolve, reject) => { - if(!opts.noCache && opts.cachedReportData ){ - console.log('skipping report request for cached data'); + if(!opts.noCache && opts.cachedReportData){ opts.reportData = opts.cachedReportData; resolve(opts); return; } queryCount++; - forceClient.reportData(opts.id, + forceClient.reportData(opts.ids[0], (response)=>{ broadcast(response); resolve(opts); }, - (error) => { - reject('Error: query'); + (error)=> { + console.warn(error); } ); } diff --git a/src/reportQueue.js b/src/reportQueue.js new file mode 100755 index 0000000..e41d70e --- /dev/null +++ b/src/reportQueue.js @@ -0,0 +1,27 @@ +let reportQueue = []; +import keys from 'lodash.keys'; +import reportQuery from './reportQuery'; + +const get = () => { + return reportQueue.splice(0, reportQueue.length); +} +const add = (id) => { + if(!id){ + return; + } + if(reportQueue.indexOf(id) < 0){ + reportQueue.push(id); + } + setTimeout(()=>{ + if(reportQueue && reportQueue.length !== 0){ + console.log('TRIGGER QUERY !!!'); + const ids = get() + return reportQuery({ids:ids}); + } + },300); +}; + +module.exports = { + add:add, + get:get +}; From 80cd756249aec5b704365ac82910a02ffa710ce0 Mon Sep 17 00:00:00 2001 From: Sreya Basuroy Date: Wed, 29 Jun 2016 16:59:16 -0700 Subject: [PATCH 11/15] remove setTimeout from reportQueue --- src/addToReportQueue.js | 0 src/cacheReportData.js | 10 +++++----- src/getByReportId.js | 2 -- src/getCachedReportData.js | 2 +- src/index.js | 11 +++++++---- src/reportQuery.js | 0 src/reportQueue.js | 12 +++++------- 7 files changed, 18 insertions(+), 19 deletions(-) mode change 100644 => 100755 src/addToReportQueue.js mode change 100644 => 100755 src/cacheReportData.js mode change 100644 => 100755 src/getByReportId.js mode change 100644 => 100755 src/getCachedReportData.js mode change 100644 => 100755 src/reportQuery.js mode change 100644 => 100755 src/reportQueue.js diff --git a/src/addToReportQueue.js b/src/addToReportQueue.js old mode 100644 new mode 100755 diff --git a/src/cacheReportData.js b/src/cacheReportData.js old mode 100644 new mode 100755 index 1e1917a..40f2b57 --- a/src/cacheReportData.js +++ b/src/cacheReportData.js @@ -1,8 +1,8 @@ // import reportQuery import query from './reportQuery'; -const notify = (id,sobj) => { - set(sobj); +const notify = (id,report) => { + set(report); }; query.addListener(notify); @@ -13,9 +13,9 @@ const get = (id)=>{ return cache[id]; }; -const set = (sobj)=>{ - let reportId = sobj.attributes.reportId; - cache[reportId] = sobj; +const set = (report)=>{ + let reportId = report.attributes.reportId; + cache[reportId] = report; }; module.exports = { diff --git a/src/getByReportId.js b/src/getByReportId.js old mode 100644 new mode 100755 index 37a5258..ba46271 --- a/src/getByReportId.js +++ b/src/getByReportId.js @@ -1,10 +1,8 @@ import getCachedReportData from './getCachedReportData'; -import doReportQuery from './reportQuery'; import addToReportQueue from './addToReportQueue'; module.exports = (id, noCache) => { return getCachedReportData({id:id, noCache:!!noCache}) - //.then(doReportQuery); .then(addToReportQueue); }; diff --git a/src/getCachedReportData.js b/src/getCachedReportData.js old mode 100644 new mode 100755 index d9d4739..0b7061d --- a/src/getCachedReportData.js +++ b/src/getCachedReportData.js @@ -5,7 +5,7 @@ module.exports = (opts) => { (resolve, reject) => { const id = opts.id; const item = cacheReportData.get(id); - opts.cacheReportData = item; + opts.cachedReportData = item; resolve(opts); }) } diff --git a/src/index.js b/src/index.js index 9e1290a..f0b321f 100644 --- a/src/index.js +++ b/src/index.js @@ -43,10 +43,11 @@ import clearCache from './clearCache'; import chatterQuery from './chatterQuery'; import getByChatterUserId from './getByChatterUserId'; -import reportQuery from './reportQuery'; -import getByReportId from './getByReportId'; - +import getBtLogoByCompanyName from './getBtLogoByCompanyName'; +import btLogoQuery from './btLogoQuery'; +import getByReportId from './getByReportId'; +import reportQuery from './reportQuery'; module.exports = { getByTypeAndId:getByTypeAndId, @@ -58,7 +59,9 @@ module.exports = { requestWithTypeAndId:requestWithTypeAndId, clearCache:clearCache, chatterQuery: chatterQuery, - reportQuery: reportQuery, getByChatterUserId: getByChatterUserId, + getBtLogoByCompanyName: getBtLogoByCompanyName, + btLogoQuery: btLogoQuery, + reportQuery: reportQuery, getByReportId: getByReportId }; diff --git a/src/reportQuery.js b/src/reportQuery.js old mode 100644 new mode 100755 diff --git a/src/reportQueue.js b/src/reportQueue.js old mode 100644 new mode 100755 index e41d70e..06a6833 --- a/src/reportQueue.js +++ b/src/reportQueue.js @@ -12,13 +12,11 @@ const add = (id) => { if(reportQueue.indexOf(id) < 0){ reportQueue.push(id); } - setTimeout(()=>{ - if(reportQueue && reportQueue.length !== 0){ - console.log('TRIGGER QUERY !!!'); - const ids = get() - return reportQuery({ids:ids}); - } - },300); + if(reportQueue && reportQueue.length !== 0){ + console.log('TRIGGER QUERY !!!'); + const ids = get(); + return reportQuery({ids:ids}); + } }; module.exports = { From 9f82c54a0d17282c0f99a557dacb0b09874eddb0 Mon Sep 17 00:00:00 2001 From: Kapil Date: Thu, 30 Jun 2016 16:44:24 -0700 Subject: [PATCH 12/15] cleaned out report container data flow --- src/cacheReportData.js | 10 +- src/{addToReportQueue.js => doReportQuery.js} | 4 +- src/getByReportId.js | 5 +- src/getCachedSobj.js | 4 +- src/reportQuery.js | 2 +- src/reportQueue.js | 25 ----- src/storage.js | 95 +++++++------------ src/storageCompact.js | 92 ++++++------------ src/storageDefaultLayout.js | 92 +++++++----------- 9 files changed, 111 insertions(+), 218 deletions(-) rename src/{addToReportQueue.js => doReportQuery.js} (75%) delete mode 100755 src/reportQueue.js diff --git a/src/cacheReportData.js b/src/cacheReportData.js index 40f2b57..1e1917a 100755 --- a/src/cacheReportData.js +++ b/src/cacheReportData.js @@ -1,8 +1,8 @@ // import reportQuery import query from './reportQuery'; -const notify = (id,report) => { - set(report); +const notify = (id,sobj) => { + set(sobj); }; query.addListener(notify); @@ -13,9 +13,9 @@ const get = (id)=>{ return cache[id]; }; -const set = (report)=>{ - let reportId = report.attributes.reportId; - cache[reportId] = report; +const set = (sobj)=>{ + let reportId = sobj.attributes.reportId; + cache[reportId] = sobj; }; module.exports = { diff --git a/src/addToReportQueue.js b/src/doReportQuery.js similarity index 75% rename from src/addToReportQueue.js rename to src/doReportQuery.js index 58c0511..ca771c8 100755 --- a/src/addToReportQueue.js +++ b/src/doReportQuery.js @@ -1,10 +1,10 @@ -import reportQueue from './reportQueue'; +import reportQuery from './reportQuery'; module.exports = (opts) => { return new Promise ( (resolve, reject) => { if(!opts.cachedReportData || opts.nocache){ - reportQueue.add(opts.id); + reportQuery({id:opts.id}) } else { console.log('skipping: already cached'); } diff --git a/src/getByReportId.js b/src/getByReportId.js index ba46271..b3cb759 100755 --- a/src/getByReportId.js +++ b/src/getByReportId.js @@ -1,8 +1,7 @@ import getCachedReportData from './getCachedReportData'; -import addToReportQueue from './addToReportQueue'; - +import doReportQuery from './doReportQuery'; module.exports = (id, noCache) => { return getCachedReportData({id:id, noCache:!!noCache}) - .then(addToReportQueue); + .then(doReportQuery); }; diff --git a/src/getCachedSobj.js b/src/getCachedSobj.js index 4cc1334..0b12784 100644 --- a/src/getCachedSobj.js +++ b/src/getCachedSobj.js @@ -43,7 +43,8 @@ module.exports = (opts) => { resolve(opts); return; } -/* + + storage.getItem(id, (item)=>{ if(item){ opts.cachedSobj = item; @@ -53,7 +54,6 @@ module.exports = (opts) => { } return; }); -*/ } ); }; diff --git a/src/reportQuery.js b/src/reportQuery.js index 5a5119c..31ae30f 100755 --- a/src/reportQuery.js +++ b/src/reportQuery.js @@ -25,7 +25,7 @@ module.exports = (opts) => { } queryCount++; - forceClient.reportData(opts.ids[0], + forceClient.reportData(opts.id, (response)=>{ broadcast(response); resolve(opts); diff --git a/src/reportQueue.js b/src/reportQueue.js deleted file mode 100755 index 06a6833..0000000 --- a/src/reportQueue.js +++ /dev/null @@ -1,25 +0,0 @@ -let reportQueue = []; -import keys from 'lodash.keys'; -import reportQuery from './reportQuery'; - -const get = () => { - return reportQueue.splice(0, reportQueue.length); -} -const add = (id) => { - if(!id){ - return; - } - if(reportQueue.indexOf(id) < 0){ - reportQueue.push(id); - } - if(reportQueue && reportQueue.length !== 0){ - console.log('TRIGGER QUERY !!!'); - const ids = get(); - return reportQuery({ids:ids}); - } -}; - -module.exports = { - add:add, - get:get -}; diff --git a/src/storage.js b/src/storage.js index 0006c97..3306d3a 100644 --- a/src/storage.js +++ b/src/storage.js @@ -24,17 +24,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ -import {smartstore} from 'react.force'; +import { AsyncStorage } from 'react-native'; import query from './query'; import cache from './cache'; -const PREFIX = 'sobj_'; - -const SOUP_NAME = PREFIX+'Soup'; - -const externalID = '__shortId'; const notify = (ids,sobjs) => { sobjs.forEach((sobj)=>{ @@ -43,70 +38,52 @@ const notify = (ids,sobjs) => { }; const populateCache = ()=>{ - const querySpec = smartstore.buildAllQuerySpec('__shortId', "ascending", 100); + AsyncStorage.getAllKeys((err, keys) => { + AsyncStorage.multiGet(keys, (err, stores) => { + stores.forEach((result, i, store) => { + const sobj = JSON.parse(store[i][1]); + cache.set(sobj); + }); + }); - smartstore.querySoup( - false, - SOUP_NAME, - querySpec, - (cursor)=>{ - const items = cursor.currentPageOrderedEntries; - if(items && items.length){ - items.forEach((sobj)=>{ - if(sobj.attributes && sobj.attributes.shortId){ - cache.set(sobj); - } - }); - } + }); +}; - }, - (err)=>{ - console.log('ERR: ',err); - }); +const set = (sobj)=>{ + if(sobj && sobj.attributes && sobj.attributes.shortId){ + setItem(sobj.attributes.shortId,sobj); + } }; -init = ()=>{ - smartstore.registerSoup(false, - SOUP_NAME, - [ - {path:externalID, type:"string"} - ], - () => { - populateCache(); - query.addListener(notify); - } - ); +const getShotId = (id)=>{ + if(id && id.length>=15){ + return id.substring(0,15); + } }; -clearAll = ()=>{ - smartstore.clearSoup(false,SOUP_NAME); +const setItem = (id,sobj,callback)=>{ + const shortId = getShotId(id); + return AsyncStorage.setItem(shortId,JSON.stringify(sobj),callback); }; -set = (sobj, callback)=>{ - if(sobj && sobj.attributes && sobj.attributes.shortId){ - sobj[externalID] = sobj.attributes.shortId; - smartstore.upsertSoupEntriesWithExternalId(false, - SOUP_NAME, [ sobj ],externalID, - (sobjs) => { - console.log('DONE UPSERTING!'); - if(callback){ - callback(sobjs); - } - }, - (err) => { - console.log('ERROR!'); - if(callback){ - callback(); - } +const getItem = (id,callback)=>{ + const shortId = getShotId(id); + return AsyncStorage.getItem(shortId,(err, result)=>{ + if(callback){ + if(err || !result){ + return callback(); } - ); - } + const sobj = JSON.parse(result); + return callback(sobj); + } + }); }; - -init(); +populateCache(); +query.addListener(notify); module.exports = { - set:set, - clearAll:clearAll + getItem:getItem, + setItem:setItem, + set:set }; \ No newline at end of file diff --git a/src/storageCompact.js b/src/storageCompact.js index 1dea84f..4bdb65a 100644 --- a/src/storageCompact.js +++ b/src/storageCompact.js @@ -24,15 +24,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ -import {smartstore} from 'react.force'; +import { AsyncStorage } from 'react-native'; import getCompactLayout from './getCompactLayout'; -import cacheCompact from './cacheCompact'; - -const PREFIX = 'compactLayout_'; -const SOUP_NAME = PREFIX+'Soup'; +import cacheCompact from './cacheCompact'; const notify = (type, compactLayout) => { if(type, compactLayout){ @@ -41,46 +38,20 @@ const notify = (type, compactLayout) => { }; const populateCache = ()=>{ - const querySpec = smartstore.buildAllQuerySpec('id', "ascending", 100); - - smartstore.querySoup( - false, - SOUP_NAME, - querySpec, - (cursor)=>{ - const items = cursor.currentPageOrderedEntries; - if(items && items.length){ - items.forEach((compactLayout)=>{ - if(compactLayout.id){ - const type = compactLayout.id.substring(PREFIX.length); - if(type){ - cacheCompact.set(type,compactLayout); - } + AsyncStorage.getAllKeys((err, keys) => { + AsyncStorage.multiGet(keys, (err, stores) => { + stores.forEach((result, i, store) => { + const key = store[i][0]; + if(key && key.indexOf('compactLayout_')===0){ + const compact = JSON.parse(store[i][1]); + if(compact && compact.objectType){ + cacheCompact.set(compact.objectType,compact); } - }); - } - - }, - (err)=>{ - console.log('ERR: ',err); + } + }); }); -}; -init = ()=>{ - smartstore.registerSoup(false, - SOUP_NAME, - [ - {path:"id", type:"string"} - ], - () => { - populateCache(); - getCompactLayout.addListener(notify); - } - ); -}; - -clearAll = ()=>{ - smartstore.clearSoup(false,SOUP_NAME); + }); }; const set = (type,compactLayout)=>{ @@ -90,33 +61,32 @@ const set = (type,compactLayout)=>{ }; const getLayoutKey = (type)=>{ - return PREFIX+type; + return 'compactLayout_'+type; }; const setItem = (type,compactLayout,callback)=>{ const key = getLayoutKey(type); - compactLayout.id = key; - smartstore.upsertSoupEntriesWithExternalId(false, - SOUP_NAME, [ compactLayout ],'id', - (compactLayouts) => { - console.log('DONE UPSERTING!'); - if(callback){ - callback(compactLayouts); - } - }, - (err) => { - console.log('ERROR!'); - if(callback){ - callback(); + return AsyncStorage.setItem(key,JSON.stringify(compactLayout),callback); +}; + +const getItem = (type,callback)=>{ + const key = getLayoutKey(type); + return AsyncStorage.getItem(key,(err, result)=>{ + if(callback){ + if(err || !result){ + return callback(); } + const compactLayout = JSON.parse(result); + return callback(compactLayout); } - ); + }); }; - -init(); +populateCache(); +getCompactLayout.addListener(notify); module.exports = { - set:set, - clearAll:clearAll + getItem:getItem, + setItem:setItem, + set:set }; \ No newline at end of file diff --git a/src/storageDefaultLayout.js b/src/storageDefaultLayout.js index 6470d98..fce6182 100644 --- a/src/storageDefaultLayout.js +++ b/src/storageDefaultLayout.js @@ -24,17 +24,15 @@ * POSSIBILITY OF SUCH DAMAGE. */ -import {smartstore} from 'react.force'; +import { AsyncStorage } from 'react-native'; import getDefaultLayout from './getDefaultLayout'; + import cacheDefault from './cacheDefault'; const PREFIX = 'defaultLayout_'; -const SOUP_NAME = PREFIX+'Soup'; - - const notify = (type, defaultLayout) => { if(type, defaultLayout){ set(type,defaultLayout); @@ -42,46 +40,21 @@ const notify = (type, defaultLayout) => { }; const populateCache = ()=>{ - const querySpec = smartstore.buildAllQuerySpec('id', "ascending", 100); - - smartstore.querySoup( - false, - SOUP_NAME, - querySpec, - (cursor)=>{ - const items = cursor.currentPageOrderedEntries; - if(items && items.length){ - items.forEach((defaultLayout)=>{ - if(defaultLayout.id){ - const type = defaultLayout.id.substring(PREFIX.length); - if(type){ - cacheDefault.set(type,defaultLayout); - } + AsyncStorage.getAllKeys((err, keys) => { + AsyncStorage.multiGet(keys, (err, stores) => { + stores.forEach((result, i, store) => { + const key = store[i][0]; + if(key && key.indexOf(PREFIX)===0){ + const defaultLayout = JSON.parse(store[i][1]); + const type = key.substring(PREFIX.length); + if(defaultLayout && type && type.length){ + cacheDefault.set(type,defaultLayout); } - }); - } - - }, - (err)=>{ - console.log('ERR: ',err); + } + }); }); -}; -clearAll = ()=>{ - smartstore.clearSoup(false,SOUP_NAME); -}; - -init = ()=>{ - smartstore.registerSoup(false, - SOUP_NAME, - [ - {path:"id", type:"string"} - ], - () => { - populateCache(); - getDefaultLayout.addListener(notify); - } - ); + }); }; const set = (type,defaultLayout)=>{ @@ -94,30 +67,29 @@ const getLayoutKey = (type)=>{ return PREFIX+type; }; -const setItem = (type,defaultLayout,callback)=>{ +const setItem = (type,compactLayout,callback)=>{ const key = getLayoutKey(type); - defaultLayout.id = key; - smartstore.upsertSoupEntriesWithExternalId(false, - SOUP_NAME, [ defaultLayout ],'id', - (defaultLayouts) => { - console.log('DONE UPSERTING!'); - if(callback){ - callback(defaultLayouts); - } - }, - (err) => { - console.log('ERROR!'); - if(callback){ - callback(); + return AsyncStorage.setItem(key,JSON.stringify(compactLayout),callback); +}; + +const getItem = (type,callback)=>{ + const key = getLayoutKey(type); + return AsyncStorage.getItem(key,(err, result)=>{ + if(callback){ + if(err || !result){ + return callback(); } + const defaultLayout = JSON.parse(result); + return callback(defaultLayout); } - ); + }); }; - -init(); +populateCache(); +getDefaultLayout.addListener(notify); module.exports = { - set:set, - clearAll:clearAll + getItem:getItem, + setItem:setItem, + set:set }; \ No newline at end of file From 0574ce035cf2de7994961ecbb4b77de9bbfcdbc7 Mon Sep 17 00:00:00 2001 From: Kapil Date: Tue, 26 Jul 2016 19:37:55 -0700 Subject: [PATCH 13/15] added data flow for dashboards --- src/cacheChatterData.js | 10 +++---- src/dashboard/getDashboardData.js | 34 +++++++++++++++++++++ src/dashboard/refreshDashboard.js | 38 ++++++++++++++++++++++++ src/dashboard/waitForDashboardRefresh.js | 26 ++++++++++++++++ src/getDashboardById.js | 7 +++++ src/index.js | 7 ++++- src/utils/interval.js | 26 ++++++++++++++++ 7 files changed, 142 insertions(+), 6 deletions(-) create mode 100644 src/dashboard/getDashboardData.js create mode 100644 src/dashboard/refreshDashboard.js create mode 100644 src/dashboard/waitForDashboardRefresh.js create mode 100644 src/getDashboardById.js create mode 100644 src/utils/interval.js diff --git a/src/cacheChatterData.js b/src/cacheChatterData.js index 2ac4ca1..040a715 100644 --- a/src/cacheChatterData.js +++ b/src/cacheChatterData.js @@ -1,8 +1,8 @@ import query from './chatterQuery'; -const notify = (ids,sobjs) => { - sobjs.forEach((sobj)=>{ - set(sobj); +const notify = (ids,chatterObjs) => { + chatterObjs.forEach((chatterObj)=>{ + set(chatterObj); }); }; @@ -14,8 +14,8 @@ const get = (id)=>{ return cache[id]; }; -const set = (sobj)=>{ - cache[sobj.Id] = sobj; +const set = (chatterObj)=>{ + cache[chatterObj.id] = chatterObj; }; module.exports = { diff --git a/src/dashboard/getDashboardData.js b/src/dashboard/getDashboardData.js new file mode 100644 index 0000000..b12f045 --- /dev/null +++ b/src/dashboard/getDashboardData.js @@ -0,0 +1,34 @@ +import {forceClient} from 'react.force'; + +const listeners = []; + +const broadcast = (records) => { + const ids = records.map((record)=>{ + return record.id; + }); + listeners.forEach((listener)=>{ + listener(ids, records); + }); +} + +module.exports = (opts) => { + return new Promise( + (resolve, reject) => { + forceClient.dashboardData(opts.id, (response)=>{ + if(response){ + response.id = response.attributes.dashboardId; + broadcast([response]); + } + resolve(opts); + }, + (error)=>{ + reject('Error: dashboard response was not received'); + }) + } + ); +}; + +module.exports.addListener = (listener) => { + listeners.push(listener); +}; + diff --git a/src/dashboard/refreshDashboard.js b/src/dashboard/refreshDashboard.js new file mode 100644 index 0000000..2d03e7f --- /dev/null +++ b/src/dashboard/refreshDashboard.js @@ -0,0 +1,38 @@ +import {forceClient} from 'react.force'; +import Interval from '../utils/interval'; +import waitForDashboardRefresh from './waitForDashboardRefresh'; + + +module.exports = (opts) => { + return new Promise( + (resolve, reject)=> { + if(!opts.autoRefresh){ + resolve(opts); + return; + } + opts.dbRefreshLoop = new Interval(function(time){ + console.log('dbrefreshed@'+time); + forceClient.dashboardRefresh(opts.id, + (response)=>{ + if(response && response.statusUrl){ + resolve(opts); + waitForDashboardRefresh(opts); + return; + } else { + reject('Error: dashboard did not refresh properly'); + } + }, + (error)=>{ + reject('Error: dashboard refresh did not receive data'); + } + ); + } + ,opts.refreshInterval); + + // ,1800000); + + opts.dbRefreshLoop.start(); + + } + ); +} diff --git a/src/dashboard/waitForDashboardRefresh.js b/src/dashboard/waitForDashboardRefresh.js new file mode 100644 index 0000000..32f5c0b --- /dev/null +++ b/src/dashboard/waitForDashboardRefresh.js @@ -0,0 +1,26 @@ +import {forceClient} from 'react.force'; +import Interval from '../utils/interval'; +import getDashboardData from './getDashboardData'; + +module.exports = (opts)=>{ + opts.dbStatusLoop = new Interval(function(time){ + console.log('dbstatuscheck@'+time); + forceClient.dashboardStatus(opts.id, + (response)=>{ + let isDbRefreshed = response.componentStatus.every((component)=>{ + return component.refreshStatus == 'IDLE'; + }) + if(isDbRefreshed){ + opts.dbStatusLoop.stop(); + opts.dbRefreshLoop.stop(); + getDashboardData(opts); + } + }, + (error)=>{ + reject('Error: there was an error in the dashboard refresh'); + } + ) + },10000); + + opts.dbStatusLoop.start(); +} diff --git a/src/getDashboardById.js b/src/getDashboardById.js new file mode 100644 index 0000000..ac835ac --- /dev/null +++ b/src/getDashboardById.js @@ -0,0 +1,7 @@ +import getDashboardData from './dashboard/getDashboardData'; +import refreshDashboard from './dashboard/refreshDashboard'; + +module.exports = (id, autoRefresh, refreshInterval, dbRefreshLoop, dbStatusLoop) => { + return getDashboardData({id: id, autoRefresh:autoRefresh, refreshInterval: refreshInterval, dbRefreshLoop:dbRefreshLoop, dbStatusLoop:dbStatusLoop}) + .then(refreshDashboard) +} diff --git a/src/index.js b/src/index.js index f0b321f..0ea3ba9 100644 --- a/src/index.js +++ b/src/index.js @@ -49,6 +49,9 @@ import btLogoQuery from './btLogoQuery'; import getByReportId from './getByReportId'; import reportQuery from './reportQuery'; +import getDashboardById from './getDashboardById'; +import getDashboardData from './dashboard/getDashboardData'; + module.exports = { getByTypeAndId:getByTypeAndId, getDefaultLayout:getDefaultLayout, @@ -63,5 +66,7 @@ module.exports = { getBtLogoByCompanyName: getBtLogoByCompanyName, btLogoQuery: btLogoQuery, reportQuery: reportQuery, - getByReportId: getByReportId + getByReportId: getByReportId, + getDashboardById: getDashboardById, + getDashboardData: getDashboardData }; diff --git a/src/utils/interval.js b/src/utils/interval.js new file mode 100644 index 0000000..393aaf9 --- /dev/null +++ b/src/utils/interval.js @@ -0,0 +1,26 @@ +module.exports = function(render, interval){ + this.start = start; + this.stop = stop; + + let timeoutId, lastTime; + + function start(){ + timeoutId = setTimeout(loop, 0); + lastTime = Date.now(); + return lastTime; + } + + function stop(){ + clearTimeout(timeoutId); + return lastTime; + } + + function loop(){ + let thisTime = Date.now(); + var deltaTime = thisTime - lastTime; + var delay = Math.max(interval - deltaTime, 0); + timeoutId = setTimeout(loop, delay); + lastTime = thisTime + delay; + render(thisTime); + } +} From 1e42ab4f215745d8fb7b40abd9e50d4c84dba80f Mon Sep 17 00:00:00 2001 From: Kapil Date: Wed, 3 Aug 2016 13:57:22 -0700 Subject: [PATCH 14/15] added stops for status and refresh loop --- src/dashboard/refreshDashboard.js | 12 +++++++----- src/dashboard/waitForDashboardRefresh.js | 13 +++++++++---- src/index.js | 6 +++++- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/dashboard/refreshDashboard.js b/src/dashboard/refreshDashboard.js index 2d03e7f..d060b96 100644 --- a/src/dashboard/refreshDashboard.js +++ b/src/dashboard/refreshDashboard.js @@ -2,6 +2,7 @@ import {forceClient} from 'react.force'; import Interval from '../utils/interval'; import waitForDashboardRefresh from './waitForDashboardRefresh'; +let _dbRefreshLoop; module.exports = (opts) => { return new Promise( @@ -10,7 +11,7 @@ module.exports = (opts) => { resolve(opts); return; } - opts.dbRefreshLoop = new Interval(function(time){ + _dbRefreshLoop = new Interval(function(time){ console.log('dbrefreshed@'+time); forceClient.dashboardRefresh(opts.id, (response)=>{ @@ -29,10 +30,11 @@ module.exports = (opts) => { } ,opts.refreshInterval); - // ,1800000); - - opts.dbRefreshLoop.start(); - + _dbRefreshLoop.start(); } ); } + +module.exports.stop = ()=>{ + _dbRefreshLoop && _dbRefreshLoop.stop(); +} diff --git a/src/dashboard/waitForDashboardRefresh.js b/src/dashboard/waitForDashboardRefresh.js index 32f5c0b..15f24ea 100644 --- a/src/dashboard/waitForDashboardRefresh.js +++ b/src/dashboard/waitForDashboardRefresh.js @@ -2,8 +2,10 @@ import {forceClient} from 'react.force'; import Interval from '../utils/interval'; import getDashboardData from './getDashboardData'; +let _dbStatusLoop; + module.exports = (opts)=>{ - opts.dbStatusLoop = new Interval(function(time){ + _dbStatusLoop = new Interval(function(time){ console.log('dbstatuscheck@'+time); forceClient.dashboardStatus(opts.id, (response)=>{ @@ -11,8 +13,7 @@ module.exports = (opts)=>{ return component.refreshStatus == 'IDLE'; }) if(isDbRefreshed){ - opts.dbStatusLoop.stop(); - opts.dbRefreshLoop.stop(); + _dbStatusLoop.stop(); getDashboardData(opts); } }, @@ -22,5 +23,9 @@ module.exports = (opts)=>{ ) },10000); - opts.dbStatusLoop.start(); + _dbStatusLoop.start(); +} + +module.exports.stop = ()=>{ + _dbStatusLoop && _dbStatusLoop.stop(); } diff --git a/src/index.js b/src/index.js index 0ea3ba9..c7ccb0d 100644 --- a/src/index.js +++ b/src/index.js @@ -51,6 +51,8 @@ import reportQuery from './reportQuery'; import getDashboardById from './getDashboardById'; import getDashboardData from './dashboard/getDashboardData'; +import waitForDashboardRefresh from './dashboard/waitForDashboardRefresh'; +import refreshDashboard from './dashboard/refreshDashboard'; module.exports = { getByTypeAndId:getByTypeAndId, @@ -68,5 +70,7 @@ module.exports = { reportQuery: reportQuery, getByReportId: getByReportId, getDashboardById: getDashboardById, - getDashboardData: getDashboardData + getDashboardData: getDashboardData, + waitForDashboardRefresh: waitForDashboardRefresh, + refreshDashboard: refreshDashboard }; From 5b2c99343a8ac3a5621c73384ea9a605f4269dfa Mon Sep 17 00:00:00 2001 From: Kapil Gowru - Salesforce Date: Fri, 9 Sep 2016 15:06:31 -0700 Subject: [PATCH 15/15] cleaned out some imports, increased status check time --- src/btLogoQueue.js | 1 - src/dashboard/waitForDashboardRefresh.js | 2 +- src/getByTypeAndId.js | 14 +++++------- src/getMetaByType.js | 27 ++++++++++++------------ src/query.js | 4 ++-- 5 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/btLogoQueue.js b/src/btLogoQueue.js index 47e73e3..2565af8 100644 --- a/src/btLogoQueue.js +++ b/src/btLogoQueue.js @@ -14,7 +14,6 @@ const add = (id) => { } setTimeout(()=>{ if(btLogoQueue && btLogoQueue.length !== 0){ - console.log('TRIGGER QUERY !!!'); const ids = get(); return btLogoQuery({ids:ids}); } diff --git a/src/dashboard/waitForDashboardRefresh.js b/src/dashboard/waitForDashboardRefresh.js index 15f24ea..3deb62e 100644 --- a/src/dashboard/waitForDashboardRefresh.js +++ b/src/dashboard/waitForDashboardRefresh.js @@ -21,7 +21,7 @@ module.exports = (opts)=>{ reject('Error: there was an error in the dashboard refresh'); } ) - },10000); + },30000); _dbStatusLoop.start(); } diff --git a/src/getByTypeAndId.js b/src/getByTypeAndId.js index 5be25f4..b9f97b4 100644 --- a/src/getByTypeAndId.js +++ b/src/getByTypeAndId.js @@ -27,20 +27,16 @@ import getCachedSobj from './getCachedSobj'; import getCachedCompactLayout from './getCachedCompactLayout'; import getCompactLayout from './getCompactLayout'; -import doCacheCompactLayout from './doCacheCompactLayout'; -import getCachedDefaultLayout from './getCachedDefaultLayout'; -import getDefaultLayout from './getDefaultLayout'; +// import getCachedDefaultLayout from './getCachedDefaultLayout'; +// import getDefaultLayout from './getDefaultLayout'; import addToQueue from './addToQueue'; -import getMetaByType from './getMetaByType'; - -import queue from './queue'; module.exports = (type, id, noCache) => { return getCachedSobj({type:type,id:id, noCache:!!noCache}) .then(getCachedCompactLayout) .then(getCompactLayout) - .then(getCachedDefaultLayout) - .then(getDefaultLayout) + // .then(getCachedDefaultLayout) + // .then(getDefaultLayout) .then(addToQueue); -}; \ No newline at end of file +}; diff --git a/src/getMetaByType.js b/src/getMetaByType.js index 6bc6341..661494a 100644 --- a/src/getMetaByType.js +++ b/src/getMetaByType.js @@ -23,18 +23,17 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ - -import getDefaultLayout from './getDefaultLayout'; -import getDefaultLayoutFieldNames from './getDefaultLayoutFieldNames'; + +// import getDefaultLayout from './getDefaultLayout'; +// import getDefaultLayoutFieldNames from './getDefaultLayoutFieldNames'; import getCompactLayout from './getCompactLayout'; import getCompactLayoutFieldNames from './getCompactLayoutFieldNames'; -import query from './query'; -import getCompactLayoutTitle from './getCompactLayoutTitle'; -import doCacheSobj from './doCacheSobj'; -import getCachedSobj from './getCachedSobj'; -import getCachedDefaultLayout from './getCachedDefaultLayout'; +// import getCompactLayoutTitle from './getCompactLayoutTitle'; +// import doCacheSobj from './doCacheSobj'; +// import getCachedSobj from './getCachedSobj'; +// import getCachedDefaultLayout from './getCachedDefaultLayout'; import getCachedCompactLayout from './getCachedCompactLayout'; -import doCacheDefaultLayout from './doCacheDefaultLayout'; +// import doCacheDefaultLayout from './doCacheDefaultLayout'; import doCacheCompactLayout from './doCacheCompactLayout'; @@ -44,8 +43,8 @@ module.exports = (opts) => { .then(getCompactLayout) .then(doCacheCompactLayout) .then(getCompactLayoutFieldNames) - .then(getCachedDefaultLayout) - .then(getDefaultLayout) - .then(doCacheDefaultLayout) - .then(getDefaultLayoutFieldNames); -}; \ No newline at end of file + // .then(getCachedDefaultLayout) + // .then(getDefaultLayout) + // .then(doCacheDefaultLayout) + // .then(getDefaultLayoutFieldNames); +}; diff --git a/src/query.js b/src/query.js index b482565..7624044 100644 --- a/src/query.js +++ b/src/query.js @@ -23,7 +23,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ - + import {forceClient} from 'react.force'; import union from 'lodash.union'; import remove from 'lodash.remove'; @@ -99,4 +99,4 @@ module.exports.addListener = (listener) => { }; module.exports.getQueryCount = () => { return queryCount; -}; \ No newline at end of file +};