Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 87 additions & 30 deletions frontend/src/components/StdDataDisplay/StdTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,26 @@
</template>
<div class="std_action" v-if="!pithy" slot="action" slot-scope="text, record">
<a v-if="editable" @click="$emit('clickEdit', record[rowKey], record)">
<template v-if="edit_text">{{ edit_text }}</template>
<template v-else>编辑</template>
{{ edit_text }}
</a>
<slot name="actions" :record="record"/>
<template v-if="deletable">
<a-divider type="vertical"/>
<a-popconfirm
v-if="soft_delete&&params.trashed"
cancelText="再想想"
okText="是的" title="你确定要反删除?"
@confirm="restore(record[rowKey])">
<a href="javascript:;">反删除</a>
cancelText="{{restore.cancel_text}}"
okText="{{restore.ok_text}}"
title="{{restore.title_text}}"
@confirm="restore.exec(record[rowKey])">
<a href="javascript:;">{{restore.action_text}}</a>
</a-popconfirm>
<a-popconfirm
v-else
cancelText="再想想"
okText="是的" title="你确定要删除?"
@confirm="destroy(record[rowKey])"
>
<a href="javascript:;">删除</a>
cancelText="{{destroy.cancel_text}}"
okText="{{destroy.ok_text}}"
title="{{destroy.title_text}}"
@confirm="destroy.exec(record[rowKey])">
<a href="javascript:;">{{destroy.action_text}}</a>
</a-popconfirm>
</template>
</div>
Expand Down Expand Up @@ -123,7 +123,82 @@ export default {
type: Boolean,
default: false
},
edit_text: String,
edit_text: {
type: String,
default() {
return this.$gettext('Edit')
}
},
restore: {
title_text: {
type: String,
default() {
return this.$gettext('Are you sure you want to restore?')
}
},
action_text: {
type: String,
default() {
return this.$gettext('Restore')
}
},
ok_text: {
type: String,
default() {
return this.$gettext('Yes, I\'m sure')
}
},
cancel_text: {
type: String,
default() {
return this.$gettext('No, I\'m rethink')
}
},
exec(id) {
this.api.restore(id).then(() => {
this.get_list()
this.$message.success('反删除 ID: ' + id + ' 成功')
}).catch(e => {
console.log(e)
this.$message.error(e?.message ?? '系统错误')
})
},
},
destroy: {
title_text: {
type: String,
default() {
return this.$gettext('Are you sure you want to destroy?')
}
},
action_text: {
type: String,
default() {
return this.$gettext('Destroy')
}
},
ok_text: {
type: String,
default() {
return this.$gettext('Yes, I\'m sure')
}
},
cancel_text: {
type: String,
default() {
return this.$gettext('No, I\'m rethink')
}
},
exec(id) {
this.api.destroy(id).then(() => {
this.get_list()
this.$message.success('删除 ID: ' + id + ' 成功')
}).catch(e => {
console.log(e)
this.$message.error(e?.message ?? '系统错误')
})
},
},
deletable: {
type: Boolean,
default: true
Expand Down Expand Up @@ -206,24 +281,6 @@ export default {
})
}
},
destroy(id) {
this.api.destroy(id).then(() => {
this.get_list()
this.$message.success('删除 ID: ' + id + ' 成功')
}).catch(e => {
console.log(e)
this.$message.error(e?.message ?? '系统错误')
})
},
restore(id) {
this.api.restore(id).then(() => {
this.get_list()
this.$message.success('反删除 ID: ' + id + ' 成功')
}).catch(e => {
console.log(e)
this.$message.error(e?.message ?? '系统错误')
})
},
get_searchColumns() {
let searchColumns = []
this.columns.forEach(column => {
Expand Down
30 changes: 30 additions & 0 deletions frontend/src/locale/en/LC_MESSAGES/app.po
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ msgstr ""
msgid "Add Site"
msgstr ""

#: src/components/StdDataDisplay/StdTable.vue:79
msgid "Are you sure you want to destroy?"
msgstr ""

#: src/components/StdDataDisplay/StdTable.vue:44
msgid "Are you sure you want to restore?"
msgstr ""

#: src/views/domain/DomainAdd.vue:89 src/views/domain/DomainEdit.vue:164
msgid "Auto-renewal disabled for %{name}"
msgstr ""
Expand Down Expand Up @@ -107,6 +115,10 @@ msgstr ""
msgid "Database (Optional, default: database)"
msgstr ""

#: src/components/StdDataDisplay/StdTable.vue:85
msgid "Destroy"
msgstr ""

#: src/router/index.js:125
msgid "Detected version update, this page will refresh."
msgstr ""
Expand Down Expand Up @@ -140,6 +152,10 @@ msgstr ""
msgid "Domain Config Created Successfully"
msgstr ""

#: src/components/StdDataDisplay/StdTable.vue:37
msgid "Edit"
msgstr ""

#: src/views/domain/DomainEdit.vue:47
msgid "Edit %{n}"
msgstr ""
Expand Down Expand Up @@ -319,6 +335,11 @@ msgstr ""
msgid "Next"
msgstr ""

#: src/components/StdDataDisplay/StdTable.vue:62
#: src/components/StdDataDisplay/StdTable.vue:97
msgid "No, I'm rethink"
msgstr ""

#: src/router/index.js:105
msgid "Not Found"
msgstr ""
Expand Down Expand Up @@ -377,6 +398,10 @@ msgstr ""
msgid "Receive"
msgstr ""

#: src/components/StdDataDisplay/StdTable.vue:50
msgid "Restore"
msgstr ""

#: src/views/domain/columns.js:16
msgid "Root Directory (root)"
msgstr ""
Expand Down Expand Up @@ -488,3 +513,8 @@ msgstr ""
#: src/views/dashboard/DashBoard.vue:58 src/views/dashboard/DashBoard.vue:298
msgid "Writes"
msgstr ""

#: src/components/StdDataDisplay/StdTable.vue:56
#: src/components/StdDataDisplay/StdTable.vue:91
msgid "Yes, I'm sure"
msgstr ""
30 changes: 30 additions & 0 deletions frontend/src/locale/zh_CN/LC_MESSAGES/app.po
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ msgstr "操作"
msgid "Add Site"
msgstr "添加站点"

#: src/components/StdDataDisplay/StdTable.vue:79
msgid "Are you sure you want to destroy?"
msgstr "你确定要删除?"

#: src/components/StdDataDisplay/StdTable.vue:44
msgid "Are you sure you want to restore?"
msgstr "你确定要反删除?"

#: src/views/domain/DomainAdd.vue:89 src/views/domain/DomainEdit.vue:164
msgid "Auto-renewal disabled for %{name}"
msgstr "成功关闭 %{name} 自动续签"
Expand Down Expand Up @@ -109,6 +117,10 @@ msgstr "仪表盘"
msgid "Database (Optional, default: database)"
msgstr "数据库 (可选,默认: database)"

#: src/components/StdDataDisplay/StdTable.vue:85
msgid "Destroy"
msgstr "删除"

#: src/router/index.js:125
msgid "Detected version update, this page will refresh."
msgstr "检测到版本更新,页面将会刷新。"
Expand Down Expand Up @@ -142,6 +154,10 @@ msgstr "你想要改变模板以支持 TLS 吗?"
msgid "Domain Config Created Successfully"
msgstr "域名配置文件创建成功"

#: src/components/StdDataDisplay/StdTable.vue:37
msgid "Edit"
msgstr "编辑"

#: src/views/domain/DomainEdit.vue:47
msgid "Edit %{n}"
msgstr "编辑 %{n}"
Expand Down Expand Up @@ -323,6 +339,11 @@ msgstr "上传流量"
msgid "Next"
msgstr "下一步"

#: src/components/StdDataDisplay/StdTable.vue:62
#: src/components/StdDataDisplay/StdTable.vue:97
msgid "No, I'm rethink"
msgstr "再想想"

#: src/router/index.js:105
msgid "Not Found"
msgstr "找不到页面"
Expand Down Expand Up @@ -381,6 +402,10 @@ msgstr "读"
msgid "Receive"
msgstr "下载"

#: src/components/StdDataDisplay/StdTable.vue:50
msgid "Restore"
msgstr "反删除"

#: src/views/domain/columns.js:16
msgid "Root Directory (root)"
msgstr "网站根目录 (root)"
Expand Down Expand Up @@ -497,6 +522,11 @@ msgstr "用户名 (*)"
msgid "Writes"
msgstr "写"

#: src/components/StdDataDisplay/StdTable.vue:56
#: src/components/StdDataDisplay/StdTable.vue:91
msgid "Yes, I'm sure"
msgstr "是的"

#~ msgid ""
#~ "Add site here first, then you can configure TLS on the domain edit page."
#~ msgstr "在这里添加站点,完成后可进入编辑页面配置 TLS。"
Expand Down
30 changes: 30 additions & 0 deletions frontend/src/locale/zh_TW/LC_MESSAGES/app.po
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ msgstr "操作"
msgid "Add Site"
msgstr "新增站點"

#: src/components/StdDataDisplay/StdTable.vue:79
msgid "Are you sure you want to destroy?"
msgstr "你确定要删除?"

#: src/components/StdDataDisplay/StdTable.vue:44
msgid "Are you sure you want to restore?"
msgstr "你确定要反删除?"

#: src/views/domain/DomainAdd.vue:89 src/views/domain/DomainEdit.vue:164
msgid "Auto-renewal disabled for %{name}"
msgstr "成功關閉 %{name} 自動續簽"
Expand Down Expand Up @@ -110,6 +118,10 @@ msgstr "儀表盤"
msgid "Database (Optional, default: database)"
msgstr "資料庫 (可選,預設: database)"

#: src/components/StdDataDisplay/StdTable.vue:85
msgid "Destroy"
msgstr "删除"

#: src/router/index.js:125
msgid "Detected version update, this page will refresh."
msgstr "檢測到版本更新,頁面將會重新整理。"
Expand Down Expand Up @@ -143,6 +155,10 @@ msgstr "你想要改變模板以支援 TLS 嗎?"
msgid "Domain Config Created Successfully"
msgstr "域名配置文件創建成功"

#: src/components/StdDataDisplay/StdTable.vue:37
msgid "Edit"
msgstr "编辑"

#: src/views/domain/DomainEdit.vue:47
msgid "Edit %{n}"
msgstr "編輯 %{n}"
Expand Down Expand Up @@ -324,6 +340,11 @@ msgstr "上傳流量"
msgid "Next"
msgstr "下一步"

#: src/components/StdDataDisplay/StdTable.vue:62
#: src/components/StdDataDisplay/StdTable.vue:97
msgid "No, I'm rethink"
msgstr "再想想"

#: src/router/index.js:105
msgid "Not Found"
msgstr "找不到頁面"
Expand Down Expand Up @@ -382,6 +403,10 @@ msgstr "讀"
msgid "Receive"
msgstr "下載"

#: src/components/StdDataDisplay/StdTable.vue:50
msgid "Restore"
msgstr "反删除"

#: src/views/domain/columns.js:16
msgid "Root Directory (root)"
msgstr "網站根目錄 (root)"
Expand Down Expand Up @@ -498,6 +523,11 @@ msgstr "使用者名稱 (*)"
msgid "Writes"
msgstr "寫"

#: src/components/StdDataDisplay/StdTable.vue:56
#: src/components/StdDataDisplay/StdTable.vue:91
msgid "Yes, I'm sure"
msgstr "是的"

#~ msgid ""
#~ "Add site here first, then you can configure TLS on the domain edit page."
#~ msgstr "在這裡新增站點,完成後可進入編輯頁面配置 TLS。"
Expand Down
Loading