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

FIx bug of endpoint page #704

Merged
merged 4 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions frontend/src/components/endpoints/EndpointDetail.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="w-full bg-gray-25 pt-9 pb-[60px] xl:px-10 md:px-0 md:pb-6 md:h-auto">
<div class="w-full bg-[#FCFCFD] pt-9 pb-[60px] xl:px-10 md:px-0 md:pb-6 md:h-auto">
zzxr6 marked this conversation as resolved.
Show resolved Hide resolved
<div class="mx-auto max-w-[1280px]">
<repo-header
:private="endpoint.private"
Expand All @@ -25,7 +25,8 @@
:settingsVisibility="canManage"
:can-write="canWrite"
repo-type="endpoint"
:hardware="endpoint.hardware"
:clusterId="endpoint.cluster_id"
:sku="endpoint.sku"
:modelId="endpoint.model_id"
:private="endpoint.private"
:endpointReplica="endpoint.actual_replica"
Expand Down Expand Up @@ -96,7 +97,6 @@
const ownerUrl = computed(() => {
const { namespace } = modelInfo.value
if (!namespace) return ''

const baseUrl = namespace.Type === 'user' ? '/profile/' : '/organizations/'
return baseUrl + namespace.Path
})
Expand Down
29 changes: 27 additions & 2 deletions frontend/src/components/endpoints/EndpointPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<span>{{ $t('endpoints.detail.cloudResource')}}</span>
</p>
<p class="w-[390px] lg:w-[370px] mlg:w-full h-[35px] leading-[18px] text-gray-500 text-xs overflow-hidden text-ellipsis line-clamp-2 text-left">
{{ hardware }}
{{ resource.name }}
</p>
</div>

Expand All @@ -62,12 +62,15 @@
</template>

<script setup>
import { watch, ref } from 'vue'
import useFetchApi from '../../packs/useFetchApi'
import EndpointPlayground from './EndpointPlayground.vue'

const props = defineProps({
appEndpoint: String,
appStatus: String,
hardware: String,
clusterId: String,
sku: String,
modelId: String,
private: String,
replicaList: Array,
Expand All @@ -76,4 +79,26 @@
default: 0
}
})

const resource = ref({})
zzxr6 marked this conversation as resolved.
Show resolved Hide resolved

const fetchResources = async () => {
const { data, error } = await useFetchApi(`/space_resources?cluster_id=${props.clusterId}`).json()

if (error.value) {
ElMessage({
message: error.value.msg,
type: 'warning'
})
} else {
const body = data.value
resource.value = body.data.find((cloudResource) => {
return String(cloudResource.id) === props.sku
}) || {}
}
}

watch(() => props.clusterId, () => {
fetchResources()
})
</script>
4 changes: 3 additions & 1 deletion frontend/src/components/endpoints/EndpointSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,10 @@
return !!framework.frame_npu_image
} else if (currentResource.value.type === 'gpu') {
return !!framework.frame_image
} else {
} else if (currentResource.value.type === 'cpu') {
return !!framework.frame_cpu_image
} else {
return true
}
})
})
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/components/shared/RepoTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
:modelId="modelId"
:private="private"
:endpointReplica="endpointReplica"
:hardware="hardware"
:clusterId="clusterId"
:sku="sku"
:replicaList="replicaList"
/>
<repo-summary
Expand Down Expand Up @@ -280,7 +281,8 @@
sdk: String,
userName: String,
commitId: String,
hardware: String,
clusterId: String,
sku: String,
modelId: String,
private: Boolean,
endpointReplica: Number,
Expand Down
Loading