Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.x] Use smaller and compressed varients of buttons and form components #405

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"html2canvas": "1.4.1",
"jest-fetch-mock": "^3.0.3",
"jquery": "^3.5.0",
"jsdom": "18.0.0",
"jsdom": "^21.1.2",
"json-2-csv": "^3.20.0",
"jspdf": "^2.5.1",
"react-addons-test-utils": "^15.6.2",
Expand Down
2 changes: 1 addition & 1 deletion public/components/context_menu/context_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
};

fetch(
`${getApiPath()}/reporting/generateReport?${new URLSearchParams(

Check failure on line 90 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

'getApiPath' was used before it was defined
uiSettingsService.getSearchParams()
)}`,
{
Expand Down Expand Up @@ -175,7 +175,7 @@
$(document).on('click', '#generateCSV', function () {
const timeRanges = getTimeFieldsFromUrl();
const queryUrl = replaceQueryURL(location.href);
const saved_search_id = getUuidFromUrl()[1];

Check failure on line 178 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

Identifier 'saved_search_id' is not in camel case
generateInContextReport(timeRanges, queryUrl, 'csv', { saved_search_id });
});

Expand All @@ -183,7 +183,7 @@
$(document).on('click', '#generateXLSX', function () {
const timeRanges = getTimeFieldsFromUrl();
const queryUrl = replaceQueryURL(location.href);
const saved_search_id = getUuidFromUrl()[1];

Check failure on line 186 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

Identifier 'saved_search_id' is not in camel case
generateInContextReport(timeRanges, queryUrl, 'xlsx', { saved_search_id });
});

Expand Down Expand Up @@ -211,7 +211,7 @@
$('#reportGenerationProgressModal').remove();
});

// close modal with the close EuiButton
// close modal with the close EuiSmallButton
$(document).on('click', '#closeReportGenerationModalButton', function () {
$('#reportGenerationProgressModal').remove();
});
Expand All @@ -232,7 +232,7 @@
});
});

checkURLParams();

Check failure on line 235 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

'checkURLParams' was used before it was defined
locationHashChanged();
});

Expand Down Expand Up @@ -285,7 +285,7 @@
};

function locationHashChanged() {
const observer = new MutationObserver(function (mutations) {

Check failure on line 288 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

'mutations' is defined but never used. Allowed unused args must match /^_/u

Check failure on line 288 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

'mutations' is defined but never used
const navMenu = document.querySelectorAll(
'nav.euiHeaderLinks > div.euiHeaderLinks__list'
);
Expand All @@ -301,7 +301,7 @@
return;
}
const menuItem = document.createElement('div');
menuItem.innerHTML = getMenuItem(

Check failure on line 304 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

Unsafe assignment to innerHTML
i18n.translate('opensearch.reports.menu.name', {
defaultMessage: 'Reporting',
})
Expand All @@ -323,7 +323,7 @@
});
}

$(window).one('hashchange', function (e) {

Check failure on line 326 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

'e' is defined but never used. Allowed unused args must match /^_/u

Check failure on line 326 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

'e' is defined but never used
locationHashChanged();
});
/**
Expand All @@ -345,7 +345,7 @@
};

const getApiPath = () => {
if (window.location.href.includes('/data-explorer/discover/')) return '../../../api'

Check failure on line 348 in public/components/context_menu/context_menu.js

View workflow job for this annotation

GitHub Actions / Lint

Replace `·return·'../../../api'` with `⏎····return·'../../../api';`
if (window.location.href.includes('/data-explorer/discover')) return '../../api'
return '../api'
}
Expand Down
32 changes: 16 additions & 16 deletions public/components/main/__tests__/__snapshots__/main.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ exports[`<Main /> panel render component 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--small"
type="button"
>
<span
Expand Down Expand Up @@ -522,7 +522,7 @@ exports[`<Main /> panel render component 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--small"
type="button"
>
<span
Expand Down Expand Up @@ -554,7 +554,7 @@ exports[`<Main /> panel render component 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary euiButton--fill"
class="euiButton euiButton--primary euiButton--small euiButton--fill"
id="createReportHomepageButton"
type="button"
>
Expand Down Expand Up @@ -912,7 +912,7 @@ exports[`<Main /> panel render component 1`] = `
/>
<div>
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--small"
type="button"
>
<span
Expand Down Expand Up @@ -975,7 +975,7 @@ exports[`<Main /> panel render component after create success 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--small"
type="button"
>
<span
Expand Down Expand Up @@ -1470,7 +1470,7 @@ exports[`<Main /> panel render component after create success 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--small"
type="button"
>
<span
Expand Down Expand Up @@ -1502,7 +1502,7 @@ exports[`<Main /> panel render component after create success 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary euiButton--fill"
class="euiButton euiButton--primary euiButton--small euiButton--fill"
id="createReportHomepageButton"
type="button"
>
Expand Down Expand Up @@ -1860,7 +1860,7 @@ exports[`<Main /> panel render component after create success 1`] = `
/>
<div>
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--small"
type="button"
>
<span
Expand Down Expand Up @@ -1980,7 +1980,7 @@ exports[`<Main /> panel render component after delete success 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--small"
type="button"
>
<span
Expand Down Expand Up @@ -2475,7 +2475,7 @@ exports[`<Main /> panel render component after delete success 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--small"
type="button"
>
<span
Expand Down Expand Up @@ -2507,7 +2507,7 @@ exports[`<Main /> panel render component after delete success 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary euiButton--fill"
class="euiButton euiButton--primary euiButton--small euiButton--fill"
id="createReportHomepageButton"
type="button"
>
Expand Down Expand Up @@ -2865,7 +2865,7 @@ exports[`<Main /> panel render component after delete success 1`] = `
/>
<div>
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--small"
type="button"
>
<span
Expand Down Expand Up @@ -2986,7 +2986,7 @@ exports[`<Main /> panel render component after edit success 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--small"
type="button"
>
<span
Expand Down Expand Up @@ -3481,7 +3481,7 @@ exports[`<Main /> panel render component after edit success 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--small"
type="button"
>
<span
Expand Down Expand Up @@ -3513,7 +3513,7 @@ exports[`<Main /> panel render component after edit success 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary euiButton--fill"
class="euiButton euiButton--primary euiButton--small euiButton--fill"
id="createReportHomepageButton"
type="button"
>
Expand Down Expand Up @@ -3871,7 +3871,7 @@ exports[`<Main /> panel render component after edit success 1`] = `
/>
<div>
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--small"
type="button"
>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ exports[`<ReportDefinitions /> panel render empty table 1`] = `
/>
<div>
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--small"
type="button"
>
<span
Expand Down
1 change: 0 additions & 1 deletion public/components/main/loading_modal/loading_modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
EuiFlexGroup,
EuiFlexItem,
EuiLoadingSpinner,
EuiButton,
} from '@elastic/eui';
import { i18n } from '@osd/i18n';
import React, { useState } from 'react';
Expand Down
14 changes: 7 additions & 7 deletions public/components/main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { i18n } from '@osd/i18n';
import {
EuiFlexGroup,
EuiFlexItem,
EuiButton,
EuiSmallButton,
EuiTitle,
// @ts-ignore
EuiHorizontalRule,
Expand Down Expand Up @@ -285,7 +285,7 @@ export function Main(props) {
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem component="span" grow={false}>
<EuiButton
<EuiSmallButton
onClick={refreshReportsTable}
iconSide="left"
iconType="refresh"
Expand All @@ -294,7 +294,7 @@ export function Main(props) {
'opensearch.reports.main.reports.button.refresh',
{ defaultMessage: 'Refresh' }
)}
</EuiButton>
</EuiSmallButton>
</EuiFlexItem>
</EuiFlexGroup>
<EuiHorizontalRule />
Expand Down Expand Up @@ -325,7 +325,7 @@ export function Main(props) {
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton
<EuiSmallButton
onClick={refreshReportsDefinitionsTable}
iconSide="left"
iconType="refresh"
Expand All @@ -334,10 +334,10 @@ export function Main(props) {
'opensearch.reports.main.reportDefinitions.button.refresh',
{ defaultMessage: 'Refresh' }
)}
</EuiButton>
</EuiSmallButton>
</EuiFlexItem>
<EuiFlexItem component="span" grow={false}>
<EuiButton
<EuiSmallButton
fill={true}
onClick={() => {
window.location.assign('reports-dashboards#/create');
Expand All @@ -348,7 +348,7 @@ export function Main(props) {
'opensearch.reports.main.reportDefinitions.button.create',
{ defaultMessage: 'Create' }
)}
</EuiButton>
</EuiSmallButton>
</EuiFlexItem>
</EuiFlexGroup>
<EuiHorizontalRule />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ exports[`<ReportDefinitionDetails /> panel render 5 hours recurring definition d
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--danger"
class="euiButton euiButton--danger euiButton--small"
id="deleteReportDefinitionButton"
type="button"
>
Expand All @@ -63,7 +63,7 @@ exports[`<ReportDefinitionDetails /> panel render 5 hours recurring definition d
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--small"
id="changeStatusFromDetailsButton"
type="button"
>
Expand All @@ -82,7 +82,7 @@ exports[`<ReportDefinitionDetails /> panel render 5 hours recurring definition d
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary euiButton--fill"
class="euiButton euiButton--primary euiButton--small euiButton--fill"
id="editReportDefinitionButton"
type="button"
>
Expand Down Expand Up @@ -457,7 +457,7 @@ exports[`<ReportDefinitionDetails /> panel render disabled daily definition, cli
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--danger"
class="euiButton euiButton--danger euiButton--small"
id="deleteReportDefinitionButton"
type="button"
>
Expand All @@ -476,7 +476,7 @@ exports[`<ReportDefinitionDetails /> panel render disabled daily definition, cli
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--small"
id="changeStatusFromDetailsButton"
type="button"
>
Expand All @@ -495,7 +495,7 @@ exports[`<ReportDefinitionDetails /> panel render disabled daily definition, cli
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary euiButton--fill"
class="euiButton euiButton--primary euiButton--small euiButton--fill"
id="editReportDefinitionButton"
type="button"
>
Expand Down Expand Up @@ -870,7 +870,7 @@ exports[`<ReportDefinitionDetails /> panel render on demand definition details 1
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--danger"
class="euiButton euiButton--danger euiButton--small"
id="deleteReportDefinitionButton"
type="button"
>
Expand All @@ -889,7 +889,7 @@ exports[`<ReportDefinitionDetails /> panel render on demand definition details 1
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--small"
id="changeStatusFromDetailsButton"
type="button"
>
Expand All @@ -908,7 +908,7 @@ exports[`<ReportDefinitionDetails /> panel render on demand definition details 1
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary euiButton--fill"
class="euiButton euiButton--primary euiButton--small euiButton--fill"
id="editReportDefinitionButton"
type="button"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
EuiHorizontalRule,
EuiSpacer,
EuiPageHeaderSection,
EuiButton,
EuiSmallButton,
EuiIcon,
EuiLink,
EuiGlobalToastList,
Expand Down Expand Up @@ -562,12 +562,12 @@ export function ReportDefinitionDetails(props: { match?: any; setBreadcrumbs?: a
reportDefinitionDetails.status === 'Active' ? 'Disable' : 'Enable';

return (
<EuiButton
<EuiSmallButton
onClick={() => changeScheduledReportDefinitionStatus(status)}
id={'changeStatusFromDetailsButton'}
>
{status}
</EuiButton>
</EuiSmallButton>
);
};

Expand Down Expand Up @@ -609,12 +609,12 @@ export function ReportDefinitionDetails(props: { match?: any; setBreadcrumbs?: a

const showActionButton =
reportDefinitionDetails.triggerType === ON_DEMAND ? (
<EuiButton
<EuiSmallButton
onClick={() => generateReportFromDetails()}
id={'generateReportFromDetailsButton'}
>
Generate report
</EuiButton>
</EuiSmallButton>
) : (
<ScheduledDefinitionStatus />
);
Expand Down Expand Up @@ -653,7 +653,7 @@ export function ReportDefinitionDetails(props: { match?: any; setBreadcrumbs?: a
)}
reportDetailsComponentContent={reportDefinitionDetails.status}
/>
<ReportDetailsComponent
<ReportDetailsComponent
reportDetailsComponentTitle={''}
reportDetailsComponentContent={''}
/>
Expand Down Expand Up @@ -697,7 +697,7 @@ export function ReportDefinitionDetails(props: { match?: any; setBreadcrumbs?: a
gutterSize="l"
>
<EuiFlexItem grow={false}>
<EuiButton
<EuiSmallButton
color={'danger'}
onClick={(show: any) => handleShowDeleteModal(show)}
id={'deleteReportDefinitionButton'}
Expand All @@ -706,11 +706,11 @@ export function ReportDefinitionDetails(props: { match?: any; setBreadcrumbs?: a
'opensearch.reports.reportDefinitionsDetails.deleteReportDefinitionButton',
{ defaultMessage: 'Delete' }
)}
</EuiButton>
</EuiSmallButton>
</EuiFlexItem>
<EuiFlexItem grow={false}>{showActionButton}</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton
<EuiSmallButton
fill={true}
onClick={() => {
window.location.assign(
Expand All @@ -723,7 +723,7 @@ export function ReportDefinitionDetails(props: { match?: any; setBreadcrumbs?: a
'opensearch.reports.reportDefinitionsDetails.editReportDefinitionButton',
{ defaultMessage: 'Edit' }
)}
</EuiButton>
</EuiSmallButton>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPageHeader>
Expand Down
Loading
Loading