Add rename rss item

close #28
This commit is contained in:
CzBiX
2020-04-25 17:42:54 +08:00
parent f6bb25ee13
commit 5589b08abf
4 changed files with 50 additions and 0 deletions

View File

@@ -230,6 +230,16 @@ class Api {
return this.axios.post('/rss/refreshItem', data).then(Api.handleResponse);
}
public moveRssFeed(path: string, newPath: string) {
const params: any = {
itemPath: path,
destPath: newPath,
}
const data = new URLSearchParams(params)
return this.axios.post('/rss/moveItem', data).then(Api.handleResponse);
}
public getRssRules(): Promise<{[key: string]: RssRule}> {
return this.axios.get('/rss/rules').then(Api.handleResponse);
}

View File

@@ -34,6 +34,14 @@
>
<v-icon>mdi-delete</v-icon>
</v-btn>
<v-btn
icon
:disabled="!selectNode"
@click="renameRssItem"
:title="$t('rename')"
>
<v-icon>mdi-file-move</v-icon>
</v-btn>
<v-divider vertical />
<v-btn
icon
@@ -379,6 +387,36 @@ export default class RssDialog extends HasTask {
this.closeSnackBar();
}
async renameRssItem() {
const input = await this.asyncShowDialog({
content: {
text: tr('name'),
type: DialogType.Input,
value: this.selectedPath!,
},
})
if (!input) {
return
}
this.showSnackBar({
text: tr('label.moving'),
})
try {
await api.moveRssFeed(this.selectedPath!, input);
} catch (e) {
this.showSnackBar({
text: e.response ? e.response.data : e.message,
})
return
}
await this.runTask();
this.closeSnackBar();
}
async deleteRssItem() {
const confirm = await this.asyncShowDialog({
content: {

View File

@@ -21,6 +21,7 @@ export default {
search: 'Search',
refresh: 'Refresh',
location: 'Location',
rename: 'Rename',
reannounce: 'Reannounce',
recheck: 'Recheck',

View File

@@ -21,6 +21,7 @@ export default {
search: '搜索',
refresh: '刷新',
location: '位置',
rename: '重命名',
reannounce: '重新通告',
recheck: '重新检查',