Skip to content

Commit

Permalink
Merge branch 'main' into eem-deduplicate-latest
Browse files Browse the repository at this point in the history
  • Loading branch information
miltonhultgren authored Jul 9, 2024
2 parents b9a1f7a + 7c5cf9c commit 54b70e1
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 15 deletions.
32 changes: 32 additions & 0 deletions packages/kbn-crypto-browser/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")

SRCS = glob(
[
"**/*.ts",
],
exclude = [
"**/*.config.js",
"**/*.mock.*",
"**/*.test.*",
"**/*.stories.*",
"**/__snapshots__/**",
"**/integration_tests/**",
"**/mocks/**",
"**/scripts/**",
"**/storybook/**",
"**/test_fixtures/**",
"**/test_helpers/**",
],
)

BUNDLER_DEPS = [
"@npm//tslib",
]

js_library(
name = "kbn-crypto-browser",
package_name = "@kbn/crypto-browser",
srcs = ["package.json"] + SRCS,
deps = BUNDLER_DEPS,
visibility = ["//visibility:public"],
)
1 change: 1 addition & 0 deletions packages/kbn-ui-shared-deps-src/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ webpack_cli(
"//packages/kbn-monaco",
"//packages/kbn-datemath",
"//packages/kbn-analytics",
"//packages/kbn-crypto-browser",
"//packages/kbn-es-query",
"//packages/kbn-search-errors",
"//packages/kbn-std",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-ui-shared-deps-src/src/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const externals = {
tslib: '__kbnSharedDeps__.TsLib',
uuid: '__kbnSharedDeps__.Uuid',
'@kbn/analytics': '__kbnSharedDeps__.KbnAnalytics',
'@kbn/crypto-browser': '__kbnSharedDeps__.KbnCryptoBrowser',
'@kbn/es-query': '__kbnSharedDeps__.KbnEsQuery',
'@kbn/search-errors': '__kbnSharedDeps__.KbnSearchErrors',
'@kbn/std': '__kbnSharedDeps__.KbnStd',
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-ui-shared-deps-src/src/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const Fflate = { unzlibSync, strFromU8 };
export const TsLib = require('tslib');
export const Uuid = require('uuid');
export const KbnAnalytics = require('@kbn/analytics');
export const KbnCryptoBrowser = require('@kbn/crypto-browser');
export const KbnEsQuery = require('@kbn/es-query');
export const KbnSearchErrors = require('@kbn/search-errors');
export const KbnStd = require('@kbn/std');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ export const AnomaliesTable = ({
}: Props) => {
const [search, setSearch] = useState('');
const trackMetric = useUiTracker({ app: 'infra_metrics' });
const [timeRange, setTimeRange] = useState<{ start: number; end: number }>({
start: datemathToEpochMillis(dateRange.from) || 0,
end: datemathToEpochMillis(dateRange.to, 'up') || 0,
const [timeRange, setTimeRange] = useState<{ start: string; end: string }>({
start: dateRange.from,
end: dateRange.to,
});
const { sorting, setSorting } = useSorting<MetricsHostsAnomaly>({
field: 'startTime',
Expand Down Expand Up @@ -256,23 +256,26 @@ export const AnomaliesTable = ({
({ isInvalid, start: startChange, end: endChange }: OnTimeChangeProps) => {
if (!isInvalid) {
setTimeRange({
start: datemathToEpochMillis(startChange)!,
end: datemathToEpochMillis(endChange, 'up')!,
start: startChange,
end: endChange,
});
}
},
[]
);

const getTimeRange = useCallback(() => {
if (hideDatePicker) {
return {
start: datemathToEpochMillis(dateRange.from) || 0,
end: datemathToEpochMillis(dateRange.to, 'up') || 0,
};
} else {
return timeRange;
}
const { start, end } = hideDatePicker
? {
start: dateRange.from,
end: dateRange.to,
}
: timeRange;

return {
start: datemathToEpochMillis(start) || 0,
end: datemathToEpochMillis(end, 'up') || 0,
};
}, [dateRange.from, dateRange.to, hideDatePicker, timeRange]);

const anomalyParams = useMemo(() => {
Expand Down Expand Up @@ -483,8 +486,8 @@ export const AnomaliesTable = ({
{!hideDatePicker && (
<EuiFlexItem grow={false}>
<EuiSuperDatePicker
start={dateRange.from}
end={dateRange.to}
start={timeRange.start}
end={timeRange.end}
showUpdateButton={false}
onTimeChange={onTimeChange}
width="full"
Expand Down

0 comments on commit 54b70e1

Please sign in to comment.