mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-13 05:48:36 +03:00
No associated events for a filter => alert shows when attempting to narrativise
This commit is contained in:
@@ -104,7 +104,6 @@ class Dashboard extends React.Component {
|
|||||||
delete std.sources
|
delete std.sources
|
||||||
Object.values(std).forEach(ev => matchedEvents.push(ev))
|
Object.values(std).forEach(ev => matchedEvents.push(ev))
|
||||||
}
|
}
|
||||||
|
|
||||||
this.props.actions.updateSelected(matchedEvents)
|
this.props.actions.updateSelected(matchedEvents)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,8 +119,8 @@ class Dashboard extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setNarrative (narrative) {
|
setNarrative (narrative) {
|
||||||
// only handleSelect if narrative is not null
|
// only handleSelect if narrative is not null and has associated events
|
||||||
if (narrative) {
|
if (narrative && narrative.steps.length >= 1) {
|
||||||
this.handleSelect([ narrative.steps[0] ])
|
this.handleSelect([ narrative.steps[0] ])
|
||||||
}
|
}
|
||||||
this.props.actions.updateNarrative(narrative)
|
this.props.actions.updateNarrative(narrative)
|
||||||
@@ -150,6 +149,11 @@ class Dashboard extends React.Component {
|
|||||||
if (hasOne) return true
|
if (hasOne) return true
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (evs.length === 0) {
|
||||||
|
alert('No associated events, cant narrativise')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const name = activeFilters.map(f => f.name).join('-')
|
const name = activeFilters.map(f => f.name).join('-')
|
||||||
const desc = activeFilters.map(f => f.description).join('\n\n')
|
const desc = activeFilters.map(f => f.description).join('\n\n')
|
||||||
@@ -247,7 +251,7 @@ class Dashboard extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div >
|
<div >
|
||||||
<Toolbar
|
<Toolbar
|
||||||
|
|||||||
@@ -83,12 +83,6 @@ export function validateDomain (domain, features) {
|
|||||||
|
|
||||||
function validateArray (items, domainKey, schema) {
|
function validateArray (items, domainKey, schema) {
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
// NB: backwards compatibility with 'tags' for 'filters'
|
|
||||||
// if (domainKey === 'events') {
|
|
||||||
// if (!item.filters && !!item.tags) {
|
|
||||||
// item.filters = item.tags
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
validateArrayItem(item, domainKey, schema)
|
validateArrayItem(item, domainKey, schema)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user