Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,20 @@ For current development version of Console, use `4.x.0-prerelease.n` packages.
For older 1.x plugin SDK packages, refer to "OpenShift Console Versions vs SDK Versions" compatibility
table in [Console dynamic plugins README](./README.md).

## 4.21.0-prerelease.x - TBD
## 4.21.0-prerelease.1 - 2025-12-04

- Deprecated `setPluginStore` function in `k8s-utils.ts`. The function is now a noop and the export
- **Deprecated**: `setPluginStore` function in `k8s-utils.ts`. The function is now a noop and the export
will be removed in a future release. ([CONSOLE-4840], [#15671])
- Fix `popupComponent` prop type in extension `console.dashboards/overview/health/resource` ([CONSOLE-4796], [#15526])
- Begin alignment of plugin SDK types with `@openshift/dynamic-plugin-sdk` ([CONSOLE-3769], [#15509])
- **Type breaking**: Fix `popupComponent` prop type in extension `console.dashboards/overview/health/resource` ([CONSOLE-4796], [#15526])
- **Type breaking**: `AlwaysOnExtension` and `ModelDefinition` types are removed from `api/common-types`. ([CONSOLE-3769], [#15509])
- The following types are now re-exported from `@openshift/dynamic-plugin-sdk` instead of being defined
locally: `ExtensionFlags`, `ExtensionTypeGuard`, `ResolvedCodeRefProperties`, `RemoteEntryModule`, and `Update`. ([CONSOLE-4840], [#15509], [#15671])
- Add optional `fetch` property to extension `console.dashboards/overview/health/url` ([CONSOLE-4796], [#15526])
- Add optional `infrastructure` parameter to `PrometheusHealthHandler` type ([CONSOLE-4796], [#15526])
- Allow `K8sResourceKind` in `TopologyDataObject`, `TopologyResourcesObject`, and `OverviewItem` types ([CONSOLE-4840], [#15699])
- Allow async functions for the `resources` property of `console.topology/data/factory` extension ([CONSOLE-4806], [#15641])
- Add color theme and font size customization to `ResourceYAMLEditor` component ([CONSOLE-4701], [#15735])
- Ensure proper pass-through of `props.editorProps.theme` and `props.options.fontFamily` to `CodeEditor` component ([CONSOLE-4701], [#15735])

## 4.20.0 - 2025-11-24

Expand Down Expand Up @@ -145,6 +149,7 @@ table in [Console dynamic plugins README](./README.md).
[CONSOLE-4576]: https://issues.redhat.com/browse/CONSOLE-4576
[CONSOLE-4654]: https://issues.redhat.com/browse/CONSOLE-4654
[CONSOLE-4656]: https://issues.redhat.com/browse/CONSOLE-4656
[CONSOLE-4701]: https://issues.redhat.com/browse/CONSOLE-4701
[CONSOLE-4796]: https://issues.redhat.com/browse/CONSOLE-4796
[CONSOLE-4806]: https://issues.redhat.com/browse/CONSOLE-4806
[CONSOLE-4840]: https://issues.redhat.com/browse/CONSOLE-4840
Expand Down Expand Up @@ -212,3 +217,4 @@ table in [Console dynamic plugins README](./README.md).
[#15641]: https://github.com/openshift/console/pull/15641
[#15671]: https://github.com/openshift/console/pull/15671
[#15699]: https://github.com/openshift/console/pull/15699
[#15735]: https://github.com/openshift/console/pull/15735
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ For current development version of Console, use `4.x.0-prerelease.n` packages.
For older 1.x plugin SDK packages, refer to "OpenShift Console Versions vs SDK Versions" compatibility
table in [Console dynamic plugins README](./README.md).

## 4.21.0-prerelease.1 - 2025-12-04

- Remove usage of direct `webpack` imports in favor of `compiler.webpack` ([OCPBUGS-66345], [#15802])

## 4.20.0 - 2025-11-24

> Initial release for OCP Console 4.20.
Expand Down Expand Up @@ -98,6 +102,7 @@ table in [Console dynamic plugins README](./README.md).
[OCPBUGS-53030]: https://issues.redhat.com/browse/OCPBUGS-53030
[OCPBUGS-55323]: https://issues.redhat.com/browse/OCPBUGS-55323
[OCPBUGS-61569]: https://issues.redhat.com/browse/OCPBUGS-61569
[OCPBUGS-66345]: https://issues.redhat.com/browse/OCPBUGS-66345
[#13188]: https://github.com/openshift/console/pull/13188
[#13388]: https://github.com/openshift/console/pull/13388
[#13521]: https://github.com/openshift/console/pull/13521
Expand All @@ -115,3 +120,4 @@ table in [Console dynamic plugins README](./README.md).
[#14993]: https://github.com/openshift/console/pull/14993
[#15183]: https://github.com/openshift/console/pull/15183
[#15479]: https://github.com/openshift/console/pull/15479
[#15802]: https://github.com/openshift/console/pull/15802
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as coreApi from '../core-api';
import * as internalApi from '../internal-api';

describe('@openshift-console/dynamic-plugin-sdk/lib/api/core-api', () => {
Object.entries(coreApi).forEach(([exportName, exportValue]) => {
it(`should export ${exportName}`, () => {
expect(exportValue).toBeDefined();
});
});
});

describe('@openshift-console/dynamic-plugin-sdk-internal/lib/api/internal-api', () => {
Object.entries(internalApi).forEach(([exportName, exportValue]) => {
it(`should export ${exportName}`, () => {
expect(exportValue).toBeDefined();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const UtilizationItem: React.FC<UtilizationItemProps> = require('@console
.default;

export const UtilizationBody: React.FC<UtilizationBodyProps> = require('@console/shared/src/components/dashboard/utilization-card/UtilizationBody')
.default;
.UtilizationBody;

export const UtilizationDurationDropdown: React.FC<UtilizationDurationDropdownProps> = require('@console/shared/src/components/dashboard/utilization-card/UtilizationDurationDropdown')
.UtilizationDurationDropdown;
Expand All @@ -68,7 +68,7 @@ export const LazyActionMenu: React.FC<LazyActionMenuProps> = require('@console/s
.default;

export const QuickStartsLoader: React.FC<QuickStartsLoaderProps> = require('@console/app/src/components/quick-starts/loader/QuickStartsLoader')
.default;
.QuickStartsLoader;

export const useUtilizationDuration: UseUtilizationDuration = require('@console/shared/src/hooks/useUtilizationDuration')
.useUtilizationDuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export const getTopologyNodeItem: GetTopologyNodeItem = require('@console/topolo
export const mergeGroup: MergeGroup = require('@console/topology/src/data-transforms/transform-utils')
.mergeGroup;

export const getModifyApplicationAction: GetModifyApplicationAction = require('@console/topology/src/actions/modify-application')
.getModifyApplicationAction;
export const useGetModifyApplicationAction: GetModifyApplicationAction = require('@console/topology/src/actions/modify-application')
.useGetModifyApplicationAction;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pcbailey @adamviktora Hi, do you know if this breaks Kubevirt plugin's topology integration?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual code change is already merged in Console 4.21 branch, so we'll need to update Kubevirt plugin 4.21 code to use a newer version of @openshift-console/dynamic-plugin-sdk-internal package.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vojtechszocs That function is used in src/views/topology/hooks/useModifyApplicationActionProvider.ts, so I would assume this is a breaking change. It should be a simple fix, though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pcbailey Thanks, I'll post a fix for Kubevirt plugin once Console 4.21 plugin SDK packages are published.


export const baseDataModelGetter: BaseDataModelGetter = require('@console/topology/src/data-transforms/data-transformer')
.baseDataModelGetter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import * as _ from 'lodash';
import * as webpack from 'webpack';
import type * as webpack from 'webpack';
import { ConsolePluginBuildMetadata } from '../build-types';
import { isEncodedCodeRef, parseEncodedCodeRefValue } from '../coderefs/coderef-resolver';
import { Extension, EncodedCodeRef } from '../types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as webpack from 'webpack';
import type * as webpack from 'webpack';
import { Extension } from '../../types';
import { collectCodeRefData, findWebpackModules, ExtensionValidator } from '../ExtensionValidator';
import { ValidationResult } from '../ValidationResult';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as glob from 'glob';
import * as _ from 'lodash';
import * as readPkg from 'read-pkg';
import * as semver from 'semver';
import * as webpack from 'webpack';
import type * as webpack from 'webpack';
import { ConsolePluginBuildMetadata, ConsolePluginPackageJSON } from '../build-types';
import { extensionsFile } from '../constants';
import {
Expand Down Expand Up @@ -437,7 +437,7 @@ export class ConsoleRemotePlugin implements webpack.WebpackPluginInstance {
);

if (result.hasErrors()) {
const error = new webpack.WebpackError('ExtensionValidator has reported errors');
const error = new compiler.webpack.WebpackError('ExtensionValidator has reported errors');
error.details = result.formatErrors();
error.file = extensionsFile;
compilation.errors.push(error);
Expand All @@ -457,7 +457,7 @@ export class ConsoleRemotePlugin implements webpack.WebpackPluginInstance {
compiler.hooks.thisCompilation.tap(ConsoleRemotePlugin.name, (compilation) => {
const modifiedModules: string[] = [];

webpack.NormalModule.getCompilationHooks(compilation).beforeLoaders.tap(
compiler.webpack.NormalModule.getCompilationHooks(compilation).beforeLoaders.tap(
ConsoleRemotePlugin.name,
(loaders, normalModule) => {
const { userRequest } = normalModule;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as path from 'path';
import * as webpack from 'webpack';
import type * as webpack from 'webpack';
import { getExtensionsFilePath } from '@console/plugin-sdk/src/codegen/active-plugins';
import { PluginPackage } from '@console/plugin-sdk/src/codegen/plugin-resolver';
import { ConsolePluginPackageJSON } from '../build-types';
Expand Down Expand Up @@ -34,7 +34,7 @@ export class ExtensionValidatorPlugin implements webpack.WebpackPluginInstance {
);

if (result.hasErrors()) {
const error = new webpack.WebpackError(
const error = new compiler.webpack.WebpackError(
`ExtensionValidator has reported errors for plugin ${pkg.name}`,
);
error.details = result.formatErrors();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as ts from 'typescript';
import * as webpack from 'webpack';
import type * as webpack from 'webpack';
import { DynamicModuleMap } from '../../utils/dynamic-module-parser';

export type DynamicModuleImportLoaderOptions = {
Expand Down
54 changes: 10 additions & 44 deletions frontend/webpack.circular-deps.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env node */
/* eslint-disable no-console */

import * as webpack from 'webpack';
import type * as webpack from 'webpack';
import * as path from 'path';
import * as fs from 'fs';
import * as CircularDependencyPlugin from 'circular-dependency-plugin';
Expand All @@ -14,17 +14,6 @@ type PresetOptions = {
exclude?: RegExp;
/** Path to write the cycle report to */
reportFile: string;
/** Thresholds for the number of cycles detected before emitting an error */
thresholds?: Partial<{
/**
* Maximum number of total cycles permitted. Defaults to 0
*/
totalCycles: number;
/**
* Maximum number of min-length cycles (A -\> B -\> A) permitted. Defaults to 0
*/
minLengthCycles: number;
}>;
};

type DetectedCycle = {
Expand Down Expand Up @@ -84,30 +73,6 @@ const getCycleEntries = (cycles: DetectedCycle[]): string => {
return cycles.map((c) => `${c.causedBy}\n ${c.modulePaths.join('\n ')}\n`).join('\n');
};

const applyThresholds = (
cycles: DetectedCycle[],
thresholds: PresetOptions['thresholds'],
compilation: webpack.Compilation,
) => {
const totalCycles = cycles.length;
if (totalCycles > thresholds.totalCycles) {
compilation.errors.push(
new webpack.WebpackError(
`${HandleCyclesPluginName}: total cycles (${totalCycles}) exceeds threshold (${thresholds.totalCycles})`,
),
);
}

const minLengthCycles = minLengthCycleCount(cycles);
if (minLengthCycles > thresholds.minLengthCycles) {
compilation.errors.push(
new webpack.WebpackError(
`${HandleCyclesPluginName}: min-length cycles (${minLengthCycles}) exceeds threshold (${thresholds.minLengthCycles})`,
),
);
}
};

export class CircularDependencyPreset {
constructor(private readonly options: PresetOptions) {}

Expand All @@ -129,6 +94,7 @@ export class CircularDependencyPreset {
return;
}

// write report
const header = `webpack compilation ${compilation.getStats().hash}\n`;

const reportPath = path.resolve(__dirname, this.options.reportFile);
Expand All @@ -137,16 +103,16 @@ export class CircularDependencyPreset {
[header, getCycleStats(cycles), getCycleEntries(cycles)].join('\n'),
);

console.log(chalk.bold.yellow(`Detected ${cycles.length} cycles`));
console.log(chalk.bold.red(`Detected ${cycles.length} cycles`));
console.log(`Module cycle report written to ${chalk.bold(reportPath)}`);

applyThresholds(
cycles,
{
totalCycles: this.options.thresholds?.totalCycles ?? 0,
minLengthCycles: this.options.thresholds?.minLengthCycles ?? 0,
},
compilation,
// throw build error
const minLengthCycles = minLengthCycleCount(cycles);

compilation.errors.push(
new compiler.webpack.WebpackError(
`${HandleCyclesPluginName}: ${cycles.length} total cycles detected, ${minLengthCycles} of which are min-length :-(`,
),
);
});
},
Expand Down