feat(transwarp): add Inceptor data source with table operations
This commit is contained in:
1 parent
597b134d21
commit
6fdc338348
101 files changed
+2300
-66
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -2885,6 +2885,9 @@ function applyProfile(val: string, preserveConnectionFields = false) {
|
||||
jdbcDriverPathsInput.value = "";
|
||||
jdbcManualClasspathOpen.value = true;
|
||||
}
|
||||
if (profile.type === "transwarp") {
|
||||
form.value.connection_string = undefined;
|
||||
}
|
||||
if (profile.type === "spanner") {
|
||||
// Google Cloud endpoints carry no host; the local emulator is opted into
|
||||
// by typing host `localhost` and port 9010 explicitly.
|
||||
@@ -2940,7 +2943,7 @@ function applyProfile(val: string, preserveConnectionFields = false) {
|
||||
if (profile.type === "salesforce") {
|
||||
resetSalesforceOAuthFields(form.value.external_config, form.value.password);
|
||||
}
|
||||
resetHiveKerberosFields(profile.type === "hive" || profile.type === "argo" || profile.type === "kyuubi" || profile.type === "impala" ? form.value : undefined);
|
||||
resetHiveKerberosFields(profile.type === "hive" || profile.type === "argo" || profile.type === "transwarp" || profile.type === "kyuubi" || profile.type === "impala" ? form.value : undefined);
|
||||
}
|
||||
if (profile.type === "meilisearch") {
|
||||
syncMeilisearchHostInput(form.value);
|
||||
@@ -3174,7 +3177,7 @@ watch(
|
||||
resetSalesforceOAuthFields(undefined, undefined);
|
||||
}
|
||||
resetElasticsearchProxyFields(config.db_type === "elasticsearch" ? config.external_config : undefined);
|
||||
resetHiveKerberosFields(config.db_type === "hive" || config.db_type === "argo" || config.db_type === "kyuubi" || config.db_type === "impala" ? config : undefined);
|
||||
resetHiveKerberosFields(config.db_type === "hive" || config.db_type === "argo" || config.db_type === "transwarp" || config.db_type === "kyuubi" || config.db_type === "impala" ? config : undefined);
|
||||
resetDamengJvmOptions(config.db_type === "dameng" ? config : undefined);
|
||||
h2ConnectionMode.value = h2ConnectionModeForConfig(config);
|
||||
customColorInput.value = config.color || "";
|
||||
@@ -4696,7 +4699,7 @@ function connectionConfigForSubmit(id: string, generatedName = "", validatePlugi
|
||||
config.ssl = !!config.ssl || damengSsl.enabled;
|
||||
config.url_params = applyDamengSslUrlParams(config.url_params, config.ssl, damengSsl.sslFilesPath, damengSsl.sslKeystorePassword, damengSsl.sslProtocol);
|
||||
}
|
||||
if (config.db_type === "hive" || config.db_type === "argo" || config.db_type === "kyuubi" || config.db_type === "impala") {
|
||||
if (config.db_type === "hive" || config.db_type === "argo" || config.db_type === "transwarp" || config.db_type === "kyuubi" || config.db_type === "impala") {
|
||||
if (hiveAuthMode.value === "kerberos" && !hivePrincipal.value.trim()) {
|
||||
throw new Error(t("connection.hiveKerberosPrincipalRequired"));
|
||||
}
|
||||
@@ -5093,6 +5096,10 @@ function connectionConfigForSubmit(id: string, generatedName = "", validatePlugi
|
||||
config.jdbc_driver_class = undefined;
|
||||
config.jdbc_driver_paths = [];
|
||||
}
|
||||
if (config.db_type === "transwarp") {
|
||||
config.jdbc_driver_class = undefined;
|
||||
config.jdbc_driver_paths = [];
|
||||
}
|
||||
if (config.db_type === "h2") {
|
||||
if (config.driver_profile === "h2-custom") {
|
||||
config.jdbc_driver_class = config.jdbc_driver_class?.trim() || "org.h2.Driver";
|
||||
@@ -8880,7 +8887,7 @@ function openExternalUrl(url: string) {
|
||||
<p class="col-span-3 text-xs text-muted-foreground">{{ t("connection.oracleTnsPathHint") }}</p>
|
||||
</div>
|
||||
|
||||
<template v-if="form.db_type === 'hive' || form.db_type === 'kyuubi' || form.db_type === 'impala'">
|
||||
<template v-if="form.db_type === 'hive' || form.db_type === 'transwarp' || form.db_type === 'kyuubi' || form.db_type === 'impala'">
|
||||
<div class="grid grid-cols-4 items-center gap-4">
|
||||
<Label :class="connectionLabelClass">{{ t("connection.hiveAuthMode") }}</Label>
|
||||
<div class="col-span-3 grid h-8 grid-cols-2 overflow-hidden rounded-md border border-input bg-muted/30 p-0.5">
|
||||
@@ -9023,7 +9030,9 @@ function openExternalUrl(url: string) {
|
||||
? 'catalog=paimon_catalog'
|
||||
: form.db_type === 'cassandra'
|
||||
? 'localdatacenter=dc1'
|
||||
: 'sslmode=prefer'
|
||||
: form.db_type === 'transwarp'
|
||||
? 'fetchSize=500;auth=noSasl'
|
||||
: 'sslmode=prefer'
|
||||
"
|
||||
/>
|
||||
<p v-if="showGenericUrlParamsHint" class="text-xs leading-5 text-muted-foreground">
|
||||
|
||||
@@ -3409,13 +3409,14 @@ const canDeleteExistingRows = computed(() => !!props.customSaveHandler || canDel
|
||||
watch(
|
||||
() => [props.databaseType, props.connectionId, props.database, props.tableMeta?.schema, props.tableMeta?.tableName],
|
||||
async () => {
|
||||
if (props.databaseType !== "hive" || !props.connectionId || !props.database || !props.tableMeta) {
|
||||
if ((props.databaseType !== "hive" && props.databaseType !== "transwarp") || !props.connectionId || !props.database || !props.tableMeta) {
|
||||
hiveTableTransactional.value = undefined;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const sql = await buildHiveTablePropertiesSql({
|
||||
schema: props.tableMeta.schema,
|
||||
databaseType: props.databaseType,
|
||||
schema: props.tableMeta.schema || props.database,
|
||||
tableName: props.tableMeta.tableName,
|
||||
propertyName: "transactional",
|
||||
});
|
||||
|
||||
@@ -66,6 +66,11 @@ describe("ConnectionIcon", () => {
|
||||
expect(listPlugins).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("shows the Inceptor logo for a saved Transwarp connection", async () => {
|
||||
const container = await mountIcon({ ...connection, db_type: "transwarp", driver_profile: "transwarp-inceptor" });
|
||||
expect(container.querySelector("img")?.getAttribute("src")).toBe("/icons/database/transwarp-inceptor.png");
|
||||
});
|
||||
|
||||
it("renders a safe fallback for missing connection metadata", async () => {
|
||||
const container = await mountIcon();
|
||||
expect(container.querySelector("img")?.getAttribute("src")).toBe("/icons/database/postgres.svg");
|
||||
|
||||
@@ -55,6 +55,17 @@ describe("DatabaseIcon", () => {
|
||||
app.unmount();
|
||||
});
|
||||
|
||||
it.each(["transwarp", "transwarp-inceptor"])("uses the Inceptor asset for %s", async (dbType) => {
|
||||
const container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
const app = createApp(DatabaseIcon, { dbType });
|
||||
app.mount(container);
|
||||
await nextTick();
|
||||
|
||||
expect(container.querySelector("img")?.getAttribute("src")).toBe("/icons/database/transwarp-inceptor.png");
|
||||
app.unmount();
|
||||
});
|
||||
|
||||
it("uses the Meilisearch asset", async () => {
|
||||
const container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
|
||||
@@ -60,6 +60,8 @@ const assetIcons: Record<string, string> = {
|
||||
prestosql: "presto",
|
||||
hive: "hive",
|
||||
argo: "hive",
|
||||
transwarp: "transwarp-inceptor.png",
|
||||
transwarp_inceptor: "transwarp-inceptor.png",
|
||||
kyuubi: "kyuubi.png",
|
||||
impala: "impala",
|
||||
hbase: "hbase",
|
||||
@@ -129,6 +131,7 @@ const assetIcons: Record<string, string> = {
|
||||
const normalizedType = computed(() => (props.dbType || "").toLowerCase().replace(/[\s-]+/g, "_"));
|
||||
const assetName = computed(() => assetIcons[normalizedType.value]);
|
||||
const useLightIconInDarkMode = computed(() => normalizedType.value === "easysearch" && isDark.value);
|
||||
const brightenInceptorInDarkMode = computed(() => isDark.value && (normalizedType.value === "transwarp" || normalizedType.value === "transwarp_inceptor"));
|
||||
const assetSrc = computed(() => {
|
||||
if (!assetName.value) return "";
|
||||
if (normalizedType.value === "uxdb" && isDark.value) return webPath("/icons/database/uxdb-dark.svg");
|
||||
@@ -137,7 +140,14 @@ const assetSrc = computed(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<img v-if="assetName" :src="assetSrc" alt="" class="database-logo object-contain" :class="{ 'database-logo-light': useLightIconInDarkMode, 'database-logo-impala': normalizedType === 'impala', 'database-logo-solr': normalizedType === 'solr' }" aria-hidden="true" />
|
||||
<img
|
||||
v-if="assetName"
|
||||
:src="assetSrc"
|
||||
alt=""
|
||||
class="database-logo object-contain"
|
||||
:class="{ 'database-logo-light': useLightIconInDarkMode, 'database-logo-inceptor-dark': brightenInceptorInDarkMode, 'database-logo-impala': normalizedType === 'impala', 'database-logo-solr': normalizedType === 'solr' }"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<Database v-else class="text-blue-400" />
|
||||
</template>
|
||||
|
||||
@@ -151,6 +161,10 @@ const assetSrc = computed(() => {
|
||||
filter: brightness(0) invert(82%);
|
||||
}
|
||||
|
||||
.database-logo-inceptor-dark {
|
||||
filter: brightness(1.6);
|
||||
}
|
||||
|
||||
.database-logo-impala {
|
||||
transform: scale(1.55);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from "vue";
|
||||
import { ChevronDown } from "@lucide/vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import type { TablePhysicalOptionsConfig, TablePhysicalOptionsDraft } from "@/lib/table/tablePhysicalOptions";
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: TablePhysicalOptionsDraft;
|
||||
config: TablePhysicalOptionsConfig;
|
||||
columns: Array<{ id: string; name: string }>;
|
||||
disabled?: boolean;
|
||||
}>();
|
||||
const emit = defineEmits<{ "update:modelValue": [value: TablePhysicalOptionsDraft] }>();
|
||||
const { t } = useI18n();
|
||||
const search = ref({ partition: "", distribution: "" });
|
||||
type ColumnGroup = "partition" | "distribution";
|
||||
const columnGroups = computed(() => [
|
||||
{ key: "partition" as const, label: props.config.partitionColumnsLabel },
|
||||
{ key: "distribution" as const, label: props.config.distributionColumnsLabel },
|
||||
]);
|
||||
|
||||
function selectedIds(group: ColumnGroup): string[] {
|
||||
return group === "partition" ? props.modelValue.partitionColumnIds : props.modelValue.distributionColumnIds;
|
||||
}
|
||||
|
||||
function selectedNames(group: ColumnGroup): string {
|
||||
const selected = new Set(selectedIds(group));
|
||||
return props.columns
|
||||
.filter((column) => selected.has(column.id))
|
||||
.map((column) => column.name)
|
||||
.join(", ");
|
||||
}
|
||||
|
||||
function availableColumns(group: ColumnGroup) {
|
||||
const filter = search.value[group].trim().toLowerCase();
|
||||
return props.columns.filter((column) => !filter || column.name.toLowerCase().includes(filter));
|
||||
}
|
||||
|
||||
function toggleColumn(group: ColumnGroup, id: string) {
|
||||
const current = selectedIds(group);
|
||||
const next = current.includes(id) ? current.filter((selected) => selected !== id) : [...current, id];
|
||||
emit("update:modelValue", {
|
||||
...props.modelValue,
|
||||
[group === "partition" ? "partitionColumnIds" : "distributionColumnIds"]: next,
|
||||
});
|
||||
}
|
||||
|
||||
function updateValue<K extends keyof TablePhysicalOptionsDraft>(field: K, value: TablePhysicalOptionsDraft[K]) {
|
||||
emit("update:modelValue", { ...props.modelValue, [field]: value });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex shrink-0 flex-wrap items-end gap-3 border-b pb-2">
|
||||
<label v-for="group in columnGroups" :key="group.key" class="flex min-w-0 max-w-full flex-col gap-1 text-muted-foreground">
|
||||
<span>{{ t(group.label) }}</span>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger as-child>
|
||||
<Button variant="outline" size="sm" class="h-8 w-48 max-w-full justify-between gap-1 px-2 font-normal" :disabled="disabled" :aria-label="t(group.label)">
|
||||
<span class="min-w-0 truncate font-mono">{{ selectedNames(group.key) || t("structureEditor.indexColumnsPlaceholder") }}</span>
|
||||
<ChevronDown class="size-3.5 shrink-0" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent class="max-h-64 min-w-48 overflow-y-auto" side="bottom" :side-offset="2">
|
||||
<div class="px-2 pb-1 pt-0.5">
|
||||
<Input v-model="search[group.key]" class="h-7 text-xs" :placeholder="t('grid.search')" @click.stop />
|
||||
</div>
|
||||
<DropdownMenuCheckboxItem v-for="column in availableColumns(group.key)" :key="column.id" :checked="selectedIds(group.key).includes(column.id)" @select.prevent @click="toggleColumn(group.key, column.id)">
|
||||
{{ column.name }}
|
||||
</DropdownMenuCheckboxItem>
|
||||
<div v-if="availableColumns(group.key).length === 0" class="px-2 py-1 text-xs text-muted-foreground">{{ t("structureEditor.indexColumnsPlaceholder") }}</div>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</label>
|
||||
<label class="flex min-w-0 max-w-full flex-col gap-1 text-muted-foreground">
|
||||
<span>{{ t(config.bucketCountLabel) }}</span>
|
||||
<Input :model-value="modelValue.bucketCount" type="number" min="1" :max="config.maxBuckets" step="1" class="h-8 w-24 max-w-full" :disabled="disabled" @update:model-value="updateValue('bucketCount', String($event ?? ''))" />
|
||||
</label>
|
||||
<label v-if="config.storageFormats.length" class="flex min-w-0 max-w-full flex-col gap-1 text-muted-foreground">
|
||||
<span>{{ t(config.storageFormatLabel) }}</span>
|
||||
<Select :model-value="modelValue.storageFormat || '__default'" :disabled="disabled" @update:model-value="updateValue('storageFormat', $event === '__default' ? '' : String($event))">
|
||||
<SelectTrigger class="w-32 max-w-full"><SelectValue :placeholder="t('structureEditor.defaultAction')" /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="__default">{{ t("structureEditor.defaultAction") }}</SelectItem>
|
||||
<SelectItem v-for="format in config.storageFormats" :key="format" :value="format">{{ format }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</label>
|
||||
<label v-if="config.transactionalLabel" class="flex h-9 items-center gap-2 text-muted-foreground">
|
||||
<input :checked="modelValue.transactional" type="checkbox" class="h-4 w-4 accent-primary" :disabled="disabled" @change="updateValue('transactional', ($event.target as HTMLInputElement).checked)" />
|
||||
{{ t(config.transactionalLabel) }}
|
||||
</label>
|
||||
</div>
|
||||
</template>
|
||||
@@ -16,6 +16,7 @@ import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMe
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { SearchableSelect } from "@/components/ui/searchable-select";
|
||||
import TablePhysicalOptionsEditor from "@/components/structure/TablePhysicalOptionsEditor.vue";
|
||||
import CustomContextMenu, { type ContextMenuItem } from "@/components/ui/CustomContextMenu.vue";
|
||||
import EditorSearchPanel from "@/components/editor/EditorSearchPanel.vue";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
@@ -58,6 +59,7 @@ import {
|
||||
import { buildMysqlAutoIncrementCounterStatement, canEditMysqlAutoIncrementCounter, refreshMysqlAutoIncrementCounterDraft } from "@/lib/table/mysqlAutoIncrementCounter";
|
||||
import { mysqlTableCollationSql, parseMysqlTableCollation } from "@/lib/table/mysqlTableCollation";
|
||||
import { MYSQL_STORAGE_ENGINES_SQL, mysqlTableEngineSql, mysqlTableEngineSqlOption, parseMysqlTableEngineMetadata, refreshMysqlTableEngineDraft, supportsMysqlTableEngine } from "@/lib/table/mysqlTableEngine";
|
||||
import { INCEPTOR_PHYSICAL_OPTIONS, buildInceptorCreateOptions, emptyTablePhysicalOptions, hasTablePhysicalOptions, pruneTablePhysicalOptions, restoreTablePhysicalOptions } from "@/lib/table/tablePhysicalOptions";
|
||||
import { PRESET_FIELDS_TEMPLATE_ID, createTableColumnTemplateDrafts } from "@/lib/table/tableColumnTemplates";
|
||||
import { getMysqlDataTypeHelp } from "@/lib/table/mysqlDataTypeHelp";
|
||||
import { getPostgresDataTypeHelp, gaussdbMTypeDisplayName } from "@/lib/table/postgresDataTypeHelp";
|
||||
@@ -1581,6 +1583,14 @@ const mysqlAutoIncrementLoading = ref(false);
|
||||
const mysqlAutoIncrementLoadError = ref("");
|
||||
const mysqlTableEngine = ref("");
|
||||
const originalMysqlTableEngine = ref("");
|
||||
const physicalOptions = ref(emptyTablePhysicalOptions());
|
||||
watch(
|
||||
() => columns.value.filter((column) => !column.markedForDrop).map((column) => column.id),
|
||||
(ids) => {
|
||||
if (!isCreateMode.value) return;
|
||||
physicalOptions.value = pruneTablePhysicalOptions(physicalOptions.value, new Set(ids));
|
||||
},
|
||||
);
|
||||
const mysqlTableEngineOptions = ref<string[]>([]);
|
||||
const mysqlTableEngineLoading = ref(false);
|
||||
const mysqlTableEngineLoadError = ref("");
|
||||
@@ -1900,6 +1910,7 @@ function createCurrentDraft(initialized = true): TableStructureEditorDraft {
|
||||
originalMysqlAutoIncrementValue: originalMysqlAutoIncrementValue.value,
|
||||
mysqlTableEngine: mysqlTableEngine.value,
|
||||
originalMysqlTableEngine: originalMysqlTableEngine.value,
|
||||
physicalOptions: cloneDraftValue(physicalOptions.value),
|
||||
tableOwner: tableOwner.value,
|
||||
originalTableOwner: originalTableOwner.value,
|
||||
columns: cloneDraftValue(columns.value),
|
||||
@@ -1977,6 +1988,7 @@ function restoreDraft(draft: TableStructureEditorDraft) {
|
||||
tableOwner.value = draft.tableOwner || "";
|
||||
originalTableOwner.value = draft.originalTableOwner || "";
|
||||
columns.value = cloneDraftValue(draft.columns || []);
|
||||
physicalOptions.value = restoreTablePhysicalOptions(draft);
|
||||
// Existing-index edits never support Concurrent (the checkbox is disabled and
|
||||
// the core builder rejects the request), so a stale `concurrently: true`
|
||||
// saved in a restored draft must not be submitted or deadlock the save.
|
||||
@@ -2066,6 +2078,7 @@ function hasPendingStructureChanges(): boolean {
|
||||
!!newTableName.value.trim() ||
|
||||
!!tableComment.value.trim() ||
|
||||
mysqlTableEngine.value !== originalMysqlTableEngine.value ||
|
||||
hasTablePhysicalOptions(physicalOptions.value) ||
|
||||
columns.value.length > 0 ||
|
||||
indexes.value.length > 0 ||
|
||||
foreignKeys.value.length > 0 ||
|
||||
@@ -2236,6 +2249,7 @@ function structureChangeOptions(): BuildTableStructureChangeSqlOptions {
|
||||
tableComment: tableComment.value,
|
||||
originalTableComment: isCreateMode.value ? undefined : originalTableComment.value,
|
||||
mysqlEngine: mysqlTableEngineSqlOption({ value: mysqlTableEngine.value, originalValue: originalMysqlTableEngine.value }, isCreateMode.value, supportsMysqlEngine.value && !mysqlTableEngineLoading.value && !mysqlTableEngineLoadError.value),
|
||||
transwarpCreate: isCreateMode.value && databaseType.value === "transwarp" ? buildInceptorCreateOptions(physicalOptions.value, columns.value) : undefined,
|
||||
tableCollation: mysqlTableDefaultCollation.value || undefined,
|
||||
partitioned: isPartitionedParent.value,
|
||||
isGaussdbMMode: connection.value?.driver_profile?.toLowerCase() === "gaussdb-m",
|
||||
@@ -2425,6 +2439,7 @@ function resetState() {
|
||||
mysqlAutoIncrementLoadError.value = "";
|
||||
mysqlTableEngine.value = "";
|
||||
originalMysqlTableEngine.value = "";
|
||||
physicalOptions.value = emptyTablePhysicalOptions();
|
||||
mysqlTableEngineOptions.value = [];
|
||||
mysqlTableEngineLoadRequestId += 1;
|
||||
mysqlTableEngineLoading.value = false;
|
||||
@@ -4786,6 +4801,7 @@ watch(
|
||||
mysqlAutoIncrementLoadError,
|
||||
mysqlTableEngine,
|
||||
originalMysqlTableEngine,
|
||||
physicalOptions,
|
||||
mysqlTableEngineLoading,
|
||||
mysqlTableEngineLoadError,
|
||||
mysqlTableDefaultCollation,
|
||||
@@ -4965,6 +4981,8 @@ watch(
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
<TablePhysicalOptionsEditor v-if="isCreateMode && databaseType === 'transwarp'" v-model="physicalOptions" :config="INCEPTOR_PHYSICAL_OPTIONS" :columns="columns.filter((column) => !column.markedForDrop && !!column.name.trim())" :disabled="saving" />
|
||||
|
||||
<div v-if="supportsTableOwner" class="flex shrink-0 items-center gap-2">
|
||||
<label class="flex shrink-0 items-center gap-1 font-medium text-muted-foreground">
|
||||
<UserRound :class="structureIconClass" />
|
||||
|
||||
@@ -5277,6 +5277,11 @@ export default {
|
||||
mysqlTableEngineSearchPlaceholder: "Search storage engines",
|
||||
mysqlTableEngineEmpty: "No storage engines available",
|
||||
mysqlTableEngineLoadFailed: "Failed to load storage engines: {message}",
|
||||
transwarpPartitionColumns: "Partition columns",
|
||||
transwarpBucketColumns: "Bucket columns",
|
||||
transwarpBucketCount: "Buckets",
|
||||
transwarpStorageFormat: "Storage format",
|
||||
transwarpTransactional: "Transactional table",
|
||||
owner: "Owner",
|
||||
ownerPlaceholder: "Enter role name...",
|
||||
ownerSearchPlaceholder: "Search or enter a role name...",
|
||||
|
||||
@@ -4773,6 +4773,11 @@ export default withEnglishFallback({
|
||||
onDelete: "Al eliminar",
|
||||
onUpdate: "Al actualizar",
|
||||
defaultAction: "Predeterminado",
|
||||
transwarpPartitionColumns: "Columnas de partición",
|
||||
transwarpBucketColumns: "Columnas de distribución",
|
||||
transwarpBucketCount: "Número de buckets",
|
||||
transwarpStorageFormat: "Formato de almacenamiento",
|
||||
transwarpTransactional: "Tabla transaccional",
|
||||
triggerName: "Disparador",
|
||||
triggerStatement: "Sentencia del disparador",
|
||||
primary: "Primaria",
|
||||
|
||||
@@ -4695,6 +4695,11 @@ export default withEnglishFallback({
|
||||
onDelete: "On delete",
|
||||
onUpdate: "On update",
|
||||
defaultAction: "Predefinito",
|
||||
transwarpPartitionColumns: "Colonne di partizione",
|
||||
transwarpBucketColumns: "Colonne di distribuzione",
|
||||
transwarpBucketCount: "Numero di bucket",
|
||||
transwarpStorageFormat: "Formato di archiviazione",
|
||||
transwarpTransactional: "Tabella transazionale",
|
||||
triggerName: "Trigger",
|
||||
triggerStatement: "Istruzione trigger",
|
||||
primary: "Primario",
|
||||
|
||||
@@ -4759,6 +4759,11 @@ export default withEnglishFallback({
|
||||
onDelete: "削除時",
|
||||
onUpdate: "更新時",
|
||||
defaultAction: "デフォルト",
|
||||
transwarpPartitionColumns: "パーティション列",
|
||||
transwarpBucketColumns: "バケット列",
|
||||
transwarpBucketCount: "バケット数",
|
||||
transwarpStorageFormat: "保存形式",
|
||||
transwarpTransactional: "トランザクションテーブル",
|
||||
triggerName: "トリガー",
|
||||
triggerStatement: "トリガー文",
|
||||
primary: "主キー",
|
||||
|
||||
@@ -4694,6 +4694,11 @@ export default withEnglishFallback({
|
||||
onDelete: "삭제 시",
|
||||
onUpdate: "수정 시",
|
||||
defaultAction: "기본",
|
||||
transwarpPartitionColumns: "파티션 열",
|
||||
transwarpBucketColumns: "버킷 열",
|
||||
transwarpBucketCount: "버킷 수",
|
||||
transwarpStorageFormat: "저장 형식",
|
||||
transwarpTransactional: "트랜잭션 테이블",
|
||||
triggerName: "트리거",
|
||||
triggerStatement: "트리거 구문",
|
||||
primary: "기본",
|
||||
|
||||
@@ -4697,6 +4697,11 @@ export default withEnglishFallback({
|
||||
onDelete: "Ao excluir",
|
||||
onUpdate: "Ao atualizar",
|
||||
defaultAction: "Padrão",
|
||||
transwarpPartitionColumns: "Colunas de partição",
|
||||
transwarpBucketColumns: "Colunas de distribuição",
|
||||
transwarpBucketCount: "Número de buckets",
|
||||
transwarpStorageFormat: "Formato de armazenamento",
|
||||
transwarpTransactional: "Tabela transacional",
|
||||
triggerName: "Trigger",
|
||||
triggerStatement: "Comando do trigger",
|
||||
primary: "Primária",
|
||||
|
||||
@@ -5223,6 +5223,11 @@ export default withEnglishFallback({
|
||||
onDelete: "При удалении",
|
||||
onUpdate: "При обновлении",
|
||||
defaultAction: "По умолчанию",
|
||||
transwarpPartitionColumns: "Столбцы секционирования",
|
||||
transwarpBucketColumns: "Столбцы распределения",
|
||||
transwarpBucketCount: "Число корзин",
|
||||
transwarpStorageFormat: "Формат хранения",
|
||||
transwarpTransactional: "Транзакционная таблица",
|
||||
triggerName: "Триггер",
|
||||
triggerStatement: "Оператор триггера",
|
||||
primary: "Первичный",
|
||||
|
||||
@@ -5251,6 +5251,11 @@ export default withEnglishFallback({
|
||||
mysqlTableEngineSearchPlaceholder: "搜索存储引擎",
|
||||
mysqlTableEngineEmpty: "没有可用的存储引擎",
|
||||
mysqlTableEngineLoadFailed: "加载存储引擎失败:{message}",
|
||||
transwarpPartitionColumns: "分区列",
|
||||
transwarpBucketColumns: "分桶列",
|
||||
transwarpBucketCount: "桶数",
|
||||
transwarpStorageFormat: "存储格式",
|
||||
transwarpTransactional: "事务表",
|
||||
owner: "所有者",
|
||||
ownerPlaceholder: "输入角色名...",
|
||||
ownerSearchPlaceholder: "搜索或输入角色名...",
|
||||
|
||||
@@ -4432,6 +4432,11 @@ export default withEnglishFallback({
|
||||
onDelete: "刪除時",
|
||||
onUpdate: "更新時",
|
||||
defaultAction: "預設",
|
||||
transwarpPartitionColumns: "分區欄位",
|
||||
transwarpBucketColumns: "分桶欄位",
|
||||
transwarpBucketCount: "桶數",
|
||||
transwarpStorageFormat: "儲存格式",
|
||||
transwarpTransactional: "交易資料表",
|
||||
triggerName: "觸發器名稱",
|
||||
triggerStatement: "觸發語句",
|
||||
primary: "主鍵",
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseConnectionUrl } from "@/lib/connection/connectionUrl";
|
||||
|
||||
describe("Transwarp JDBC URL parsing", () => {
|
||||
it("keeps the selected product when the SDK uses its other compatible URL", () => {
|
||||
const inceptor = parseConnectionUrl("jdbc:inceptor2://quark:10000/default;fetchSize=200", "transwarp-inceptor");
|
||||
expect(inceptor).toMatchObject({
|
||||
dbType: "transwarp",
|
||||
driverProfile: "transwarp-inceptor",
|
||||
host: "quark",
|
||||
port: 10000,
|
||||
database: "default",
|
||||
urlParams: "fetchSize=200",
|
||||
});
|
||||
expect(parseConnectionUrl("jdbc:transwarp2://quark:10000/default").driverProfile).toBe("transwarp-inceptor");
|
||||
});
|
||||
|
||||
it("detects Inceptor URLs without an existing product selection", () => {
|
||||
expect(parseConnectionUrl("jdbc:inceptor2://quark:10000/default")).toMatchObject({
|
||||
dbType: "transwarp",
|
||||
driverProfile: "transwarp-inceptor",
|
||||
});
|
||||
expect(parseConnectionUrl("jdbc:hive2://quark:10000/default").dbType).toBe("hive");
|
||||
});
|
||||
});
|
||||
@@ -59,6 +59,11 @@ describe("connectionUrlCopyFormats", () => {
|
||||
const formats = connectionUrlCopyFormats(config({ db_type: "hive", host: "hive.example.com", port: 10000, database: "dw" }));
|
||||
expect(formats).toEqual(["jdbcUrl", "jdbcUrlWithCredentials", "hostPort"]);
|
||||
});
|
||||
|
||||
it("uses semicolon options when copying an Inceptor JDBC URL", () => {
|
||||
const transwarp = config({ db_type: "transwarp", host: "quark.example.com", port: 10000, database: "default", username: "", password: "", url_params: "fetchSize=500" });
|
||||
expect(buildConnectionUrlCopy(transwarp, "jdbcUrl")).toBe("jdbc:inceptor2://quark.example.com:10000/default;fetchSize=500");
|
||||
});
|
||||
});
|
||||
|
||||
describe("buildConnectionUrlCopy standard URL", () => {
|
||||
|
||||
@@ -33,4 +33,11 @@ describe("database namespace creation targets", () => {
|
||||
expect(connectionNamespaceCreationTarget(postgres)).toBe("database");
|
||||
expect(databaseNodeNamespaceCreationTarget(postgres, databaseNode)).toBe("schema");
|
||||
});
|
||||
|
||||
it("offers top-level database creation for Inceptor without nested schemas", () => {
|
||||
const transwarp = { db_type: "transwarp", driver_profile: "transwarp-inceptor" } as Conn;
|
||||
|
||||
expect(connectionNamespaceCreationTarget(transwarp)).toBe("database");
|
||||
expect(databaseNodeNamespaceCreationTarget(transwarp, databaseNode)).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -667,6 +667,7 @@ describe("splitSqlStatementRanges", () => {
|
||||
expect(rangeSqlTexts(splitSqlStatementRanges(argoProcedureFixture, "argo"))).toEqual([argoProcedureFixture]);
|
||||
expect(hasMultipleExecutionTargets(argoProcedureFixture, "argo")).toBe(false);
|
||||
expect(rangeSqlTexts(executableStatementRanges(argoProcedureFixture, "argo"))).toEqual([argoProcedureFixture]);
|
||||
expect(rangeSqlTexts(splitSqlStatementRanges(argoProcedureFixture, "transwarp"))).toEqual([argoProcedureFixture]);
|
||||
});
|
||||
|
||||
it("statement at cursor inside an ArgoDB procedure body returns the whole definition", () => {
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { databaseRenameMaintenanceDatabase, supportsDatabaseRename } from "@/lib/table/objectRenameSql";
|
||||
import { databaseRenameMaintenanceDatabase, supportsDatabaseRename, supportsObjectRename } from "@/lib/table/objectRenameSql";
|
||||
|
||||
describe("Inceptor object rename", () => {
|
||||
it("exposes table rename without enabling unsupported object or database renames", () => {
|
||||
expect(supportsObjectRename("transwarp", "TABLE")).toBe(true);
|
||||
expect(supportsObjectRename("transwarp", "VIEW")).toBe(false);
|
||||
expect(supportsObjectRename("transwarp", "PROCEDURE")).toBe(false);
|
||||
expect(supportsObjectRename("transwarp", "FUNCTION")).toBe(false);
|
||||
expect(supportsDatabaseRename("transwarp")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("database rename", () => {
|
||||
it("chooses a maintenance database outside the rename target", () => {
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
editablePrimaryKeys,
|
||||
editableRowIdentifierColumns,
|
||||
hasCompleteTdengineRowIdentity,
|
||||
hiveTablePropertiesIndicateTransactional,
|
||||
isClickHouseExistingRowReadonlyColumn,
|
||||
isHiddenGridColumn,
|
||||
isSalesforceExistingRowReadonlyColumn,
|
||||
@@ -45,6 +46,17 @@ function index(columns: string[], isUnique = true, filter: string | null = null)
|
||||
}
|
||||
|
||||
describe("tableEditing", () => {
|
||||
it("allows Inceptor inserts but only edits existing rows in transactional tables", () => {
|
||||
expect(isTableDataEditable("transwarp", [], "TABLE")).toBe(true);
|
||||
expect(isTableDataEditable("transwarp", [], "VIEW")).toBe(false);
|
||||
expect(canInsertTableRows("transwarp")).toBe(true);
|
||||
expect(canEditExistingTableRows("transwarp", false)).toBe(false);
|
||||
expect(canEditExistingTableRows("transwarp", true)).toBe(true);
|
||||
expect(supportsDataGridTransaction("transwarp")).toBe(true);
|
||||
expect(hiveTablePropertiesIndicateTransactional({ rows: [["transactional", "true"]] })).toBe(true);
|
||||
expect(hiveTablePropertiesIndicateTransactional({ rows: [["true"]] })).toBe(true);
|
||||
expect(hiveTablePropertiesIndicateTransactional({ rows: [["false"]] })).toBe(false);
|
||||
});
|
||||
it("synthesizes ROWID only for Oracle-compatible base tables", () => {
|
||||
expect(editablePrimaryKeys("oracle", [column("ID"), column("NAME")])).toEqual([]);
|
||||
expect(editablePrimaryKeys("oracle", [column("ID"), column("NAME")], "VIEW")).toEqual([]);
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildInceptorCreateOptions, emptyTablePhysicalOptions, hasTablePhysicalOptions, pruneTablePhysicalOptions, restoreTablePhysicalOptions } from "@/lib/table/tablePhysicalOptions";
|
||||
|
||||
const columns = [
|
||||
{ id: "first", name: "id" },
|
||||
{ id: "second", name: "day" },
|
||||
{ id: "third", name: "label" },
|
||||
];
|
||||
|
||||
describe("table physical options", () => {
|
||||
it("restores a saved draft without sharing its column selections", () => {
|
||||
const saved = { physicalOptions: { partitionColumnIds: ["second"], distributionColumnIds: ["first"], bucketCount: "2", storageFormat: "ORC", transactional: true } };
|
||||
const restored = restoreTablePhysicalOptions(saved);
|
||||
expect(restored).toMatchObject({ partitionColumnIds: ["second"], distributionColumnIds: ["first"], bucketCount: "2", storageFormat: "ORC", transactional: true });
|
||||
expect(restored.partitionColumnIds).not.toBe(saved.physicalOptions.partitionColumnIds);
|
||||
expect(restored.distributionColumnIds).not.toBe(saved.physicalOptions.distributionColumnIds);
|
||||
expect(restoreTablePhysicalOptions({})).toEqual(emptyTablePhysicalOptions());
|
||||
expect(hasTablePhysicalOptions(restored)).toBe(true);
|
||||
expect(hasTablePhysicalOptions(emptyTablePhysicalOptions())).toBe(false);
|
||||
});
|
||||
|
||||
it("uses the current column name after a selected column is renamed", () => {
|
||||
const draft = { ...emptyTablePhysicalOptions(), partitionColumnIds: ["second"], distributionColumnIds: ["first"], bucketCount: "2", storageFormat: "ORC", transactional: true };
|
||||
const renamed = columns.map((column) => (column.id === "second" ? { ...column, name: "event_day" } : column));
|
||||
expect(buildInceptorCreateOptions(draft, renamed)).toEqual({
|
||||
partitionColumns: ["event_day"],
|
||||
bucketColumns: ["id"],
|
||||
bucketCount: 2,
|
||||
storageFormat: "ORC",
|
||||
transactional: true,
|
||||
});
|
||||
expect(pruneTablePhysicalOptions(draft, new Set(["first", "third"]))).toMatchObject({ partitionColumnIds: [], distributionColumnIds: ["first"] });
|
||||
});
|
||||
|
||||
it("keeps an invalid bucket count in the SQL builder's validation path", () => {
|
||||
const draft = { ...emptyTablePhysicalOptions(), distributionColumnIds: ["first"], bucketCount: "1.5" };
|
||||
expect(buildInceptorCreateOptions(draft, columns).bucketCount).toBe(0);
|
||||
});
|
||||
});
|
||||
@@ -110,6 +110,21 @@ describe("tableStructureCapabilities", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("enables only the verified Inceptor column structure operations", () => {
|
||||
expect(getTableStructureCapabilities("transwarp", "transwarp")).toMatchObject({
|
||||
dialect: "mysql",
|
||||
alterStrategy: "direct",
|
||||
createTable: true,
|
||||
addColumn: true,
|
||||
dropColumn: false,
|
||||
renameColumn: true,
|
||||
alterExistingColumn: true,
|
||||
comment: true,
|
||||
createIndex: false,
|
||||
foreignKey: false,
|
||||
});
|
||||
});
|
||||
|
||||
it("uses local-only column reordering for editable databases without physical reorder support", () => {
|
||||
for (const databaseType of ["sqlserver", "postgres", "sqlite", "oracle", "dameng", "duckdb", "informix"] as const) {
|
||||
expect(supportsLocalTableColumnReorder(databaseType, databaseType)).toBe(true);
|
||||
|
||||
@@ -28,6 +28,16 @@ describe("HiveServer2-compatible driver installation", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Transwarp driver installation", () => {
|
||||
it("routes the single Inceptor profile to the shared Agent package", () => {
|
||||
const profile = "transwarp-inceptor";
|
||||
expect(agentDriverInstallKey("transwarp", profile)).toBe("transwarp");
|
||||
expect(showAgentDriverInstallHint("transwarp", [], profile)).toBe(true);
|
||||
expect(showAgentDriverInstallHint("transwarp", [{ db_type: "transwarp", installed: true }], profile)).toBe(false);
|
||||
expect(driverStoreFocusForInstallError("transwarp driver is not installed. Please install it from the Driver Manager.", "transwarp", profile)).toEqual({ target: "driver", driver: "transwarp" });
|
||||
});
|
||||
});
|
||||
|
||||
describe("shouldApplyDriverStoreFocus", () => {
|
||||
it("applies when the driver first appears after a list load", () => {
|
||||
expect(shouldApplyDriverStoreFocus(null, "driver:mysql", false)).toBe(true);
|
||||
|
||||
@@ -110,6 +110,7 @@ describe("AGENT_DRIVER_CATEGORY_MAP integrity", () => {
|
||||
"oceanbase-oracle",
|
||||
"oscar",
|
||||
"sundb",
|
||||
"transwarp",
|
||||
"uxdb",
|
||||
"vastbase",
|
||||
"xugu",
|
||||
|
||||
@@ -37,6 +37,7 @@ export function agentDriverInstallKey(dbType: DatabaseType | undefined, driverPr
|
||||
if (dbType === "kyuubi" || dbType === "impala") return "hive";
|
||||
if (dbType === "oracle") return "oracle";
|
||||
if (dbType === "h2") return "h2";
|
||||
if (dbType === "transwarp") return "transwarp";
|
||||
if (dbType === "mongodb") return "mongodb";
|
||||
if (dbType === "dameng") return "dameng";
|
||||
if (dbType === "gbase") return driverProfile === "gbase8s" ? "gbase8s" : "gbase8a";
|
||||
|
||||
@@ -35,6 +35,7 @@ const DRIVER_STARTUP_FLOOR_TYPES = new Set<DatabaseType>([
|
||||
"kyuubi",
|
||||
"impala",
|
||||
"argo",
|
||||
"transwarp",
|
||||
"spark",
|
||||
"db2",
|
||||
"informix",
|
||||
|
||||
@@ -265,6 +265,9 @@ export function connectionUrlPlaceholder(dbType: DatabaseType, driverProfile?: s
|
||||
case "iris":
|
||||
return driverProfile === "cache" ? "cache://user:password@host:port/namespace" : "iris://user:password@host:port/namespace";
|
||||
|
||||
case "transwarp":
|
||||
return "jdbc:inceptor2://host:10000/default";
|
||||
|
||||
case "influxdb":
|
||||
return "influxdb://user:password@host:port/database";
|
||||
|
||||
|
||||
@@ -424,8 +424,8 @@ export function connectionProfileForScheme(scheme: string, preferredProfile?: st
|
||||
return SCHEME_PROFILES[normalizedScheme];
|
||||
}
|
||||
|
||||
function parseJdbcHiveUrl(source: string): ParsedConnectionUrl | null {
|
||||
const match = /^jdbc:hive2:\/\/(?<hosts>[^/?#;]+)(?:\/(?<path>[^?#]*))?(?<query>\?[^#]*)?(?<fragment>#.*)?$/i.exec(source);
|
||||
function parseJdbcHiveUrl(source: string, preferredProfile?: string): ParsedConnectionUrl | null {
|
||||
const match = /^jdbc:(?<subprotocol>hive2|inceptor2|transwarp2):\/\/(?<hosts>[^/?#;]+)(?:\/(?<path>[^?#]*))?(?<query>\?[^#]*)?(?<fragment>#.*)?$/i.exec(source);
|
||||
if (!match?.groups) return null;
|
||||
|
||||
const firstHost = match.groups.hosts.split(",")[0]?.trim();
|
||||
@@ -442,11 +442,13 @@ function parseJdbcHiveUrl(source: string): ParsedConnectionUrl | null {
|
||||
const [rawDatabase = "", ...paramParts] = (match.groups.path || "").split(";");
|
||||
const structured = extractHiveStructuredParams(paramParts.join(";"));
|
||||
const urlParams = `${structured.urlParams}${match.groups.query || ""}${match.groups.fragment || ""}`;
|
||||
const profile = preferredProfile === "transwarp-inceptor" ? preferredProfile : match.groups.subprotocol.toLowerCase() === "hive2" ? "hive" : "transwarp-inceptor";
|
||||
const transwarp = profile !== "hive";
|
||||
|
||||
return {
|
||||
dbType: "hive",
|
||||
driverProfile: "hive",
|
||||
driverLabel: "Apache Hive",
|
||||
dbType: transwarp ? "transwarp" : "hive",
|
||||
driverProfile: profile,
|
||||
driverLabel: profile === "transwarp-inceptor" ? "星环Inceptor" : "Apache Hive",
|
||||
host: endpoint.hostname.replace(/^\[(.*)]$/, "$1"),
|
||||
port: endpoint.port ? Number(endpoint.port) : 10000,
|
||||
username: structured.username ?? decodeUrlPart(endpoint.username),
|
||||
@@ -698,7 +700,7 @@ export function parseConnectionUrl(value: string, preferredProfile?: string): Pa
|
||||
if (/^jdbc:oceanbase:(?:oracle:)?loadbalance:\/\//i.test(input)) {
|
||||
throw new Error("Unsupported OceanBase JDBC URL variant: loadbalance");
|
||||
}
|
||||
const jdbcHive = parseJdbcHiveUrl(input);
|
||||
const jdbcHive = parseJdbcHiveUrl(input, preferredProfile);
|
||||
if (jdbcHive) return jdbcHive;
|
||||
const jdbcH2 = parseH2JdbcUrl(input);
|
||||
if (jdbcH2) return jdbcH2;
|
||||
|
||||
@@ -100,6 +100,7 @@ const JDBC_URL_PREFIXES: Partial<Record<DatabaseType, string>> = {
|
||||
hive: "jdbc:hive2",
|
||||
kyuubi: "jdbc:hive2",
|
||||
argo: "jdbc:hive2",
|
||||
transwarp: "jdbc:inceptor2",
|
||||
impala: "jdbc:impala",
|
||||
trino: "jdbc:trino",
|
||||
prestosql: "jdbc:presto",
|
||||
@@ -353,6 +354,12 @@ function buildSpecialJdbcUrl(config: ConnectionUrlCopyConfig, database: string,
|
||||
const query = joinNonEmpty("&", [database && `db=${database}`, ...credentials, rawParams.replace(/^[?&]+/, "")]);
|
||||
return `jdbc:snowflake://${formatHostForUrl(host)}/${query ? `?${query}` : ""}`;
|
||||
}
|
||||
case "transwarp": {
|
||||
const portPart = shouldAppendPort(config) ? `:${config.port}` : "";
|
||||
const props = rawParams.replace(/^[?&;]+/, "").replace(/&/g, ";");
|
||||
const ssl = config.ssl && !queryHasParam(props, ["ssl"]) ? ";ssl=true" : "";
|
||||
return `jdbc:inceptor2://${formatHostForUrl(host)}${portPart}/${database || "default"}${props ? `;${props}` : ""}${ssl}`;
|
||||
}
|
||||
case "informix":
|
||||
case "gbase": {
|
||||
const prefix = config.db_type === "informix" ? "jdbc:informix-sqli" : jdbcPrefixFor(config);
|
||||
|
||||
@@ -61,6 +61,7 @@ export const AGENT_DRIVER_CATEGORY_MAP: Readonly<Record<string, DriverCategoryKe
|
||||
sundb: "domestic",
|
||||
tdengine: "timeseries",
|
||||
teradata: "analytics",
|
||||
transwarp: "domestic",
|
||||
trino: "analytics",
|
||||
uxdb: "domestic",
|
||||
vastbase: "domestic",
|
||||
|
||||
@@ -134,6 +134,7 @@ export interface DataGridConditionalUpdateSqlOptions {
|
||||
}
|
||||
|
||||
export interface HiveTablePropertiesSqlOptions {
|
||||
databaseType?: DatabaseType;
|
||||
schema?: string;
|
||||
tableName: string;
|
||||
propertyName: string;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { manifestDatabaseTypes } from "@/lib/database/databaseDriverManifest";
|
||||
import { supportsTransfer } from "@/lib/database/databaseFeatureSupport";
|
||||
import type { DatabaseType } from "@/types/database";
|
||||
|
||||
const TABLE_ONLY_TRANSFER_DATABASES: DatabaseType[] = ["sqlite", "rqlite", "turso", "cloudflare-d1", "duckdb", "clickhouse", "mongodb", "highgo", "vastbase", "goldendb", "yashandb", "questdb", "h2", "hive", "argo", "kyuubi", "impala", "spark"];
|
||||
const TABLE_ONLY_TRANSFER_DATABASES: DatabaseType[] = ["sqlite", "rqlite", "turso", "cloudflare-d1", "duckdb", "clickhouse", "mongodb", "highgo", "vastbase", "goldendb", "yashandb", "questdb", "h2", "hive", "argo", "transwarp", "kyuubi", "impala", "spark"];
|
||||
|
||||
describe("transferObjectKinds", () => {
|
||||
it("groups databases into transfer families", () => {
|
||||
|
||||
@@ -70,6 +70,7 @@ export const DATABASE_NAMESPACE_CREATION_MATRIX = {
|
||||
prestosql: { database: "schema" },
|
||||
hive: { deferred: "Hive database creation needs agent metadata validation first" },
|
||||
argo: { deferred: "ArgoDB database creation needs agent metadata validation first" },
|
||||
transwarp: { connection: "database" },
|
||||
kyuubi: { deferred: "Kyuubi database creation needs dedicated metadata validation first" },
|
||||
impala: { deferred: "Impala database creation needs dedicated metadata validation first" },
|
||||
spark: { deferred: "Spark database creation needs agent metadata validation first" },
|
||||
|
||||
@@ -80,6 +80,7 @@ const DATABASE_TYPE_OBJECTS = new Map<DatabaseType, SidebarObjectKind[]>([
|
||||
// ArgoDB (Transwarp) shares the Hive agent; its catalog views
|
||||
// (system.procedures_v / system.functions_v) expose routines natively.
|
||||
["argo", ROUTINE_OBJECTS],
|
||||
["transwarp", ["TABLE", "VIEW", "PROCEDURE", "FUNCTION", "PACKAGE", "PACKAGE_BODY"]],
|
||||
["kyuubi", TABLE_VIEW_OBJECTS],
|
||||
["impala", TABLE_VIEW_OBJECTS],
|
||||
["spark", TABLE_VIEW_OBJECTS],
|
||||
|
||||
@@ -71,6 +71,7 @@ export const DATABASE_PROPERTY_EDITING_MATRIX = {
|
||||
prestosql: { deferred: "catalog properties are connector-managed" },
|
||||
hive: { deferred: "database properties need agent metadata validation first" },
|
||||
argo: { deferred: "database properties need agent metadata validation first" },
|
||||
transwarp: { deferred: "database properties need server validation first" },
|
||||
kyuubi: { deferred: "database properties need Kyuubi-specific validation first" },
|
||||
impala: { deferred: "database properties need Impala-specific validation first" },
|
||||
spark: { deferred: "database properties need agent metadata validation first" },
|
||||
|
||||
@@ -133,6 +133,16 @@ const DATABASE_CAPABILITY_OVERRIDES: Partial<Record<DatabaseType, Partial<Databa
|
||||
transaction: false,
|
||||
},
|
||||
},
|
||||
transwarp: {
|
||||
tableData: {
|
||||
insert: true,
|
||||
updateRequiresPrimaryKey: false,
|
||||
deleteRequiresPrimaryKey: false,
|
||||
keylessRowPredicate: true,
|
||||
requiresTransactionalTableForExistingRows: true,
|
||||
transaction: true,
|
||||
},
|
||||
},
|
||||
jdbc: {
|
||||
tableData: {
|
||||
insert: false,
|
||||
|
||||
@@ -15,7 +15,7 @@ const GAUSSDB_COUNT_QUERY_DOP_KEY = "gaussdbCountQueryDop";
|
||||
export const GAUSSDB_M_JDBC_DRIVER_PROFILE = "gaussdb-m";
|
||||
export const GAUSSDB_M_JDBC_DRIVER_CLASS = "com.huawei.gaussdb.jdbc.Driver";
|
||||
|
||||
const DATABASE_AS_EXECUTION_SCHEMA_TYPES = new Set<DatabaseType>(["hive", "kyuubi", "impala", "argo", "spark"]);
|
||||
const DATABASE_AS_EXECUTION_SCHEMA_TYPES = new Set<DatabaseType>(["hive", "kyuubi", "impala", "argo", "transwarp", "spark"]);
|
||||
const CONNECTION_ROOT_SCHEMA_TYPES = new Set<DatabaseType>(["oracle", "dameng", "oceanbase-oracle"]);
|
||||
|
||||
const JDBC_DIALECT_MATCHERS: Array<{ type: DatabaseType; patterns: RegExp[] }> = [
|
||||
|
||||
@@ -14,7 +14,7 @@ const SQLITE_CODEMIRROR_DATABASE_TYPES = new Set<DatabaseType>(["sqlite", "rqlit
|
||||
// literals; the mysql-family types are covered by isMysql at the define() site. Mirrors
|
||||
// BACKSLASH_ESCAPE_STRING_DIALECTS in lib/sql/sqlStatementRanges.ts so the editor
|
||||
// tokenizer and the statement splitter agree on escape semantics per dialect.
|
||||
const BACKSLASH_ESCAPE_CODEMIRROR_DATABASE_TYPES = new Set<DatabaseType>(["hive", "argo", "impala", "spark", "databend"]);
|
||||
const BACKSLASH_ESCAPE_CODEMIRROR_DATABASE_TYPES = new Set<DatabaseType>(["hive", "argo", "transwarp", "impala", "spark", "databend"]);
|
||||
|
||||
const CODEMIRROR_SQLITE_EXTENSION_KEYWORDS = new Set("abort analyze attach autoincrement conflict database detach exclusive fail glob ignore index indexed instead isnull notnull offset plan pragma query raise regexp reindex rename replace temp vacuum virtual".split(" "));
|
||||
const STANDARD_SQL_TYPES = "array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying";
|
||||
|
||||
@@ -4,7 +4,7 @@ import { qualifiedTableName, quoteTableIdentifier } from "@/lib/table/tableSelec
|
||||
import { requiresMysqlIdentifierQuote, requiresPostgresIdentifierQuote } from "@/lib/sql/sqlIdentifier.ts";
|
||||
|
||||
/** 智能引号使用反引号的方言族。 */
|
||||
const SMART_QUOTE_BACKTICK_TYPES = new Set<DatabaseType>(["mysql", "clickhouse", "hive", "argo", "kyuubi", "impala", "spark", "databricks", "databend", "tdengine", "access", "doris", "starrocks", "goldendb"]);
|
||||
const SMART_QUOTE_BACKTICK_TYPES = new Set<DatabaseType>(["mysql", "clickhouse", "hive", "argo", "transwarp", "kyuubi", "impala", "spark", "databricks", "databend", "tdengine", "access", "doris", "starrocks", "goldendb"]);
|
||||
/** 智能引号使用双引号的方言族(SQL Server 方括号除外)。 */
|
||||
const SMART_QUOTE_DOUBLE_TYPES = new Set<DatabaseType>(["postgres", "gaussdb", "opengauss"]);
|
||||
/** SQL Server 族智能引号使用方括号。 */
|
||||
|
||||
@@ -1439,7 +1439,7 @@ type SqlCompletionApplyDialect = "mysql" | "postgres" | "sqlserver" | "oracle" |
|
||||
// QueryEditor may use another dialect as a CodeMirror syntax fallback.
|
||||
// Completion apply text must still follow the connected database's identifier
|
||||
// folding and quoting rules.
|
||||
const MYSQL_LIKE_IDENTIFIER_DATABASES = new Set<DatabaseType>(["mysql", "clickhouse", "hive", "argo", "kyuubi", "impala", "spark", "databend", "tdengine", "access", "doris", "starrocks"]);
|
||||
const MYSQL_LIKE_IDENTIFIER_DATABASES = new Set<DatabaseType>(["mysql", "clickhouse", "hive", "argo", "transwarp", "kyuubi", "impala", "spark", "databend", "tdengine", "access", "doris", "starrocks"]);
|
||||
const POSTGRES_LIKE_IDENTIFIER_DATABASES = new Set<DatabaseType>(["postgres", "redshift", "gaussdb", "kingbase", "highgo", "uxdb", "vastbase", "kwdb", "opengauss"]);
|
||||
export const ORACLE_COMPAT_IDENTIFIER_DATABASES = new Set<DatabaseType>(["oracle", "oceanbase-oracle", "yashandb", "oscar", "xugu"]);
|
||||
const UPPER_FOLDING_IDENTIFIER_DATABASES = new Set<DatabaseType>(["dameng", "db2"]);
|
||||
@@ -3256,7 +3256,7 @@ function lastTopLevelKeywordIndex(sql: string, keyword: string): number {
|
||||
// unquoted token as a table reference there is a false-positive risk. Everything else defaults
|
||||
// to Unicode support (MySQL/Postgres/SQL Server/SQLite/DuckDB and the many Chinese-vendor
|
||||
// engines this product supports legitimately use non-ASCII unquoted identifiers).
|
||||
const ASCII_ONLY_UNQUOTED_IDENTIFIER_DATABASES = new Set<DatabaseType>(["clickhouse", "snowflake", "bigquery", "hive", "argo", "spark", "trino", "prestosql", "impala", "db2", "teradata"]);
|
||||
const ASCII_ONLY_UNQUOTED_IDENTIFIER_DATABASES = new Set<DatabaseType>(["clickhouse", "snowflake", "bigquery", "hive", "argo", "transwarp", "spark", "trino", "prestosql", "impala", "db2", "teradata"]);
|
||||
|
||||
// Dialects where a bare "--" needs trailing whitespace/EOL to start a comment, since MySQL
|
||||
// reserves unspaced "--" for double-negation (e.g. `SELECT 1--1`). Scoped to mysql itself plus
|
||||
|
||||
@@ -293,7 +293,7 @@ const SET_OPERATION_MODIFIER_KEYWORDS = new Set(["ALL", "DISTINCT"]);
|
||||
// in sync. ArgoDB (Transwarp Hive/Inceptor fork) ships a PL/SQL-compatible procedure
|
||||
// language (`CREATE [OR REPLACE] PROCEDURE ... IS BEGIN ... END;`), so its statement
|
||||
// ranges must stay whole instead of splitting at every body semicolon.
|
||||
const ORACLE_LIKE_PL_SQL_DATABASES: ReadonlySet<DatabaseType> = new Set(["oracle", "dameng", "gaussdb", "yashandb", "oscar", "oceanbase-oracle", "xugu", "argo"]);
|
||||
const ORACLE_LIKE_PL_SQL_DATABASES: ReadonlySet<DatabaseType> = new Set(["oracle", "dameng", "gaussdb", "yashandb", "oscar", "oceanbase-oracle", "xugu", "argo", "transwarp"]);
|
||||
const MYSQL_ROUTINE_BLOCK_DATABASES: ReadonlySet<DatabaseType> = new Set(["mysql", "doris", "starrocks", "manticoresearch", "goldendb"]);
|
||||
// PostgreSQL/openGauss are also the connection types users pick for GaussDB/openGauss instances
|
||||
// running in Oracle (A) compatibility mode, where a routine body is written in Oracle style
|
||||
@@ -305,7 +305,7 @@ const POSTGRES_FAMILY_DATABASES: ReadonlySet<DatabaseType> = new Set(["postgres"
|
||||
// escape unconditionally makes ESCAPE '\' swallow its closing quote and the following statement
|
||||
// boundary, so the next statement loses its run button (#8189). Gate it by dialect, matching the
|
||||
// tokenizer/completion side.
|
||||
export const BACKSLASH_ESCAPE_STRING_DIALECTS: ReadonlySet<DatabaseType> = new Set(["mysql", "doris", "starrocks", "hive", "argo", "impala", "spark", "databend"]);
|
||||
export const BACKSLASH_ESCAPE_STRING_DIALECTS: ReadonlySet<DatabaseType> = new Set(["mysql", "doris", "starrocks", "hive", "argo", "transwarp", "impala", "spark", "databend"]);
|
||||
function allowsBackslashStringEscape(databaseType?: DatabaseType): boolean {
|
||||
return !!databaseType && BACKSLASH_ESCAPE_STRING_DIALECTS.has(databaseType);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ export function supportsObjectRename(databaseType: DatabaseType | undefined, obj
|
||||
return false;
|
||||
}
|
||||
if (databaseType === "sqlite" || databaseType === "rqlite" || databaseType === "turso" || databaseType === "cloudflare-d1" || databaseType === "duckdb") return objectType === "TABLE";
|
||||
if (databaseType === "transwarp") return objectType === "TABLE";
|
||||
if (databaseType === "mysql" || databaseType === "goldendb") return objectType === "TABLE" || objectType === "VIEW";
|
||||
if (postgresLikeRenameTypes.has(databaseType)) return objectType === "TABLE" || objectType === "VIEW" || objectType === "MATERIALIZED_VIEW";
|
||||
if (oracleLikeRenameTypes.has(databaseType)) return objectType === "TABLE" || objectType === "VIEW" || objectType === "MATERIALIZED_VIEW";
|
||||
|
||||
@@ -92,6 +92,12 @@ export function canDeleteExistingTdengineRows(databaseType: DatabaseType | undef
|
||||
|
||||
export function hiveTablePropertiesIndicateTransactional(result: { rows: readonly (readonly unknown[])[] }): boolean {
|
||||
return result.rows.some((row) => {
|
||||
if (row.length === 1)
|
||||
return (
|
||||
String(row[0] ?? "")
|
||||
.trim()
|
||||
.toLowerCase() === "true"
|
||||
);
|
||||
const name = String(row[0] ?? "")
|
||||
.trim()
|
||||
.toLowerCase();
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import type { EditableStructureColumn, TranswarpCreateTableOptions } from "@/lib/table/tableStructureEditorSql";
|
||||
|
||||
export interface TablePhysicalOptionsDraft {
|
||||
partitionColumnIds: string[];
|
||||
distributionColumnIds: string[];
|
||||
bucketCount: string;
|
||||
storageFormat: string;
|
||||
transactional: boolean;
|
||||
}
|
||||
|
||||
export interface TablePhysicalOptionsConfig {
|
||||
partitionColumnsLabel: string;
|
||||
distributionColumnsLabel: string;
|
||||
bucketCountLabel: string;
|
||||
storageFormatLabel: string;
|
||||
transactionalLabel?: string;
|
||||
maxBuckets: number;
|
||||
storageFormats: readonly string[];
|
||||
}
|
||||
|
||||
export const INCEPTOR_PHYSICAL_OPTIONS: TablePhysicalOptionsConfig = {
|
||||
partitionColumnsLabel: "structureEditor.transwarpPartitionColumns",
|
||||
distributionColumnsLabel: "structureEditor.transwarpBucketColumns",
|
||||
bucketCountLabel: "structureEditor.transwarpBucketCount",
|
||||
storageFormatLabel: "structureEditor.transwarpStorageFormat",
|
||||
transactionalLabel: "structureEditor.transwarpTransactional",
|
||||
maxBuckets: 4096,
|
||||
storageFormats: ["ORC", "PARQUET", "TEXTFILE"],
|
||||
};
|
||||
|
||||
export function emptyTablePhysicalOptions(): TablePhysicalOptionsDraft {
|
||||
return { partitionColumnIds: [], distributionColumnIds: [], bucketCount: "", storageFormat: "", transactional: false };
|
||||
}
|
||||
|
||||
export function hasTablePhysicalOptions(draft: TablePhysicalOptionsDraft): boolean {
|
||||
return draft.partitionColumnIds.length > 0 || draft.distributionColumnIds.length > 0 || !!draft.bucketCount.trim() || !!draft.storageFormat || draft.transactional;
|
||||
}
|
||||
|
||||
export function pruneTablePhysicalOptions(draft: TablePhysicalOptionsDraft, availableColumnIds: ReadonlySet<string>): TablePhysicalOptionsDraft {
|
||||
const partitionColumnIds = draft.partitionColumnIds.filter((id) => availableColumnIds.has(id));
|
||||
const distributionColumnIds = draft.distributionColumnIds.filter((id) => availableColumnIds.has(id));
|
||||
if (partitionColumnIds.length === draft.partitionColumnIds.length && distributionColumnIds.length === draft.distributionColumnIds.length) return draft;
|
||||
return { ...draft, partitionColumnIds, distributionColumnIds };
|
||||
}
|
||||
|
||||
export function restoreTablePhysicalOptions(saved: { physicalOptions?: TablePhysicalOptionsDraft }): TablePhysicalOptionsDraft {
|
||||
if (!saved.physicalOptions) return emptyTablePhysicalOptions();
|
||||
return {
|
||||
partitionColumnIds: [...saved.physicalOptions.partitionColumnIds],
|
||||
distributionColumnIds: [...saved.physicalOptions.distributionColumnIds],
|
||||
bucketCount: saved.physicalOptions.bucketCount,
|
||||
storageFormat: saved.physicalOptions.storageFormat,
|
||||
transactional: saved.physicalOptions.transactional,
|
||||
};
|
||||
}
|
||||
|
||||
export function buildInceptorCreateOptions(draft: TablePhysicalOptionsDraft, columns: readonly Pick<EditableStructureColumn, "id" | "name">[]): TranswarpCreateTableOptions {
|
||||
const names = (ids: readonly string[]) => ids.map((id) => columns.find((column) => column.id === id)?.name ?? id);
|
||||
const count = draft.bucketCount.trim();
|
||||
const parsedCount = Number(count);
|
||||
return {
|
||||
partitionColumns: names(draft.partitionColumnIds),
|
||||
bucketColumns: names(draft.distributionColumnIds),
|
||||
bucketCount: count ? (Number.isSafeInteger(parsedCount) && parsedCount > 0 && parsedCount <= 4096 ? parsedCount : 0) : undefined,
|
||||
storageFormat: draft.storageFormat || undefined,
|
||||
transactional: draft.transactional,
|
||||
};
|
||||
}
|
||||
@@ -109,6 +109,7 @@ export function quoteTableIdentifier(databaseType: DatabaseType | undefined, nam
|
||||
databaseType === "clickhouse" ||
|
||||
databaseType === "hive" ||
|
||||
databaseType === "argo" ||
|
||||
databaseType === "transwarp" ||
|
||||
databaseType === "kyuubi" ||
|
||||
databaseType === "impala" ||
|
||||
databaseType === "spark" ||
|
||||
@@ -152,6 +153,7 @@ function requiresIdentifierQuote(databaseType: DatabaseType | undefined, name: s
|
||||
case "clickhouse":
|
||||
case "hive":
|
||||
case "argo":
|
||||
case "transwarp":
|
||||
case "kyuubi":
|
||||
case "impala":
|
||||
case "spark":
|
||||
|
||||
@@ -268,6 +268,20 @@ const informixCapabilities = capabilities({
|
||||
rebuildIndex: true,
|
||||
});
|
||||
|
||||
// Inceptor accepts ADD COLUMNS and CHANGE. DROP COLUMN and index/constraint DDL
|
||||
// remain disabled until a safe server-supported form is verified.
|
||||
const transwarpCapabilities = capabilities({
|
||||
dialect: "mysql",
|
||||
createTable: true,
|
||||
addColumn: true,
|
||||
renameColumn: true,
|
||||
alterExistingColumn: true,
|
||||
alterType: true,
|
||||
alterNullability: true,
|
||||
alterDefault: true,
|
||||
comment: true,
|
||||
});
|
||||
|
||||
const accessCapabilities = capabilities({
|
||||
dialect: "h2",
|
||||
createTable: true,
|
||||
@@ -359,6 +373,7 @@ const capabilityByType: Partial<Record<DatabaseType, TableStructureCapabilities>
|
||||
access: accessCapabilities,
|
||||
clickhouse: clickhouseCapabilities,
|
||||
informix: informixCapabilities,
|
||||
transwarp: transwarpCapabilities,
|
||||
influxdb: influxdbCapabilities,
|
||||
manticoresearch: manticoreSearchCapabilities,
|
||||
};
|
||||
|
||||
@@ -90,6 +90,7 @@ export interface BuildTableStructureChangeSqlOptions {
|
||||
tableComment?: string;
|
||||
originalTableComment?: string;
|
||||
mysqlEngine?: string;
|
||||
transwarpCreate?: TranswarpCreateTableOptions;
|
||||
/** MySQL only: the table's current default collation. Columns whose collation merely
|
||||
* matches it inherit the table default, so the backend leaves their redundant
|
||||
* `CHARACTER SET`/`COLLATE` clauses out of the generated DDL. */
|
||||
@@ -103,6 +104,14 @@ export interface BuildTableStructureChangeSqlOptions {
|
||||
isGaussdbMMode?: boolean;
|
||||
}
|
||||
|
||||
export interface TranswarpCreateTableOptions {
|
||||
partitionColumns: string[];
|
||||
bucketColumns: string[];
|
||||
bucketCount?: number;
|
||||
storageFormat?: string;
|
||||
transactional: boolean;
|
||||
}
|
||||
|
||||
export interface TableStructureChangeSql {
|
||||
statements: string[];
|
||||
warnings: string[];
|
||||
|
||||
@@ -1782,6 +1782,7 @@ export interface TableStructureEditorDraft {
|
||||
originalMysqlAutoIncrementValue?: string;
|
||||
mysqlTableEngine?: string;
|
||||
originalMysqlTableEngine?: string;
|
||||
physicalOptions?: import("@/lib/table/tablePhysicalOptions").TablePhysicalOptionsDraft;
|
||||
tableOwner?: string;
|
||||
originalTableOwner?: string;
|
||||
columns: import("@/lib/table/tableStructureEditorSql").EditableStructureColumn[];
|
||||
|
||||
@@ -87,6 +87,7 @@ export const CONNECTION_PROFILES = {
|
||||
prestosql: { type: "prestosql", port: 8080, user: "", label: "PrestoSQL", icon: "presto" },
|
||||
hive: { type: "hive", port: 10000, user: "", label: "Apache Hive", icon: "hive" },
|
||||
kyuubi: { type: "kyuubi", port: 10009, user: "", label: "Apache Kyuubi", icon: "kyuubi", urlParams: "auth=NONE" },
|
||||
"transwarp-inceptor": { type: "transwarp", port: 10000, user: "", label: "星环Inceptor", icon: "transwarp-inceptor" },
|
||||
argo: { type: "argo", port: 10000, user: "", label: "ArgoDB (Transwarp)", icon: "hive", urlParams: "auth=noSasl" },
|
||||
impala: { type: "impala", port: 21050, user: "", label: "Apache Impala", icon: "impala", urlParams: "auth=noSasl" },
|
||||
spark: { type: "spark", port: 10015, user: "", label: "Apache Spark", icon: "spark" },
|
||||
@@ -196,6 +197,7 @@ export const CONNECTION_PROFILE_ICONS = {
|
||||
prestosql: "prestosql",
|
||||
hive: "hive",
|
||||
kyuubi: "kyuubi",
|
||||
"transwarp-inceptor": "transwarp-inceptor",
|
||||
argo: "hive",
|
||||
impala: "impala",
|
||||
spark: "spark",
|
||||
@@ -300,6 +302,7 @@ export const CONNECTION_PICKER_OPTIONS = [
|
||||
{ value: "prestosql", label: "PrestoSQL", category: "analytics" },
|
||||
{ value: "hive", label: "Hive", category: "analytics" },
|
||||
{ value: "kyuubi", label: "Apache Kyuubi", category: "analytics" },
|
||||
{ value: "transwarp-inceptor", label: "星环Inceptor", category: "domestic" },
|
||||
{ value: "argo", label: "ArgoDB", category: "domestic" },
|
||||
{ value: "impala", label: "Apache Impala", category: "analytics" },
|
||||
{ value: "spark", label: "Apache Spark", category: "analytics" },
|
||||
|
||||
@@ -53,6 +53,7 @@ export const DATABASE_TYPES = [
|
||||
"prestosql",
|
||||
"hive",
|
||||
"argo",
|
||||
"transwarp",
|
||||
"kyuubi",
|
||||
"impala",
|
||||
"db2",
|
||||
|
||||
Reference in new issue
Block a user