Skip to content

Commit

Permalink
Merge branch 'master' into refactor-external-dns
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsgstrabo committed Jan 10, 2024
2 parents 582d885 + 3993230 commit 304d420
Show file tree
Hide file tree
Showing 88 changed files with 1,334 additions and 3,914 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ gen-log-api:
.PHONY: lint
lint:
npm run "lint"
npm run "lint-ts"


.PHONY: lint-strict
lint-strict:
npm run "lint-strict"

.PHONY: run
run:
Expand Down
6 changes: 0 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
"test:no-watch": "EXTEND_ESLINT=true vitest run",
"test:coverage": "EXTEND_ESLINT=true vitest --coverage",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint-ts": "tsc --noEmit --skipLibCheck",
"lint:watch": "eslint -w src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"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",
Expand All @@ -32,7 +35,6 @@
"clsx": "^2.0.0",
"date-fns": "^3.0.5",
"http-status-codes": "^2.3.0",
"immutability-helper": "^3.1.1",
"jdenticon": "^3.2.0",
"lodash": "^4.17.21",
"nanoid": "^5.0.4",
Expand Down
55 changes: 0 additions & 55 deletions src/api/application-alerting.ts

This file was deleted.

70 changes: 0 additions & 70 deletions src/api/environment-alerting.ts

This file was deleted.

163 changes: 66 additions & 97 deletions src/components/alerting/alerting-actions.tsx
Original file line number Diff line number Diff line change
@@ -1,111 +1,80 @@
import { Button } from '@equinor/eds-core-react';
import * as PropTypes from 'prop-types';
import { FunctionComponent } from 'react';

import {
AlertingConfigModel,
AlertingConfigModelValidationMap,
} from '../../models/radix-api/alerting/alerting-config';
import {
UpdateAlertingConfigModel,
UpdateAlertingConfigModelValidationMap,
} from '../../models/radix-api/alerting/update-alerting-config';

import './style.css';
import { AlertingConfig } from '../../store/radix-api';

export const AlertingActions: FunctionComponent<{
config: AlertingConfigModel;
editConfig?: UpdateAlertingConfigModel;
enableAlertingCallback: () => void;
disableAlertingCallback: () => void;
editAlertingEnableCallback: () => void;
editAlertingDisableCallback: () => void;
saveAlertingCallback: () => void;
type Props = {
config: AlertingConfig;
isSaving: boolean;
isAlertingEditEnabled: boolean;
isAlertingEditDirty: boolean;
}> = ({
config,
isEdit: boolean;
onEdit: () => void;
onSave: () => void;
onCancel: () => void;
onEnable: () => void;
onDisable: () => void;
};

export const AlertingActions = ({
isEdit,
isSaving,
enableAlertingCallback,
disableAlertingCallback,
editAlertingEnableCallback,
editAlertingDisableCallback,
saveAlertingCallback,
isAlertingEditEnabled,
isAlertingEditDirty,
}) => (
<div className="alerting-actions">
<div className="grid grid--gap-small grid--auto-columns">
{config.enabled ? (
<>
{isAlertingEditEnabled ? (
<>
<Button
disabled={!isAlertingEditDirty || isSaving}
onClick={saveAlertingCallback}
>
Save
</Button>
<Button
disabled={isSaving}
variant="outlined"
onClick={editAlertingDisableCallback}
>
Cancel
config,
onEdit,
onCancel,
onEnable,
onDisable,
onSave,
}: Props) => {
return (
<div className="alerting-actions">
<div className="grid grid--gap-small grid--auto-columns">
{config.enabled ? (
<>
{isEdit ? (
<>
<Button disabled={isSaving} onClick={onSave}>
Save
</Button>
<Button
disabled={isSaving}
variant="outlined"
onClick={onCancel}
>
Cancel
</Button>
</>
) : (
<Button disabled={!config.ready} onClick={onEdit}>
Edit
</Button>
</>
) : (
<Button
disabled={!config.ready}
onClick={editAlertingEnableCallback}
>
Edit
</Button>
)}
</>
) : (
<Button
disabled={isSaving}
onClick={(ev) => {
ev.preventDefault();
enableAlertingCallback();
}}
>
Enable Alerts
</Button>
)}
</div>
)}
</>
) : (
<Button disabled={isSaving} onClick={onEnable}>
Enable Alerts
</Button>
)}
</div>

<div className="grid grid--gap-small grid--auto-columns">
{config.enabled && (
<Button
disabled={isSaving}
color="danger"
onClick={(ev) => {
ev.preventDefault();
disableAlertingCallback();
}}
>
Disable Alerts
</Button>
)}
<div className="grid grid--gap-small grid--auto-columns">
{config.enabled && (
<Button disabled={isSaving} color="danger" onClick={onDisable}>
Disable Alerts
</Button>
)}
</div>
</div>
</div>
);
);
};

AlertingActions.propTypes = {
config: PropTypes.shape(AlertingConfigModelValidationMap)
.isRequired as PropTypes.Validator<AlertingConfigModel>,
editConfig: PropTypes.shape(
UpdateAlertingConfigModelValidationMap
) as PropTypes.Validator<UpdateAlertingConfigModel>,
enableAlertingCallback: PropTypes.func.isRequired,
disableAlertingCallback: PropTypes.func.isRequired,
editAlertingEnableCallback: PropTypes.func.isRequired,
editAlertingDisableCallback: PropTypes.func.isRequired,
saveAlertingCallback: PropTypes.func.isRequired,
isSaving: PropTypes.bool.isRequired,
isAlertingEditEnabled: PropTypes.bool.isRequired,
isAlertingEditDirty: PropTypes.bool.isRequired,
isEdit: PropTypes.bool.isRequired,
config: PropTypes.object.isRequired as PropTypes.Validator<AlertingConfig>,

onSave: PropTypes.func.isRequired,
onCancel: PropTypes.func.isRequired,
onEdit: PropTypes.func.isRequired,
onEnable: PropTypes.func.isRequired,
onDisable: PropTypes.func.isRequired,
};
Loading

0 comments on commit 304d420

Please sign in to comment.