This repository has been archived by the owner on Mar 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bare-bones implementation of facts page
For now this is just rendering a pinterest-style board of events for all pipelines, in reverse chronological order. We can add more features (like filtering) once we're more stabilized and have a clearer understanding of the requirements of the facts page as compared to the newsfeed component.
- Loading branch information
Showing
6 changed files
with
140 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,12 @@ | ||
/*import { SERVICES } from '../../services/Admin'; | ||
import parallelAsync from 'async/parallel'; | ||
import constants from '../constants'; | ||
import { momentLastMonths } from '../../utils/Utils.js'; | ||
import { SERVICES } from '../../services/Facts'; | ||
import { ResponseHandler } from '../shared'; | ||
|
||
const methods = { | ||
load_facts(siteKey, limit, offset, filteredEdges = [], dataSources = [], fromDate="", toDate="", fulltextTerm="", langCode="en") { | ||
let self = this; | ||
let originalSource; | ||
if (dataSources.length === 0) dataSources = ["tadaweb"]; | ||
let sourceProperties = ["title", "link", "originalSources"]; | ||
if (!fromDate || !toDate) { | ||
let range = momentLastMonths(3); | ||
fromDate = range.fromDate; | ||
toDate = range.toDate; | ||
} | ||
SERVICES.FetchMessages(siteKey, originalSource, filteredEdges, langCode, limit, offset, fromDate, toDate, dataSources, fulltextTerm, sourceProperties, (err, reqRsp, body) => ResponseHandler(err, reqRsp, body, (error, response) => { | ||
if (response && !error) { | ||
self.dispatch(constants.FACTS.LOAD_FACTS_SUCCESS, { response }); | ||
} else { | ||
console.warn('Error, could not load facts', error); | ||
self.dispatch(constants.FACTS.LOAD_FACTS_FAIL, { error }); | ||
} | ||
})); | ||
}, | ||
load_tags(siteKey, sourceFilter=[], fromDate="", toDate="", query=""){ | ||
let self = this; | ||
SERVICES.FetchTerms(siteKey, query, fromDate, toDate, sourceFilter, (err, response, body) => ResponseHandler(err, response, body, (error, response) => { | ||
if (response && !error) { | ||
self.dispatch(constants.FACTS.LOAD_TAGS, response); | ||
} else { | ||
console.error(`[${error}] occured while processing tag request`); | ||
} | ||
})); | ||
}, | ||
load_settings(siteName){ | ||
let self = this; | ||
SERVICES.getSiteDefintion(siteName, (err, response, body) => ResponseHandler(err, response, body, (error, graphqlResponse) => { | ||
console.log(constants.FACTS.INITIALIZE); | ||
if (graphqlResponse && !error) { | ||
self.dispatch(constants.FACTS.INITIALIZE, graphqlResponse.siteDefinition.sites[0]); | ||
}else{ | ||
console.error(`[${error}] occured while processing message request`); | ||
} | ||
})); | ||
}, | ||
save_page_state(pageState) { | ||
this.dispatch(constants.FACTS.SAVE_PAGE_STATE, pageState); | ||
}, | ||
changeLanguage(language){ | ||
this.dispatch(constants.FACTS.CHANGE_LANGUAGE, language); | ||
} | ||
loadFacts(pipelinekeys, callback) { | ||
SERVICES.loadFacts(pipelinekeys, (error, response, body) => ResponseHandler(error, response, body, callback)); | ||
}, | ||
}; | ||
|
||
module.exports = { | ||
constants: constants, | ||
methods: {FACTS: methods} | ||
}; | ||
*/ | ||
methods: {FACTS: methods} | ||
}; |
Oops, something went wrong.