Skip to content

Commit

Permalink
Merge pull request backstage#20736 from ivangonzalezacuna/kubernetes/…
Browse files Browse the repository at this point in the history
…exported-types

(kubernetes-react): Make sure types are exported
  • Loading branch information
Jamie Klassen authored Oct 31, 2023
2 parents 37cb79a + b52f576 commit 0ad4cca
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .changeset/old-coats-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@backstage/plugin-kubernetes-react': patch
---

Make sure types exported by other `kubernetes` plugins in the past are exported again after the creation
of the react package.

Some types have been moved to this new package but the export was missing, so they were not available anymore for developers.
35 changes: 35 additions & 0 deletions plugins/kubernetes-react/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { IContainerStatus } from 'kubernetes-models/v1';
import { IdentityApi } from '@backstage/core-plugin-api';
import { IIoK8sApimachineryPkgApisMetaV1ObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';
import { IObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';
import type { JsonObject } from '@backstage/types';
import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';
import { OAuthApi } from '@backstage/core-plugin-api';
import { ObjectsByEntityResponse } from '@backstage/plugin-kubernetes-common';
Expand Down Expand Up @@ -59,6 +60,26 @@ export const Cluster: ({
// @public (undocumented)
export const ClusterContext: React_2.Context<ClusterAttributes>;

// @public (undocumented)
export type ClusterLinksFormatter = (
options: ClusterLinksFormatterOptions,
) => URL;

// @public (undocumented)
export interface ClusterLinksFormatterOptions {
// (undocumented)
dashboardParameters?: JsonObject;
// (undocumented)
dashboardUrl?: URL;
// (undocumented)
kind: string;
// (undocumented)
object: any;
}

// @public (undocumented)
export const clusterLinksFormatters: Record<string, ClusterLinksFormatter>;

// @public
export type ClusterProps = {
clusterObjects: ClusterObjects;
Expand Down Expand Up @@ -207,6 +228,20 @@ export interface FixDialogProps {
pod: Pod_2;
}

// @public (undocumented)
export function formatClusterLink(
options: FormatClusterLinkOptions,
): string | undefined;

// @public (undocumented)
export type FormatClusterLinkOptions = {
dashboardUrl?: string;
dashboardApp?: string;
dashboardParameters?: JsonObject;
object: any;
kind: string;
};

// @public (undocumented)
export class GoogleKubernetesAuthProvider implements KubernetesAuthProvider {
constructor(authProvider: OAuthApi);
Expand Down
2 changes: 2 additions & 0 deletions plugins/kubernetes-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ export * from './hooks';
export * from './api';
export * from './kubernetes-auth-provider';
export * from './components';
export * from './utils';
export * from './types';
6 changes: 6 additions & 0 deletions plugins/kubernetes-react/src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@

import type { JsonObject } from '@backstage/types';

/**
* @public
*/
export interface ClusterLinksFormatterOptions {
dashboardUrl?: URL;
dashboardParameters?: JsonObject;
object: any;
kind: string;
}

/**
* @public
*/
export type ClusterLinksFormatter = (
options: ClusterLinksFormatterOptions,
) => URL;
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
import type { JsonObject } from '@backstage/types';
import { defaultFormatterName, clusterLinksFormatters } from './formatters';

// @Deprecated use import { FormatClusterLinkOptions } from '@backstage/kubernetes-react'
/**
* @public
*/
export type FormatClusterLinkOptions = {
dashboardUrl?: string;
dashboardApp?: string;
Expand All @@ -26,7 +28,9 @@ export type FormatClusterLinkOptions = {
kind: string;
};

// @Deprecated use import { formatClusterLink } from '@backstage/kubernetes-react'
/**
* @public
*/
export function formatClusterLink(options: FormatClusterLinkOptions) {
if (!options.dashboardUrl && !options.dashboardParameters) {
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import { aksFormatter } from './aks';
import { eksFormatter } from './eks';
import { gkeFormatter } from './gke';

/**
* @public
*/
export const clusterLinksFormatters: Record<string, ClusterLinksFormatter> = {
standard: standardFormatter,
rancher: rancherFormatter,
Expand Down
5 changes: 4 additions & 1 deletion plugins/kubernetes-react/src/utils/clusterLinks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
* limitations under the License.
*/

export { formatClusterLink } from './formatClusterLink';
export {
formatClusterLink,
type FormatClusterLinkOptions,
} from './formatClusterLink';
export { clusterLinksFormatters } from './formatters';

0 comments on commit 0ad4cca

Please sign in to comment.