Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Commit

Permalink
Add bare-bones implementation of facts page
Browse files Browse the repository at this point in the history
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
c-w committed Oct 17, 2017
1 parent 3b3abdf commit 259b367
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 268 deletions.
62 changes: 7 additions & 55 deletions src/actions/Facts/index.js
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}
};
Loading

0 comments on commit 259b367

Please sign in to comment.