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

fixed:Fixed an issue where callbacks could still be shared when they expired #1442

Merged
merged 1 commit into from
Aug 29, 2024
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
21 changes: 7 additions & 14 deletions ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,25 @@
</n-notification-provider>
</n-dialog-provider>
</n-config-provider>
<n-float-button :right="20" :bottom="20" shape="circle">
<n-icon>
<CashIcon />
</n-icon>
</n-float-button>
</template>

<script setup lang="ts">
import { lang } from '@/config';
import { useI18n } from 'vue-i18n';
import { BASE_URL } from '@/config';
import { onMounted } from 'vue';
import { useLogger } from '@/hooks/useLogger.ts';
import { storeToRefs } from 'pinia';
// todo)) 与新 Luna 进行联动
import { darkTheme } from 'naive-ui';
import { alovaInstance } from '@/api';
import { useGlobalStore } from '@/store/modules/global';
import { zhCN, dateZhCN } from 'naive-ui';
import { CashOutline as CashIcon } from '@vicons/ionicons5';

const { error } = useLogger('App');
const globalStore = useGlobalStore();
import { onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { storeToRefs } from 'pinia';
import { useLogger } from '@/hooks/useLogger.ts';
import { useGlobalStore } from '@/store/modules/global';

const { mergeLocaleMessage } = useI18n();
const { error } = useLogger('App');

const globalStore = useGlobalStore();
const { i18nLoaded } = storeToRefs(globalStore);

const setLanguage = async (lang: string): Promise<void> => {
Expand Down
4 changes: 1 addition & 3 deletions ui/src/components/Kubernetes/MainContent/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@ import ThemeConfig from '@/components/ThemeConfig/index.vue';
import CustomTerminal from '@/components/CustomTerminal/index.vue';
// import TabSuffix from '@/components/Kubernetes/MainContent/components/TabSuffix/index.vue';

// 引入 type
import { NMessageProvider, TabPaneProps, useDialog, useNotification } from 'naive-ui';

import type { Ref } from 'vue';
import type { ISettingProp, shareUser } from '@/views/interface';

// 引入 hook
import { useI18n } from 'vue-i18n';
import { v4 as uuidv4 } from 'uuid';
import { useMessage } from 'naive-ui';
Expand All @@ -79,7 +77,6 @@ import { useTreeStore } from '@/store/modules/tree.ts';
import { useParamsStore } from '@/store/modules/params.ts';
import { useTerminalStore } from '@/store/modules/terminal.ts';

// 创建消息和日志实例
const message = useMessage();
const { debug } = useLogger('K8s-CustomTerminal');

Expand Down Expand Up @@ -272,6 +269,7 @@ const onSocketData = (msgType: string, msg: any, terminal: Terminal) => {
}
case 'CLOSE': {
enableShare.value = false;

notification.error({
content: t('WebSocketClosed'),
duration: 50000
Expand Down
5 changes: 3 additions & 2 deletions ui/src/hooks/useTerminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,11 @@ export const useTerminal = async (el: HTMLElement, option: ICallbackOptions): Pr
break;
}
default: {
option.emitCallback &&
option.emitCallback('socketData', socketData.type, socketData, terminal);
break;
}
}

option.emitCallback && option.emitCallback('socketData', socketData.type, socketData, terminal);
};

/**
Expand Down
3 changes: 2 additions & 1 deletion ui/src/views/Connection/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,9 @@ const onSocketData = (msgType: string, msg: any, terminal: Terminal) => {
message.info(`${data.user} ${t('ResumeSession')}`);
break;
}
case 'ClOSE': {
case 'CLOSE': {
enableShare.value = false;

notification.error({
content: t('WebSocketClosed'),
duration: 50000
Expand Down
Loading