mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-29 08:11:06 +00:00
Merge pull request #116 from SuLea-IT/codex/issue-110-mongodb-legacy
feat: add MongoDB form URL parameters
This commit is contained in:
@@ -401,7 +401,7 @@ async function testConnection() {
|
||||
isTesting.value = true;
|
||||
testResult.value = null;
|
||||
try {
|
||||
const config: ConnectionConfig = { ...form.value, id: editingId.value || uuid() };
|
||||
const config = connectionConfigForSubmit(editingId.value || uuid());
|
||||
const msg = await api.testConnection(config);
|
||||
if (runId !== testRunId) return;
|
||||
testResult.value = { ok: true, message: msg };
|
||||
@@ -415,6 +415,14 @@ async function testConnection() {
|
||||
}
|
||||
}
|
||||
|
||||
function connectionConfigForSubmit(id: string): ConnectionConfig {
|
||||
const config: ConnectionConfig = { ...form.value, id };
|
||||
if (config.db_type === "mongodb" && !mongoUseUrl.value) {
|
||||
config.connection_string = undefined;
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
function resetTestState() {
|
||||
testRunId += 1;
|
||||
isTesting.value = false;
|
||||
@@ -462,11 +470,11 @@ async function save() {
|
||||
resetTestState();
|
||||
try {
|
||||
if (editingId.value) {
|
||||
const updated: ConnectionConfig = { ...form.value, id: editingId.value };
|
||||
const updated = connectionConfigForSubmit(editingId.value);
|
||||
await store.updateConnection(updated);
|
||||
store.stopEditing();
|
||||
} else {
|
||||
const config: ConnectionConfig = { ...form.value, id: uuid() };
|
||||
const config = connectionConfigForSubmit(uuid());
|
||||
await store.addConnection(config);
|
||||
open.value = false;
|
||||
await nextTick();
|
||||
@@ -757,6 +765,20 @@ async function browseSshKeyPath() {
|
||||
:placeholder="t('connection.databasePlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
<div class="grid grid-cols-4 items-center gap-4">
|
||||
<Label class="text-right">{{ t("connection.urlParams") }}</Label>
|
||||
<Input
|
||||
v-model="form.url_params"
|
||||
class="col-span-3"
|
||||
placeholder="authSource=admin&authMechanism=SCRAM-SHA-1"
|
||||
/>
|
||||
</div>
|
||||
<div class="grid grid-cols-4 items-start gap-4">
|
||||
<span />
|
||||
<p class="col-span-3 text-xs text-muted-foreground">
|
||||
{{ t("connection.mongoLegacyHint") }}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user