3
3
<div class =" animatable_content_box " >
4
4
5
5
<b-form-input
6
+ @input =" currentPage=1"
6
7
onkeypress =" return event.keyCode != 13;"
7
8
size =" sm"
8
9
placeholder =" Search by prompt text"
16
17
<div @click =" toggle_order()" style =" float :right ; margin-bottom : 20px ;" class =" l_button" >
17
18
{{this.app_state.show_history_in_oldest_first ? "Oldest": "Newest"}} First
18
19
</div >
20
+ <div @click =" clear_history()" style =" float :right ; margin-bottom : 20px ;" class =" l_button" >
21
+ Clear History
22
+ </div >
19
23
<div v-if =" Object.values(app_state.app_data.history).length > 0" >
20
- <div v-for =" history_box in get_history()" :key =" history_box.key" style =" clear : both ;" >
24
+ <div v-if =" get_history().length > 30" >
25
+ <b-pagination
26
+ v-model =" currentPage"
27
+ :total-rows =" get_history().length"
28
+ :per-page =" 30"
29
+ />
30
+ </div >
31
+ <div v-for =" history_box in get_history().slice((currentPage - 1) * 30, currentPage * 30)" :key =" history_box.key" style =" clear : both ;" >
32
+
21
33
22
34
<div @click =" delete_hist(history_box.key)" style =" float :right ; margin-top : 10px ;" class =" l_button" >Delete</div >
23
35
<!-- <div @click="share_on_arthub(history_box)" style="float:right; margin-top: 10px;" class="l_button">Share</div> -->
65
77
</template >
66
78
<script >
67
79
import ImageItem from ' ../components/ImageItem.vue'
80
+ import {native_confirm } from " ../native_functions_vue_bridge.js" ;
68
81
import {share_on_arthub } from ' ../utils.js'
69
82
70
83
import Vue from ' vue'
@@ -83,7 +96,8 @@ export default {
83
96
},
84
97
data () {
85
98
return {
86
- searchText: ' '
99
+ searchText: ' ' ,
100
+ currentPage: 1 ,
87
101
};
88
102
},
89
103
methods: {
@@ -95,7 +109,6 @@ export default {
95
109
let history = Object .values (this .app_state .app_data .history );
96
110
const that = this ;
97
111
const list = this .app_state .show_history_in_oldest_first ? history : history .reverse ();
98
-
99
112
if (that .searchText .trim () === ' ' ) {
100
113
return list;
101
114
}
@@ -104,7 +117,7 @@ export default {
104
117
keys: [' prompt' ],
105
118
useExtendedSearch: true ,
106
119
});
107
-
120
+
108
121
return fuse .search (that .searchText ).map (r => r .item );
109
122
110
123
},
@@ -132,6 +145,12 @@ export default {
132
145
return r;
133
146
},
134
147
148
+ clear_history (){
149
+ if (native_confirm (" Are you sure you want to clear history?" )){
150
+ Vue .set ( this .app_state .app_data , " history" , {});
151
+ }
152
+ },
153
+
135
154
share_on_arthub (box ){
136
155
this .app_state .global_loader_modal_msg = " Uploading" ;
137
156
let params = this .get_box_params_dict (box);
@@ -147,6 +166,24 @@ export default {
147
166
}
148
167
</script >
149
168
<style >
169
+ .page-item .page-link {
170
+ outline : none !important ;
171
+ box-shadow : none ;
172
+ }
173
+ .page-item .page-link {
174
+ font-size : 13px ;
175
+ }
176
+ @media (prefers-color-scheme: dark) {
177
+ .page-item .page-link , .page-item.disabled .page-link {
178
+ background-color :#303030 ;
179
+ border-color : #303030 ;
180
+ color :rgba (255 , 255 , 255 , 0.5 );
181
+ }
182
+ .page-item.active .page-link {
183
+ background-color :#606060 ;
184
+ border-color : #606060 ;
185
+ }
186
+ }
150
187
</style >
151
188
<style scoped>
152
189
.history_box_info {
0 commit comments