mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-06 05:24:33 +08:00
feat: Add demo mode handling (#8548)
This commit is contained in:
parent
c460d9fd7d
commit
47d9c996aa
15 changed files with 32 additions and 111 deletions
|
@ -10,14 +10,18 @@ import (
|
|||
)
|
||||
|
||||
var whiteUrlList = map[string]struct{}{
|
||||
"/core/api/v2/auth/login": {},
|
||||
"/api/v2/websites/config": {},
|
||||
"/api/v2/websites/waf/config": {},
|
||||
"/api/v2/files/loadfile": {},
|
||||
"/api/v2/files/size": {},
|
||||
"/api/v2/logs/operation": {},
|
||||
"/api/v2/logs/login": {},
|
||||
"/core/api/v2/auth/logout": {},
|
||||
"/api/v2/dashboard/app/launcher/option": {},
|
||||
"/api/v2/websites/config": {},
|
||||
"/api/v2/websites/waf/config": {},
|
||||
"/api/v2/files/loadfile": {},
|
||||
"/api/v2/files/size": {},
|
||||
"/api/v2/runtimes/sync": {},
|
||||
"/api/v2/toolbox/device/base": {},
|
||||
|
||||
"/api/v2/core/auth/login": {},
|
||||
"/api/v2/core/logs/login": {},
|
||||
"/api/v2/core/logs/operation": {},
|
||||
"/api/v2/core/auth/logout": {},
|
||||
|
||||
"/api/v2/apps/installed/loadport": {},
|
||||
"/api/v2/apps/installed/check": {},
|
||||
|
@ -27,13 +31,18 @@ var whiteUrlList = map[string]struct{}{
|
|||
"/api/v2/databases/status": {},
|
||||
"/api/v2/databases/baseinfo": {},
|
||||
|
||||
"/api/v2/waf/attack/stat": {},
|
||||
"/api/v2/waf/config/website": {},
|
||||
"/api/v2/xpack/waf/attack/stat": {},
|
||||
"/api/v2/xpack/waf/config/website": {},
|
||||
"/api/v2/xpack/waf/relation/stat": {},
|
||||
|
||||
"/api/v2/monitor/stat": {},
|
||||
"/api/v2/monitor/visitors": {},
|
||||
"/api/v2/monitor/visitors/loc": {},
|
||||
"/api/v2/monitor/qps": {},
|
||||
"/api/v2/xpack/monitor/stat": {},
|
||||
"/api/v2/xpack/monitor/visitors": {},
|
||||
"/api/v2/xpack/monitor/visitors/loc": {},
|
||||
"/api/v2/xpack/monitor/qps": {},
|
||||
"/api/v2/xpack/monitor/logs/stat": {},
|
||||
"/api/v2/xpack/monitor/websites": {},
|
||||
"/api/v2/xpack/monitor/trend": {},
|
||||
"/api/v2/xpack/monitor/rank": {},
|
||||
}
|
||||
|
||||
func DemoHandle() gin.HandlerFunc {
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
<template>
|
||||
<div v-loading="loading">
|
||||
<DrawerPro v-model="drawerVisible" :header="$t('terminal.groupChange')" @close="handleClose" size="small">
|
||||
<el-form @submit.prevent ref="hostInfoRef" label-position="top" :model="dialogData" :rules="rules">
|
||||
<el-form-item :label="$t('commons.table.group')" prop="group">
|
||||
<el-select filterable v-model="dialogData.groupID" clearable style="width: 100%">
|
||||
<div v-for="item in groupList" :key="item.id">
|
||||
<el-option :label="item.name" :value="item.id" />
|
||||
</div>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="drawerVisible = false">{{ $t('commons.button.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="onSubmit(hostInfoRef)">
|
||||
{{ $t('commons.button.confirm') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</DrawerPro>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import type { ElForm } from 'element-plus';
|
||||
import { Rules } from '@/global/form-rules';
|
||||
import { getGroupList } from '@/api/modules/group';
|
||||
|
||||
const loading = ref();
|
||||
interface DialogProps {
|
||||
group: string;
|
||||
groupType: string;
|
||||
}
|
||||
const drawerVisible = ref(false);
|
||||
const dialogData = ref({
|
||||
groupID: 0,
|
||||
groupType: '',
|
||||
});
|
||||
|
||||
const groupList = ref();
|
||||
const acceptParams = (params: DialogProps): void => {
|
||||
dialogData.value.groupType = params.groupType;
|
||||
loadGroups(params.group);
|
||||
drawerVisible.value = true;
|
||||
};
|
||||
const emit = defineEmits(['search', 'change']);
|
||||
|
||||
const handleClose = () => {
|
||||
drawerVisible.value = false;
|
||||
};
|
||||
|
||||
type FormInstance = InstanceType<typeof ElForm>;
|
||||
const hostInfoRef = ref<FormInstance>();
|
||||
const rules = reactive({
|
||||
groupID: [Rules.requiredSelect],
|
||||
});
|
||||
|
||||
const loadGroups = async (groupName: string) => {
|
||||
const res = await getGroupList(dialogData.value.groupType);
|
||||
groupList.value = res.data;
|
||||
for (const group of groupList.value) {
|
||||
if (group.name === groupName) {
|
||||
dialogData.value.groupID = group.id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const onSubmit = (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) return;
|
||||
loading.value = true;
|
||||
emit('change', Number(dialogData.value.groupID));
|
||||
loading.value = false;
|
||||
drawerVisible.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
acceptParams,
|
||||
});
|
||||
</script>
|
|
@ -112,14 +112,13 @@ const loadStatus = async () => {
|
|||
await getSystemAvailable()
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
window.location.reload();
|
||||
toLogin();
|
||||
clearInterval(Number(timer));
|
||||
timer = null;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
window.location.reload();
|
||||
toLogin();
|
||||
clearInterval(Number(timer));
|
||||
timer = null;
|
||||
});
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
import { App } from '@/api/interface/app';
|
||||
import { getAppByKey, getAppDetail, searchApp } from '@/api/modules/app';
|
||||
import { useVModel } from '@vueuse/core';
|
||||
import { defineProps } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
mode: {
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { defineProps } from 'vue';
|
||||
import { Promotion } from '@element-plus/icons-vue';
|
||||
defineProps({
|
||||
row: {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { defineProps, computed } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
import Status from '@/components/status/index.vue';
|
||||
|
||||
const props = defineProps({
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
import { Runtime } from '@/api/interface/runtime';
|
||||
import { GetNodeScripts } from '@/api/modules/runtime';
|
||||
import { useVModel } from '@vueuse/core';
|
||||
import { defineProps } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
mode: {
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineProps, reactive } from 'vue';
|
||||
import { reactive } from 'vue';
|
||||
import { FormRules } from 'element-plus';
|
||||
import { Rules } from '@/global/form-rules';
|
||||
import { Runtime } from '@/api/interface/runtime';
|
||||
|
|
|
@ -120,7 +120,7 @@ import Extensions from './extension-template/index.vue';
|
|||
import AppResources from '@/views/website/runtime/php/check/index.vue';
|
||||
import CreateRuntime from '@/views/website/runtime/php/create/index.vue';
|
||||
import RouterMenu from '../index.vue';
|
||||
import Log from '@/components/log/drawer/index.vue';
|
||||
import Log from '@/components/log/file-drawer/index.vue';
|
||||
import ComposeLogs from '@/components/log/compose/index.vue';
|
||||
import Config from '@/views/website/runtime/php/config/index.vue';
|
||||
import Supervisor from '@/views/website/runtime/php/supervisor/index.vue';
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
<script setup lang="ts">
|
||||
import { Rules, checkNumberRange } from '@/global/form-rules';
|
||||
import { FormRules } from 'element-plus';
|
||||
import { defineProps } from 'vue';
|
||||
import { useVModel } from '@vueuse/core';
|
||||
|
||||
const props = defineProps({
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineProps, reactive } from 'vue';
|
||||
import { reactive } from 'vue';
|
||||
import { FormRules } from 'element-plus';
|
||||
import { Rules } from '@/global/form-rules';
|
||||
import { Runtime } from '@/api/interface/runtime';
|
||||
|
|
|
@ -175,7 +175,7 @@ import { MsgError, MsgSuccess } from '@/utils/message';
|
|||
import { GlobalStore } from '@/store';
|
||||
import SSLUpload from './upload/index.vue';
|
||||
import Apply from './apply/index.vue';
|
||||
import Log from '@/components/log/drawer/index.vue';
|
||||
import Log from '@/components/log/file-drawer/index.vue';
|
||||
import Obtain from './obtain/index.vue';
|
||||
import MsgInfo from '@/components/msg-info/index.vue';
|
||||
|
||||
|
|
|
@ -139,14 +139,14 @@ onUnmounted(() => {
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
.custom-tabs >>> .el-tabs__header.is-left {
|
||||
.custom-tabs :deep(.el-tabs__header.is-left) {
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.custom-tabs >>> .el-tabs__content {
|
||||
.custom-tabs :deep(.el-tabs__content) {
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
import { deleteLoadBalance, getLoadBalances } from '@/api/modules/website';
|
||||
import { defineProps, onMounted, ref } from 'vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import Operate from './operate/index.vue';
|
||||
import i18n from '@/lang';
|
||||
import { Website } from '@/api/interface/website';
|
||||
|
|
Loading…
Add table
Reference in a new issue