-
+
{{ $t('tool.supervisor.notStartWarn') }}
@@ -9,18 +9,17 @@
-
+
{{ $t('commons.button.create') + $t('tool.supervisor.list') }}
-
-
+
+
@@ -86,24 +85,44 @@ const globalStore = GlobalStore();
const loading = ref(false);
const setSuperVisor = ref(false);
-const isExistSuperVisor = ref(false);
-const isRunningSuperVisor = ref(true);
const createRef = ref();
const fileRef = ref();
const data = ref();
const maskShow = ref(true);
+const supervisorStatus = ref({
+ maskShow: true,
+ isExist: false,
+ isRunning: false,
+ init: true,
+});
const setting = () => {
setSuperVisor.value = true;
};
-const isExist = (isExist: boolean) => {
- isExistSuperVisor.value = isExist;
+const getStatus = (status: any) => {
+ supervisorStatus.value = status;
};
-const isRunning = (running: boolean) => {
- isRunningSuperVisor.value = running;
-};
+const showStopped = computed((): boolean => {
+ if (supervisorStatus.value.init || setSuperVisor.value) {
+ return false;
+ }
+ if (supervisorStatus.value.isExist && !supervisorStatus.value.isRunning && maskShow.value) {
+ return true;
+ }
+ return false;
+});
+
+const showTable = computed((): boolean => {
+ if (supervisorStatus.value.init || setSuperVisor.value || !supervisorStatus.value.isExist) {
+ return false;
+ }
+ if (supervisorStatus.value.isExist && !setSuperVisor.value) {
+ return true;
+ }
+ return true;
+});
const openCreate = () => {
createRef.value.acceptParams();
@@ -113,7 +132,6 @@ const search = async () => {
loading.value = true;
try {
const res = await GetSupervisorProcess();
- console.log(res);
data.value = res.data;
} catch (error) {}
loading.value = false;
diff --git a/frontend/src/views/host/tool/supervisor/status/index.vue b/frontend/src/views/host/tool/supervisor/status/index.vue
index f8deddf0e..7a0813bbb 100644
--- a/frontend/src/views/host/tool/supervisor/status/index.vue
+++ b/frontend/src/views/host/tool/supervisor/status/index.vue
@@ -6,7 +6,7 @@
{{ 'Supervisor' }}
{{ $t('app.version') }}:{{ data.version }}
-
+
{{ $t('app.start') }}
@@ -18,25 +18,30 @@
{{ $t('app.restart') }}
-
+
{{ $t('commons.button.set') }}
+
+
+ {{ $t('commons.button.init') }}
+
+
-
+
{{ $t('tool.supervisor.notSupport') }}
-
{{ $t('tool.supervisor.notSupportCrl') }}
-
+ {{ $t('tool.supervisor.notSupportCrl') }}
+ {{ $t('tool.supervisor.initHelper') }}
+
{{ $t('firewall.quickJump') }}
@@ -75,14 +80,18 @@ const data = ref({
serviceName: '',
});
-const em = defineEmits(['setting', 'isExist', 'isRunning', 'update:loading', 'update:maskShow']);
+const em = defineEmits(['setting', 'getStatus', 'update:loading', 'update:maskShow']);
const setting = () => {
- em('setting', false);
+ em('setting', true);
};
const toDoc = async () => {
- window.open('https://1panel.cn/docs/user_manual/hosts/firewall/', '_blank');
+ window.open('https://1panel.cn/docs/user_manual/hosts/supervisor/', '_blank');
+};
+
+const init = async () => {
+ initRef.value.acceptParams(data.value.configPath, data.value.serviceName);
};
const onOperate = async (operation: string) => {
@@ -120,15 +129,13 @@ const getStatus = async () => {
em('update:loading', true);
const res = await GetSupervisorStatus();
data.value = res.data.config as HostTool.Supersivor;
- em('isRunning', data.value.status === 'running');
- if (!data.value.isExist || !data.value.ctlExist) {
- em('isExist', false);
- } else {
- em('isExist', true);
- }
- if (data.value.init) {
- initRef.value.acceptParams(data.value.configPath, data.value.serviceName);
- }
+
+ const status = {
+ isExist: data.value.isExist && data.value.ctlExist,
+ isRunning: data.value.status === 'running',
+ init: data.value.init,
+ };
+ em('getStatus', status);
} catch (error) {}
em('update:loading', false);
};
diff --git a/frontend/src/views/host/tool/supervisor/status/init/index.vue b/frontend/src/views/host/tool/supervisor/status/init/index.vue
index fc29149d6..9d69db2e4 100644
--- a/frontend/src/views/host/tool/supervisor/status/init/index.vue
+++ b/frontend/src/views/host/tool/supervisor/status/init/index.vue
@@ -1,7 +1,7 @@
-
+
- {{ $t('commons.button.init') }}
+
@@ -23,6 +23,9 @@