Skip to content

Commit

Permalink
add tree type indication when applying rule
Browse files Browse the repository at this point in the history
  • Loading branch information
khansadaoudi committed Oct 17, 2024
1 parent a605faa commit 79ed5c8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/components/grewSearch/GrewRequestCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ export default defineComponent({
},
data() {
const currentQueryType: 'SEARCH' | 'REWRITE' = grewTemplates.searchQueries[0].type as 'SEARCH' | 'REWRITE';
const data: { selectedSamples: string[]; treeType: string; otherUser: string } = { selectedSamples: [], treeType: 'recent', otherUser: '' };
const data: { selectedSamples: string[]; treeType: string; otherUser: string; treeTypeLabel: string }
= { selectedSamples: [], treeType: 'recent', otherUser: '', treeTypeLabel: this.$t('grewSearch.recentTree') };
return {
searchReplaceTab: grewTemplates.searchQueries[0].type,
searchQueryTab: grewTemplates.searchQueries[0].type,
Expand Down Expand Up @@ -152,11 +153,11 @@ export default defineComponent({
this.data = val;
},
onSearch() {
this.parentOnSearch(this.currentQuery.normalize('NFC'), this.data.treeType, this.data.otherUser, this.data.selectedSamples);
this.parentOnSearch(this.currentQuery.normalize('NFC'), this.data.treeType, this.data.treeTypeLabel, this.data.otherUser, this.data.selectedSamples);
this.changeLastGrewQuery({ text: this.currentQuery.normalize('NFC'), type: this.currentQueryType, userType: this.data.treeType });
},
tryRules() {
this.parentOnTryRules(this.currentQuery.normalize('NFC'), this.data.treeType, this.data.otherUser, this.data.selectedSamples);
this.parentOnTryRules(this.currentQuery.normalize('NFC'), this.data.treeType, this.data.treeTypeLabel, this.data.otherUser, this.data.selectedSamples);
this.changeLastGrewQuery({ text: this.currentQuery.normalize('NFC'), type: this.currentQueryType, userType: this.data.treeType });
},
changeQuery(query: string, type: 'SEARCH' | 'REWRITE') {
Expand Down
10 changes: 8 additions & 2 deletions src/components/grewSearch/GrewSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:query-type="queryType"
:query="query"
:userType="userType"
:treeLabel="treeLabel"
@reload-results="reloadResults"
@closed="closeDialog"
/>
Expand Down Expand Up @@ -49,12 +50,14 @@ export default defineComponent({
queryType: string;
query: string;
userType: string;
treeLabel: string;
} = {
resultSearchDialog: false,
resultSearch: {},
queryType: '',
query: '',
userType: '',
treeLabel: '',
};
return result;
},
Expand All @@ -63,10 +66,12 @@ export default defineComponent({
},
methods: {
...mapActions(useGrewHistoryStore, ['saveHistory']),
onSearch(searchPattern: string, treeType: string, otherUser: string, selectedSamples: string[]) {
onSearch(searchPattern: string, treeType: string, treeLabel: string, otherUser: string, selectedSamples: string[]) {
const data = { pattern: searchPattern, userType: treeType, sampleIds: selectedSamples, otherUser: otherUser };
this.queryType = 'SEARCH';
this.userType = treeType;
this.treeLabel = treeLabel;
console.log(this.treeLabel)
api
.searchRequest(this.name, data)
.then((response) => {
Expand All @@ -78,11 +83,12 @@ export default defineComponent({
notifyError({ error });
});
},
onTryRules(query: string, userType: string, otherUser: string, selectedSamples: string[]) {
onTryRules(query: string, userType: string, treeLabel: string, otherUser: string, selectedSamples: string[]) {
const data = { query: query, userType: userType, sampleIds: selectedSamples, otherUser: otherUser };
this.queryType = 'REWRITE';
this.query = query;
this.userType = userType;
this.treeLabel = treeLabel;
api
.tryPackage(this.name, data)
.then((response) => {
Expand Down
7 changes: 7 additions & 0 deletions src/components/grewSearch/ResultView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
<q-tooltip v-if="!atLeastOneSelected">{{ $t('grewSearch.applyRuleTooltip') }}</q-tooltip>
</q-btn>
</div>
<div>
{{ treeLabel }}
</div>
</q-bar>
</div>
</template>
Expand Down Expand Up @@ -121,6 +124,10 @@ export default defineComponent({
type: String as PropType<string>,
required: false,
},
treeLabel: {
type: String as PropType<string>,
required: false,
}
},
data() {
Expand Down
1 change: 1 addition & 0 deletions src/components/shared/TreesTypeSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export default defineComponent({
const data = {
selectedSamples: this.selectedSamples.map((sample) => sample.sampleName),
treeType: this.treeType.value,
treeTypeLabel: this.treeType.label,
otherUser: this.otherUser,
};
this.$emit('selected-value', data);
Expand Down

0 comments on commit 79ed5c8

Please sign in to comment.