Files
modeling-app/src/lib/commandBarConfigs/namedViewsConfig.ts

337 lines
11 KiB
TypeScript
Raw Normal View History

Move the wasm lib, and cleanup rust directory and all references (#5585) * git mv src/wasm-lib rust Signed-off-by: Jess Frazelle <github@jessfraz.com> * mv wasm-lib to workspace Signed-off-by: Jess Frazelle <github@jessfraz.com> * mv kcl-lib Signed-off-by: Jess Frazelle <github@jessfraz.com> * mv derive docs Signed-off-by: Jess Frazelle <github@jessfraz.com> * resolve file paths Signed-off-by: Jess Frazelle <github@jessfraz.com> * clippy Signed-off-by: Jess Frazelle <github@jessfraz.com> * move more shit Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix more paths Signed-off-by: Jess Frazelle <github@jessfraz.com> * make yarn build:wasm work Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix scripts Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixups Signed-off-by: Jess Frazelle <github@jessfraz.com> * better references Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix cargo ci Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix reference Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix more ci Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix tests Signed-off-by: Jess Frazelle <github@jessfraz.com> * cargo sort Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix script Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * fmt Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix a dep Signed-off-by: Jess Frazelle <github@jessfraz.com> * sort Signed-off-by: Jess Frazelle <github@jessfraz.com> * remove unused deps Signed-off-by: Jess Frazelle <github@jessfraz.com> * Revert "remove unused deps" This reverts commit fbabdb062e275fd5cbc1476f8480a1afee15d972. * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * deps; Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-01 13:59:01 -08:00
import { NamedView } from '@rust/kcl-lib/bindings/NamedView'
Feature: Named views (#5532) * feature: building skeleton for adding a viewpoint in frontend as well as rust with the settings toml * chore: named views loaded into memory * fix: testing code * chore: saving off progress, skeleton for listing and deleting named views * fix: fixed state stale dereferencing issue * feat: initial skeleton for loading view points * fix: pushing bug * fix: saving off progress * fix: trying to update to main? * fix: main fixes, API fixes * fix: what is happening * fix: ope * fix: implemented default values on serde * fix: pushing working dev code... need to clean it up * feature: adding no results found on filteroptions within an options input, not just command input bar level * fix: initial PR cleanup pass of junky code * fix: addressing comments in initial pass * fix: addressing PR comments * fix: moved modeling.namedViews to app.namedViews as per request * fix: _id and _version are now id and version. * fix: python codespell, perspective * fix: cargo fmt * fix: updating description of the named view commands * fix: removing testing code * fix: feature flag this to DEV only * fix: ts ignore for production engine api * fix: deep parital fights arrays and objects within settings, doing a namedview type predicate checking * fix: auto fixes * Remove unnecessary alias * Reword toast messages (more consistency) * fmt * cargo clippy * Fix Set appearance flakes * cargo test * fix: removing pub since the toml_stringify was refactored * fix: adding ignore this on user level * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * chore: Vec<NamedView> to HashMap<uuid::Uuid,NamedView> * fix: removing debugging code * chore: HashMap to IndexMap * fix: remove testing code --------- Co-authored-by: 49lf <ircsurfer33@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 15:37:25 -06:00
import { Command, CommandArgumentOption } from '../commandTypes'
import toast from 'react-hot-toast'
import { engineCommandManager } from 'lib/singletons'
import { uuidv4 } from 'lib/utils'
import { settingsActor, getSettings } from 'machines/appMachine'
import { err, reportRejection } from 'lib/trap'
import {
CameraViewState_type,
WorldCoordinateSystem_type,
} from '@kittycad/lib/dist/types/src/models'
function isWorldCoordinateSystemType(
x: string
): x is WorldCoordinateSystem_type {
return x === 'right_handed_up_z' || x === 'right_handed_up_y'
}
function namedViewToCameraViewState(
namedView: NamedView
): CameraViewState_type | Error {
const worldCoordinateSystem: string = namedView.world_coord_system
if (!isWorldCoordinateSystemType(worldCoordinateSystem)) {
return new Error('world coordinate system is not typed')
}
const cameraViewState: CameraViewState_type = {
eye_offset: namedView.eye_offset,
fov_y: namedView.fov_y,
ortho_scale_enabled: namedView.ortho_scale_enabled,
ortho_scale_factor: namedView.ortho_scale_factor,
world_coord_system: worldCoordinateSystem,
is_ortho: namedView.is_ortho,
pivot_position: namedView.pivot_position,
pivot_rotation: namedView.pivot_rotation,
}
return cameraViewState
}
function cameraViewStateToNamedView(
name: string,
cameraViewState: CameraViewState_type
): NamedView | Error {
let pivot_position: [number, number, number] | null = null
let pivot_rotation: [number, number, number, number] | null = null
if (cameraViewState.pivot_position.length === 3) {
pivot_position = [
cameraViewState.pivot_position[0],
cameraViewState.pivot_position[1],
cameraViewState.pivot_position[2],
]
} else {
return new Error(`invalid pivot position ${cameraViewState.pivot_position}`)
}
if (cameraViewState.pivot_rotation.length === 4) {
pivot_rotation = [
cameraViewState.pivot_rotation[0],
cameraViewState.pivot_rotation[1],
cameraViewState.pivot_rotation[2],
cameraViewState.pivot_rotation[3],
]
} else {
return new Error(`invalid pivot rotation ${cameraViewState.pivot_rotation}`)
}
// Create a new named view
const requestedView: NamedView = {
name,
eye_offset: cameraViewState.eye_offset,
fov_y: cameraViewState.fov_y,
ortho_scale_enabled: cameraViewState.ortho_scale_enabled,
ortho_scale_factor: cameraViewState.ortho_scale_factor,
world_coord_system: cameraViewState.world_coord_system,
is_ortho: cameraViewState.is_ortho,
pivot_position,
pivot_rotation,
// TS side knows about the version for the time being the version is not used for anything for now.
// Can be detected and cleaned up later if we have new version.
version: 1.0,
}
return requestedView
}
Feature: Named views (#5532) * feature: building skeleton for adding a viewpoint in frontend as well as rust with the settings toml * chore: named views loaded into memory * fix: testing code * chore: saving off progress, skeleton for listing and deleting named views * fix: fixed state stale dereferencing issue * feat: initial skeleton for loading view points * fix: pushing bug * fix: saving off progress * fix: trying to update to main? * fix: main fixes, API fixes * fix: what is happening * fix: ope * fix: implemented default values on serde * fix: pushing working dev code... need to clean it up * feature: adding no results found on filteroptions within an options input, not just command input bar level * fix: initial PR cleanup pass of junky code * fix: addressing comments in initial pass * fix: addressing PR comments * fix: moved modeling.namedViews to app.namedViews as per request * fix: _id and _version are now id and version. * fix: python codespell, perspective * fix: cargo fmt * fix: updating description of the named view commands * fix: removing testing code * fix: feature flag this to DEV only * fix: ts ignore for production engine api * fix: deep parital fights arrays and objects within settings, doing a namedview type predicate checking * fix: auto fixes * Remove unnecessary alias * Reword toast messages (more consistency) * fmt * cargo clippy * Fix Set appearance flakes * cargo test * fix: removing pub since the toml_stringify was refactored * fix: adding ignore this on user level * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * chore: Vec<NamedView> to HashMap<uuid::Uuid,NamedView> * fix: removing debugging code * chore: HashMap to IndexMap * fix: remove testing code --------- Co-authored-by: 49lf <ircsurfer33@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 15:37:25 -06:00
export function createNamedViewsCommand() {
// Creates a command to be registered in the command bar.
// The createNamedViewsCommand will prompt the user for a name and then
// hit the engine for the camera properties and write them back to disk
// in project.toml.
const createNamedViewCommand: Command = {
name: 'Create named view',
displayName: `Create named view`,
description:
'Saves a named view based on your current view to load again later',
groupId: 'namedViews',
icon: 'settings',
needsReview: false,
onSubmit: (data) => {
const invokeAndForgetCreateNamedView = async () => {
if (!data) {
return toast.error('Unable to create named view, missing name')
}
// Retrieve camera view state from the engine
const cameraGetViewResponse =
await engineCommandManager.sendSceneCommand({
type: 'modeling_cmd_req',
cmd_id: uuidv4(),
cmd: { type: 'default_camera_get_view' },
})
if (!(cameraGetViewResponse && 'resp' in cameraGetViewResponse)) {
return toast.error('Unable to create named view, websocket failure')
}
if ('modeling_response' in cameraGetViewResponse.resp.data) {
if (cameraGetViewResponse.success) {
if (
cameraGetViewResponse.resp.data.modeling_response.type ===
'default_camera_get_view'
) {
const view =
cameraGetViewResponse.resp.data.modeling_response.data
const requestedView = cameraViewStateToNamedView(
data.name,
view.view
)
if (err(requestedView)) {
toast.error('Unable to create named view.')
return
}
// Retrieve application state for namedViews
const namedViews = {
...settingsActor.getSnapshot().context.app.namedViews.current,
}
Feature: Named views (#5532) * feature: building skeleton for adding a viewpoint in frontend as well as rust with the settings toml * chore: named views loaded into memory * fix: testing code * chore: saving off progress, skeleton for listing and deleting named views * fix: fixed state stale dereferencing issue * feat: initial skeleton for loading view points * fix: pushing bug * fix: saving off progress * fix: trying to update to main? * fix: main fixes, API fixes * fix: what is happening * fix: ope * fix: implemented default values on serde * fix: pushing working dev code... need to clean it up * feature: adding no results found on filteroptions within an options input, not just command input bar level * fix: initial PR cleanup pass of junky code * fix: addressing comments in initial pass * fix: addressing PR comments * fix: moved modeling.namedViews to app.namedViews as per request * fix: _id and _version are now id and version. * fix: python codespell, perspective * fix: cargo fmt * fix: updating description of the named view commands * fix: removing testing code * fix: feature flag this to DEV only * fix: ts ignore for production engine api * fix: deep parital fights arrays and objects within settings, doing a namedview type predicate checking * fix: auto fixes * Remove unnecessary alias * Reword toast messages (more consistency) * fmt * cargo clippy * Fix Set appearance flakes * cargo test * fix: removing pub since the toml_stringify was refactored * fix: adding ignore this on user level * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * chore: Vec<NamedView> to HashMap<uuid::Uuid,NamedView> * fix: removing debugging code * chore: HashMap to IndexMap * fix: remove testing code --------- Co-authored-by: 49lf <ircsurfer33@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 15:37:25 -06:00
// Create and set namedViews application state
const uniqueUuidV4 = uuidv4()
const requestedNamedViews = {
...namedViews,
[uniqueUuidV4]: requestedView,
}
settingsActor.send({
type: `set.app.namedViews`,
data: {
level: 'project',
value: requestedNamedViews,
},
})
toast.success(`Named view ${requestedView.name} created.`)
}
Feature: Named views (#5532) * feature: building skeleton for adding a viewpoint in frontend as well as rust with the settings toml * chore: named views loaded into memory * fix: testing code * chore: saving off progress, skeleton for listing and deleting named views * fix: fixed state stale dereferencing issue * feat: initial skeleton for loading view points * fix: pushing bug * fix: saving off progress * fix: trying to update to main? * fix: main fixes, API fixes * fix: what is happening * fix: ope * fix: implemented default values on serde * fix: pushing working dev code... need to clean it up * feature: adding no results found on filteroptions within an options input, not just command input bar level * fix: initial PR cleanup pass of junky code * fix: addressing comments in initial pass * fix: addressing PR comments * fix: moved modeling.namedViews to app.namedViews as per request * fix: _id and _version are now id and version. * fix: python codespell, perspective * fix: cargo fmt * fix: updating description of the named view commands * fix: removing testing code * fix: feature flag this to DEV only * fix: ts ignore for production engine api * fix: deep parital fights arrays and objects within settings, doing a namedview type predicate checking * fix: auto fixes * Remove unnecessary alias * Reword toast messages (more consistency) * fmt * cargo clippy * Fix Set appearance flakes * cargo test * fix: removing pub since the toml_stringify was refactored * fix: adding ignore this on user level * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * chore: Vec<NamedView> to HashMap<uuid::Uuid,NamedView> * fix: removing debugging code * chore: HashMap to IndexMap * fix: remove testing code --------- Co-authored-by: 49lf <ircsurfer33@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 15:37:25 -06:00
}
}
}
invokeAndForgetCreateNamedView().catch(reportRejection)
},
args: {
name: {
required: true,
inputType: 'string',
},
},
}
// Given a named view selection from the command bar, this will
// find it in the setting state, remove it from the array and
// rewrite the project.toml settings to disk to delete the named view
const deleteNamedViewCommand: Command = {
name: 'Delete named view',
displayName: `Delete named view`,
description: 'Deletes the named view from settings',
groupId: 'namedViews',
icon: 'settings',
needsReview: false,
onSubmit: (data) => {
if (!data) {
return toast.error('Unable to delete named view, missing name')
}
const idToDelete = data.name
// Retrieve application state for namedViews
const namedViews = {
...settingsActor.getSnapshot().context.app.namedViews.current,
}
const { [idToDelete]: viewToDelete, ...rest } = namedViews
// Find the named view in the array
if (idToDelete && viewToDelete) {
// Update global state with the new computed state
settingsActor.send({
type: `set.app.namedViews`,
data: {
level: 'project',
value: rest,
},
})
toast.success(`Named view ${viewToDelete.name} removed.`)
} else {
toast.error(`Unable to delete, could not find the named view`)
}
},
args: {
name: {
required: true,
inputType: 'options',
options: (commandBar, machineContext) => {
const settings = getSettings()
Feature: Named views (#5532) * feature: building skeleton for adding a viewpoint in frontend as well as rust with the settings toml * chore: named views loaded into memory * fix: testing code * chore: saving off progress, skeleton for listing and deleting named views * fix: fixed state stale dereferencing issue * feat: initial skeleton for loading view points * fix: pushing bug * fix: saving off progress * fix: trying to update to main? * fix: main fixes, API fixes * fix: what is happening * fix: ope * fix: implemented default values on serde * fix: pushing working dev code... need to clean it up * feature: adding no results found on filteroptions within an options input, not just command input bar level * fix: initial PR cleanup pass of junky code * fix: addressing comments in initial pass * fix: addressing PR comments * fix: moved modeling.namedViews to app.namedViews as per request * fix: _id and _version are now id and version. * fix: python codespell, perspective * fix: cargo fmt * fix: updating description of the named view commands * fix: removing testing code * fix: feature flag this to DEV only * fix: ts ignore for production engine api * fix: deep parital fights arrays and objects within settings, doing a namedview type predicate checking * fix: auto fixes * Remove unnecessary alias * Reword toast messages (more consistency) * fmt * cargo clippy * Fix Set appearance flakes * cargo test * fix: removing pub since the toml_stringify was refactored * fix: adding ignore this on user level * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * chore: Vec<NamedView> to HashMap<uuid::Uuid,NamedView> * fix: removing debugging code * chore: HashMap to IndexMap * fix: remove testing code --------- Co-authored-by: 49lf <ircsurfer33@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 15:37:25 -06:00
const namedViews = {
...settings.app.namedViews.current,
Feature: Named views (#5532) * feature: building skeleton for adding a viewpoint in frontend as well as rust with the settings toml * chore: named views loaded into memory * fix: testing code * chore: saving off progress, skeleton for listing and deleting named views * fix: fixed state stale dereferencing issue * feat: initial skeleton for loading view points * fix: pushing bug * fix: saving off progress * fix: trying to update to main? * fix: main fixes, API fixes * fix: what is happening * fix: ope * fix: implemented default values on serde * fix: pushing working dev code... need to clean it up * feature: adding no results found on filteroptions within an options input, not just command input bar level * fix: initial PR cleanup pass of junky code * fix: addressing comments in initial pass * fix: addressing PR comments * fix: moved modeling.namedViews to app.namedViews as per request * fix: _id and _version are now id and version. * fix: python codespell, perspective * fix: cargo fmt * fix: updating description of the named view commands * fix: removing testing code * fix: feature flag this to DEV only * fix: ts ignore for production engine api * fix: deep parital fights arrays and objects within settings, doing a namedview type predicate checking * fix: auto fixes * Remove unnecessary alias * Reword toast messages (more consistency) * fmt * cargo clippy * Fix Set appearance flakes * cargo test * fix: removing pub since the toml_stringify was refactored * fix: adding ignore this on user level * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * chore: Vec<NamedView> to HashMap<uuid::Uuid,NamedView> * fix: removing debugging code * chore: HashMap to IndexMap * fix: remove testing code --------- Co-authored-by: 49lf <ircsurfer33@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 15:37:25 -06:00
}
const options: CommandArgumentOption<any>[] = []
Object.entries(namedViews).forEach(([key, view]) => {
if (view) {
options.push({
name: view.name,
isCurrent: false,
value: key,
})
}
})
return options
},
},
},
}
// Read the named view from settings state and pass that camera information to the engine command to set the view of the engine camera
const loadNamedViewCommand: Command = {
name: 'Load named view',
displayName: `Load named view`,
description: 'Loads your camera to the named view',
groupId: 'namedViews',
icon: 'settings',
needsReview: false,
onSubmit: (data) => {
const invokeAndForgetLoadNamedView = async () => {
if (!data) {
return toast.error('Unable to load named view')
}
// Retrieve application state for namedViews
const namedViews = {
...settingsActor.getSnapshot().context.app.namedViews.current,
}
const idToLoad = data.name
const viewToLoad = namedViews[idToLoad]
if (viewToLoad) {
// Split into the name and the engine data
const { name, version, ...engineViewData } = viewToLoad
const cameraViewState = namedViewToCameraViewState(viewToLoad)
if (err(cameraViewState)) {
toast.error(`Unable to load named view ${data.name}`)
return
}
Feature: Named views (#5532) * feature: building skeleton for adding a viewpoint in frontend as well as rust with the settings toml * chore: named views loaded into memory * fix: testing code * chore: saving off progress, skeleton for listing and deleting named views * fix: fixed state stale dereferencing issue * feat: initial skeleton for loading view points * fix: pushing bug * fix: saving off progress * fix: trying to update to main? * fix: main fixes, API fixes * fix: what is happening * fix: ope * fix: implemented default values on serde * fix: pushing working dev code... need to clean it up * feature: adding no results found on filteroptions within an options input, not just command input bar level * fix: initial PR cleanup pass of junky code * fix: addressing comments in initial pass * fix: addressing PR comments * fix: moved modeling.namedViews to app.namedViews as per request * fix: _id and _version are now id and version. * fix: python codespell, perspective * fix: cargo fmt * fix: updating description of the named view commands * fix: removing testing code * fix: feature flag this to DEV only * fix: ts ignore for production engine api * fix: deep parital fights arrays and objects within settings, doing a namedview type predicate checking * fix: auto fixes * Remove unnecessary alias * Reword toast messages (more consistency) * fmt * cargo clippy * Fix Set appearance flakes * cargo test * fix: removing pub since the toml_stringify was refactored * fix: adding ignore this on user level * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * chore: Vec<NamedView> to HashMap<uuid::Uuid,NamedView> * fix: removing debugging code * chore: HashMap to IndexMap * fix: remove testing code --------- Co-authored-by: 49lf <ircsurfer33@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 15:37:25 -06:00
// Only send the specific camera information, the NamedView itself
// is not directly compatible with the engine API
await engineCommandManager.sendSceneCommand({
type: 'modeling_cmd_req',
cmd_id: uuidv4(),
cmd: {
type: 'default_camera_set_view',
view: {
...cameraViewState,
Feature: Named views (#5532) * feature: building skeleton for adding a viewpoint in frontend as well as rust with the settings toml * chore: named views loaded into memory * fix: testing code * chore: saving off progress, skeleton for listing and deleting named views * fix: fixed state stale dereferencing issue * feat: initial skeleton for loading view points * fix: pushing bug * fix: saving off progress * fix: trying to update to main? * fix: main fixes, API fixes * fix: what is happening * fix: ope * fix: implemented default values on serde * fix: pushing working dev code... need to clean it up * feature: adding no results found on filteroptions within an options input, not just command input bar level * fix: initial PR cleanup pass of junky code * fix: addressing comments in initial pass * fix: addressing PR comments * fix: moved modeling.namedViews to app.namedViews as per request * fix: _id and _version are now id and version. * fix: python codespell, perspective * fix: cargo fmt * fix: updating description of the named view commands * fix: removing testing code * fix: feature flag this to DEV only * fix: ts ignore for production engine api * fix: deep parital fights arrays and objects within settings, doing a namedview type predicate checking * fix: auto fixes * Remove unnecessary alias * Reword toast messages (more consistency) * fmt * cargo clippy * Fix Set appearance flakes * cargo test * fix: removing pub since the toml_stringify was refactored * fix: adding ignore this on user level * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * chore: Vec<NamedView> to HashMap<uuid::Uuid,NamedView> * fix: removing debugging code * chore: HashMap to IndexMap * fix: remove testing code --------- Co-authored-by: 49lf <ircsurfer33@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 15:37:25 -06:00
},
},
})
const isPerpsective = !engineViewData.is_ortho
// Update the GUI for orthographic and projection
settingsActor.send({
type: 'set.modeling.cameraProjection',
data: {
level: 'user',
value: isPerpsective ? 'perspective' : 'orthographic',
},
})
// Update the camera by triggering the callback workflow to get the camera settings
// Setting the view won't update the client side camera.
// Asking for the default camera settings after setting the view will internally sync the camera
await engineCommandManager.sendSceneCommand({
type: 'modeling_cmd_req',
cmd_id: uuidv4(),
cmd: {
type: 'default_camera_get_settings',
},
})
Feature: Named views (#5532) * feature: building skeleton for adding a viewpoint in frontend as well as rust with the settings toml * chore: named views loaded into memory * fix: testing code * chore: saving off progress, skeleton for listing and deleting named views * fix: fixed state stale dereferencing issue * feat: initial skeleton for loading view points * fix: pushing bug * fix: saving off progress * fix: trying to update to main? * fix: main fixes, API fixes * fix: what is happening * fix: ope * fix: implemented default values on serde * fix: pushing working dev code... need to clean it up * feature: adding no results found on filteroptions within an options input, not just command input bar level * fix: initial PR cleanup pass of junky code * fix: addressing comments in initial pass * fix: addressing PR comments * fix: moved modeling.namedViews to app.namedViews as per request * fix: _id and _version are now id and version. * fix: python codespell, perspective * fix: cargo fmt * fix: updating description of the named view commands * fix: removing testing code * fix: feature flag this to DEV only * fix: ts ignore for production engine api * fix: deep parital fights arrays and objects within settings, doing a namedview type predicate checking * fix: auto fixes * Remove unnecessary alias * Reword toast messages (more consistency) * fmt * cargo clippy * Fix Set appearance flakes * cargo test * fix: removing pub since the toml_stringify was refactored * fix: adding ignore this on user level * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * chore: Vec<NamedView> to HashMap<uuid::Uuid,NamedView> * fix: removing debugging code * chore: HashMap to IndexMap * fix: remove testing code --------- Co-authored-by: 49lf <ircsurfer33@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 15:37:25 -06:00
toast.success(`Named view ${name} loaded.`)
} else {
toast.error(`Unable to load named view, could not find named view`)
}
}
invokeAndForgetLoadNamedView().catch(reportRejection)
},
args: {
name: {
required: true,
inputType: 'options',
options: () => {
const settings = getSettings()
Feature: Named views (#5532) * feature: building skeleton for adding a viewpoint in frontend as well as rust with the settings toml * chore: named views loaded into memory * fix: testing code * chore: saving off progress, skeleton for listing and deleting named views * fix: fixed state stale dereferencing issue * feat: initial skeleton for loading view points * fix: pushing bug * fix: saving off progress * fix: trying to update to main? * fix: main fixes, API fixes * fix: what is happening * fix: ope * fix: implemented default values on serde * fix: pushing working dev code... need to clean it up * feature: adding no results found on filteroptions within an options input, not just command input bar level * fix: initial PR cleanup pass of junky code * fix: addressing comments in initial pass * fix: addressing PR comments * fix: moved modeling.namedViews to app.namedViews as per request * fix: _id and _version are now id and version. * fix: python codespell, perspective * fix: cargo fmt * fix: updating description of the named view commands * fix: removing testing code * fix: feature flag this to DEV only * fix: ts ignore for production engine api * fix: deep parital fights arrays and objects within settings, doing a namedview type predicate checking * fix: auto fixes * Remove unnecessary alias * Reword toast messages (more consistency) * fmt * cargo clippy * Fix Set appearance flakes * cargo test * fix: removing pub since the toml_stringify was refactored * fix: adding ignore this on user level * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * chore: Vec<NamedView> to HashMap<uuid::Uuid,NamedView> * fix: removing debugging code * chore: HashMap to IndexMap * fix: remove testing code --------- Co-authored-by: 49lf <ircsurfer33@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 15:37:25 -06:00
const namedViews = {
...settings.app.namedViews.current,
Feature: Named views (#5532) * feature: building skeleton for adding a viewpoint in frontend as well as rust with the settings toml * chore: named views loaded into memory * fix: testing code * chore: saving off progress, skeleton for listing and deleting named views * fix: fixed state stale dereferencing issue * feat: initial skeleton for loading view points * fix: pushing bug * fix: saving off progress * fix: trying to update to main? * fix: main fixes, API fixes * fix: what is happening * fix: ope * fix: implemented default values on serde * fix: pushing working dev code... need to clean it up * feature: adding no results found on filteroptions within an options input, not just command input bar level * fix: initial PR cleanup pass of junky code * fix: addressing comments in initial pass * fix: addressing PR comments * fix: moved modeling.namedViews to app.namedViews as per request * fix: _id and _version are now id and version. * fix: python codespell, perspective * fix: cargo fmt * fix: updating description of the named view commands * fix: removing testing code * fix: feature flag this to DEV only * fix: ts ignore for production engine api * fix: deep parital fights arrays and objects within settings, doing a namedview type predicate checking * fix: auto fixes * Remove unnecessary alias * Reword toast messages (more consistency) * fmt * cargo clippy * Fix Set appearance flakes * cargo test * fix: removing pub since the toml_stringify was refactored * fix: adding ignore this on user level * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * chore: Vec<NamedView> to HashMap<uuid::Uuid,NamedView> * fix: removing debugging code * chore: HashMap to IndexMap * fix: remove testing code --------- Co-authored-by: 49lf <ircsurfer33@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 15:37:25 -06:00
}
const options: CommandArgumentOption<any>[] = []
Object.entries(namedViews).forEach(([key, view]) => {
if (view) {
options.push({
name: view.name,
isCurrent: false,
value: key,
})
}
})
return options
},
},
},
}
return {
createNamedViewCommand,
deleteNamedViewCommand,
loadNamedViewCommand,
}
}