chore: Move open terminal in new tab to terminal component

This commit is contained in:
Justin Lin committed 2026-02-27 16:02:28 +11:00
1 parent ab4d06498a
commit 5b7bf0794c
12 files changed
+24 -19

No files matched your search

+2 -1
View File
@@ -144,4 +144,5 @@ dist
.pnp.*
#screenshots
tests/cypress/screenshots
tests/cypress/screenshots
services/cmd-hook/cmd-hook
+1 -1
View File
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { useRouter } from 'vue-router'
import { useToast } from 'vue-toastification'
import useSession from '../../store/session'
import { useSession } from '../../store/session'
import { openBugReport, openQuestSurvey } from '../../utils/formbricks'
const router = useRouter()
+1 -1
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import useSession from '../../store/session'
import { useSession } from '../../store/session'
import MarkdownText from '../MarkdownText.vue'
const sessionStore = useSession()
+1 -6
View File
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { computed } from 'vue'
import MarkdownText from '../MarkdownText.vue'
import useSession from '../../store/session'
import { useSession } from '../../store/session'
const sessionStore = useSession()
const tasks = computed(() => {
@@ -22,11 +22,6 @@ const tasks = computed(() => {
<div class="h-full w-full max-h-full">
<p id="topic" class="text-text font-black" v-if="sessionStore.quest">
{{ sessionStore.quest.title }}
<a
:href="`http://localhost/terminal/${sessionStore.session?.containerName}?token=${sessionStore.session?.token}`"
>
Open Terminal
</a>
</p>
<br />
<div>
+1 -1
View File
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { useToast } from 'vue-toastification'
import { computed } from 'vue'
import useSession from '../../store/session'
import { useSession } from '../../store/session'
const toast = useToast()
const sessionStore = useSession()
+11 -1
View File
@@ -1,6 +1,8 @@
<script setup lang="ts">
import { onMounted, onUnmounted, ref } from 'vue'
import { useTerminal } from '../../store/session'
import { useSession, useTerminal } from '../../store/session'
const sessionStore = useSession()
const terminal = ref<HTMLElement | null>(null)
const term = useTerminal()
@@ -23,6 +25,14 @@ onMounted(() => {
<div class="flex items-center gap-2 p-1">
<font-awesome-icon :icon="['fas', 'terminal']" class="text-text" />
<button id="Terminal" class="text-text">終端機</button>
<a
class="text-sm font-normal text-gray-200 ml-10"
:href="`/terminal/${sessionStore.session?.containerName}?token=${sessionStore.session?.token}`"
target="_blank"
>
Open Terminal in New Tab
</a>
</div>
<div
id="terminal"
+1 -1
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
import FileNode from '../FileNode.vue'
import useSession from '../../store/session'
import { useSession } from '../../store/session'
const sessionStore = useSession()
</script>
@@ -5,7 +5,7 @@ import { useToast } from 'vue-toastification'
import { logout } from '../../utils/auth'
import { trpc } from '../../utils/trpc'
import { openBugReport } from '../../utils/formbricks'
import useSession from '../../store/session'
import { useSession } from '../../store/session'
import useUserProfile from '../../store/userProfile'
const userStore = useUserProfile()
+1 -3
View File
@@ -34,7 +34,7 @@ interface Store {
quest: QuestDetailResponse | null
}
const useSession = defineStore('session', {
export const useSession = defineStore('session', {
state: (): Store => ({
session: null,
questId: '',
@@ -126,5 +126,3 @@ const useSession = defineStore('session', {
export function useTerminal() {
return term
}
export default useSession
+1 -1
View File
@@ -1,5 +1,5 @@
import formbricks from '@formbricks/js/website'
import useSession from '../store/session'
import { useSession } from '../store/session'
import useUserProfile from '../store/userProfile'
if (typeof window !== 'undefined') {
+1 -1
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { computed, onMounted, watch } from 'vue'
import useSession from '../store/session'
import { useSession } from '../store/session'
import useUserProfile from '../store/userProfile'
import HeaderPart from '../components/header/HeaderPart.vue'
import GameHeaderComponents from '../components/header/GameHeaderComponents.vue'
+2 -1
View File
@@ -8,6 +8,7 @@ import {
} from '../containers/docker.js'
import logger from '../utils/logger.js'
import { questManager } from './quest.js'
import config from '../config'
async function deactivateSessions(userId: string, quest: string) {
const sessions = await Session.find({
@@ -65,7 +66,7 @@ export async function createNewSession(
})
console.log('container', container.id)
console.log('containerName', `http://localhost/terminal/${containerName}`)
console.log('containerName', `${config.baseUrl}/terminal/${containerName}`)
const progress = userProfile.progress.get(quest.id)
if (!progress) {