1PORTNAME=	opensearch-dashboards
2DISTVERSION=	2.19.4
3PORTREVISION=	1
4DISTVERSIONSUFFIX=	-linux-${OPENSEARCH_ARCH}
5CATEGORIES=	textproc www
6MASTER_SITES=	https://artifacts.opensearch.org/releases/bundle/${PORTNAME}/${DISTVERSION}/
7PKGNAMESUFFIX=	219
8
9MAINTAINER=	ports@MidnightBSD.org
10COMMENT=	Visualization dashboards for OpenSearch
11WWW=		https://opensearch.org
12
13LICENSE=	Apache-2.0
14LICENSE_FILE=	${WRKSRC}/LICENSE.txt
15
16ONLY_FOR_ARCHS=	aarch64 amd64
17
18CONFLICTS=	opensearch-dashboards opensearch-dashboards210 opensearch-dashboards213 \
19		opensearch-dashboards216
20
21BUILD_DEPENDS=	npm-node20>0:www/npm-node20
22
23USES=		nodejs:20,build,run python:build
24USE_RC_SUBR=	${PORTNAME}
25
26SUB_FILES=	pkg-deinstall
27SUB_LIST=	PORTNAME="${PORTNAME}" \
28		PKGNAMESUFFIX="${PKGNAMESUFFIX}" \
29		WWWDIR=${WWWDIR}
30
31WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
32
33NODE_VER=	20.19.2
34NO_BUILD=	yes
35
36_DEVDIR=	${WRKDIR}/.devdir
37
38.include <bsd.port.pre.mk>
39
40.if ${ARCH} == "aarch64"
41OPENSEARCH_ARCH=	arm64
42.else
43OPENSEARCH_ARCH=	x64
44.endif
45
46post-patch:
47	@${REINPLACE_CMD} -e 's|<19|<=${NODE_VER}|g' ${WRKSRC}/package.json
48	${RM} \
49		${WRKSRC}/bin/*.orig \
50		${WRKSRC}/bin/*.bak \
51		${WRKSRC}/package.json.bak
52	-${RM} -r ${WRKSRC}/plugins/reportsDashboards/.chromium
53
54do-install:
55	${MKDIR} ${WWWDIR} ${ETCDIR}
56	${INSTALL_DATA} ${WRKSRC}/config/opensearch_dashboards.yml ${ETCDIR}/opensearch_dashboards.yml.sample
57	(cd ${WRKSRC} && \
58		${COPYTREE_SHARE} "data node_modules package.json plugins src" ${WWWDIR} && \
59		${COPYTREE_BIN} bin ${WWWDIR})
60	${FIND} ${FAKE_DESTDIR}${TRUE_PREFIX} -type f -iname '*.bak' -delete
61
62post-install:
63	${ECHO} "@sample ${ETCDIR_REL}/opensearch_dashboards.yml.sample" >> ${TMPPLIST}
64	${FIND} -s ${FAKE_DESTDIR}${WWWDIR} -not -type d | ${SORT} | \
65		${SED} -e 's#^${FAKE_DESTDIR}${PREFIX}/##' >> ${TMPPLIST}
66	${ECHO} "@dir(www,www) ${WWWDIR}/data" >> ${TMPPLIST}
67	${ECHO} "@dir ${WWWDIR}/plugins/reportsDashboards/node_modules/set-interval-async/test/resources/legacy" >> ${TMPPLIST}
68	${ECHO} "@dir ${WWWDIR}/plugins/reportsDashboards/node_modules/set-interval-async/test/resources/fixed" >> ${TMPPLIST}
69	${ECHO} "@dir ${WWWDIR}/plugins/reportsDashboards/node_modules/set-interval-async/test/resources/dynamic" >> ${TMPPLIST}
70	${ECHO} "@dir ${WWWDIR}/plugins/reportsDashboards/node_modules/set-interval-async/examples/fixed" >> ${TMPPLIST}
71	${ECHO} "@dir ${WWWDIR}/plugins/reportsDashboards/node_modules/set-interval-async/examples/dynamic" >> ${TMPPLIST}
72	${ECHO} "@dir ${WWWDIR}/plugins/observabilityDashboards/server/adaptors/integrations/__test__" >> ${TMPPLIST}
73	${ECHO} "@dir ${WWWDIR}/plugins/observabilityDashboards/server/adaptors/integrations/repository/__test__" >> ${TMPPLIST}
74	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Alerts/components/AlertFlyout" >> ${TMPPLIST}
75	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/CreateDetector/components/ConfigureAlerts/components/AlertCondition" >> ${TMPPLIST}
76	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/components/AlertTriggerView" >> ${TMPPLIST}
77	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/components/DetectorBasicDetailsView" >> ${TMPPLIST}
78	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/components/DetectorRulesView" >> ${TMPPLIST}
79	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/components/FieldMappingsView" >> ${TMPPLIST}
80	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/components/UpdateAlertConditions" >> ${TMPPLIST}
81	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/components/UpdateDetectorBasicDetails" >> ${TMPPLIST}
82	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/components/UpdateDetectorRules" >> ${TMPPLIST}
83	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/components/UpdateFieldMappings" >> ${TMPPLIST}
84	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/containers/AlertTriggersView" >> ${TMPPLIST}
85	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/containers/DetectorDetails" >> ${TMPPLIST}
86	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/containers/DetectorDetailsView" >> ${TMPPLIST}
87	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/containers/Detectors" >> ${TMPPLIST}
88	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/containers/EditFieldMappings" >> ${TMPPLIST}
89	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Rules/components/DeleteModal" >> ${TMPPLIST}
90	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Rules/components/RuleEditor/components" >> ${TMPPLIST}
91	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Rules/components/RulesTable" >> ${TMPPLIST}
92	${ECHO} "@dir ${WWWDIR}/plugins/securityDashboards/server/multitenancy/test" >> ${TMPPLIST}
93
94.include <bsd.port.post.mk>
95