Skip to content

allow exporting remote collection #2813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 21, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,18 @@ export class ApiService {
async getCollection(
collectionServerId: string
): Promise<IQueryCollection | undefined> {
const res = await apiClient.getCollection(collectionServerId);
if (!res) {
try {
const res = await apiClient.getCollection(collectionServerId);
if (!res) {
return;
}

return serverCollectionToLocalCollection(res);
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);

Choose a reason for hiding this comment

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

medium

Consider adding more context to the error message, such as the collectionServerId, to aid in debugging.

Suggested change
console.error(e);
console.error(`Error fetching collection ${collectionServerId}:`, e);

return;
}

return serverCollectionToLocalCollection(res);
}

async getCollections(): Promise<IQueryCollection[]> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,19 @@ export class QueryCollectionService {
}

collection.queries = collection.queries.map((query) => {
return { ...query, id: uuid(), created_at: now, updated_at: now };
return {
...query,
storageType: 'local',
id: uuid(),
created_at: now,
updated_at: now,
};
Comment on lines +120 to +126

Choose a reason for hiding this comment

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

medium

The storageType is being assigned here. It's also assigned later when adding to the storage. Consider consolidating this to avoid redundancy.

      return {
        ...query,
        id: uuid(),
        created_at: now,
        updated_at: now,
      };

});

return this.storage.queryCollections.add({
...collection,
storageType: 'local',
Comment on lines 130 to +131

Choose a reason for hiding this comment

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

medium

The storageType is being assigned here as well. Consider consolidating the storageType assignment to a single location.

      ...collection,
      workspaceId: WORKSPACES.LOCAL,
      id: collectionId ?? uuid(),

workspaceId: WORKSPACES.LOCAL,
id: collectionId ?? uuid(),
parentPath,
created_at: now,
Expand Down Expand Up @@ -694,7 +702,7 @@ export class QueryCollectionService {
}

async getCollectionTreeByCollectionId(collectionId: CollectionID) {
const collection = await this.getLocalCollectionByID(collectionId);
const collection = await this.getCollectionByID(collectionId);
if (!collection) {
throw new Error('Collection not found!');
}
Expand Down
21 changes: 21 additions & 0 deletions packages/altair-app/src/scss/_ant-overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,29 @@
.ant-modal-confirm-body .ant-modal-confirm-content {
color: var(--theme-font-color);
}
.ant-btn {
// background: var(--theme-off-bg-color);
// color: var(--theme-font-color);
// border-color: var(--theme-border-color);
border-radius: 4px;
// font-size: fontsize(12);
// padding: 0.5rem 1rem;
}
.ant-btn-primary {
background-color: var(--primary-color);
border-color: var(--primary-color);
color: var(--theme-font-color);
}
.ant-btn-primary:focus,
.ant-btn-primary:hover {
background-color: var(--primary-color);
border-color: var(--primary-color);
color: var(--theme-font-color);
}
.ant-btn:focus,
.ant-btn:hover {
color: var(--primary-color);
border-color: var(--primary-color);
Comment on lines +62 to +65

Choose a reason for hiding this comment

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

medium

These styles are quite broad and could potentially affect other buttons in the application unintentionally. Consider using a more specific class or nesting these styles within a more specific context to avoid unintended side effects.

.altair-app .ant-btn:focus,
.altair-app .ant-btn:hover {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

}

.anticon {
Expand Down
Loading