aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/oauth2/resources.py12
-rw-r--r--wqflask/wqflask/templates/oauth2/create-resource.html14
2 files changed, 20 insertions, 6 deletions
diff --git a/wqflask/wqflask/oauth2/resources.py b/wqflask/wqflask/oauth2/resources.py
index 8f31f7c9..aacde369 100644
--- a/wqflask/wqflask/oauth2/resources.py
+++ b/wqflask/wqflask/oauth2/resources.py
@@ -27,7 +27,9 @@ def create_resource():
return render_template(
"oauth2/create-resource.html",
resource_categories=categories,
- resource_category_error=error)
+ resource_category_error=error,
+ resource_name=request.args.get("resource_name"),
+ resource_category=request.args.get("resource_category"))
if request.method == "GET":
return oauth2_get("oauth2/resource/categories").either(
@@ -38,9 +40,11 @@ def create_resource():
from flask import jsonify
def __perr__(error):
err = process_error(error)
- print(f"THE ERROR: {err}")
- flash(f"{err['error']}: {err['error_message']}", "alert-danger")
- return redirect(url_for("oauth2.resource.user_resources"))
+ flash(f"{err['error']}: {err['error_description']}", "alert-danger")
+ return redirect(url_for(
+ "oauth2.resource.create_resource",
+ resource_name=request.form.get("resource_name"),
+ resource_category=request.form.get("resource_category")))
def __psuc__(succ):
flash("Resource created successfully", "alert-success")
return redirect(url_for("oauth2.resource.user_resources"))
diff --git a/wqflask/wqflask/templates/oauth2/create-resource.html b/wqflask/wqflask/templates/oauth2/create-resource.html
index 9d9a8cd3..1b4263ed 100644
--- a/wqflask/wqflask/templates/oauth2/create-resource.html
+++ b/wqflask/wqflask/templates/oauth2/create-resource.html
@@ -28,6 +28,9 @@
<div class="form-group mytooltip">
<label for="resource_name" class="form-label">Name</label>
<input type="text" name="resource_name" class="form-control"
+ {%if resource_name is defined and resource_name is not none%}
+ value="{{resource_name}}"
+ {%endif%}
required="required" />
<span class="mytooltiptext">
The resource name, e.g. the experiment name.
@@ -38,10 +41,17 @@
<div class="form-group">
{%for category in resource_categories%}
<div class="radio mytooltip">
- <label for="resource_name" class="form-label"
+ <label for="rdo:resource_category:{{category.resource_category_id}}"
+ class="form-label"
style="text-transform: capitalize;">
<input type="radio" name="resource_category" required="required"
- value="{{category.resource_category_id}}" />
+ id="rdo:resource_category:{{category.resource_category_id}}"
+ value="{{category.resource_category_id}}"
+ {%if resource_category is defined%}
+ {%if category.resource_category_id == resource_category%}
+ checked="checked"
+ {%endif%}
+ {%endif%} />
{{category.resource_category_key}}
</label>
<span class="mytooltiptext">