1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 16:29:17 +08:00

feat: 修改部分接口报错和页面显示问题 (#2731)

This commit is contained in:
zhengkunwang 2023-10-31 13:51:00 +08:00 committed by GitHub
parent c346cae288
commit 45d233bade
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 25 additions and 14 deletions

View File

@ -55,8 +55,8 @@ type FileOption struct {
ShowHidden bool `json:"showHidden"` ShowHidden bool `json:"showHidden"`
Page int `json:"page"` Page int `json:"page"`
PageSize int `json:"pageSize"` PageSize int `json:"pageSize"`
SortBy string `json:"sortBy" validate:"oneof=name size modTime"` SortBy string `json:"sortBy"`
SortOrder string `json:"sortOrder" validate:"oneof=ascending descending"` SortOrder string `json:"sortOrder"`
} }
type FileSearchInfo struct { type FileSearchInfo struct {

View File

@ -35,8 +35,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import i18n from '@/lang';
import { MsgSuccess } from '@/utils/message';
import { onMounted, reactive, ref } from 'vue'; import { onMounted, reactive, ref } from 'vue';
defineOptions({ name: 'OpDialog' });
const form = reactive({ const form = reactive({
msgs: [], msgs: [],
title: '', title: '',
@ -46,6 +50,7 @@ const form = reactive({
}); });
const loading = ref(); const loading = ref();
const open = ref(); const open = ref();
const successMsg = ref('');
interface DialogProps { interface DialogProps {
title: string; title: string;
@ -54,6 +59,7 @@ interface DialogProps {
api: Function; api: Function;
params: Object; params: Object;
successMsg: string;
} }
const acceptParams = (props: DialogProps): void => { const acceptParams = (props: DialogProps): void => {
form.title = props.title; form.title = props.title;
@ -61,6 +67,7 @@ const acceptParams = (props: DialogProps): void => {
form.msgs = props.msg.split('\n'); form.msgs = props.msg.split('\n');
form.api = props.api; form.api = props.api;
form.params = props.params; form.params = props.params;
successMsg.value = props.successMsg;
open.value = true; open.value = true;
}; };
@ -74,6 +81,11 @@ const onConfirm = async () => {
.then(() => { .then(() => {
emit('cancel'); emit('cancel');
emit('search'); emit('search');
if (successMsg.value) {
MsgSuccess(successMsg.value);
} else {
MsgSuccess(i18n.global.t('commons.msg.deleteSuccess'));
}
open.value = false; open.value = false;
loading.value = false; loading.value = false;
}) })

View File

@ -3,11 +3,13 @@ import LayoutContent from './layout-content/index.vue';
import RouterButton from './router-button/index.vue'; import RouterButton from './router-button/index.vue';
import ComplexTable from './complex-table/index.vue'; import ComplexTable from './complex-table/index.vue';
import ErrPrompt from './error-prompt/index.vue'; import ErrPrompt from './error-prompt/index.vue';
import OpDialog from './del-dialog/index.vue';
export default { export default {
install(app: App) { install(app: App) {
app.component(LayoutContent.name, LayoutContent); app.component(LayoutContent.name, LayoutContent);
app.component(RouterButton.name, RouterButton); app.component(RouterButton.name, RouterButton);
app.component(ComplexTable.name, ComplexTable); app.component(ComplexTable.name, ComplexTable);
app.component(ErrPrompt.name, ErrPrompt); app.component(ErrPrompt.name, ErrPrompt);
app.component(OpDialog.name, OpDialog);
}, },
}; };

View File

@ -290,6 +290,7 @@ const stopProcess = async (row: any) => {
]), ]),
api: StopProcess, api: StopProcess,
params: { PID: row.PID }, params: { PID: row.PID },
successMsg: i18n.global.t('commons.msg.operationSuccess'),
}); });
}; };

View File

@ -18,7 +18,7 @@
<br /> <br />
<div v-loading="loading"> <div v-loading="loading">
<codemirror <codemirror
style="height: calc(100vh - 430px)" style="height: calc(100vh - 430px); min-height: 300px"
:autofocus="true" :autofocus="true"
:placeholder="$t('website.noLog')" :placeholder="$t('website.noLog')"
:indent-with-tab="true" :indent-with-tab="true"
@ -50,7 +50,7 @@ import { Codemirror } from 'vue-codemirror';
import { javascript } from '@codemirror/lang-javascript'; import { javascript } from '@codemirror/lang-javascript';
import { oneDark } from '@codemirror/theme-one-dark'; import { oneDark } from '@codemirror/theme-one-dark';
import OpDialog from '@/components/del-dialog/index.vue'; import OpDialog from '@/components/del-dialog/index.vue';
import { onMounted, onUnmounted, reactive, ref, shallowRef } from 'vue'; import { onUnmounted, reactive, ref, shallowRef } from 'vue';
import { OperateSupervisorProcessFile } from '@/api/modules/host-tool'; import { OperateSupervisorProcessFile } from '@/api/modules/host-tool';
import i18n from '@/lang'; import i18n from '@/lang';
import { TabsPaneContext } from 'element-plus'; import { TabsPaneContext } from 'element-plus';
@ -155,10 +155,6 @@ const onCloseLog = async () => {
timer = null; timer = null;
}; };
onMounted(() => {
getContent();
});
onUnmounted(() => { onUnmounted(() => {
onCloseLog(); onCloseLog();
}); });

View File

@ -135,8 +135,8 @@ const openDetail = (row: Runtime.Runtime) => {
const openDelete = async (row: Runtime.Runtime) => { const openDelete = async (row: Runtime.Runtime) => {
opRef.value.acceptParams({ opRef.value.acceptParams({
title: i18n.global.t('commons.msg.delete'), title: i18n.global.t('commons.msg.deleteTitle'),
names: [req.name], names: [row.name],
msg: i18n.global.t('commons.msg.operatorHelper', [ msg: i18n.global.t('commons.msg.operatorHelper', [
i18n.global.t('website.runtime'), i18n.global.t('website.runtime'),
i18n.global.t('commons.msg.delete'), i18n.global.t('commons.msg.delete'),

View File

@ -59,7 +59,7 @@ const buttons = [
{ {
label: i18n.global.t('commons.button.delete'), label: i18n.global.t('commons.button.delete'),
click: function (row: Website.DnsAccount) { click: function (row: Website.DnsAccount) {
deleteAccount(row.id); deleteAccount(row);
}, },
}, },
]; ];

View File

@ -77,7 +77,7 @@ const openUrl = (domain: string, port: string) => {
const deleteDomain = async (row: Website.Domain) => { const deleteDomain = async (row: Website.Domain) => {
opRef.value.acceptParams({ opRef.value.acceptParams({
title: i18n.global.t('commons.msg.delete'), title: i18n.global.t('commons.msg.deleteTitle'),
names: [row.domain], names: [row.domain],
msg: i18n.global.t('commons.msg.operatorHelper', [ msg: i18n.global.t('commons.msg.operatorHelper', [
i18n.global.t('website.domain'), i18n.global.t('website.domain'),

View File

@ -131,7 +131,7 @@ const openEditFile = (proxyConfig: Website.ProxyConfig) => {
const deleteProxy = async (proxyConfig: Website.ProxyConfig) => { const deleteProxy = async (proxyConfig: Website.ProxyConfig) => {
proxyConfig.operate = 'delete'; proxyConfig.operate = 'delete';
opRef.value.acceptParams({ opRef.value.acceptParams({
title: i18n.global.t('commons.msg.delete'), title: i18n.global.t('commons.msg.deleteTitle'),
names: [proxyConfig.name], names: [proxyConfig.name],
msg: i18n.global.t('commons.msg.operatorHelper', [ msg: i18n.global.t('commons.msg.operatorHelper', [
i18n.global.t('website.proxy'), i18n.global.t('website.proxy'),

View File

@ -146,7 +146,7 @@ const openEditFile = (proxyConfig: Website.RedirectConfig) => {
const deleteProxy = async (redirectConfig: Website.RedirectConfig) => { const deleteProxy = async (redirectConfig: Website.RedirectConfig) => {
redirectConfig.operate = 'delete'; redirectConfig.operate = 'delete';
opRef.value.acceptParams({ opRef.value.acceptParams({
title: i18n.global.t('commons.msg.delete'), title: i18n.global.t('commons.msg.deleteTitle'),
names: [redirectConfig.name], names: [redirectConfig.name],
msg: i18n.global.t('commons.msg.operatorHelper', [ msg: i18n.global.t('commons.msg.operatorHelper', [
i18n.global.t('website.redirect'), i18n.global.t('website.redirect'),