Skip to content

Commit d919e37

Browse files
github-actions[bot]Dr. Lint-a-lot
andauthored
Running lint --fix & prettier (#25486)
Co-authored-by: Dr. Lint-a-lot <garybot2@graylog.com>
1 parent 7b29d74 commit d919e37

34 files changed

Lines changed: 178 additions & 145 deletions

graylog2-web-interface/src/components/collectors/common/StatCard.test.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@ describe('StatCard', () => {
2828
});
2929

3030
it('applies variant styling for warning', async () => {
31-
render(<StatCard value={5} label="Offline" variant="warning" onClick={() => { /* force this to be a button */ }} />);
31+
render(
32+
<StatCard
33+
value={5}
34+
label="Offline"
35+
variant="warning"
36+
onClick={() => {
37+
/* force this to be a button */
38+
}}
39+
/>,
40+
);
3241

3342
const card = screen.getByRole('button');
3443
expect(card).toBeInTheDocument();

graylog2-web-interface/src/components/collectors/common/StatCard.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ const Label = styled.div(
7474
);
7575

7676
const StatCard = ({ value, label, variant = 'default', onClick = undefined }: Props) => (
77-
<StyledCard as={onClick ? 'button' : 'div'}
78-
$variant={variant}
79-
$clickable={!!onClick}
80-
onClick={onClick}
81-
type={onClick ? 'button' : undefined}
82-
>
77+
<StyledCard
78+
as={onClick ? 'button' : 'div'}
79+
$variant={variant}
80+
$clickable={!!onClick}
81+
onClick={onClick}
82+
type={onClick ? 'button' : undefined}>
8383
<Value>{value}</Value>
8484
<Label>{label}</Label>
8585
</StyledCard>

graylog2-web-interface/src/components/collectors/deployment/BulkActions.test.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ jest.mock('components/common/EntityDataTable/hooks/useSelectedEntities');
3030
jest.mock('../hooks/useCollectorsMutations');
3131

3232
const setSelectedEntitiesMock = jest.fn();
33-
const bulkDeleteEnrollmentTokensMock = jest.fn(() => Promise.resolve({ successfully_performed: 0, failures: [], errors: [] }));
33+
const bulkDeleteEnrollmentTokensMock = jest.fn(() =>
34+
Promise.resolve({ successfully_performed: 0, failures: [], errors: [] }),
35+
);
3436

3537
const useSelectedEntitiesResponse = {
3638
selectedEntities: [],
@@ -50,9 +52,11 @@ describe('BulkActions', () => {
5052
beforeEach(() => {
5153
jest.clearAllMocks();
5254
asMock(useSelectedEntities).mockReturnValue(useSelectedEntitiesResponse);
53-
asMock(useCollectorsMutations).mockReturnValue(mockCollectorsMutations({
54-
bulkDeleteEnrollmentTokens: bulkDeleteEnrollmentTokensMock,
55-
}));
55+
asMock(useCollectorsMutations).mockReturnValue(
56+
mockCollectorsMutations({
57+
bulkDeleteEnrollmentTokens: bulkDeleteEnrollmentTokensMock,
58+
}),
59+
);
5660
});
5761

5862
it('renders bulk actions dropdown', async () => {

graylog2-web-interface/src/components/collectors/deployment/BulkActions.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ const BulkActions = () => {
4646
show
4747
onConfirm={handleConfirm}
4848
onCancel={() => setShowConfirm(false)}>
49-
Are you sure you want to delete {selectedEntities.length} enrollment tokens?
50-
New collectors will not be able to enroll using the deleted tokens.
49+
Are you sure you want to delete {selectedEntities.length} enrollment tokens? New collectors will not be able
50+
to enroll using the deleted tokens.
5151
</ConfirmDialog>
5252
)}
5353
</>

graylog2-web-interface/src/components/collectors/deployment/EnrollmentTokenList.test.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ describe('EnrollmentTokenList', () => {
9393
isLoading: false,
9494
});
9595

96-
asMock(useCollectorsMutations).mockReturnValue(mockCollectorsMutations({
97-
deleteEnrollmentToken: deleteEnrollmentTokenMock,
98-
}));
96+
asMock(useCollectorsMutations).mockReturnValue(
97+
mockCollectorsMutations({
98+
deleteEnrollmentToken: deleteEnrollmentTokenMock,
99+
}),
100+
);
99101

100102
asMock(fetchPaginatedEnrollmentTokens).mockResolvedValue(mockPaginatedResponse([mockToken()]));
101103
});

graylog2-web-interface/src/components/collectors/deployment/EnrollmentTokenList.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,24 @@ import Routes from 'routing/Routes';
2626
import type { ColumnRenderers } from 'components/common/EntityDataTable';
2727
import type { Sort } from 'stores/PaginationTypes';
2828

29+
import BulkActions from './BulkActions';
30+
2931
import { fetchPaginatedEnrollmentTokens, enrollmentTokensKeyFn, useCollectorsMutations, useFleets } from '../hooks';
3032
import type { EnrollmentTokenMetadata } from '../types';
31-
import BulkActions from './BulkActions';
3233

3334
const DEFAULT_LAYOUT = {
3435
entityTableId: 'enrollment-tokens',
3536
defaultPageSize: 20,
3637
defaultSort: { attributeId: 'created_at', direction: 'desc' } as Sort,
37-
defaultDisplayedAttributes: ['name', 'fleet_id', 'created_by', 'created_at', 'expires_at', 'usage_count', 'last_used_at'],
38+
defaultDisplayedAttributes: [
39+
'name',
40+
'fleet_id',
41+
'created_by',
42+
'created_at',
43+
'expires_at',
44+
'usage_count',
45+
'last_used_at',
46+
],
3847
defaultColumnOrder: ['name', 'fleet_id', 'created_by', 'created_at', 'expires_at', 'usage_count', 'last_used_at'],
3948
};
4049

graylog2-web-interface/src/components/collectors/fleets/CollectorsFleets.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ const CollectorsFleets = () => {
6464
entityActions={() => null}
6565
/>
6666

67-
{showFleetModal && (
68-
<FleetFormModal onClose={closeCreateModal} onSave={handleSaveFleet} />
69-
)}
67+
{showFleetModal && <FleetFormModal onClose={closeCreateModal} onSave={handleSaveFleet} />}
7068
</>
7169
);
7270
};

graylog2-web-interface/src/components/collectors/fleets/FleetDetail.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,7 @@ const FleetDetail = ({ fleetId }: Props) => {
9999
const { data: stats, isLoading: statsLoading } = useFleetStats(fleetId);
100100
const defaultInstanceFilters = useDefaultInstanceFilters();
101101
const { data: sources } = useSources(fleetId);
102-
const {
103-
createSource,
104-
updateSource,
105-
deleteSource,
106-
updateFleet,
107-
deleteFleet,
108-
} = useCollectorsMutations();
102+
const { createSource, updateSource, deleteSource, updateFleet, deleteFleet } = useCollectorsMutations();
109103
const [showSourceModal, setShowSourceModal] = useState(false);
110104
const [editingSource, setEditingSource] = useState<Source | null>(null);
111105
const [deletingSource, setDeletingSource] = useState<Source | null>(null);
@@ -215,7 +209,9 @@ const FleetDetail = ({ fleetId }: Props) => {
215209
return (
216210
<div>
217211
<Header>
218-
<h2>{fleet.name} <BetaBadge /></h2>
212+
<h2>
213+
{fleet.name} <BetaBadge />
214+
</h2>
219215
{fleet.target_version && <Label bsStyle="info">v{fleet.target_version}</Label>}
220216
</Header>
221217

@@ -288,11 +284,7 @@ const FleetDetail = ({ fleetId }: Props) => {
288284
)}
289285

290286
{showSourceModal && (
291-
<SourceFormModal
292-
fleetId={fleetId}
293-
onClose={() => setShowSourceModal(false)}
294-
onSave={handleSaveSource}
295-
/>
287+
<SourceFormModal fleetId={fleetId} onClose={() => setShowSourceModal(false)} onSave={handleSaveSource} />
296288
)}
297289

298290
{editingSource && (

graylog2-web-interface/src/components/collectors/fleets/FleetFormModal.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,7 @@ const FleetFormModal = ({ fleet = undefined, onClose, onSave }: Props) => {
7474
<Modal.Title>{isEdit ? 'Edit Fleet' : 'New Fleet'}</Modal.Title>
7575
</Modal.Header>
7676
<Modal.Body>
77-
<FormikInput
78-
id="fleet-name"
79-
label="Name"
80-
name="name"
81-
help="A unique name for this fleet"
82-
required
83-
/>
77+
<FormikInput id="fleet-name" label="Name" name="name" help="A unique name for this fleet" required />
8478
<FormikInput
8579
id="fleet-description"
8680
label="Description"

graylog2-web-interface/src/components/collectors/fleets/FleetSettings.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,8 @@ const FleetSettings = ({ fleet, onSave, onDelete = undefined }: Props) => {
113113
<Section>
114114
<SectionTitle>General Settings</SectionTitle>
115115
<Form>
116-
<FormikInput
117-
id="fleet-name"
118-
label="Fleet Name"
119-
name="name"
120-
required
121-
/>
122-
<FormikInput
123-
id="fleet-description"
124-
type="textarea"
125-
label="Description"
126-
name="description"
127-
/>
116+
<FormikInput id="fleet-name" label="Fleet Name" name="name" required />
117+
<FormikInput id="fleet-description" type="textarea" label="Description" name="description" />
128118
<FormikInput
129119
id="fleet-target-version"
130120
label="Target Version"

0 commit comments

Comments
 (0)