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