Skip to content

Commit

Permalink
fixed refresh button visibility; updated snapshots
Browse files Browse the repository at this point in the history
Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>
  • Loading branch information
amsiglan committed Jun 28, 2024
1 parent 0112416 commit 5dd580c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 260 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ exports[`<Alerts /> spec renders the component 1`] = `
findingService={
FindingsService {
"getFindings": [Function],
"getThreatIntelFindings": [Function],
"httpClient": [MockFunction],
}
}
Expand Down Expand Up @@ -124,6 +125,7 @@ exports[`<Alerts /> spec renders the component 1`] = `
findingService={
FindingsService {
"getFindings": [Function],
"getThreatIntelFindings": [Function],
"httpClient": [MockFunction],
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,27 +190,9 @@ exports[`<UpdateAlertConditions /> spec renders the component 1`] = `
},
}
}
detectorService={
DetectorService {
"createDetector": [Function],
"dataSourceEnabled": undefined,
"deleteDetector": [Function],
"getDetector": [Function],
"getDetectors": [Function],
"osDriver": Object {
"delete": [MockFunction],
"get": [MockFunction],
"head": [MockFunction],
"post": [MockFunction],
"put": [MockFunction],
},
"searchDetectors": [Function],
"updateDetector": [Function],
}
}
location={
Object {
"pathname": "",
"pathname": "/edit-alert-triggers/detector_id_1",
"state": Object {
"detectorHit": Object {
"_id": "detector_id_1",
Expand Down Expand Up @@ -419,20 +401,6 @@ exports[`<UpdateAlertConditions /> spec renders the component 1`] = `
"httpClient": [MockFunction],
}
}
opensearchService={
OpenSearchService {
"getIndexPatterns": [Function],
"getPlugins": [Function],
"httpClient": [MockFunction],
"savedObjectsClient": Object {
"delete": [MockFunction],
"get": [MockFunction],
"head": [MockFunction],
"post": [MockFunction],
"put": [MockFunction],
},
}
}
ruleService={
RuleService {
"createRule": [Function],
Expand All @@ -452,7 +420,7 @@ exports[`<UpdateAlertConditions /> spec renders the component 1`] = `
"detector_type": "detector_type",
"enabled": true,
"enabled_time": 1,
"id": "",
"id": "detector_id_1",
"inputs": Array [
Object {
"detector_input": Object {
Expand Down Expand Up @@ -818,29 +786,11 @@ exports[`<UpdateAlertConditions /> spec renders the component 1`] = `
},
}
}
detectorService={
DetectorService {
"createDetector": [Function],
"dataSourceEnabled": undefined,
"deleteDetector": [Function],
"getDetector": [Function],
"getDetectors": [Function],
"osDriver": Object {
"delete": [MockFunction],
"get": [MockFunction],
"head": [MockFunction],
"post": [MockFunction],
"put": [MockFunction],
},
"searchDetectors": [Function],
"updateDetector": [Function],
}
}
getTriggerName={[Function]}
isEdit={true}
location={
Object {
"pathname": "",
"pathname": "/edit-alert-triggers/detector_id_1",
"state": Object {
"detectorHit": Object {
"_id": "detector_id_1",
Expand Down Expand Up @@ -1049,20 +999,6 @@ exports[`<UpdateAlertConditions /> spec renders the component 1`] = `
"httpClient": [MockFunction],
}
}
opensearchService={
OpenSearchService {
"getIndexPatterns": [Function],
"getPlugins": [Function],
"httpClient": [MockFunction],
"savedObjectsClient": Object {
"delete": [MockFunction],
"get": [MockFunction],
"head": [MockFunction],
"post": [MockFunction],
"put": [MockFunction],
},
}
}
ruleService={
RuleService {
"createRule": [Function],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1356,196 +1356,20 @@ exports[`<UpdateDetectorBasicDetails /> spec renders the component 1`] = `
/>
</EuiSpacer>
<Interval
detector={
Object {
"createdBy": "someone",
"detector_type": "detector_type",
"enabled": true,
"enabled_time": 1,
"id": "detector_id_1",
"inputs": Array [
Object {
"detector_input": Object {
"custom_rules": Array [
Object {
"_id": "rule_id_1",
"_index": ".windows",
"_primary_term": 1,
"_source": Object {
"last_update_time": "12/12/2022",
"queries": Array [
Object {
"value": ".windows",
},
],
"rule": "rule_name",
},
"_version": 1,
"id": "rule_id_1",
"prePackaged": true,
},
],
"description": "detectorDescription",
"indices": Array [
".windows",
],
"pre_packaged_rules": Array [
Object {
"_id": "rule_id_1",
"_index": ".windows",
"_primary_term": 1,
"_source": Object {
"last_update_time": "12/12/2022",
"queries": Array [
Object {
"value": ".windows",
},
],
"rule": "rule_name",
},
"_version": 1,
"id": "rule_id_1",
"prePackaged": true,
},
],
},
},
],
"last_update_time": 1,
"name": "detector_name",
"schedule": Object {
"period": Object {
"interval": 1,
"unit": "MINUTES",
},
},
"triggers": Array [
Object {
"actions": Array [
Object {
"destination_id": "some_destination_id_1",
"id": "trigger_id_1_0",
"message_template": Object {
"lang": "some_lang",
"source": "some_source",
},
"name": "some_name",
"subject_template": Object {
"lang": "some_lang",
"source": "some_source",
},
"throttle": Object {
"unit": "minutes",
"value": 1,
},
"throttle_enabled": true,
},
Object {
"destination_id": "some_destination_id_1",
"id": "trigger_id_1_1",
"message_template": Object {
"lang": "some_lang",
"source": "some_source",
},
"name": "some_name",
"subject_template": Object {
"lang": "some_lang",
"source": "some_source",
},
"throttle": Object {
"unit": "minutes",
"value": 1,
},
"throttle_enabled": true,
},
],
"detection_types": Array [
"rules",
],
"id": "trigger_id_0",
"ids": Array [
"rule_id_1",
],
"name": "alert_name",
"sev_levels": Array [
"severity_level_low",
],
"severity": "1",
"tags": Array [
"any.tag",
],
"types": Array [
"detector_type_1",
],
},
Object {
"actions": Array [
Object {
"destination_id": "some_destination_id_1",
"id": "trigger_id_1_0",
"message_template": Object {
"lang": "some_lang",
"source": "some_source",
},
"name": "some_name",
"subject_template": Object {
"lang": "some_lang",
"source": "some_source",
},
"throttle": Object {
"unit": "minutes",
"value": 1,
},
"throttle_enabled": true,
},
Object {
"destination_id": "some_destination_id_1",
"id": "trigger_id_1_1",
"message_template": Object {
"lang": "some_lang",
"source": "some_source",
},
"name": "some_name",
"subject_template": Object {
"lang": "some_lang",
"source": "some_source",
},
"throttle": Object {
"unit": "minutes",
"value": 1,
},
"throttle_enabled": true,
},
],
"detection_types": Array [
"rules",
],
"id": "trigger_id_1",
"ids": Array [
"rule_id_1",
],
"name": "alert_name",
"sev_levels": Array [
"severity_level_low",
],
"severity": "1",
"tags": Array [
"any.tag",
],
"types": Array [
"detector_type_1",
],
},
],
"type": "detector",
}
}
label={
<FormFieldHeader
headerTitle="Runs every"
/>
}
onDetectorScheduleChange={[Function]}
onScheduleChange={[Function]}
schedule={
Object {
"period": Object {
"interval": 1,
"unit": "MINUTES",
},
}
}
>
<EuiFormRow
describedByIds={Array []}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const ThreatIntelSource: React.FC<ThreatIntelSource> = ({
}
};

const { name, enabled, description, type, ioc_types, last_update_time } = source;
const { name, description, type, ioc_types, last_update_time, enabled } = source;
const schedule = type === 'S3_CUSTOM' ? source.schedule : undefined;

return (
Expand All @@ -149,7 +149,7 @@ export const ThreatIntelSource: React.FC<ThreatIntelSource> = ({
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiFlexGroup alignItems="center">
{enabled && (
{type === 'S3_CUSTOM' && (
<EuiFlexItem grow={false}>
<EuiButton fill onClick={onRefresh}>
Refresh
Expand Down Expand Up @@ -181,12 +181,14 @@ export const ThreatIntelSource: React.FC<ThreatIntelSource> = ({
{
title: 'Refresh schedule',
description: schedule
? parseSchedule({
period: {
interval: schedule.interval.period,
unit: schedule.interval.unit.toUpperCase(),
},
})
? enabled
? parseSchedule({
period: {
interval: schedule.interval.period,
unit: schedule.interval.unit.toUpperCase(),
},
})
: 'Download on demand'
: 'File uploaded',
},
{
Expand Down

0 comments on commit 5dd580c

Please sign in to comment.