return separate response for browser-run apps
This commit is contained in:
+23
-15
@@ -168,6 +168,21 @@ def execute_from_flask(api_function, request: Request, *args,
|
||||
return get_response((headers, status, content))
|
||||
|
||||
|
||||
def generate():
|
||||
collection_id = "speckle"
|
||||
|
||||
yield loading_screen().data
|
||||
|
||||
try:
|
||||
browser_response = execute_from_flask(itemtypes_api.get_collection_items,
|
||||
request, collection_id,
|
||||
skip_valid_check=True)
|
||||
yield browser_response.data
|
||||
|
||||
except Exception as ex:
|
||||
yield error_screen(ex).data
|
||||
|
||||
|
||||
@BLUEPRINT.route('/')
|
||||
def landing_page():
|
||||
"""
|
||||
@@ -176,8 +191,6 @@ def landing_page():
|
||||
:returns: HTTP response
|
||||
"""
|
||||
|
||||
collection_id = "speckle"
|
||||
|
||||
agent = request.headers.get('User-Agent')
|
||||
# Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
|
||||
# Mozilla/5.0 QGIS/32815/Windows 10 Version 2009
|
||||
@@ -196,18 +209,6 @@ def landing_page():
|
||||
|
||||
# if requested from the browser, return this, otherwise ignore IF statement
|
||||
if request.method == 'GET' and browser_agent: # list items
|
||||
|
||||
def generate():
|
||||
yield loading_screen().data
|
||||
try:
|
||||
browser_response = execute_from_flask(itemtypes_api.get_collection_items,
|
||||
request, collection_id,
|
||||
skip_valid_check=True)
|
||||
yield browser_response.data
|
||||
|
||||
except Exception as ex:
|
||||
yield error_screen(ex).data
|
||||
|
||||
return Response(stream_with_context(generate()))
|
||||
|
||||
return get_response(api_.landing_page(request))
|
||||
@@ -294,10 +295,17 @@ def collections(collection_id=None):
|
||||
:returns: HTTP response
|
||||
"""
|
||||
|
||||
# raise NotImplementedError()
|
||||
return get_response(api_.describe_collections(request, collection_id))
|
||||
|
||||
|
||||
@BLUEPRINT.route('/speckle')
|
||||
def speckle_collection():
|
||||
|
||||
collection_id="speckle"
|
||||
|
||||
return collection_items(collection_id=collection_id)
|
||||
|
||||
|
||||
@BLUEPRINT.route('/collections/<path:collection_id>/schema')
|
||||
def collection_schema(collection_id):
|
||||
"""
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
});
|
||||
|
||||
// construnt data URL
|
||||
var link = "https://geo.speckle.systems/?speckleUrl=";
|
||||
var link = "https://geo.speckle.systems/speckle/?speckleUrl=";
|
||||
if (document.getElementById("speckle_model").value!=""){
|
||||
link += document.getElementById("speckle_model").value.replace(" ", "")
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
));
|
||||
|
||||
(async () => {
|
||||
const speckle_data = await fetch('https://geo.speckle.systems/?speckleUrl=https://app.speckle.systems/projects/344f803f81/models/5582ab673e&datatype=projectcomments', {
|
||||
const speckle_data = await fetch('https://geo.speckle.systems/speckle/?speckleUrl=https://app.speckle.systems/projects/344f803f81/models/5582ab673e&datatype=projectcomments', {
|
||||
headers: {
|
||||
'Accept': 'application/geo+json'
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
));
|
||||
|
||||
(async () => {
|
||||
const speckle_data = await fetch('https://geo.speckle.systems/?speckleUrl=https://app.speckle.systems/projects/344f803f81/models/5582ab673e&datatype=polygons', {
|
||||
const speckle_data = await fetch('https://geo.speckle.systems/speckle/?speckleUrl=https://app.speckle.systems/projects/344f803f81/models/5582ab673e&datatype=polygons', {
|
||||
headers: {
|
||||
'Accept': 'application/geo+json'
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
|
||||
(async () => {
|
||||
const speckle_data2 = await fetch('https://geo.speckle.systems/?speckleUrl=https://app.speckle.systems/projects/344f803f81/models/37d93c5d32&preserveAttributes=true', {
|
||||
const speckle_data2 = await fetch('https://geo.speckle.systems/speckle/?speckleUrl=https://app.speckle.systems/projects/344f803f81/models/37d93c5d32&preserveAttributes=true', {
|
||||
//const speckle_data = await fetch('http://localhost:5000/?speckleUrl=https://app.speckle.systems/projects/64753f52b7/models/338b386787&limit=1000000&lat=-0.031405&lon=109.335828&preserveAttributes=true', {
|
||||
headers: {
|
||||
'Accept': 'application/geo+json'
|
||||
@@ -155,7 +155,7 @@
|
||||
|
||||
//map.fitBounds(speckle_layer.getBounds())
|
||||
|
||||
const speckle_data = await fetch('https://geo.speckle.systems/?speckleUrl=https://app.speckle.systems/projects/344f803f81/models/5582ab673e&datatype=projectcomments', {
|
||||
const speckle_data = await fetch('https://geo.speckle.systems/speckle/?speckleUrl=https://app.speckle.systems/projects/344f803f81/models/5582ab673e&datatype=projectcomments', {
|
||||
//const speckle_data = await fetch('http://localhost:5000/?speckleUrl=https://app.speckle.systems/projects/64753f52b7/models/338b386787&limit=1000000&lat=-0.031405&lon=109.335828&preserveAttributes=true', {
|
||||
headers: {
|
||||
'Accept': 'application/geo+json'
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
});
|
||||
|
||||
(async () => {
|
||||
//const speckle_data = await fetch('https://geo.speckle.systems/?speckleUrl=https://app.speckle.systems/projects/344f803f81/models/5582ab673e&datatype=projectcomments', {
|
||||
//var speckle_url = 'http://localhost:5000/?speckleUrl=https://app.speckle.systems/projects/5feae56049/models/9c43d7569c&limit=1000000&datatype=polygons&preserveattributes=false';
|
||||
//const speckle_data = await fetch('https://geo.speckle.systems/speckle/?speckleUrl=https://app.speckle.systems/projects/344f803f81/models/5582ab673e&datatype=projectcomments', {
|
||||
//var speckle_url = 'http://localhost:5000/speckle/?speckleUrl=https://app.speckle.systems/projects/5feae56049/models/9c43d7569c&limit=1000000&datatype=polygons&preserveattributes=false';
|
||||
// https://app.speckle.systems/projects/5feae56049/models/01c4183677
|
||||
var speckle_url = 'http://localhost:5000/?speckleUrl=https://app.speckle.systems/projects/5feae56049/models/01c4183677&limit=1000000&datatype=polygons&preserveattributes=true';
|
||||
var speckle_url = 'https://geo.speckle.systems/speckle/?speckleUrl=https://app.speckle.systems/projects/5feae56049/models/01c4183677&limit=1000000&datatype=polygons&preserveattributes=true';
|
||||
|
||||
//var speckle_url = 'https://geo.speckle.systems/?speckleUrl=https://app.speckle.systems/projects/5feae56049/models/9c43d7569c&northDegrees=-30&preserveAttributes=true';
|
||||
//var speckle_url = 'https://geo.speckle.systems/speckle/?speckleUrl=https://app.speckle.systems/projects/5feae56049/models/9c43d7569c&northDegrees=-30&preserveAttributes=true';
|
||||
const speckle_data = await fetch(speckle_url, {
|
||||
headers: {
|
||||
'Accept': 'application/geo+json'
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
|
||||
//////// add Speckle layer
|
||||
(async () => {
|
||||
const geojson = await fetch('https://geo.speckle.systems/?speckleUrl=https://app.speckle.systems/projects/344f803f81/models/5582ab673e&datatype=polygons', {
|
||||
const geojson = await fetch('https://geo.speckle.systems/speckle/?speckleUrl=https://app.speckle.systems/projects/344f803f81/models/5582ab673e&datatype=polygons', {
|
||||
headers: {
|
||||
'Accept': 'application/geo+json'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user