feat(usable): integrate current dbtool implementation snapshot
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -5,7 +5,7 @@ use std::process::ExitCode;
|
||||
|
||||
use db_app::{
|
||||
self, AppError, ColumnItem, ConnectResponse, ExportResponse, InspectPayload, InspectResponse,
|
||||
OperationState, QueryResponse, SchemaItem, TableItem,
|
||||
OperationState, QueryResponse, SchemaAvailability, SchemaItem, TableItem,
|
||||
};
|
||||
use db_config::ConnectionProfile;
|
||||
use db_core::{
|
||||
@@ -794,7 +794,13 @@ fn render_query_text(response: &QueryResponse) -> String {
|
||||
}
|
||||
|
||||
fn render_schema(schema: &SchemaItem) -> String {
|
||||
schema.name.clone()
|
||||
match schema.availability {
|
||||
SchemaAvailability::Ready => schema.name.clone(),
|
||||
SchemaAvailability::Restricted => match &schema.note {
|
||||
Some(note) => format!("{} [restricted] - {}", schema.name, note),
|
||||
None => format!("{} [restricted]", schema.name),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
fn render_table(table: &TableItem) -> String {
|
||||
@@ -820,6 +826,22 @@ mod tests {
|
||||
#[cfg(unix)]
|
||||
use std::{fs::Permissions, os::unix::fs::PermissionsExt};
|
||||
|
||||
#[test]
|
||||
fn render_schema_marks_restricted_entries() {
|
||||
let rendered = render_schema(&SchemaItem {
|
||||
name: String::from("restricted_probe"),
|
||||
availability: SchemaAvailability::Restricted,
|
||||
note: Some(String::from(
|
||||
"schema access is restricted: restricted_probe",
|
||||
)),
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
rendered,
|
||||
"restricted_probe [restricted] - schema access is restricted: restricted_probe"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_query_args_collects_params() {
|
||||
let args = vec![
|
||||
|
||||
Reference in New Issue
Block a user