Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Oct 31, 2023
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
4 changes: 2 additions & 2 deletions backend/utils/files/fileinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ type FileOption struct {
ShowHidden bool `json:"showHidden"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
SortBy string `json:"sortBy" validate:"oneof=name size modTime"`
SortOrder string `json:"sortOrder" validate:"oneof=ascending descending"`
SortBy string `json:"sortBy"`
SortOrder string `json:"sortOrder"`
}

type FileSearchInfo struct {
Expand Down
12 changes: 12 additions & 0 deletions frontend/src/components/del-dialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@
</template>

<script setup lang="ts">
import i18n from '@/lang';
import { MsgSuccess } from '@/utils/message';
import { onMounted, reactive, ref } from 'vue';

defineOptions({ name: 'OpDialog' });

const form = reactive({
msgs: [],
title: '',
Expand All @@ -46,6 +50,7 @@ const form = reactive({
});
const loading = ref();
const open = ref();
const successMsg = ref('');

interface DialogProps {
title: string;
Expand All @@ -54,13 +59,15 @@ interface DialogProps {

api: Function;
params: Object;
successMsg: string;
}
const acceptParams = (props: DialogProps): void => {
form.title = props.title;
form.names = props.names;
form.msgs = props.msg.split('\n');
form.api = props.api;
form.params = props.params;
successMsg.value = props.successMsg;
open.value = true;
};

Expand All @@ -74,6 +81,11 @@ const onConfirm = async () => {
.then(() => {
emit('cancel');
emit('search');
if (successMsg.value) {
MsgSuccess(successMsg.value);
} else {
MsgSuccess(i18n.global.t('commons.msg.deleteSuccess'));
}
open.value = false;
loading.value = false;
})
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import LayoutContent from './layout-content/index.vue';
import RouterButton from './router-button/index.vue';
import ComplexTable from './complex-table/index.vue';
import ErrPrompt from './error-prompt/index.vue';
import OpDialog from './del-dialog/index.vue';
export default {
install(app: App) {
app.component(LayoutContent.name, LayoutContent);
app.component(RouterButton.name, RouterButton);
app.component(ComplexTable.name, ComplexTable);
app.component(ErrPrompt.name, ErrPrompt);
app.component(OpDialog.name, OpDialog);
},
};
1 change: 1 addition & 0 deletions frontend/src/views/host/process/process/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ const stopProcess = async (row: any) => {
]),
api: StopProcess,
params: { PID: row.PID },
successMsg: i18n.global.t('commons.msg.operationSuccess'),
});
};

Expand Down
8 changes: 2 additions & 6 deletions frontend/src/views/host/tool/supervisor/file/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<br />
<div v-loading="loading">
<codemirror
style="height: calc(100vh - 430px)"
style="height: calc(100vh - 430px); min-height: 300px"
:autofocus="true"
:placeholder="$t('website.noLog')"
:indent-with-tab="true"
Expand Down Expand Up @@ -50,7 +50,7 @@ import { Codemirror } from 'vue-codemirror';
import { javascript } from '@codemirror/lang-javascript';
import { oneDark } from '@codemirror/theme-one-dark';
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 i18n from '@/lang';
import { TabsPaneContext } from 'element-plus';
Expand Down Expand Up @@ -155,10 +155,6 @@ const onCloseLog = async () => {
timer = null;
};

onMounted(() => {
getContent();
});

onUnmounted(() => {
onCloseLog();
});
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/views/website/runtime/php/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ const openDetail = (row: Runtime.Runtime) => {

const openDelete = async (row: Runtime.Runtime) => {
opRef.value.acceptParams({
title: i18n.global.t('commons.msg.delete'),
names: [req.name],
title: i18n.global.t('commons.msg.deleteTitle'),
names: [row.name],
msg: i18n.global.t('commons.msg.operatorHelper', [
i18n.global.t('website.runtime'),
i18n.global.t('commons.msg.delete'),
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/website/ssl/dns-account/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const buttons = [
{
label: i18n.global.t('commons.button.delete'),
click: function (row: Website.DnsAccount) {
deleteAccount(row.id);
deleteAccount(row);
},
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const openUrl = (domain: string, port: string) => {

const deleteDomain = async (row: Website.Domain) => {
opRef.value.acceptParams({
title: i18n.global.t('commons.msg.delete'),
title: i18n.global.t('commons.msg.deleteTitle'),
names: [row.domain],
msg: i18n.global.t('commons.msg.operatorHelper', [
i18n.global.t('website.domain'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const openEditFile = (proxyConfig: Website.ProxyConfig) => {
const deleteProxy = async (proxyConfig: Website.ProxyConfig) => {
proxyConfig.operate = 'delete';
opRef.value.acceptParams({
title: i18n.global.t('commons.msg.delete'),
title: i18n.global.t('commons.msg.deleteTitle'),
names: [proxyConfig.name],
msg: i18n.global.t('commons.msg.operatorHelper', [
i18n.global.t('website.proxy'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const openEditFile = (proxyConfig: Website.RedirectConfig) => {
const deleteProxy = async (redirectConfig: Website.RedirectConfig) => {
redirectConfig.operate = 'delete';
opRef.value.acceptParams({
title: i18n.global.t('commons.msg.delete'),
title: i18n.global.t('commons.msg.deleteTitle'),
names: [redirectConfig.name],
msg: i18n.global.t('commons.msg.operatorHelper', [
i18n.global.t('website.redirect'),
Expand Down
Loading