Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
"@sentry/electron": "4.0.0",
"@sentry/tracing": "7.10.0",
"@sentry/webpack-plugin": "1.18.8",
"@sentry/webpack-plugin": "1.20.0",
"@storybook/addon-actions": "6.5.10",
"@storybook/addon-essentials": "6.5.10",
"@storybook/builder-webpack5": "6.5.10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,37 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/

import { PanelsState } from "@foxglove/studio-base/context/CurrentLayoutContext/actions";
import { defaultPlaybackConfig } from "@foxglove/studio-base/providers/CurrentLayoutProvider/reducers";

/**
* This is loaded when the user has no layout selected on application launch
* to avoid presenting the user with a blank layout.
*/
export const defaultLayout: PanelsState = {
configById: {
"3D!18i6zy7": {
layers: {
"845139cb-26bc-40b3-8161-8ab60af4baf5": {
visible: true,
frameLocked: true,
label: "Grid",
instanceId: "845139cb-26bc-40b3-8161-8ab60af4baf5",
layerId: "foxglove.Grid",
size: 10,
divisions: 10,
lineWidth: 1,
color: "#248eff",
position: [0, 0, 0],
rotation: [0, 0, 0],
order: 1,
},
},
},
"RawMessages!os6rgs": {},
"ImageViewPanel!3mnp456": {},
"configById": {
"Plot!3fa5k5u": {
"title": "Plot",
"paths": [
{
"value": "/topic.data",
"enabled": true,
"timestampMethod": "receiveTime"
}
],
"showXAxisLabels": true,
"showYAxisLabels": true,
"showLegend": true,
"legendDisplay": "floating",
"showPlotValuesInLegend": false,
"isSynced": true,
"xAxisVal": "timestamp",
"sidebarDimension": 240
}
},
globalVariables: {},
userNodes: {},
linkedGlobalVariables: [],
playbackConfig: { ...defaultPlaybackConfig },
layout: {
first: "3D!18i6zy7",
second: {
first: "ImageViewPanel!3mnp456",
second: "RawMessages!os6rgs",
direction: "column",
splitPercentage: 30,
},
direction: "row",
splitPercentage: 70,
"globalVariables": {},
"userNodes": {},
"linkedGlobalVariables": [],
"playbackConfig": {
"speed": 1.0
},
"layout": "Plot!3fa5k5u"
} as const;
31 changes: 17 additions & 14 deletions packages/studio-base/src/providers/CurrentLayoutProvider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ import {
import { useLayoutManager } from "@foxglove/studio-base/context/LayoutManagerContext";
import { useUserProfileStorage } from "@foxglove/studio-base/context/UserProfileStorageContext";
import { LinkedGlobalVariables } from "@foxglove/studio-base/panels/ThreeDimensionalViz/Interactions/useLinkedGlobalVariables";
import { defaultLayout } from "@foxglove/studio-base/providers/CurrentLayoutProvider/defaultLayout";
// import { defaultLayout } from "@foxglove/studio-base/providers/CurrentLayoutProvider/defaultLayout";
import panelsReducer from "@foxglove/studio-base/providers/CurrentLayoutProvider/reducers";
import { LayoutID } from "@foxglove/studio-base/services/ConsoleApi";
import { AppEvent } from "@foxglove/studio-base/services/IAnalytics";
import { LayoutManagerEventTypes } from "@foxglove/studio-base/services/ILayoutManager";
import { PanelConfig, UserNodes, PlaybackConfig } from "@foxglove/studio-base/types/panels";
import { windowAppURLState } from "@foxglove/studio-base/util/appURLState";
// import { windowAppURLState } from "@foxglove/studio-base/util/appURLState";
import { getPanelTypeFromId } from "@foxglove/studio-base/util/layout";

const log = Logger.getLogger(__filename);
Expand Down Expand Up @@ -253,25 +253,28 @@ export default function CurrentLayoutProvider({

// Load initial state by re-selecting the last selected layout from the UserProfile.
useAsync(async () => {
// Don't restore the layout if there's one specified in the app state url.
if (windowAppURLState()?.layoutId) {
return;

async function loadLayout() {
const response = await fetch('layout.json');
const layout = await response.json();
return layout;
}
const defaultLayout = await loadLayout();

// Retreive the selected layout id from the user's profile. If there's no layout specified
// or we can't load it then save and select a default layout.
const { currentLayoutId } = await getUserProfile();
const layout = currentLayoutId ? await layoutManager.getLayout(currentLayoutId) : undefined;
if (layout) {
await setSelectedLayoutId(currentLayoutId, { saveToProfile: false });
} else {
const newLayout = await layoutManager.saveNewLayout({
name: "Default",
data: defaultLayout,
permission: "CREATOR_WRITE",
});

const newLayout = await layoutManager.saveNewLayout({
name: "Default",
data: defaultLayout,
permission: "CREATOR_WRITE",
});

if(currentLayoutId != newLayout.id){
await setSelectedLayoutId(newLayout.id);
}

}, [getUserProfile, layoutManager, setSelectedLayoutId]);

const actions: ICurrentLayout["actions"] = useMemo(
Expand Down
29 changes: 29 additions & 0 deletions web/public/layout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"configById": {
"Plot!3fa5k5u": {
"title": "Plot",
"paths": [
{
"value": "/topic.datasdfasdf",
"enabled": true,
"timestampMethod": "receiveTime"
}
],
"showXAxisLabels": true,
"showYAxisLabels": true,
"showLegend": true,
"legendDisplay": "floating",
"showPlotValuesInLegend": false,
"isSynced": true,
"xAxisVal": "timestamp",
"sidebarDimension": 240
}
},
"globalVariables": {},
"userNodes": {},
"linkedGlobalVariables": [],
"playbackConfig": {
"speed": 1.0
},
"layout": "Plot!3fa5k5u"
}
2 changes: 1 addition & 1 deletion web/src/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function Root({ appConfiguration }: { appConfiguration: IAppConfiguration
<App
disableSignin={disableSignin}
enableDialogAuth={enableDialogAuth}
enableLaunchPreferenceScreen
// enableLaunchPreferenceScreen
deepLinks={[window.location.href]}
dataSources={dataSources}
appConfiguration={appConfiguration}
Expand Down
35 changes: 18 additions & 17 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3787,9 +3787,9 @@ __metadata:
languageName: node
linkType: hard

"@sentry/cli@npm:^1.73.0":
version: 1.74.3
resolution: "@sentry/cli@npm:1.74.3"
"@sentry/cli@npm:^1.74.6":
version: 1.74.6
resolution: "@sentry/cli@npm:1.74.6"
dependencies:
https-proxy-agent: ^5.0.0
mkdirp: ^0.5.5
Expand All @@ -3800,7 +3800,7 @@ __metadata:
which: ^2.0.2
bin:
sentry-cli: bin/sentry-cli
checksum: f90f68d9849bcef031389738e467ae1a2aeca8c2a55b66820d816d0e99990864593dbc04d8c58cf8e6a7a5e320879486ddad09ffdcb0ae63da54f1aa3e0d7fe3
checksum: 3d1ef94d5505ed23858503228b59ae1ed401774e27466d7a47eba47be3855e9706f12292d4a0a6135303a5916791620e0d3a184d2fda9e28f2d26ccd347b36fb
languageName: node
linkType: hard

Expand Down Expand Up @@ -3928,12 +3928,13 @@ __metadata:
languageName: node
linkType: hard

"@sentry/webpack-plugin@npm:1.18.8":
version: 1.18.8
resolution: "@sentry/webpack-plugin@npm:1.18.8"
"@sentry/webpack-plugin@npm:1.20.0":
version: 1.20.0
resolution: "@sentry/webpack-plugin@npm:1.20.0"
dependencies:
"@sentry/cli": ^1.73.0
checksum: e159ee1e4b486a6d602bcf04e08ce4f167c9148aa4b612f6871f81954fba0cf607297a77bcda22f6f882266ac715ce8cb7be55858eaebc9fdbb85737ae92eb04
"@sentry/cli": ^1.74.6
webpack-sources: ^2.0.0 || ^3.0.0
checksum: d582026c3686f287ddc23de4e64c6f03afc2a73a84ec5a8fd3eded56a45683094bf132f4c624a35386fff872eb518771109d5c0b91a2cf79da0aff035c5bb05b
languageName: node
linkType: hard

Expand Down Expand Up @@ -12777,7 +12778,7 @@ __metadata:
"@pmmmwh/react-refresh-webpack-plugin": 0.5.4
"@sentry/electron": 4.0.0
"@sentry/tracing": 7.10.0
"@sentry/webpack-plugin": 1.18.8
"@sentry/webpack-plugin": 1.20.0
"@storybook/addon-actions": 6.5.10
"@storybook/addon-essentials": 6.5.10
"@storybook/builder-webpack5": 6.5.10
Expand Down Expand Up @@ -24650,6 +24651,13 @@ __metadata:
languageName: node
linkType: hard

"webpack-sources@npm:^2.0.0 || ^3.0.0, webpack-sources@npm:^3.2.3":
version: 3.2.3
resolution: "webpack-sources@npm:3.2.3"
checksum: 989e401b9fe3536529e2a99dac8c1bdc50e3a0a2c8669cbafad31271eadd994bc9405f88a3039cd2e29db5e6d9d0926ceb7a1a4e7409ece021fe79c37d9c4607
languageName: node
linkType: hard

"webpack-sources@npm:^2.2.0":
version: 2.3.1
resolution: "webpack-sources@npm:2.3.1"
Expand All @@ -24660,13 +24668,6 @@ __metadata:
languageName: node
linkType: hard

"webpack-sources@npm:^3.2.3":
version: 3.2.3
resolution: "webpack-sources@npm:3.2.3"
checksum: 989e401b9fe3536529e2a99dac8c1bdc50e3a0a2c8669cbafad31271eadd994bc9405f88a3039cd2e29db5e6d9d0926ceb7a1a4e7409ece021fe79c37d9c4607
languageName: node
linkType: hard

"webpack-virtual-modules@npm:^0.2.2":
version: 0.2.2
resolution: "webpack-virtual-modules@npm:0.2.2"
Expand Down