Skip to content

Commit

Permalink
fix(reflect): fix xls export feature
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasRichel committed Feb 16, 2024
1 parent b4876ac commit cfbbb28
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/plugins/reflect/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/plugins/reflect/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "viewer-plugin-reflect",
"version": "0.0.1",
"version": "0.1.0",
"description": "Reflect BIMData Viewer Plugin",
"scripts": {
"build": "rollup -c --environment BUILD:production",
Expand Down
27 changes: 18 additions & 9 deletions src/plugins/reflect/src/ReflectDashboard/ReflectDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</div>

<div class="reflect-dashboard__body__results">
<ReflectValidationTable :rows="validationData" />
<ReflectValidationTable :rows="resultDataValidation" />
</div>
</div>

Expand Down Expand Up @@ -105,7 +105,9 @@ export default {
reflectElementUuids: null,
reflectElementUuidsNotValid: null,
validationData: [],
resultDataRows: [],
resultDataColumns: [],
resultDataValidation: [],
};
},
created() {
Expand Down Expand Up @@ -188,8 +190,13 @@ export default {
});
}
this.validationData = runResults
.reduce((acc, rule) => acc.concat(rule.validation_generale), []);
this.resultDataRows =
runResults.reduce((acc, rule) => acc.concat(rule.result), []);
this.resultDataColumns =
Object.keys(this.resultDataRows.reduce((obj, x) => ({ ...obj, ...x }), {}))
.map(x => ({ id: x, label: x }));
this.resultDataValidation =
runResults.reduce((acc, rule) => acc.concat(rule.validation_generale), []);
const uuids = [...this.$viewer.state.models[0].uuids.keys()];
this.$viewer.state.hideObjectsByUuids( diff(uuids, this.reflectElementUuids) );
Expand Down Expand Up @@ -243,7 +250,9 @@ export default {
async reset() {
this.loading = true;
this.validationData = [];
this.resultDataRows = [];
this.resultDataColumns = [];
this.resultDataValidation = [];
const uuids = [...this.$viewer.state.models[0].uuids.keys()];
this.$viewer.state.showObjectsByUuids(uuids);
Expand All @@ -266,12 +275,12 @@ export default {
},
async exportDataToXLS() {
if (this.validationData.length > 0) {
if (this.resultDataValidation.length > 0) {
this.loading = true;
await generateAndDownloadXLS(
[],
[],
this.validationData,
this.resultDataColumns,
this.resultDataRows,
this.resultDataValidation,
REFLECT_XLS_FILENAME
);
this.loading = false;
Expand Down

0 comments on commit cfbbb28

Please sign in to comment.