diff --git a/src/ifctester/webapp/serve.py b/src/ifctester/webapp/serve.py index 5b18f15545..c114b47542 100644 --- a/src/ifctester/webapp/serve.py +++ b/src/ifctester/webapp/serve.py @@ -22,9 +22,6 @@ import os import sys bonsai_lib_path = os.environ.get("BONSAI_LIB_PATH") -print(os.environ) -print(bonsai_lib_path) -bonsai_version = os.environ.get("BONSAI_VERSION") if bonsai_lib_path: sys.path.insert(0, bonsai_lib_path) diff --git a/src/ifctester/webapp/src/config.json b/src/ifctester/webapp/src/config.json index d5c450f460..9198e64126 100644 --- a/src/ifctester/webapp/src/config.json +++ b/src/ifctester/webapp/src/config.json @@ -2,7 +2,6 @@ "wasm": { "wheel_url": "/worker/bin/ifcopenshell-0.8.3+bb329af-cp313-cp313-emscripten_4_0_9_wasm32.whl", "odfpy_url": "/worker/bin/odfpy-1.4.2-py2.py3-none-any.whl", - "api_py_url": "/worker/api.py", - "pyodide_url": "https://cdn.jsdelivr.net/pyodide/v0.28.0/full/pyodide.js" + "api_py_url": "/worker/api.py" } -} \ No newline at end of file +} diff --git a/src/ifctester/webapp/src/modules/api/ids.svelte.ts b/src/ifctester/webapp/src/modules/api/ids.svelte.ts index a05e9d6453..3035113654 100644 --- a/src/ifctester/webapp/src/modules/api/ids.svelte.ts +++ b/src/ifctester/webapp/src/modules/api/ids.svelte.ts @@ -265,17 +265,17 @@ export async function deleteFacet( const spec = Module.documents[docId].specifications.specification[specId]; const list = (spec[clause] as Record | undefined)?.[facet] as Facet[] | undefined; if (!list) return; - delete list[facetId]; + list.splice(facetId, 1); } export function getSpecUsage(spec?: Specification | null): IdsCardinality { if (!spec?.applicability) return 'required'; const minOccurs = spec.applicability["@minOccurs"] as number | undefined; const maxOccurs = spec.applicability["@maxOccurs"] as number | "unbounded" | undefined; - - if (minOccurs === 1 && maxOccurs === "unbounded") return 'required'; - if (minOccurs === 0 && maxOccurs === "unbounded") return 'optional'; - if (minOccurs === 0 && maxOccurs === 0) return 'prohibited'; + + if (minOccurs !== 0) return 'required'; + if (minOccurs === 0 && maxOccurs !== 0) return 'optional'; + if (maxOccurs === 0) return 'prohibited'; return 'required'; }; diff --git a/src/ifctester/webapp/src/pages/Home/FacetEditor.svelte b/src/ifctester/webapp/src/pages/Home/FacetEditor.svelte index c8b472397d..dbc6091f95 100644 --- a/src/ifctester/webapp/src/pages/Home/FacetEditor.svelte +++ b/src/ifctester/webapp/src/pages/Home/FacetEditor.svelte @@ -34,7 +34,7 @@ (facet as Record)[prop] = value; }; - const baseId = `facet-${facetType}-${index}`; + let baseId = $derived(`facet-${facetType}-${index}`);
diff --git a/src/ifctester/webapp/src/pages/Home/IdsViewer.svelte b/src/ifctester/webapp/src/pages/Home/IdsViewer.svelte index 936906adc0..e69ca73f7a 100644 --- a/src/ifctester/webapp/src/pages/Home/IdsViewer.svelte +++ b/src/ifctester/webapp/src/pages/Home/IdsViewer.svelte @@ -4,7 +4,7 @@ import { error, success } from "$src/modules/utils/toast.svelte"; import * as Tooltip from "$src/lib/components/ui/tooltip"; import type { AuditReport, AuditReportData } from "$src/types/report"; - import type { DocumentState, IdsDocument } from "$src/types/ids"; + import type { DocumentState, IdsDocument, Specification } from "$src/types/ids"; let activeDocument = $derived( IDS.Module.activeDocument ? (IDS.Module.documents[IDS.Module.activeDocument] as IdsDocument) : null @@ -19,6 +19,8 @@ let expandedRequirements = $state(new Set()); let allExpanded = $state(false); + type SpecificationStatus = boolean | 'skipped' | null; + // Open Editor mode and jump to a specific specification function editSpecification(index: number) { if (IDS.Module.activeDocument) { @@ -55,7 +57,7 @@ } } - function getSpecificationStatus(specIndex: number, auditData: AuditReportData) { + function getSpecificationStatus(specIndex: number, auditData: AuditReportData): SpecificationStatus { const spec = auditData.specifications[specIndex]; if (!spec) return null; return spec.is_skipped ? 'skipped' : spec.status; @@ -98,6 +100,10 @@ return null; // No reason needed for passed specifications } + function getDocumentSpecificationUsage(spec: Specification) { + return IDS.getSpecUsage(spec); + } + async function handleDownloadReport() { if (!auditReport) return; @@ -223,6 +229,7 @@
{#each activeDocument.specifications.specification as spec, index} + {@const usage = getDocumentSpecificationUsage(spec)}
{spec["@description"]}

{/if}
- {#if spec.applicability["@minOccurs"] === 1 && spec.applicability["@maxOccurs"] === 'unbounded'} + {#if usage === 'required'} Required {/if} - {#if spec.applicability["@minOccurs"] === 0 && spec.applicability["@maxOccurs"] === 'unbounded'} + {#if usage === 'optional'} Optional {/if} - {#if spec.applicability["@minOccurs"] === 0 && spec.applicability["@maxOccurs"] === 0} + {#if usage === 'prohibited'} Prohibited {/if} {#if auditReport} {@const stats = getSpecificationStats(index, auditReport.data)} {@const status = getSpecificationStatus(index, auditReport.data)} - {#if stats && spec.applicability["@maxOccurs"] !== 0 && status !== 'skipped'} + {#if stats && usage !== 'prohibited' && status !== 'skipped'} Checks: {stats.checksPassed}/{stats.checksTotal} Requirements: {stats.requirementsPassed}/{stats.requirements} {/if} @@ -325,12 +332,13 @@ {#if auditReport} {@const status = getSpecificationStatus(index, auditReport.data)} - {#if ! status && spec.applicability["@maxOccurs"] == 0} + {#if status === false && usage === 'prohibited'} {@const specReport = auditReport.data.specifications[index]} + {@const applicableEntities = specReport.applicable_entities ?? []}
- {#if specReport.applicable_entities && specReport.applicable_entities.length > 0} + {#if applicableEntities.length > 0}
-

Failed Elements ({specReport.applicable_entities.length})

+

Failed Elements ({applicableEntities.length})

@@ -346,7 +354,7 @@ - {#each specReport.applicable_entities.slice(0, 10) as entity} + {#each applicableEntities.slice(0, 10) as entity} @@ -402,9 +410,9 @@ {/each} - {#if specReport.applicable_entities.length > 10} + {#if applicableEntities.length > 10} - + {/if} diff --git a/src/ifctester/webapp/src/pages/Home/RestrictionEditor.svelte b/src/ifctester/webapp/src/pages/Home/RestrictionEditor.svelte index 46e93d15ce..513d9f18b1 100644 --- a/src/ifctester/webapp/src/pages/Home/RestrictionEditor.svelte +++ b/src/ifctester/webapp/src/pages/Home/RestrictionEditor.svelte @@ -1,6 +1,14 @@
{entity.class} {entity.predefined_type || '-'}
... {specReport.applicable_entities.length - 10} more failing elements not shown ...... {applicableEntities.length - 10} more failing elements not shown ...