Skip to content

Commit

Permalink
Merge pull request #348 from Progress1/empty_type_bug
Browse files Browse the repository at this point in the history
Fixed bugs in Product and Report screens (endless status, errors mesages)
  • Loading branch information
Progress1 authored Aug 21, 2024
2 parents 5b2624d + 7510072 commit 1001146
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 29 deletions.
22 changes: 15 additions & 7 deletions src/gui/src/components/analyze/NewReportItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,14 @@
<span class="caption grey--text">ID: {{ report_item.uuid }}</span>
</v-col>
<v-col cols="4" class="pr-3">
<v-combobox v-on:change="reportSelected" :disabled="edit"
<v-combobox v-on:change="reportSelected"
:disabled="edit"
v-model="selected_type"
:items="report_types"
item-text="title"
:label="$t('report_item.report_type')"
name="report_type"
v-validate="'required'"
/>
</v-col>
<v-col cols="4" class="pr-3">
Expand Down Expand Up @@ -356,7 +359,7 @@ export default {
this.report_item.title = "";
this.report_item.title_prefix = "";
this.report_item.completed = false;
this.$validator.reset();
this.resetValidation();
},
reportSelected() {
Expand Down Expand Up @@ -389,7 +392,7 @@ export default {
setTimeout(() => {
//this.$root.$emit('mouse-click-close');
this.$root.$emit('change-state', 'DEFAULT');
this.$validator.reset();
this.resetValidation();
this.visible = false;
this.$root.$emit('first-dialog', '');
}, 150);
Expand Down Expand Up @@ -487,6 +490,11 @@ export default {
})
},
resetValidation() {
this.$validator.reset();
this.show_validation_error = false;
},
getLockedStyle(field_id) {
return this.field_locks[field_id] === true ? 'locked-style' : ''
},
Expand Down Expand Up @@ -818,6 +826,7 @@ export default {
},
},
mixins: [AuthMixin],
mounted() {
this.$root.$on('attachments-uploaded', () => {
this.attachmets_attributes_count--
Expand All @@ -836,10 +845,9 @@ export default {
this.local_reports = !window.location.pathname.includes('/group/');
this.$store.dispatch('getAllReportItemTypes', {search: ''})
.then(() => {
this.report_types = this.$store.getters.getReportItemTypes.items;
});
this.$store.dispatch('getAllReportItemTypes', {search: ''}).then(() => {
this.report_types = this.$store.getters.getReportItemTypes.items;
});
this.$root.$on('new-report', (data) => {
this.visible = true;
Expand Down
51 changes: 29 additions & 22 deletions src/gui/src/components/publish/NewProduct.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@
<v-form @submit.prevent="add" id="form" ref="form" class="px-4">
<v-row no-gutters>
<v-col cols="6" class="pr-3">
<v-combobox v-on:change="productSelected" :disabled="!canModify"
<v-combobox v-on:change="productSelected"
:disabled="!canModify"
v-model="selected_type"
:items="product_types"
item-text="title"
:label="$t('product.report_type')" />
:label="$t('product.report_type')"
name="report_type"
v-validate="'required'"
/>
</v-col>
<v-col cols="6" class="pr-3">
<v-text-field :disabled="!canModify"
Expand Down Expand Up @@ -173,7 +177,7 @@
this.product.description = ""
this.product.product_type_id = null
this.product.report_items = []
this.$validator.reset();
this.resetValidation();
},
publishConfirmation() {
Expand Down Expand Up @@ -205,13 +209,13 @@
if (this.product.id !== -1) {
updateProduct(this.product).then(() => {
this.$validator.reset();
this.resetValidation();
publishProduct(this.product.id, this.publisher_presets[i].id)
})
} else {
createProduct(this.product).then((response) => {
this.$validator.reset();
this.resetValidation();
this.product.id = response.data
publishProduct(this.product.id, this.publisher_presets[i].id)
})
Expand All @@ -231,7 +235,7 @@
},
cancel() {
this.$validator.reset();
this.resetValidation();
this.visible = false
},
Expand All @@ -257,15 +261,15 @@
if (this.product.id !== -1) {
updateProduct(this.product).then(() => {
this.$validator.reset();
this.resetValidation();
this.preview_link = ((typeof (process.env.VUE_APP_TARANIS_NG_CORE_API) == "undefined") ? "$VUE_APP_TARANIS_NG_CORE_API" : process.env.VUE_APP_TARANIS_NG_CORE_API) + "/publish/products/" + this.product.id + "/overview?jwt=" + this.$store.getters.getJWT
this.$refs.previewBtn.$el.click()
})
} else {
createProduct(this.product).then((response) => {
this.product.id = response.data
this.$validator.reset();
this.resetValidation();
this.preview_link = ((typeof (process.env.VUE_APP_TARANIS_NG_CORE_API) == "undefined") ? "$VUE_APP_TARANIS_NG_CORE_API" : process.env.VUE_APP_TARANIS_NG_CORE_API) + "/publish/products/" + response.data + "/overview?jwt=" + this.$store.getters.getJWT
this.$refs.previewBtn.$el.click()
})
Expand Down Expand Up @@ -300,7 +304,7 @@
if (this.product.id !== -1) {
updateProduct(this.product).then(() => {
this.$validator.reset();
this.resetValidation();
this.visible = false;
this.$root.$emit('notification',
Expand All @@ -316,7 +320,7 @@
} else {
createProduct(this.product).then(() => {
this.$validator.reset();
this.resetValidation();
this.visible = false;
this.$root.$emit('notification',
Expand All @@ -336,7 +340,12 @@
this.show_validation_error = true;
}
})
}
},
resetValidation() {
this.$validator.reset();
this.show_validation_error = false;
},
},
mounted() {
Expand All @@ -346,18 +355,16 @@
this.report_items = data
});
this.$store.dispatch('getAllUserProductTypes', { search: '' })
.then(() => {
this.product_types = this.$store.getters.getProductTypes.items
});
this.$store.dispatch('getAllUserProductTypes', { search: '' }).then(() => {
this.product_types = this.$store.getters.getProductTypes.items
});
this.$store.dispatch('getAllUserPublishersPresets', { search: '' })
.then(() => {
this.publisher_presets = this.$store.getters.getProductsPublisherPresets.items;
for (let i = 0; i < this.publisher_presets.length; i++) {
this.publisher_presets.selected = false
}
});
this.$store.dispatch('getAllUserPublishersPresets', { search: '' }).then(() => {
this.publisher_presets = this.$store.getters.getProductsPublisherPresets.items;
for (let i = 0; i < this.publisher_presets.length; i++) {
this.publisher_presets.selected = false
}
});
this.$root.$on('show-product-edit', (data) => {
this.visible = true;
Expand Down

0 comments on commit 1001146

Please sign in to comment.