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

feat(common): Standardize Event Bus (#7650)

This commit is contained in:
zhengkunwang 2025-01-06 18:16:22 +08:00 committed by GitHub
parent b1adafec2d
commit 022580bbb2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 16 additions and 9 deletions

View File

@ -16,8 +16,7 @@ server {
access_log /www/sites/domain/log/access.log main; access_log /www/sites/domain/log/access.log main;
error_log /www/sites/domain/log/error.log; error_log /www/sites/domain/log/error.log;
location ^~ /.well-known/acme-challenge { location ~ \.well-known{
allow all; allow all;
root /usr/share/nginx/html;
} }
} }

View File

@ -15,6 +15,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import bus from '@/global/bus';
defineProps({ defineProps({
showClose: { showClose: {
@ -50,6 +51,7 @@ const openWithTaskID = (id: string, tail: boolean) => {
config.tail = tail; config.tail = tail;
} }
open.value = true; open.value = true;
bus.emit('refreshTask', true);
}; };
const openWithResourceID = (taskType: string, taskOperate: string, resourceID: number) => { const openWithResourceID = (taskType: string, taskOperate: string, resourceID: number) => {

View File

@ -78,6 +78,7 @@ import { isString } from '@vueuse/core';
import { getSettingInfo, listNodeOptions } from '@/api/modules/setting'; import { getSettingInfo, listNodeOptions } from '@/api/modules/setting';
import { countExecutingTask } from '@/api/modules/log'; import { countExecutingTask } from '@/api/modules/log';
import { compareVersion } from '@/utils/version'; import { compareVersion } from '@/utils/version';
import bus from '@/global/bus';
const route = useRoute(); const route = useRoute();
const menuStore = MenuStore(); const menuStore = MenuStore();
@ -85,6 +86,12 @@ const globalStore = GlobalStore();
const nodes = ref([]); const nodes = ref([]);
const nodeChangeRef = ref<DropdownInstance>(); const nodeChangeRef = ref<DropdownInstance>();
const version = ref(); const version = ref();
bus.on('refreshTask', () => {
console.log('on bus message');
checkTask();
});
defineProps({ defineProps({
menuRouter: { menuRouter: {
type: Boolean, type: Boolean,

View File

@ -25,8 +25,8 @@ import { getSystemAvailable } from '@/api/modules/setting';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { loadMasterProductProFromDB, loadProductProFromDB } from '@/utils/xpack'; import { loadMasterProductProFromDB, loadProductProFromDB } from '@/utils/xpack';
import { useTheme } from '@/global/use-theme'; import { useTheme } from '@/global/use-theme';
const { switchTheme } = useTheme();
import TaskList from '@/components/task-list/index.vue'; import TaskList from '@/components/task-list/index.vue';
const { switchTheme } = useTheme();
useResize(); useResize();

View File

@ -136,16 +136,15 @@ import TaskLog from '@/components/task-log/index.vue';
import { newUUID } from '@/utils/util'; import { newUUID } from '@/utils/util';
import { computeSizeFromMB } from '@/utils/util'; import { computeSizeFromMB } from '@/utils/util';
const router = useRouter();
interface InstallRrops { interface InstallRrops {
params?: App.AppParams; params?: App.AppParams;
app: any; app: any;
} }
const installData = ref<InstallRrops>({ const installData = ref<InstallRrops>({
app: {}, app: {},
}); });
const router = useRouter();
const open = ref(false); const open = ref(false);
const rules = ref<FormRules>({ const rules = ref<FormRules>({
name: [Rules.appName], name: [Rules.appName],

View File

@ -13,7 +13,7 @@
import i18n from '@/lang'; import i18n from '@/lang';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { SearchAppInstalled } from '@/api/modules/app'; import { SearchAppInstalled } from '@/api/modules/app';
import bus from './bus'; import bus from '@/global/bus';
let showButton = ref(false); let showButton = ref(false);
const buttons = [ const buttons = [

View File

@ -49,7 +49,7 @@ import { onBeforeUnmount, ref } from 'vue';
import { App } from '@/api/interface/app'; import { App } from '@/api/interface/app';
import { InstalledOp } from '@/api/modules/app'; import { InstalledOp } from '@/api/modules/app';
import i18n from '@/lang'; import i18n from '@/lang';
import bus from '../../bus'; import bus from '@/global/bus';
import TaskLog from '@/components/task-log/index.vue'; import TaskLog from '@/components/task-log/index.vue';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';

View File

@ -87,7 +87,7 @@ import { reactive, ref, onBeforeUnmount } from 'vue';
import { MsgSuccess } from '@/utils/message'; import { MsgSuccess } from '@/utils/message';
import { Rules } from '@/global/form-rules'; import { Rules } from '@/global/form-rules';
import Diff from './diff/index.vue'; import Diff from './diff/index.vue';
import bus from '../../bus'; import bus from '@/global/bus';
import CodemirrorPro from '@/components/codemirror-pro/index.vue'; import CodemirrorPro from '@/components/codemirror-pro/index.vue';
import TaskLog from '@/components/task-log/index.vue'; import TaskLog from '@/components/task-log/index.vue';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';