Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#435: show spinner indicating page is loading #449

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use http_header component instead of disabling compression everywhere
  • Loading branch information
djyotta committed Jun 26, 2024
commit 2a745e7e108156ac0031ea2b63ed6aeb59702aef
4 changes: 4 additions & 0 deletions examples/official-site/examples/show-progress/go.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
-- Disable actix-web compression middleware:
-- https://github.com/actix/actix-web/issues/3410
SELECT 'http_header' AS component, 'Identity' AS "Content-Encoding";

SELECT 'shell' AS component, 'light' AS theme;

-- can disable the spinner to show only progress bar
Expand Down
4 changes: 4 additions & 0 deletions examples/official-site/examples/show-progress/index.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
-- Disable actix-web compression middleware:
-- https://github.com/actix/actix-web/issues/3410
SELECT 'http_header' AS component, 'Identity' AS "Content-Encoding";

SELECT 'shell' AS component, 'dark' AS theme;

SELECT 'loader-start' AS component,
Expand Down
24 changes: 12 additions & 12 deletions examples/official-site/sqlpage/migrations/01_documentation.sql
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ Default is "spinner-border".
Set to the empty string to disable the spinner - e.g. to display only progress
updates.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've noticed this whole approach doesn't work inside run_sql for some reason. So I should note that 'loader-start' component should be selected before descending into run_sql.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, run_sql is a function, it returns a single json value all at once, it can't stream its results.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought as much but didn't want to assume. It's good to have the clarification.

', 'TEXT', TRUE, TRUE),
('size', 'Size of the spinner eg. sm, lg', 'TEXT', TRUE, TRUE),
('size', 'Size of the spinner (e.g. sm, lg) [see here](https://tabler.io/docs/components/progress)', 'TEXT', TRUE, TRUE),
('color', 'Color of the spinner', 'COLOR', TRUE, TRUE)
) x;

Expand All @@ -779,6 +779,17 @@ Hide the spinner displayed by the loader-start component.
INSERT INTO component(name, icon, description, introduced_in_version) VALUES
('progress', 'time-duration-15', 'Display a progress bar.', '0.25.0');

INSERT INTO parameter(component, name, description_md, type, top_level, optional) SELECT 'progress', * FROM (VALUES
-- top-level
('percent', 'Number between 0 and 100.', 'INTEGER', TRUE, TRUE),
('stage', 'A message to display under the progress bar to indicate which stage the process is at.', 'TEXT', TRUE, TRUE),
('color', 'The fill color of the progress bar', 'COLOR', TRUE, TRUE),
('size', 'The size of the progress bar (e.g. sm, lg) [see here](https://tabler.io/docs/components/progress)', 'TEXT', TRUE, TRUE),
-- item-level
('percent', 'Number between 0 and 100.', 'INTEGER', FALSE, TRUE),
('stage', 'A message to display under the progress bar to indicate which stage the process is at.', 'TEXT', FALSE, TRUE)
) x;

INSERT INTO example(component, description, properties) VALUES
('loader-start', '
Will be displayed until [loader-stop](/documentation.sql?component=loader-stop) is selected.
Expand Down Expand Up @@ -809,17 +820,6 @@ Source is [here](https://github.com/lovasoa/SQLpage/tree/main/examples/official-
', NULL)
;

INSERT INTO parameter(component, name, description_md, type, top_level, optional) SELECT 'progress', * FROM (VALUES
-- top-level
('percent', 'Number between 0 and 100.', 'INTEGER', TRUE, TRUE),
('stage', 'A message to display under the progress bar to indicate which stage the process is at.', 'TEXT', TRUE, TRUE),
('color', 'The fill color of the progress bar', 'COLOR', TRUE, TRUE),
('size', 'The size of the progress bar [see here](https://tabler.io/docs/components/progress)', 'TEXT', TRUE, TRUE),
-- item-level
('percent', 'Number between 0 and 100.', 'INTEGER', FALSE, TRUE),
('stage', 'A message to display under the progress bar to indicate which stage the process is at.', 'TEXT', FALSE, TRUE)
) x;

INSERT INTO component(name, icon, description) VALUES
('shell', 'layout-navbar', 'Personalize the "shell" surrounding your page contents. Used to set properties for the entire page.');

Expand Down
3 changes: 0 additions & 3 deletions examples/official-site/sqlpage/sqlpage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ database_url: "sqlite::memory:"

# We have a file upload example, and would like to limit the size of the uploaded files
max_uploaded_file_size: 256000

# For the show-progress example to work, we have to disable compression
compress_responses: False