Skip to content
Draft
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
2 changes: 1 addition & 1 deletion frontend/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v22.14.0
v22.19.0
47,371 changes: 25,047 additions & 22,324 deletions frontend/package-lock.json

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions frontend/src/lib/CompareUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,16 @@ export default class CompareUtils {
logger.error('Numbers of passed in runs and workflows do not match');
}

const yLabels = chain(flatten(workflowObjects.map(w => WorkflowParser.getParameters(w))))
.countBy(p => p.name) // count by parameter name
.map((k, v) => ({ name: v, count: k })) // convert to counter objects
const yLabels = (chain(flatten(workflowObjects.map(w => WorkflowParser.getParameters(w))))
.countBy((p: { name: string }) => p.name) // count by parameter name
.map((k: number, v: string) => ({ name: v, count: k })) // convert to counter objects
.orderBy('count', 'desc') // sort on count field, descending
.map(o => o.name)
.value();
.map((o: { name: string; count: number }) => o.name) as any).value();

const rows = yLabels.map(name => {
const rows = yLabels.map((name: string) => {
return workflowObjects.map(w => {
const params = WorkflowParser.getParameters(w);
const param = params.find(p => p.name === name);
const param = params.find((p: { name: string }) => p.name === name);
return param ? param.value || '' : '';
});
});
Expand Down
23 changes: 14 additions & 9 deletions frontend/src/lib/v2/CompareUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { getArtifactName, getExecutionDisplayName, LinkedArtifact } from 'src/ml
import { getMetadataValue } from 'src/mlmd/Utils';
import { Execution, Value } from 'src/third_party/mlmd';
import * as jspb from 'google-protobuf';
import { chain, flatMapDeep, flatten } from 'lodash';
import { flatMapDeep } from 'lodash';
import { stylesheet } from 'typestyle';
import { RuntimeParameters } from 'src/pages/NewRunV2';
import { V2beta1Run } from 'src/apisv2beta1/run';
Expand Down Expand Up @@ -105,12 +105,16 @@ export const getParamsTableProps = (runs: V2beta1Run[]): CompareTableProps | und
}
}

const yLabels = chain(flatten(parameterNames))
.countBy(p => p) // count by parameter name
.map((k, v) => ({ name: v, count: k })) // convert to counter objects
.orderBy('count', 'desc') // sort on count field, descending
.map(o => o.name)
.value();
const flattenedNames = parameterNames.flat();
const counts = flattenedNames.reduce((acc, name: string) => {
acc[name] = (acc[name] || 0) + 1;
return acc;
}, {} as Record<string, number>);

const yLabels: string[] = Object.entries(counts)
.map(([name, count]) => ({ name, count }))
.sort((a, b) => b.count - a.count)
.map(o => o.name);

const rows: string[][] = yLabels.map(yLabel => {
return runs.map(run => {
Expand Down Expand Up @@ -139,7 +143,7 @@ export const getValidRocCurveArtifactData = (
): RocCurveArtifactData => {
const validRocCurveIdSet: Set<string> = new Set();
const fullArtifactPathMap: FullArtifactPathMap = {};
const validLinkedArtifacts = flatMapDeep(
const validLinkedArtifacts: LinkedArtifact[] = flatMapDeep(
rocCurveRunArtifacts.map(runArtifact =>
runArtifact.executionArtifacts.map(executionArtifact => {
const validArtifacts = getValidArtifacts(executionArtifact);
Expand All @@ -157,7 +161,8 @@ export const getValidRocCurveArtifactData = (
return validArtifacts;
}),
),
);
) as LinkedArtifact[];

return {
validLinkedArtifacts,
fullArtifactPathMap,
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/mlmd/LineageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,13 @@ export class LineageView extends React.Component<LineageViewProps, LineageViewSt
}

private buildExecutionCards(executions: Execution[]): CardDetails[] {
const executionsByTypeId = groupBy(executions, e => e.getTypeId());

const executionsByTypeId = groupBy(executions, (e: Execution) => e.getTypeId());
return Object.keys(executionsByTypeId).map(typeId => {
const executionTypeName = getExecutionTypeName(Number(typeId), this.executionTypes);
const executionsForType = executionsByTypeId[typeId];
return {
title: executionTypeName,
elements: executionsForType.map(execution => ({
elements: executionsForType.map((execution: Execution) => ({
typedResource: {
type: 'execution',
resource: execution,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/RunDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ class RunDetails extends Page<RunDetailsInternalProps, RunDetailsState> {
),
),
);
const allArtifactConfigs = flatten(configLists);
const allArtifactConfigs: AnnotatedConfig[] = flatten(configLists) as AnnotatedConfig[];

this.setStateSafe({ allArtifactConfigs });
}
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@

import * as Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { TextEncoder, TextDecoder } from 'util';

Object.assign(global, {
TextEncoder: globalThis.TextEncoder || TextEncoder,
TextDecoder: globalThis.TextDecoder || TextDecoder,
});

Enzyme.configure({
adapter: new Adapter(),
Expand Down
Loading