This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Loading component - #352

Merged
valentijnnieman merged 66 commits into
masterfrom
loading_component
Feb 28, 2019
Merged

Loading component#352
valentijnnieman merged 66 commits into
masterfrom
loading_component

Conversation

@valentijnnieman

@valentijnniemanvalentijnnieman commented Oct 30, 2018

Copy link
Copy Markdown
Contributor

This is the new Loading component for the new Loading States api issue 267. For now it has a basic default spinner.

Please note!
I've had to make a small change to extract-meta to not pick up .jsx files, so that we can have .jsx files in src/ that are not supposed to be mapped to Dash components. This is so that I could split up all the spinners into separate files, that we don't want Dash to pick up as components - instead they should be JS only components that get used under the hood. There's probably a better fix here, let me know your thoughts please.

TODO:

  • Add more default spinners, and a prop for selecting which one to use (loading_screen_style = 'basic' | 'overlay' | 'spinner' | 'empty-div' | or something similar)
  • Support for full-screen spinners
  • Add props for styling the default spinner's colours and other
  • Add support for handling which prop caused loading time (once in renderer PR)
  • Allow for React components that don't get picked up by extract-meta, so we can have a file structure that allows separating of concerns.
  • Look into adding support for custom loading components, with this PR perhaps

SPINNERS:

edit: I'm also showing the component and prop Name in the HTML, just to show off that that information is being passed. In the final version of this component, I'll remove it (or at least change how it looks)

edit2: I've fixed the Demo app and I've added a Loading Demo app that you can fire up to check out all the spinners. npm start!

Comment threadsrc/components/Loading.react.js Outdated
Comment threadsrc/components/Loading.react.js Outdated
@T4rk1n

Copy link
Copy Markdown
Contributor

@valentijnnieman You wrap the component you want to have a loading with this loading component ?

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

@bpostlethwaite I think you mentioned specific loading spinners for Plotly on Friday? If there are any that you think we should incorporate into this component, could you link them here? Thanks in advance :)

@bpostlethwaite

Copy link
Copy Markdown
Member

https://github.com/plotly/streambed/blob/master/shelly/webapp/static/webapp/images/plotly-logo-loop.gif

But this one doesn't actually seem to have looping enabled. You'll need to open a GIF editor and enable looping.

I am pretty sure we should edit this one in streambed to support looping as well...

@bpostlethwaite

Copy link
Copy Markdown
Member

If you create a loop version let me know and I'll PR that back into streambed

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Hmm it's very small and blurry. I don't think we should have that as a default loading spinner, would rather have something in like we have here now! Taken from http://tobiasahlin.com/spinkit/ .

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

I made this https://codepen.io/Chunkydory/pen/qQOrwB which is a little bit campy! But I kind of like it. @cldougl also pointed out that this exists! https://codepen.io/doeg/pen/RWGoLR

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Here's the pen of the cube spinner I just added: https://codepen.io/Chunkydory/pen/aQdpPL

@Marc-Andre-Rivet

Copy link
Copy Markdown
Contributor

@valentijnnieman No specific suggestion, just a curated list of spinners
https://github.com/yangshun/awesome-spinners

@valentijnniemanvalentijnnieman changed the title [WIP]Loading componentLoading componentNov 13, 2018
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"builder": "3.2.2",
"color": "^3.1.0",

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New dependency used for darkening hex colors, used in the CubeSpinner component. It allows users to provide a color, and the component will figure out the appropriate darker colors that are used in the cube.

);
};

export default LoadingDemo;

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New Demo app that shows off the spinners.

Comment threadextract-meta
let src;

if (!['.jsx', '.js'].includes(path.extname(filepath))) {
if (!['.js'].includes(path.extname(filepath))) {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently do not have any .jsx files in our source code, so I figured they could be used in a way to denote components that should not be picked up by extract-meta, so that we can use them internally in JS. It's an easy solution to have the spinners, in this case, in separate files and not in one huge Loading.react.js file.

Comment threadindex.html
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/theme/xq-light.min.css" />
<link rel="stylesheet" href="https://unpkg.com/react-select@1.0.0-rc.3/dist/react-select.css" />
<link rel="stylesheet" href="https://cdn.rawgit.com/chriddyp/abcbc02565dd495b676c3269240e09ca/raw/816de7d5c5d5626e3f3cac8e967070aa15da77e2/rc-slider.css"
/>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are no longer needed since we supply these CSS files ourselves in the source code (using style-loader etc)

Comment threadindex.html
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/codemirror.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/mode/javascript/javascript.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/react@15/dist/react.js"></script>
<script type="text/javascript" src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're supplying React in the devDependencies now, so this is no longer needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I dug through this because it was not obvious to me how the dependencies had changed based on the webpack.config.js and webpack.server.config.js changes in this PR -- they would not affect these script dependencies.

webpack.serve.config.js sets config.externals = undefined which makes webpack.config.js evaluate 'externals' in overrides to true which does not set react, react-dom, etc. as defaults.

Not going to ask for changes as this is out of scope, just documenting my own confusion. I think this could be improved on later.

Comment threadwebpack.config.js
rules: [
{
test: /\.js$/,
test: /\.jsx?$/,

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.jsx files weren't being picked up in the Webpack configs, this will add both .js and .jsx files.

config.output = {
filename: './output.js',
path: path.resolve(__dirname),
};

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the Demo app.

PropTypes.node,
]),

type: PropTypes.oneOf(['graph', 'cube', 'circle', 'dot', 'default']),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add a description docstring here.

<h3 className="dash-loading-title">
Loading {status.component_name}
's {status.prop_name}
</h3>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😸

Comment threadsrc/components/Input.react.js
Comment threadsrc/components/Loading/Loading.react.js Outdated
Comment threadsrc/components/Loading/spinners/CircleSpinner.jsx
Comment threadsrc/components/Loading/spinners/CircleSpinner.jsx
@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Released as prerelease 0.44.0rc2

Comment threadCHANGELOG.md Outdated

## [0.44.0] - 2019-02-13
### Added
- Loading component

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreleased, revert version change for final merge. Add issue link.

Marc-Andre-Rivet
Marc-Andre-Rivet previously approved these changes Feb 13, 2019

@Marc-Andre-RivetMarc-Andre-Rivet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor comments and questions

Comment threaddash_core_components/CircleSpinner.py Outdated
Comment threadsrc/components/DatePickerRange.react.js
Comment threadsrc/components/Loading/Loading.react.js Outdated
Comment threadsrc/components/Loading/Loading.react.js Outdated

@Marc-Andre-RivetMarc-Andre-Rivet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not mean to approve just yet :)

@Marc-Andre-Rivet
Marc-Andre-Rivet dismissed stale reviews from chriddyp and themself February 13, 2019 18:27

Mistake. Not quite there yet!

Comment threadsrc/components/Loading.react.js Outdated
@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

(Re) released as rc 0.43.0rc3 including fixes

R.type(this.props.children) !== 'Object' ||
R.type(this.props.children) !== 'Function'
) {
return <div className={className}>{this.props.children}</div>;

@Marc-Andre-RivetMarc-Andre-RivetFeb 15, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not using the id passed through props for id+key of this component, normal and loading cases. Might cause similar problems as what we've seen with other comps

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we're setting key anywhere in the components, so I don't think it'll cause problems. The key is set in dash-renderer, however. But, you're right - I should add the id prop here!

@eromoe

eromoe commented Feb 26, 2019

Copy link
Copy Markdown

I have installed 0.44.0rc2 , but no loading shows,

Is something wrong with my installed packages ? :

dash==0.36.0 # The core dash backend
dash-html-components==0.13.5 # HTML components
dash-core-components==0.44.0rc2 # Supercharged components
dash-table==3.1.11 # Interactive DataTable component (new!)
dash-daq==0.1.0 # DAQ components (newly open-sourced!)
dash-bootstrap-components

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Hi @eromoe - the packages you'd need are:

dash_html_components==0.14.0rc21
dash_renderer==0.18.0rc4
dash_core_components==0.43.0rc3

It looks like you're missing dash_renderer==0.18.0rc4!

Here's a link to the forums with a more detailed example of how to use this.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@valentijnnieman@T4rk1n@bpostlethwaite@Marc-Andre-Rivet@CP-Vub@Akronix@eromoe@chriddyp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Loading component - #352

Merged
valentijnnieman merged 66 commits into
masterfrom
loading_component
Feb 28, 2019
Merged

Loading component#352
valentijnnieman merged 66 commits into
masterfrom
loading_component

Conversation

@valentijnnieman

@valentijnniemanvalentijnnieman commented Oct 30, 2018

Copy link
Copy Markdown
Contributor

This is the new Loading component for the new Loading States api issue 267. For now it has a basic default spinner.

Please note!
I've had to make a small change to extract-meta to not pick up .jsx files, so that we can have .jsx files in src/ that are not supposed to be mapped to Dash components. This is so that I could split up all the spinners into separate files, that we don't want Dash to pick up as components - instead they should be JS only components that get used under the hood. There's probably a better fix here, let me know your thoughts please.

TODO:

  • Add more default spinners, and a prop for selecting which one to use (loading_screen_style = 'basic' | 'overlay' | 'spinner' | 'empty-div' | or something similar)
  • Support for full-screen spinners
  • Add props for styling the default spinner's colours and other
  • Add support for handling which prop caused loading time (once in renderer PR)
  • Allow for React components that don't get picked up by extract-meta, so we can have a file structure that allows separating of concerns.
  • Look into adding support for custom loading components, with this PR perhaps

SPINNERS:

edit: I'm also showing the component and prop Name in the HTML, just to show off that that information is being passed. In the final version of this component, I'll remove it (or at least change how it looks)

edit2: I've fixed the Demo app and I've added a Loading Demo app that you can fire up to check out all the spinners. npm start!

Comment threadsrc/components/Loading.react.js Outdated
Comment threadsrc/components/Loading.react.js Outdated
@T4rk1n

Copy link
Copy Markdown
Contributor

@valentijnnieman You wrap the component you want to have a loading with this loading component ?

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

@bpostlethwaite I think you mentioned specific loading spinners for Plotly on Friday? If there are any that you think we should incorporate into this component, could you link them here? Thanks in advance :)

@bpostlethwaite

Copy link
Copy Markdown
Member

https://github.com/plotly/streambed/blob/master/shelly/webapp/static/webapp/images/plotly-logo-loop.gif

But this one doesn't actually seem to have looping enabled. You'll need to open a GIF editor and enable looping.

I am pretty sure we should edit this one in streambed to support looping as well...

@bpostlethwaite

Copy link
Copy Markdown
Member

If you create a loop version let me know and I'll PR that back into streambed

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Hmm it's very small and blurry. I don't think we should have that as a default loading spinner, would rather have something in like we have here now! Taken from http://tobiasahlin.com/spinkit/ .

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

I made this https://codepen.io/Chunkydory/pen/qQOrwB which is a little bit campy! But I kind of like it. @cldougl also pointed out that this exists! https://codepen.io/doeg/pen/RWGoLR

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Here's the pen of the cube spinner I just added: https://codepen.io/Chunkydory/pen/aQdpPL

@Marc-Andre-Rivet

Copy link
Copy Markdown
Contributor

@valentijnnieman No specific suggestion, just a curated list of spinners
https://github.com/yangshun/awesome-spinners

@valentijnniemanvalentijnnieman changed the title [WIP]Loading componentLoading componentNov 13, 2018
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"builder": "3.2.2",
"color": "^3.1.0",

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New dependency used for darkening hex colors, used in the CubeSpinner component. It allows users to provide a color, and the component will figure out the appropriate darker colors that are used in the cube.

);
};

export default LoadingDemo;

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New Demo app that shows off the spinners.

Comment threadextract-meta
let src;

if (!['.jsx', '.js'].includes(path.extname(filepath))) {
if (!['.js'].includes(path.extname(filepath))) {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently do not have any .jsx files in our source code, so I figured they could be used in a way to denote components that should not be picked up by extract-meta, so that we can use them internally in JS. It's an easy solution to have the spinners, in this case, in separate files and not in one huge Loading.react.js file.

Comment threadindex.html
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/theme/xq-light.min.css" />
<link rel="stylesheet" href="https://unpkg.com/react-select@1.0.0-rc.3/dist/react-select.css" />
<link rel="stylesheet" href="https://cdn.rawgit.com/chriddyp/abcbc02565dd495b676c3269240e09ca/raw/816de7d5c5d5626e3f3cac8e967070aa15da77e2/rc-slider.css"
/>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are no longer needed since we supply these CSS files ourselves in the source code (using style-loader etc)

Comment threadindex.html
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/codemirror.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/mode/javascript/javascript.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/react@15/dist/react.js"></script>
<script type="text/javascript" src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're supplying React in the devDependencies now, so this is no longer needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I dug through this because it was not obvious to me how the dependencies had changed based on the webpack.config.js and webpack.server.config.js changes in this PR -- they would not affect these script dependencies.

webpack.serve.config.js sets config.externals = undefined which makes webpack.config.js evaluate 'externals' in overrides to true which does not set react, react-dom, etc. as defaults.

Not going to ask for changes as this is out of scope, just documenting my own confusion. I think this could be improved on later.

Comment threadwebpack.config.js
rules: [
{
test: /\.js$/,
test: /\.jsx?$/,

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.jsx files weren't being picked up in the Webpack configs, this will add both .js and .jsx files.

config.output = {
filename: './output.js',
path: path.resolve(__dirname),
};

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the Demo app.

PropTypes.node,
]),

type: PropTypes.oneOf(['graph', 'cube', 'circle', 'dot', 'default']),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add a description docstring here.

<h3 className="dash-loading-title">
Loading {status.component_name}
's {status.prop_name}
</h3>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😸

Comment threadsrc/components/Input.react.js
Comment threadsrc/components/Loading/Loading.react.js Outdated
Comment threadsrc/components/Loading/spinners/CircleSpinner.jsx
Comment threadsrc/components/Loading/spinners/CircleSpinner.jsx
@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Released as prerelease 0.44.0rc2

Comment threadCHANGELOG.md Outdated

## [0.44.0] - 2019-02-13
### Added
- Loading component

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreleased, revert version change for final merge. Add issue link.

Marc-Andre-Rivet
Marc-Andre-Rivet previously approved these changes Feb 13, 2019

@Marc-Andre-RivetMarc-Andre-Rivet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor comments and questions

Comment threaddash_core_components/CircleSpinner.py Outdated
Comment threadsrc/components/DatePickerRange.react.js
Comment threadsrc/components/Loading/Loading.react.js Outdated
Comment threadsrc/components/Loading/Loading.react.js Outdated

@Marc-Andre-RivetMarc-Andre-Rivet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not mean to approve just yet :)

@Marc-Andre-Rivet
Marc-Andre-Rivet dismissed stale reviews from chriddyp and themself February 13, 2019 18:27

Mistake. Not quite there yet!

Comment threadsrc/components/Loading.react.js Outdated
@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

(Re) released as rc 0.43.0rc3 including fixes

R.type(this.props.children) !== 'Object' ||
R.type(this.props.children) !== 'Function'
) {
return <div className={className}>{this.props.children}</div>;

@Marc-Andre-RivetMarc-Andre-RivetFeb 15, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not using the id passed through props for id+key of this component, normal and loading cases. Might cause similar problems as what we've seen with other comps

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we're setting key anywhere in the components, so I don't think it'll cause problems. The key is set in dash-renderer, however. But, you're right - I should add the id prop here!

@eromoe

eromoe commented Feb 26, 2019

Copy link
Copy Markdown

I have installed 0.44.0rc2 , but no loading shows,

Is something wrong with my installed packages ? :

dash==0.36.0 # The core dash backend
dash-html-components==0.13.5 # HTML components
dash-core-components==0.44.0rc2 # Supercharged components
dash-table==3.1.11 # Interactive DataTable component (new!)
dash-daq==0.1.0 # DAQ components (newly open-sourced!)
dash-bootstrap-components

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Hi @eromoe - the packages you'd need are:

dash_html_components==0.14.0rc21
dash_renderer==0.18.0rc4
dash_core_components==0.43.0rc3

It looks like you're missing dash_renderer==0.18.0rc4!

Here's a link to the forums with a more detailed example of how to use this.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@valentijnnieman@T4rk1n@bpostlethwaite@Marc-Andre-Rivet@CP-Vub@Akronix@eromoe@chriddyp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Loading component - #352

Merged
valentijnnieman merged 66 commits into
masterfrom
loading_component
Feb 28, 2019
Merged

Loading component#352
valentijnnieman merged 66 commits into
masterfrom
loading_component

Conversation

@valentijnnieman

@valentijnniemanvalentijnnieman commented Oct 30, 2018

Copy link
Copy Markdown
Contributor

This is the new Loading component for the new Loading States api issue 267. For now it has a basic default spinner.

Please note!
I've had to make a small change to extract-meta to not pick up .jsx files, so that we can have .jsx files in src/ that are not supposed to be mapped to Dash components. This is so that I could split up all the spinners into separate files, that we don't want Dash to pick up as components - instead they should be JS only components that get used under the hood. There's probably a better fix here, let me know your thoughts please.

TODO:

  • Add more default spinners, and a prop for selecting which one to use (loading_screen_style = 'basic' | 'overlay' | 'spinner' | 'empty-div' | or something similar)
  • Support for full-screen spinners
  • Add props for styling the default spinner's colours and other
  • Add support for handling which prop caused loading time (once in renderer PR)
  • Allow for React components that don't get picked up by extract-meta, so we can have a file structure that allows separating of concerns.
  • Look into adding support for custom loading components, with this PR perhaps

SPINNERS:

edit: I'm also showing the component and prop Name in the HTML, just to show off that that information is being passed. In the final version of this component, I'll remove it (or at least change how it looks)

edit2: I've fixed the Demo app and I've added a Loading Demo app that you can fire up to check out all the spinners. npm start!

Comment threadsrc/components/Loading.react.js Outdated
Comment threadsrc/components/Loading.react.js Outdated
@T4rk1n

Copy link
Copy Markdown
Contributor

@valentijnnieman You wrap the component you want to have a loading with this loading component ?

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

@bpostlethwaite I think you mentioned specific loading spinners for Plotly on Friday? If there are any that you think we should incorporate into this component, could you link them here? Thanks in advance :)

@bpostlethwaite

Copy link
Copy Markdown
Member

https://github.com/plotly/streambed/blob/master/shelly/webapp/static/webapp/images/plotly-logo-loop.gif

But this one doesn't actually seem to have looping enabled. You'll need to open a GIF editor and enable looping.

I am pretty sure we should edit this one in streambed to support looping as well...

@bpostlethwaite

Copy link
Copy Markdown
Member

If you create a loop version let me know and I'll PR that back into streambed

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Hmm it's very small and blurry. I don't think we should have that as a default loading spinner, would rather have something in like we have here now! Taken from http://tobiasahlin.com/spinkit/ .

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

I made this https://codepen.io/Chunkydory/pen/qQOrwB which is a little bit campy! But I kind of like it. @cldougl also pointed out that this exists! https://codepen.io/doeg/pen/RWGoLR

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Here's the pen of the cube spinner I just added: https://codepen.io/Chunkydory/pen/aQdpPL

@Marc-Andre-Rivet

Copy link
Copy Markdown
Contributor

@valentijnnieman No specific suggestion, just a curated list of spinners
https://github.com/yangshun/awesome-spinners

@valentijnniemanvalentijnnieman changed the title [WIP]Loading componentLoading componentNov 13, 2018
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"builder": "3.2.2",
"color": "^3.1.0",

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New dependency used for darkening hex colors, used in the CubeSpinner component. It allows users to provide a color, and the component will figure out the appropriate darker colors that are used in the cube.

);
};

export default LoadingDemo;

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New Demo app that shows off the spinners.

Comment threadextract-meta
let src;

if (!['.jsx', '.js'].includes(path.extname(filepath))) {
if (!['.js'].includes(path.extname(filepath))) {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently do not have any .jsx files in our source code, so I figured they could be used in a way to denote components that should not be picked up by extract-meta, so that we can use them internally in JS. It's an easy solution to have the spinners, in this case, in separate files and not in one huge Loading.react.js file.

Comment threadindex.html
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/theme/xq-light.min.css" />
<link rel="stylesheet" href="https://unpkg.com/react-select@1.0.0-rc.3/dist/react-select.css" />
<link rel="stylesheet" href="https://cdn.rawgit.com/chriddyp/abcbc02565dd495b676c3269240e09ca/raw/816de7d5c5d5626e3f3cac8e967070aa15da77e2/rc-slider.css"
/>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are no longer needed since we supply these CSS files ourselves in the source code (using style-loader etc)

Comment threadindex.html
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/codemirror.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/mode/javascript/javascript.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/react@15/dist/react.js"></script>
<script type="text/javascript" src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're supplying React in the devDependencies now, so this is no longer needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I dug through this because it was not obvious to me how the dependencies had changed based on the webpack.config.js and webpack.server.config.js changes in this PR -- they would not affect these script dependencies.

webpack.serve.config.js sets config.externals = undefined which makes webpack.config.js evaluate 'externals' in overrides to true which does not set react, react-dom, etc. as defaults.

Not going to ask for changes as this is out of scope, just documenting my own confusion. I think this could be improved on later.

Comment threadwebpack.config.js
rules: [
{
test: /\.js$/,
test: /\.jsx?$/,

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.jsx files weren't being picked up in the Webpack configs, this will add both .js and .jsx files.

config.output = {
filename: './output.js',
path: path.resolve(__dirname),
};

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the Demo app.

PropTypes.node,
]),

type: PropTypes.oneOf(['graph', 'cube', 'circle', 'dot', 'default']),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add a description docstring here.

<h3 className="dash-loading-title">
Loading {status.component_name}
's {status.prop_name}
</h3>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😸

Comment threadsrc/components/Input.react.js
Comment threadsrc/components/Loading/Loading.react.js Outdated
Comment threadsrc/components/Loading/spinners/CircleSpinner.jsx
Comment threadsrc/components/Loading/spinners/CircleSpinner.jsx
@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Released as prerelease 0.44.0rc2

Comment threadCHANGELOG.md Outdated

## [0.44.0] - 2019-02-13
### Added
- Loading component

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreleased, revert version change for final merge. Add issue link.

Marc-Andre-Rivet
Marc-Andre-Rivet previously approved these changes Feb 13, 2019

@Marc-Andre-RivetMarc-Andre-Rivet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor comments and questions

Comment threaddash_core_components/CircleSpinner.py Outdated
Comment threadsrc/components/DatePickerRange.react.js
Comment threadsrc/components/Loading/Loading.react.js Outdated
Comment threadsrc/components/Loading/Loading.react.js Outdated

@Marc-Andre-RivetMarc-Andre-Rivet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not mean to approve just yet :)

@Marc-Andre-Rivet
Marc-Andre-Rivet dismissed stale reviews from chriddyp and themself February 13, 2019 18:27

Mistake. Not quite there yet!

Comment threadsrc/components/Loading.react.js Outdated
@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

(Re) released as rc 0.43.0rc3 including fixes

R.type(this.props.children) !== 'Object' ||
R.type(this.props.children) !== 'Function'
) {
return <div className={className}>{this.props.children}</div>;

@Marc-Andre-RivetMarc-Andre-RivetFeb 15, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not using the id passed through props for id+key of this component, normal and loading cases. Might cause similar problems as what we've seen with other comps

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we're setting key anywhere in the components, so I don't think it'll cause problems. The key is set in dash-renderer, however. But, you're right - I should add the id prop here!

@eromoe

eromoe commented Feb 26, 2019

Copy link
Copy Markdown

I have installed 0.44.0rc2 , but no loading shows,

Is something wrong with my installed packages ? :

dash==0.36.0 # The core dash backend
dash-html-components==0.13.5 # HTML components
dash-core-components==0.44.0rc2 # Supercharged components
dash-table==3.1.11 # Interactive DataTable component (new!)
dash-daq==0.1.0 # DAQ components (newly open-sourced!)
dash-bootstrap-components

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Hi @eromoe - the packages you'd need are:

dash_html_components==0.14.0rc21
dash_renderer==0.18.0rc4
dash_core_components==0.43.0rc3

It looks like you're missing dash_renderer==0.18.0rc4!

Here's a link to the forums with a more detailed example of how to use this.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@valentijnnieman@T4rk1n@bpostlethwaite@Marc-Andre-Rivet@CP-Vub@Akronix@eromoe@chriddyp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Loading component - #352

Merged
valentijnnieman merged 66 commits into
masterfrom
loading_component
Feb 28, 2019
Merged

Loading component#352
valentijnnieman merged 66 commits into
masterfrom
loading_component

Conversation

@valentijnnieman

@valentijnniemanvalentijnnieman commented Oct 30, 2018

Copy link
Copy Markdown
Contributor

This is the new Loading component for the new Loading States api issue 267. For now it has a basic default spinner.

Please note!
I've had to make a small change to extract-meta to not pick up .jsx files, so that we can have .jsx files in src/ that are not supposed to be mapped to Dash components. This is so that I could split up all the spinners into separate files, that we don't want Dash to pick up as components - instead they should be JS only components that get used under the hood. There's probably a better fix here, let me know your thoughts please.

TODO:

  • Add more default spinners, and a prop for selecting which one to use (loading_screen_style = 'basic' | 'overlay' | 'spinner' | 'empty-div' | or something similar)
  • Support for full-screen spinners
  • Add props for styling the default spinner's colours and other
  • Add support for handling which prop caused loading time (once in renderer PR)
  • Allow for React components that don't get picked up by extract-meta, so we can have a file structure that allows separating of concerns.
  • Look into adding support for custom loading components, with this PR perhaps

SPINNERS:

edit: I'm also showing the component and prop Name in the HTML, just to show off that that information is being passed. In the final version of this component, I'll remove it (or at least change how it looks)

edit2: I've fixed the Demo app and I've added a Loading Demo app that you can fire up to check out all the spinners. npm start!

Comment threadsrc/components/Loading.react.js Outdated
Comment threadsrc/components/Loading.react.js Outdated
@T4rk1n

Copy link
Copy Markdown
Contributor

@valentijnnieman You wrap the component you want to have a loading with this loading component ?

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

@bpostlethwaite I think you mentioned specific loading spinners for Plotly on Friday? If there are any that you think we should incorporate into this component, could you link them here? Thanks in advance :)

@bpostlethwaite

Copy link
Copy Markdown
Member

https://github.com/plotly/streambed/blob/master/shelly/webapp/static/webapp/images/plotly-logo-loop.gif

But this one doesn't actually seem to have looping enabled. You'll need to open a GIF editor and enable looping.

I am pretty sure we should edit this one in streambed to support looping as well...

@bpostlethwaite

Copy link
Copy Markdown
Member

If you create a loop version let me know and I'll PR that back into streambed

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Hmm it's very small and blurry. I don't think we should have that as a default loading spinner, would rather have something in like we have here now! Taken from http://tobiasahlin.com/spinkit/ .

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

I made this https://codepen.io/Chunkydory/pen/qQOrwB which is a little bit campy! But I kind of like it. @cldougl also pointed out that this exists! https://codepen.io/doeg/pen/RWGoLR

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Here's the pen of the cube spinner I just added: https://codepen.io/Chunkydory/pen/aQdpPL

@Marc-Andre-Rivet

Copy link
Copy Markdown
Contributor

@valentijnnieman No specific suggestion, just a curated list of spinners
https://github.com/yangshun/awesome-spinners

@valentijnniemanvalentijnnieman changed the title [WIP]Loading componentLoading componentNov 13, 2018
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"builder": "3.2.2",
"color": "^3.1.0",

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New dependency used for darkening hex colors, used in the CubeSpinner component. It allows users to provide a color, and the component will figure out the appropriate darker colors that are used in the cube.

);
};

export default LoadingDemo;

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New Demo app that shows off the spinners.

Comment threadextract-meta
let src;

if (!['.jsx', '.js'].includes(path.extname(filepath))) {
if (!['.js'].includes(path.extname(filepath))) {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently do not have any .jsx files in our source code, so I figured they could be used in a way to denote components that should not be picked up by extract-meta, so that we can use them internally in JS. It's an easy solution to have the spinners, in this case, in separate files and not in one huge Loading.react.js file.

Comment threadindex.html
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/theme/xq-light.min.css" />
<link rel="stylesheet" href="https://unpkg.com/react-select@1.0.0-rc.3/dist/react-select.css" />
<link rel="stylesheet" href="https://cdn.rawgit.com/chriddyp/abcbc02565dd495b676c3269240e09ca/raw/816de7d5c5d5626e3f3cac8e967070aa15da77e2/rc-slider.css"
/>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are no longer needed since we supply these CSS files ourselves in the source code (using style-loader etc)

Comment threadindex.html
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/codemirror.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/mode/javascript/javascript.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/react@15/dist/react.js"></script>
<script type="text/javascript" src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're supplying React in the devDependencies now, so this is no longer needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I dug through this because it was not obvious to me how the dependencies had changed based on the webpack.config.js and webpack.server.config.js changes in this PR -- they would not affect these script dependencies.

webpack.serve.config.js sets config.externals = undefined which makes webpack.config.js evaluate 'externals' in overrides to true which does not set react, react-dom, etc. as defaults.

Not going to ask for changes as this is out of scope, just documenting my own confusion. I think this could be improved on later.

Comment threadwebpack.config.js
rules: [
{
test: /\.js$/,
test: /\.jsx?$/,

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.jsx files weren't being picked up in the Webpack configs, this will add both .js and .jsx files.

config.output = {
filename: './output.js',
path: path.resolve(__dirname),
};

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the Demo app.

PropTypes.node,
]),

type: PropTypes.oneOf(['graph', 'cube', 'circle', 'dot', 'default']),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add a description docstring here.

<h3 className="dash-loading-title">
Loading {status.component_name}
's {status.prop_name}
</h3>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😸

Comment threadsrc/components/Input.react.js
Comment threadsrc/components/Loading/Loading.react.js Outdated
Comment threadsrc/components/Loading/spinners/CircleSpinner.jsx
Comment threadsrc/components/Loading/spinners/CircleSpinner.jsx
@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Released as prerelease 0.44.0rc2

Comment threadCHANGELOG.md Outdated

## [0.44.0] - 2019-02-13
### Added
- Loading component

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreleased, revert version change for final merge. Add issue link.

Marc-Andre-Rivet
Marc-Andre-Rivet previously approved these changes Feb 13, 2019

@Marc-Andre-RivetMarc-Andre-Rivet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor comments and questions

Comment threaddash_core_components/CircleSpinner.py Outdated
Comment threadsrc/components/DatePickerRange.react.js
Comment threadsrc/components/Loading/Loading.react.js Outdated
Comment threadsrc/components/Loading/Loading.react.js Outdated

@Marc-Andre-RivetMarc-Andre-Rivet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not mean to approve just yet :)

@Marc-Andre-Rivet
Marc-Andre-Rivet dismissed stale reviews from chriddyp and themself February 13, 2019 18:27

Mistake. Not quite there yet!

Comment threadsrc/components/Loading.react.js Outdated
@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

(Re) released as rc 0.43.0rc3 including fixes

R.type(this.props.children) !== 'Object' ||
R.type(this.props.children) !== 'Function'
) {
return <div className={className}>{this.props.children}</div>;

@Marc-Andre-RivetMarc-Andre-RivetFeb 15, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not using the id passed through props for id+key of this component, normal and loading cases. Might cause similar problems as what we've seen with other comps

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we're setting key anywhere in the components, so I don't think it'll cause problems. The key is set in dash-renderer, however. But, you're right - I should add the id prop here!

@eromoe

eromoe commented Feb 26, 2019

Copy link
Copy Markdown

I have installed 0.44.0rc2 , but no loading shows,

Is something wrong with my installed packages ? :

dash==0.36.0 # The core dash backend
dash-html-components==0.13.5 # HTML components
dash-core-components==0.44.0rc2 # Supercharged components
dash-table==3.1.11 # Interactive DataTable component (new!)
dash-daq==0.1.0 # DAQ components (newly open-sourced!)
dash-bootstrap-components

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Hi @eromoe - the packages you'd need are:

dash_html_components==0.14.0rc21
dash_renderer==0.18.0rc4
dash_core_components==0.43.0rc3

It looks like you're missing dash_renderer==0.18.0rc4!

Here's a link to the forums with a more detailed example of how to use this.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@valentijnnieman@T4rk1n@bpostlethwaite@Marc-Andre-Rivet@CP-Vub@Akronix@eromoe@chriddyp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Loading component - #352

Merged
valentijnnieman merged 66 commits into
masterfrom
loading_component
Feb 28, 2019
Merged

Loading component#352
valentijnnieman merged 66 commits into
masterfrom
loading_component

Conversation

@valentijnnieman

@valentijnniemanvalentijnnieman commented Oct 30, 2018

Copy link
Copy Markdown
Contributor

This is the new Loading component for the new Loading States api issue 267. For now it has a basic default spinner.

Please note!
I've had to make a small change to extract-meta to not pick up .jsx files, so that we can have .jsx files in src/ that are not supposed to be mapped to Dash components. This is so that I could split up all the spinners into separate files, that we don't want Dash to pick up as components - instead they should be JS only components that get used under the hood. There's probably a better fix here, let me know your thoughts please.

TODO:

  • Add more default spinners, and a prop for selecting which one to use (loading_screen_style = 'basic' | 'overlay' | 'spinner' | 'empty-div' | or something similar)
  • Support for full-screen spinners
  • Add props for styling the default spinner's colours and other
  • Add support for handling which prop caused loading time (once in renderer PR)
  • Allow for React components that don't get picked up by extract-meta, so we can have a file structure that allows separating of concerns.
  • Look into adding support for custom loading components, with this PR perhaps

SPINNERS:

edit: I'm also showing the component and prop Name in the HTML, just to show off that that information is being passed. In the final version of this component, I'll remove it (or at least change how it looks)

edit2: I've fixed the Demo app and I've added a Loading Demo app that you can fire up to check out all the spinners. npm start!

Comment threadsrc/components/Loading.react.js Outdated
Comment threadsrc/components/Loading.react.js Outdated
@T4rk1n

Copy link
Copy Markdown
Contributor

@valentijnnieman You wrap the component you want to have a loading with this loading component ?

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

@bpostlethwaite I think you mentioned specific loading spinners for Plotly on Friday? If there are any that you think we should incorporate into this component, could you link them here? Thanks in advance :)

@bpostlethwaite

Copy link
Copy Markdown
Member

https://github.com/plotly/streambed/blob/master/shelly/webapp/static/webapp/images/plotly-logo-loop.gif

But this one doesn't actually seem to have looping enabled. You'll need to open a GIF editor and enable looping.

I am pretty sure we should edit this one in streambed to support looping as well...

@bpostlethwaite

Copy link
Copy Markdown
Member

If you create a loop version let me know and I'll PR that back into streambed

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Hmm it's very small and blurry. I don't think we should have that as a default loading spinner, would rather have something in like we have here now! Taken from http://tobiasahlin.com/spinkit/ .

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

I made this https://codepen.io/Chunkydory/pen/qQOrwB which is a little bit campy! But I kind of like it. @cldougl also pointed out that this exists! https://codepen.io/doeg/pen/RWGoLR

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Here's the pen of the cube spinner I just added: https://codepen.io/Chunkydory/pen/aQdpPL

@Marc-Andre-Rivet

Copy link
Copy Markdown
Contributor

@valentijnnieman No specific suggestion, just a curated list of spinners
https://github.com/yangshun/awesome-spinners

@valentijnniemanvalentijnnieman changed the title [WIP]Loading componentLoading componentNov 13, 2018
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"builder": "3.2.2",
"color": "^3.1.0",

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New dependency used for darkening hex colors, used in the CubeSpinner component. It allows users to provide a color, and the component will figure out the appropriate darker colors that are used in the cube.

);
};

export default LoadingDemo;

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New Demo app that shows off the spinners.

Comment threadextract-meta
let src;

if (!['.jsx', '.js'].includes(path.extname(filepath))) {
if (!['.js'].includes(path.extname(filepath))) {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently do not have any .jsx files in our source code, so I figured they could be used in a way to denote components that should not be picked up by extract-meta, so that we can use them internally in JS. It's an easy solution to have the spinners, in this case, in separate files and not in one huge Loading.react.js file.

Comment threadindex.html
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/theme/xq-light.min.css" />
<link rel="stylesheet" href="https://unpkg.com/react-select@1.0.0-rc.3/dist/react-select.css" />
<link rel="stylesheet" href="https://cdn.rawgit.com/chriddyp/abcbc02565dd495b676c3269240e09ca/raw/816de7d5c5d5626e3f3cac8e967070aa15da77e2/rc-slider.css"
/>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are no longer needed since we supply these CSS files ourselves in the source code (using style-loader etc)

Comment threadindex.html
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/codemirror.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/mode/javascript/javascript.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/react@15/dist/react.js"></script>
<script type="text/javascript" src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're supplying React in the devDependencies now, so this is no longer needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I dug through this because it was not obvious to me how the dependencies had changed based on the webpack.config.js and webpack.server.config.js changes in this PR -- they would not affect these script dependencies.

webpack.serve.config.js sets config.externals = undefined which makes webpack.config.js evaluate 'externals' in overrides to true which does not set react, react-dom, etc. as defaults.

Not going to ask for changes as this is out of scope, just documenting my own confusion. I think this could be improved on later.

Comment threadwebpack.config.js
rules: [
{
test: /\.js$/,
test: /\.jsx?$/,

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.jsx files weren't being picked up in the Webpack configs, this will add both .js and .jsx files.

config.output = {
filename: './output.js',
path: path.resolve(__dirname),
};

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the Demo app.

PropTypes.node,
]),

type: PropTypes.oneOf(['graph', 'cube', 'circle', 'dot', 'default']),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add a description docstring here.

<h3 className="dash-loading-title">
Loading {status.component_name}
's {status.prop_name}
</h3>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😸

Comment threadsrc/components/Input.react.js
Comment threadsrc/components/Loading/Loading.react.js Outdated
Comment threadsrc/components/Loading/spinners/CircleSpinner.jsx
Comment threadsrc/components/Loading/spinners/CircleSpinner.jsx
@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Released as prerelease 0.44.0rc2

Comment threadCHANGELOG.md Outdated

## [0.44.0] - 2019-02-13
### Added
- Loading component

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreleased, revert version change for final merge. Add issue link.

Marc-Andre-Rivet
Marc-Andre-Rivet previously approved these changes Feb 13, 2019

@Marc-Andre-RivetMarc-Andre-Rivet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor comments and questions

Comment threaddash_core_components/CircleSpinner.py Outdated
Comment threadsrc/components/DatePickerRange.react.js
Comment threadsrc/components/Loading/Loading.react.js Outdated
Comment threadsrc/components/Loading/Loading.react.js Outdated

@Marc-Andre-RivetMarc-Andre-Rivet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not mean to approve just yet :)

@Marc-Andre-Rivet
Marc-Andre-Rivet dismissed stale reviews from chriddyp and themself February 13, 2019 18:27

Mistake. Not quite there yet!

Comment threadsrc/components/Loading.react.js Outdated
@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

(Re) released as rc 0.43.0rc3 including fixes

R.type(this.props.children) !== 'Object' ||
R.type(this.props.children) !== 'Function'
) {
return <div className={className}>{this.props.children}</div>;

@Marc-Andre-RivetMarc-Andre-RivetFeb 15, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not using the id passed through props for id+key of this component, normal and loading cases. Might cause similar problems as what we've seen with other comps

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we're setting key anywhere in the components, so I don't think it'll cause problems. The key is set in dash-renderer, however. But, you're right - I should add the id prop here!

@eromoe

eromoe commented Feb 26, 2019

Copy link
Copy Markdown

I have installed 0.44.0rc2 , but no loading shows,

Is something wrong with my installed packages ? :

dash==0.36.0 # The core dash backend
dash-html-components==0.13.5 # HTML components
dash-core-components==0.44.0rc2 # Supercharged components
dash-table==3.1.11 # Interactive DataTable component (new!)
dash-daq==0.1.0 # DAQ components (newly open-sourced!)
dash-bootstrap-components

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Hi @eromoe - the packages you'd need are:

dash_html_components==0.14.0rc21
dash_renderer==0.18.0rc4
dash_core_components==0.43.0rc3

It looks like you're missing dash_renderer==0.18.0rc4!

Here's a link to the forums with a more detailed example of how to use this.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@valentijnnieman@T4rk1n@bpostlethwaite@Marc-Andre-Rivet@CP-Vub@Akronix@eromoe@chriddyp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Loading component - #352

Merged
valentijnnieman merged 66 commits into
masterfrom
loading_component
Feb 28, 2019
Merged

Loading component#352
valentijnnieman merged 66 commits into
masterfrom
loading_component

Conversation

@valentijnnieman

@valentijnniemanvalentijnnieman commented Oct 30, 2018

Copy link
Copy Markdown
Contributor

This is the new Loading component for the new Loading States api issue 267. For now it has a basic default spinner.

Please note!
I've had to make a small change to extract-meta to not pick up .jsx files, so that we can have .jsx files in src/ that are not supposed to be mapped to Dash components. This is so that I could split up all the spinners into separate files, that we don't want Dash to pick up as components - instead they should be JS only components that get used under the hood. There's probably a better fix here, let me know your thoughts please.

TODO:

  • Add more default spinners, and a prop for selecting which one to use (loading_screen_style = 'basic' | 'overlay' | 'spinner' | 'empty-div' | or something similar)
  • Support for full-screen spinners
  • Add props for styling the default spinner's colours and other
  • Add support for handling which prop caused loading time (once in renderer PR)
  • Allow for React components that don't get picked up by extract-meta, so we can have a file structure that allows separating of concerns.
  • Look into adding support for custom loading components, with this PR perhaps

SPINNERS:

edit: I'm also showing the component and prop Name in the HTML, just to show off that that information is being passed. In the final version of this component, I'll remove it (or at least change how it looks)

edit2: I've fixed the Demo app and I've added a Loading Demo app that you can fire up to check out all the spinners. npm start!

Comment threadsrc/components/Loading.react.js Outdated
Comment threadsrc/components/Loading.react.js Outdated
@T4rk1n

Copy link
Copy Markdown
Contributor

@valentijnnieman You wrap the component you want to have a loading with this loading component ?

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

@bpostlethwaite I think you mentioned specific loading spinners for Plotly on Friday? If there are any that you think we should incorporate into this component, could you link them here? Thanks in advance :)

@bpostlethwaite

Copy link
Copy Markdown
Member

https://github.com/plotly/streambed/blob/master/shelly/webapp/static/webapp/images/plotly-logo-loop.gif

But this one doesn't actually seem to have looping enabled. You'll need to open a GIF editor and enable looping.

I am pretty sure we should edit this one in streambed to support looping as well...

@bpostlethwaite

Copy link
Copy Markdown
Member

If you create a loop version let me know and I'll PR that back into streambed

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Hmm it's very small and blurry. I don't think we should have that as a default loading spinner, would rather have something in like we have here now! Taken from http://tobiasahlin.com/spinkit/ .

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

I made this https://codepen.io/Chunkydory/pen/qQOrwB which is a little bit campy! But I kind of like it. @cldougl also pointed out that this exists! https://codepen.io/doeg/pen/RWGoLR

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Here's the pen of the cube spinner I just added: https://codepen.io/Chunkydory/pen/aQdpPL

@Marc-Andre-Rivet

Copy link
Copy Markdown
Contributor

@valentijnnieman No specific suggestion, just a curated list of spinners
https://github.com/yangshun/awesome-spinners

@valentijnniemanvalentijnnieman changed the title [WIP]Loading componentLoading componentNov 13, 2018
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"builder": "3.2.2",
"color": "^3.1.0",

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New dependency used for darkening hex colors, used in the CubeSpinner component. It allows users to provide a color, and the component will figure out the appropriate darker colors that are used in the cube.

);
};

export default LoadingDemo;

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New Demo app that shows off the spinners.

Comment threadextract-meta
let src;

if (!['.jsx', '.js'].includes(path.extname(filepath))) {
if (!['.js'].includes(path.extname(filepath))) {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently do not have any .jsx files in our source code, so I figured they could be used in a way to denote components that should not be picked up by extract-meta, so that we can use them internally in JS. It's an easy solution to have the spinners, in this case, in separate files and not in one huge Loading.react.js file.

Comment threadindex.html
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/theme/xq-light.min.css" />
<link rel="stylesheet" href="https://unpkg.com/react-select@1.0.0-rc.3/dist/react-select.css" />
<link rel="stylesheet" href="https://cdn.rawgit.com/chriddyp/abcbc02565dd495b676c3269240e09ca/raw/816de7d5c5d5626e3f3cac8e967070aa15da77e2/rc-slider.css"
/>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are no longer needed since we supply these CSS files ourselves in the source code (using style-loader etc)

Comment threadindex.html
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/codemirror.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/mode/javascript/javascript.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/react@15/dist/react.js"></script>
<script type="text/javascript" src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're supplying React in the devDependencies now, so this is no longer needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I dug through this because it was not obvious to me how the dependencies had changed based on the webpack.config.js and webpack.server.config.js changes in this PR -- they would not affect these script dependencies.

webpack.serve.config.js sets config.externals = undefined which makes webpack.config.js evaluate 'externals' in overrides to true which does not set react, react-dom, etc. as defaults.

Not going to ask for changes as this is out of scope, just documenting my own confusion. I think this could be improved on later.

Comment threadwebpack.config.js
rules: [
{
test: /\.js$/,
test: /\.jsx?$/,

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.jsx files weren't being picked up in the Webpack configs, this will add both .js and .jsx files.

config.output = {
filename: './output.js',
path: path.resolve(__dirname),
};

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the Demo app.

PropTypes.node,
]),

type: PropTypes.oneOf(['graph', 'cube', 'circle', 'dot', 'default']),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add a description docstring here.

<h3 className="dash-loading-title">
Loading {status.component_name}
's {status.prop_name}
</h3>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😸

Comment threadsrc/components/Input.react.js
Comment threadsrc/components/Loading/Loading.react.js Outdated
Comment threadsrc/components/Loading/spinners/CircleSpinner.jsx
Comment threadsrc/components/Loading/spinners/CircleSpinner.jsx
@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Released as prerelease 0.44.0rc2

Comment threadCHANGELOG.md Outdated

## [0.44.0] - 2019-02-13
### Added
- Loading component

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreleased, revert version change for final merge. Add issue link.

Marc-Andre-Rivet
Marc-Andre-Rivet previously approved these changes Feb 13, 2019

@Marc-Andre-RivetMarc-Andre-Rivet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor comments and questions

Comment threaddash_core_components/CircleSpinner.py Outdated
Comment threadsrc/components/DatePickerRange.react.js
Comment threadsrc/components/Loading/Loading.react.js Outdated
Comment threadsrc/components/Loading/Loading.react.js Outdated

@Marc-Andre-RivetMarc-Andre-Rivet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not mean to approve just yet :)

@Marc-Andre-Rivet
Marc-Andre-Rivet dismissed stale reviews from chriddyp and themself February 13, 2019 18:27

Mistake. Not quite there yet!

Comment threadsrc/components/Loading.react.js Outdated
@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

(Re) released as rc 0.43.0rc3 including fixes

R.type(this.props.children) !== 'Object' ||
R.type(this.props.children) !== 'Function'
) {
return <div className={className}>{this.props.children}</div>;

@Marc-Andre-RivetMarc-Andre-RivetFeb 15, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not using the id passed through props for id+key of this component, normal and loading cases. Might cause similar problems as what we've seen with other comps

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we're setting key anywhere in the components, so I don't think it'll cause problems. The key is set in dash-renderer, however. But, you're right - I should add the id prop here!

@eromoe

eromoe commented Feb 26, 2019

Copy link
Copy Markdown

I have installed 0.44.0rc2 , but no loading shows,

Is something wrong with my installed packages ? :

dash==0.36.0 # The core dash backend
dash-html-components==0.13.5 # HTML components
dash-core-components==0.44.0rc2 # Supercharged components
dash-table==3.1.11 # Interactive DataTable component (new!)
dash-daq==0.1.0 # DAQ components (newly open-sourced!)
dash-bootstrap-components

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Hi @eromoe - the packages you'd need are:

dash_html_components==0.14.0rc21
dash_renderer==0.18.0rc4
dash_core_components==0.43.0rc3

It looks like you're missing dash_renderer==0.18.0rc4!

Here's a link to the forums with a more detailed example of how to use this.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@valentijnnieman@T4rk1n@bpostlethwaite@Marc-Andre-Rivet@CP-Vub@Akronix@eromoe@chriddyp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Loading component - #352

Merged
valentijnnieman merged 66 commits into
masterfrom
loading_component
Feb 28, 2019
Merged

Loading component#352
valentijnnieman merged 66 commits into
masterfrom
loading_component

Conversation

@valentijnnieman

@valentijnniemanvalentijnnieman commented Oct 30, 2018

Copy link
Copy Markdown
Contributor

This is the new Loading component for the new Loading States api issue 267. For now it has a basic default spinner.

Please note!
I've had to make a small change to extract-meta to not pick up .jsx files, so that we can have .jsx files in src/ that are not supposed to be mapped to Dash components. This is so that I could split up all the spinners into separate files, that we don't want Dash to pick up as components - instead they should be JS only components that get used under the hood. There's probably a better fix here, let me know your thoughts please.

TODO:

  • Add more default spinners, and a prop for selecting which one to use (loading_screen_style = 'basic' | 'overlay' | 'spinner' | 'empty-div' | or something similar)
  • Support for full-screen spinners
  • Add props for styling the default spinner's colours and other
  • Add support for handling which prop caused loading time (once in renderer PR)
  • Allow for React components that don't get picked up by extract-meta, so we can have a file structure that allows separating of concerns.
  • Look into adding support for custom loading components, with this PR perhaps

SPINNERS:

edit: I'm also showing the component and prop Name in the HTML, just to show off that that information is being passed. In the final version of this component, I'll remove it (or at least change how it looks)

edit2: I've fixed the Demo app and I've added a Loading Demo app that you can fire up to check out all the spinners. npm start!

Comment threadsrc/components/Loading.react.js Outdated
Comment threadsrc/components/Loading.react.js Outdated
@T4rk1n

Copy link
Copy Markdown
Contributor

@valentijnnieman You wrap the component you want to have a loading with this loading component ?

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

@bpostlethwaite I think you mentioned specific loading spinners for Plotly on Friday? If there are any that you think we should incorporate into this component, could you link them here? Thanks in advance :)

@bpostlethwaite

Copy link
Copy Markdown
Member

https://github.com/plotly/streambed/blob/master/shelly/webapp/static/webapp/images/plotly-logo-loop.gif

But this one doesn't actually seem to have looping enabled. You'll need to open a GIF editor and enable looping.

I am pretty sure we should edit this one in streambed to support looping as well...

@bpostlethwaite

Copy link
Copy Markdown
Member

If you create a loop version let me know and I'll PR that back into streambed

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Hmm it's very small and blurry. I don't think we should have that as a default loading spinner, would rather have something in like we have here now! Taken from http://tobiasahlin.com/spinkit/ .

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

I made this https://codepen.io/Chunkydory/pen/qQOrwB which is a little bit campy! But I kind of like it. @cldougl also pointed out that this exists! https://codepen.io/doeg/pen/RWGoLR

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Here's the pen of the cube spinner I just added: https://codepen.io/Chunkydory/pen/aQdpPL

@Marc-Andre-Rivet

Copy link
Copy Markdown
Contributor

@valentijnnieman No specific suggestion, just a curated list of spinners
https://github.com/yangshun/awesome-spinners

@valentijnniemanvalentijnnieman changed the title [WIP]Loading componentLoading componentNov 13, 2018
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"builder": "3.2.2",
"color": "^3.1.0",

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New dependency used for darkening hex colors, used in the CubeSpinner component. It allows users to provide a color, and the component will figure out the appropriate darker colors that are used in the cube.

);
};

export default LoadingDemo;

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New Demo app that shows off the spinners.

Comment threadextract-meta
let src;

if (!['.jsx', '.js'].includes(path.extname(filepath))) {
if (!['.js'].includes(path.extname(filepath))) {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently do not have any .jsx files in our source code, so I figured they could be used in a way to denote components that should not be picked up by extract-meta, so that we can use them internally in JS. It's an easy solution to have the spinners, in this case, in separate files and not in one huge Loading.react.js file.

Comment threadindex.html
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/theme/xq-light.min.css" />
<link rel="stylesheet" href="https://unpkg.com/react-select@1.0.0-rc.3/dist/react-select.css" />
<link rel="stylesheet" href="https://cdn.rawgit.com/chriddyp/abcbc02565dd495b676c3269240e09ca/raw/816de7d5c5d5626e3f3cac8e967070aa15da77e2/rc-slider.css"
/>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are no longer needed since we supply these CSS files ourselves in the source code (using style-loader etc)

Comment threadindex.html
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/codemirror.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/mode/javascript/javascript.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/react@15/dist/react.js"></script>
<script type="text/javascript" src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're supplying React in the devDependencies now, so this is no longer needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I dug through this because it was not obvious to me how the dependencies had changed based on the webpack.config.js and webpack.server.config.js changes in this PR -- they would not affect these script dependencies.

webpack.serve.config.js sets config.externals = undefined which makes webpack.config.js evaluate 'externals' in overrides to true which does not set react, react-dom, etc. as defaults.

Not going to ask for changes as this is out of scope, just documenting my own confusion. I think this could be improved on later.

Comment threadwebpack.config.js
rules: [
{
test: /\.js$/,
test: /\.jsx?$/,

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.jsx files weren't being picked up in the Webpack configs, this will add both .js and .jsx files.

config.output = {
filename: './output.js',
path: path.resolve(__dirname),
};

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the Demo app.

PropTypes.node,
]),

type: PropTypes.oneOf(['graph', 'cube', 'circle', 'dot', 'default']),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add a description docstring here.

<h3 className="dash-loading-title">
Loading {status.component_name}
's {status.prop_name}
</h3>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😸

Comment threadsrc/components/Input.react.js
Comment threadsrc/components/Loading/Loading.react.js Outdated
Comment threadsrc/components/Loading/spinners/CircleSpinner.jsx
Comment threadsrc/components/Loading/spinners/CircleSpinner.jsx
@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Released as prerelease 0.44.0rc2

Comment threadCHANGELOG.md Outdated

## [0.44.0] - 2019-02-13
### Added
- Loading component

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreleased, revert version change for final merge. Add issue link.

Marc-Andre-Rivet
Marc-Andre-Rivet previously approved these changes Feb 13, 2019

@Marc-Andre-RivetMarc-Andre-Rivet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor comments and questions

Comment threaddash_core_components/CircleSpinner.py Outdated
Comment threadsrc/components/DatePickerRange.react.js
Comment threadsrc/components/Loading/Loading.react.js Outdated
Comment threadsrc/components/Loading/Loading.react.js Outdated

@Marc-Andre-RivetMarc-Andre-Rivet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not mean to approve just yet :)

@Marc-Andre-Rivet
Marc-Andre-Rivet dismissed stale reviews from chriddyp and themself February 13, 2019 18:27

Mistake. Not quite there yet!

Comment threadsrc/components/Loading.react.js Outdated
@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

(Re) released as rc 0.43.0rc3 including fixes

R.type(this.props.children) !== 'Object' ||
R.type(this.props.children) !== 'Function'
) {
return <div className={className}>{this.props.children}</div>;

@Marc-Andre-RivetMarc-Andre-RivetFeb 15, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not using the id passed through props for id+key of this component, normal and loading cases. Might cause similar problems as what we've seen with other comps

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we're setting key anywhere in the components, so I don't think it'll cause problems. The key is set in dash-renderer, however. But, you're right - I should add the id prop here!

@eromoe

eromoe commented Feb 26, 2019

Copy link
Copy Markdown

I have installed 0.44.0rc2 , but no loading shows,

Is something wrong with my installed packages ? :

dash==0.36.0 # The core dash backend
dash-html-components==0.13.5 # HTML components
dash-core-components==0.44.0rc2 # Supercharged components
dash-table==3.1.11 # Interactive DataTable component (new!)
dash-daq==0.1.0 # DAQ components (newly open-sourced!)
dash-bootstrap-components

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Hi @eromoe - the packages you'd need are:

dash_html_components==0.14.0rc21
dash_renderer==0.18.0rc4
dash_core_components==0.43.0rc3

It looks like you're missing dash_renderer==0.18.0rc4!

Here's a link to the forums with a more detailed example of how to use this.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@valentijnnieman@T4rk1n@bpostlethwaite@Marc-Andre-Rivet@CP-Vub@Akronix@eromoe@chriddyp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Loading component - #352

Merged
valentijnnieman merged 66 commits into
masterfrom
loading_component
Feb 28, 2019
Merged

Loading component#352
valentijnnieman merged 66 commits into
masterfrom
loading_component

Conversation

@valentijnnieman

@valentijnniemanvalentijnnieman commented Oct 30, 2018

Copy link
Copy Markdown
Contributor

This is the new Loading component for the new Loading States api issue 267. For now it has a basic default spinner.

Please note!
I've had to make a small change to extract-meta to not pick up .jsx files, so that we can have .jsx files in src/ that are not supposed to be mapped to Dash components. This is so that I could split up all the spinners into separate files, that we don't want Dash to pick up as components - instead they should be JS only components that get used under the hood. There's probably a better fix here, let me know your thoughts please.

TODO:

  • Add more default spinners, and a prop for selecting which one to use (loading_screen_style = 'basic' | 'overlay' | 'spinner' | 'empty-div' | or something similar)
  • Support for full-screen spinners
  • Add props for styling the default spinner's colours and other
  • Add support for handling which prop caused loading time (once in renderer PR)
  • Allow for React components that don't get picked up by extract-meta, so we can have a file structure that allows separating of concerns.
  • Look into adding support for custom loading components, with this PR perhaps

SPINNERS:

edit: I'm also showing the component and prop Name in the HTML, just to show off that that information is being passed. In the final version of this component, I'll remove it (or at least change how it looks)

edit2: I've fixed the Demo app and I've added a Loading Demo app that you can fire up to check out all the spinners. npm start!

Comment threadsrc/components/Loading.react.js Outdated
Comment threadsrc/components/Loading.react.js Outdated
@T4rk1n

Copy link
Copy Markdown
Contributor

@valentijnnieman You wrap the component you want to have a loading with this loading component ?

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

@bpostlethwaite I think you mentioned specific loading spinners for Plotly on Friday? If there are any that you think we should incorporate into this component, could you link them here? Thanks in advance :)

@bpostlethwaite

Copy link
Copy Markdown
Member

https://github.com/plotly/streambed/blob/master/shelly/webapp/static/webapp/images/plotly-logo-loop.gif

But this one doesn't actually seem to have looping enabled. You'll need to open a GIF editor and enable looping.

I am pretty sure we should edit this one in streambed to support looping as well...

@bpostlethwaite

Copy link
Copy Markdown
Member

If you create a loop version let me know and I'll PR that back into streambed

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Hmm it's very small and blurry. I don't think we should have that as a default loading spinner, would rather have something in like we have here now! Taken from http://tobiasahlin.com/spinkit/ .

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

I made this https://codepen.io/Chunkydory/pen/qQOrwB which is a little bit campy! But I kind of like it. @cldougl also pointed out that this exists! https://codepen.io/doeg/pen/RWGoLR

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Here's the pen of the cube spinner I just added: https://codepen.io/Chunkydory/pen/aQdpPL

@Marc-Andre-Rivet

Copy link
Copy Markdown
Contributor

@valentijnnieman No specific suggestion, just a curated list of spinners
https://github.com/yangshun/awesome-spinners

@valentijnniemanvalentijnnieman changed the title [WIP]Loading componentLoading componentNov 13, 2018
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"builder": "3.2.2",
"color": "^3.1.0",

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New dependency used for darkening hex colors, used in the CubeSpinner component. It allows users to provide a color, and the component will figure out the appropriate darker colors that are used in the cube.

);
};

export default LoadingDemo;

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New Demo app that shows off the spinners.

Comment threadextract-meta
let src;

if (!['.jsx', '.js'].includes(path.extname(filepath))) {
if (!['.js'].includes(path.extname(filepath))) {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently do not have any .jsx files in our source code, so I figured they could be used in a way to denote components that should not be picked up by extract-meta, so that we can use them internally in JS. It's an easy solution to have the spinners, in this case, in separate files and not in one huge Loading.react.js file.

Comment threadindex.html
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/theme/xq-light.min.css" />
<link rel="stylesheet" href="https://unpkg.com/react-select@1.0.0-rc.3/dist/react-select.css" />
<link rel="stylesheet" href="https://cdn.rawgit.com/chriddyp/abcbc02565dd495b676c3269240e09ca/raw/816de7d5c5d5626e3f3cac8e967070aa15da77e2/rc-slider.css"
/>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are no longer needed since we supply these CSS files ourselves in the source code (using style-loader etc)

Comment threadindex.html
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/codemirror.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/mode/javascript/javascript.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/react@15/dist/react.js"></script>
<script type="text/javascript" src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're supplying React in the devDependencies now, so this is no longer needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I dug through this because it was not obvious to me how the dependencies had changed based on the webpack.config.js and webpack.server.config.js changes in this PR -- they would not affect these script dependencies.

webpack.serve.config.js sets config.externals = undefined which makes webpack.config.js evaluate 'externals' in overrides to true which does not set react, react-dom, etc. as defaults.

Not going to ask for changes as this is out of scope, just documenting my own confusion. I think this could be improved on later.

Comment threadwebpack.config.js
rules: [
{
test: /\.js$/,
test: /\.jsx?$/,

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.jsx files weren't being picked up in the Webpack configs, this will add both .js and .jsx files.

config.output = {
filename: './output.js',
path: path.resolve(__dirname),
};

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the Demo app.

PropTypes.node,
]),

type: PropTypes.oneOf(['graph', 'cube', 'circle', 'dot', 'default']),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add a description docstring here.

<h3 className="dash-loading-title">
Loading {status.component_name}
's {status.prop_name}
</h3>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😸

Comment threadsrc/components/Input.react.js
Comment threadsrc/components/Loading/Loading.react.js Outdated
Comment threadsrc/components/Loading/spinners/CircleSpinner.jsx
Comment threadsrc/components/Loading/spinners/CircleSpinner.jsx
@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Released as prerelease 0.44.0rc2

Comment threadCHANGELOG.md Outdated

## [0.44.0] - 2019-02-13
### Added
- Loading component

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreleased, revert version change for final merge. Add issue link.

Marc-Andre-Rivet
Marc-Andre-Rivet previously approved these changes Feb 13, 2019

@Marc-Andre-RivetMarc-Andre-Rivet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor comments and questions

Comment threaddash_core_components/CircleSpinner.py Outdated
Comment threadsrc/components/DatePickerRange.react.js
Comment threadsrc/components/Loading/Loading.react.js Outdated
Comment threadsrc/components/Loading/Loading.react.js Outdated

@Marc-Andre-RivetMarc-Andre-Rivet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not mean to approve just yet :)

@Marc-Andre-Rivet
Marc-Andre-Rivet dismissed stale reviews from chriddyp and themself February 13, 2019 18:27

Mistake. Not quite there yet!

Comment threadsrc/components/Loading.react.js Outdated
@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

(Re) released as rc 0.43.0rc3 including fixes

R.type(this.props.children) !== 'Object' ||
R.type(this.props.children) !== 'Function'
) {
return <div className={className}>{this.props.children}</div>;

@Marc-Andre-RivetMarc-Andre-RivetFeb 15, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not using the id passed through props for id+key of this component, normal and loading cases. Might cause similar problems as what we've seen with other comps

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we're setting key anywhere in the components, so I don't think it'll cause problems. The key is set in dash-renderer, however. But, you're right - I should add the id prop here!

@eromoe

eromoe commented Feb 26, 2019

Copy link
Copy Markdown

I have installed 0.44.0rc2 , but no loading shows,

Is something wrong with my installed packages ? :

dash==0.36.0 # The core dash backend
dash-html-components==0.13.5 # HTML components
dash-core-components==0.44.0rc2 # Supercharged components
dash-table==3.1.11 # Interactive DataTable component (new!)
dash-daq==0.1.0 # DAQ components (newly open-sourced!)
dash-bootstrap-components

@valentijnnieman

Copy link
Copy Markdown
ContributorAuthor

Hi @eromoe - the packages you'd need are:

dash_html_components==0.14.0rc21
dash_renderer==0.18.0rc4
dash_core_components==0.43.0rc3

It looks like you're missing dash_renderer==0.18.0rc4!

Here's a link to the forums with a more detailed example of how to use this.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@valentijnnieman@T4rk1n@bpostlethwaite@Marc-Andre-Rivet@CP-Vub@Akronix@eromoe@chriddyp