Connections Typeahead Additional Fixes (#1457)

This commit is contained in:
Sylvie Crowe 2024-12-10 11:13:15 -08:00 committed by GitHub
parent f1a590f51b
commit 0174adea7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 7 deletions

View File

@ -637,7 +637,7 @@ const ChangeConnectionBlockModal = React.memo(
const connStatusMap = new Map<string, ConnStatus>(); const connStatusMap = new Map<string, ConnStatus>();
const fullConfig = jotai.useAtomValue(atoms.fullConfigAtom); const fullConfig = jotai.useAtomValue(atoms.fullConfigAtom);
const connectionsConfig = fullConfig.connections; const connectionsConfig = fullConfig.connections;
let filterOutNowsh = util.useAtomValueSafe(viewModel.filterOutNowsh) || true; let filterOutNowsh = util.useAtomValueSafe(viewModel.filterOutNowsh) ?? true;
let maxActiveConnNum = 1; let maxActiveConnNum = 1;
for (const conn of allConnStatus) { for (const conn of allConnStatus) {
@ -706,9 +706,6 @@ const ChangeConnectionBlockModal = React.memo(
} }
const filteredList: Array<string> = []; const filteredList: Array<string> = [];
for (const conn of connList) { for (const conn of connList) {
if (conn === connSelected) {
createNew = false;
}
if ( if (
conn.includes(connSelected) && conn.includes(connSelected) &&
connectionsConfig?.[conn]?.["display:hidden"] != true && connectionsConfig?.[conn]?.["display:hidden"] != true &&
@ -716,13 +713,13 @@ const ChangeConnectionBlockModal = React.memo(
// != false is necessary because of defaults // != false is necessary because of defaults
) { ) {
filteredList.push(conn); filteredList.push(conn);
if (conn === connSelected) {
createNew = false;
}
} }
} }
const filteredWslList: Array<string> = []; const filteredWslList: Array<string> = [];
for (const conn of wslList) { for (const conn of wslList) {
if (conn === connSelected) {
createNew = false;
}
if ( if (
conn.includes(connSelected) && conn.includes(connSelected) &&
connectionsConfig?.[conn]?.["display:hidden"] != true && connectionsConfig?.[conn]?.["display:hidden"] != true &&
@ -730,6 +727,9 @@ const ChangeConnectionBlockModal = React.memo(
// != false is necessary because of defaults // != false is necessary because of defaults
) { ) {
filteredWslList.push(conn); filteredWslList.push(conn);
if (conn === connSelected) {
createNew = false;
}
} }
} }
// priority handles special suggestions when necessary // priority handles special suggestions when necessary

View File

@ -733,6 +733,10 @@ func GetConnectionsFromInternalConfig() []string {
var internalNames []string var internalNames []string
config := wconfig.ReadFullConfig() config := wconfig.ReadFullConfig()
for internalName := range config.Connections { for internalName := range config.Connections {
if strings.HasPrefix(internalName, "wsl://") {
// don't add wsl conns to this list
continue
}
internalNames = append(internalNames, internalName) internalNames = append(internalNames, internalName)
} }
return internalNames return internalNames