[CodeFactor] Apply fixes

This commit is contained in:
codefactor-io 2024-05-01 10:38:28 +00:00
parent 38427429dd
commit efff46b4eb
No known key found for this signature in database
GPG key ID: B66B2D63282C190F
4 changed files with 75 additions and 87 deletions

View file

@ -6,7 +6,7 @@ import chat_conversations from "./chat_conversations.vue";
import chat_messages from "./chat_messages.vue"; import chat_messages from "./chat_messages.vue";
import chat_new_message from "./chat_new_message.vue"; import chat_new_message from "./chat_new_message.vue";
import {getStationInfo} from "./../js/api"; import { getStationInfo } from "./../js/api";
import { setActivePinia } from "pinia"; import { setActivePinia } from "pinia";
import pinia from "../store/index"; import pinia from "../store/index";
@ -119,33 +119,30 @@ watch(
); );
const stationInfo = ref({ const stationInfo = ref({
callsign: 'N/A', // Default value for callsign callsign: "N/A", // Default value for callsign
location: { location: {
gridsquare: 'N/A', // Default value for gridsquare gridsquare: "N/A", // Default value for gridsquare
}, },
}); });
async function getStationInfoByCallsign(){ async function getStationInfoByCallsign() {
try { try {
const data = await getStationInfo(chat.selectedCallsign); const data = await getStationInfo(chat.selectedCallsign);
stationInfo.value = { stationInfo.value = {
callsign: data.callsign || 'N/A', // Default if not present callsign: data.callsign || "N/A", // Default if not present
location: { location: {
gridsquare: data.location?.gridsquare || 'N/A', // Default if not present gridsquare: data.location?.gridsquare || "N/A", // Default if not present
}, },
}; };
} catch (error) { } catch (error) {
console.error("Error fetching station info:", error); console.error("Error fetching station info:", error);
} }
} }
</script> </script>
<template> <template>
<!-- Station Info Modal -->
<!-- Station Info Modal --> <div
<div
class="modal fade" class="modal fade"
ref="modalEle" ref="modalEle"
id="stationInfoModal" id="stationInfoModal"
@ -162,16 +159,12 @@ async function getStationInfoByCallsign(){
data-bs-dismiss="modal" data-bs-dismiss="modal"
aria-label="Close" aria-label="Close"
></button> ></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>
<strong>Location:</strong> {{ stationInfo.location.gridsquare }}
</p>
<p><strong>Location:</strong> {{ stationInfo.location.gridsquare }}</p>
<p><strong>Details:</strong> {{ stationInfo.details }}</p> <p><strong>Details:</strong> {{ stationInfo.details }}</p>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@ -187,18 +180,19 @@ async function getStationInfoByCallsign(){
</div> </div>
</div> </div>
<div class="container-fluid d-flex p-0"> <div class="container-fluid d-flex p-0">
<!-- Chat Conversations --> <!-- Chat Conversations -->
<div class="bg-light p-0" style="width: 250px"> <div class="bg-light p-0" style="width: 250px">
<div class="container-fluid overflow-auto p-0"> <div class="container-fluid overflow-auto p-0">
<chat_conversations /> <chat_conversations />
</div> </div>
<div class="list-group overflow-auto" id="list-tab-chat" role="tablist"></div> <div
class="list-group overflow-auto"
id="list-tab-chat"
role="tablist"
></div>
</div> </div>
<!-- Chat Messages --> <!-- Chat Messages -->
<div class="flex-grow-1 border-start p-0"> <div class="flex-grow-1 border-start p-0">
<div class="d-flex flex-column"> <div class="d-flex flex-column">
@ -213,9 +207,6 @@ async function getStationInfoByCallsign(){
<h4 class="p-0 m-0">{{ chat.selectedCallsign }}</h4> <h4 class="p-0 m-0">{{ chat.selectedCallsign }}</h4>
</button> </button>
<div class="input-group mb-0 p-0 w-25"> <div class="input-group mb-0 p-0 w-25">
<button type="button" class="btn btn-outline-secondary" disabled> <button type="button" class="btn btn-outline-secondary" disabled>
Beacons Beacons

View file

@ -35,7 +35,6 @@ function newChat() {
if (callsign === "") return; if (callsign === "") return;
this.newChatCall.value = ""; this.newChatCall.value = "";
} }
</script> </script>
<template> <template>

View file

@ -211,7 +211,6 @@ const transmissionSpeedChartDataMessageInfo = computed(() => ({
</div> </div>
</div> </div>
<!-- Message Info Modal --> <!-- Message Info Modal -->
<div <div
class="modal fade" class="modal fade"

View file

@ -34,12 +34,11 @@ export async function processFreedataMessages(data) {
chatStore.callsign_list = createCallsignListFromAPI(data); chatStore.callsign_list = createCallsignListFromAPI(data);
chatStore.sorted_chat_list = createSortedMessagesList(data); chatStore.sorted_chat_list = createSortedMessagesList(data);
console.log(chatStore.sorted_chat_list) console.log(chatStore.sorted_chat_list);
// also update the selectedCallsign - if its undefined, then we select the first available callsign // also update the selectedCallsign - if its undefined, then we select the first available callsign
if (typeof chatStore.selectedCallsign == "undefined"){ if (typeof chatStore.selectedCallsign == "undefined") {
chatStore.selectedCallsign = Object.keys(chatStore.sorted_chat_list)[0] chatStore.selectedCallsign = Object.keys(chatStore.sorted_chat_list)[0];
} }
} }
} }