Spaces:
Sleeping
Sleeping
Aravind-0808 commited on
Commit ·
e0981df
1
Parent(s): c7525e3
update the file name
Browse files- templates/API_connectors.html +1 -1
- templates/dashboard.html +270 -270
- templates/data_connectors.html +102 -87
- templates/index.html +58 -96
- templates/knowledgebase.html +1 -1
templates/API_connectors.html
CHANGED
|
@@ -12,7 +12,7 @@
|
|
| 12 |
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
|
| 13 |
<script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script>
|
| 14 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
|
| 15 |
-
<link rel="stylesheet" href="/static/css/
|
| 16 |
</head>
|
| 17 |
|
| 18 |
<body>
|
|
|
|
| 12 |
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
|
| 13 |
<script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script>
|
| 14 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
|
| 15 |
+
<link rel="stylesheet" href="/static/css/API_connectors.css">
|
| 16 |
</head>
|
| 17 |
|
| 18 |
<body>
|
templates/dashboard.html
CHANGED
|
@@ -1,271 +1,271 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="en">
|
| 3 |
-
|
| 4 |
-
<head>
|
| 5 |
-
<meta charset="UTF-8">
|
| 6 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
-
<title>Dashboard</title>
|
| 8 |
-
<!-- CSS -->
|
| 9 |
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
|
| 10 |
-
<link rel="stylesheet" type="text/css" href="../static/css/style.css" />
|
| 11 |
-
<link rel="stylesheet" type="text/css" href="../static/css/dashboard.css" />
|
| 12 |
-
<link rel="stylesheet" type="text/css" href="../static/css/perfect-scrollbar.css" />
|
| 13 |
-
<link rel="stylesheet" href="/static/css/
|
| 14 |
-
</head>
|
| 15 |
-
|
| 16 |
-
<body>
|
| 17 |
-
{% set company_name = company_name %}
|
| 18 |
-
{% include 'sidepane.html' %}
|
| 19 |
-
|
| 20 |
-
<div class="wrapper">
|
| 21 |
-
<section class="main-header">
|
| 22 |
-
<div class="container-fluid">
|
| 23 |
-
<div id="company-block" class="form-group left-align" style="display: none;">
|
| 24 |
-
<label for="company" class="ml-3" style="display: inline-block; margin-right: 10px;">
|
| 25 |
-
Select the Company Name to view the details <span class="text-danger">*</span>
|
| 26 |
-
</label>
|
| 27 |
-
<select type="text" id="company" name="company" class="ml-3 form-control"
|
| 28 |
-
style="display: inline-block; width: 20%;" required>
|
| 29 |
-
<option value="" selected>Select</option>
|
| 30 |
-
</select>
|
| 31 |
-
</div>
|
| 32 |
-
|
| 33 |
-
<div class="row">
|
| 34 |
-
<div class="col-md-6">
|
| 35 |
-
<div class="card bg-primary">
|
| 36 |
-
<div class="card-body">
|
| 37 |
-
<div class="media align-items-center">
|
| 38 |
-
<span class="p-3 mr-3 feature-icon rounded">
|
| 39 |
-
<img src="../static/logos/calendar-silhouette.svg" />
|
| 40 |
-
</span>
|
| 41 |
-
<div class="media-body">
|
| 42 |
-
<p class="fs-30 text-white mb-2">KnowledgeBase</p>
|
| 43 |
-
<span id="knowledgeBaseCount"
|
| 44 |
-
class="fs-48 text-white font-w600">{{table_count_of_each_table.knowledge_base}}</span>
|
| 45 |
-
</div>
|
| 46 |
-
</div>
|
| 47 |
-
</div>
|
| 48 |
-
</div>
|
| 49 |
-
</div>
|
| 50 |
-
<div class="col-md-6">
|
| 51 |
-
<div class="card bg-info">
|
| 52 |
-
<div class="card-body">
|
| 53 |
-
<div class="media align-items-center">
|
| 54 |
-
<span class="p-3 mr-3 feature-icon rounded">
|
| 55 |
-
<img src="../static/logos/calendar-silhouette.svg" />
|
| 56 |
-
</span>
|
| 57 |
-
<div class="media-body">
|
| 58 |
-
<p class="fs-30 text-white mb-2">Data connectors</p>
|
| 59 |
-
<span id="dataConnectorsCount"
|
| 60 |
-
class="fs-48 text-white font-w600">{{table_count_of_each_table.data_connectors}}</span>
|
| 61 |
-
</div>
|
| 62 |
-
</div>
|
| 63 |
-
</div>
|
| 64 |
-
</div>
|
| 65 |
-
</div>
|
| 66 |
-
</div>
|
| 67 |
-
<div class="row">
|
| 68 |
-
<div class="col-md-6 ">
|
| 69 |
-
<div class="card bg-success">
|
| 70 |
-
<div class="card-body">
|
| 71 |
-
<div class="media align-items-center">
|
| 72 |
-
<span class="p-3 mr-3 feature-icon rounded">
|
| 73 |
-
<img src="../static/logos/email.svg" />
|
| 74 |
-
</span>
|
| 75 |
-
<div class="media-body">
|
| 76 |
-
<p class="fs-30 text-white mb-2">API Connectors</p>
|
| 77 |
-
<span id="apiConnectorsCount"
|
| 78 |
-
class="fs-48 text-white font-w600">{{table_count_of_each_table.api_connectors}}</span>
|
| 79 |
-
</div>
|
| 80 |
-
</div>
|
| 81 |
-
</div>
|
| 82 |
-
</div>
|
| 83 |
-
</div>
|
| 84 |
-
<div class="col-md-6 ">
|
| 85 |
-
<div class="card bg-secondary">
|
| 86 |
-
<div class="card-body">
|
| 87 |
-
<div class="media align-items-center">
|
| 88 |
-
<span class="p-3 mr-3 feature-icon rounded">
|
| 89 |
-
<img src="../static/logos/dots.svg" />
|
| 90 |
-
</span>
|
| 91 |
-
<div class="media-body">
|
| 92 |
-
<p class="fs-30 text-white mb-2">Prompt_Templates</p>
|
| 93 |
-
<span id="promptTemplatesCount"
|
| 94 |
-
class="fs-48 text-white font-w600">{{table_count_of_each_table.prompt_templates}}</span>
|
| 95 |
-
</div>
|
| 96 |
-
</div>
|
| 97 |
-
</div>
|
| 98 |
-
</div>
|
| 99 |
-
</div>
|
| 100 |
-
</div>
|
| 101 |
-
</div>
|
| 102 |
-
</section>
|
| 103 |
-
<input type="hidden" id="userRole" name="userRole" value={{role}}>
|
| 104 |
-
<input type="hidden" id="company_id" name="company_id" value={{company_id}}>
|
| 105 |
-
<input type="hidden" id="username" name="username" value={{username}}>
|
| 106 |
-
<input type="hidden" id="company_name" name="company_name" value={{company_name}}>
|
| 107 |
-
|
| 108 |
-
</div>
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
{% include 'footer.html' %}
|
| 112 |
-
|
| 113 |
-
<script src="https://cdn.jsdelivr.net/npm/admin-lte@3.1/dist/js/adminlte.min.js"></script>
|
| 114 |
-
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
| 115 |
-
<script>
|
| 116 |
-
document.getElementById("add").style.display = "none";
|
| 117 |
-
|
| 118 |
-
// function updateCompanyName(newCompanyName) {
|
| 119 |
-
// sessionStorage.setItem('company_name', newCompanyName);
|
| 120 |
-
// document.getElementById('selectedCompany').innerText = `Company name: ${newCompanyName}`;
|
| 121 |
-
// const sidePaneCompanyName = document.querySelector('.sidebar .company-name');
|
| 122 |
-
// if (sidePaneCompanyName) {
|
| 123 |
-
// sidePaneCompanyName.innerText = newCompanyName;
|
| 124 |
-
// }
|
| 125 |
-
// }
|
| 126 |
-
function updateSidepane(companyName) {
|
| 127 |
-
const sidepaneCompanyElement = document.getElementById('selectedCompany');
|
| 128 |
-
if (sidepaneCompanyElement) {
|
| 129 |
-
sidepaneCompanyElement.innerText = `Company Name: ${companyName}`;
|
| 130 |
-
}
|
| 131 |
-
}
|
| 132 |
-
|
| 133 |
-
window.addEventListener('pageshow', function (event) {
|
| 134 |
-
if (event.persisted || (window.performance && window.performance.navigation.type === 2)) {
|
| 135 |
-
window.location.reload();
|
| 136 |
-
}
|
| 137 |
-
});
|
| 138 |
-
|
| 139 |
-
document.addEventListener('DOMContentLoaded', function () {
|
| 140 |
-
var role1 = document.getElementById("userRole").value;
|
| 141 |
-
var company_id1 = document.getElementById("company_id").value;
|
| 142 |
-
var company_name1 = document.getElementById("company_name").value;
|
| 143 |
-
var username1 = document.getElementById("username").value;
|
| 144 |
-
console.log("companyid in dasshboard", username1);
|
| 145 |
-
sessionStorage.setItem('userRole', role1);
|
| 146 |
-
// sessionStorage.setItem('siderole',role1);
|
| 147 |
-
// sessionStorage.setItem('sidecompanyId',company_id1);
|
| 148 |
-
sessionStorage.setItem('company_id', company_id1);
|
| 149 |
-
sessionStorage.setItem('company_name', company_name1);
|
| 150 |
-
sessionStorage.setItem('username', username1);
|
| 151 |
-
const companyName = sessionStorage.getItem('company_name');
|
| 152 |
-
if (companyName) {
|
| 153 |
-
|
| 154 |
-
updateSidepane(companyName);
|
| 155 |
-
}
|
| 156 |
-
else {
|
| 157 |
-
document.getElementById(selectedCompany).value = "Select a company";
|
| 158 |
-
}
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
if (!role1) {
|
| 162 |
-
var roleFromInput = sessionStorage.getItem('userRole');
|
| 163 |
-
sessionStorage.setItem('userRole', roleFromInput);
|
| 164 |
-
console.log("Role set in sessionStorage:", roleFromInput);
|
| 165 |
-
} else {
|
| 166 |
-
sessionStorage.setItem('userRole', role1);
|
| 167 |
-
console.log("Retrieved user role from input:", role1); // Debugging
|
| 168 |
-
}
|
| 169 |
-
if (role1 === "superadmin") {
|
| 170 |
-
document.getElementById('company-block').style.display = 'block';
|
| 171 |
-
fetchCompanies();
|
| 172 |
-
}
|
| 173 |
-
|
| 174 |
-
});
|
| 175 |
-
document.getElementById('company').addEventListener('change', async function () {
|
| 176 |
-
const selectedCompany = this.value;
|
| 177 |
-
sessionStorage.setItem("company_name", selectedCompany);
|
| 178 |
-
// Update the sidepane immediately
|
| 179 |
-
updateSidepane(selectedCompany);
|
| 180 |
-
if (selectedCompany !== "Select") {
|
| 181 |
-
try {
|
| 182 |
-
const response = await fetch(`/api/company_id?company_name=${encodeURIComponent(selectedCompany)}`);
|
| 183 |
-
if (!response.ok) {
|
| 184 |
-
contentSection.style.display = 'none';
|
| 185 |
-
displayErrorMessage("Document details do not exist for this company. Please fill in the details.");
|
| 186 |
-
throw new Error('Network response was not ok');
|
| 187 |
-
}
|
| 188 |
-
const data = await response.json();
|
| 189 |
-
console.log('data returned', data);
|
| 190 |
-
const companyId = data.company_id;
|
| 191 |
-
sessionStorage.setItem("company_id", companyId);
|
| 192 |
-
console.log("company id for superadmin", company_id);
|
| 193 |
-
//document.getElementById('company_id').value = companyId;
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
if (companyId) {
|
| 197 |
-
try {
|
| 198 |
-
const countResponse = await fetch(`/api/company_record_count/${companyId}`);
|
| 199 |
-
if (!countResponse.ok) {
|
| 200 |
-
throw new Error('Network response was not ok');
|
| 201 |
-
}
|
| 202 |
-
const countData = await countResponse.json();
|
| 203 |
-
console.log('Count data:', countData); // Log the response data
|
| 204 |
-
updateRecordCounts(countData.table_counts);
|
| 205 |
-
} catch (error) {
|
| 206 |
-
console.error('Error fetching record counts:', error);
|
| 207 |
-
}
|
| 208 |
-
} else {
|
| 209 |
-
clearRecordCounts();
|
| 210 |
-
}
|
| 211 |
-
} catch (error) {
|
| 212 |
-
console.error('No details for this company ID or data documents:', error);
|
| 213 |
-
// displayEmptyTable();
|
| 214 |
-
|
| 215 |
-
displayErrorMessage("company details do not exist for this company.");
|
| 216 |
-
|
| 217 |
-
}
|
| 218 |
-
}
|
| 219 |
-
});
|
| 220 |
-
|
| 221 |
-
function updateRecordCounts(counts) {
|
| 222 |
-
// Update the counts displayed in the dashboard
|
| 223 |
-
document.getElementById('knowledgeBaseCount').textContent = counts.knowledge_base || 0;
|
| 224 |
-
document.getElementById('dataConnectorsCount').textContent = counts.data_connectors || 0;
|
| 225 |
-
document.getElementById('apiConnectorsCount').textContent = counts.api_connectors || 0;
|
| 226 |
-
document.getElementById('promptTemplatesCount').textContent = counts.prompt_templates || 0;
|
| 227 |
-
}
|
| 228 |
-
|
| 229 |
-
function clearRecordCounts() {
|
| 230 |
-
document.getElementById('knowledgeBaseCount').textContent = 0;
|
| 231 |
-
document.getElementById('dataConnectorsCount').textContent = 0;
|
| 232 |
-
document.getElementById('apiConnectorsCount').textContent = 0;
|
| 233 |
-
document.getElementById('promptTemplatesCount').textContent = 0;
|
| 234 |
-
}
|
| 235 |
-
|
| 236 |
-
async function fetchCompanies() {
|
| 237 |
-
try {
|
| 238 |
-
const response = await fetch('/api/companies');
|
| 239 |
-
if (!response.ok) {
|
| 240 |
-
throw new Error('Network response was not ok');
|
| 241 |
-
}
|
| 242 |
-
const data = await response.json();
|
| 243 |
-
displayCompanies(data.companies);
|
| 244 |
-
} catch (error) {
|
| 245 |
-
console.error('Error fetching companies:', error);
|
| 246 |
-
}
|
| 247 |
-
}
|
| 248 |
-
|
| 249 |
-
function displayCompanies(companies) {
|
| 250 |
-
const companySelect = document.getElementById('company');
|
| 251 |
-
companySelect.innerHTML = '<option value="" selected>Select</option>'; // Reset the dropdown
|
| 252 |
-
companies.forEach(company => {
|
| 253 |
-
const option = document.createElement('option');
|
| 254 |
-
option.value = company.name;
|
| 255 |
-
option.textContent = company.name;
|
| 256 |
-
companySelect.appendChild(option);
|
| 257 |
-
});
|
| 258 |
-
}
|
| 259 |
-
function clearFormFields() {
|
| 260 |
-
document.getElementById('APIName').value = "";
|
| 261 |
-
document.getElementById('APIEndpoint').value = "";
|
| 262 |
-
document.getElementById('Auth_Bearer').value = "";
|
| 263 |
-
document.getElementById('Inputjson').value = "";
|
| 264 |
-
document.getElementById('OutputJson').value = "";
|
| 265 |
-
document.getElementById('Description').value = "";
|
| 266 |
-
}
|
| 267 |
-
|
| 268 |
-
</script>
|
| 269 |
-
</body>
|
| 270 |
-
|
| 271 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>Dashboard</title>
|
| 8 |
+
<!-- CSS -->
|
| 9 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../static/css/style.css" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../static/css/dashboard.css" />
|
| 12 |
+
<link rel="stylesheet" type="text/css" href="../static/css/perfect-scrollbar.css" />
|
| 13 |
+
<link rel="stylesheet" href="/static/css/dashboard1.css">
|
| 14 |
+
</head>
|
| 15 |
+
|
| 16 |
+
<body>
|
| 17 |
+
{% set company_name = company_name %}
|
| 18 |
+
{% include 'sidepane.html' %}
|
| 19 |
+
|
| 20 |
+
<div class="wrapper">
|
| 21 |
+
<section class="main-header">
|
| 22 |
+
<div class="container-fluid">
|
| 23 |
+
<div id="company-block" class="form-group left-align" style="display: none;">
|
| 24 |
+
<label for="company" class="ml-3" style="display: inline-block; margin-right: 10px;">
|
| 25 |
+
Select the Company Name to view the details <span class="text-danger">*</span>
|
| 26 |
+
</label>
|
| 27 |
+
<select type="text" id="company" name="company" class="ml-3 form-control"
|
| 28 |
+
style="display: inline-block; width: 20%;" required>
|
| 29 |
+
<option value="" selected>Select</option>
|
| 30 |
+
</select>
|
| 31 |
+
</div>
|
| 32 |
+
|
| 33 |
+
<div class="row">
|
| 34 |
+
<div class="col-md-6">
|
| 35 |
+
<div class="card bg-primary">
|
| 36 |
+
<div class="card-body">
|
| 37 |
+
<div class="media align-items-center">
|
| 38 |
+
<span class="p-3 mr-3 feature-icon rounded">
|
| 39 |
+
<img src="../static/logos/calendar-silhouette.svg" />
|
| 40 |
+
</span>
|
| 41 |
+
<div class="media-body">
|
| 42 |
+
<p class="fs-30 text-white mb-2">KnowledgeBase</p>
|
| 43 |
+
<span id="knowledgeBaseCount"
|
| 44 |
+
class="fs-48 text-white font-w600">{{table_count_of_each_table.knowledge_base}}</span>
|
| 45 |
+
</div>
|
| 46 |
+
</div>
|
| 47 |
+
</div>
|
| 48 |
+
</div>
|
| 49 |
+
</div>
|
| 50 |
+
<div class="col-md-6">
|
| 51 |
+
<div class="card bg-info">
|
| 52 |
+
<div class="card-body">
|
| 53 |
+
<div class="media align-items-center">
|
| 54 |
+
<span class="p-3 mr-3 feature-icon rounded">
|
| 55 |
+
<img src="../static/logos/calendar-silhouette.svg" />
|
| 56 |
+
</span>
|
| 57 |
+
<div class="media-body">
|
| 58 |
+
<p class="fs-30 text-white mb-2">Data connectors</p>
|
| 59 |
+
<span id="dataConnectorsCount"
|
| 60 |
+
class="fs-48 text-white font-w600">{{table_count_of_each_table.data_connectors}}</span>
|
| 61 |
+
</div>
|
| 62 |
+
</div>
|
| 63 |
+
</div>
|
| 64 |
+
</div>
|
| 65 |
+
</div>
|
| 66 |
+
</div>
|
| 67 |
+
<div class="row">
|
| 68 |
+
<div class="col-md-6 ">
|
| 69 |
+
<div class="card bg-success">
|
| 70 |
+
<div class="card-body">
|
| 71 |
+
<div class="media align-items-center">
|
| 72 |
+
<span class="p-3 mr-3 feature-icon rounded">
|
| 73 |
+
<img src="../static/logos/email.svg" />
|
| 74 |
+
</span>
|
| 75 |
+
<div class="media-body">
|
| 76 |
+
<p class="fs-30 text-white mb-2">API Connectors</p>
|
| 77 |
+
<span id="apiConnectorsCount"
|
| 78 |
+
class="fs-48 text-white font-w600">{{table_count_of_each_table.api_connectors}}</span>
|
| 79 |
+
</div>
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
</div>
|
| 83 |
+
</div>
|
| 84 |
+
<div class="col-md-6 ">
|
| 85 |
+
<div class="card bg-secondary">
|
| 86 |
+
<div class="card-body">
|
| 87 |
+
<div class="media align-items-center">
|
| 88 |
+
<span class="p-3 mr-3 feature-icon rounded">
|
| 89 |
+
<img src="../static/logos/dots.svg" />
|
| 90 |
+
</span>
|
| 91 |
+
<div class="media-body">
|
| 92 |
+
<p class="fs-30 text-white mb-2">Prompt_Templates</p>
|
| 93 |
+
<span id="promptTemplatesCount"
|
| 94 |
+
class="fs-48 text-white font-w600">{{table_count_of_each_table.prompt_templates}}</span>
|
| 95 |
+
</div>
|
| 96 |
+
</div>
|
| 97 |
+
</div>
|
| 98 |
+
</div>
|
| 99 |
+
</div>
|
| 100 |
+
</div>
|
| 101 |
+
</div>
|
| 102 |
+
</section>
|
| 103 |
+
<input type="hidden" id="userRole" name="userRole" value={{role}}>
|
| 104 |
+
<input type="hidden" id="company_id" name="company_id" value={{company_id}}>
|
| 105 |
+
<input type="hidden" id="username" name="username" value={{username}}>
|
| 106 |
+
<input type="hidden" id="company_name" name="company_name" value={{company_name}}>
|
| 107 |
+
|
| 108 |
+
</div>
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
{% include 'footer.html' %}
|
| 112 |
+
|
| 113 |
+
<script src="https://cdn.jsdelivr.net/npm/admin-lte@3.1/dist/js/adminlte.min.js"></script>
|
| 114 |
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
| 115 |
+
<script>
|
| 116 |
+
document.getElementById("add").style.display = "none";
|
| 117 |
+
|
| 118 |
+
// function updateCompanyName(newCompanyName) {
|
| 119 |
+
// sessionStorage.setItem('company_name', newCompanyName);
|
| 120 |
+
// document.getElementById('selectedCompany').innerText = `Company name: ${newCompanyName}`;
|
| 121 |
+
// const sidePaneCompanyName = document.querySelector('.sidebar .company-name');
|
| 122 |
+
// if (sidePaneCompanyName) {
|
| 123 |
+
// sidePaneCompanyName.innerText = newCompanyName;
|
| 124 |
+
// }
|
| 125 |
+
// }
|
| 126 |
+
function updateSidepane(companyName) {
|
| 127 |
+
const sidepaneCompanyElement = document.getElementById('selectedCompany');
|
| 128 |
+
if (sidepaneCompanyElement) {
|
| 129 |
+
sidepaneCompanyElement.innerText = `Company Name: ${companyName}`;
|
| 130 |
+
}
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
window.addEventListener('pageshow', function (event) {
|
| 134 |
+
if (event.persisted || (window.performance && window.performance.navigation.type === 2)) {
|
| 135 |
+
window.location.reload();
|
| 136 |
+
}
|
| 137 |
+
});
|
| 138 |
+
|
| 139 |
+
document.addEventListener('DOMContentLoaded', function () {
|
| 140 |
+
var role1 = document.getElementById("userRole").value;
|
| 141 |
+
var company_id1 = document.getElementById("company_id").value;
|
| 142 |
+
var company_name1 = document.getElementById("company_name").value;
|
| 143 |
+
var username1 = document.getElementById("username").value;
|
| 144 |
+
console.log("companyid in dasshboard", username1);
|
| 145 |
+
sessionStorage.setItem('userRole', role1);
|
| 146 |
+
// sessionStorage.setItem('siderole',role1);
|
| 147 |
+
// sessionStorage.setItem('sidecompanyId',company_id1);
|
| 148 |
+
sessionStorage.setItem('company_id', company_id1);
|
| 149 |
+
sessionStorage.setItem('company_name', company_name1);
|
| 150 |
+
sessionStorage.setItem('username', username1);
|
| 151 |
+
const companyName = sessionStorage.getItem('company_name');
|
| 152 |
+
if (companyName) {
|
| 153 |
+
|
| 154 |
+
updateSidepane(companyName);
|
| 155 |
+
}
|
| 156 |
+
else {
|
| 157 |
+
document.getElementById(selectedCompany).value = "Select a company";
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
if (!role1) {
|
| 162 |
+
var roleFromInput = sessionStorage.getItem('userRole');
|
| 163 |
+
sessionStorage.setItem('userRole', roleFromInput);
|
| 164 |
+
console.log("Role set in sessionStorage:", roleFromInput);
|
| 165 |
+
} else {
|
| 166 |
+
sessionStorage.setItem('userRole', role1);
|
| 167 |
+
console.log("Retrieved user role from input:", role1); // Debugging
|
| 168 |
+
}
|
| 169 |
+
if (role1 === "superadmin") {
|
| 170 |
+
document.getElementById('company-block').style.display = 'block';
|
| 171 |
+
fetchCompanies();
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
});
|
| 175 |
+
document.getElementById('company').addEventListener('change', async function () {
|
| 176 |
+
const selectedCompany = this.value;
|
| 177 |
+
sessionStorage.setItem("company_name", selectedCompany);
|
| 178 |
+
// Update the sidepane immediately
|
| 179 |
+
updateSidepane(selectedCompany);
|
| 180 |
+
if (selectedCompany !== "Select") {
|
| 181 |
+
try {
|
| 182 |
+
const response = await fetch(`/api/company_id?company_name=${encodeURIComponent(selectedCompany)}`);
|
| 183 |
+
if (!response.ok) {
|
| 184 |
+
contentSection.style.display = 'none';
|
| 185 |
+
displayErrorMessage("Document details do not exist for this company. Please fill in the details.");
|
| 186 |
+
throw new Error('Network response was not ok');
|
| 187 |
+
}
|
| 188 |
+
const data = await response.json();
|
| 189 |
+
console.log('data returned', data);
|
| 190 |
+
const companyId = data.company_id;
|
| 191 |
+
sessionStorage.setItem("company_id", companyId);
|
| 192 |
+
console.log("company id for superadmin", company_id);
|
| 193 |
+
//document.getElementById('company_id').value = companyId;
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
if (companyId) {
|
| 197 |
+
try {
|
| 198 |
+
const countResponse = await fetch(`/api/company_record_count/${companyId}`);
|
| 199 |
+
if (!countResponse.ok) {
|
| 200 |
+
throw new Error('Network response was not ok');
|
| 201 |
+
}
|
| 202 |
+
const countData = await countResponse.json();
|
| 203 |
+
console.log('Count data:', countData); // Log the response data
|
| 204 |
+
updateRecordCounts(countData.table_counts);
|
| 205 |
+
} catch (error) {
|
| 206 |
+
console.error('Error fetching record counts:', error);
|
| 207 |
+
}
|
| 208 |
+
} else {
|
| 209 |
+
clearRecordCounts();
|
| 210 |
+
}
|
| 211 |
+
} catch (error) {
|
| 212 |
+
console.error('No details for this company ID or data documents:', error);
|
| 213 |
+
// displayEmptyTable();
|
| 214 |
+
|
| 215 |
+
displayErrorMessage("company details do not exist for this company.");
|
| 216 |
+
|
| 217 |
+
}
|
| 218 |
+
}
|
| 219 |
+
});
|
| 220 |
+
|
| 221 |
+
function updateRecordCounts(counts) {
|
| 222 |
+
// Update the counts displayed in the dashboard
|
| 223 |
+
document.getElementById('knowledgeBaseCount').textContent = counts.knowledge_base || 0;
|
| 224 |
+
document.getElementById('dataConnectorsCount').textContent = counts.data_connectors || 0;
|
| 225 |
+
document.getElementById('apiConnectorsCount').textContent = counts.api_connectors || 0;
|
| 226 |
+
document.getElementById('promptTemplatesCount').textContent = counts.prompt_templates || 0;
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
function clearRecordCounts() {
|
| 230 |
+
document.getElementById('knowledgeBaseCount').textContent = 0;
|
| 231 |
+
document.getElementById('dataConnectorsCount').textContent = 0;
|
| 232 |
+
document.getElementById('apiConnectorsCount').textContent = 0;
|
| 233 |
+
document.getElementById('promptTemplatesCount').textContent = 0;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
async function fetchCompanies() {
|
| 237 |
+
try {
|
| 238 |
+
const response = await fetch('/api/companies');
|
| 239 |
+
if (!response.ok) {
|
| 240 |
+
throw new Error('Network response was not ok');
|
| 241 |
+
}
|
| 242 |
+
const data = await response.json();
|
| 243 |
+
displayCompanies(data.companies);
|
| 244 |
+
} catch (error) {
|
| 245 |
+
console.error('Error fetching companies:', error);
|
| 246 |
+
}
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
function displayCompanies(companies) {
|
| 250 |
+
const companySelect = document.getElementById('company');
|
| 251 |
+
companySelect.innerHTML = '<option value="" selected>Select</option>'; // Reset the dropdown
|
| 252 |
+
companies.forEach(company => {
|
| 253 |
+
const option = document.createElement('option');
|
| 254 |
+
option.value = company.name;
|
| 255 |
+
option.textContent = company.name;
|
| 256 |
+
companySelect.appendChild(option);
|
| 257 |
+
});
|
| 258 |
+
}
|
| 259 |
+
function clearFormFields() {
|
| 260 |
+
document.getElementById('APIName').value = "";
|
| 261 |
+
document.getElementById('APIEndpoint').value = "";
|
| 262 |
+
document.getElementById('Auth_Bearer').value = "";
|
| 263 |
+
document.getElementById('Inputjson').value = "";
|
| 264 |
+
document.getElementById('OutputJson').value = "";
|
| 265 |
+
document.getElementById('Description').value = "";
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
</script>
|
| 269 |
+
</body>
|
| 270 |
+
|
| 271 |
</html>
|
templates/data_connectors.html
CHANGED
|
@@ -11,7 +11,7 @@
|
|
| 11 |
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/admin-lte@3.1/dist/css/adminlte.min.css">
|
| 12 |
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.25/css/dataTables.bootstrap4.min.css">
|
| 13 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
|
| 14 |
-
<link rel="stylesheet" href="/static/css/
|
| 15 |
|
| 16 |
|
| 17 |
</head>
|
|
@@ -128,6 +128,7 @@
|
|
| 128 |
<tr>
|
| 129 |
<th>Sno</th>
|
| 130 |
<th>Table Name</th>
|
|
|
|
| 131 |
</tr>
|
| 132 |
</thead>
|
| 133 |
<tbody id="table-body">
|
|
@@ -137,7 +138,7 @@
|
|
| 137 |
</div>
|
| 138 |
|
| 139 |
|
| 140 |
-
<div id="schema-table-section" style="margin-left: 30px;
|
| 141 |
<div class="row">
|
| 142 |
<div class="col-md-3">
|
| 143 |
<div class="form-group1">
|
|
@@ -150,24 +151,30 @@
|
|
| 150 |
</select>
|
| 151 |
</div>
|
| 152 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
|
| 154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
<div class="form-group">
|
| 156 |
<!-- Label with better spacing -->
|
| 157 |
-
<label for="tableschema" class="form-label"
|
| 158 |
-
style="margin-top: 0px; margin-left: 100px;width: 200%;">
|
| 159 |
Select Tables <span class="text-danger">*</span>
|
| 160 |
</label>
|
| 161 |
|
| 162 |
<!-- Dropdown container -->
|
| 163 |
-
<div class="dropdown custom-dropdown" style="margin-
|
| 164 |
-
<!-- Dropdown button -->
|
| 165 |
-
<button class="btn btn-primary dropdown-toggle w-100 text-start mt-3" type="button"
|
| 166 |
-
id="tablesDropdown" data-bs-toggle="dropdown" aria-expanded="false"
|
| 167 |
-
style="text-align: left;">
|
| 168 |
-
Select Tables
|
| 169 |
-
</button>
|
| 170 |
-
|
| 171 |
<!-- Dropdown menu with form styling -->
|
| 172 |
<ul class="dropdown-menu p-3 w-100" aria-labelledby="tablesDropdown"
|
| 173 |
style="max-height: 200px; overflow-y: auto;">
|
|
@@ -189,20 +196,10 @@
|
|
| 189 |
</div>
|
| 190 |
</div>
|
| 191 |
</div>
|
| 192 |
-
</div>
|
| 193 |
|
| 194 |
|
| 195 |
-
<div class="row">
|
| 196 |
-
<div class="col-md-3">
|
| 197 |
-
<div class="form-group1">
|
| 198 |
-
<label for="selectedTables" id="labelselected">Selected Tables</label>
|
| 199 |
-
<textarea type="text" id="selectedTables" name="selectedTables" class="form-control"
|
| 200 |
-
rows="4" readonly></textarea>
|
| 201 |
-
</div>
|
| 202 |
-
</div>
|
| 203 |
-
|
| 204 |
</div>
|
| 205 |
-
<div class="col-md-3">
|
| 206 |
<div class="btn-container1">
|
| 207 |
<button type="button" id="saveBtn" class="btn btn-primary"
|
| 208 |
style="width: 600px; margin-top: 10px;">Save</button>
|
|
@@ -230,48 +227,10 @@
|
|
| 230 |
<script src="https://cdn.jsdelivr.net/npm/admin-lte/dist/js/adminlte.min.js"></script>
|
| 231 |
|
| 232 |
<script>
|
| 233 |
-
// Populate the table body
|
| 234 |
-
const tableNames = localStorage.getItem("tablename"); // Retrieve the string
|
| 235 |
-
const tableBody = document.getElementById("table-body"); // Get the table body element
|
| 236 |
-
|
| 237 |
-
if (tableNames) {
|
| 238 |
-
const tableArray = tableNames.split(','); // Split the string into an array
|
| 239 |
-
tableArray.forEach((table, index) => {
|
| 240 |
-
const row = document.createElement("tr"); // Create a new row
|
| 241 |
-
row.innerHTML = `
|
| 242 |
-
<td>${index + 1}</td>
|
| 243 |
-
<td>${table.trim()}</td>
|
| 244 |
-
`;
|
| 245 |
-
tableBody.appendChild(row); // Append the row to the table
|
| 246 |
-
});
|
| 247 |
-
} else {
|
| 248 |
-
console.error("No table names found in localStorage.");
|
| 249 |
-
}
|
| 250 |
|
| 251 |
-
// Initialize DataTable
|
| 252 |
-
$(document).ready(function () {
|
| 253 |
-
$("#adminlte-table").DataTable({
|
| 254 |
-
responsive: true,
|
| 255 |
-
autoWidth: false,
|
| 256 |
-
paging: true,
|
| 257 |
-
lengthChange: true,
|
| 258 |
-
searching: true,
|
| 259 |
-
ordering: true,
|
| 260 |
-
info: true,
|
| 261 |
-
pageLength: 5,
|
| 262 |
-
lengthMenu: [5, 10, 15, 20],
|
| 263 |
-
language: {
|
| 264 |
-
paginate: {
|
| 265 |
-
previous: "<button class='btn1'>Previous</button>",
|
| 266 |
-
next: "<button class='btn1'>Next</button>",
|
| 267 |
-
},
|
| 268 |
|
| 269 |
-
},
|
| 270 |
-
});
|
| 271 |
-
});
|
| 272 |
|
| 273 |
-
|
| 274 |
-
<script>
|
| 275 |
|
| 276 |
document.addEventListener('DOMContentLoaded', function () {
|
| 277 |
// fetchCompanies();
|
|
@@ -474,10 +433,25 @@
|
|
| 474 |
document.getElementById("saveBtn").addEventListener("click", async function (event) {
|
| 475 |
event.preventDefault(); // Prevent the default form submission
|
| 476 |
|
| 477 |
-
//
|
| 478 |
-
|
| 479 |
-
tablename = document.getElementById('selectedTables').value
|
| 480 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 481 |
const tableNames = localStorage.getItem("tablename"); // Retrieve the string
|
| 482 |
if (tableNames) {
|
| 483 |
const tableArray = tableNames.split(','); // Split the string into an array
|
|
@@ -488,15 +462,20 @@
|
|
| 488 |
|
| 489 |
const form = document.getElementById('databaseconnectorForm');
|
| 490 |
const formData = new FormData(form);
|
| 491 |
-
|
| 492 |
-
formData
|
|
|
|
|
|
|
| 493 |
try {
|
| 494 |
console.log("inside save", formData);
|
| 495 |
-
console.log("
|
| 496 |
-
for (const [key, value] of formData.entries()) {
|
| 497 |
-
console.log(`${key}: ${value}`);
|
| 498 |
|
|
|
|
|
|
|
|
|
|
| 499 |
}
|
|
|
|
|
|
|
| 500 |
const response = await fetch(form.action, {
|
| 501 |
method: "POST",
|
| 502 |
body: formData
|
|
@@ -508,33 +487,69 @@
|
|
| 508 |
|
| 509 |
const data = await response.json();
|
| 510 |
|
| 511 |
-
console.log("result",
|
| 512 |
|
| 513 |
const messageContainer = document.getElementById('message-container');
|
| 514 |
if (data.created) {
|
| 515 |
if (messageContainer) {
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 522 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 523 |
}
|
| 524 |
|
| 525 |
} catch (error) {
|
| 526 |
console.error('Error saving data:', error);
|
| 527 |
-
const messageContainer = document.getElementById('message-container');
|
| 528 |
-
if (messageContainer) {
|
| 529 |
-
messageContainer.innerHTML = `
|
| 530 |
-
<div class='alert alert-danger'>
|
| 531 |
-
An error occurred while saving data in database.
|
| 532 |
-
<button class='close' style='font-size:medium;margin-top:6px;' onclick='dismissMessage()'>OK</button>
|
| 533 |
-
</div>`;
|
| 534 |
-
}
|
| 535 |
}
|
| 536 |
});
|
| 537 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 538 |
|
| 539 |
function dismissMessage() {
|
| 540 |
const messageContainer = document.getElementById('message-container');
|
|
|
|
| 11 |
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/admin-lte@3.1/dist/css/adminlte.min.css">
|
| 12 |
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.25/css/dataTables.bootstrap4.min.css">
|
| 13 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
|
| 14 |
+
<link rel="stylesheet" href="/static/css/data_connectors.css">
|
| 15 |
|
| 16 |
|
| 17 |
</head>
|
|
|
|
| 128 |
<tr>
|
| 129 |
<th>Sno</th>
|
| 130 |
<th>Table Name</th>
|
| 131 |
+
<th>Schema Name</th>
|
| 132 |
</tr>
|
| 133 |
</thead>
|
| 134 |
<tbody id="table-body">
|
|
|
|
| 138 |
</div>
|
| 139 |
|
| 140 |
|
| 141 |
+
<div id="schema-table-section" style="margin-left: 30px; width: 100%; height: 530px; display: none;">
|
| 142 |
<div class="row">
|
| 143 |
<div class="col-md-3">
|
| 144 |
<div class="form-group1">
|
|
|
|
| 151 |
</select>
|
| 152 |
</div>
|
| 153 |
</div>
|
| 154 |
+
<div class="col-md-3" style="position: absolute; right: 15%;">
|
| 155 |
+
<div class="form-group1">
|
| 156 |
+
<label for="selectedTables" id="labelselected">Selected Tables</label>
|
| 157 |
+
<textarea type="text" id="selectedTables" name="selectedTables" class="form-control"
|
| 158 |
+
rows="4" readonly
|
| 159 |
+
style="height: 310px !important; width: 330px !important;"></textarea>
|
| 160 |
+
</div>
|
| 161 |
+
</div>
|
| 162 |
|
| 163 |
+
|
| 164 |
+
</div>
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
<div class="row">
|
| 168 |
+
|
| 169 |
+
<div class="col-md-3" style="margin-top: 50px;margin-left: -100px;">
|
| 170 |
<div class="form-group">
|
| 171 |
<!-- Label with better spacing -->
|
| 172 |
+
<label for="tableschema" class="form-label" style="margin-top: 0px; width: 200%;">
|
|
|
|
| 173 |
Select Tables <span class="text-danger">*</span>
|
| 174 |
</label>
|
| 175 |
|
| 176 |
<!-- Dropdown container -->
|
| 177 |
+
<div class="dropdown custom-dropdown" style="margin-top: -35px;">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
<!-- Dropdown menu with form styling -->
|
| 179 |
<ul class="dropdown-menu p-3 w-100" aria-labelledby="tablesDropdown"
|
| 180 |
style="max-height: 200px; overflow-y: auto;">
|
|
|
|
| 196 |
</div>
|
| 197 |
</div>
|
| 198 |
</div>
|
|
|
|
| 199 |
|
| 200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
</div>
|
| 202 |
+
<div class="col-md-3" style="margin-top: 250px;">
|
| 203 |
<div class="btn-container1">
|
| 204 |
<button type="button" id="saveBtn" class="btn btn-primary"
|
| 205 |
style="width: 600px; margin-top: 10px;">Save</button>
|
|
|
|
| 227 |
<script src="https://cdn.jsdelivr.net/npm/admin-lte/dist/js/adminlte.min.js"></script>
|
| 228 |
|
| 229 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
|
|
|
|
|
|
|
|
|
|
| 232 |
|
| 233 |
+
|
|
|
|
| 234 |
|
| 235 |
document.addEventListener('DOMContentLoaded', function () {
|
| 236 |
// fetchCompanies();
|
|
|
|
| 433 |
document.getElementById("saveBtn").addEventListener("click", async function (event) {
|
| 434 |
event.preventDefault(); // Prevent the default form submission
|
| 435 |
|
| 436 |
+
// Get values from form fields
|
| 437 |
+
const schemaname = document.getElementById("schemas") ? document.getElementById("schemas").value : null;
|
| 438 |
+
const tablename = document.getElementById('selectedTables') ? document.getElementById('selectedTables').value : null;
|
| 439 |
+
const companyId = document.getElementById('company_id') ? document.getElementById('company_id').value : null;
|
| 440 |
+
|
| 441 |
+
// Validate required fields
|
| 442 |
+
if (!tablename) {
|
| 443 |
+
alert('Table name is required');
|
| 444 |
+
return;
|
| 445 |
+
}
|
| 446 |
+
if (!companyId) {
|
| 447 |
+
alert('Company ID is required');
|
| 448 |
+
return;
|
| 449 |
+
}
|
| 450 |
+
|
| 451 |
+
// Save the table name to localStorage
|
| 452 |
+
window.localStorage.setItem("tablename", tablename);
|
| 453 |
+
|
| 454 |
+
// Retrieve table names from localStorage and process
|
| 455 |
const tableNames = localStorage.getItem("tablename"); // Retrieve the string
|
| 456 |
if (tableNames) {
|
| 457 |
const tableArray = tableNames.split(','); // Split the string into an array
|
|
|
|
| 462 |
|
| 463 |
const form = document.getElementById('databaseconnectorForm');
|
| 464 |
const formData = new FormData(form);
|
| 465 |
+
|
| 466 |
+
// Append additional data to the formData
|
| 467 |
+
formData.append("company_id", companyId);
|
| 468 |
+
|
| 469 |
try {
|
| 470 |
console.log("inside save", formData);
|
| 471 |
+
console.log("company_id", companyId);
|
|
|
|
|
|
|
| 472 |
|
| 473 |
+
// Log form data for debugging
|
| 474 |
+
for (const [key, value] of formData.entries()) {
|
| 475 |
+
console.error(`${key}: ${value}`);
|
| 476 |
}
|
| 477 |
+
|
| 478 |
+
// Send data to the server
|
| 479 |
const response = await fetch(form.action, {
|
| 480 |
method: "POST",
|
| 481 |
body: formData
|
|
|
|
| 487 |
|
| 488 |
const data = await response.json();
|
| 489 |
|
| 490 |
+
console.log("result", data);
|
| 491 |
|
| 492 |
const messageContainer = document.getElementById('message-container');
|
| 493 |
if (data.created) {
|
| 494 |
if (messageContainer) {
|
| 495 |
+
dismissMessage()
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
// If there are table names in localStorage, display them in the table
|
| 499 |
+
const schemaName = schemaname ? schemaname : 'N/A'; // Default to 'N/A' if schema is null
|
| 500 |
+
const tableNames = localStorage.getItem("tablename");
|
| 501 |
+
const tableBody = document.getElementById("table-body");
|
| 502 |
+
|
| 503 |
+
if (tableNames) {
|
| 504 |
+
const tableArray = tableNames.split(',');
|
| 505 |
+
let serialNumber = tableBody.rows.length + 1;
|
| 506 |
+
tableArray.forEach((table, index) => {
|
| 507 |
+
const row = document.createElement("tr");
|
| 508 |
+
row.innerHTML = `
|
| 509 |
+
<td>${serialNumber++}</td>
|
| 510 |
+
<td>${table.trim()}</td>
|
| 511 |
+
<td>${schemaName}</td>
|
| 512 |
+
`;
|
| 513 |
+
tableBody.appendChild(row);
|
| 514 |
+
});
|
| 515 |
+
} else {
|
| 516 |
+
console.error("No table names found in localStorage.");
|
| 517 |
}
|
| 518 |
+
|
| 519 |
+
// Initialize DataTable only if it's not already initialized
|
| 520 |
+
$(document).ready(function () {
|
| 521 |
+
if (!$.fn.dataTable.isDataTable('#adminlte-table')) {
|
| 522 |
+
$("#adminlte-table").DataTable({
|
| 523 |
+
responsive: true,
|
| 524 |
+
autoWidth: false,
|
| 525 |
+
paging: true,
|
| 526 |
+
lengthChange: true,
|
| 527 |
+
searching: true,
|
| 528 |
+
ordering: true,
|
| 529 |
+
info: true,
|
| 530 |
+
pageLength: 5,
|
| 531 |
+
lengthMenu: [5, 10, 15, 20],
|
| 532 |
+
language: {
|
| 533 |
+
paginate: {
|
| 534 |
+
previous: "<button class='btn1'>Previous</button>",
|
| 535 |
+
next: "<button class='btn1'>Next</button>",
|
| 536 |
+
}
|
| 537 |
+
}
|
| 538 |
+
});
|
| 539 |
+
}
|
| 540 |
+
});
|
| 541 |
}
|
| 542 |
|
| 543 |
} catch (error) {
|
| 544 |
console.error('Error saving data:', error);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 545 |
}
|
| 546 |
});
|
| 547 |
|
| 548 |
+
|
| 549 |
+
|
| 550 |
+
|
| 551 |
+
|
| 552 |
+
|
| 553 |
|
| 554 |
function dismissMessage() {
|
| 555 |
const messageContainer = document.getElementById('message-container');
|
templates/index.html
CHANGED
|
@@ -1,97 +1,59 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="en">
|
| 3 |
-
|
| 4 |
-
<head>
|
| 5 |
-
<meta charset="UTF-8">
|
| 6 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
-
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
| 8 |
-
<title>Sign In/Up Form</title>
|
| 9 |
-
<!-- Google Font -->
|
| 10 |
-
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,800" rel="stylesheet">
|
| 11 |
-
<!-- Font Awesome -->
|
| 12 |
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
| 13 |
-
<link rel="stylesheet" href="/static/css/index.css">
|
| 14 |
-
<style>
|
| 15 |
-
|
| 16 |
-
</style>
|
| 17 |
-
</head>
|
| 18 |
-
|
| 19 |
-
<body class="login-page" style="background-image: url('static/img/Brain.
|
| 20 |
-
<main>
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
<
|
| 27 |
-
<
|
| 28 |
-
<
|
| 29 |
-
</
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
<
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
<
|
| 44 |
-
</div>
|
| 45 |
-
<
|
| 46 |
-
<
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
<button type="submit" class="ghost" id="signIn">Sign In</button>
|
| 60 |
-
</div>
|
| 61 |
-
<div class="overlay-panel overlay-right">
|
| 62 |
-
<div class="logo-container">
|
| 63 |
-
<img src="/static/img/redmindlogo3.jpg" alt="Logo" class="logo">
|
| 64 |
-
</div>
|
| 65 |
-
<h1>RedMindGPT</h1>
|
| 66 |
-
<p> Start Journey With Us</p>
|
| 67 |
-
<button class="ghost" id="signUp">Sign Up</button>
|
| 68 |
-
</div>
|
| 69 |
-
</div>
|
| 70 |
-
</div>
|
| 71 |
-
</div>
|
| 72 |
-
</main>
|
| 73 |
-
|
| 74 |
-
<!-- <footer>
|
| 75 |
-
<p>Developed with <i class="fas fa-heart"></i> by <a href="#">RedMind</a></p>
|
| 76 |
-
</footer> -->
|
| 77 |
-
|
| 78 |
-
<script>
|
| 79 |
-
const signUpButton = document.getElementById('signUp');
|
| 80 |
-
const signInButton = document.getElementById('signIn');
|
| 81 |
-
const text = document.getElementById('h1');
|
| 82 |
-
const container = document.getElementById('container');
|
| 83 |
-
const formcontainer = document.getElementById('form-container');
|
| 84 |
-
|
| 85 |
-
signUpButton.addEventListener('click', () => {
|
| 86 |
-
container.classList.add("right-panel-active");
|
| 87 |
-
text.textContent = 'hello'
|
| 88 |
-
});
|
| 89 |
-
|
| 90 |
-
signInButton.addEventListener('click', () => {
|
| 91 |
-
container.classList.remove("right-panel-active");
|
| 92 |
-
|
| 93 |
-
});
|
| 94 |
-
</script>
|
| 95 |
-
</body>
|
| 96 |
-
|
| 97 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
| 8 |
+
<title>Sign In/Up Form</title>
|
| 9 |
+
<!-- Google Font -->
|
| 10 |
+
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,800" rel="stylesheet">
|
| 11 |
+
<!-- Font Awesome -->
|
| 12 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
| 13 |
+
<link rel="stylesheet" href="/static/css/index.css">
|
| 14 |
+
<style>
|
| 15 |
+
|
| 16 |
+
</style>
|
| 17 |
+
</head>
|
| 18 |
+
|
| 19 |
+
<body class="login-page" style="background-image: url('static/img/Brain.png'); background-size: cover;">
|
| 20 |
+
<main>
|
| 21 |
+
<div class="container" id="container">
|
| 22 |
+
<div class="form-container sign-in-container">
|
| 23 |
+
<form action='/validate-user' name='signUpForm' method="post">
|
| 24 |
+
<h1 id="text" style="margin-bottom: 50px;">Sign in</h1>
|
| 25 |
+
<span>or use your email for registration</span>
|
| 26 |
+
<input type="text" placeholder="Name" name="username" required />
|
| 27 |
+
<input type="password" placeholder="Password" name="password" required />
|
| 28 |
+
<button type="submit">Sign in</button>
|
| 29 |
+
</form>
|
| 30 |
+
</div>
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
<div class="overlay-container">
|
| 35 |
+
<div class="overlay">
|
| 36 |
+
<div class="overlay-panel overlay-left">
|
| 37 |
+
<h1>Welcome Back!</h1>
|
| 38 |
+
<p>To keep connected with us please login with your personal info</p>
|
| 39 |
+
<button type="submit" class="ghost" id="signIn">Sign In</button>
|
| 40 |
+
</div>
|
| 41 |
+
<div class="overlay-panel overlay-right">
|
| 42 |
+
<div class="logo-container">
|
| 43 |
+
<img src="/static/img/redmindlogo3.jpg" alt="Logo" class="logo">
|
| 44 |
+
</div>
|
| 45 |
+
<h1>RedMindGPT</h1>
|
| 46 |
+
<p> Start Journey With Us</p>
|
| 47 |
+
</div>
|
| 48 |
+
</div>
|
| 49 |
+
</div>
|
| 50 |
+
</div>
|
| 51 |
+
</main>
|
| 52 |
+
|
| 53 |
+
<!-- <footer>
|
| 54 |
+
<p>Developed with <i class="fas fa-heart"></i> by <a href="#">RedMind</a></p>
|
| 55 |
+
</footer> -->
|
| 56 |
+
|
| 57 |
+
</body>
|
| 58 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
</html>
|
templates/knowledgebase.html
CHANGED
|
@@ -15,7 +15,7 @@
|
|
| 15 |
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
|
| 16 |
<script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script>
|
| 17 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
|
| 18 |
-
<link rel="stylesheet" href="/static/css/
|
| 19 |
|
| 20 |
</head>
|
| 21 |
|
|
|
|
| 15 |
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
|
| 16 |
<script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script>
|
| 17 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
|
| 18 |
+
<link rel="stylesheet" href="/static/css/knowledgebase.css">
|
| 19 |
|
| 20 |
</head>
|
| 21 |
|