Skip to content

Commit

Permalink
UI - fix 401 on startup
Browse files Browse the repository at this point in the history
- documented tabHandler

Signed-off-by: thfries <thomas.fries0@gmail.com>
  • Loading branch information
thfries committed Nov 27, 2023
1 parent 2d6d55b commit 61eeb35
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 4 additions & 1 deletion ui/modules/operations/piggyback.ts
Expand Up @@ -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!';
Expand Down Expand Up @@ -57,6 +58,8 @@ let dom = {
responseStatus: null,
commandValidationElement: null,
headerValidationElement: null,
tabOperations: null,
collapseOperations: null,
}

document.getElementById('piggybackHTML').innerHTML = piggybackHTML;
Expand All @@ -72,7 +75,7 @@ export async function ready() {
Templates.setSelectedService(service);
}

await loadServicesAndInstances();
TabHandler(dom.tabOperations, dom.collapseOperations, loadServicesAndInstances, 'disableOperations');

initAceEditors();

Expand Down
10 changes: 6 additions & 4 deletions ui/modules/utils/tabHandler.ts
Expand Up @@ -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
*/

Expand Down

0 comments on commit 61eeb35

Please sign in to comment.