|
21 | 21 | v-if="accountsCount === 0 && is_preloading > 0" |
22 | 22 | class="empty mb-2" |
23 | 23 | > |
24 | | - <div class="empty-icon"> |
25 | | - <i class="fa fa-3x fa-user-circle-o" /> |
| 24 | + <div |
| 25 | + v-if="!searchAccount" |
| 26 | + > |
| 27 | + <div class="empty-icon"> |
| 28 | + <i class="fa fa-3x fa-user-circle-o" /> |
| 29 | + </div> |
| 30 | + <p class="empty-title h5"> |
| 31 | + {{ labels.no_accounts }} |
| 32 | + </p> |
| 33 | + <p class="empty-subtitle"> |
| 34 | + {{ labels.no_accounts_desc }} |
| 35 | + </p> |
| 36 | + </div> |
| 37 | + <div |
| 38 | + v-else |
| 39 | + > |
| 40 | + {{ labels.no_account_found }}: "{{ searchAccount }}" |
26 | 41 | </div> |
27 | | - <p class="empty-title h5"> |
28 | | - {{ labels.no_accounts }} |
29 | | - </p> |
30 | | - <p class="empty-subtitle"> |
31 | | - {{ labels.no_accounts_desc }} |
32 | | - </p> |
33 | 42 | </div> |
34 | 43 | <template v-if="is_preloading > 0"> |
35 | 44 | <div |
|
109 | 118 |
|
110 | 119 | export default { |
111 | 120 | name: 'AccountView', |
| 121 | + props: { |
| 122 | + searchAccount: { |
| 123 | + default: function () { |
| 124 | + return ''; |
| 125 | + }, |
| 126 | + type: String |
| 127 | + } |
| 128 | + }, |
112 | 129 | components: { |
113 | 130 | SignInBtn, |
114 | 131 | ServiceUserTile, |
|
124 | 141 | twitter_warning: false, |
125 | 142 | labels: this.$store.state.labels.accounts, |
126 | 143 | upsell_link: ropApiSettings.upsell_link, |
127 | | - pro_installed: ropApiSettings.pro_installed |
| 144 | + pro_installed: ropApiSettings.pro_installed, |
| 145 | + postTimeout: '' |
128 | 146 | } |
129 | 147 | }, |
130 | 148 | computed: { |
131 | 149 | /** |
132 | 150 | * Get all the available/active accounts. |
133 | 151 | */ |
134 | 152 | accounts: function () { |
135 | | - const all_accounts = {}; |
| 153 | + let all_accounts = {}; |
136 | 154 | let twitter = 0; |
137 | 155 | const services = this.$store.state.authenticatedServices; |
138 | 156 | for (const key in services) { |
|
150 | 168 | } |
151 | 169 | } |
152 | 170 | } |
| 171 | + if (this.searchAccount){ |
| 172 | + all_accounts = this.filteredAccounts(all_accounts); |
| 173 | + } |
153 | 174 | this.twitter_warning = twitter > 1; |
154 | 175 | this.$log.info('All accounts: ', all_accounts); |
155 | 176 | this.$log.debug('Preloading: ', this.$store.state.hide_preloading); |
|
206 | 227 | this.is_loading = false; |
207 | 228 | Vue.$log.error('Got nothing from server. Prompt user to check internet connection and try again', error) |
208 | 229 | }) |
| 230 | + }, |
| 231 | + filteredAccounts: function(accounts) { |
| 232 | + const result = {}; |
| 233 | + const query = this.searchAccount?.toLowerCase() || ''; |
| 234 | + |
| 235 | + for (const account_id in accounts) { |
| 236 | + const account = accounts[account_id]; |
| 237 | + if ( |
| 238 | + account?.user && |
| 239 | + account.user.toLowerCase().includes(query) |
| 240 | + ) { |
| 241 | + result[account_id] = account; |
| 242 | + } |
| 243 | + } |
| 244 | + return result; |
209 | 245 | } |
210 | 246 | } |
211 | 247 | } |
|
0 commit comments