Skip to content

Commit f3791e1

Browse files
authored
Merge pull request #485 from vcync/next
Next
2 parents 748572a + c89f95e commit f3791e1

13 files changed

Lines changed: 108 additions & 497 deletions

File tree

build/icon.ico

57.9 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"vue-class-component": "^7.2.3",
5757
"vue-color": "^2.7.1",
5858
"vue-fragment": "^1.5.1",
59-
"vue-golden-layout": "^2.0.8",
59+
"vue-golden-layout": "^2.1.0",
6060
"vue-property-decorator": "^8.3.0",
6161
"vue-smooth-dnd": "^0.8.1",
6262
"vuex": "^3.1.2",

src/App.vue

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
:showMaximiseIcon="false"
88
:state.sync="layoutState"
99
@state="updateLayoutState"
10+
@creation-error="reset"
1011
:headerHeight="18"
1112
>
1213
<gl-col>
@@ -70,10 +71,6 @@
7071
<gl-component title="Preview" :closable="false">
7172
<Preview />
7273
</gl-component>
73-
74-
<gl-component title="Swap" :closable="false">
75-
<ABSwap />
76-
</gl-component>
7774
</gl-stack>
7875
</gl-row>
7976
</gl-col>
@@ -86,7 +83,6 @@
8683

8784
<script>
8885
import Preview from "@/components/Preview";
89-
import ABSwap from "@/components/ABSwap";
9086
import Groups from "@/components/Groups";
9187
import Gallery from "@/components/Gallery";
9288
import InputConfig from "@/components/InputConfig";
@@ -99,14 +95,15 @@ import ModuleInspector from "@/components/ModuleInspector";
9995
import InfoView from "@/components/InfoView";
10096
import Search from "@/components/Search";
10197
98+
import getNextName from "@/application/utils/get-next-name";
99+
import constants from "@/application/constants";
102100
import * as GoldenLayout from "golden-layout";
103101
104102
export default {
105103
name: "app",
106104
107105
components: {
108106
Preview,
109-
ABSwap,
110107
Groups,
111108
Gallery,
112109
InputConfig,
@@ -156,7 +153,18 @@ export default {
156153
},
157154
158155
created() {
159-
const layoutState = window.localStorage.getItem("layoutState");
156+
const layoutErroredLastLoad = window.localStorage.getItem(
157+
constants.LAYOUT_LOAD_ERROR_KEY
158+
);
159+
160+
if (layoutErroredLastLoad) {
161+
console.warn(
162+
"Layout could not be restored. Default layout loaded and old layout was saved to a backup local storage key"
163+
);
164+
window.localStorage.removeItem(constants.LAYOUT_LOAD_ERROR_KEY);
165+
}
166+
167+
const layoutState = window.localStorage.getItem(constants.LAYOUT_STATE_KEY);
160168
if (layoutState) {
161169
this.layoutState = JSON.parse(layoutState);
162170
}
@@ -306,7 +314,7 @@ export default {
306314
/**
307315
* @description Called when <golden-layout /> updates its state.
308316
* Unminifies config, purges dynamically added panels, minifies and saves to
309-
* localStorage key "layoutState".
317+
* localStorage key `constants.LAYOUT_STATE_KEY`.
310318
*
311319
* @param {GoldenLayout config} value
312320
*/
@@ -315,9 +323,29 @@ export default {
315323
const cleanedConfig = this.purgeDynamicPanels(config);
316324
317325
window.localStorage.setItem(
318-
"layoutState",
326+
constants.LAYOUT_STATE_KEY,
319327
JSON.stringify(GoldenLayout.minifyConfig(cleanedConfig))
320328
);
329+
},
330+
331+
async reset() {
332+
console.log("golden layout creation error");
333+
const localStorageKeys = Object.keys(window.localStorage);
334+
335+
const nextKey = await getNextName(
336+
constants.LAYOUT_STATE_KEY,
337+
localStorageKeys
338+
);
339+
window.localStorage.setItem(nextKey, JSON.stringify(this.layoutState));
340+
341+
window.localStorage.removeItem(constants.LAYOUT_STATE_KEY);
342+
343+
window.localStorage.setItem(
344+
constants.LAYOUT_LOAD_ERROR_KEY,
345+
JSON.stringify(true)
346+
);
347+
348+
window.location.reload();
321349
}
322350
},
323351

src/application/constants.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
export default {
22
get GALLERY_GROUP_NAME() {
33
return "modV internal Gallery Group";
4+
},
5+
6+
get LAYOUT_STATE_KEY() {
7+
return "layoutState";
8+
},
9+
10+
get LAYOUT_LOAD_ERROR() {
11+
return "layoutLoadError";
412
}
513
};

src/application/sample-modules/isf/bokeh.fs

Lines changed: 0 additions & 199 deletions
This file was deleted.

0 commit comments

Comments
 (0)