Skip to content

Commit

Permalink
Fixbug/exp envs (#69)
Browse files Browse the repository at this point in the history
* fix: env bug

* fix: ui
  • Loading branch information
Feudalman authored Nov 24, 2024
1 parent 10d39c8 commit f4cd4a1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<EnvGroups :title="$t('experiment.env.groups.apple')">
<div class="w-full py-5 flex-col space-y-5">
<h1 class="flex items-center gap-2 font-semibold">{{ $t('experiment.env.groups.apple') }}</h1>
<EnvItem env-key="brand" :env-value="data.type" />
<EnvItem env-key="cpu" :env-value="data.cpu" />
<EnvItem env-key="memory" :env-value="data.memory + 'GB'" />
</EnvGroups>
</div>
</template>

<script setup>
import EnvGroups from '@swanlab-vue/views/experiment/pages/environment/components/EnvGroup.vue'
import EnvItem from '@swanlab-vue/views/experiment/pages/environment/components/EnvItem.vue'
defineProps({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export const getHardwareData = (exp) => {
apple: system.soc?.apple,
cpu: parseCPUInfo(system),
memory: parseMemoryInfo(system),
gpu: gpu.type ? gpu : null,
nvidia: gpu.nvidia
gpu: gpu?.type ? gpu : null,
nvidia: gpu?.nvidia
}
}

Expand Down
18 changes: 14 additions & 4 deletions vue/src/views/experiment/pages/environment/pages/EnvHardware.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<div class="w-full border p-6 rounded-lg bg-default" v-if="data">
<div class="w-full border p-6 rounded-lg bg-default" v-if="isShow">
<h1 class="w-full text-xl font-semibold pb-4 border-b">{{ $t('experiment.env.title.hardware') }}</h1>
<AppleChip :data="data.apple" v-if="isApple" />
<EnvGroup :title="$t('experiment.env.groups.cpu')" :data="data.cpu" v-if="data.cpu && !isApple" />
<EnvGroup :data="data.memory" v-if="data.memory && !isApple" />
<EnvGroup :title="$t('experiment.env.groups.cpu')" :data="data.cpu" v-if="hasCPU && !isApple" />
<EnvGroup :data="data.memory" v-if="hasMem && !isApple" />
<NvidiaGpu :data="data.nvidia" type="nvidia" v-if="data.nvidia" />
<NvidiaGpu :data="data.gpu" type="gpu" v-else />
<NvidiaGpu :data="data.gpu" type="gpu" v-else-if="data.gpu" />
</div>
<div v-else>
<p class="text-center pt-5">{{ $t('experiment.env.empty.hardware') }}</p>
Expand All @@ -29,6 +29,16 @@ const { experiment } = useExperimentStore()
// 系统硬件信息
const data = computed(() => getHardwareData(experiment))
const isApple = computed(() => data.value?.apple)
// 是否有基础信息
const hasData = (target) => {
if (!target) return false
return target?.filter((item) => item.value).length > 0
}
const hasCPU = computed(() => hasData(data.value.cpu))
const hasMem = computed(() => hasData(data.value.memory))
const isShow = computed(() => {
return data.value.apple || hasCPU.value || hasMem.value || data.value.gpu
})
</script>
<style lang="scss" scoped></style>
6 changes: 3 additions & 3 deletions vue/src/views/experiment/pages/log/LogPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
</div>
<!-- 没有日志 -->
<div
class="w-full py-10 flex flex-col items-center text-lg font-semibold"
class="w-full py-10 flex justify-center items-center gap-2 font-semibold"
v-if="logs.length === 0 && errorLogs.length === 0"
>
<SLIcon class="magnifier" icon="search"></SLIcon>
<span>{{ $t('experiment.empty_log') }}</span>
<SLIcon class="size-5" icon="search"></SLIcon>
<span class="text-base">{{ $t('experiment.empty_log') }}</span>
</div>
</div>
<div class="flex h-full items-center justify-center" v-else>
Expand Down

0 comments on commit f4cd4a1

Please sign in to comment.