Skip to content

Commit

Permalink
AMP-2826
Browse files Browse the repository at this point in the history
- minor changes

Merge remote-tracking branch 'origin/master' into AMP-2826_itemSearch
  • Loading branch information
yingfeng-iu committed Apr 12, 2024
1 parent 6910c89 commit b1792cf
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 20 deletions.
11 changes: 9 additions & 2 deletions src/components/entity/ItemSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ export default {
},
data() {
return {
workflowResultService: new WorkflowResultService(),
itemService: new ItemService(),
loading: false,
searchType: "",
searchSource: [],
workflowResultService: new WorkflowResultService(),
itemService: new ItemService(),
errors: {
search_error: "",
no_data_error: "",
Expand All @@ -66,12 +66,17 @@ export default {
computed: {},
props: {},
methods: {
// handler for handleSearchItems event emitted by child component (the Search pop-up ialog)
searchItems(searchWord) {
this.refreshData(searchWord);
},
// pop up child component (the Search pop-up ialog)
onSearch() {
this.$bvModal.show("modal-lg");
},
// call item search API
async refreshData(searchWord = "") {
const self = this;
try {
Expand All @@ -98,9 +103,11 @@ export default {
}
},
},
updated() {
this.onSearch();
},
mounted() {
this.onSearch();
},
Expand Down
44 changes: 26 additions & 18 deletions src/components/shared/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -810,14 +810,18 @@ export default {
const self = this;
self.searchFields.rows[0] = self.searchFields.choosenField;
},
// called when search button clicked
async searchItems() {
this.$emit("handleSearchItems", this.searchWord);
},
// called when enter key pressed on keyword textarea
async searchKeyUp(e) {
if (e.keyCode === 13) {
this.searchItems();
}
},
onSelectAllChange(ev) {
const self = this;
if (ev.srcElement.checked) {
Expand All @@ -833,6 +837,8 @@ export default {
console.log("selectedRecords: ", self.selectedRecords);
return;
},
// event handler when selections in the search results list change
onChange(ev, record) {
const self = this;
Expand Down Expand Up @@ -1032,9 +1038,11 @@ export default {
"unitEntity",
JSON.stringify({ ...uEntity })
);
//checking permission
// checking permission
if (uEntity && uEntity.currentUnit)
self.accessControlService.checkAccessControl(self);
self.accessControlService.checkAccessControl(self);
// go to item detail page
self.$router.push("/collections/items/item-search/details");
// this.itemService
// .getItemDetails(this.selectedItemId)
// .then((res) => {
Expand Down Expand Up @@ -1064,22 +1072,22 @@ export default {
// self.selectedItem.parentType = self.type;
// self.selectedItem.unitName = self.selectedUnit.name;
// self.selectedItem.collectionName = self.selectedCollection.name;
self.$router.push("/collections/items/item-search/details");
// })
// .catch((error) => {
// this.dataSource = [];
// this.clonedDataSource = [];
// this.searchWord = "";
// this.selectedItemId = null;
// this.errors.search_error = "";
// this.errors.no_data_error = "";
// this.$bvToast.toast("Failed to show the item", {
// title: "Notification",
// appendToast: true,
// variant: "danger",
// autoHideDelay: 5000,
// });
// });
// self.$router.push("/collections/items/item-search/details");
// })
// .catch((error) => {
// this.dataSource = [];
// this.clonedDataSource = [];
// this.searchWord = "";
// this.selectedItemId = null;
// this.errors.search_error = "";
// this.errors.no_data_error = "";
// this.$bvToast.toast("Failed to show the item", {
// title: "Notification",
// appendToast: true,
// variant: "danger",
// autoHideDelay: 5000,
// });
// });
break;
}
case "workflow-search":
Expand Down

0 comments on commit b1792cf

Please sign in to comment.