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() { function transmitNewMessage() {
// Check if a callsign is selected, default to the first one if not // Check if a callsign is selected, default to the first one if not
if (typeof(chat.selectedCallsign) === 'undefined') { if (typeof(chat.selectedCallsign) === 'undefined') {
@ -110,15 +114,12 @@ function transmitNewMessage() {
// Cleanup after sending message // Cleanup after sending message
chat.inputText = ''; chat.inputText = '';
chatModuleMessage.value = ""; chatModuleMessage.value = "";
selectedFiles.value = []; // Clear selected files after sending resetFile()
// Reset any other states or UI elements as necessary
} }
function resetFile(event){ function resetFile(event){
if (fileInput.value) { //fileInput.reset()
fileInput.value = ''; // Attempt to clear by setting value to empty (may not work due to security restrictions in browsers) fileInput.value = null
}
// Clear the selected files array to reset the state of attachments // Clear the selected files array to reset the state of attachments
selectedFiles.value = []; selectedFiles.value = [];
@ -296,6 +297,8 @@ const speedChartData = computed(() => ({
<!-- Hidden file input --> <!-- Hidden file input -->
<input type="file" multiple ref="fileInput" @change="handleFileSelection" style="display: none;" /> <input type="file" multiple ref="fileInput" @change="handleFileSelection" style="display: none;" />
</div> </div>
<div class="container-fluid px-0"> <div class="container-fluid px-0">
@ -321,18 +324,6 @@ const speedChartData = computed(() => ({
</div> </div>
</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" /> <Line :data="speedChartData" />
--> -->

View file

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