From 5819f48a69fbb540b6e953a17d3700603039853b Mon Sep 17 00:00:00 2001 From: Pierre Marcenac Date: Tue, 28 Nov 2023 10:00:37 +0000 Subject: [PATCH 1/5] Fix bugs in the `` component. --- editor/app.py | 4 +- editor/components/tabs/__init__.py | 14 +++-- .../tabs/frontend/build/asset-manifest.json | 6 +-- .../components/tabs/frontend/build/index.html | 2 +- .../js/{main.d73ef39a.js => main.716a0ab4.js} | 6 +-- ...CENSE.txt => main.716a0ab4.js.LICENSE.txt} | 0 .../build/static/js/main.716a0ab4.js.map | 1 + .../build/static/js/main.d73ef39a.js.map | 1 - editor/components/tabs/frontend/src/Tabs.tsx | 52 ++++++++++++++----- editor/core/query_params.py | 3 ++ editor/core/state.py | 6 ++- editor/cypress/e2e/displayErrors.cy.js | 5 +- editor/cypress/e2e/loadCroissant.cy.js | 4 +- editor/utils.py | 19 +++---- editor/views/record_sets.py | 4 +- editor/views/wizard.py | 47 ++++++++--------- 16 files changed, 104 insertions(+), 70 deletions(-) rename editor/components/tabs/frontend/build/static/js/{main.d73ef39a.js => main.716a0ab4.js} (58%) rename editor/components/tabs/frontend/build/static/js/{main.d73ef39a.js.LICENSE.txt => main.716a0ab4.js.LICENSE.txt} (100%) create mode 100644 editor/components/tabs/frontend/build/static/js/main.716a0ab4.js.map delete mode 100644 editor/components/tabs/frontend/build/static/js/main.d73ef39a.js.map diff --git a/editor/app.py b/editor/app.py index 4fe919e7f..ade3de0bd 100644 --- a/editor/app.py +++ b/editor/app.py @@ -70,7 +70,9 @@ def _logout(): col3.button("Menu", on_click=_back_to_menu) -if st.session_state.get(CurrentProject): +should_display_editor = bool(st.session_state.get(CurrentProject)) + +if should_display_editor: render_editor() else: render_splash() diff --git a/editor/components/tabs/__init__.py b/editor/components/tabs/__init__.py index c7242ceee..77c58d174 100644 --- a/editor/components/tabs/__init__.py +++ b/editor/components/tabs/__init__.py @@ -2,6 +2,8 @@ import streamlit.components.v1 as components +from core.constants import OVERVIEW + # Create a _RELEASE constant. We'll set this to False while we're developing # the component, and True when we're ready to package and distribute it. _RELEASE = True @@ -17,12 +19,12 @@ _component_func = components.declare_component("tabs_component", path=build_dir) -def render_tabs(tabs: list[str], selected_tab: int, key=None): +def render_tabs(tabs: list[str], selected_tab: int, json: str | None, key=None): """Create a new instance of "tabs_component". Args: - nodes: The nodes to render in the tree. Nodes are dictionaries with keys `name` - (unique identifier), `type` and `parent` (referencing another name). + tabs: The tabs to render in the component. + selected_tab: The selected tab. key: An optional key that uniquely identifies this component. If this is None, and the component's arguments are changed, the component will be re-mounted in the Streamlit frontend and lose its current state. @@ -33,6 +35,10 @@ def render_tabs(tabs: list[str], selected_tab: int, key=None): frontend.) """ component_value = _component_func( - tabs=tabs, selected_tab=selected_tab, key=key, default=0 + tabs=tabs, + selected_tab=selected_tab, + json=json, + key=key, + default=OVERVIEW, ) return component_value diff --git a/editor/components/tabs/frontend/build/asset-manifest.json b/editor/components/tabs/frontend/build/asset-manifest.json index 7d4eddc3a..30248f1bc 100644 --- a/editor/components/tabs/frontend/build/asset-manifest.json +++ b/editor/components/tabs/frontend/build/asset-manifest.json @@ -1,10 +1,10 @@ { "files": { - "main.js": "./static/js/main.d73ef39a.js", + "main.js": "./static/js/main.716a0ab4.js", "index.html": "./index.html", - "main.d73ef39a.js.map": "./static/js/main.d73ef39a.js.map" + "main.716a0ab4.js.map": "./static/js/main.716a0ab4.js.map" }, "entrypoints": [ - "static/js/main.d73ef39a.js" + "static/js/main.716a0ab4.js" ] } \ No newline at end of file diff --git a/editor/components/tabs/frontend/build/index.html b/editor/components/tabs/frontend/build/index.html index 7b16209b9..5566c25df 100644 --- a/editor/components/tabs/frontend/build/index.html +++ b/editor/components/tabs/frontend/build/index.html @@ -1 +1 @@ -Streamlit Tabs Component
\ No newline at end of file +Streamlit Tabs Component
\ No newline at end of file diff --git a/editor/components/tabs/frontend/build/static/js/main.d73ef39a.js b/editor/components/tabs/frontend/build/static/js/main.716a0ab4.js similarity index 58% rename from editor/components/tabs/frontend/build/static/js/main.d73ef39a.js rename to editor/components/tabs/frontend/build/static/js/main.716a0ab4.js index 7d8189502..caccbd0a0 100644 --- a/editor/components/tabs/frontend/build/static/js/main.d73ef39a.js +++ b/editor/components/tabs/frontend/build/static/js/main.716a0ab4.js @@ -1,3 +1,3 @@ -/*! For license information please see main.d73ef39a.js.LICENSE.txt */ -(()=>{"use strict";var e={110:(e,t,n)=>{var r=n(309),i={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},a={};function l(e){return r.isMemo(e)?s:a[e.$$typeof]||i}a[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a[r.Memo]=s;var u=Object.defineProperty,c=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,h=Object.getPrototypeOf,p=Object.prototype;e.exports=function e(t,n,r){if("string"!==typeof n){if(p){var i=h(n);i&&i!==p&&e(t,i,r)}var s=c(n);d&&(s=s.concat(d(n)));for(var a=l(t),y=l(n),m=0;m{var n="function"===typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,i=n?Symbol.for("react.portal"):60106,o=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,a=n?Symbol.for("react.profiler"):60114,l=n?Symbol.for("react.provider"):60109,u=n?Symbol.for("react.context"):60110,c=n?Symbol.for("react.async_mode"):60111,d=n?Symbol.for("react.concurrent_mode"):60111,f=n?Symbol.for("react.forward_ref"):60112,h=n?Symbol.for("react.suspense"):60113,p=n?Symbol.for("react.suspense_list"):60120,y=n?Symbol.for("react.memo"):60115,m=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,g=n?Symbol.for("react.fundamental"):60117,v=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function _(e){if("object"===typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case c:case d:case o:case a:case s:case h:return e;default:switch(e=e&&e.$$typeof){case u:case f:case m:case y:case l:return e;default:return t}}case i:return t}}}function S(e){return _(e)===d}t.AsyncMode=c,t.ConcurrentMode=d,t.ContextConsumer=u,t.ContextProvider=l,t.Element=r,t.ForwardRef=f,t.Fragment=o,t.Lazy=m,t.Memo=y,t.Portal=i,t.Profiler=a,t.StrictMode=s,t.Suspense=h,t.isAsyncMode=function(e){return S(e)||_(e)===c},t.isConcurrentMode=S,t.isContextConsumer=function(e){return _(e)===u},t.isContextProvider=function(e){return _(e)===l},t.isElement=function(e){return"object"===typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return _(e)===f},t.isFragment=function(e){return _(e)===o},t.isLazy=function(e){return _(e)===m},t.isMemo=function(e){return _(e)===y},t.isPortal=function(e){return _(e)===i},t.isProfiler=function(e){return _(e)===a},t.isStrictMode=function(e){return _(e)===s},t.isSuspense=function(e){return _(e)===h},t.isValidElementType=function(e){return"string"===typeof e||"function"===typeof e||e===o||e===d||e===a||e===s||e===h||e===p||"object"===typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===y||e.$$typeof===l||e.$$typeof===u||e.$$typeof===f||e.$$typeof===g||e.$$typeof===v||e.$$typeof===w||e.$$typeof===b)},t.typeOf=_},309:(e,t,n)=>{e.exports=n(746)},725:e=>{var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(i){return!1}}()?Object.assign:function(e,i){for(var o,s,a=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l{var r=n(791),i=n(296);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n