Skip to content

Commit 896a0fe

Browse files
Merge pull request #499 from zhuje/ou848-upgrade-sdk-pr
OU-848: Dependency update of dynamic plugin sdk and typescript
2 parents 3b543ac + 4f9b854 commit 896a0fe

File tree

13 files changed

+1157
-1117
lines changed

13 files changed

+1157
-1117
lines changed

web/.eslintrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ parser: '@typescript-eslint/parser'
1111
parserOptions:
1212
ecmaFeatures:
1313
jsx: true
14-
ecmaVersion: 2018
14+
ecmaVersion: 2021
1515
sourceType: module
1616
plugins:
1717
- prettier

web/package-lock.json

Lines changed: 1076 additions & 1055 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
"@lezer/lr": "^1.0.0",
4747
"@mui/material": "^6.1.10",
4848
"@openshift-console/dynamic-plugin-sdk": "^4.19.0",
49-
"@openshift-console/dynamic-plugin-sdk-internal": "^4.19.0-prerelease.1",
50-
"@openshift-console/dynamic-plugin-sdk-webpack": "^4.19.0-prerelease.1",
49+
"@openshift-console/dynamic-plugin-sdk-internal": "^4.19.0-prerelease.2",
50+
"@openshift-console/dynamic-plugin-sdk-webpack": "^4.19.0",
5151
"@patternfly/react-charts": "^8.2.0",
5252
"@patternfly/react-core": "^6.2.0",
5353
"@patternfly/react-data-view": "^6.1.0",
@@ -90,15 +90,15 @@
9090
"@types/react-helmet": "^6.1.11",
9191
"@types/react-router-dom": "^5.3.2",
9292
"@types/webpack-dev-server": "^4.7.2",
93-
"@typescript-eslint/eslint-plugin": "^5.15.0",
94-
"@typescript-eslint/parser": "^5.15.0",
93+
"@typescript-eslint/eslint-plugin": "^8.39.1",
94+
"@typescript-eslint/parser": "^8.39.1",
9595
"copy-webpack-plugin": "^11.0.0",
9696
"css-loader": "^6.7.1",
9797
"csstype": "^3.1.3",
9898
"cypress": "^14.2.1",
9999
"cypress-multi-reporters": "^1.4.0",
100100
"cypress-wait-until": "^3.0.2",
101-
"eslint": "8.44.0",
101+
"eslint": "^8.44.0",
102102
"eslint-config-prettier": "^8.5.0",
103103
"eslint-plugin-prettier": "^4.0.0",
104104
"eslint-plugin-react": "^7.29.4",
@@ -118,7 +118,7 @@
118118
"style-loader": "^3.3.1",
119119
"ts-loader": "^9.2.8",
120120
"ts-node": "^10.7.0",
121-
"typescript": "^4.6.2",
121+
"typescript": "^5.9.2",
122122
"webpack": "^5.76.0",
123123
"webpack-cli": "^4.9.2",
124124
"webpack-dev-server": "^4.15.1"

web/src/actions/observe.ts

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -160,44 +160,44 @@ export const setIncidentsChartSelection = (incidentsChartSelectedId) =>
160160
export const setFilteredIncidentsData = (filteredIncidentsData) =>
161161
action(ActionType.SetFilteredIncidentsData, filteredIncidentsData);
162162

163-
const actions = {
164-
alertingErrored,
165-
alertingLoaded,
166-
alertingLoading,
167-
alertingSetRules,
168-
dashboardsPatchAllVariables,
169-
dashboardsPatchVariable,
170-
DashboardsClearVariables,
171-
dashboardsSetEndTime,
172-
dashboardsSetPollInterval,
173-
dashboardsSetTimespan,
174-
dashboardsVariableOptionsLoaded,
175-
queryBrowserAddQuery,
176-
queryBrowserDuplicateQuery,
177-
queryBrowserDeleteAllQueries,
178-
queryBrowserDeleteAllSeries,
179-
queryBrowserDeleteQuery,
180-
queryBrowserDismissNamespaceAlert,
181-
queryBrowserPatchQuery,
182-
queryBrowserRunQueries,
183-
queryBrowserSetAllExpanded,
184-
queryBrowserSetMetrics,
185-
queryBrowserSetPollInterval,
186-
queryBrowserSetTimespan,
187-
queryBrowserToggleAllSeries,
188-
queryBrowserToggleIsEnabled,
189-
queryBrowserToggleSeries,
190-
setAlertCount,
191-
toggleGraphs,
192-
showGraphs,
193-
setIncidents,
194-
setIncidentsActiveFilters,
195-
setChooseIncident,
196-
setAlertsData,
197-
setAlertsTableData,
198-
setAlertsAreLoading,
199-
setIncidentsChartSelection,
200-
setFilteredIncidentsData,
163+
type Actions = {
164+
alertingErrored: typeof alertingErrored;
165+
alertingLoaded: typeof alertingLoaded;
166+
alertingLoading: typeof alertingLoading;
167+
alertingSetRules: typeof alertingSetRules;
168+
dashboardsPatchAllVariables: typeof dashboardsPatchAllVariables;
169+
dashboardsPatchVariable: typeof dashboardsPatchVariable;
170+
DashboardsClearVariables: typeof DashboardsClearVariables;
171+
dashboardsSetEndTime: typeof dashboardsSetEndTime;
172+
dashboardsSetPollInterval: typeof dashboardsSetPollInterval;
173+
dashboardsSetTimespan: typeof dashboardsSetTimespan;
174+
dashboardsVariableOptionsLoaded: typeof dashboardsVariableOptionsLoaded;
175+
queryBrowserAddQuery: typeof queryBrowserAddQuery;
176+
queryBrowserDuplicateQuery: typeof queryBrowserDuplicateQuery;
177+
queryBrowserDeleteAllQueries: typeof queryBrowserDeleteAllQueries;
178+
queryBrowserDeleteAllSeries: typeof queryBrowserDeleteAllSeries;
179+
queryBrowserDeleteQuery: typeof queryBrowserDeleteQuery;
180+
queryBrowserDismissNamespaceAlert: typeof queryBrowserDismissNamespaceAlert;
181+
queryBrowserPatchQuery: typeof queryBrowserPatchQuery;
182+
queryBrowserRunQueries: typeof queryBrowserRunQueries;
183+
queryBrowserSetAllExpanded: typeof queryBrowserSetAllExpanded;
184+
queryBrowserSetMetrics: typeof queryBrowserSetMetrics;
185+
queryBrowserSetPollInterval: typeof queryBrowserSetPollInterval;
186+
queryBrowserSetTimespan: typeof queryBrowserSetTimespan;
187+
queryBrowserToggleAllSeries: typeof queryBrowserToggleAllSeries;
188+
queryBrowserToggleIsEnabled: typeof queryBrowserToggleIsEnabled;
189+
queryBrowserToggleSeries: typeof queryBrowserToggleSeries;
190+
setAlertCount: typeof setAlertCount;
191+
toggleGraphs: typeof toggleGraphs;
192+
showGraphs: typeof showGraphs;
193+
setIncidents: typeof setIncidents;
194+
setIncidentsActiveFilters: typeof setIncidentsActiveFilters;
195+
setChooseIncident: typeof setChooseIncident;
196+
setAlertsData: typeof setAlertsData;
197+
setAlertsTableData: typeof setAlertsTableData;
198+
setAlertsAreLoading: typeof setAlertsAreLoading;
199+
setIncidentsChartSelection: typeof setIncidentsChartSelection;
200+
setFilteredIncidentsData: typeof setFilteredIncidentsData;
201201
};
202202

203-
export type ObserveAction = Action<typeof actions>;
203+
export type ObserveAction = Action<Actions>;

web/src/components/TypeaheadSelect.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ export const TypeaheadSelect: React.FC<TypeaheadSelectProps> = ({
237237

238238
<TextInputGroupUtilities {...(!inputValue ? { style: { display: 'none' } } : {})}>
239239
<Button
240-
icon={<TimesIcon aria-hidden />}
240+
icon={<TimesIcon aria-hidden="true" />}
241241
variant="plain"
242242
onClick={onClearButtonClick}
243243
aria-label="Clear input value"
@@ -253,7 +253,9 @@ export const TypeaheadSelect: React.FC<TypeaheadSelectProps> = ({
253253
isOpen={isOpen}
254254
onSelect={handleSelect}
255255
onOpenChange={(isOpen) => {
256-
!isOpen && closeMenu();
256+
if (!isOpen) {
257+
closeMenu();
258+
}
257259
}}
258260
toggle={toggle}
259261
shouldFocusFirstItemOnOpen={false}

web/src/components/alerting/SilencesUtils.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export const SilenceTableRow: React.FC<SilenceTableRowProps> = ({ obj, showCheck
9494
isChecked={selectedSilences.has(id)}
9595
isDisabled={state === SilenceStates.Expired}
9696
onChange={(_e, checked) => {
97-
typeof _e === 'boolean' ? onCheckboxChange(checked) : onCheckboxChange(checked);
97+
onCheckboxChange(checked);
9898
}}
9999
/>
100100
</Td>

web/src/components/console/console-shared/src/datetime/prometheus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const parsePrometheusDuration = (duration: string): number => {
5050
.split(/\s+/)
5151
.map((p) => p.match(/^(\d+)([wdhms])$/));
5252
return _.sumBy(parts, (p) => parseInt(p[1], 10) * units[p[2]]);
53-
} catch (ignored) {
53+
} catch {
5454
// Invalid duration format
5555
return 0;
5656
}

web/src/components/console/utils/async.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ export class AsyncComponent extends React.Component<AsyncComponentProps, AsyncCo
5252
if (!Component) {
5353
return Promise.reject(AsyncComponentError.ComponentNotFound);
5454
}
55-
this.isAsyncMounted && this.setState({ Component });
55+
if (this.isAsyncMounted) {
56+
this.setState({ Component });
57+
}
5658
})
5759
.catch((error) => {
5860
if (error === AsyncComponentError.ComponentNotFound) {

web/src/components/console/utils/ref-width-hook.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ export const useRefWidth = () => {
66

77
const setRef = useCallback((e: HTMLDivElement) => {
88
const newWidth = e?.clientWidth;
9-
newWidth && ref.current?.clientWidth !== newWidth && setWidth(e.clientWidth);
9+
if (newWidth && ref.current?.clientWidth !== newWidth) {
10+
setWidth(e.clientWidth);
11+
}
1012
ref.current = e;
1113
}, []);
1214

@@ -23,7 +25,9 @@ export const useRefWidth = () => {
2325
const clientWidth = ref.current?.clientWidth;
2426

2527
useEffect(() => {
26-
width !== clientWidth && setWidth(clientWidth);
28+
if (width !== clientWidth) {
29+
setWidth(clientWidth);
30+
}
2731
}, [clientWidth, width]);
2832

2933
return [setRef, width] as [React.Ref<HTMLDivElement>, number];

web/src/components/console/utils/single-typeahead-dropdown.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ export const SingleTypeaheadDropdown: React.FC<SingleTypeaheadDropdownProps> = (
209209
if (enableCreateNew && value === CREATE_NEW) {
210210
if (!selectOptions.some((item) => item.value === filterValue)) {
211211
setSelectOptions([...selectOptions, { value: filterValue, children: filterValue }]);
212-
onCreate && onCreate(filterValue);
212+
if (onCreate) {
213+
onCreate(filterValue);
214+
}
213215
}
214216
selectOption(filterValue, filterValue);
215217
resetActiveAndFocusedItem();
@@ -226,8 +228,9 @@ export const SingleTypeaheadDropdown: React.FC<SingleTypeaheadDropdownProps> = (
226228
const onTextInputChange = (_event: React.FormEvent<HTMLInputElement>, value: string) => {
227229
setInputValue(value);
228230
setFilterValue(value);
229-
onInputChange && onInputChange(value);
230-
231+
if (onInputChange) {
232+
onInputChange(value);
233+
}
231234
resetActiveAndFocusedItem();
232235
};
233236

@@ -317,7 +320,9 @@ export const SingleTypeaheadDropdown: React.FC<SingleTypeaheadDropdownProps> = (
317320
setFilterValue('');
318321
resetActiveAndFocusedItem();
319322
textInputRef?.current?.focus();
320-
onClear && onClear(selectedKey);
323+
if (onClear) {
324+
onClear(selectedKey);
325+
}
321326
};
322327

323328
const selectedItemWidth = React.useMemo(() => {
@@ -343,7 +348,9 @@ export const SingleTypeaheadDropdown: React.FC<SingleTypeaheadDropdownProps> = (
343348
onClick={onInputClick}
344349
onChange={onTextInputChange}
345350
onKeyDown={(ev: React.KeyboardEvent<HTMLInputElement>) => {
346-
ev.key === 'Enter' && ev.preventDefault(); // prevent accidental form submission
351+
if (ev.key === 'Enter') {
352+
ev.preventDefault(); // prevent accidental form submission
353+
}
347354
onInputKeyDown(ev);
348355
}}
349356
id={`${ID_PREFIX}-input`}
@@ -385,7 +392,11 @@ export const SingleTypeaheadDropdown: React.FC<SingleTypeaheadDropdownProps> = (
385392
selected={selectedKey}
386393
onSelect={onSelect}
387394
onOpenChange={(open) => {
388-
open ? setIsOpen(true) : closeMenu();
395+
if (open) {
396+
setIsOpen(true);
397+
} else {
398+
closeMenu();
399+
}
389400
}}
390401
toggle={toggle}
391402
shouldFocusFirstItemOnOpen={false}

0 commit comments

Comments
 (0)