mirror of
https://github.com/CzBiX/qb-web.git
synced 2026-02-11 06:15:07 +08:00
Add refresh rss item button
This commit is contained in:
@@ -221,6 +221,15 @@ class Api {
|
||||
return this.axios.post('/rss/removeItem', data).then(Api.handleResponse);
|
||||
}
|
||||
|
||||
public refreshRssFeed(path: string) {
|
||||
const params: any = {
|
||||
itemPath: path,
|
||||
}
|
||||
|
||||
const data = new URLSearchParams(params)
|
||||
return this.axios.post('/rss/refreshItem', data).then(Api.handleResponse);
|
||||
}
|
||||
|
||||
public getRssRules(): Promise<{[key: string]: RssRule}> {
|
||||
return this.axios.get('/rss/rules').then(Api.handleResponse);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,15 @@
|
||||
>
|
||||
<v-icon>mdi-delete</v-icon>
|
||||
</v-btn>
|
||||
<v-divider vertical />
|
||||
<v-btn
|
||||
icon
|
||||
:disabled="!selectNode"
|
||||
@click="refreshRssItem"
|
||||
:title="$t('refresh')"
|
||||
>
|
||||
<v-icon>mdi-refresh</v-icon>
|
||||
</v-btn>
|
||||
<v-spacer />
|
||||
<v-divider vertical />
|
||||
<v-switch
|
||||
@@ -290,6 +299,16 @@ export default class RssDialog extends HasTask {
|
||||
return null
|
||||
}
|
||||
|
||||
get selectedPath() {
|
||||
if (!this.selectNode) {
|
||||
return null
|
||||
}
|
||||
|
||||
return toPath(this.selectNode!).map(p => {
|
||||
return p.replace('\\\'', '\'').replace('\\\\', '\\');
|
||||
}).join('\\');
|
||||
}
|
||||
|
||||
isItemLoading(row: any) {
|
||||
const item = row.item.item
|
||||
return item && item.isLoading
|
||||
@@ -355,7 +374,7 @@ export default class RssDialog extends HasTask {
|
||||
})
|
||||
|
||||
await api.addRssFeed(input);
|
||||
this.runTask();
|
||||
await this.runTask();
|
||||
|
||||
this.closeSnackBar();
|
||||
}
|
||||
@@ -376,23 +395,24 @@ export default class RssDialog extends HasTask {
|
||||
text: tr('label.deleting'),
|
||||
})
|
||||
|
||||
const path = toPath(this.selectNode!).map(p => {
|
||||
return p.replace('\\\'', '\'').replace('\\\\', '\\');
|
||||
}).join('\\');
|
||||
|
||||
try {
|
||||
await api.removeRssFeed(path);
|
||||
await api.removeRssFeed(this.selectedPath!);
|
||||
} catch (e) {
|
||||
this.showSnackBar({
|
||||
text: e.response ? e.response.data : e.message,
|
||||
})
|
||||
return
|
||||
}
|
||||
this.runTask();
|
||||
await this.runTask();
|
||||
|
||||
this.closeSnackBar();
|
||||
}
|
||||
|
||||
async refreshRssItem() {
|
||||
await api.refreshRssFeed(this.selectedPath!);
|
||||
await this.runTask();
|
||||
}
|
||||
|
||||
async changePreference(key: string, value: any) {
|
||||
await api.setPreferences({
|
||||
[key]: value,
|
||||
|
||||
@@ -19,6 +19,7 @@ export default {
|
||||
reset: 'Reset',
|
||||
login: 'Login',
|
||||
search: 'Search',
|
||||
refresh: 'Refresh',
|
||||
location: 'Location',
|
||||
|
||||
reannounce: 'Reannounce',
|
||||
|
||||
@@ -19,6 +19,7 @@ export default {
|
||||
reset: '重置',
|
||||
login: '登录',
|
||||
search: '搜索',
|
||||
refresh: '刷新',
|
||||
location: '位置',
|
||||
|
||||
reannounce: '重新通告',
|
||||
|
||||
Reference in New Issue
Block a user