Skip to content

Commit

Permalink
[UI - multiuser] Fix pod log namespace source (#3477)
Browse files Browse the repository at this point in the history
* Fix pod log namespace source

* Fix unit tests
  • Loading branch information
Bobgy authored Apr 8, 2020
1 parent bcb16ef commit 100369a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
3 changes: 2 additions & 1 deletion frontend/src/lib/RunUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
} from '../apis/run';
import { logger } from './Utils';
import WorkflowParser from './WorkflowParser';
import { ApiExperiment } from 'src/apis/experiment';

export interface MetricMetadata {
count: number;
Expand Down Expand Up @@ -117,7 +118,7 @@ function getAllExperimentReferences(run?: ApiRun | ApiJob): ApiResourceReference
);
}

function getNamespaceReferenceName(run?: ApiRun | ApiJob): string | undefined {
function getNamespaceReferenceName(run?: ApiExperiment): string | undefined {
// There should be only one namespace reference.
const namespaceRef =
run &&
Expand Down
7 changes: 1 addition & 6 deletions frontend/src/pages/RunDetails.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1021,14 +1021,9 @@ describe('RunDetails', () => {

it("loads logs in run's namespace", async () => {
testRun.pipeline_runtime!.workflow_manifest = JSON.stringify({
metadata: { namespace: 'username' },
status: { nodes: { node1: { id: 'node1' } } },
});
testRun.run!.resource_references = [
{
key: { type: ApiResourceType.NAMESPACE, id: 'username' },
relationship: ApiRelationship.OWNER,
},
];
tree = shallow(<RunDetails {...generateProps()} />);
await getRunSpy;
await TestUtils.flushPromises();
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 @@ -784,7 +784,7 @@ export class RunDetails extends Page<RunDetailsInternalProps, RunDetailsState> {
try {
const logs = await Apis.getPodLogs(
selectedNodeDetails.id,
RunUtils.getNamespaceReferenceName(this.state.runMetadata),
this.state.workflow?.metadata?.namespace,
);
selectedNodeDetails.logs = logs;
this.setStateSafe({
Expand Down

0 comments on commit 100369a

Please sign in to comment.