More fixes related to rc-dock changes. #6479

This commit is contained in:
Aditya Toshniwal 2023-11-20 17:45:17 +05:30
parent d8bcc11a95
commit 19cbe8c39f
3 changed files with 24 additions and 24 deletions

View File

@ -79,7 +79,7 @@ function SQL({nodeData, node, treeNodeInfo, isActive, isStale, setIsStale}) {
gettext(e.response.data.errormsg)
);
// show failed message.
setNodeSQL([gettext('Failed to retrieve data from the server.'), true]);
setNodeSQL(gettext('Failed to retrieve data from the server.'));
setLoaderText('');
}).then(()=>{
setLoaderText('');

View File

@ -33,19 +33,16 @@ function TabTitle({id, closable, defaultInternal}) {
}, []);
useEffect(()=>{
let deregister;
if(internal.renamable) {
deregister = layoutDocker.eventBus.registerListener(LAYOUT_EVENTS.REFRESH_TITLE, _.debounce((panelId)=>{
if(panelId == id) {
const internal = layoutDocker?.find(id)?.internal??{};
setAttrs({
icon: internal.icon,
title: internal.title,
tooltip: internal.tooltip ?? internal.title,
});
}
}, 100));
}
const deregister = layoutDocker.eventBus.registerListener(LAYOUT_EVENTS.REFRESH_TITLE, _.debounce((panelId)=>{
if(panelId == id) {
const internal = layoutDocker?.find(id)?.internal??{};
setAttrs({
icon: internal.icon,
title: internal.title,
tooltip: internal.tooltip ?? internal.title,
});
}
}, 100));
return ()=>deregister?.();
}, []);

View File

@ -11,6 +11,7 @@ import React, { useContext, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { LayoutDockerContext, LAYOUT_EVENTS } from './Layout';
import { usePgAdmin } from '../../../static/js/BrowserComponent';
import ErrorBoundary from './ErrorBoundary';
export default function withStandardTabInfo(Component, tabId) {
// eslint-disable-next-line react/display-name
@ -63,16 +64,18 @@ export default function withStandardTabInfo(Component, tabId) {
}, []);
return (
<Component
{...props}
nodeItem={nodeItem}
nodeData={nodeData}
node={node}
treeNodeInfo={treeNodeInfo}
isActive={isActive}
isStale={isStale}
setIsStale={(v)=>setNodeInfo((prev)=>[v, prev[1], prev[2]])}
/>
<ErrorBoundary>
<Component
{...props}
nodeItem={nodeItem}
nodeData={nodeData}
node={node}
treeNodeInfo={treeNodeInfo}
isActive={isActive}
isStale={isStale}
setIsStale={(v)=>setNodeInfo((prev)=>[v, prev[1], prev[2]])}
/>
</ErrorBoundary>
);
};