From db75bd90dd712fe47f9965ff8e5880688aa2c53b Mon Sep 17 00:00:00 2001 From: AronPerez Date: Fri, 10 Jan 2025 21:43:50 -0500 Subject: [PATCH] [DLT-1110] Fix update bug --- .../transfer/transfer-endpoint-manager.js | 27 ++++--------------- .../transfer/transfer-ui-manager.js | 5 ++-- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/web/static/components/transfer/transfer-endpoint-manager.js b/web/static/components/transfer/transfer-endpoint-manager.js index c461d239b..100d436a5 100644 --- a/web/static/components/transfer/transfer-endpoint-manager.js +++ b/web/static/components/transfer/transfer-endpoint-manager.js @@ -1,4 +1,4 @@ -import * as api from "../../api.js"; +import { epView, epAutocomplete } from "../../api.js"; import { dlgAlert } from "../../dialogs.js"; import { createMatchesHtml } from "./transfer-templates.js"; @@ -31,30 +31,13 @@ export class TransferEndpointManager { this.searchTokenIterator = 0; } - /** - * ------------GET------------ - */ - - /** - * Gets the status of an endpoint - * @param {Object} endpoint - The endpoint object - * @param {boolean} endpoint.activated - Whether the endpoint is activated - * @param {number} endpoint.expires_in - Time until expiration in seconds - * @returns {string} Status string indicating endpoint state - */ - getEndpointStatus(endpoint) { - if (!endpoint.activated && endpoint.expires_in === -1) return "active"; - if (endpoint.activated) return `${Math.floor(endpoint.expires_in / 3600)} hrs`; - return "inactive"; - } - /** * Performs autocomplete search for endpoints * @param {string} endpoint - The endpoint search term * @param {string} searchToken - Token to track current search request */ searchEndpointAutocomplete(endpoint, searchToken) { - api.epAutocomplete(endpoint, (ok, data) => { + epAutocomplete(endpoint, (ok, data) => { // Prevent race conditions by ignoring responses from outdated searches // Without this check, rapid typing could cause UI flickering and incorrect results // as slower API responses return after newer searches @@ -91,7 +74,7 @@ export class TransferEndpointManager { console.log("Searching for endpoint:", endpoint); try { - return api.epView(endpoint, (ok, data) => { + return epView(endpoint, (ok, data) => { if (searchToken !== this.currentSearchToken) { console.warn("Ignoring stale epView response"); return; @@ -155,8 +138,8 @@ export class TransferEndpointManager { return; } - const path = $("#path", this.#controller.uiManager.state.frame).val().trim(); - console.log("Processing path:", path); + const pathElement = $("#path", this.#controller.uiManager.state.frame); + const path = pathElement?.val()?.trim() || ''; if (!path.length) { console.log("Empty path - disabling endpoint"); diff --git a/web/static/components/transfer/transfer-ui-manager.js b/web/static/components/transfer/transfer-ui-manager.js index f96c67432..dc16fff36 100644 --- a/web/static/components/transfer/transfer-ui-manager.js +++ b/web/static/components/transfer/transfer-ui-manager.js @@ -561,11 +561,12 @@ export class TransferUIManager { */ handleTransfer() { const config = this.getTransferConfig(); + console.log('config', config); if (!config) return; - + console.log('this.#controller.model.mode', this.#controller.model.mode); if ( this.#controller.model.mode === TransferMode.TT_DATA_GET || - this.#controller.model.mode === TransferMode.TT_DATA_GET + this.#controller.model.mode === TransferMode.TT_DATA_PUT ) { this.startTransfer(config); } else {