Skip to content

Commit c4a2e25

Browse files
authored
fix: dynamo db ui query issues fix (#206)
fix: dynamo db ui query issues fix - [x] set index name to null when the user selects the main table - [x] fix scrollbar issue in UI query - [x] fix table/index selection issue when contains index name same with table name Refs: #142 --------- Signed-off-by: seven <[email protected]>
1 parent 1ef32a9 commit c4a2e25

File tree

4 files changed

+240
-172
lines changed

4 files changed

+240
-172
lines changed

src-tauri/src/dynamo/scan_table.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::dynamo::types::ApiResponse;
2+
use aws_sdk_dynamodb::error::ProvideErrorMetadata;
23
use aws_sdk_dynamodb::types::AttributeValue;
34
use aws_sdk_dynamodb::Client;
45
use serde_json::{json, Value};
@@ -185,10 +186,18 @@ pub async fn scan_table(client: &Client, input: ScanTableInput<'_>) -> Result<Ap
185186
})),
186187
})
187188
}
188-
Err(e) => Ok(ApiResponse {
189-
status: 500,
190-
message: format!("Failed to execute scan: {:?}", e),
191-
data: None,
192-
}),
189+
Err(e) => {
190+
let error_code = e.code().unwrap_or("UnknownError").to_string();
191+
let error_message = e.message().unwrap_or("UnknownError").to_string();
192+
193+
Ok(ApiResponse {
194+
status: 500,
195+
message: format!(
196+
"Failed to execute scan!\n\nerrorCode: {}\nmessage: {}",
197+
error_code, error_message
198+
),
199+
data: None,
200+
})
201+
}
193202
}
194203
}

src/datasources/dynamoApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ export type DynamoDBTableInfo = {
6565

6666
export type QueryParams = {
6767
tableName: string;
68-
indexName: string;
68+
indexName: string | null;
6969
partitionKey: {
7070
name: string;
71-
value: string;
71+
value: string | null;
7272
};
7373
sortKey?: {
7474
name: string;

src/views/editor/dynamo-editor/components/create-item.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ fetchIndices(activeConnection.value as Connection).then(() => {
391391
type: attributeType,
392392
}))
393393
.filter(({ key }) => ![partitionKey.name, sortKey?.name].filter(Boolean).includes(key));
394-
console.log('keyAttributes', dynamoRecordForm.value.keyAttributes);
395394
});
396395
</script>
397396

0 commit comments

Comments
 (0)