diff --git a/web/src/views/apps/postgresql/IndexView.vue b/web/src/views/apps/postgresql/IndexView.vue index 81673fcf..a2732dc5 100644 --- a/web/src/views/apps/postgresql/IndexView.vue +++ b/web/src/views/apps/postgresql/IndexView.vue @@ -3,6 +3,7 @@ defineOptions({ name: 'apps-postgresql-index' }) +import copy2clipboard from '@vavt/copy2clipboard' import { NButton, NDataTable } from 'naive-ui' import { useGettext } from 'vue3-gettext' @@ -12,6 +13,9 @@ import ServiceStatus from '@/components/common/ServiceStatus.vue' const { $gettext } = useGettext() const currentTab = ref('status') +const { data: postgresPassword } = useRequest(postgresql.postgresPassword, { + initialData: '' +}) const { data: log } = useRequest(postgresql.log, { initialData: '' }) @@ -55,13 +59,44 @@ const handleClearLog = async () => { await postgresql.clearLog() window.$message.success($gettext('Cleared successfully')) } + +const handleSetPostgresPassword = () => { + useRequest(postgresql.setPostgresPassword(postgresPassword.value)).onSuccess(() => { + window.$message.success($gettext('Modified successfully')) + }) +} + +const handleCopyPostgresPassword = () => { + copy2clipboard(postgresPassword.value).then(() => { + window.$message.success($gettext('Copied successfully')) + }) +}