Skip to content

Commit

Permalink
refactor(testing): DISCOVERY-523 Revert formatting changes
Browse files Browse the repository at this point in the history
Revert automatically applied formatting changes in unrelated parts of
edited files
  • Loading branch information
mirekdlugosz committed Sep 25, 2024
1 parent a445e80 commit 5baf67b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 48 deletions.
21 changes: 5 additions & 16 deletions src/views/credentials/viewCredentialsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,13 @@ const CredentialsListView: React.FunctionComponent = () => {
key: API_QUERY_TYPES.SEARCH_NAME,
title: t('toolbar.label', { context: 'option_name' }),
type: FilterType.search,
placeholderText: t('toolbar.label', {
context: 'placeholder_filter_search_by_name'
})
placeholderText: t('toolbar.label', { context: 'placeholder_filter_search_by_name' })
},
{
key: API_QUERY_TYPES.CREDENTIAL_TYPE,
title: t('toolbar.label', { context: 'option_cred_type' }),
type: FilterType.select,
placeholderText: t('toolbar.label', {
context: 'placeholder_filter_cred_type'
}),
placeholderText: t('toolbar.label', { context: 'placeholder_filter_cred_type' }),
selectOptions: [
{
key: API_DATA_SOURCE_TYPES.ANSIBLE,
Expand Down Expand Up @@ -162,10 +158,7 @@ const CredentialsListView: React.FunctionComponent = () => {
selection: { isEnabled: true }
});

const { isLoading, data } = useCredentialsQuery({
tableState,
setRefreshTime
});
const { isLoading, data } = useCredentialsQuery({ tableState, setRefreshTime });

const tableBatteries = useTablePropHelpers({
...tableState,
Expand Down Expand Up @@ -248,9 +241,7 @@ const CredentialsListView: React.FunctionComponent = () => {
<EmptyState>
<EmptyStateHeader
headingLevel="h4"
titleText={t('view.empty-state', {
context: 'credentials_title'
})}
titleText={t('view.empty-state', { context: 'credentials_title' })}
icon={<EmptyStateIcon icon={PlusCircleIcon} />}
/>
<EmptyStateBody>{t('view.empty-state', { context: 'credentials_description' })}</EmptyStateBody>
Expand Down Expand Up @@ -320,9 +311,7 @@ const CredentialsListView: React.FunctionComponent = () => {
</Modal>
<Modal
variant={ModalVariant.small}
title={t('form-dialog.confirmation', {
context: 'title_delete-credential'
})}
title={t('form-dialog.confirmation', { context: 'title_delete-credential' })}
isOpen={pendingDeleteCredential !== undefined}
onClose={() => setPendingDeleteCredential(undefined)}
actions={[
Expand Down
5 changes: 1 addition & 4 deletions src/views/sources/addSourceModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ const AddSourceModal: React.FC<AddSourceModalProps> = ({
}
})
.then(response => {
const updatedOptions = response?.data?.results?.map(({ name, id }) => ({
label: name,
value: `${id}`
}));
const updatedOptions = response?.data?.results?.map(({ name, id }) => ({ label: name, value: `${id}` }));
setCredOptions(updatedOptions || []);
})
.catch(err => {
Expand Down
35 changes: 8 additions & 27 deletions src/views/sources/viewSourcesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ const SourcesListView: React.FunctionComponent = () => {
const [sourceBeingEdited, setSourceBeingEdited] = React.useState<SourceType>();
const [addSourceModal, setAddSourceModal] = React.useState<string>();
const [connectionsSelected, setConnectionsSelected] = React.useState<SourceType>();
const emptyConnectionData: Connections = {
successful: [],
failed: [],
unreachable: []
};
const emptyConnectionData: Connections = { successful: [], failed: [], unreachable: [] };
const [connectionsData, setConnectionsData] = React.useState<Connections>(emptyConnectionData);
const { queryClient } = useQueryClientConfig();
const { alerts, addAlert, removeAlert } = useAlerts();
Expand Down Expand Up @@ -156,27 +152,19 @@ const SourcesListView: React.FunctionComponent = () => {
key: API_QUERY_TYPES.SEARCH_NAME,
title: t('toolbar.label', { context: 'option_name' }),
type: FilterType.search,
placeholderText: t('toolbar.label', {
context: 'placeholder_filter_search_by_name'
})
placeholderText: t('toolbar.label', { context: 'placeholder_filter_search_by_name' })
},
{
key: API_QUERY_TYPES.SEARCH_CREDENTIALS_NAME,
title: t('toolbar.label', {
context: 'option_search_credentials_by_name'
}),
title: t('toolbar.label', { context: 'option_search_credentials_by_name' }),
type: FilterType.search,
placeholderText: t('toolbar.label', {
context: 'placeholder_filter_cred_type'
})
placeholderText: t('toolbar.label', { context: 'placeholder_filter_cred_type' })
},
{
key: API_QUERY_TYPES.SOURCE_TYPE,
title: t('toolbar.label', { context: 'option_source_type' }),
type: FilterType.select,
placeholderText: t('toolbar.label', {
context: 'placeholder_filter_source_type'
}),
placeholderText: t('toolbar.label', { context: 'placeholder_filter_source_type' }),
selectOptions: [
{
key: API_DATA_SOURCE_TYPES.ANSIBLE,
Expand Down Expand Up @@ -309,9 +297,7 @@ const SourcesListView: React.FunctionComponent = () => {
source.connection.status === 'running';
const scanTime = (isPending && source.connection.start_time) || source.connection.end_time;

const statusString = t(`table.label_status_${source.connection.status}`, {
context: 'sources'
});
const statusString = t(`table.label_status_${source.connection.status}`, { context: 'sources' });
return (
<Button
variant={ButtonVariant.link}
Expand Down Expand Up @@ -387,10 +373,7 @@ const SourcesListView: React.FunctionComponent = () => {
<ActionMenu<SourceType>
item={source}
actions={[
{
label: t('table.label', { context: 'edit' }),
onClick: onEditSource
},
{ label: t('table.label', { context: 'edit' }), onClick: onEditSource },
{
label: t('table.label', { context: 'delete' }),
onClick: setPendingDeleteSource
Expand Down Expand Up @@ -436,9 +419,7 @@ const SourcesListView: React.FunctionComponent = () => {
/>
<Modal
variant={ModalVariant.small}
title={t('form-dialog.confirmation', {
context: 'title_delete-source'
})}
title={t('form-dialog.confirmation', { context: 'title_delete-source' })}
isOpen={pendingDeleteSource !== undefined}
onClose={() => setPendingDeleteSource(undefined)}
actions={[
Expand Down
2 changes: 1 addition & 1 deletion tests/__snapshots__/code.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ exports[`General code checks should only have specific console.[warn|log|info|er
"hooks/useSourceApi.ts:191: console.error(error);",
"hooks/useSourceApi.ts:255: console.error(error);",
"views/scans/showScansModal.tsx:77: console.log({ aValue, bValue });",
"views/sources/addSourceModal.tsx:73: console.error(err);",
"views/sources/addSourceModal.tsx:70: console.error(err);",
]
`;

0 comments on commit 5baf67b

Please sign in to comment.