Skip to content

Commit

Permalink
Merge branch 'ui5' into update
Browse files Browse the repository at this point in the history
  • Loading branch information
mrCherry97 authored Oct 2, 2023
2 parents 7dcd6fb + c06b893 commit 796cf1f
Show file tree
Hide file tree
Showing 61 changed files with 225 additions and 367 deletions.
19 changes: 9 additions & 10 deletions docs/extensibility/display-section.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,18 @@ Badge widgets render texts as a status badge, using a set of predefined rules to

- **placeholder** - an optional property to change the default empty text placeholder `-` with a custom string.
If the **translations** section has a translation entry with the ID that is the same as the **placeholder** string, the translation is used.
- **highlights** - an optional map of highlight rules. Key refers to the type of highlight, while the rule can just be a plain array of values or a string containing a [JSONata](jsonata.md) rule. Allowed keys are `informative` `positive`, `negative` and `critical`.
- **highlights** - an optional map of highlight rules. Key refers to the type of highlight, while the rule can just be a plain array of values or a string containing a [JSONata](jsonata.md) rule. Allowed keys are `information`, `success`, `warning` and `error`.
- **description** - a [JSONata](jsonata.md) expression used to fetch additional information that will be displayed in a tooltip when hovering over the badge.
- **copyable** - an optional flag to display a **Copy to clipboard** button next to the widget. By default set to `false`.

#### Default highlight rules

When no highlights are provided, the following values are automatically handled:

- rendered as informative: `initial`, `pending`, `available`, `released`.
- rendered as positive: `ready`, `bound`, `running`, `success`, `succeeded`, `ok`.
- rendered as negative: `unknown`, `warning`.
- rendered as critical: `error`, `failure`, `invalid`.
- rendered as information: `initial`, `pending`, `available`, `released`.
- rendered as success: `ready`, `bound`, `running`, `success`, `succeeded`, `ok`.
- rendered as warning: `unknown`, `warning`.
- rendered as error: `error`, `failure`, `invalid`.

#### Example

Expand All @@ -231,10 +231,10 @@ When no highlights are provided, the following values are automatically handled:
widget: Badge
placeholder: '-'
highlights:
positive:
success:
- Running
- ok
negative: $item < 0
error: $item < 0
description: status.message
```

Expand Down Expand Up @@ -835,11 +835,10 @@ injections: |-
- name: status
widget: Badge
highlights:
positive:
success:
- 'OK'
negative:
error:
- 'ERROR'
critical:
- 'SKIPPED'
source: 'status.APIRuleStatus.code ? status.APIRuleStatus.code : "UNKNOWN"'
description: status.APIRuleStatus.desc
Expand Down
5 changes: 2 additions & 3 deletions examples/injections/apirules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ injections: |-
- name: status
widget: Badge
highlights:
positive:
success:
- 'OK'
negative:
error:
- 'ERROR'
critical:
- 'SKIPPED'
source: 'status.APIRuleStatus.code ? status.APIRuleStatus.code : "UNKNOWN"'
description: status.APIRuleStatus.desc
9 changes: 4 additions & 5 deletions examples/injections/functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@ injections: |-
- name: header.status
widget: Badge
highlights:
positive:
success:
- RUNNING
negative:
error:
- FAILED
- ERROR
informative:
- INITIALIZING
critical:
- DEPLOYING
- BUILDING
- PENDING
information:
- INITIALIZING
source: >-
($.status = undefined or $.status.conditions = undefined or
$count($.status.conditions) = 0) ? 'INITIALIZING' :
Expand Down
4 changes: 2 additions & 2 deletions examples/services/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ data:
sort: true
widget: Badge
highlights:
positive:
success:
- 'true'
negative:
error:
- 'false'
- widget: ResourceList
source: $apirules()
Expand Down
6 changes: 0 additions & 6 deletions public/i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -710,12 +710,6 @@ gardener:
provider: Provider
generic-list:
no-entries-found: No entries found
grafana:
logs: Logs
missing-domain: Grafana service does not have a host defined
not-exposed: Grafana service is not exposed
open-in-grafana: Open in Grafana
unavailable: No Grafana link
graphs:
capacity: Capacity
cpu: CPU
Expand Down
14 changes: 3 additions & 11 deletions public/schemas/schema-details.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,31 +119,23 @@ $widgets:
type: object
widget: FormGroup
properties:
informative:
information:
type: [string, array]
widget: MultiType
widgets:
string: Jsonata
array: SimpleList
items:
type: string
positive:
success:
type: [string, array]
widget: MultiType
widgets:
string: Jsonata
array: SimpleList
items:
type: string
negative:
type: [string, array]
widget: MultiType
widgets:
string: Jsonata
array: SimpleList
items:
type: string
critical:
error:
type: [string, array]
widget: MultiType
widgets:
Expand Down
16 changes: 3 additions & 13 deletions public/schemas/schema-injections.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ items:
type: object
widget: FormGroup
properties:
informative:
information:
type:
- string
- array
Expand All @@ -153,7 +153,7 @@ items:
array: SimpleList
items:
type: string
positive:
success:
type:
- string
- array
Expand All @@ -163,17 +163,7 @@ items:
array: SimpleList
items:
type: string
negative:
type:
- string
- array
widget: MultiType
widgets:
string: Jsonata
array: SimpleList
items:
type: string
critical:
error:
type:
- string
- array
Expand Down
14 changes: 3 additions & 11 deletions public/schemas/schema-list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,31 +104,23 @@ $widgets:
type: object
widget: FormGroup
properties:
informative:
information:
type: [string, array]
widget: MultiType
widgets:
string: Jsonata
array: SimpleList
items:
type: string
positive:
success:
type: [string, array]
widget: MultiType
widgets:
string: Jsonata
array: SimpleList
items:
type: string
negative:
type: [string, array]
widget: MultiType
widgets:
string: Jsonata
array: SimpleList
items:
type: string
critical:
error:
type: [string, array]
widget: MultiType
widgets:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { MessageStrip } from '@ui5/webcomponents-react';
import { Select } from 'fundamental-react';
import { MessageStrip, Select, Option } from '@ui5/webcomponents-react';

import { ResourceForm } from 'shared/ResourceForm';

Expand All @@ -24,6 +22,11 @@ export function ContextChooser(params) {
text: t('clusters.wizard.all-contexts'),
});

const onChange = (event, setValue) => {
const selectedContext = event.detail.selectedOption.value;
setValue(selectedContext);
};

return (
<ResourceForm.Wrapper {...params}>
<ResourceForm.FormField
Expand All @@ -34,10 +37,16 @@ export function ContextChooser(params) {
input={({ value, setValue }) => (
<Select
id="context-chooser"
selectedKey={value}
options={contexts}
onSelect={(_, { key }) => setValue(key)}
/>
onChange={event => {
onChange(event, setValue);
}}
>
{contexts.map(context => (
<Option value={context.key} selected={value === context.key}>
{context.text}
</Option>
))}
</Select>
)}
/>
{kubeconfig['current-context'] === '-all-' && (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Clusters/views/ClusterStorageType.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function ClusterStorageType({ clusterConfig }) {
return (
<StatusBadge
resourceKind="clusters"
type={knownStorage.includes(storage) ? 'info' : 'warning'}
type={knownStorage.includes(storage) ? 'Information' : 'Warning'}
>
{storage || 'unknown'}
</StatusBadge>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ const getEnumComponent = (
return ({ onChange, setValue, onBlur, value, ...props }) => (
<Dropdown
{...props}
onKeyDown={event => {
event.preventDefault();
}}
value={value}
options={options}
setValue={v => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ export function Modules({ storeKeys, resource, onChange, schema, required }) {
<Dropdown
className="fd-margin-top--tiny"
label={t('extensibility.widgets.modules.module-channel-label')}
compact
disabled={!isChecked}
placeholder={t(
'extensibility.widgets.modules.module-channel-placeholder',
Expand Down
3 changes: 1 addition & 2 deletions src/components/Extensibility/components/Badge.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { isNil } from 'lodash';
import { useJsonata } from '../hooks/useJsonata';
import { useTranslation } from 'react-i18next';

import { StatusBadge } from 'shared/components/StatusBadge/StatusBadge';
import {
Expand All @@ -10,12 +11,10 @@ import {
import { Tooltip } from 'shared/components/Tooltip/Tooltip';

import './Badge.scss';
import { useTranslation } from 'react-i18next';

export function Badge({
value,
structure,
schema,
originalResource,
scope,
arrayItems,
Expand Down
12 changes: 6 additions & 6 deletions src/components/Extensibility/components/tests/Badge.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,34 @@ describe('Badge', () => {
expect(status).toHaveLength(1);
});

it('Renders a badge with positive type for custom highlights', () => {
it('Renders a badge with success type for custom highlights', () => {
const value = 'yes';
const structure = {
highlights: {
positive: ['yes', 'ok'],
Success: ['yes', 'ok'],
},
};

const wrapper = shallow(<Badge value={value} structure={structure} />);
const status = wrapper.find(StatusBadge);
const badgeProps = status.props();
expect(badgeProps.type).toEqual('positive');
expect(badgeProps.type).toEqual('Success');
expect(badgeProps.autoResolveType).toEqual(false);
expect(status).toHaveLength(1);
});

it('Renders a badge with positive type for custom highlights', () => {
it('Renders a badge with error type for custom highlights', () => {
const value = -2;
const structure = {
highlights: {
negative: 'data < 0',
Error: 'data < 0',
},
};

const wrapper = shallow(<Badge value={value} structure={structure} />);
const status = wrapper.find(StatusBadge);
const badgeProps = status.props();
expect(badgeProps.type).toEqual('negative');
expect(badgeProps.type).toEqual('Error');
expect(badgeProps.autoResolveType).toEqual(false);
expect(status).toHaveLength(1);
});
Expand Down
1 change: 0 additions & 1 deletion src/components/HelmReleases/HelmReleaseStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export function HelmReleaseStatus({ status }) {
case 'deployed':
return 'Success';
case 'uninstalling':
return 'Error';
case 'failed':
return 'Error';
case 'unknown':
Expand Down
2 changes: 1 addition & 1 deletion src/components/HelmReleases/ReleaseDataPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function ReleaseDataPanel({ release, simpleHeader }) {
{name}
</Link>
<div className="fd-margin-begin--sm">
<StatusBadge noTooltip type="info">
<StatusBadge noTooltip type="Information">
{t('helm-releases.headers.release-version', { version })}
</StatusBadge>
</div>
Expand Down
Loading

0 comments on commit 796cf1f

Please sign in to comment.