-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for synchronizing navigation across split panes.
- Allow users to sync navigation by node id, or upload a data json file to specify node id mapping. When user selects one node in one side of the pane, the node with mapped id will be automatically selected in another pane. - Allow visualizer component user to pass mapping data through visualizer config. PiperOrigin-RevId: 682822429
- Loading branch information
1 parent
cdcd675
commit 557efd5
Showing
22 changed files
with
902 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/ui/src/components/visualizer/common/sync_navigation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* @license | ||
* Copyright 2024 The Model Explorer Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* ============================================================================== | ||
*/ | ||
|
||
import {TaskData, TaskType} from './task'; | ||
|
||
/** The data for navigation syncing. */ | ||
export interface SyncNavigationData extends TaskData { | ||
type: TaskType.SYNC_NAVIGATION; | ||
|
||
mapping: SyncNavigationMapping; | ||
} | ||
|
||
/** | ||
* The mapping for navigation syncing, from node id from one side to node id | ||
* from another side. | ||
*/ | ||
export type SyncNavigationMapping = Record<string, string>; | ||
|
||
/** The mode of navigation syncing. */ | ||
export enum SyncNavigationMode { | ||
DISABLED = 'disabled', | ||
MATCH_NODE_ID = 'match_node_id', | ||
VISUALIZER_CONFIG = 'visualizer_config', | ||
UPLOAD_MAPPING_FROM_COMPUTER = 'from_computer', | ||
LOAD_MAPPING_FROM_CNS = 'from_cns', | ||
} | ||
|
||
/** The labels for sync navigation modes. */ | ||
export const SYNC_NAVIGATION_MODE_LABELS = { | ||
[SyncNavigationMode.DISABLED]: 'Disabled', | ||
[SyncNavigationMode.MATCH_NODE_ID]: 'Match node id', | ||
[SyncNavigationMode.UPLOAD_MAPPING_FROM_COMPUTER]: | ||
'Upload mapping from computer', | ||
[SyncNavigationMode.LOAD_MAPPING_FROM_CNS]: 'Load mapping from CNS', | ||
[SyncNavigationMode.VISUALIZER_CONFIG]: 'From Visualizer Config', | ||
}; | ||
|
||
/** Information about the source of navigation. */ | ||
export interface NavigationSourceInfo { | ||
paneIndex: number; | ||
nodeId: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* @license | ||
* Copyright 2024 The Model Explorer Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* ============================================================================== | ||
*/ | ||
|
||
/** The base data for a task. */ | ||
export declare interface TaskData { | ||
type: TaskType; | ||
} | ||
|
||
/** The type of a task. */ | ||
export enum TaskType { | ||
SYNC_NAVIGATION = 'sync_navigation', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.