mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-17 20:51:55 +01:00
fix long tab names and syncing tab renaming (#1160)
This commit is contained in:
parent
be5d73af21
commit
b746a0bfb6
@ -140,6 +140,7 @@ function initGlobalAtoms(initOpts: GlobalInitOptions) {
|
|||||||
return connStatuses;
|
return connStatuses;
|
||||||
});
|
});
|
||||||
const flashErrorsAtom = atom<FlashErrorType[]>([]);
|
const flashErrorsAtom = atom<FlashErrorType[]>([]);
|
||||||
|
const reinitVersion = atom(0);
|
||||||
atoms = {
|
atoms = {
|
||||||
// initialized in wave.ts (will not be null inside of application)
|
// initialized in wave.ts (will not be null inside of application)
|
||||||
clientId: clientIdAtom,
|
clientId: clientIdAtom,
|
||||||
@ -159,6 +160,7 @@ function initGlobalAtoms(initOpts: GlobalInitOptions) {
|
|||||||
modalOpen,
|
modalOpen,
|
||||||
allConnStatus: allConnStatusAtom,
|
allConnStatus: allConnStatusAtom,
|
||||||
flashErrors: flashErrorsAtom,
|
flashErrors: flashErrorsAtom,
|
||||||
|
reinitVersion,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,10 @@
|
|||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
text-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25);
|
text-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25);
|
||||||
|
overflow: hidden;
|
||||||
|
width: calc(100% - 10px);
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
&.focused {
|
&.focused {
|
||||||
outline: none;
|
outline: none;
|
||||||
@ -76,6 +80,12 @@
|
|||||||
|
|
||||||
&:hover .close {
|
&:hover .close {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
|
backdrop-filter: blur(3px);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: var(--main-text-color);
|
||||||
|
// background-color: var(--highlight-bg-color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,11 +96,6 @@ const ConfigErrorIcon = ({ buttonRef }: { buttonRef: React.RefObject<HTMLElement
|
|||||||
Config Error
|
Config Error
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
return (
|
|
||||||
<div className="config-error" ref={buttonRef as React.RefObject<HTMLDivElement>}>
|
|
||||||
<i className="fa fa-solid fa-exclamation-triangle" />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const TabBar = React.memo(({ workspace }: TabBarProps) => {
|
const TabBar = React.memo(({ workspace }: TabBarProps) => {
|
||||||
@ -254,6 +249,13 @@ const TabBar = React.memo(({ workspace }: TabBarProps) => {
|
|||||||
debounce(100, () => saveTabsPosition())();
|
debounce(100, () => saveTabsPosition())();
|
||||||
}, [tabIds, newTabId, isFullScreen]);
|
}, [tabIds, newTabId, isFullScreen]);
|
||||||
|
|
||||||
|
const reinitVersion = useAtomValue(atoms.reinitVersion);
|
||||||
|
useEffect(() => {
|
||||||
|
if (reinitVersion > 0) {
|
||||||
|
setSizeAndPosition();
|
||||||
|
}
|
||||||
|
}, [reinitVersion]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.addEventListener("resize", () => handleResizeTabs());
|
window.addEventListener("resize", () => handleResizeTabs());
|
||||||
return () => {
|
return () => {
|
||||||
|
1
frontend/types/custom.d.ts
vendored
1
frontend/types/custom.d.ts
vendored
@ -24,6 +24,7 @@ declare global {
|
|||||||
modalOpen: jotai.PrimitiveAtom<boolean>;
|
modalOpen: jotai.PrimitiveAtom<boolean>;
|
||||||
allConnStatus: jotai.Atom<ConnStatus[]>;
|
allConnStatus: jotai.Atom<ConnStatus[]>;
|
||||||
flashErrors: jotai.PrimitiveAtom<FlashErrorType[]>;
|
flashErrors: jotai.PrimitiveAtom<FlashErrorType[]>;
|
||||||
|
reinitVersion: jotai.PrimitiveAtom<number>;
|
||||||
};
|
};
|
||||||
|
|
||||||
type WritableWaveObjectAtom<T extends WaveObj> = jotai.WritableAtom<T, [value: T], void>;
|
type WritableWaveObjectAtom<T extends WaveObj> = jotai.WritableAtom<T, [value: T], void>;
|
||||||
|
@ -85,11 +85,22 @@ async function reinitWave() {
|
|||||||
getApi().sendLog("Reinit Wave");
|
getApi().sendLog("Reinit Wave");
|
||||||
const client = await WOS.reloadWaveObject<Client>(WOS.makeORef("client", savedInitOpts.clientId));
|
const client = await WOS.reloadWaveObject<Client>(WOS.makeORef("client", savedInitOpts.clientId));
|
||||||
const waveWindow = await WOS.reloadWaveObject<WaveWindow>(WOS.makeORef("window", savedInitOpts.windowId));
|
const waveWindow = await WOS.reloadWaveObject<WaveWindow>(WOS.makeORef("window", savedInitOpts.windowId));
|
||||||
await WOS.reloadWaveObject<Workspace>(WOS.makeORef("workspace", waveWindow.workspaceid));
|
const ws = await WOS.reloadWaveObject<Workspace>(WOS.makeORef("workspace", waveWindow.workspaceid));
|
||||||
const initialTab = await WOS.reloadWaveObject<Tab>(WOS.makeORef("tab", savedInitOpts.tabId));
|
const initialTab = await WOS.reloadWaveObject<Tab>(WOS.makeORef("tab", savedInitOpts.tabId));
|
||||||
await WOS.reloadWaveObject<LayoutState>(WOS.makeORef("layout", initialTab.layoutstate));
|
await WOS.reloadWaveObject<LayoutState>(WOS.makeORef("layout", initialTab.layoutstate));
|
||||||
|
reloadAllWorkspaceTabs(ws);
|
||||||
document.title = `Wave Terminal - ${initialTab.name}`; // TODO update with tab name change
|
document.title = `Wave Terminal - ${initialTab.name}`; // TODO update with tab name change
|
||||||
getApi().setWindowInitStatus("wave-ready");
|
getApi().setWindowInitStatus("wave-ready");
|
||||||
|
globalStore.set(atoms.reinitVersion, globalStore.get(atoms.reinitVersion) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function reloadAllWorkspaceTabs(ws: Workspace) {
|
||||||
|
if (ws == null || ws.tabids == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ws.tabids.forEach((tabid) => {
|
||||||
|
WOS.reloadWaveObject<Tab>(WOS.makeORef("tab", tabid));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadAllWorkspaceTabs(ws: Workspace) {
|
function loadAllWorkspaceTabs(ws: Workspace) {
|
||||||
|
Loading…
Reference in New Issue
Block a user