Skip to content

Commit

Permalink
deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
TJKoury committed Nov 18, 2023
1 parent e5e034f commit 403ecd9
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 18 deletions.
6 changes: 3 additions & 3 deletions docs/assets/app-bd99f75f.js → docs/assets/app-02934653.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<meta name="HandheldFriendly" content="true" />

<title>SDA TAP LAB</title>
<script type="module" crossorigin src="/assets/app-bd99f75f.js"></script>
<script type="module" crossorigin src="/assets/app-02934653.js"></script>
<link rel="stylesheet" href="/assets/index-5887f923.css">
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "spaceaware.io",
"private": true,
"version": "0.0.0+1700320327276",
"version": "0.0.0+1700321816686",
"type": "module",
"scripts": {
"postinstall": "npm run copy:orbpro",
Expand Down
28 changes: 20 additions & 8 deletions src/lib/DataTable/DataTable.svelte
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<script lang="ts">
import { onMount, onDestroy } from "svelte";
import { Grid } from "ag-grid-community";
import type { GridOptions, ColDef } from "ag-grid-community";
import type { GridOptions, ColDef, GridApi } from "ag-grid-community";
import "@/../node_modules/ag-grid-community/styles/ag-grid.css";
import "@/../node_modules/ag-grid-community/styles/ag-theme-balham.css";
import {
filterModelStore,
data,
columnDefs,
filterAction,
} from "@/stores/datatable.store";
import { get } from "svelte/store";
let gridOptions: GridOptions = {
columnDefs: $columnDefs,
Expand All @@ -20,6 +22,7 @@
},
onFilterChanged: (event) => {
filterModelStore.set(event.api.getFilterModel());
executeFilterAction(event.api);
},
onSortChanged: (event) => {},
};
Expand All @@ -28,22 +31,31 @@
let gridElement: HTMLElement;
let gridApi: any;
//window.resizeGrid = resizeGrid;
onMount(() => {
grid = new Grid(gridElement, gridOptions);
gridApi = gridOptions.api;
//window.addEventListener("resize", resizeGrid);
});
onDestroy(() => {
// window.removeEventListener("resize", resizeGrid);
});
// Reactive statements to update columnDefs and rowData
$: if (gridApi) {
gridApi.setColumnDefs($columnDefs);
gridApi.setRowData($data);
// resizeGrid();
}
function executeFilterAction(api: GridApi) {
const filterActionFunction = get(filterAction);
if (!filterActionFunction) {
return;
}
// Retrieve filtered row data
const rowData: any[] = [];
api.forEachNodeAfterFilter((node) => {
rowData.push(node.data);
});
// Invoke the filter action function with the filtered rows
filterActionFunction(rowData);
}
</script>

Expand Down
20 changes: 16 additions & 4 deletions src/lib/SpaceObjects/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,30 @@
data,
columnDefs as columnDefStore,
filterModelStore,
filterAction,
} from "@/stores/datatable.store";
import type { Entity, SpaceEntity } from "orbpro";
const filterActionFunction = (filteredRows: any[]) => {
if (!$viewer) {
return;
}
const dataSource = $viewer.dataSources.getByName("spaceaware")[0];
const filteredIds = new Set(filteredRows.map((row) => row.OBJECT_ID)); // Assuming each row has an 'id' property
dataSource.entities.values.forEach((entity: Entity) => {
// Assuming each entity has a corresponding 'id' property
entity.show = filteredIds.has(entity.id);
});
};
const toggleModal = async () => {
if ($mode === "SpaceObjects") {
$mode = null;
$filterAction = null;
} else if (!$mode) {
$mode = "SpaceObjects";
$filterAction = filterActionFunction;
}
$columnDefStore = columnDefs;
Expand All @@ -25,13 +41,9 @@
const combinedData = dataSource.entities.values.map((e: Entity) => {
const OMM = e.properties?.OMM.getValue() || {};
const CAT = e.properties?.CAT.getValue() || {};
// Combine OMM and CAT in a format suitable for your datatable
// Assuming you want an object with both properties
return { ...OMM, ...CAT };
});
// Set the combined data to the $data store
data.set(combinedData as any);
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/stores/datatable.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { writable, type Writable } from "svelte/store";
// Stores for filter and sort models
export const filterModelStore = writable({});
export const sortModelStore = writable({});
export const mode:Writable<any> = writable(null);
export const mode: Writable<any> = writable(null);
export const data = writable([]);
export const columnDefs: Writable<ColDef[]> = writable([]);
export const filterAction: Writable<Function | null> = writable(null);

0 comments on commit 403ecd9

Please sign in to comment.