Skip to content
Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Updated

Augment `dx studio reports` commands to return owner field where relevant.

## 0.5.2 - 2026-06-17

### Added
Expand Down
6 changes: 6 additions & 0 deletions src/commands/studio/reports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ describe("studio reports command", () => {
markdown_notes: null,
view_access_type: "everyone",
edit_access_type: "specific_users",
owner: {
id: "usr_abc",
name: "Alice Example",
email: "[email protected]",
},
url: "https://app.example.com/datacloud/studio/reports/abc123",
tiles: [
{
Expand Down Expand Up @@ -395,6 +400,7 @@ describe("studio reports command", () => {
expect(output).toContain(
"https://app.example.com/datacloud/studio/reports/abc123",
);
expect(output).toContain("Alice Example ([email protected])");
expect(output).toContain("### Tiles");
expect(output).toContain("Weekly deploys (line)");
expect(output).not.toContain("Weekly deploys (line, tile_line)");
Expand Down
13 changes: 13 additions & 0 deletions src/commands/studio/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,20 @@ type StudioReportTile = {
chart_config: Record<string, unknown>;
};

type StudioReportOwner = {
id: string;
name: string;
email: string;
};

type StudioReport = {
id: string;
name: string | null;
description: string | null;
markdown_notes: string | null;
view_access_type: string;
edit_access_type: string;
owner: StudioReportOwner | null;
url: string;
tiles: StudioReportTile[];
created_at: string;
Expand Down Expand Up @@ -498,6 +505,7 @@ function renderStudioReport(report: StudioReport): ui.Block[] {
[
ui.dli("URL", ui.link(report.url)),
ui.dli("Description", formatOptionalText(report.description)),
ui.dli("Owner", formatOwner(report.owner)),
ui.dli("View access", formatViewAccessType(report.view_access_type)),
ui.dli("Edit access", formatEditAccessType(report.edit_access_type)),
ui.dli("Tiles", report.tiles.length.toString()),
Expand Down Expand Up @@ -642,6 +650,11 @@ function formatOptionalText(value: string | null): string {
return value && value.trim().length > 0 ? value : ui.dim("(None)");
}

function formatOwner(owner: StudioReportOwner | null): string {
if (!owner) return ui.dim("(None)");
return `${owner.name} (${owner.email})`;
}

function formatViewAccessType(value: string): string {
switch (value) {
case "owner_and_direct_url_only":
Expand Down
Loading