diff --git a/ui/modules/operations/piggyback.ts b/ui/modules/operations/piggyback.ts index 0586b98c27..06aad53c69 100644 --- a/ui/modules/operations/piggyback.ts +++ b/ui/modules/operations/piggyback.ts @@ -19,6 +19,7 @@ import * as Utils from '../utils.js'; import piggybackHTML from './piggyback.html'; import piggybackPlaceholders from './piggybackPlaceholders.json'; import * as Templates from './templates.js'; +import {TabHandler} from '../utils/tabHandler.js'; const EDITOR_INVALID_JSON_MNSSAGE = 'Invalid json!' const HEADER_IS_REQUIRED_MESSAGE = 'Headers field is required!'; @@ -57,6 +58,8 @@ let dom = { responseStatus: null, commandValidationElement: null, headerValidationElement: null, + tabOperations: null, + collapseOperations: null, } document.getElementById('piggybackHTML').innerHTML = piggybackHTML; @@ -72,7 +75,7 @@ export async function ready() { Templates.setSelectedService(service); } - await loadServicesAndInstances(); + TabHandler(dom.tabOperations, dom.collapseOperations, loadServicesAndInstances, 'disableOperations'); initAceEditors(); diff --git a/ui/modules/utils/tabHandler.ts b/ui/modules/utils/tabHandler.ts index c412d80b7c..0838e4f9bd 100644 --- a/ui/modules/utils/tabHandler.ts +++ b/ui/modules/utils/tabHandler.ts @@ -16,10 +16,12 @@ import * as Authorization from '../environments/authorization.js'; /** * Common behaviour of all main tabs. Handles refresh of a tab after the environmant was changed - * @param {Element} domTabItem - * @param {Element} domTabContent - * @param {function} onRefreshTab - * @param {string} envDisabledKey + * It tracks a flag if the environment was changed and does a lazy call to refresh the tab + * if needed. + * @param {Element} domTabItem Reference to tab item in dom + * @param {Element} domTabContent Reference to the tab content in dom + * @param {function} onRefreshTab Callback that is called if the tab is activated and environment has changed + * @param {string} envDisabledKey Key that is used in environment json to toggle the tab * @returns */