-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update packages/webviz-core from internal repo (#658)
Changelog: - Co-authored-by: Chris Hasson <[email protected]>
- Loading branch information
Showing
82 changed files
with
5,130 additions
and
781 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// @flow | ||
// | ||
// Copyright (c) 2020-present, Cruise LLC | ||
// | ||
// 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. | ||
import fs from "fs"; | ||
import rmfr from "rmfr"; | ||
import uuid from "uuid"; | ||
|
||
import globalEnvVars from "./globalEnvVars"; | ||
|
||
export function makeTempDirectory() { | ||
const tmpDir = `${globalEnvVars.tempVideosDirectory}/__video-recording-tmp-${uuid.v4()}__`; | ||
fs.mkdirSync(tmpDir); | ||
return tmpDir; | ||
} | ||
|
||
// Executes the function passing in a new temp directory that will be automatically cleaned up afterwards. | ||
export async function withTempDirectory<T>(fn: (*) => Promise<T>): Promise<T> { | ||
const tmpDir = makeTempDirectory(); | ||
try { | ||
return await fn(tmpDir); | ||
} catch (error) { | ||
throw error; | ||
} finally { | ||
rmfr(tmpDir); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// @flow | ||
// | ||
// Copyright (c) 2021-present, Cruise LLC | ||
// | ||
// 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. | ||
import { applyPatchToLayout } from "webviz-core/src/actions/panels"; | ||
import { deflatePatch } from "webviz-core/src/util/layout"; | ||
import sendNotification from "webviz-core/src/util/sendNotification"; | ||
|
||
const DEFAULT_LAYOUT = { | ||
layout: "", | ||
savedProps: {}, | ||
globalVariables: {}, | ||
userNodes: {}, | ||
linkedGlobalVariables: [], | ||
playbackConfig: { speed: 0.1, messageOrder: "receiveTime", timeDisplayMethod: "ROS" }, | ||
}; | ||
|
||
describe("panels", () => { | ||
describe("applyPatchToLayout", () => { | ||
it("handles patches", () => { | ||
const patch = deflatePatch({ globalVariables: [{}, { foo: "bar" }] }); | ||
expect(applyPatchToLayout(patch, DEFAULT_LAYOUT)).toEqual({ | ||
...DEFAULT_LAYOUT, | ||
globalVariables: { foo: "bar" }, | ||
}); | ||
}); | ||
it("handles invalid patches", () => { | ||
applyPatchToLayout("abc", DEFAULT_LAYOUT); | ||
|
||
expect(sendNotification).toHaveBeenLastCalledWith(expect.any(String), expect.any(String), "app", "error"); | ||
sendNotification.expectCalledDuringTest(); | ||
}); | ||
}); | ||
}); |
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.