Skip to content

Commit

Permalink
Merge pull request opendatahub-io#2881 from rsun19/delete-dead-code-s…
Browse files Browse the repository at this point in the history
…econd-pass

deleted dead code in second pass
  • Loading branch information
openshift-merge-bot[bot] authored Jun 6, 2024
2 parents 78b9cd9 + a8b1d88 commit 2f76c11
Show file tree
Hide file tree
Showing 11 changed files with 5 additions and 156 deletions.
10 changes: 2 additions & 8 deletions frontend/src/api/trustyai/k8s.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import {
k8sGetResource,
K8sStatus,
} from '@openshift/dynamic-plugin-sdk-utils';
import { K8sAPIOptions, RouteKind, TrustyAIKind } from '~/k8sTypes';
import { getRoute } from '~/api';
import { TRUSTYAI_DEFINITION_NAME, TRUSTYAI_ROUTE_NAME } from '~/concepts/trustyai/const';
import { K8sAPIOptions, TrustyAIKind } from '~/k8sTypes';
import { TRUSTYAI_DEFINITION_NAME } from '~/concepts/trustyai/const';
import { applyK8sAPIOptions } from '~/api/apiMergeUtils';
import { TrustyAIApplicationsModel } from '~/api/models/trustyai';

Expand All @@ -25,11 +24,6 @@ const trustyAIDefaultCRSpec: TrustyAIKind['spec'] = {
},
};

export const getTrustyAIAPIRoute = async (
namespace: string,
opts?: K8sAPIOptions,
): Promise<RouteKind> => getRoute(TRUSTYAI_ROUTE_NAME, namespace, opts);

export const getTrustyAICR = async (
namespace: string,
opts?: K8sAPIOptions,
Expand Down
4 changes: 0 additions & 4 deletions frontend/src/api/trustyai/rawTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,3 @@ export type BaseMetricCreationResponse = {
requestId: string;
timestamp: string;
};

export type BaseMetricDeletionRequest = {
requestId: string;
};
52 changes: 0 additions & 52 deletions frontend/src/concepts/dashboard/codeEditor/useCodeEditorAsLogs.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { getModelRegistryCR } from '~/api';
import { SupportedArea, useIsAreaAvailable } from '~/concepts/areas';
import { ModelRegistryKind } from '~/k8sTypes';
import useModelRegistryEnabled from '~/pages/modelRegistry/useModelRegistryEnabled';
import { FAST_POLL_INTERVAL, SERVER_TIMEOUT } from '~/utilities/const';
import useFetchState, {
FetchState,
Expand All @@ -18,7 +18,7 @@ export const isModelRegistryAvailable = ([state, loaded]: FetchState<State>): bo
loaded && !!state && isModelRegistryCRStatusAvailable(state);

export const useModelRegistryNamespaceCR = (namespace: string, name: string): FetchState<State> => {
const modelRegistryAreaAvailable = useIsAreaAvailable(SupportedArea.MODEL_REGISTRY).status;
const modelRegistryAreaAvailable = useModelRegistryEnabled();

const callback = React.useCallback<FetchStateCallbackPromise<State>>(
(opts) => {
Expand Down
18 changes: 1 addition & 17 deletions frontend/src/concepts/pipelines/content/tables/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
PipelineRunJobKFv2,
PipelineRunKFv2,
PipelineCoreResourceKF,
ResourceTypeKF,
ResourceReferenceKF,
} from '~/concepts/pipelines/kfTypes';
import { PipelineRunJobKFv2, PipelineRunKFv2 } from '~/concepts/pipelines/kfTypes';

export const getRunDuration = (run: PipelineRunKFv2): number => {
const finishedDate = new Date(run.finished_at);
Expand All @@ -17,16 +11,6 @@ export const getRunDuration = (run: PipelineRunKFv2): number => {
return finishedDate.getTime() - createdDate.getTime();
};

/**
* @deprecated
* Uses v1 api where resource references existed
*/
export const getResourceRef = (
resource: PipelineCoreResourceKF | null | undefined,
type: ResourceTypeKF,
): ResourceReferenceKF | undefined =>
resource?.resource_references?.find((ref) => ref.key.type === type);

export const getPipelineRunJobStartTime = (job: PipelineRunJobKFv2): Date | null => {
const startTime =
job.trigger.cron_schedule?.start_time || job.trigger.periodic_schedule?.start_time;
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/concepts/topology/utils.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { DEFAULT_TASK_NODE_TYPE, RunStatus } from '@patternfly/react-topology';
import { genRandomChars } from '~/utilities/string';
import { PipelineTask } from '~/concepts/pipelines/topology';
import { EXECUTION_TASK_NODE_TYPE, NODE_HEIGHT, NODE_WIDTH } from './const';
import { PipelineNodeModelExpanded } from './types';

export const createNodeId = (prefix = 'node'): string => `${prefix}-${genRandomChars()}`;

export const ICON_TASK_NODE_TYPE = 'ICON_TASK_NODE';

export const ARTIFACT_NODE_WIDTH = 44;
Expand Down
6 changes: 0 additions & 6 deletions frontend/src/pages/modelServing/screens/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,3 @@ export enum StorageKeys {
DEFAULT_REGION = 'region',
PATH = 'path',
}

export const STORAGE_KEYS_REQUIRED: StorageKeys[] = [
StorageKeys.ACCESS_KEY_ID,
StorageKeys.SECRET_ACCESS_KEY,
StorageKeys.S3_ENDPOINT,
];
20 changes: 0 additions & 20 deletions frontend/src/pages/modelServing/screens/metrics/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ChartThemeColor, getCustomTheme } from '@patternfly/react-charts';
import { BiasMetricType } from '~/api';
import { BiasChartConfigMap, MetricsChartTypes } from '~/pages/modelServing/screens/metrics/types';
import { ModelMetricType } from '~/pages/modelServing/screens/metrics/ModelServingMetricsContext';
Expand Down Expand Up @@ -26,10 +25,6 @@ export const EMPTY_BIAS_CHART_SELECTION_DESC =

export const BIAS_THRESHOLD_COLOR = 'var(--pf-chart-global--danger--Color--100, #c9190b)';
export const BIAS_DOMAIN_PADDING = 0.1;
export const DEFAULT_BIAS_THRESHOLD_DELTAS: { [key in BiasMetricType]: number } = {
[BiasMetricType.SPD]: 0.1,
[BiasMetricType.DIR]: 0.2,
};

export const BIAS_CHART_CONFIGS: BiasChartConfigMap = {
[BiasMetricType.SPD]: {
Expand Down Expand Up @@ -77,18 +72,3 @@ export const BIAS_CHART_CONFIGS: BiasChartConfigMap = {
},
},
};

const colorScale = [
'var(--pf-chart-color-green-300, #4cb140)',
'var(--pf-chart-global--danger--Color--100, #c9190b)',
];

const themeProps = {
bar: { colorScale },
chart: { colorScale },
group: { colorScale },
legend: { colorScale },
stack: { colorScale },
};

export const SUCCESS_FAIL_CHART_THEME = getCustomTheme(ChartThemeColor.default, themeProps);
6 changes: 0 additions & 6 deletions frontend/src/pages/modelServing/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
K8sAPIOptions,
RoleBindingKind,
ServingRuntimeKind,
DataScienceClusterKindStatus,
InferenceServiceKind,
ServiceAccountKind,
} from '~/k8sTypes';
Expand Down Expand Up @@ -298,10 +297,5 @@ export const isModelServerEditInfoChanged = (
))
: true;

export const checkModelMeshFailureStatus = (status: DataScienceClusterKindStatus): string =>
status.conditions.find(
(condition) => condition.type === 'model-meshReady' && condition.status === 'False',
)?.message || '';

export const isModelMesh = (inferenceService: InferenceServiceKind): boolean =>
inferenceService.metadata.annotations?.['serving.kserve.io/deploymentMode'] === 'ModelMesh';
11 changes: 0 additions & 11 deletions frontend/src/pages/pipelines/global/experiments/artifacts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,3 @@ export const getArtifactName = (artifact: Artifact.AsObject | undefined): string
artifact?.name ||
artifact?.customPropertiesMap.find(([name]) => name === 'display_name')?.[1].stringValue ||
'(No name)';

export function buildQuery(queriesMap?: { [key: string]: string | number | undefined }): string {
const queryContent = Object.entries(queriesMap || {})
.filter((entry): entry is [string, string | number] => entry[1] != null)
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
.join('&');
if (!queryContent) {
return '';
}
return `?${queryContent}`;
}
27 changes: 0 additions & 27 deletions frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,20 +551,6 @@ export type ImageInfo = {

export type ImageType = 'byon' | 'jupyter' | 'other';

export type PersistentVolumeClaim = K8sResourceCommon & {
spec: {
accessModes: string[];
resources: {
requests: {
storage: string;
};
};
storageClassName?: string;
volumeMode: 'Filesystem' | 'Block';
};
status?: Record<string, any>; // eslint-disable-line
};

export type Volume = {
name: string;
emptyDir?: Record<string, unknown>;
Expand All @@ -578,19 +564,6 @@ export type Volume = {

export type VolumeMount = { mountPath: string; name: string };

/**
* @deprecated -- use K8sStatus
* Copy from partial of V1Status that will returned by the delete CoreV1Api
*/
export type DeleteStatus = {
apiVersion?: string;
code?: number;
kind?: string;
message?: string;
reason?: string;
status?: string;
};

export type RoleBindingSubject = {
kind: string;
apiGroup: string;
Expand Down

0 comments on commit 2f76c11

Please sign in to comment.