Skip to content

Commit

Permalink
feat: added procedure searchbar (#212)
Browse files Browse the repository at this point in the history
* feat: added procedure searchbar

* feat: fixed formatting

* feat: remove devURL and restore readme

* feat: added searchbar into container
  • Loading branch information
micahwoodard authored Apr 3, 2024
1 parent cc54d4f commit b874295
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/aind_metadata_service/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,15 @@ async def index(request: Request):
"parameter": "subject_id", # required
"parameter_label": "Subject ID",
},
{
"endpoint": "procedures", # required
"description": (
"Retrieve procedures metadata from Labtracks and"
" SharePoint servers"
),
"parameter": "subject_id", # required
"parameter_label": "Subject ID",
},
],
}
),
Expand Down
4 changes: 1 addition & 3 deletions src/aind_metadata_service/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,12 @@ <h1>{{ service_name }}</h1>
</div>
<div class="main">
{% for e in endpoints if e.endpoint and e.parameter %}
<div>
<div class="container">
<div class="heading">{{ e.endpoint|title }}
</div>
<p>{{ e.description }}</p>
<label for="param-id-{{ e.endpoint }}">{{ e.parameter_label or e.parameter }}:</label>
<input type="text" id="param-id-{{ e.endpoint }}" size="6" placeholder="{{ e.parameter }}" onkeydown="searchWithEnter('{{ e.endpoint }}')" />
</div>
<button id="search" type="button" class="primary" onclick="queryEndpoint('{{ e.endpoint }}')">Search</button>
</div>
{% endfor %}
Expand Down Expand Up @@ -158,7 +156,7 @@ <h1>{{ service_name }}</h1>
const viewOrHide = $("#response-raw-div").is(":visible") ? "Hide" : "View";
$("#toggle-raw").text(`${viewOrHide} raw response`);
};
queryEndpoint = function (endpoint) {
queryEndpoint = function (endpoint) {
let parameter = $(`#param-id-${endpoint}`).val();
$.ajax({
url: `/${endpoint}/${parameter}`,
Expand Down

0 comments on commit b874295

Please sign in to comment.