Skip to content

Commit 406423c

Browse files
authored
Merge branch 'main' into feat/widgetize-app-layout-skeleton-event-base
2 parents 46a42d1 + 5687992 commit 406423c

File tree

8 files changed

+52
-40
lines changed

8 files changed

+52
-40
lines changed

pages/funnel-analytics/static-single-page-flow.page.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ export default function StaticSinglePageCreatePage() {
8888
{
8989
analyticsMetadata: {
9090
errorContext: {
91-
errorCategory: 'api_specific',
92-
errorSubCategory: 'access_control',
91+
errorCategory: 'API_SPECIFIC',
92+
errorSubCategory: 'ACCESS_CONTROL_ISSUES',
9393
errorMessage: 'This is a dismissible error message.',
9494
},
9595
},
@@ -149,8 +149,8 @@ export default function StaticSinglePageCreatePage() {
149149
const errorMessage = 'There is an error';
150150
setErrorText('There is an error');
151151
setFunnelErrorContext({
152-
errorCategory: 'api_specific',
153-
errorSubCategory: 'connection',
152+
errorCategory: 'API_SPECIFIC',
153+
errorSubCategory: 'CONNECTION_PROBLEMS',
154154
errorMessage,
155155
});
156156
} else {
@@ -205,8 +205,8 @@ export default function StaticSinglePageCreatePage() {
205205
const errorMessage = 'Trigger error';
206206
setFieldError(errorMessage);
207207
setFieldErrorContext({
208-
errorCategory: 'input_validation',
209-
errorSubCategory: 'access_control',
208+
errorCategory: 'INPUT_VALIDATION',
209+
errorSubCategory: 'ACCESS_CONTROL_ISSUES',
210210
errorMessage,
211211
});
212212
} else {

pages/multiselect/select-all.page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const groupedOptionsWithDisabledOptions: MultiselectProps.Options = [
3333
const initialSelectedOptions = [
3434
(groupedOptionsWithDisabledOptions[0] as OptionGroup).options[2],
3535
(groupedOptionsWithDisabledOptions[1] as OptionGroup).options[0],
36+
(groupedOptionsWithDisabledOptions[1] as OptionGroup).options[1],
3637
];
3738

3839
export default function MultiselectPage() {

src/alert/__tests__/alert-analytics.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ describe('Alert Analytics', () => {
207207
type="error"
208208
analyticsMetadata={{
209209
errorContext: {
210-
errorCategory: 'api_specific',
211-
errorSubCategory: 'access_control',
210+
errorCategory: 'API_SPECIFIC',
211+
errorSubCategory: 'ACCESS_CONTROL_ISSUES',
212212
errorMessage: 'This is an error text from errorContext',
213213
},
214214
}}
@@ -225,8 +225,8 @@ describe('Alert Analytics', () => {
225225
expect(FunnelMetrics.funnelError).toHaveBeenCalledWith(
226226
expect.objectContaining({
227227
errorContext: {
228-
errorCategory: 'api_specific',
229-
errorSubCategory: 'access_control',
228+
errorCategory: 'API_SPECIFIC',
229+
errorSubCategory: 'ACCESS_CONTROL_ISSUES',
230230
errorMessage: 'This is an error text from errorContext',
231231
},
232232
})

src/internal/analytics/__integ__/static-single-page-flow.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@ describe.each(['refresh', 'refresh-toolbar'] as Theme[])('%s', theme => {
328328
stepNumber: 1,
329329
subStepName: 'Container 1 - header',
330330
errorContext: {
331-
errorCategory: 'input_validation',
332-
errorSubCategory: 'access_control',
331+
errorCategory: 'INPUT_VALIDATION',
332+
errorSubCategory: 'ACCESS_CONTROL_ISSUES',
333333
errorMessage: 'Trigger error',
334334
},
335335
fieldIdentifier: 'field1',

src/internal/analytics/interfaces.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,31 @@ export type FunnelType = 'single-page' | 'multi-page' | 'modal';
55
export type FlowType = 'create' | 'edit' | 'delete' | 'home' | 'dashboard' | 'view-resource';
66

77
type ErrorSubCategory =
8-
| 'data_format'
9-
| 'parameter_validation'
10-
| 'access_control'
11-
| 'identity_management'
12-
| 'resource_state'
13-
| 'resource_capacity'
14-
| 'connection'
15-
| 'network_config'
16-
| 'resource_limit'
17-
| 'service_quota'
18-
| 'service_integration'
19-
| 'resource_config'
20-
| 'service_operations'
21-
| 'api_request'
22-
| 'other';
8+
| 'DATA_FORMAT_ISSUES'
9+
| 'PARAMETER_VALIDATION_ISSUES'
10+
| 'ACCESS_CONTROL_ISSUES'
11+
| 'IDENTITY_MANAGEMENT_PROBLEMS'
12+
| 'RESOURCE_STATE_ISSUES'
13+
| 'RESOURCE_CAPACITY_PROBLEMS'
14+
| 'CONNECTION_PROBLEMS'
15+
| 'NETWORK_CONFIGURATION_ISSUES'
16+
| 'RESOURCE_LIMIT_EXCEEDED'
17+
| 'SERVICE_QUOTA_RESTRICTIONS'
18+
| 'SERVICE_INTEGRATION_CONFLICTS'
19+
| 'RESOURCE_CONFIGURATION_MISMATCHES'
20+
| 'SERVICE_SPECIFIC_OPERATIONS'
21+
| 'API_REQUEST_PROBLEMS'
22+
| 'OTHER';
2323

2424
type ErrorCategory =
25-
| 'input_validation'
26-
| 'permission'
27-
| 'resource_availability'
28-
| 'network'
29-
| 'service_limits'
30-
| 'configuration'
31-
| 'api_specific'
32-
| 'other';
25+
| 'INPUT_VALIDATION'
26+
| 'PERMISSION_IAM'
27+
| 'RESOURCE_AVAILABILITY'
28+
| 'NETWORK_CONNECTIVITY'
29+
| 'SERVICE_QUOTAS_LIMITS'
30+
| 'CONFIGURATION_CONFLICTS'
31+
| 'API_SPECIFIC'
32+
| 'OTHER';
3333

3434
export interface ErrorContext {
3535
errorCategory: ErrorCategory;

src/multiselect/__tests__/analytics-metadata.test.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,10 @@ describe('Multiselect renders correct analytics metadata', () => {
276276
});
277277

278278
const disabledToken = wrapper.findToken(3)!.findDismiss().getElement();
279-
expect(getGeneratedAnalyticsMetadata(disabledToken)).toEqual(getMetadataContexts(5));
279+
expect(getGeneratedAnalyticsMetadata(disabledToken)).toEqual({
280+
detail: { position: '3' },
281+
...getMetadataContexts(5),
282+
});
280283
});
281284

282285
test('in show more', () => {

src/multiselect/internal.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ type InternalMultiselectProps = SomeRequired<
3131
> &
3232
InternalBaseComponentProps;
3333

34+
type ExtendedToken = TokenGroupProps.Item & { _readOnly: boolean };
35+
3436
const InternalMultiselect = React.forwardRef(
3537
(
3638
{
@@ -116,9 +118,9 @@ const InternalMultiselect = React.forwardRef(
116118
/>
117119
);
118120

119-
const tokens: TokenGroupProps['items'] = selectedOptions.map(option => ({
121+
const tokens: Array<ExtendedToken> = selectedOptions.map(option => ({
120122
label: option.label,
121-
disabled: disabled || option.disabled,
123+
disabled,
122124
labelTag: option.labelTag,
123125
description: option.description,
124126
iconAlt: option.iconAlt,
@@ -129,6 +131,7 @@ const InternalMultiselect = React.forwardRef(
129131
dismissLabel: i18n('deselectAriaLabel', deselectAriaLabel?.(option), format =>
130132
format({ option__label: option.label ?? '' })
131133
),
134+
_readOnly: !!option.disabled,
132135
}));
133136

134137
const ListComponent = virtualScroll ? VirtualList : PlainList;
@@ -200,6 +203,7 @@ const InternalMultiselect = React.forwardRef(
200203
limitShowFewerAriaLabel={tokenLimitShowFewerAriaLabel}
201204
disableOuterPadding={true}
202205
readOnly={readOnly}
206+
isItemReadOnly={item => (item as ExtendedToken)._readOnly}
203207
/>
204208
)}
205209

src/token-group/internal.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ import { Token } from './token';
2020
import tokenListStyles from '../internal/components/token-list/styles.css.js';
2121
import styles from './styles.css.js';
2222

23-
type InternalTokenGroupProps = SomeRequired<TokenGroupProps, 'items' | 'alignment'> & InternalBaseComponentProps;
23+
type InternalTokenGroupProps = SomeRequired<TokenGroupProps, 'items' | 'alignment'> &
24+
InternalBaseComponentProps & {
25+
isItemReadOnly?: (item: TokenGroupProps.Item) => boolean;
26+
};
2427

2528
export default function InternalTokenGroup({
2629
alignment,
@@ -32,6 +35,7 @@ export default function InternalTokenGroup({
3235
limitShowFewerAriaLabel,
3336
limitShowMoreAriaLabel,
3437
readOnly,
38+
isItemReadOnly,
3539
__internalRootRef,
3640
...props
3741
}: InternalTokenGroupProps) {
@@ -75,7 +79,7 @@ export default function InternalTokenGroup({
7579
setNextFocusIndex(itemIndex);
7680
}}
7781
disabled={item.disabled}
78-
readOnly={readOnly}
82+
readOnly={readOnly || isItemReadOnly?.(item)}
7983
{...(item.disabled || readOnly
8084
? {}
8185
: getAnalyticsMetadataAttribute({ detail: { position: `${itemIndex + 1}` } }))}

0 commit comments

Comments
 (0)