Spaces:
Sleeping
Sleeping
Download templates/parameters.html from alisaleem97/NexLab_System: direct link, hf CLI and curl.
- Browser
- Download file 11.8 kB
-
https://huggingface.co/spaces/alisaleem97/NexLab_System/resolve/main/templates/parameters.html
- Command line
-
hf download hf://spaces/alisaleem97/NexLab_System/templates/parameters.html
-
curl -L -o parameters.html https://huggingface.co/spaces/alisaleem97/NexLab_System/resolve/main/templates/parameters.html
11.8 kB
| <!-- templates/parameters.html --> | |
| {% extends "base.html" %} | |
| {% block title %}Parameters - NexLab{% endblock %} | |
| {% block page_title %}Test Parameters{% endblock %} | |
| {% block content %} | |
| <!-- Tom Select CSS --> | |
| <link href="/static/vendor/tom-select/tom-select.css" rel="stylesheet"> | |
| <div class="bg-white rounded-xl shadow-sm border border-slate-200"> | |
| <div class="p-6 border-b border-slate-200 flex justify-between items-center"> | |
| <div> | |
| <h3 class="text-lg font-semibold text-slate-800">Parameter Definition</h3> | |
| <p class="text-sm text-slate-500">Define test parameters and headers</p> | |
| </div> | |
| <button onclick="toggleForm('addParameterForm')" | |
| class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition duration-200"> | |
| <svg class="w-5 h-5 inline mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path></svg> | |
| Add Parameter | |
| </button> | |
| </div> | |
| <!-- Add/Edit Parameter Form --> | |
| <div id="addParameterForm" style="display: none;" class="p-6 bg-slate-50 border-b border-slate-200"> | |
| <h4 class="text-md font-semibold text-slate-700 mb-4" id="formTitle">New Parameter Details</h4> | |
| <form method="POST" id="parameterForm" action="/parameters/create"> | |
| <input type="hidden" id="param_id" name="param_id" value=""> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4"> | |
| <div> | |
| <label class="block text-sm font-medium text-slate-700 mb-1">Parameter Name *</label> | |
| <input type="text" id="parameter_name" name="parameter_name" required placeholder="e.g., Hemoglobin" | |
| class="w-full border border-slate-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-500 focus:outline-none"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-slate-700 mb-1">Short Name *</label> | |
| <input type="text" id="parameter_short_name" name="parameter_short_name" required placeholder="e.g., HGB" | |
| class="w-full border border-slate-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-500 focus:outline-none uppercase"> | |
| </div> | |
| </div> | |
| <div class="mb-4"> | |
| <label class="flex items-center"> | |
| <input type="checkbox" id="is_header" name="is_header" class="rounded text-indigo-600 focus:ring-indigo-500"> | |
| <span class="ml-2 text-sm text-slate-700">Is Header? (Section Title like CBC, Chemistry)</span> | |
| </label> | |
| </div> | |
| <div class="flex gap-2"> | |
| <button type="submit" class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg text-sm font-medium"> | |
| <svg class="w-4 h-4 inline mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4"></path></svg> | |
| Save Parameter | |
| </button> | |
| <button type="button" onclick="toggleForm('addParameterForm')" | |
| class="bg-white border border-slate-300 text-slate-700 px-4 py-2 rounded-lg text-sm font-medium hover:bg-slate-50"> | |
| Cancel | |
| </button> | |
| </div> | |
| </form> | |
| </div> | |
| <!-- Search/Filter Section --> | |
| <div class="p-6 border-b border-slate-200 bg-slate-50"> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4 items-end"> | |
| <div> | |
| <label class="block text-sm font-medium text-slate-700 mb-1">Search by Parameter Name</label> | |
| <select id="search_parameter" placeholder="Search parameters..." | |
| class="w-full border border-slate-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:outline-none"> | |
| <option value="">All Parameters...</option> | |
| {% for param in parameters %} | |
| <option value="{{ param.parameter_name }}">{{ param.parameter_name }} ({{ param.parameter_short_name }})</option> | |
| {% endfor %} | |
| </select> | |
| </div> | |
| <div> | |
| <button onclick="filterParametersTable()" class="w-full bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition flex items-center justify-center gap-2"> | |
| <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg> | |
| Search | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Parameters Table --> | |
| <div class="overflow-x-auto"> | |
| <table class="min-w-full divide-y divide-slate-200"> | |
| <thead class="bg-slate-50"> | |
| <tr> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">ID</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">Parameter Name</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">Short Name</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">Type</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">Created</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">Actions</th> | |
| </tr> | |
| </thead> | |
| <tbody class="bg-white divide-y divide-slate-200" id="parametersTableBody"> | |
| {% for param in parameters %} | |
| <tr class="hover:bg-slate-50 parameter-row" style="display: none;" data-parameter-name="{{ param.parameter_name }}"> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-500">#{{ param.id }}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-slate-800">{{ param.parameter_name }}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm font-bold text-indigo-600">{{ param.parameter_short_name }}</td> | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| {% if param.is_header %} | |
| <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-amber-100 text-amber-800">Header</span> | |
| {% else %} | |
| <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">Parameter</span> | |
| {% endif %} | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-500">{{ param.created_at.strftime('%Y-%m-%d') }}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm font-medium"> | |
| <div class="flex items-center space-x-3"> | |
| <button onclick='editParameter({{ parameters_json[loop.index0] | tojson }})' | |
| class="text-blue-600 hover:text-blue-900" title="Edit"> | |
| <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path></svg> | |
| </button> | |
| <a href="javascript:void(0)" | |
| onclick="confirmDelete('/parameters/delete/{{ param.id }}')" | |
| class="text-red-600 hover:text-red-900" title="Delete"> | |
| <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path></svg> | |
| </a> | |
| </div> | |
| </td> | |
| </tr> | |
| {% endfor %} | |
| </tbody> | |
| </table> | |
| </div> | |
| {% if not parameters %} | |
| <div class="text-center py-12"> | |
| <svg class="mx-auto h-12 w-12 text-slate-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19.428 15.428a2 2 0 00-1.022-.547l-2.384-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 10.172V5L8 4z"></path> | |
| </svg> | |
| <h3 class="mt-2 text-sm font-medium text-slate-900">No parameters</h3> | |
| <p class="mt-1 text-sm text-slate-500">Get started by adding a new parameter.</p> | |
| </div> | |
| {% endif %} | |
| </div> | |
| <!-- Tom Select JS --> | |
| <script src="/static/vendor/tom-select/tom-select.complete.min.js"></script> | |
| <script> | |
| let paramSearchSelect; | |
| function initTomSelect() { | |
| paramSearchSelect = new TomSelect('#search_parameter', { | |
| plugins: ['dropdown_input', 'clear_button'], | |
| placeholder: 'Search parameters...', | |
| create: false, | |
| maxItems: 1 | |
| }); | |
| } | |
| document.addEventListener('DOMContentLoaded', initTomSelect); | |
| function filterParametersTable() { | |
| const nameFilter = document.getElementById('search_parameter').value.toLowerCase(); | |
| const rows = document.querySelectorAll('.parameter-row'); | |
| rows.forEach(row => { | |
| const paramName = row.dataset.parameterName.toLowerCase(); | |
| const matchName = !nameFilter || paramName === nameFilter; | |
| if (matchName) { | |
| row.style.display = ''; | |
| } else { | |
| row.style.display = 'none'; | |
| } | |
| }); | |
| } | |
| function toggleForm(formId) { | |
| const form = document.getElementById(formId); | |
| form.style.display = form.style.display === 'none' ? 'block' : 'none'; | |
| if (form.style.display === 'none') { | |
| document.getElementById('parameterForm').reset(); | |
| document.getElementById('param_id').value = ''; | |
| document.getElementById('formTitle').textContent = 'New Parameter Details'; | |
| } | |
| } | |
| function editParameter(param) { | |
| document.getElementById('param_id').value = param.id; | |
| document.getElementById('parameter_name').value = param.parameter_name; | |
| document.getElementById('parameter_short_name').value = param.parameter_short_name; | |
| document.getElementById('is_header').checked = param.is_header; | |
| document.getElementById('formTitle').textContent = 'Edit Parameter Details'; | |
| document.getElementById('addParameterForm').style.display = 'block'; | |
| document.getElementById('parameterForm').action = '/parameters/update/' + param.id; | |
| } | |
| // Auto-uppercase short name input | |
| document.getElementById('parameter_short_name').addEventListener('input', function(e) { | |
| this.value = this.value.toUpperCase(); | |
| }); | |
| </script> | |
| {% endblock %} |