feat(map): render classified unit identity aspects
This commit is contained in:
@@ -137,7 +137,7 @@ export type MapSubjectDetailProfile = {
|
||||
source: "fact" | "attribute" | "geometry" | "context";
|
||||
field: string;
|
||||
label: string;
|
||||
format: "text" | "number" | "timestamp" | "boolean" | "coordinate" | "signal_state" | "movement_state" | "telemetry_readings";
|
||||
format: "text" | "number" | "timestamp" | "boolean" | "coordinate" | "signal_state" | "movement_state" | "string_list" | "telemetry_readings";
|
||||
unit?: string;
|
||||
allowedReadingIds?: string[];
|
||||
}>;
|
||||
|
||||
@@ -6,7 +6,8 @@ export type MapSubjectDetailField = {
|
||||
source: "fact" | "attribute" | "geometry" | "context";
|
||||
field: string;
|
||||
label: string;
|
||||
format: "text" | "number" | "timestamp" | "boolean" | "coordinate" | "signal_state" | "movement_state" | "telemetry_readings";
|
||||
format: "text" | "number" | "timestamp" | "boolean" | "coordinate" | "signal_state" | "movement_state" | "string_list" | "telemetry_readings";
|
||||
dataClass?: "operational" | "restricted";
|
||||
unit?: string;
|
||||
allowedReadingIds?: string[];
|
||||
};
|
||||
@@ -57,7 +58,12 @@ export function buildMapSubjectCardModel(
|
||||
bindingId?: string;
|
||||
dataProductId?: string;
|
||||
profile?: MapSubjectDetailProfile;
|
||||
aspects?: Record<string, { fact: MapRuntimeFact; bindingId?: string; dataProductId?: string }>;
|
||||
aspects?: Record<string, {
|
||||
fact: MapRuntimeFact;
|
||||
bindingId?: string;
|
||||
dataProductId?: string;
|
||||
dataClass?: "operational" | "restricted";
|
||||
}>;
|
||||
},
|
||||
): MapSubjectCardModel | null;
|
||||
|
||||
|
||||
@@ -160,6 +160,7 @@ function buildSection(section, aspects) {
|
||||
readings.push(...normalizeTelemetryReadings(value, field.allowedReadingIds));
|
||||
continue;
|
||||
}
|
||||
if (field.format === "string_list" && (!Array.isArray(value) || value.length === 0)) continue;
|
||||
if (value === undefined || value === null || value === "") continue;
|
||||
if (typeof value === "string" && DIRECT_IDENTIFIER_VALUE.test(value.trim()) && !restricted) continue;
|
||||
rows.push({
|
||||
@@ -214,6 +215,14 @@ function formatValue(format, value, unit) {
|
||||
if (format === "signal_state") return value === "active" ? "На связи" : value === "inactive" ? "Не на связи" : formatScalar(value, unit);
|
||||
if (format === "movement_state") return value === "moving" ? "В движении" : value === "stopped" ? "Неподвижен" : formatScalar(value, unit);
|
||||
if (format === "boolean") return Boolean(value) ? "Да" : "Нет";
|
||||
if (format === "string_list") {
|
||||
if (!Array.isArray(value)) return "—";
|
||||
const items = value.slice(0, 256).flatMap((item) => {
|
||||
const scalar = formatScalar(item);
|
||||
return scalar === "—" ? [] : [scalar.replace(/^([^=]{1,160})=/, "$1: ")];
|
||||
});
|
||||
return items.length ? items.join(" • ") : "—";
|
||||
}
|
||||
if (format === "coordinate" && typeof value === "number" && Number.isFinite(value)) {
|
||||
return new Intl.NumberFormat("ru-RU", { minimumFractionDigits: 5, maximumFractionDigits: 6 }).format(value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user