feat(foundry): support restricted subject aspects
This commit is contained in:
@@ -132,6 +132,73 @@ test("subject details compose declared aspect bindings by stable source id", ()
|
||||
assert.equal(card.tabs[0].sections[0].rows[0].value, "cargo_trike");
|
||||
});
|
||||
|
||||
test("restricted joined aspects render declared identifiers and remain fail-closed otherwise", () => {
|
||||
const profile = {
|
||||
id: "map.subject-detail.restricted",
|
||||
version: "1.0.0",
|
||||
title: "Restricted",
|
||||
semanticTypes: ["map.moving_object"],
|
||||
defaultTabId: "contacts",
|
||||
tabs: [{
|
||||
id: "contacts",
|
||||
label: "Контакты",
|
||||
emptyMessage: "Нет данных",
|
||||
sections: [{
|
||||
id: "device",
|
||||
label: "Контакты устройства",
|
||||
fields: [
|
||||
{
|
||||
id: "contacts.phone",
|
||||
aspectId: "unit_contacts",
|
||||
source: "attribute",
|
||||
field: "device_phone_primary",
|
||||
label: "Телефон 1",
|
||||
format: "text",
|
||||
dataClass: "restricted",
|
||||
},
|
||||
{
|
||||
id: "contacts.imei",
|
||||
aspectId: "unit_contacts",
|
||||
source: "attribute",
|
||||
field: "device_imei",
|
||||
label: "IMEI",
|
||||
format: "text",
|
||||
dataClass: "restricted",
|
||||
},
|
||||
],
|
||||
}],
|
||||
}],
|
||||
};
|
||||
const contactAspect = {
|
||||
bindingId: "trike-unit-contacts",
|
||||
dataProductId: "fleet.units.contacts.current.v1",
|
||||
dataClass: "restricted",
|
||||
fact: {
|
||||
sourceId: fact.sourceId,
|
||||
semanticType: "map.moving_object",
|
||||
attributes: {
|
||||
device_phone_primary: "+79991234567",
|
||||
device_imei: "867236078012345",
|
||||
},
|
||||
},
|
||||
};
|
||||
const card = buildMapSubjectCardModel(fact, {
|
||||
profile,
|
||||
aspects: { unit_contacts: contactAspect },
|
||||
});
|
||||
assert.deepEqual(
|
||||
card.tabs[0].sections[0].rows.map((row) => row.value),
|
||||
["+79991234567", "867236078012345"],
|
||||
);
|
||||
const rejected = buildMapSubjectCardModel(fact, {
|
||||
profile,
|
||||
aspects: {
|
||||
unit_contacts: { ...contactAspect, dataClass: "operational" },
|
||||
},
|
||||
});
|
||||
assert.equal(rejected.tabs[0].empty, true);
|
||||
});
|
||||
|
||||
test("Cesium pin and label share one entity selection that opens the subject card", async () => {
|
||||
const [renderer, preview] = await Promise.all([
|
||||
readFile(new URL("../apps/catalog/src/CesiumMapRenderer.tsx", import.meta.url), "utf8"),
|
||||
|
||||
Reference in New Issue
Block a user