Skip to content

Commit

Permalink
chore: replace storydisplay with stacinfo element
Browse files Browse the repository at this point in the history
  • Loading branch information
silvester-pari committed Oct 24, 2023
1 parent 2d52108 commit 0f71c16
Show file tree
Hide file tree
Showing 11 changed files with 344 additions and 96 deletions.
332 changes: 295 additions & 37 deletions app/package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@chenfengyuan/vue-countdown": "^1.1.5",
"@eox/itemfilter": "^0.8.6",
"@eox/layercontrol": "^0.7.1",
"@eox/stacinfo": "^0.2.0",
"@turf/difference": "^6.5.0",
"axios": "^0.21.1",
"chart.js": "2.9.3",
Expand Down
66 changes: 33 additions & 33 deletions app/src/components/DataPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -652,49 +652,49 @@ export default {
selectedArea(area) {
this.showRegenerateButton = this.customAreaIndicator && !!area;
},
indicatorObject:{
immediate:true,
deep:true,
handler(indicatorObj){
console.log('indicatorObject watcher triggered');
// If markdown is coming from stac collection show it direclty
// console.log('changed');
if (indicatorObj && 'markdown' in indicatorObj) {
this.$store.commit('story/SET_STORY', indicatorObj.markdown);
indicatorObject: {
immediate: true,
deep: true,
handler(indicatorObj) {
console.log('indicatorObject watcher triggered');
// If markdown is coming from stac collection show it direclty
// console.log('changed');
if (indicatorObj && 'markdown' in indicatorObj) {
// this.$store.commit('story/SET_STORY', indicatorObj.markdown);
// return this.$marked(indicatorObj.markdown);
}
// If not do previous checks to see if other option can be found
let markdown = '';
let indObject = indicatorObj;
if (this.featureObject) {
indObject = this.featureObject;
}
try {
const demoItem = this.$route.name === 'demo'
? this.appConfig.demoMode[this.$route.query.event]
.find((item) => item.poi === this.getLocationCode(indObject)) : false;
markdown = require(`../../public${demoItem.story}.md`);
} catch {
}
// If not do previous checks to see if other option can be found
let markdown = '';
let indObject = indicatorObj;
if (this.featureObject) {
indObject = this.featureObject;
}
try {
markdown = require(`../../public${this.appConfig.storyPath}${this.getLocationCode(indObject)}.md`);
const demoItem = this.$route.name === 'demo'
? this.appConfig.demoMode[this.$route.query.event]
.find((item) => item.poi === this.getLocationCode(indObject)) : false;
markdown = require(`../../public${demoItem.story}.md`);
} catch {
try {
markdown = require(`../../public${this.baseConfig.indicatorsDefinition[indicatorObj.indicator].story}.md`);
markdown = require(`../../public${this.appConfig.storyPath}${this.getLocationCode(indObject)}.md`);
} catch {
try {
const indicator = Array.isArray(this.$store.state.features.featureFilters.indicators)
? this.$store.state.features.featureFilters.indicators[0]
: this.$store.state.features.featureFilters.indicators;
markdown = require(`../../public${this.baseConfig.indicatorsDefinition[indicator].story}.md`);
markdown = require(`../../public${this.baseConfig.indicatorsDefinition[indicatorObj.indicator].story}.md`);
} catch {
markdown = { default: '' };
try {
const indicator = Array.isArray(this.$store.state.features.featureFilters.indicators)
? this.$store.state.features.featureFilters.indicators[0]
: this.$store.state.features.featureFilters.indicators;
markdown = require(`../../public${this.baseConfig.indicatorsDefinition[indicator].story}.md`);
} catch {
markdown = { default: '' };
}
}
}
}
}
this.$store.commit('story/SET_STORY', markdown.default);
}
}
// this.$store.commit('story/SET_STORY', markdown.default);
},
},
},
};
</script>
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/map/StyleControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default {
} catch {
markdown = { default: '' };
}
this.$store.commit('story/SET_STORY', markdown.default);
// this.$store.commit('story/SET_STORY', markdown.default);
},
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/map/VectorTileStyleControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default {
} catch {
markdown = { default: '' };
}
this.$store.commit('story/SET_STORY', markdown.default);
// this.$store.commit('story/SET_STORY', markdown.default);
},
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/map/WmsStyleControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default {
} catch {
markdown = { default: '' };
}
this.$store.commit('story/SET_STORY', markdown.default);
// this.$store.commit('story/SET_STORY', markdown.default);
},
},
methods: {
Expand Down
2 changes: 2 additions & 0 deletions app/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import getLocationCode from './mixins/getLocationCode';

import '@eox/itemfilter';
import '@eox/layercontrol';
import '@eox/stacinfo';

// Set UTC as default time zone behavior for whole client
Settings.defaultZoneName = 'utc';
Expand All @@ -40,6 +41,7 @@ Vue.config.productionTip = false;
Vue.config.ignoredElements = [
'eox-itemfilter',
'eox-layercontrol',
'eox-stacinfo',
];

Vue.use(VuePapaParse);
Expand Down
2 changes: 0 additions & 2 deletions app/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import features from './modules/features';
import indicators from './modules/indicators';
import themes from './modules/themes';
import gtif from './modules/gtif';
import story from './modules/story';

const vuexLocal = new VuexPersistence({
storage: localStorage,
Expand All @@ -32,7 +31,6 @@ const store = new Vuex.Store({
indicators,
themes,
gtif,
story,
},
state: {
packageVersion: process.env.PACKAGE_VERSION || '0',
Expand Down
18 changes: 0 additions & 18 deletions app/src/store/modules/story.js

This file was deleted.

12 changes: 9 additions & 3 deletions app/src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,15 @@
@panel-selected="function(id){ handleSelection(id) }"
:activeID="activePanel" :title="panel.title"
>
<StoryDisplay v-if="panel.title == 'Information'" />
<eox-stacinfo
v-if="panel.title == 'Information' && indicatorSelected"
:for="$store.state.indicators.selectedIndicator.link"
header='[]'
subheader='[]'
properties='["description"]'
featured='[]'
footer='[]'
></eox-stacinfo>
<DataPanel
v-if="panel.title === 'Analysis' && indicatorObject
|| $store.state.features.featureFilters.indicators.length > 0"
Expand Down Expand Up @@ -217,7 +225,6 @@ import { getMapInstance } from '@/components/map/map';
import closeMixin from '@/mixins/close';
import dialogMixin from '@/mixins/dialogMixin';
import { mapState, mapGetters } from 'vuex';
import StoryDisplay from '../components/StoryDisplay.vue';
import NarrativesToolsPanel from '../components/NarrativesToolsPanel.vue';
export default {
Expand All @@ -243,7 +250,6 @@ export default {
// ESABreadcrumbs,
UiPanel,
UiPanelsLayout,
StoryDisplay,
NarrativesToolsPanel,
},
props: {
Expand Down
1 change: 1 addition & 0 deletions app/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ module.exports = {
'ol',
'@eox/itemfilter',
'@eox/layercontrol',
'@eox/stacinfo',
'ol-mapbox-style',
],
configureWebpack: {
Expand Down

0 comments on commit 0f71c16

Please sign in to comment.