Skip to content

Commit

Permalink
Update packages/webviz-core from internal repo (cruise-automation#673)
Browse files Browse the repository at this point in the history
* Update packages/webviz-core from internal repo

Changelog:
-

* Update react-router and react-router-dom to 5.2.1 and 5.3.0

Co-authored-by: Chris Hasson <[email protected]>
  • Loading branch information
hassoncs and hassoncs authored Sep 23, 2021
1 parent 3c7fe5d commit 4ed917d
Show file tree
Hide file tree
Showing 96 changed files with 1,476 additions and 2,666 deletions.
835 changes: 171 additions & 664 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
"react-hot-loader": "4.8.2",
"react-live": "^1.12.0",
"react-monaco-editor": "0.36.0",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"react-router": "5.2.1",
"react-router-dom": "5.3.0",
"react-svg-loader": "^2.1.0",
"react-virtualized-select": "^3.1.3",
"redux-devtools-extension": "^2.13.7",
Expand Down
4 changes: 2 additions & 2 deletions packages/webviz-core/migrations/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
// This source code is licensed under the Apache License, Version 2.0,
// found in the LICENSE file in the root directory of this source tree.
// You may not use this file except in compliance with the License.
export const CURRENT_LAYOUT_VERSION = 18;
export const THREE_DIMENSIONAL_SAVED_PROPS_VERSION = 17;
export const CURRENT_LAYOUT_VERSION = 19;
export const THREE_DIMENSIONAL_SAVED_PROPS_VERSION = 19;
2 changes: 1 addition & 1 deletion packages/webviz-core/migrations/frozenHelpers.sha
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
0ac345204bcb8845749bd69ea6ff98dfd9018b76 ./webviz-core/migrations/frozenHelpers/getPanelIdWithNewType.js
534696ba8c013571cc2415c68f971b3e68cdb8f4 ./webviz-core/migrations/frozenHelpers/getPanelTypeFromId.js
6c9820bd0ac1e464c9bbff0f478d8f766cbee23b ./webviz-core/migrations/frozenHelpers/incrementVersion.js
6981fd08e48800992202a437e5c46de3b8040e0e ./webviz-core/migrations/frozenHelpers/migrate3dPanelCheckedKeys.js
f7bc42ed3f065e3ced57786608c205717b8cdfc5 ./webviz-core/migrations/frozenHelpers/migrate3dPanelCheckedKeys.js
e149101e77462fe27cf20d79800b512b774a6b01 ./webviz-core/migrations/frozenHelpers/migrate3dPanelCheckedKeys.test.js
26510ef12123b4c7bb6e2ce09625ba32e6ff2b2e ./webviz-core/migrations/frozenHelpers/migrateConfigFieldName.js
9ef1379e84ccef68f08b925cfa8b1039d112e9fd ./webviz-core/migrations/frozenHelpers/migratePanelType.js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import type { TopicTreeConfig } from "webviz-core/migrations/frozenMigrations/2020.05.06.00:00:03.migrate3DPanel";

const SECOND_SOURCE_PREFIX = "/webviz_source_2";
const $WEBVIZ_SOURCE_2 = "/webviz_source_2";
const ROOT_NAME = "name:root";
const ROOT_2_NAME = "name_2:root";
const UNCATEGORIZED_NAME = "name:(Uncategorized)";
Expand All @@ -24,7 +24,7 @@ export const makePredecessorRelations = (topicTree: TopicTreeConfig): Map<string
throw new Error(`Duplicate key ${key1}. Migration won't work.`);
}
relations.set(`t:${key1}`, `name:${key2}`);
relations.set(`t:${SECOND_SOURCE_PREFIX}${key1}`, `name_2:${key2}`);
relations.set(`t:${$WEBVIZ_SOURCE_2}${key1}`, `name_2:${key2}`);
} else {
if (relations.has(`name:${key1}`)) {
throw new Error(`Duplicate key ${key1}. Migration won't work.`);
Expand Down Expand Up @@ -59,9 +59,7 @@ export const visibleTopicKeys = (predecessors: Map<string, string>, checkedKeys:
const isVisible = (key): boolean => {
// - Not in the topic tree, with "name:(Uncategorized)" checked.
if (!predecessors.has(key)) {
const uncategorizedGroup = key.startsWith(`t:${SECOND_SOURCE_PREFIX}`)
? UNCATEGORIZED_2_NAME
: UNCATEGORIZED_NAME;
const uncategorizedGroup = key.startsWith(`t:${$WEBVIZ_SOURCE_2}`) ? UNCATEGORIZED_2_NAME : UNCATEGORIZED_NAME;
return checkedKeys.has(uncategorizedGroup);
}
// - In the topic-tree with all ancestors checked.
Expand Down Expand Up @@ -89,15 +87,15 @@ export const visibleTopicKeys = (predecessors: Map<string, string>, checkedKeys:
const migrateCheckedKeys = (
oldTopicTree: TopicTreeConfig,
newTopicTree: TopicTreeConfig,
checkedKeys: $ReadOnlyArray<string>,
checkedKeys: $ReadOnlyArray<?string>,
getWantedVisibleTopicKeys: (Set<string>) => Set<string>
): string[] => {
// Goal: Any topic that was visible before should stay visible. Any topic that was not visible
// before should not be visible after.
//
// Find the topic keys that were visible before.
const oldPredecessors = makePredecessorRelations(oldTopicTree);
const oldCheckedKeys = new Set(checkedKeys);
const oldCheckedKeys = new Set(checkedKeys.filter(Boolean));
const oldVisibleTopicKeys = visibleTopicKeys(oldPredecessors, oldCheckedKeys);
// Find the topics that we want to be visible after (in case new topics are added etc.)
const wantedVisibleTopicKeys = getWantedVisibleTopicKeys(oldVisibleTopicKeys);
Expand All @@ -112,7 +110,7 @@ const migrateCheckedKeys = (
break;
}
if (iterKey == null) {
const uncategorizedGroup = topicKey.startsWith(`t:${SECOND_SOURCE_PREFIX}`)
const uncategorizedGroup = topicKey.startsWith(`t:${$WEBVIZ_SOURCE_2}`)
? UNCATEGORIZED_2_NAME
: UNCATEGORIZED_NAME;
newCheckedKeys.add(uncategorizedGroup);
Expand Down
2 changes: 1 addition & 1 deletion packages/webviz-core/migrations/frozenMigrations.sha
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ccad8c55a86776ab4c959888892697155ef77aa8 ./webviz-core/migrations/frozenMigrati
d583ffb94d816bce9ecf555f466813abd4348c7d ./webviz-core/migrations/frozenMigrations/2020.05.06.00:00:03.migrate3DPanel.test.js
2e36b076614b28e9dad4f3a656cc2c12116bf2f5 ./webviz-core/migrations/frozenMigrations/2020.05.06.00:00:04.migrateGlobalDataToGlobalVariables.js
cefcfbad95bd282c3e7f72b373a2e0394e8297a6 ./webviz-core/migrations/frozenMigrations/2020.05.06.00:00:05.migrateSourcePrefix.js
edce816a09dbc93e93f06aaf8b211bc15615f904 ./webviz-core/migrations/frozenMigrations/2020.05.14.13:39:17.migrate3DPanelFeatureGroupKeys.js
f03b50c98a717628fd173c8cf130fc91e10f71ed ./webviz-core/migrations/frozenMigrations/2020.05.14.13:39:17.migrate3DPanelFeatureGroupKeys.js
c46f7288766bd7aa026f77d65d41e013d312162d ./webviz-core/migrations/frozenMigrations/2020.05.14.13:39:17.migrate3DPanelFeatureGroupKeys.test.js
ab684bfcf2ce591d974613ee8c07c56490970d20 ./webviz-core/migrations/frozenMigrations/2020.06.01.11:34:51.migrate3DPanelPointCloudHexColors.js
7bfac30079a4947418f37b730306ed36d117b6c6 ./webviz-core/migrations/frozenMigrations/2020.06.01.11:34:51.migrate3DPanelPointCloudHexColors.test.js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export type TreeTopicNode = {|
export type TreeNode = TreeGroupNode | TreeTopicNode;

const UNCATEGORIZED_KEY = "name:(Uncategorized)";
const SECOND_SOURCE_PREFIX = "/webviz_source_2";
const $WEBVIZ_SOURCE_2 = "/webviz_source_2";

function generateNodeKey({
topicName,
Expand All @@ -57,11 +57,7 @@ function generateNodeKey({
namespace?: ?string,
isFeatureColumn?: boolean,
|}): string {
const prefixedTopicName = topicName
? isFeatureColumn
? `${SECOND_SOURCE_PREFIX}${topicName}`
: topicName
: undefined;
const prefixedTopicName = topicName ? (isFeatureColumn ? `${$WEBVIZ_SOURCE_2}${topicName}` : topicName) : undefined;
if (namespace) {
if (prefixedTopicName) {
return `ns:${prefixedTopicName}:${namespace}`;
Expand Down Expand Up @@ -107,7 +103,7 @@ export function generateTreeNode(
featureKey,
topicName,
availableByColumn: hasFeatureColumn
? [availableTopicsNamesSet.has(topicName), availableTopicsNamesSet.has(`${SECOND_SOURCE_PREFIX}${topicName}`)]
? [availableTopicsNamesSet.has(topicName), availableTopicsNamesSet.has(`${$WEBVIZ_SOURCE_2}${topicName}`)]
: [availableTopicsNamesSet.has(topicName)],
providerAvailable,
...(parentKey ? { parentKey } : undefined),
Expand Down Expand Up @@ -163,7 +159,7 @@ export function migrateToFeatureGroupCheckedKeys(checkedKeys: string[], topicTre
// Find checked feature topics and add their ancestor nodes to the newCheckedKeys.
const newCheckedKeys = [...checkedKeys];
const checkedFeatureTopicKeys = checkedKeys
.map((key) => (key.includes(SECOND_SOURCE_PREFIX) ? key.replace(SECOND_SOURCE_PREFIX, "") : undefined))
.map((key) => (key.includes($WEBVIZ_SOURCE_2) ? key.replace($WEBVIZ_SOURCE_2, "") : undefined))
.filter(Boolean);

const rootTreeNode = generateTreeNode(topicTreeConfig, {
Expand Down
1 change: 1 addition & 0 deletions packages/webviz-core/migrations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const migrationsByVersion = {
"016": [],
"017": [],
"018": [],
"019": [],
};

export default function migratePanels(originalPanelsState: any): any {
Expand Down
Loading

0 comments on commit 4ed917d

Please sign in to comment.