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.main import bp as main_bp
|
||||||
from routes.api import bp as api_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 = 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")
|
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:]
|
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"])
|
@bp.route("/", methods=["GET", "POST"])
|
||||||
def index():
|
def index():
|
||||||
env_token = current_app.config["NUBES_API_TOKEN"]
|
env_token = current_app.config["NUBES_API_TOKEN"]
|
||||||
@@ -75,6 +87,7 @@ def index():
|
|||||||
organization=org, error=error,
|
organization=org, error=error,
|
||||||
env_token_masked=_mask(env_token),
|
env_token_masked=_mask(env_token),
|
||||||
has_user_token=bool(user_token),
|
has_user_token=bool(user_token),
|
||||||
|
client_id=_client_id(active_token),
|
||||||
instance_groups=instance_groups)
|
instance_groups=instance_groups)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,12 +31,8 @@
|
|||||||
{% if organization %}
|
{% if organization %}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">Организация</div>
|
<div class="card-header">Организация</div>
|
||||||
<div class="card-body" style="font-size:12px;">
|
<div class="card-body" style="padding:8px 14px;font-size:12px;">
|
||||||
<table>
|
{{ organization.displayName }}{% if client_id %} ({{ client_id }}){% endif %} — <span class="badge badge-success">{{ organization.explainedStatus or "OK" }}</span>
|
||||||
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user