diff --git a/Makefile b/Makefile index 5c8c3580d..a7ff2cb55 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,10 @@ gen-scan-api: gen-log-api: npm run "apigen:log" +.PHONY: gen-local-radix-log-api +gen-local-radix-log-api: + OVERRIDE_RADIX_LOG_API_SWAGGER_URL=http://localhost:8003/swagger/doc.json npm run "apigen:log" + .PHONY: gen-service-now-api gen-service-now-api: npm run "apigen:service-now" diff --git a/docker-compose.yml b/docker-compose.yml index eaad12527..a4417ac0c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -78,6 +78,8 @@ services: - radix ports: - "8000:8000" # In prod, this is served on port 443 + depends_on: + - auth-state # for use with development auth-state: diff --git a/package-lock.json b/package-lock.json index 7aca7a542..1783f3196 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,9 +19,8 @@ "date-fns": "^4.1.0", "http-status-codes": "^2.3.0", "jdenticon": "^3.3.0", - "lodash": "^4.17.21", + "lodash-es": "^4.17.21", "nanoid": "^5.0.7", - "prop-types": "^15.8.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-google-charts": "^4.0.7", @@ -42,7 +41,7 @@ "@remix-run/web-fetch": "^4.4.2", "@rtk-query/codegen-openapi": "^1.2.0", "@testing-library/react": "^16.0.1", - "@types/lodash": "^4.17.9", + "@types/lodash-es": "^4.17.9", "@types/react": "^18.3.10", "@types/react-dom": "^18.3.0", "@types/react-router-dom": "^5.3.3", @@ -3936,6 +3935,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/lodash-es": { + "version": "4.17.12", + "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.12.tgz", + "integrity": "sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/lodash": "*" + } + }, "node_modules/@types/mdast": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.3.tgz", @@ -7026,7 +7035,14 @@ "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lodash-es": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", + "license": "MIT" }, "node_modules/lodash.merge": { "version": "4.6.2", diff --git a/package.json b/package.json index 6347f7b1e..a70e7ce13 100644 --- a/package.json +++ b/package.json @@ -14,12 +14,11 @@ "test": "vitest watch", "test:no-watch": "vitest run", "test:coverage": "vitest --coverage", - "lint": "biome check", + "lint": "biome check && tsc --noEmit --skipLibCheck", "lint-fix": "biome check --write", "lint-ts": "tsc --noEmit --skipLibCheck", "lint:watch": "watch --color -n 1 biome lint --colors=force", "lint-ts:watch": "tsc --noEmit --skipLibCheck --watch", - "lint-strict": "tsc --noEmit --skipLibCheck --strictNullChecks", "deps": "npm run deps:license && npm run deps:stale", "deps:license": "node scripts/deps-license-check.js", "deps:stale": "node scripts/deps-stale-check.js", @@ -40,9 +39,8 @@ "date-fns": "^4.1.0", "http-status-codes": "^2.3.0", "jdenticon": "^3.3.0", - "lodash": "^4.17.21", + "lodash-es": "^4.17.21", "nanoid": "^5.0.7", - "prop-types": "^15.8.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-google-charts": "^4.0.7", @@ -63,7 +61,7 @@ "@remix-run/web-fetch": "^4.4.2", "@rtk-query/codegen-openapi": "^1.2.0", "@testing-library/react": "^16.0.1", - "@types/lodash": "^4.17.9", + "@types/lodash-es": "^4.17.9", "@types/react": "^18.3.10", "@types/react-dom": "^18.3.0", "@types/react-router-dom": "^5.3.3", diff --git a/radixconfig.yaml b/radixconfig.yaml index b9a4ca805..027b03fac 100644 --- a/radixconfig.yaml +++ b/radixconfig.yaml @@ -38,7 +38,7 @@ spec: CLUSTER_EGRESS_IPS: undefined # Comma separated list of IPs of all Public IP Prefixes assigned to the ClusterType (production, playground, development) CLUSTER_INGRESS_IPS: undefined # Comma separated list of IPs of all Public IP Prefixes assigned to the ClusterType (production, playground, development) OAUTH2_AUTHORITY: "https://login.microsoftonline.com/3aa4a235-b6e2-48d5-9195-7fcf05b459b0" - SERVICENOW_PROXY_SCOPES: "1b4a22f1-d4a1-4b6a-81b2-fd936daf1786/Application.Read" + SERVICENOW_PROXY_SCOPES: "1b4a22f1-d4a1-4b6a-81b2-fd936daf1786/Application.Read" # scopes must be seperated by comma CLUSTER_OIDC_ISSUER_URL: "" CMDB_CI_URL: "https://equinor.service-now.com/selfservice?id=form&table=cmdb_ci_business_app&sys_id={CIID}" secrets: diff --git a/src/components/alert/index.tsx b/src/components/alert/index.tsx index a58560dee..d52f829fe 100644 --- a/src/components/alert/index.tsx +++ b/src/components/alert/index.tsx @@ -1,5 +1,4 @@ import { clsx } from 'clsx'; -import * as PropTypes from 'prop-types'; import type { FunctionComponent, PropsWithChildren, ReactNode } from 'react'; import './style.css'; @@ -36,10 +35,3 @@ export const Alert: FunctionComponent> = ({ )} ); - -Alert.propTypes = { - children: PropTypes.node, - actions: PropTypes.node, - className: PropTypes.string, - type: PropTypes.oneOf(['info', 'success', 'warning', 'danger']), -}; diff --git a/src/components/alerting/alerting-actions.tsx b/src/components/alerting/alerting-actions.tsx index 9007d0db7..945132a8c 100644 --- a/src/components/alerting/alerting-actions.tsx +++ b/src/components/alerting/alerting-actions.tsx @@ -1,6 +1,4 @@ import { Button } from '@equinor/eds-core-react'; -import * as PropTypes from 'prop-types'; - import './style.css'; import type { AlertingConfig } from '../../store/radix-api'; @@ -66,15 +64,3 @@ export const AlertingActions = ({ ); }; - -AlertingActions.propTypes = { - isSaving: PropTypes.bool.isRequired, - isEdit: PropTypes.bool.isRequired, - config: PropTypes.object.isRequired as PropTypes.Validator, - - onSave: PropTypes.func.isRequired, - onCancel: PropTypes.func.isRequired, - onEdit: PropTypes.func.isRequired, - onEnable: PropTypes.func.isRequired, - onDisable: PropTypes.func.isRequired, -}; diff --git a/src/components/alerting/alerting-overview.tsx b/src/components/alerting/alerting-overview.tsx index edb5f953e..f2735ae0b 100644 --- a/src/components/alerting/alerting-overview.tsx +++ b/src/components/alerting/alerting-overview.tsx @@ -1,6 +1,5 @@ import { Icon, Typography } from '@equinor/eds-core-react'; import { check_circle_outlined, warning_outlined } from '@equinor/eds-icons'; -import * as PropTypes from 'prop-types'; import { Fragment, type FunctionComponent } from 'react'; import type { AlertingConfig } from '../../store/radix-api'; @@ -34,7 +33,3 @@ export const AlertingConfigStatus: FunctionComponent<{ ); }; - -AlertingConfigStatus.propTypes = { - config: PropTypes.object.isRequired as PropTypes.Validator, -}; diff --git a/src/components/alerting/buildEditConfig.ts b/src/components/alerting/buildEditConfig.ts index 059c2ce97..d9b5c40c8 100644 --- a/src/components/alerting/buildEditConfig.ts +++ b/src/components/alerting/buildEditConfig.ts @@ -1,12 +1,13 @@ -import { cloneDeep } from 'lodash'; +import { cloneDeep } from 'lodash-es'; import type { AlertingConfig, ReceiverConfigMap, UpdateAlertingConfig, + UpdateReceiverConfigSecretsMap, } from '../../store/radix-api'; const buildReceiverSecrets = (receviers: ReceiverConfigMap) => { - const secretsConfig = {}; + const secretsConfig: UpdateReceiverConfigSecretsMap = {}; if (!receviers) { return secretsConfig; } @@ -25,8 +26,10 @@ export const buildEditConfig = ( config: AlertingConfig ): UpdateAlertingConfig => { return { - alerts: cloneDeep(config.alerts), - receivers: cloneDeep(config.receivers), - receiverSecrets: buildReceiverSecrets(config.receivers), + alerts: config.alerts ? cloneDeep(config.alerts) : [], + receivers: config.receivers ? cloneDeep(config.receivers) : {}, + receiverSecrets: config.receivers + ? buildReceiverSecrets(config.receivers) + : {}, }; }; diff --git a/src/components/alerting/edit-alerting.tsx b/src/components/alerting/edit-alerting.tsx index 4955741ef..5c8dca66a 100644 --- a/src/components/alerting/edit-alerting.tsx +++ b/src/components/alerting/edit-alerting.tsx @@ -1,5 +1,4 @@ import { TextField } from '@equinor/eds-core-react'; -import * as PropTypes from 'prop-types'; import type { ChangeEvent, Dispatch, @@ -37,11 +36,3 @@ export const UpdateSlackReceivers: FunctionComponent<{ ))} ); - -UpdateSlackReceivers.propTypes = { - alertingConfig: PropTypes.object - .isRequired as PropTypes.Validator, - changedReceivers: PropTypes.object - .isRequired as PropTypes.Validator, - setChangedReceivers: PropTypes.func.isRequired, -}; diff --git a/src/components/alerting/index.tsx b/src/components/alerting/index.tsx index ba37b152f..b1a6712fd 100644 --- a/src/components/alerting/index.tsx +++ b/src/components/alerting/index.tsx @@ -1,6 +1,5 @@ import { Icon, Typography } from '@equinor/eds-core-react'; import { info_circle } from '@equinor/eds-icons'; -import * as PropTypes from 'prop-types'; import { useState } from 'react'; import { AlertingActions } from './alerting-actions'; @@ -36,7 +35,7 @@ export const Alerting = ({ {} ); const onSave = async () => { - const config: UpdateAlertingConfig = buildEditConfig(alertingConfig); + const config = buildEditConfig(alertingConfig); Object.entries(changedReceivers).forEach(([receiver, url]) => { config.receiverSecrets[receiver] = { slackConfig: { webhookUrl: url } }; }); @@ -88,11 +87,3 @@ export const Alerting = ({ ); }; - -Alerting.propTypes = { - isSaving: PropTypes.bool.isRequired, - alertingConfig: PropTypes.object.isRequired, - enableAlerting: PropTypes.func.isRequired, - updateAlerting: PropTypes.func.isRequired, - disableAlerting: PropTypes.func.isRequired, -}; diff --git a/src/components/app-config-ad-groups/index.tsx b/src/components/app-config-ad-groups/index.tsx index 6fd9253ce..5099a138c 100644 --- a/src/components/app-config-ad-groups/index.tsx +++ b/src/components/app-config-ad-groups/index.tsx @@ -1,9 +1,6 @@ import { AuthenticatedTemplate } from '@azure/msal-react'; import { Typography } from '@equinor/eds-core-react'; -import * as PropTypes from 'prop-types'; - import { ADGroups, type HandleAdGroupsChangeCB } from '../graph/adGroups'; - import './style.css'; interface Props { @@ -36,10 +33,3 @@ export const AppConfigAdGroups = ({ ); - -AppConfigAdGroups.propTypes = { - labeling: PropTypes.string.isRequired, - adGroups: PropTypes.arrayOf(PropTypes.string), - isDisabled: PropTypes.bool, - onChange: PropTypes.func.isRequired, -}; diff --git a/src/components/app-config-ci/ci-popover.tsx b/src/components/app-config-ci/ci-popover.tsx index a49fd7b90..bff4f71ec 100644 --- a/src/components/app-config-ci/ci-popover.tsx +++ b/src/components/app-config-ci/ci-popover.tsx @@ -1,14 +1,14 @@ import { Popover, Typography } from '@equinor/eds-core-react'; -import { type FunctionComponent, useEffect } from 'react'; +import { useEffect } from 'react'; import type { Application } from '../../store/service-now-api'; import { configVariables } from '../../utils/config'; import { ExternalLink } from '../link/external-link'; export interface ConfigurationItemPopoverProps { - open?: boolean; + open: boolean; onClose: () => unknown; - anchorEl: HTMLElement; + anchorEl?: HTMLElement; configurationItem: Application; } @@ -16,9 +16,12 @@ function urlStringForCI(id: string): string { return configVariables.CMDB_CI_URL.replace(/{CIID}/g, encodeURIComponent(id)); } -export const ConfigurationItemPopover: FunctionComponent< - ConfigurationItemPopoverProps -> = ({ open, onClose, anchorEl, configurationItem }) => { +export const ConfigurationItemPopover = ({ + open, + onClose, + anchorEl, + configurationItem, +}: ConfigurationItemPopoverProps) => { const externalUrl = urlStringForCI(configurationItem.id); useEffect(() => { diff --git a/src/components/app-config-ci/ci-select.tsx b/src/components/app-config-ci/ci-select.tsx deleted file mode 100644 index 044ea9350..000000000 --- a/src/components/app-config-ci/ci-select.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { Icon } from '@equinor/eds-core-react'; -import { info_circle } from '@equinor/eds-icons'; -import type React from 'react'; -import type { MouseEvent, MutableRefObject } from 'react'; -import { - type GroupBase, - type IndicatorsContainerProps, - type PropsValue, - components, -} from 'react-select'; -import AsyncSelect, { type AsyncProps } from 'react-select/async'; - -type InfoIconProps