Small fixup for bottom right Settings button
This commit is contained in:
@ -92,7 +92,7 @@ export function LowerRightControls({
|
||||
<Link
|
||||
to={
|
||||
location.pathname.includes(paths.FILE)
|
||||
? filePath + paths.SETTINGS + '?tab=project'
|
||||
? (filePath + paths.SETTINGS + '?tab=project')
|
||||
: paths.HOME + paths.SETTINGS
|
||||
}
|
||||
>
|
||||
|
@ -20,7 +20,6 @@ import { paths } from 'lib/paths'
|
||||
import { useDotDotSlash } from 'hooks/useDotDotSlash'
|
||||
import { ForwardedRef, forwardRef, useEffect } from 'react'
|
||||
import { useLspContext } from 'components/LspProvider'
|
||||
import { ForwardedRef, forwardRef, useEffect } from 'react'
|
||||
|
||||
interface AllSettingsFieldsProps {
|
||||
searchParamTab: SettingsLevel
|
||||
|
@ -25,4 +25,5 @@ export const VITE_KC_DEV_TOKEN = import.meta.env.VITE_KC_DEV_TOKEN as
|
||||
export const TEST = import.meta.env.TEST
|
||||
// @ts-ignore
|
||||
export const DEV = import.meta.env.DEV
|
||||
// @ts-ignore
|
||||
export const CI = import.meta.env.CI
|
||||
|
@ -531,7 +531,8 @@ class EngineConnection extends EventTarget {
|
||||
* This will attempt the full handshake, and retry if the connection
|
||||
* did not establish.
|
||||
*/
|
||||
connect(reconnecting?: boolean) {
|
||||
connect(reconnecting?: boolean): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
if (this.isConnecting() || this.isReady()) {
|
||||
return
|
||||
}
|
||||
@ -915,85 +916,26 @@ class EngineConnection extends EventTarget {
|
||||
}
|
||||
this.websocket.addEventListener('error', this.onWebSocketError)
|
||||
|
||||
this.onWebSocketMessage = (event) => {
|
||||
// In the EngineConnection, we're looking for messages to/from
|
||||
// the server that relate to the ICE handshake, or WebRTC
|
||||
// negotiation. There may be other messages (including ArrayBuffer
|
||||
// messages) that are intended for the GUI itself, so be careful
|
||||
// when assuming we're the only consumer or that all messages will
|
||||
// be carefully formatted here.
|
||||
this.onWebSocketMessage = (event) => {
|
||||
// In the EngineConnection, we're looking for messages to/from
|
||||
// the server that relate to the ICE handshake, or WebRTC
|
||||
// negotiation. There may be other messages (including ArrayBuffer
|
||||
// messages) that are intended for the GUI itself, so be careful
|
||||
// when assuming we're the only consumer or that all messages will
|
||||
// be carefully formatted here.
|
||||
|
||||
if (typeof event.data !== 'string') {
|
||||
return
|
||||
}
|
||||
|
||||
const message: Models['WebSocketResponse_type'] = JSON.parse(event.data)
|
||||
|
||||
if (!message.success) {
|
||||
const errorsString = message?.errors
|
||||
?.map((error) => {
|
||||
return ` - ${error.error_code}: ${error.message}`
|
||||
})
|
||||
.join('\n')
|
||||
if (message.request_id) {
|
||||
const artifactThatFailed =
|
||||
this.engineCommandManager.artifactMap[message.request_id]
|
||||
console.error(
|
||||
`Error in response to request ${message.request_id}:\n${errorsString}
|
||||
failed cmd type was ${artifactThatFailed?.type}`
|
||||
)
|
||||
} else {
|
||||
console.error(`Error from server:\n${errorsString}`)
|
||||
if (typeof event.data !== 'string') {
|
||||
return
|
||||
}
|
||||
|
||||
const firstError = message?.errors[0]
|
||||
if (firstError.error_code === 'auth_token_invalid') {
|
||||
this.state = {
|
||||
type: EngineConnectionStateType.Disconnecting,
|
||||
value: {
|
||||
type: DisconnectingType.Error,
|
||||
value: {
|
||||
error: ConnectionError.BadAuthToken,
|
||||
context: firstError.message,
|
||||
},
|
||||
},
|
||||
}
|
||||
this.disconnectAll()
|
||||
}
|
||||
return
|
||||
}
|
||||
const message: Models['WebSocketResponse_type'] = JSON.parse(
|
||||
event.data
|
||||
)
|
||||
|
||||
let resp = message.resp
|
||||
|
||||
// If there's no body to the response, we can bail here.
|
||||
if (!resp || !resp.type) {
|
||||
return
|
||||
}
|
||||
|
||||
switch (resp.type) {
|
||||
case 'pong':
|
||||
this.pingPongSpan.pong = new Date()
|
||||
break
|
||||
case 'ice_server_info':
|
||||
let ice_servers = resp.data?.ice_servers
|
||||
|
||||
// Now that we have some ICE servers it makes sense
|
||||
// to start initializing the RTCPeerConnection. RTCPeerConnection
|
||||
// will begin the ICE process.
|
||||
createPeerConnection()
|
||||
|
||||
this.state = {
|
||||
type: EngineConnectionStateType.Connecting,
|
||||
value: {
|
||||
type: ConnectingType.PeerConnectionCreated,
|
||||
},
|
||||
}
|
||||
|
||||
// No ICE servers can be valid in a local dev. env.
|
||||
if (ice_servers?.length === 0) {
|
||||
console.warn('No ICE servers')
|
||||
this.pc?.setConfiguration({
|
||||
bundlePolicy: 'max-bundle',
|
||||
if (!message.success) {
|
||||
const errorsString = message?.errors
|
||||
?.map((error) => {
|
||||
return ` - ${error.error_code}: ${error.message}`
|
||||
})
|
||||
.join('\n')
|
||||
if (message.request_id) {
|
||||
@ -1206,6 +1148,7 @@ class EngineConnection extends EventTarget {
|
||||
this.onNetworkStatusReady
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
// Do not change this back to an object or any, we should only be sending the
|
||||
// WebSocketRequest type!
|
||||
|
@ -7,7 +7,7 @@ import { ProjectRoute } from 'wasm-lib/kcl/bindings/ProjectRoute'
|
||||
import { components } from './machine-api'
|
||||
import { isDesktop } from './isDesktop'
|
||||
import { FileEntry } from 'wasm-lib/kcl/bindings/FileEntry'
|
||||
import { SaveSettingsPayload } from 'lib/settings/settingsUtils'
|
||||
import { SaveSettingsPayload } from 'lib/settings/settingsTypes'
|
||||
|
||||
import {
|
||||
defaultAppSettings,
|
||||
@ -27,13 +27,17 @@ const DEFAULT_PROJECT_KCL_FILE = 'main.kcl'
|
||||
export async function listMachines(): Promise<{
|
||||
[key: string]: components['schemas']['Machine']
|
||||
}> {
|
||||
let machines: string = await invoke<string>('list_machines')
|
||||
return JSON.parse(machines)
|
||||
console.log("STUB")
|
||||
return {}
|
||||
// let machines: string = await invoke<string>('list_machines')
|
||||
// return JSON.parse(machines)
|
||||
}
|
||||
|
||||
// Get the machine-api ip address.
|
||||
export async function getMachineApiIp(): Promise<string | null> {
|
||||
return await invoke<string | null>('get_machine_api_ip')
|
||||
console.log("STUB")
|
||||
return null
|
||||
// return await invoke<string | null>('get_machine_api_ip')
|
||||
}
|
||||
|
||||
export async function renameProjectDirectory(
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { isDesktop } from './isDesktop'
|
||||
import { components } from './machine-api'
|
||||
import { getMachineApiIp, listMachines } from './tauri'
|
||||
import { getMachineApiIp, listMachines } from './desktop'
|
||||
|
||||
export class MachineManager {
|
||||
private _isDesktop: boolean = isDesktop()
|
||||
|
@ -83,8 +83,7 @@ export const fileLoader: LoaderFunction = async (
|
||||
const isBrowserProject = params.id === decodeURIComponent(BROWSER_PATH)
|
||||
|
||||
if (!isBrowserProject && projectPathData) {
|
||||
const { project_name, project_path, current_file_name, current_file_path } =
|
||||
projectPathData
|
||||
const { project_name, project_path, current_file_name, current_file_path } = projectPathData
|
||||
|
||||
const urlObj = new URL(routerData.request.url)
|
||||
let code = ''
|
||||
|
@ -3,7 +3,7 @@ import { onboardingPaths } from 'routes/Onboarding/paths'
|
||||
import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
|
||||
import { Themes, getSystemTheme } from 'lib/theme'
|
||||
import { bracket } from 'lib/exampleKcl'
|
||||
import { createAndOpenNewProject } from 'lib/tauriFS'
|
||||
import { createAndOpenNewProject } from 'lib/desktopFS'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { useNavigate, useRouteLoaderData } from 'react-router-dom'
|
||||
import { paths } from 'lib/paths'
|
||||
@ -17,9 +17,7 @@ import { useState } from 'react'
|
||||
import { createNewProjectDirectory, listProjects } from 'lib/desktop'
|
||||
import { IndexLoaderData } from 'lib/types'
|
||||
import { useFileContext } from 'hooks/useFileContext'
|
||||
import { paths } from 'lib/paths'
|
||||
import { useLspContext } from 'components/LspProvider'
|
||||
import { useState } from 'react'
|
||||
|
||||
/**
|
||||
* Show either a welcome screen or a warning screen
|
||||
|
50
yarn.lock
50
yarn.lock
@ -2360,11 +2360,6 @@
|
||||
dependencies:
|
||||
"@babel/types" "^7.20.7"
|
||||
|
||||
"@types/d3-force@^3.0.10":
|
||||
version "3.0.10"
|
||||
resolved "https://registry.yarnpkg.com/@types/d3-force/-/d3-force-3.0.10.tgz#6dc8fc6e1f35704f3b057090beeeb7ac674bff1a"
|
||||
integrity sha512-ZYeSaCF3p73RdOKcjj+swRlZfnYpK1EbaDiYICEEp5Q6sUiqFaFQ9qgoshp5CzIyyb/yD09kD9o2zEltCexlgw==
|
||||
|
||||
"@types/cacheable-request@^6.0.1":
|
||||
version "6.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/cacheable-request/-/cacheable-request-6.0.3.tgz#a430b3260466ca7b5ca5bfd735693b36e7a9d183"
|
||||
@ -2375,6 +2370,18 @@
|
||||
"@types/node" "*"
|
||||
"@types/responselike" "^1.0.0"
|
||||
|
||||
"@types/d3-force@^3.0.10":
|
||||
version "3.0.10"
|
||||
resolved "https://registry.yarnpkg.com/@types/d3-force/-/d3-force-3.0.10.tgz#6dc8fc6e1f35704f3b057090beeeb7ac674bff1a"
|
||||
integrity sha512-ZYeSaCF3p73RdOKcjj+swRlZfnYpK1EbaDiYICEEp5Q6sUiqFaFQ9qgoshp5CzIyyb/yD09kD9o2zEltCexlgw==
|
||||
|
||||
"@types/electron@^1.6.10":
|
||||
version "1.6.10"
|
||||
resolved "https://registry.yarnpkg.com/@types/electron/-/electron-1.6.10.tgz#7e87888ed3888767cca68e92772c2c8ea46bc873"
|
||||
integrity sha512-MOCVyzIwkBEloreoCVrTV108vSf8fFIJPsGruLCoAoBZdxtnJUqKA4lNonf/2u1twSjAspPEfmEheC+TLm/cMw==
|
||||
dependencies:
|
||||
electron "*"
|
||||
|
||||
"@types/eslint@^8.4.5":
|
||||
version "8.56.11"
|
||||
resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.56.11.tgz#e2ff61510a3b9454b3329fe7731e3b4c6f780041"
|
||||
@ -3839,30 +3846,6 @@ csstype@^3.0.2:
|
||||
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
|
||||
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==
|
||||
|
||||
"d3-dispatch@1 - 3":
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/d3-dispatch/-/d3-dispatch-3.0.1.tgz#5fc75284e9c2375c36c839411a0cf550cbfc4d5e"
|
||||
integrity sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==
|
||||
|
||||
d3-force@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/d3-force/-/d3-force-3.0.0.tgz#3e2ba1a61e70888fe3d9194e30d6d14eece155c4"
|
||||
integrity sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==
|
||||
dependencies:
|
||||
d3-dispatch "1 - 3"
|
||||
d3-quadtree "1 - 3"
|
||||
d3-timer "1 - 3"
|
||||
|
||||
"d3-quadtree@1 - 3":
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/d3-quadtree/-/d3-quadtree-3.0.1.tgz#6dca3e8be2b393c9a9d514dabbd80a92deef1a4f"
|
||||
integrity sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==
|
||||
|
||||
"d3-timer@1 - 3":
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/d3-timer/-/d3-timer-3.0.1.tgz#6284d2a2708285b1abb7e201eda4380af35e63b0"
|
||||
integrity sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==
|
||||
|
||||
damerau-levenshtein@^1.0.8:
|
||||
version "1.0.8"
|
||||
resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz#b43d286ccbd36bc5b2f7ed41caf2d0aba1f8a6e7"
|
||||
@ -4172,7 +4155,7 @@ electron-winstaller@^5.3.0:
|
||||
optionalDependencies:
|
||||
"@electron/windows-sign" "^1.1.2"
|
||||
|
||||
electron@^31.2.1:
|
||||
electron@*, electron@^31.2.1:
|
||||
version "31.3.1"
|
||||
resolved "https://registry.yarnpkg.com/electron/-/electron-31.3.1.tgz#de5f21f10db1ba0568e0cdd7ae76ec40a4b800c3"
|
||||
integrity sha512-9fiuWlRhBfygtcT+auRd/WdBK/f8LZZcrpx0RjpXhH2DPTP/PfnkC4JB1PW55qCbGbh4wAgkYbf4ExIag8oGCA==
|
||||
@ -8293,7 +8276,7 @@ string_decoder@~1.1.1:
|
||||
dependencies:
|
||||
ansi-regex "^5.0.1"
|
||||
|
||||
strip-ansi@^7.0.1, strip-ansi@^7.1.0:
|
||||
strip-ansi@^7.0.1:
|
||||
version "7.1.0"
|
||||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
|
||||
integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==
|
||||
@ -9132,11 +9115,6 @@ word-wrap@^1.2.3, word-wrap@^1.2.5:
|
||||
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34"
|
||||
integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==
|
||||
|
||||
workerpool@6.2.1:
|
||||
version "6.2.1"
|
||||
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
|
||||
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==
|
||||
|
||||
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
|
||||
|
Reference in New Issue
Block a user