Spaces:
Runtime error
Runtime error
Update sidepane.html
Browse files- sidepane.html +210 -105
sidepane.html
CHANGED
|
@@ -1,105 +1,210 @@
|
|
| 1 |
-
<!-- sidepane.html -->
|
| 2 |
-
|
| 3 |
-
<!-- This file represents the sidepane component of a web application. It contains the navigation menu and sidebar. -->
|
| 4 |
-
|
| 5 |
-
<
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
</
|
| 18 |
-
|
| 19 |
-
</
|
| 20 |
-
|
| 21 |
-
<!--
|
| 22 |
-
<
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
<
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
<
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
<
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
<
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
</
|
| 85 |
-
</li>
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!-- sidepane.html -->
|
| 2 |
+
|
| 3 |
+
<!-- This file represents the sidepane component of a web application. It contains the navigation menu and sidebar. -->
|
| 4 |
+
<!DOCTYPE html>
|
| 5 |
+
<html lang="en">
|
| 6 |
+
|
| 7 |
+
<head>
|
| 8 |
+
<meta charset="UTF-8">
|
| 9 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 10 |
+
<title>Company Profile</title>
|
| 11 |
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
| 12 |
+
|
| 13 |
+
<div class="container-fluid d-flex justify-content-center align-items-center">
|
| 14 |
+
<img src="/static/img/redmindlogo3.jpg" alt="Logo" style="width: 80px; height: auto; margin-right: 10px;">
|
| 15 |
+
|
| 16 |
+
<h3 style="text-align: center; margin-bottom: 0;">Redmind GPT - {{title}}</h3>
|
| 17 |
+
<button class="btn btn-primary" style="position: absolute; top: 30px;right:40px;" onclick="logout()">Logout</button>
|
| 18 |
+
|
| 19 |
+
</div>
|
| 20 |
+
<!-- Left navbar links -->
|
| 21 |
+
<!-- <ul class="navbar-nav">
|
| 22 |
+
<li class="nav-item">
|
| 23 |
+
<a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
|
| 24 |
+
</li>
|
| 25 |
+
</ul> -->
|
| 26 |
+
</nav>
|
| 27 |
+
|
| 28 |
+
<!-- Main Sidebar Container -->
|
| 29 |
+
<aside class="main-sidebar sidebar-dark-primary elevation-4" style="width: 200px; position: fixed; top: 0; left: 0; height: 100vh; overflow: hidden;">
|
| 30 |
+
<!-- Sidebar -->
|
| 31 |
+
<div class="sidebar">
|
| 32 |
+
<!-- Sidebar Menu -->
|
| 33 |
+
<nav class="mt-2">
|
| 34 |
+
<ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
|
| 35 |
+
|
| 36 |
+
<input type="hidden" id="userRole" name="userRole" value={{role}}>
|
| 37 |
+
<input type="hidden" id="company_id" name="company_id" value={{company_id}}>
|
| 38 |
+
<div class="form-group"style="display: none;">
|
| 39 |
+
<label for="llm_tools" >LLM Tools<span class="text-danger">*</span></label>
|
| 40 |
+
<select class="form-control" id="llm_tools" name="llm_tools" multiple required style="display: none;">
|
| 41 |
+
<option value="Database">Database</option>
|
| 42 |
+
<option value="Static Documents">Static Documents</option>
|
| 43 |
+
<option value="API">API</option>
|
| 44 |
+
</select>
|
| 45 |
+
<div class="invalid-feedback">
|
| 46 |
+
Please select at least one LLM tool.
|
| 47 |
+
</div>
|
| 48 |
+
</div>
|
| 49 |
+
|
| 50 |
+
<li class="nav-item">
|
| 51 |
+
<a href="{{url_for('dashboard')}}" class="nav-link">
|
| 52 |
+
<i class="nav-icon fas fa-home"></i>
|
| 53 |
+
<p>Dashboard</p>
|
| 54 |
+
</a>
|
| 55 |
+
</li>
|
| 56 |
+
<li class="nav-item" >
|
| 57 |
+
<a href="{{ url_for('company_profile') }}" class="nav-link">
|
| 58 |
+
<i class="nav-icon fas fa-users"></i>
|
| 59 |
+
<p>Company Profile</p>
|
| 60 |
+
</a>
|
| 61 |
+
</li>
|
| 62 |
+
<li class="nav-item" id="knowledgebase_link">
|
| 63 |
+
<a href="{{ url_for('knowledgebase') }}" class="nav-link">
|
| 64 |
+
<i class="nav-icon fas fa-cogs"></i>
|
| 65 |
+
<p>KnowledgeBase</p>
|
| 66 |
+
</a>
|
| 67 |
+
</li>
|
| 68 |
+
<li class="nav-item" id="data_connectors_link">
|
| 69 |
+
<a href="{{ url_for('data_connectors') }}" class="nav-link">
|
| 70 |
+
<i class="nav-icon fas fa-cogs"></i>
|
| 71 |
+
<p>Data Connectors</p>
|
| 72 |
+
</a>
|
| 73 |
+
</li>
|
| 74 |
+
<li class="nav-item" id="api_connectors_link">
|
| 75 |
+
<a href="{{ url_for('API_connectors') }}" class="nav-link">
|
| 76 |
+
<i class="nav-icon fas fa-cogs"></i>
|
| 77 |
+
<p>API Connectors</p>
|
| 78 |
+
</a>
|
| 79 |
+
</li>
|
| 80 |
+
<li class="nav-item">
|
| 81 |
+
<a href="{{url_for('prompt_template')}}" class="nav-link">
|
| 82 |
+
<i class="nav-icon fas fa-cogs"></i>
|
| 83 |
+
<p>Prompt Templates</p>
|
| 84 |
+
</a>
|
| 85 |
+
</li>
|
| 86 |
+
<!--<li class="nav-item">
|
| 87 |
+
<a href="#" class="nav-link">
|
| 88 |
+
<i class="nav-icon fas fa-cogs"></i>
|
| 89 |
+
<p>LLM Settings</p>
|
| 90 |
+
</a>
|
| 91 |
+
<ul class="nav nav-treeview">
|
| 92 |
+
<li class="nav-item">
|
| 93 |
+
<a href="#" class="nav-link">
|
| 94 |
+
<i class="far fa-circle nav-icon"></i>
|
| 95 |
+
<p>Sublink 1</p>
|
| 96 |
+
</a>
|
| 97 |
+
</li>
|
| 98 |
+
<li class="nav-item">
|
| 99 |
+
<a href="#" class="nav-link">
|
| 100 |
+
<i class="far fa-circle nav-icon"></i>
|
| 101 |
+
<p>Sublink 2</p>
|
| 102 |
+
</a>
|
| 103 |
+
</li>
|
| 104 |
+
|
| 105 |
+
</ul>
|
| 106 |
+
</li> -->
|
| 107 |
+
|
| 108 |
+
<!-- Add more navigation links here -->
|
| 109 |
+
</ul>
|
| 110 |
+
</nav>
|
| 111 |
+
<!-- /.sidebar-menu -->
|
| 112 |
+
</div>
|
| 113 |
+
<!-- /.sidebar -->
|
| 114 |
+
</aside>
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
<!-- AdminLTE JS -->
|
| 118 |
+
<script >
|
| 119 |
+
|
| 120 |
+
function logout() {
|
| 121 |
+
sessionStorage.removeItem('role');
|
| 122 |
+
sessionStorage.clear();
|
| 123 |
+
window.location.href = '/';
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
document.addEventListener("DOMContentLoaded", function() {
|
| 128 |
+
|
| 129 |
+
const company_id1 = document.getElementById("company_id").value;
|
| 130 |
+
const role1 = document.getElementById("userRole").value;
|
| 131 |
+
sessionStorage.setItem('siderole1',role1);
|
| 132 |
+
sessionStorage.setItem('sidecompanyId1',company_id1);
|
| 133 |
+
|
| 134 |
+
const sidecompanyId = sessionStorage.getItem('sidecompanyId1');
|
| 135 |
+
const siderole = sessionStorage.getItem('siderole1');
|
| 136 |
+
if (sidecompanyId && siderole) {
|
| 137 |
+
console.log("Company ID inside sidepane:", sidecompanyId);
|
| 138 |
+
console.log("Role inside sidepane:",siderole);
|
| 139 |
+
|
| 140 |
+
editCompany(sidecompanyId,siderole);
|
| 141 |
+
if (siderole==='admin')
|
| 142 |
+
{
|
| 143 |
+
console.log("inside admin before edit");
|
| 144 |
+
updateLinkVisibility(siderole);
|
| 145 |
+
}
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
});
|
| 149 |
+
|
| 150 |
+
async function updateLinkVisibility(siderole) {
|
| 151 |
+
//const role = sessionStorage.getItem('role');
|
| 152 |
+
if(siderole==='admin')
|
| 153 |
+
{
|
| 154 |
+
const displayState = JSON.parse(sessionStorage.getItem('displayState'));
|
| 155 |
+
|
| 156 |
+
// Update the visibility of links based on the stored state
|
| 157 |
+
document.getElementById('api_connectors_link').style.display = displayState.apiConnectors;
|
| 158 |
+
document.getElementById('knowledgebase_link').style.display = displayState.knowledgeBase;
|
| 159 |
+
document.getElementById('data_connectors_link').style.display = displayState.dataConnectors
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
async function editCompany(sidecompanyId,siderole) {
|
| 163 |
+
console.log("inside edit ", sidecompanyId);
|
| 164 |
+
console.log("inside edit role role",siderole);
|
| 165 |
+
$.getJSON(`/api/getcompanydetails/${sidecompanyId}`, function (company) {
|
| 166 |
+
// Set the value of #llm_tools and trigger change event
|
| 167 |
+
$('#llm_tools').val(company.llm_tools.split(',')).trigger('change');
|
| 168 |
+
|
| 169 |
+
// Get the selected values from #llm_tools
|
| 170 |
+
const llmTools = $('#llm_tools').val(); // This is an array
|
| 171 |
+
|
| 172 |
+
console.log("inside sidepane edit llmTools", llmTools);
|
| 173 |
+
//const role =sessionStorage.getItem('role');
|
| 174 |
+
|
| 175 |
+
if (llmTools && llmTools.length > 0) {
|
| 176 |
+
console.log("inside if");
|
| 177 |
+
if (siderole === 'admin') {
|
| 178 |
+
// Example: Conditionally display some links based on llm_tools
|
| 179 |
+
if (api_connectors_link) {
|
| 180 |
+
api_connectors_link.style.display = llmTools.includes('API') ? 'block' : 'none';
|
| 181 |
+
console.log("state api",api_connectors_link.style.display );
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
if (knowledgebase_link) {
|
| 185 |
+
knowledgebase_link.style.display = llmTools.includes('Static Documents') ? 'block' : 'none';
|
| 186 |
+
console.log("state know", knowledgebase_link.style.display);
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
if (data_connectors_link) {
|
| 190 |
+
data_connectors_link.style.display = llmTools.includes('Database') ? 'block' : 'none';
|
| 191 |
+
console.log("state dataconn", data_connectors_link.style.display);
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
console.log("inside storageadmin");
|
| 195 |
+
sessionStorage.setItem('displayState', JSON.stringify({
|
| 196 |
+
apiConnectors: api_connectors_link.style.display,
|
| 197 |
+
knowledgeBase: knowledgebase_link.style.display ,
|
| 198 |
+
dataConnectors: data_connectors_link.style.display
|
| 199 |
+
|
| 200 |
+
}));
|
| 201 |
+
}
|
| 202 |
+
}
|
| 203 |
+
}).fail(function () {
|
| 204 |
+
alert("Error retrieving company details.");
|
| 205 |
+
});
|
| 206 |
+
|
| 207 |
+
}
|
| 208 |
+
</script>
|
| 209 |
+
</head>
|
| 210 |
+
</html>
|