Skip to content
Merged
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
19 changes: 6 additions & 13 deletions src/commands/frameworks-backends-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@ import { bold } from "colorette";

const Table = require("cli-table");
const COLUMN_LENGTH = 20;
const TABLE_HEAD = [
"Backend Id",
"Repository Name",
"Location",
"URL",
"Created Date",
"Updated Date",
];
const TABLE_HEAD = ["Backend Id", "Repository", "Location", "URL", "Created Date", "Updated Date"];
export const command = new Command("backends:list")
.description("List backends of a Firebase project.")
.option("-l, --location <location>", "App Backend location", "-")
Expand All @@ -27,11 +20,11 @@ export const command = new Command("backends:list")
style: { head: ["green"] },
});
table.colWidths = COLUMN_LENGTH;
const backendsList: gcp.ListBackendsResponse[] = [];
const backendsList: gcp.Backend[] = [];
try {
const backendsPerRegion = await gcp.listBackends(projectId, location);
backendsList.push(backendsPerRegion);
populateTable(backendsPerRegion, location, table);
backendsList.push(...backendsPerRegion.backends);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just ooc what do we do if the user has 100s of backends? It doesn't look like we allow them to page through the results atm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point. will leave a bug for myself.

populateTable(backendsList, table);

logger.info();
logger.info(`Backends for project ${bold(projectId)}`);
Expand All @@ -47,8 +40,8 @@ export const command = new Command("backends:list")
return backendsList;
});

function populateTable(backendsLists: gcp.ListBackendsResponse, location: string, table: any) {
for (const backend of backendsLists.backends) {
function populateTable(backends: gcp.Backend[], table: any) {
for (const backend of backends) {
const [location, , backendId] = backend.name.split("/").slice(3, 6);
const entry = [
backendId,
Expand Down