Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard Entity Page load issue fix #49

Merged
merged 1 commit into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions assets/js/Ioda/components/modal/RawSignalsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@ class RawSignalsModal extends PureComponent {
data={this.props.regionalSignalsTableSummaryDataProcessed}
totalCount={this.props.regionalSignalsTableSummaryDataProcessed.length}
toggleEntityVisibilityInHtsViz={event => this.props.toggleEntityVisibilityInHtsViz(event, "region")}
handleEntityClick={(entityType, entityCode) => this.props.handleEntityClick(entityType, entityCode)}
handleCheckboxEventLoading={(item) => this.props.handleCheckboxEventLoading(item)}
/>
: <Loading/>
Expand All @@ -423,7 +422,6 @@ class RawSignalsModal extends PureComponent {
totalCount={this.props.asnSignalsTableTotalCount}
entityType={this.props.entityType === "asn" ? "country" : "asn"}
toggleEntityVisibilityInHtsViz={event => this.props.toggleEntityVisibilityInHtsViz(event, "asn")}
handleEntityClick={(entityType, entityCode) => this.props.handleEntityClick(entityType, entityCode)}
handleCheckboxEventLoading={(item) => this.props.handleCheckboxEventLoading(item)}
/> : <Loading/>
}
Expand Down
9 changes: 2 additions & 7 deletions assets/js/Ioda/data/ActionEntities.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,9 @@ const buildEntityMetadataConfig = (entityType, entityCode) => {
}
};

export const getEntityMetadata = (dispatch, entityType, entityCode) => {
export const getEntityMetadata = ( entityType, entityCode) => {
let config = buildEntityMetadataConfig(entityType, entityCode);
fetchData(config).then(data => {
dispatch({
type: ENTITY_METADATA,
payload: data.data.data,
})
});
return fetchData(config).then(data => data.data.data);
}

const summaryDataForSignalsTableConfig = (entityType, relatedToEntityType, relatedToEntityCode) => {
Expand Down
12 changes: 5 additions & 7 deletions assets/js/Ioda/data/ActionTopo.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ PUBLIC ACTION FUNCTIONS
* @param dispatch
* @param entityType
*/
export const getTopoAction = (dispatch, entityType) => {
export const getTopoAction = (entityType) => {
let config = buildTopoConfig(entityType);
fetchData(config).then(data => {
dispatch({
type: GET_TOPO_DATA,
subtype: entityType,
payload: data.data.data,
})
return fetchData(config).then(data => {
return {
[entityType]: data.data.data
}
});
}

25 changes: 8 additions & 17 deletions assets/js/Ioda/pages/dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,19 +229,6 @@ class Dashboard extends Component {
})
}

// After API call for topographic data completes, update topoData state with fresh data
if (this.props.topoData !== prevProps.topoData) {
let topoObjects;
if (this.state.activeTabType === country.type) {
topoObjects = topojson.feature(this.props.topoData.country.topology, this.props.topoData.country.topology.objects["ne_10m_admin_0.countries.v3.1.0"]);
} else if (this.state.activeTabType === region.type) {
topoObjects = topojson.feature(this.props.topoData.region.topology, this.props.topoData.region.topology.objects["ne_10m_admin_1.regions.v3.0.0"]);
}

this.setState({
topoData: topoObjects
}, this.getMapScores);
}

// Make API call for data to populate time series stacked horizon view
if (this.props.eventSignals !== prevProps.eventSignals) {
Expand Down Expand Up @@ -391,8 +378,15 @@ class Dashboard extends Component {
}
// Make API call to retrieve topographic data
getDataTopo(entityType) {
let topologyObjectName = entityType == "country" ? "ne_10m_admin_0.countries.v3.1.0" : "ne_10m_admin_1.regions.v3.0.0"
if (this.state.mounted) {
this.props.getTopoAction(entityType);
getTopoAction(entityType)
.then(data => topojson.feature(data[entityType].topology, data[entityType].topology.objects[topologyObjectName]))
.then(data =>
this.setState({
topoData : data
},this.getMapScores)
)
}
}
// function to manage when a user clicks a country in the map
Expand Down Expand Up @@ -594,9 +588,6 @@ const mapDispatchToProps = (dispatch) => {
totalOutagesAction: (from, until, entityType) => {
totalOutages(dispatch, from, until, entityType);
},
getTopoAction: (entityType) => {
getTopoAction(dispatch, entityType);
},
getSignalsAction: (entityType, entityCode, from, until, datasource=null, maxPoints=null) => {
getSignalsAction(dispatch, entityType, entityCode, from, until, datasource, maxPoints);
},
Expand Down
Loading