Skip to content

Commit 5d0d7d7

Browse files
committed
added galaxy view, bug fixes for processors/benchmarks/economics/cores tables on SOC/GPU/CPU id pages, bug fixes for processor table add/delete, added FPGA to component search for processor table
1 parent b694e4b commit 5d0d7d7

25 files changed

+2583
-335
lines changed

components/Forms/CpuForm.vue

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@
553553
<script setup lang="js">
554554
import { ref, watch } from 'vue'
555555
import { useRuntimeConfig } from '#imports'
556+
import { getItemWithExpiry } from '@/lib/encrypter'
556557
// import { useRouter } from 'vue-router'
557558
558559
// const router = useRouter()
@@ -573,6 +574,16 @@ const props = defineProps({
573574
}
574575
})
575576
577+
const emit = defineEmits(['data-refreshed'])
578+
579+
// Helper function to get the authentication token
580+
const getAuthToken = () => {
581+
const token = getItemWithExpiry('encryptedJWTPDB')
582+
if (!token) {
583+
console.warn('[CpuForm] No authentication token found. User may need to log in again.')
584+
}
585+
return token || null
586+
}
576587
577588
// Reactive states for messages
578589
const successMessage = ref('')
@@ -889,7 +900,13 @@ const toggleHistory = () => {
889900
890901
// Cores functionality
891902
const cores = computed(() => {
892-
return props.cpuData?.cores || []
903+
const coresData = props.cpuData?.cores || []
904+
// #region agent log
905+
if (typeof fetch !== 'undefined') {
906+
fetch('http://127.0.0.1:7242/ingest/a2e5b876-28c3-4b64-9549-c4e9792dd0b0',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'CpuForm.vue:891',message:'Cores computed',data:{hasCpuData:!!props.cpuData,coresCount:coresData.length,coresIsArray:Array.isArray(coresData),coresData:coresData},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'F'})}).catch(()=>{});
907+
}
908+
// #endregion
909+
return coresData
893910
})
894911
895912
const showAddCoreForm = ref(false)
@@ -953,7 +970,7 @@ const submitCore = async () => {
953970
method,
954971
headers: {
955972
'Content-Type': 'application/json',
956-
'Authorization': `Bearer ${localStorage.getItem('token')}`
973+
'Authorization': `Bearer ${getAuthToken()}`
957974
},
958975
body: JSON.stringify({
959976
core_name: coreForm.value.core_name,
@@ -966,10 +983,11 @@ const submitCore = async () => {
966983
if (response.ok) {
967984
successMessage.value = `Core ${editingCore.value ? 'updated' : 'added'} successfully!`
968985
cancelCoreForm()
969-
// Refresh page to reload cores
970986
setTimeout(() => {
971-
window.location.reload()
972-
}, 1000)
987+
successMessage.value = ''
988+
}, 3000)
989+
// Emit event to refresh data without page reload
990+
emit('data-refreshed')
973991
} else {
974992
const errorData = await response.json()
975993
errorMessage.value = errorData.error || 'Failed to save core'
@@ -993,16 +1011,17 @@ const deleteCore = async (coreId) => {
9931011
const response = await fetch(`${useRuntimeConfig().public.backendUrl}/cpus/${cpuId}/cores/${coreId}`, {
9941012
method: 'DELETE',
9951013
headers: {
996-
'Authorization': `Bearer ${localStorage.getItem('token')}`
1014+
'Authorization': `Bearer ${getAuthToken()}`
9971015
}
9981016
})
9991017
10001018
if (response.ok) {
10011019
successMessage.value = 'Core deleted successfully!'
1002-
// Refresh page to reload cores
10031020
setTimeout(() => {
1004-
window.location.reload()
1005-
}, 1000)
1021+
successMessage.value = ''
1022+
}, 3000)
1023+
// Emit event to refresh data without page reload
1024+
emit('data-refreshed')
10061025
} else {
10071026
const errorData = await response.json()
10081027
errorMessage.value = errorData.error || 'Failed to delete core'

components/Forms/GpuForm.vue

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,7 @@
797797
<script setup lang="js">
798798
import { ref, watch } from 'vue'
799799
import { useRuntimeConfig } from '#imports'
800+
import { getItemWithExpiry } from '@/lib/encrypter'
800801
801802
const props = defineProps({
802803
gpuData: {
@@ -813,6 +814,17 @@ const props = defineProps({
813814
}
814815
})
815816
817+
const emit = defineEmits(['data-refreshed'])
818+
819+
// Helper function to get the authentication token
820+
const getAuthToken = () => {
821+
const token = getItemWithExpiry('encryptedJWTPDB')
822+
if (!token) {
823+
console.warn('[GpuForm] No authentication token found. User may need to log in again.')
824+
}
825+
return token || null
826+
}
827+
816828
const successMessage = ref('')
817829
const errorMessage = ref('')
818830
const isProcessorsExpanded = ref(true)
@@ -1099,7 +1111,13 @@ const redirectPage = (data) => {
10991111
11001112
// Cores functionality
11011113
const cores = computed(() => {
1102-
return props.gpuData?.cores || []
1114+
const coresData = props.gpuData?.cores || []
1115+
// #region agent log
1116+
if (typeof fetch !== 'undefined') {
1117+
fetch('http://127.0.0.1:7242/ingest/a2e5b876-28c3-4b64-9549-c4e9792dd0b0',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'GpuForm.vue:1101',message:'Cores computed',data:{hasGpuData:!!props.gpuData,coresCount:coresData.length,coresIsArray:Array.isArray(coresData),coresData:coresData},timestamp:Date.now(),sessionId:'debug-session',runId:'run1',hypothesisId:'F'})}).catch(()=>{});
1118+
}
1119+
// #endregion
1120+
return coresData
11031121
})
11041122
11051123
const showAddCoreForm = ref(false)
@@ -1163,7 +1181,7 @@ const submitCore = async () => {
11631181
method,
11641182
headers: {
11651183
'Content-Type': 'application/json',
1166-
'Authorization': `Bearer ${localStorage.getItem('token')}`
1184+
'Authorization': `Bearer ${getAuthToken()}`
11671185
},
11681186
body: JSON.stringify({
11691187
core_name: coreForm.value.core_name,
@@ -1176,10 +1194,11 @@ const submitCore = async () => {
11761194
if (response.ok) {
11771195
successMessage.value = `Core ${editingCore.value ? 'updated' : 'added'} successfully!`
11781196
cancelCoreForm()
1179-
// Refresh page to reload cores
11801197
setTimeout(() => {
1181-
window.location.reload()
1182-
}, 1000)
1198+
successMessage.value = ''
1199+
}, 3000)
1200+
// Emit event to refresh data without page reload
1201+
emit('data-refreshed')
11831202
} else {
11841203
const errorData = await response.json()
11851204
errorMessage.value = errorData.error || 'Failed to save core'
@@ -1203,16 +1222,17 @@ const deleteCore = async (coreId) => {
12031222
const response = await fetch(`${useRuntimeConfig().public.backendUrl}/gpus/${gpuId}/cores/${coreId}`, {
12041223
method: 'DELETE',
12051224
headers: {
1206-
'Authorization': `Bearer ${localStorage.getItem('token')}`
1225+
'Authorization': `Bearer ${getAuthToken()}`
12071226
}
12081227
})
12091228
12101229
if (response.ok) {
12111230
successMessage.value = 'Core deleted successfully!'
1212-
// Refresh page to reload cores
12131231
setTimeout(() => {
1214-
window.location.reload()
1215-
}, 1000)
1232+
successMessage.value = ''
1233+
}, 3000)
1234+
// Emit event to refresh data without page reload
1235+
emit('data-refreshed')
12161236
} else {
12171237
const errorData = await response.json()
12181238
errorMessage.value = errorData.error || 'Failed to delete core'

0 commit comments

Comments
 (0)