diff --git a/README.md b/README.md index 7778612..a41e07e 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ List of possible issues you can experience and solutions to them: - Page or Map stays blank and Developer Tools Console shows "net::ERR_QUIC_PROTOCOL_ERROR 200 (OK)" -Solution: Try reloading the page. Otherwise, if in Google Chrome, navigate to chrome://flags/#enable-quic in and change Experimental QUIC Protocol dropdown to Disabled. +Solution: Try reloading the page. Otherwise, if in Google Chrome, navigate to chrome://flags/#enable-quic and change Experimental QUIC Protocol dropdown to Disabled. - Model seems to be loaded incomplete @@ -170,9 +170,6 @@ Repeated launch: cd pygeoapi_venv Scripts\activate cd pygeoapi -python -m pip install --upgrade specklepy==2.19.6 -python -m pip install pydantic==1.10.17 -python pygeoapi\provider\speckle_utils\patch\patch_specklepy.py python setup.py install set PYGEOAPI_CONFIG=example-config.yml set PYGEOAPI_OPENAPI=example-config.yml diff --git a/pygeoapi/flask_app.py b/pygeoapi/flask_app.py index 43e0e38..455ed66 100644 --- a/pygeoapi/flask_app.py +++ b/pygeoapi/flask_app.py @@ -35,7 +35,8 @@ from typing import Union import click from flask import (Flask, Blueprint, make_response, request, - send_from_directory, Response, Request) + send_from_directory, Response, Request, stream_with_context) +from http import HTTPStatus from pygeoapi.api import API, APIRequest, apply_gzip import pygeoapi.api.coverages as coverages_api @@ -47,7 +48,7 @@ import pygeoapi.api.stac as stac_api import pygeoapi.api.tiles as tiles_api from pygeoapi.openapi import load_openapi_document from pygeoapi.config import get_config -from pygeoapi.util import get_mimetype, get_api_rules +from pygeoapi.util import get_mimetype, get_api_rules, render_j2_template CONFIG = get_config() @@ -195,12 +196,29 @@ def landing_page(): # if requested from the browser, return this, otherwise ignore IF statement if request.method == 'GET' and browser_agent: # list items - return execute_from_flask(itemtypes_api.get_collection_items, + + def generate(): + yield loading_screen().data + browser_response = execute_from_flask(itemtypes_api.get_collection_items, request, collection_id, skip_valid_check=True) + yield browser_response.data + return Response(stream_with_context(generate())) + return get_response(api_.landing_page(request)) +def loading_screen(): + """ + Loading empty page + + :returns: HTTP response + """ + + content = render_j2_template(api_.tpl_config, 'loading_screen.html',{}) + + return get_response((request.headers, HTTPStatus.OK, content)) + @BLUEPRINT.route('/openapi') def openapi(): """ diff --git a/pygeoapi/static/img/speckle_cube_loading.gif b/pygeoapi/static/img/speckle_cube_loading.gif new file mode 100644 index 0000000..7c43f3f Binary files /dev/null and b/pygeoapi/static/img/speckle_cube_loading.gif differ diff --git a/pygeoapi/templates/_base.html b/pygeoapi/templates/_base.html index abe30da..4f3da45 100644 --- a/pygeoapi/templates/_base.html +++ b/pygeoapi/templates/_base.html @@ -123,6 +123,13 @@ {% endif %} +