Skip to content

Commit

Permalink
[DLT-1110] Fix update bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AronPerez committed Jan 11, 2025
1 parent c99d09d commit db75bd9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
27 changes: 5 additions & 22 deletions web/static/components/transfer/transfer-endpoint-manager.js
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
5 changes: 3 additions & 2 deletions web/static/components/transfer/transfer-ui-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit db75bd9

Please sign in to comment.