Skip to content

Commit

Permalink
Merge pull request #174 from Progress1/bug_rpt_item_view
Browse files Browse the repository at this point in the history
Fix: display report item details on product (previously empty)
  • Loading branch information
milankowww authored Oct 16, 2023
2 parents 41b9bae + be2aa30 commit fb67094
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
21 changes: 13 additions & 8 deletions src/gui/src/components/analyze/NewReportItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

<v-toolbar-title>
<span v-if="!edit">{{ $t('report_item.add_new') }}</span>
<span v-else-if="read_only">{{ $t('report_item.read') }}</span>
<span v-else>{{ $t('report_item.edit') }}</span>
</v-toolbar-title>

Expand Down Expand Up @@ -187,7 +188,7 @@
<v-expansion-panel-content class="pt-0">
<AttributeContainer
:attribute_item="attribute_item" :edit="edit" :modify="modify"
:report_item_id="report_item.id"
:report_item_id="report_item.id" :read_only="read_only"
/>
</v-expansion-panel-content>
</v-expansion-panel>
Expand Down Expand Up @@ -258,7 +259,8 @@ export default {
add_button: Boolean,
analyze_selector: Boolean,
collections: Array,
csv_codes: Array
csv_codes: Array,
read_only: Boolean,
},
components: {NewsItemSelector, AttributeContainer, RemoteReportItemSelector, VueCsvImport},
data: () => ({
Expand Down Expand Up @@ -309,6 +311,9 @@ export default {
dialog(val) {
if (val) { document.getElementsByName('hmtl').style.overflow = 'hidden' }
else { document.getElementsByName('hmtl').style.overflow = 'auto' }
},
$route() {
this.local_reports = !window.location.pathname.includes('/group/');
}
},
computed: {
Expand Down Expand Up @@ -565,7 +570,6 @@ export default {
let data = response.data;
this.visible = true;
this.edit = true;
this.overlay = false
this.show_error = false;
Expand All @@ -586,6 +590,10 @@ export default {
this.report_item.report_item_type_id = data.report_item_type_id;
this.report_item.completed = data.completed;
if (!this.report_types || !this.report_types.length) {
return;
}
for (let i = 0; i < this.report_types.length; i++) {
if (this.report_types[i].id === this.report_item.report_item_type_id) {
this.selected_type = this.report_types[i];
Expand All @@ -600,6 +608,8 @@ export default {
}
}
this.visible = true;
getReportItemLocks(this.report_item.id).then((response) => {
let locks_data = response.data
Expand Down Expand Up @@ -821,11 +831,6 @@ export default {
this.$root.$on('report-item-unlocked', this.report_item_unlocked);
this.$root.$on('report-item-updated', this.report_item_updated);
},
watch: {
$route() {
this.local_reports = !window.location.pathname.includes('/group/');
}
},
beforeDestroy() {
this.$root.$off('attachments-uploaded')
this.$root.$off('new-report')
Expand Down
14 changes: 10 additions & 4 deletions src/gui/src/components/analyze/RemoteReportItemSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,17 @@
})
}
if (this.$store.getters.getCurrentReportItemGroup === null && this.links.length > 0) {
this.selected_group_id = this.links[0].id
this.$store.dispatch("changeCurrentReportItemGroup", this.links[0].id);
// check if .links exist otherwise it will crash with undefined error
if (this.links.length > 0) {
if (this.$store.getters.getCurrentReportItemGroup === null) {
this.selected_group_id = this.links[0].id
this.$store.dispatch("changeCurrentReportItemGroup", this.selected_group_id);
} else {
this.selected_group_id = this.$store.getters.getCurrentReportItemGroup
this.links[0].id = this.selected_group_id
}
} else {
this.selected_group_id = this.links[0].id = this.$store.getters.getCurrentReportItemGroup
this.selected_group_id = this.$store.getters.getCurrentReportItemGroup
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/gui/src/components/publish/ReportItemSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<v-spacer style="height:8px"></v-spacer>

<NewReportItem ref="reportItemDialog"/>
<NewReportItem ref="reportItemDialog" :read_only="true"/>

<component publish_selector class="item-selector" v-bind:is="cardLayout()" v-for="value in values" :card="value"
:key="value.id"
Expand Down
1 change: 1 addition & 0 deletions src/gui/src/i18n/en/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ const messages_en = {
report_item: {
add_new: "New report item",
edit: "Edit report item",
read: "Report item preview",
save: "Save",
cancel: "Cancel",
validation_error: "Please fill in all required fields",
Expand Down

0 comments on commit fb67094

Please sign in to comment.