Skip to content
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

Epic/support dynamo db #144

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Conversation

ChenChunShenG19
Copy link

@ChenChunShenG19 ChenChunShenG19 commented Dec 14, 2024

feat|fix|refactor: summary title of the PR

  1. Add a new connect option: dynamodb
  2. add configuration page for dynamodb

Refs: #142

Comment on lines +125 to +146
async saveConnection(connection:Connection) {
try {
if (connection.id) {
const index = this.connections.findIndex(c => c.id === connection.id);
if (index !== -1) {
this.connections[index] = connection;
}
} else {
connection.id = this.connections.length + 1;
this.connections.push(connection);
}

try {
await storeApi.set('connections', pureObject(this.connections));
} catch (error) {
console.warn('Failed to persist connections:', error);
}

return connection;
} catch (error) {
console.error('Error saving connection:', error);
throw error;
Copy link
Member

Choose a reason for hiding this comment

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

store the type to type like DatabaseType.ELASTICSEARCH to storeApi.set, it should help to simplify the fetchConnections as well?

Comment on lines +214 to +219
if (!(error instanceof Error && error.message.includes('__TAURI_IPC__'))) {
if (error instanceof Error) {
message.error(error.message);
} else {
message.error(lang.t('connection.unknownError'));
}
Copy link
Member

Choose a reason for hiding this comment

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

it looks worth encapsulating the error inside saveConnection, so On UI page it only needs to care about showing the message ?

Comment on lines +286 to +294
try {
await client.send(new ListTablesCommand({}));
return true;
} catch (error) {
if (error instanceof Error) {
throw new Error(error.message);
}
throw new Error('Unknown error occurred while testing connection');
}
Copy link
Member

Choose a reason for hiding this comment

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

@aws-sdk/client-dynamodb should not able to run here, since all ts/vue content running in browser rather than nodejs, so to call the dynamodb,

vue -> rust dynamo lib -> dynamodb

Copy link
Author

Choose a reason for hiding this comment

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

Oh, yes! You are right! I will update soon

Copy link
Member

@Blankll Blankll left a comment

Choose a reason for hiding this comment

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

looks great, for clusterManage, not need to add support for this pr, I think we can like:
show blank/empty for dyamodb to fix these errors and quick merge,

thanks 🚀 🚀 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants