v0.5.104: админ видит (личное) у своих компаний в dropdown

This commit is contained in:
“Naeel”
2026-06-15 13:41:01 +04:00
parent d1e86f5b35
commit 7cc06bf9d9
3 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "ipwhitelist",
"version": "0.5.103",
"version": "0.5.104",
"description": "IP WhiteList microservice for cloud provider",
"main": "server.js",
"scripts": {
+2
View File
@@ -51,10 +51,12 @@ function createUserRouter() {
let companies;
if (isAdmin) {
const all = await q.getAllCompanies();
const ownIds = new Set(req.allClientIds || []);
companies = all.map(c => ({
client_id: c.client_id,
name: c.name || c.client_id,
active_count: c.active_count,
isPersonal: ownIds.has(c.client_id),
}));
} else {
companies = (req.profiles && req.profiles.length > 0)
+1 -1
View File
@@ -170,7 +170,7 @@
<select name="switchTo" onchange="this.form.submit()">
<% companies.forEach(function(c) { %>
<option value="<%= c.client_id %>" <%= c.client_id === activeClientId ? 'selected' : '' %>>
<%= c.name %> (<%= c.client_id %>)<% if (c.active_count != null) { %> — <%= c.active_count %> зап.<% } %>
<%= c.name %> (<%= c.client_id %>)<% if (c.isPersonal) { %> (личное)<% } %><% if (c.active_count != null) { %> — <%= c.active_count %> зап.<% } %>
</option>
<% }) %>
</select>