Skip to content

Commit 2143a49

Browse files
committed
fix(store): Use SIMPUT_ prefix for store entry that should be public
1 parent ae3f0e9 commit 2143a49

File tree

16 files changed

+58
-51
lines changed

16 files changed

+58
-51
lines changed

src/app.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Vue.use(Vuetify);
2626
export const { applyHook, registerHook } = HookManager;
2727

2828
export function registerWidget(name, component) {
29-
Store.commit(Mutations.ADD_PROPERTY_MAPPING, { name, component });
29+
Store.commit(Mutations.SIMPUT_ADD_PROPERTY_MAPPING, { name, component });
3030
}
3131

3232
export function registerType(type, urls) {
@@ -86,16 +86,17 @@ export function createViewer() {
8686
type: dataset.type,
8787
data: dataset.data,
8888
});
89-
return Store.dispatch(Actions.LOAD_TEMPLATE, dataset.type);
89+
return Store.dispatch(Actions.SIMPUT_LOAD_TEMPLATE, dataset.type);
9090
}
9191
return Promise.reject(new Error('No model found in download'));
9292
});
93-
} else if (type) {
93+
}
94+
if (type) {
9495
Store.commit(Mutations.SET_MODEL, {
9596
type,
9697
data: {},
9798
});
98-
return Store.dispatch(Actions.LOAD_TEMPLATE, type);
99+
return Store.dispatch(Actions.SIMPUT_LOAD_TEMPLATE, type);
99100
}
100101
return Promise.resolve();
101102
},

src/components/core/ControlsDrawer/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
},
1515
computed: Object.assign(
1616
mapGetters({
17-
dataModel: Getters.MODEL,
17+
dataModel: Getters.SIMPUT_MODEL,
1818
})
1919
),
2020
data() {

src/components/core/Landing/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default {
1818
window.open(sample.goTo, '_blank');
1919
} else {
2020
this.$store.commit(Mutations.SET_MODEL, sample.model);
21-
this.$store.dispatch(Actions.LOAD_TEMPLATE, sample.model.type);
21+
this.$store.dispatch(Actions.SIMPUT_LOAD_TEMPLATE, sample.model.type);
2222
}
2323
},
2424
},
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
import { mapState } from 'vuex';
1+
import { mapGetters } from 'vuex';
22

33
// ---------------------------------------------------------------------------
44

55
export default {
66
name: 'PropertyFactory',
77
props: ['prop', 'viewData'],
8-
computed: mapState({
9-
component(state) {
10-
return state.properties.mapping[this.prop.ui.propType.toLowerCase()];
8+
computed: {
9+
...mapGetters({
10+
getComponent: 'SIMPUT_COMPONENT_GET',
11+
}),
12+
component() {
13+
return this.getComponent(this.prop.ui.propType);
1114
},
12-
}),
15+
},
1316
};

src/components/core/PropertyPanel/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default {
2525
return (property.show || alwaysShow)(this.viewData) ? 'block' : 'none';
2626
},
2727
updateViewData(newData) {
28-
this.$store.state.templates.dataManager.updateViewData(newData);
28+
this.$store.getters.SIMPUT_DATAMANAGER.updateViewData(newData);
2929
},
3030
},
3131
};
Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { mapState } from 'vuex';
1+
import { mapGetters } from 'vuex';
22

33
import PropertyPanel from 'simput/src/components/core/PropertyPanel';
44

@@ -9,23 +9,21 @@ export default {
99
components: {
1010
PropertyPanel,
1111
},
12-
computed: Object.assign(
13-
{
14-
panelData() {
15-
if (this.dataManager) {
16-
return this.dataManager.getPropertyList();
17-
}
18-
return [];
19-
},
20-
viewData() {
21-
if (this.dataManager) {
22-
return this.dataManager.getActiveViewData();
23-
}
24-
return {};
25-
},
12+
computed: {
13+
...mapGetters({
14+
dataManager: 'SIMPUT_DATAMANAGER',
15+
}),
16+
panelData() {
17+
if (this.dataManager) {
18+
return this.dataManager.getPropertyList();
19+
}
20+
return [];
2621
},
27-
mapState({
28-
dataManager: (state) => state.templates.dataManager,
29-
})
30-
),
22+
viewData() {
23+
if (this.dataManager) {
24+
return this.dataManager.getActiveViewData();
25+
}
26+
return {};
27+
},
28+
},
3129
};

src/components/core/WorkflowMenu/script.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ import { Getters } from 'simput/src/stores/types';
66
export default {
77
name: 'WorkflowMenu',
88
computed: mapGetters({
9-
dataModel: Getters.DATAMANAGER,
9+
dataModel: 'SIMPUT_DATAMANAGER',
10+
getListComponentByName: 'SIMPUT_COMPONENT_GET',
1011
}),
1112
methods: {
1213
viewHasChildren(viewId) {
1314
const viewItem = this.dataModel.model.views[viewId];
1415
return 'size' in viewItem || 'children' in viewItem;
1516
},
16-
getListComponentByName(name) {
17-
return this.$store.state.properties.mapping[name.toLowerCase()];
18-
},
1917
},
2018
};

src/components/properties/CellProperty/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export default {
101101
},
102102
beforeMount() {
103103
const update = () => this.$nextTick(this.$forceUpdate);
104-
this.unsubscribe = this.$store.state.templates.dataManager.subscribe(
104+
this.unsubscribe = this.$store.getters.SIMPUT_DATAMANAGER.subscribe(
105105
update
106106
).unsubscribe;
107107
},

src/components/properties/CheckboxProperty/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default {
2929
},
3030
beforeMount() {
3131
const update = () => this.$nextTick(this.$forceUpdate);
32-
this.unsubscribe = this.$store.state.templates.dataManager.subscribe(
32+
this.unsubscribe = this.$store.getters.SIMPUT_DATAMANAGER.subscribe(
3333
update
3434
).unsubscribe;
3535
},

src/components/properties/ColorProperty/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default {
6060
},
6161
beforeMount() {
6262
const update = () => this.$nextTick(this.$forceUpdate);
63-
this.unsubscribe = this.$store.state.templates.dataManager.subscribe(
63+
this.unsubscribe = this.$store.getters.SIMPUT_DATAMANAGER.subscribe(
6464
update
6565
).unsubscribe;
6666
},

0 commit comments

Comments
 (0)