-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Update the style of the service/backend info icons in the selec…
…ted service/backend header (#122587) * adding box-shadow * addressing pr comments * removing console * addressing comments * addressing pr comments * addressing comments Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
fcc8e9b
commit 6473ff3
Showing
3 changed files
with
156 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 130 additions & 0 deletions
130
x-pack/plugins/apm/public/components/shared/service_icons/service_icons.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import { EuiFlexGroup, EuiFlexItem, EuiTitle } from '@elastic/eui'; | ||
import { Meta, Story } from '@storybook/react'; | ||
import React from 'react'; | ||
import { CoreStart } from '../../../../../../../src/core/public'; | ||
import { createKibanaReactContext } from '../../../../../../../src/plugins/kibana_react/public'; | ||
import { | ||
APIReturnType, | ||
createCallApmApi, | ||
} from '../../../services/rest/createCallApmApi'; | ||
import { ServiceIcons } from './'; | ||
|
||
type ServiceDetailsReturnType = | ||
APIReturnType<'GET /internal/apm/services/{serviceName}/metadata/details'>; | ||
type ServiceIconsReturnType = | ||
APIReturnType<'GET /internal/apm/services/{serviceName}/metadata/icons'>; | ||
|
||
interface Args { | ||
serviceName: string; | ||
start: string; | ||
end: string; | ||
icons: ServiceIconsReturnType; | ||
details: ServiceDetailsReturnType; | ||
} | ||
|
||
const stories: Meta<Args> = { | ||
title: 'shared/ServiceIcons', | ||
component: ServiceIcons, | ||
decorators: [ | ||
(StoryComponent, { args }) => { | ||
const { icons, details, serviceName } = args; | ||
|
||
const coreMock = { | ||
http: { | ||
get: (endpoint: string) => { | ||
switch (endpoint) { | ||
case `/internal/apm/services/${serviceName}/metadata/icons`: | ||
return icons; | ||
default: | ||
return details; | ||
} | ||
}, | ||
}, | ||
notifications: { toasts: { add: () => {} } }, | ||
uiSettings: { get: () => true }, | ||
} as unknown as CoreStart; | ||
|
||
const KibanaReactContext = createKibanaReactContext(coreMock); | ||
|
||
createCallApmApi(coreMock); | ||
|
||
return ( | ||
<KibanaReactContext.Provider> | ||
<StoryComponent /> | ||
</KibanaReactContext.Provider> | ||
); | ||
}, | ||
], | ||
}; | ||
export default stories; | ||
|
||
export const Example: Story<Args> = ({ serviceName, start, end }) => { | ||
return ( | ||
<EuiFlexGroup> | ||
<EuiFlexItem> | ||
<EuiTitle size="l"> | ||
<h1 data-test-subj="apmMainTemplateHeaderServiceName"> | ||
<EuiFlexGroup justifyContent="spaceBetween"> | ||
<EuiFlexItem> | ||
<EuiFlexGroup> | ||
<EuiFlexItem grow={false}> | ||
<EuiTitle size="l"> | ||
<h1 data-test-subj="apmMainTemplateHeaderServiceName"> | ||
{serviceName} | ||
</h1> | ||
</EuiTitle> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<ServiceIcons | ||
serviceName={serviceName} | ||
start={start} | ||
end={end} | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</h1> | ||
</EuiTitle> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); | ||
}; | ||
Example.args = { | ||
serviceName: 'opbeans-java', | ||
start: '2021-09-10T13:59:00.000Z', | ||
end: '2021-09-10T14:14:04.789Z', | ||
icons: { | ||
agentName: 'java', | ||
containerType: 'Kubernetes', | ||
cloudProvider: 'gcp', | ||
}, | ||
details: { | ||
service: { | ||
versions: ['2021-12-22 17:03:27'], | ||
runtime: { name: 'Java', version: '11.0.11' }, | ||
agent: { | ||
name: 'java', | ||
version: '1.28.3-SNAPSHOT.UNKNOWN', | ||
}, | ||
}, | ||
container: { | ||
os: 'Linux', | ||
type: 'Kubernetes', | ||
isContainerized: true, | ||
totalNumberInstances: 1, | ||
}, | ||
cloud: { | ||
provider: 'gcp', | ||
projectName: 'elastic-observability', | ||
availabilityZones: ['us-central1-c'], | ||
machineTypes: ['n1-standard-4'], | ||
}, | ||
}, | ||
}; |