Skip to content

Commit

Permalink
Rename "Top-Level" to "Data Series"
Browse files Browse the repository at this point in the history
  • Loading branch information
julieg18 committed Sep 19, 2023
1 parent 403e93f commit 6233c89
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 24 deletions.
2 changes: 1 addition & 1 deletion extension/src/pipeline/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class Pipeline extends DeferredDisposable {
return this.addPipeline()
}

public async addTopLevelPlot() {
public async addDataSeriesPlot() {
const cwd = await this.getCwd()

if (!cwd) {
Expand Down
4 changes: 2 additions & 2 deletions extension/src/pipeline/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ export class WorkspacePipeline extends BaseWorkspace<Pipeline> {
)
}

public async addTopLevelPlot(overrideRoot?: string) {
public async addDataSeriesPlot(overrideRoot?: string) {
const cwd = overrideRoot || (await this.getCwd())

if (!cwd) {
return
}

void this.getRepository(cwd).addTopLevelPlot()
void this.getRepository(cwd).addDataSeriesPlot()
}

private getCwd() {
Expand Down
6 changes: 3 additions & 3 deletions extension/src/plots/quickPick.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ describe('pickPlotType', () => {
[
{
description:
'Create a top-level plot definition by selecting data from a file',
label: 'Top-Level',
value: 'top-level'
'Create a data series plot definition by selecting data from a file',
label: 'Data Series',
value: 'data-series'
},
{
description:
Expand Down
8 changes: 4 additions & 4 deletions extension/src/plots/quickPick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import { Title } from '../vscode/title'

export const enum PLOT_TYPE {
CUSTOM = 'custom',
TOP_LEVEL = 'top-level'
DATA_SERIES = 'data-series'
}

export const pickPlotType = () =>
quickPickValue(
[
{
description:
'Create a top-level plot definition by selecting data from a file',
label: 'Top-Level',
value: PLOT_TYPE.TOP_LEVEL
'Create a data series plot definition by selecting data from a file',
label: 'Data Series',
value: PLOT_TYPE.DATA_SERIES
},
{
description:
Expand Down
4 changes: 2 additions & 2 deletions extension/src/plots/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ export class WorkspacePlots extends BaseWorkspaceWebviews<Plots, PlotsData> {
await this.addCustomPlot(overrideRoot)
}

if (response === PLOT_TYPE.TOP_LEVEL) {
await pipelines.addTopLevelPlot(overrideRoot)
if (response === PLOT_TYPE.DATA_SERIES) {
await pipelines.addDataSeriesPlot(overrideRoot)
}

sendTelemetryEvent(
Expand Down
6 changes: 3 additions & 3 deletions extension/src/test/suite/pipeline/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ suite('Pipeline Test Suite', () => {
})
})

it('should add a top-level plot', async () => {
it('should add a data series plot', async () => {
const { pipeline } = buildPipeline({
disposer: disposable,
dvcRoot: dvcDemoPath
Expand All @@ -304,7 +304,7 @@ suite('Pipeline Test Suite', () => {

mockPickPlotConfiguration.onFirstCall().resolves(undefined)

await pipeline.addTopLevelPlot()
await pipeline.addDataSeriesPlot()

expect(mockPickPlotConfiguration).to.be.calledOnce
expect(mockAddPlotToDvcFile).not.to.be.called
Expand All @@ -316,7 +316,7 @@ suite('Pipeline Test Suite', () => {
y: 'acc'
})

await pipeline.addTopLevelPlot()
await pipeline.addDataSeriesPlot()

expect(mockPickPlotConfiguration).to.be.calledTwice
expect(mockAddPlotToDvcFile).to.be.called
Expand Down
20 changes: 11 additions & 9 deletions extension/src/test/suite/plots/workspace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,21 @@ suite('Workspace Plots Test Suite', () => {
})

describe('dvc.addPlot', () => {
it('should be able to add a top-level plot', async () => {
it('should be able to add a data series plot', async () => {
const mockPickPlotType = stub(quickPickUtil, 'pickPlotType')
const mockAddTopLevelPlot = stub(
const mockAddDataSeriesPlot = stub(
WorkspacePipeline.prototype,
'addTopLevelPlot'
'addDataSeriesPlot'
)

mockPickPlotType.onFirstCall().resolves(quickPickUtil.PLOT_TYPE.TOP_LEVEL)
mockAddTopLevelPlot.onFirstCall().resolves(undefined)
mockPickPlotType
.onFirstCall()
.resolves(quickPickUtil.PLOT_TYPE.DATA_SERIES)
mockAddDataSeriesPlot.onFirstCall().resolves(undefined)

await commands.executeCommand(RegisteredCommands.ADD_PLOT)

expect(mockAddTopLevelPlot).to.be.calledOnce
expect(mockAddDataSeriesPlot).to.be.calledOnce
})

it('should be able to add a custom plot', async () => {
Expand Down Expand Up @@ -75,9 +77,9 @@ suite('Workspace Plots Test Suite', () => {

it('should not add a plot if users cancels', async () => {
const mockPickPlotType = stub(quickPickUtil, 'pickPlotType')
const mockAddTopLevelPlot = stub(
const mockAddDataSeriesPlot = stub(
WorkspacePipeline.prototype,
'addTopLevelPlot'
'addDataSeriesPlot'
)
const mockGetMetricAndParam = stub(
customPlotQuickPickUtil,
Expand All @@ -88,7 +90,7 @@ suite('Workspace Plots Test Suite', () => {

await commands.executeCommand(RegisteredCommands.ADD_PLOT)

expect(mockAddTopLevelPlot).not.to.be.called
expect(mockAddDataSeriesPlot).not.to.be.called
expect(mockGetMetricAndParam).not.to.be.called
})

Expand Down

0 comments on commit 6233c89

Please sign in to comment.