Org as single line with company code, v1.0.4
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ from flask import Flask
|
||||
from routes.main import bp as main_bp
|
||||
from routes.api import bp as api_bp
|
||||
|
||||
VERSION = "1.0.3"
|
||||
VERSION = "1.0.4"
|
||||
|
||||
app = Flask(__name__, template_folder="templates", static_folder="static")
|
||||
app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-dev.ngcloud.ru/api/v1/svc")
|
||||
|
||||
@@ -14,6 +14,18 @@ def _mask(s):
|
||||
return s[:4] + "*" * (len(s) - 8) + s[-4:]
|
||||
|
||||
|
||||
def _client_id(token):
|
||||
import base64, json
|
||||
try:
|
||||
parts = token.split(".")
|
||||
if len(parts) >= 2:
|
||||
payload = base64.urlsafe_b64decode(parts[1] + "==")
|
||||
return json.loads(payload).get("ClientID", "")
|
||||
except Exception:
|
||||
pass
|
||||
return ""
|
||||
|
||||
|
||||
@bp.route("/", methods=["GET", "POST"])
|
||||
def index():
|
||||
env_token = current_app.config["NUBES_API_TOKEN"]
|
||||
@@ -75,6 +87,7 @@ def index():
|
||||
organization=org, error=error,
|
||||
env_token_masked=_mask(env_token),
|
||||
has_user_token=bool(user_token),
|
||||
client_id=_client_id(active_token),
|
||||
instance_groups=instance_groups)
|
||||
|
||||
|
||||
|
||||
@@ -31,12 +31,8 @@
|
||||
{% if organization %}
|
||||
<div class="card">
|
||||
<div class="card-header">Организация</div>
|
||||
<div class="card-body" style="font-size:12px;">
|
||||
<table>
|
||||
<tr><td style="color:var(--muted);">Имя</td><td>{{ organization.displayName }}</td></tr>
|
||||
<tr><td style="color:var(--muted);">UID</td><td style="font-family:monospace;font-size:11px;">{{ organization.instanceUid }}</td></tr>
|
||||
<tr><td style="color:var(--muted);">Статус</td><td><span class="badge badge-success">{{ organization.explainedStatus or "OK" }}</span></td></tr>
|
||||
</table>
|
||||
<div class="card-body" style="padding:8px 14px;font-size:12px;">
|
||||
{{ organization.displayName }}{% if client_id %} ({{ client_id }}){% endif %} — <span class="badge badge-success">{{ organization.explainedStatus or "OK" }}</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user