Skip to content
3 changes: 2 additions & 1 deletion app/common/public/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,5 +291,6 @@
"AccessToken": "AccessToken",
"Token": "Token",
"Key": "Key",
"Secret": "Secret"
"Secret": "Geheimnis",
"Close tab": "Tab schließen"
}
3 changes: 2 additions & 1 deletion app/common/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,5 +291,6 @@
"AccessToken": "AccessToken",
"Token": "Token",
"Key": "Key",
"Secret": "Secret"
"Secret": "Secret",
"Close tab": "Close tab"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is enough to only add English resources. localized resources are synchronized automatically to crowdin as soon as the PR is merged and should not be changed manually.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only kept English resources

}
3 changes: 2 additions & 1 deletion app/common/public/locales/es-ES/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,5 +291,6 @@
"AccessToken": "AccessToken",
"Token": "Token",
"Key": "Key",
"Secret": "Secret"
"Secret": "Secreto",
"Close tab": "Cerrar pestaña"
}
3 changes: 2 additions & 1 deletion app/common/public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,5 +291,6 @@
"AccessToken": "AccessToken",
"Token": "Token",
"Key": "Key",
"Secret": "Secret"
"Secret": "Secret",
"Close tab": "Fermer l'onglet"
}
3 changes: 2 additions & 1 deletion app/common/public/locales/ja/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,5 +291,6 @@
"AccessToken": "AccessToken",
"Token": "Token",
"Key": "Key",
"Secret": "Secret"
"Secret": "シークレット",
"Close tab": "タブを閉じる"
}
3 changes: 2 additions & 1 deletion app/common/public/locales/ko/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,5 +291,6 @@
"AccessToken": "AccessToken",
"Token": "Token",
"Key": "Key",
"Secret": "Secret"
"Secret": "시크릿",
"Close tab": "탭 닫기"
}
3 changes: 2 additions & 1 deletion app/common/public/locales/ru/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,5 +291,6 @@
"AccessToken": "AccessToken",
"Token": "Token",
"Key": "Key",
"Secret": "Secret"
"Secret": "Секрет",
"Close tab": "Закрыть вкладку"
}
203 changes: 101 additions & 102 deletions app/common/public/locales/zh-CN/translation.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion app/common/public/locales/zh-TW/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,5 +291,6 @@
"AccessToken": "AccessToken",
"Token": "Token",
"Key": "Key",
"Secret": "Secret"
"Secret": "密鑰",
"Close tab": "關閉標籤頁"
}
50 changes: 38 additions & 12 deletions app/common/renderer/components/Session/Session.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import {Badge, Button, Dropdown, Spin, Tabs} from 'antd';

Check failure on line 1 in app/common/renderer/components/Session/Session.jsx

View workflow job for this annotation

GitHub Actions / Lint & Format

Run autofix to sort these imports!
import {LinkOutlined} from '@ant-design/icons';
import {Badge, Button, Spin, Tabs} from 'antd';
import _ from 'lodash';
import {useEffect} from 'react';
import {useNavigate} from 'react-router';

import {ADD_CLOUD_PROVIDER_TAB_KEY, SERVER_TYPES, SESSION_BUILDER_TABS} from '../../constants/session-builder';
import {BUTTON} from '../../constants/antd-types';
import {LINKS} from '../../constants/common';
import {
ADD_CLOUD_PROVIDER_TAB_KEY,
SERVER_TYPES,
SESSION_BUILDER_TABS,
} from '../../constants/session-builder';
import {ipcRenderer, openLink} from '../../polyfills';
import {log} from '../../utils/logger';
import AdvancedServerParams from './AdvancedServerParams.jsx';
Expand All @@ -24,11 +20,12 @@

const Session = (props) => {
const {
tabKey,
switchTabs,
serverType,
setServerType,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No such function exists. You probably wanted to use changeServerType

server,
visibleProviders = [],
removeVisibleProvider,
caps,
capsUUID,
capsName,
Expand All @@ -45,7 +42,7 @@

const navigate = useNavigate();

const isAttaching = tabKey === 'attach';
const isAttaching = serverType === 'attach';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this was changed. tabKey is used for session builder tabs, but serverType is used for the server type tabs.


const handleSelectServerTab = async (tab) => {
const {changeServerType, addCloudProvider} = props;
Expand All @@ -62,14 +59,38 @@
}
};

const getContextMenu = (tabKey) => ({
items: [
{
key: 'closeTab',
label: t('Close tab'),
onClick: () => handleCloseTab(tabKey),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this action will also trigger handleSelectServerTab, which will try to select the same tab that was just removed

disabled: tabKey === SERVER_TYPES.REMOTE
}
]
});

const handleContextMenu = (e) => {
e.preventDefault();
e.stopPropagation();
};

const handleCloseTab = (tabKey) => {
if (tabKey !== SERVER_TYPES.REMOTE) {
removeVisibleProvider(tabKey);
if (serverType === tabKey) {
setServerType(SERVER_TYPES.REMOTE);
}
}
};

useEffect(() => {
const {
setLocalServerParams,
getSavedSessions,
setSavedServerParams,
initFromSessionFile,
setStateFromSessionFile,
setVisibleProviders,
bindWindowClose,
initFromQueryString,
saveSessionAsFile,
Expand All @@ -79,7 +100,6 @@
bindWindowClose();
switchTabs(SESSION_BUILDER_TABS.CAPS_BUILDER);
await getSavedSessions();
await setVisibleProviders();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why this was removed?

await setSavedServerParams();
await setLocalServerParams();
initFromQueryString(loadNewSession);
Expand Down Expand Up @@ -114,7 +134,13 @@
return true;
}
return {
label: <div>{provider.tabhead()}</div>,
label: (
<Dropdown menu={getContextMenu(providerName)} trigger={['contextMenu']}>
<div onContextMenu={(e) => handleContextMenu(e)}>
{provider.tabhead()}
</div>
</Dropdown>
),
key: providerName,
children: provider.tab(props),
};
Expand All @@ -129,7 +155,7 @@
</div>

<Tabs
activeKey={tabKey}
activeKey={serverType}
onChange={switchTabs}
className={SessionStyles.scrollingTabCont}
items={[
Expand Down
Loading