file input fixes

This commit is contained in:
DJ2LS 2024-02-06 21:05:57 +01:00
parent f526a9adb3
commit 01e4385c40
2 changed files with 12 additions and 19 deletions

View file

@ -75,6 +75,10 @@ function handleFileSelection(event) {
}
}
function removeFile(index) {
selectedFiles.value.splice(index, 1);
}
function transmitNewMessage() {
// Check if a callsign is selected, default to the first one if not
if (typeof(chat.selectedCallsign) === 'undefined') {
@ -110,15 +114,12 @@ function transmitNewMessage() {
// Cleanup after sending message
chat.inputText = '';
chatModuleMessage.value = "";
selectedFiles.value = []; // Clear selected files after sending
// Reset any other states or UI elements as necessary
resetFile()
}
function resetFile(event){
if (fileInput.value) {
fileInput.value = ''; // Attempt to clear by setting value to empty (may not work due to security restrictions in browsers)
}
//fileInput.reset()
fileInput.value = null
// Clear the selected files array to reset the state of attachments
selectedFiles.value = [];
@ -296,6 +297,8 @@ const speedChartData = computed(() => ({
<!-- Hidden file input -->
<input type="file" multiple ref="fileInput" @change="handleFileSelection" style="display: none;" />
</div>
<div class="container-fluid px-0">
@ -321,18 +324,6 @@ const speedChartData = computed(() => ({
</div>
</div>
<hr>
<div class="btn-group me-2" role="group" aria-label="Basic outlined example">
<button type="button" class="btn btn-secondary">total size</button>
<button type="button" class="btn btn-secondary disabled">{{chat.inputFileSize}} {{totalSizeFormatted}}</button>
</div>
<!--
<Line :data="speedChartData" />
-->

View file

@ -38,7 +38,9 @@ function createCallsignListFromAPI(data: {
}): { [key: string]: { timestamp: string; body: string } } {
const callsignList: { [key: string]: { timestamp: string; body: string } } =
{};
if( typeof(data) == 'undefined'){
return false
}
data.messages.forEach((message) => {
let callsign =
message.direction === "receive" ? message.origin : message.destination;