Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
feat: functioning ability to import data and control state
Browse files Browse the repository at this point in the history
  • Loading branch information
rashley-iqt committed Feb 14, 2019
1 parent 6385fcf commit 46277d7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
27 changes: 15 additions & 12 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Modal from 'react-modal';
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faCheck, faDizzy, faPlusCircle, faMinusCircle, faHome } from "@fortawesome/free-solid-svg-icons";

import { selectDataset, getLastUpdated } from 'domain/dataset';
import { selectDatasets, getLastUpdated } from 'domain/dataset';
import { setHierarchyConfig, showNodes, colorBy, selectControls } from 'domain/controls';
import { getError, clearError } from "domain/error";

Expand All @@ -32,8 +32,6 @@ class App extends Component {
showData: true,
showGrouping: false,
showFiltering: false,
uuid1: uuidv4(),
uuid2: uuidv4(),
}

toggleShowData = () =>{
Expand Down Expand Up @@ -83,7 +81,7 @@ class App extends Component {
}

render() {
const { dataset, darkTheme, error, lastUpdated } = this.props;
const { dataset, darkTheme, error, lastUpdated, uuids } = this.props;
const hasDataset = dataset && dataset.length > 0;

const showData = this.state.showData;
Expand Down Expand Up @@ -114,11 +112,13 @@ class App extends Component {
</div>
<div>
<div className={ classNames({ [style.section]: true, [style.hidden]: !showData }) }>
<DatasetControls uuid={ this.state.uuid1 } datasets={ datasets }/>
</div>
<div className={ classNames({ [style.section]: true, [style.hidden]: !showData }) }>
<DatasetControls uuid={ this.state.uuid2 } datasets={ datasets }/>
<DatasetControls uuid={ uuids[0] } datasets={ datasets }/>
</div>
{ uuids.length > 1 &&
<div className={ classNames({ [style.section]: true, [style.hidden]: !showData }) }>
<DatasetControls uuid={ uuids[1] } datasets={ datasets }/>
</div>
}
</div>

{ hasDataset &&
Expand Down Expand Up @@ -170,7 +170,7 @@ class App extends Component {
}

<div className={ style.canvas }>
<Visualization startUid={this.state.uuid1} endUid={this.state.uuid2} />
<Visualization startUid={uuids[0]} endUid={uuids[1] || null} />
</div>
<Modal isOpen={ error !== null } onRequestClose={this.onErrorClose} contentLabel="An Error has occurred">
<div className={ style.modal }>
Expand Down Expand Up @@ -199,12 +199,15 @@ class App extends Component {
}

const mapStateToProps = state => {
const owner = Object.keys(state.dataset.datasets)[0] || ""
const datasets = selectDatasets(state);
const uuids = Object.keys(datasets) || [uuidv4()];
const dataset = datasets[uuids[0]] && datasets[uuids[0]].dataset ? datasets[uuids[0]].dataset : [];
return {
dataset: selectDataset(state, owner),
dataset: dataset,
darkTheme: selectControls(state).darkTheme,
error: getError(state),
lastUpdated: getLastUpdated(state, owner),
lastUpdated: getLastUpdated(state, uuids[0]),
uuids: uuids
}
}

Expand Down
1 change: 0 additions & 1 deletion src/epics/load-dataset-epic.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ const formatPayload = (data) => {
const owner = data.owner;
const content = data.content;
const datasets = content.datasets;
console.log(datasets);
const keyFields = content.keyFields || [];
const ignoredFields = content.ignoredFields || [];
const controls = content.controls || {};
Expand Down
2 changes: 0 additions & 2 deletions src/features/dataset-controls/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ const sanitizeForExport = (datasets) =>{
delete item.CRVIZ;
});
});
console.log("dataset without CRVIZ: %o", result);
console.log("dataset with CRVIZ: %o", datasets);
return result;
}

Expand Down

0 comments on commit 46277d7

Please sign in to comment.