Skip to content

Commit 127361b

Browse files
authored
Merge pull request #4687 from rtibbles/searching_for_saves_in_all_the_wrong_places
Limit duplicate search creation
2 parents 64aed98 + 9bb8871 commit 127361b

File tree

8 files changed

+72
-182
lines changed

8 files changed

+72
-182
lines changed

contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/EditSearchModal.vue

Lines changed: 0 additions & 107 deletions
This file was deleted.

contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/SavedSearchesModal.vue

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@
3333
</VListTileSubTitle>
3434
</VListTileContent>
3535

36-
<VListTileAction>
37-
<IconButton
38-
icon="edit"
39-
color="grey"
40-
:text="$tr('editAction')"
41-
@click="handleClickEdit(search.id)"
42-
/>
43-
</VListTileAction>
44-
4536
<VListTileAction>
4637
<IconButton
4738
icon="clear"
@@ -70,14 +61,6 @@
7061
</VBtn>
7162
</template>
7263
</MessageDialog>
73-
74-
<EditSearchModal
75-
v-if="searchId"
76-
v-model="showEdit"
77-
:searchId="searchId"
78-
@submit="showEdit = false"
79-
@cancel="showEdit = false"
80-
/>
8164
</div>
8265

8366
</template>
@@ -86,15 +69,13 @@
8669
<script>
8770
8871
import { mapActions, mapGetters } from 'vuex';
89-
import EditSearchModal from './EditSearchModal';
9072
import MessageDialog from 'shared/views/MessageDialog';
9173
import IconButton from 'shared/views/IconButton';
9274
9375
export default {
9476
name: 'SavedSearchesModal',
9577
inject: ['RouteNames'],
9678
components: {
97-
EditSearchModal,
9879
MessageDialog,
9980
IconButton,
10081
},
@@ -108,15 +89,14 @@
10889
return {
10990
loading: true,
11091
showDelete: false,
111-
showEdit: false,
11292
searchId: null,
11393
};
11494
},
11595
computed: {
11696
...mapGetters('importFromChannels', ['savedSearches']),
11797
dialog: {
11898
get() {
119-
return this.value && !this.showDelete && !this.showEdit;
99+
return this.value && !this.showDelete;
120100
},
121101
set(value) {
122102
this.$emit('input', value);
@@ -133,13 +113,8 @@
133113
...mapActions('importFromChannels', ['loadSavedSearches', 'deleteSearch']),
134114
handleCancel() {
135115
this.searchId = null;
136-
this.showEdit = false;
137116
this.showDelete = false;
138117
},
139-
handleClickEdit(searchId) {
140-
this.searchId = searchId;
141-
this.showEdit = true;
142-
},
143118
handleClickDelete(searchId) {
144119
this.searchId = searchId;
145120
this.showDelete = true;
@@ -178,7 +153,6 @@
178153
},
179154
$trs: {
180155
closeButtonLabel: 'Close',
181-
editAction: 'Edit',
182156
deleteAction: 'Delete',
183157
savedSearchesTitle: 'Saved searches',
184158
noSavedSearches: 'You do not have any saved searches',

contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/SearchOrBrowseWindow.vue

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
@click="handleBackToBrowse"
1010
/>
1111
</div>
12-
1312
<!-- Search bar -->
1413
<VLayout row wrap class="mt-4 px-2">
1514
<VFlex style="max-width: 700px">
@@ -22,6 +21,7 @@
2221
box
2322
clearable
2423
hideDetails
24+
@click:clear="handleBackToBrowse"
2525
>
2626
<template #prepend-inner>
2727
<Icon icon="search" />
@@ -43,6 +43,15 @@
4343
</VFlex>
4444
</VLayout>
4545

46+
<div class="my-2 px-2">
47+
<ActionLink
48+
class="mb-3"
49+
:text="$tr('savedSearchesLabel')"
50+
:disabled="!savedSearchesExist"
51+
@click="showSavedSearches = true"
52+
/>
53+
</div>
54+
4655
<!-- Search or Topics Browsing -->
4756
<ChannelList
4857
v-if="isBrowsing && !$route.params.channelId"
@@ -66,6 +75,7 @@
6675
@copy_to_clipboard="handleCopyToClipboard"
6776
/>
6877
</VSheet>
78+
<SavedSearchesModal v-model="showSavedSearches" />
6979
</template>
7080
</ImportFromChannelsModal>
7181

@@ -74,11 +84,12 @@
7484

7585
<script>
7686
77-
import { mapActions, mapMutations, mapState } from 'vuex';
87+
import { mapActions, mapGetters, mapMutations, mapState } from 'vuex';
7888
import { RouteNames } from '../../constants';
7989
import ChannelList from './ChannelList';
8090
import ContentTreeList from './ContentTreeList';
8191
import SearchResultsList from './SearchResultsList';
92+
import SavedSearchesModal from './SavedSearchesModal';
8293
import ImportFromChannelsModal from './ImportFromChannelsModal';
8394
import { withChangeTracker } from 'shared/data/changes';
8495
@@ -89,16 +100,19 @@
89100
ContentTreeList,
90101
SearchResultsList,
91102
ChannelList,
103+
SavedSearchesModal,
92104
},
93105
data() {
94106
return {
95107
searchTerm: '',
96108
topicNode: null,
97109
copyNode: null,
98110
languageFromChannelList: null,
111+
showSavedSearches: false,
99112
};
100113
},
101114
computed: {
115+
...mapGetters('importFromChannels', ['savedSearchesExist']),
102116
...mapState('importFromChannels', ['selected']),
103117
isBrowsing() {
104118
return this.$route.name === RouteNames.IMPORT_FROM_CHANNELS_BROWSE;
@@ -122,16 +136,24 @@
122136
);
123137
},
124138
},
139+
beforeRouteEnter(to, from, next) {
140+
next(vm => {
141+
vm.searchTerm = to.params.searchTerm || '';
142+
vm.showSavedSearches = false;
143+
});
144+
},
145+
beforeRouteUpdate(to, from, next) {
146+
this.searchTerm = to.params.searchTerm || '';
147+
this.showSavedSearches = false;
148+
next();
149+
},
125150
beforeRouteLeave(to, from, next) {
126151
// Clear selections if going back to TreeView
127152
if (to.name === RouteNames.TREE_VIEW) {
128153
this.$store.commit('importFromChannels/CLEAR_NODES');
129154
}
130155
next();
131156
},
132-
mounted() {
133-
this.searchTerm = this.$route.params.searchTerm || '';
134-
},
135157
methods: {
136158
...mapActions('clipboard', ['copy']),
137159
...mapMutations('importFromChannels', {
@@ -196,6 +218,7 @@
196218
backToBrowseAction: 'Back to browse',
197219
searchLabel: 'Search for resources…',
198220
searchAction: 'Search',
221+
savedSearchesLabel: 'View saved searches',
199222
200223
// Copy strings
201224
// undo: 'Undo',

0 commit comments

Comments
 (0)