Skip to content

Commit 47b2700

Browse files
authored
Merge pull request #551 from 21nCo/TIDY-454
TIDY-454 - Static build runtime crashes, CF deployment issues fix
2 parents eb4656b + af09e9a commit 47b2700

30 files changed

Lines changed: 1098 additions & 164 deletions

.github/workflows/tests.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,38 @@ jobs:
154154
with:
155155
name: playwright-smoke-${{ matrix.product }}
156156
path: apps/e2e-playwright/artifacts
157+
158+
playwright-static-nucleum-smoke:
159+
runs-on: ubuntu-latest
160+
needs:
161+
- app-checks
162+
- vitest
163+
timeout-minutes: 30
164+
permissions:
165+
contents: read
166+
actions: write
167+
steps:
168+
- name: Checkout
169+
uses: actions/checkout@v4
170+
- name: Setup Node
171+
uses: actions/setup-node@v4
172+
with:
173+
node-version: 20
174+
cache: npm
175+
- name: Install dependencies
176+
run: npm install --legacy-peer-deps
177+
- name: Install Playwright browsers
178+
run: npx playwright install --with-deps
179+
working-directory: apps/e2e-playwright
180+
- name: Run Nucleum Playwright smoke against generated build
181+
env:
182+
E2E_LOGIN_EMAIL: ${{ secrets.E2E_LOGIN_EMAIL }}
183+
E2E_LOGIN_PASSWORD: ${{ secrets.E2E_LOGIN_PASSWORD }}
184+
VITE_ACCOUNT_BASE_URL_TEMPLATE: https://account-{region}-dev.nucleum.app
185+
run: npm --workspace e2e-playwright run test:static:nucleum:app-smoke
186+
- name: Upload static Playwright artifacts
187+
if: always()
188+
uses: actions/upload-artifact@v4
189+
with:
190+
name: playwright-static-nucleum-smoke
191+
path: apps/e2e-playwright/artifacts

apps/e2e-playwright/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"test:feature": "playwright test --grep @feature",
88
"test:regression": "playwright test --grep @regression",
99
"test:ci": "playwright test --reporter=line",
10+
"test:static:nucleum": "node ../../tools/ci/run-playwright-static-product.mjs --product=nucleum --environment=dev --suite=all",
11+
"test:static:nucleum:smoke": "node ../../tools/ci/run-playwright-static-product.mjs --product=nucleum --environment=dev --suite=smoke --reporter=line",
12+
"test:static:nucleum:app-smoke": "node ../../tools/ci/run-playwright-static-product.mjs --product=nucleum --environment=dev --suite=app-smoke --reporter=line",
1013
"coverage:matrix": "tsx scripts/generate-coverage-matrix.ts",
1114
"debug:impromptu-smoke": "npx tsx scripts/impromptu-surface-smoke.ts",
1215
"debug:collection-deep-dive": "npx tsx scripts/impromptu-collection-deep-dive.ts",

client/components/charts/EChart.svelte

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { beforeUpdate, onDestroy, onMount } from "svelte";
2+
import { onDestroy } from "svelte";
33
import * as echarts from "echarts";
44
import type { ECharts, EChartsOption } from "echarts";
55
import { ChartType } from "@21n/types/analytics.type";
@@ -15,13 +15,19 @@
1515
} from "./chart.utils";
1616
import { userPreferences } from "../settings/userPreferences.store";
1717
18-
let type: ChartType;
19-
let data: any;
20-
let options: any;
21-
let showLegend: boolean = true;
22-
let isConstrainedWidth: boolean = false;
23-
24-
export { type, data, options, showLegend, isConstrainedWidth };
18+
let {
19+
type,
20+
data,
21+
options,
22+
showLegend = true,
23+
isConstrainedWidth = false
24+
}: {
25+
type: ChartType;
26+
data: any;
27+
options: any;
28+
showLegend?: boolean;
29+
isConstrainedWidth?: boolean;
30+
} = $props();
2531
2632
const supportedTypes = new Set([
2733
ChartType.BAR,
@@ -38,15 +44,15 @@
3844
ChartType.HOURLY_HEATMAP
3945
]);
4046
41-
let container: HTMLDivElement | undefined;
47+
let container = $state<HTMLDivElement | undefined>();
4248
let chart: ECharts | undefined;
4349
let resizeObserver: ResizeObserver | undefined;
4450
45-
let currentAppearance = $appearance;
46-
let currentColors = currentAppearance
47-
? retrieveCurrentColors(currentAppearance)
48-
: undefined;
49-
let shouldRenderChart = supportedTypes.has(type);
51+
let currentAppearance = $state<typeof $appearance | undefined>(undefined);
52+
let currentColors = $state<ReturnType<typeof retrieveCurrentColors> | undefined>(
53+
undefined
54+
);
55+
let shouldRenderChart = $state(false);
5056
5157
const defaultPaletteKeys = [
5258
"aps1",
@@ -1501,13 +1507,7 @@
15011507
shouldRenderChart = supportedTypes.has(type);
15021508
}
15031509
1504-
onMount(() => {
1505-
refreshDerivedState();
1506-
ensureChart();
1507-
updateChart();
1508-
});
1509-
1510-
beforeUpdate(() => {
1510+
$effect(() => {
15111511
refreshDerivedState();
15121512
if (shouldRenderChart) {
15131513
ensureChart();

client/components/charts/custom/charts/barChart/Simple.svelte

Lines changed: 47 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
axisLeft,
1010
axisBottom
1111
} from "d3";
12-
import { beforeUpdate, onDestroy, onMount } from "svelte";
12+
import { onDestroy, onMount } from "svelte";
1313
//TODO - import dependency on local
1414
import { roundOffToNdigitsAfterDecimal } from "@21n/products/pointron/pointron.utils";
1515
import {
@@ -20,22 +20,27 @@
2020
import { generateUID } from "@21n/utils/utils";
2121
import appearance from "@21n/stores/appearance.store";
2222
23-
let data: ChartDataPoint[] = [];
24-
let options: BarChartOptions;
25-
let orientation: Orientation = Orientation.Vertical;
26-
let themeColors = retrieveCurrentColors($appearance);
23+
let {
24+
data = [],
25+
options,
26+
orientation = Orientation.Vertical
27+
}: {
28+
data?: ChartDataPoint[];
29+
options: BarChartOptions;
30+
orientation?: Orientation;
31+
} = $props();
32+
33+
let themeColors = $state(retrieveCurrentColors($appearance));
2734
const chartID = generateUID();
2835
29-
export { data, options, orientation };
30-
31-
let containerRef: any = null;
32-
let scrollableElementContainerRef: any = null;
33-
let fixedXAxisRef: any = null;
34-
let fixedYAxisRef: any = null;
35-
let legendContainerRef: any = null;
36-
let wrapperRef: any = null;
37-
let informationModal: any = null;
38-
let previouslyCheckedItem: HTMLInputElement;
36+
let containerRef = $state<any>(null);
37+
let scrollableElementContainerRef = $state<any>(null);
38+
let fixedXAxisRef = $state<any>(null);
39+
let fixedYAxisRef = $state<any>(null);
40+
let legendContainerRef = $state<any>(null);
41+
let wrapperRef = $state<any>(null);
42+
let informationModal = $state<any>(null);
43+
let previouslyCheckedItem = $state<HTMLInputElement>();
3944
// let previouslyCheckedId: string = "";
4045
4146
let currentDataLength: number = 0;
@@ -46,16 +51,21 @@
4651
let sanitizedData: ChartDataPoint[] = [];
4752
// in sanitizedData we will be modifying the data so that if there are multiple data items present with same key then we will only be considering the first one and will be ignoring the rest
4853
49-
let groups: string[] = [];
54+
let groups = $state<string[]>([]);
5055
51-
let selectedGroups: string[] = [];
56+
let selectedGroups = $state<string[]>([]);
5257
5358
let BARS_AND_AXIS_SVG: any = null;
5459
let FIXED_AXIS_GROUP: any = null;
60+
let isMounted = false;
5561
56-
let colors: { [key: string]: string }[] = [];
62+
let colors = $state<Record<string, string>>({});
5763
58-
let mouseHoverData: ChartDataPoint = { key: "", value: 0, group: "" };
64+
let mouseHoverData = $state<ChartDataPoint>({
65+
key: "",
66+
value: 0,
67+
group: ""
68+
});
5969
6070
// Please write these values along with their units
6171
const DEFAULT_CONTAINER_DIMENSIONS = {
@@ -169,10 +179,7 @@
169179
"filteredData for id ",
170180
id + " is " + filteredData.map((d) => d.key)
171181
);
172-
BARS_AND_AXIS_SVG.remove();
173-
FIXED_AXIS_GROUP.remove();
174-
paintGraph();
175-
handleEventListeningForBars();
182+
repaintGraph();
176183
previouslyCheckedItem = currentlyCheckedItem;
177184
}
178185
@@ -202,8 +209,15 @@
202209
// return selectedGroups.includes(d.group);
203210
// });//*this is done so that the chart is rendered with the data that is present at the time of mounting
204211
205-
BARS_AND_AXIS_SVG.remove();
206-
FIXED_AXIS_GROUP.remove();
212+
repaintGraph();
213+
}
214+
215+
function repaintGraph() {
216+
if (!isMounted) return;
217+
BARS_AND_AXIS_SVG?.remove();
218+
FIXED_AXIS_GROUP?.remove();
219+
BARS_AND_AXIS_SVG = null;
220+
FIXED_AXIS_GROUP = null;
207221
paintGraph();
208222
handleEventListeningForBars();
209223
}
@@ -760,15 +774,22 @@
760774
}
761775
762776
paintGraph();
777+
isMounted = true;
763778
764779
if (scrollableElementContainerRef) {
765780
scrollableElementContainerRef.addEventListener("scroll", detectScrollEnd);
766781
}
767782
handleEventListeningForBars();
768783
});
769784
770-
beforeUpdate(() => {
785+
$effect.pre(() => {
771786
refreshDerivedState();
787+
if (isMounted) {
788+
filteredData = previouslyCheckedItem
789+
? data.filter((d) => d.group === previouslyCheckedItem.value)
790+
: data;
791+
repaintGraph();
792+
}
772793
});
773794
774795
onDestroy(() => {

client/components/charts/custom/charts/barChart/Stacked.svelte

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
axisLeft,
1010
axisBottom
1111
} from "d3";
12-
import { beforeUpdate, onDestroy, onMount } from "svelte";
12+
import { onDestroy, onMount } from "svelte";
1313
//TODO - import dependency on local
1414
import { roundOffToNdigitsAfterDecimal } from "@21n/products/pointron/pointron.utils";
1515
import {
@@ -22,21 +22,26 @@
2222
import appearance from "@21n/stores/appearance.store";
2323
import view from "@21n/stores/view.store";
2424
25-
let data: ChartDataPoint[] = [];
26-
let options: any;
27-
let orientation: Orientation = Orientation.Vertical;
28-
let themeColors = retrieveCurrentColors($appearance);
25+
let {
26+
data = [],
27+
options,
28+
orientation = Orientation.Vertical
29+
}: {
30+
data?: ChartDataPoint[];
31+
options: any;
32+
orientation?: Orientation;
33+
} = $props();
34+
35+
let themeColors = $state(retrieveCurrentColors($appearance));
2936
const chartID = generateUID();
3037
31-
export { data, options, orientation };
32-
33-
let containerRef: any = null;
34-
let scrollableElementContainerRef: any = null;
35-
let fixedXAxisRef: any = null;
36-
let fixedYAxisRef: any = null;
37-
let legendContainerRef: any = null;
38-
let wrapperRef: any = null;
39-
let informationModal: any = null;
38+
let containerRef = $state<any>(null);
39+
let scrollableElementContainerRef = $state<any>(null);
40+
let fixedXAxisRef = $state<any>(null);
41+
let fixedYAxisRef = $state<any>(null);
42+
let legendContainerRef = $state<any>(null);
43+
let wrapperRef = $state<any>(null);
44+
let informationModal = $state<any>(null);
4045
4146
4247
let SVGScrollableDimensionLength: number = 0;
@@ -45,17 +50,22 @@
4550
let sanitizedData: ChartDataPoint[] = [];
4651
// in sanitizedData we will be modifying the data so that if there are multiple data items present with same key and group then we will merge them into one data item with the value being the sum of all the values of the data items with same key and group
4752
48-
let groups: ChartDataPoint[][] = [];
49-
let groupsBasedOnKey: ChartDataPoint[][] = [];
53+
let groups = $state<ChartDataPoint[][]>([]);
54+
let groupsBasedOnKey = $state<ChartDataPoint[][]>([]);
5055
51-
let selectedGroups: string[] = [];
56+
let selectedGroups = $state<string[]>([]);
5257
5358
let BARS_AND_AXIS_SVG: any = null;
5459
let FIXED_AXIS_GROUP: any = null;
60+
let isMounted = false;
5561
56-
let colors: { [key: string]: string }[] = [];
62+
let colors = $state<Record<string, string>>({});
5763
58-
let mouseHoverData: ChartDataPoint = { key: "", value: 0, group: "" };
64+
let mouseHoverData = $state<ChartDataPoint>({
65+
key: "",
66+
value: 0,
67+
group: ""
68+
});
5969
6070
// Please write these values along with their units
6171
const DEFAULT_CONTAINER_DIMENSIONS = {
@@ -319,9 +329,15 @@
319329
groups = tempGroups;
320330
groupsBasedOnKey = tempGroupingBasedOnKey;
321331
322-
//remove the existing graph and repaint it by calling the paintGraph function
323-
BARS_AND_AXIS_SVG.remove();
324-
FIXED_AXIS_GROUP.remove();
332+
repaintGraph();
333+
}
334+
335+
function repaintGraph() {
336+
if (!isMounted) return;
337+
BARS_AND_AXIS_SVG?.remove();
338+
FIXED_AXIS_GROUP?.remove();
339+
BARS_AND_AXIS_SVG = null;
340+
FIXED_AXIS_GROUP = null;
325341
paintGraph();
326342
handleEventListeningForBars();
327343
}
@@ -923,20 +939,22 @@
923939
});
924940
}
925941
paintGraph();
942+
isMounted = true;
926943
updateGraph();
927944
if (scrollableElementContainerRef) {
928945
scrollableElementContainerRef.addEventListener("scroll", detectScrollEnd);
929946
}
930947
handleEventListeningForBars();
931948
});
932949
933-
beforeUpdate(() => {
950+
$effect.pre(() => {
934951
refreshDimensions();
935952
const currentXDomain = JSON.stringify(options?.xDomain ?? null);
936953
if (previousData !== data || previousXDomain !== currentXDomain) {
937954
previousData = data;
938955
previousXDomain = currentXDomain;
939956
refreshSanitizedData();
957+
repaintGraph();
940958
}
941959
});
942960

client/components/combination/SideNavCombinationNavItem.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import { cn } from "@21n/client/utils/ui.utils";
88
import { resolveResourceIcon } from "@21n/client/components/flux/resourceStores/resource.utils";
99
import type { IAvatar } from "@21n/client/types/avatar.type";
10+
import SideNavCombinationNavItem from "./SideNavCombinationNavItem.svelte";
1011
import {
1112
CombinationNavItemType,
1213
type ICombinationNavItem
@@ -69,7 +70,7 @@
6970
);
7071
$effect(() => {
7172
if (!isEditing) {
72-
editLabel = item.label;
73+
editLabel = item.label;
7374
}
7475
});
7576
@@ -277,7 +278,7 @@
277278
{#if item.children && item.children.length > 0 && !isCollapsed}
278279
<div class="flex flex-col">
279280
{#each item.children as child}
280-
<svelte:self
281+
<SideNavCombinationNavItem
281282
item={child}
282283
depth={depth + 1}
283284
{activeItemId}

0 commit comments

Comments
 (0)