Tenant Connection String Düzenlemeleri
This commit is contained in:
parent
00e3f6c17b
commit
904126191e
4 changed files with 96 additions and 47 deletions
|
|
@ -111,34 +111,3 @@ username=system%40sozsoft.com
|
|||
- Proje build olmuyorsa hatalar çözülür
|
||||
- Yeni migration eklenir (varsa). Migration boş çıkıyorsa kaldırılır. (Örn dotnet ef migrations add Abp902 ve dotnet ef migrations remove)
|
||||
- Migration boş değilse çalıştırılır (dotnet ef database update)
|
||||
|
||||
# PostgreSQL Komutları
|
||||
- FDW eklentisini yükle (sadece 1 kez gerekir)
|
||||
```
|
||||
CREATE EXTENSION IF NOT EXISTS postgres_fdw;
|
||||
```
|
||||
|
||||
- Uzak veritabanı için bağlantı tanımı yap
|
||||
```
|
||||
CREATE SERVER kurs_server
|
||||
FOREIGN DATA WRAPPER postgres_fdw
|
||||
OPTIONS (
|
||||
host 'Ip_Adress',
|
||||
dbname 'DbName',
|
||||
port '5432'
|
||||
);
|
||||
```
|
||||
|
||||
- Uzak veritabanı için kullanıcı eşlemesi
|
||||
```
|
||||
CREATE USER MAPPING FOR sa
|
||||
SERVER kurs_server
|
||||
OPTIONS (user 'user', password 'password');
|
||||
```
|
||||
|
||||
- Uzak schema'dan tabloyu kendi veritabanına import et
|
||||
```
|
||||
IMPORT FOREIGN SCHEMA public
|
||||
FROM SERVER kurs_server
|
||||
INTO public;
|
||||
```
|
||||
|
|
|
|||
|
|
@ -617,13 +617,13 @@
|
|||
"key": "App.AuditLogs",
|
||||
"en": "Audit Logs",
|
||||
"tr": "Denetim Geçmişi"
|
||||
},
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "App.EntityChanges",
|
||||
"en": "Entity Changes",
|
||||
"tr": "Varlık Değişiklikleri"
|
||||
},
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "AccessDenied",
|
||||
|
|
@ -816,6 +816,18 @@
|
|||
"en": "Users Moved",
|
||||
"tr": "Kullanıcılar Taşındı"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "Abp.Identity.CreateUser",
|
||||
"en": "Create User",
|
||||
"tr": "Kullanıcı Oluştur"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "Abp.Identity.UserCreating",
|
||||
"en": "User Creating",
|
||||
"tr": "Kullanıcı Oluşturuluyor..."
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "Abp.Identity.OrganizationUnit.Delete",
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict';
|
|||
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
||||
}, {
|
||||
"url": "index.html",
|
||||
"revision": "0.05gfa4u7tj8"
|
||||
"revision": "0.tgk2t9rlh7"
|
||||
}], {});
|
||||
workbox.cleanupOutdatedCaches();
|
||||
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {
|
|||
FormItem,
|
||||
Input,
|
||||
Notification,
|
||||
Select,
|
||||
Tabs,
|
||||
toast,
|
||||
} from '@/components/ui'
|
||||
|
|
@ -17,21 +18,26 @@ import {
|
|||
postSeedTenantData,
|
||||
putTenantDefaultConnectionString,
|
||||
} from '@/proxy/admin/tenant/tenant.service'
|
||||
import { DataSourceTypeEnum } from '@/proxy/form'
|
||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||
import { Field, Form, Formik, FormikHelpers } from 'formik'
|
||||
import { Field, FieldProps, Form, Formik, FormikHelpers } from 'formik'
|
||||
import { Suspense, useEffect, useRef, useState } from 'react'
|
||||
import * as Yup from 'yup'
|
||||
import { dataSourceTypeOptions } from '../listForm/edit/options'
|
||||
|
||||
export interface ConnectionStringDto {
|
||||
id: string
|
||||
name: string
|
||||
value: string
|
||||
isNew?: boolean
|
||||
dataSourceType?: number
|
||||
}
|
||||
|
||||
const schemaCs = Yup.object().shape({
|
||||
id: Yup.string().required(),
|
||||
name: Yup.string().required(),
|
||||
dataSourceType: Yup.number().required(),
|
||||
value: Yup.string().required(),
|
||||
})
|
||||
|
||||
const schemaSeed = Yup.object().shape({
|
||||
|
|
@ -67,7 +73,7 @@ function TenantConnectionString({
|
|||
|
||||
if (response.data.length == 0) {
|
||||
isNew = true
|
||||
value = 'User ID=sa;Password=NvQp8s@l;Host=postgres;Port=5432;Database=' + name + ';'
|
||||
value = ''
|
||||
} else {
|
||||
isNew = false
|
||||
value = response.data
|
||||
|
|
@ -78,6 +84,7 @@ function TenantConnectionString({
|
|||
name: 'Default',
|
||||
value,
|
||||
isNew,
|
||||
...(value && { dataSourceType: value.startsWith('Server') ? 1 : 2 }),
|
||||
})
|
||||
setLoading(false)
|
||||
}
|
||||
|
|
@ -138,7 +145,9 @@ function TenantConnectionString({
|
|||
placement: 'top-center',
|
||||
},
|
||||
)
|
||||
onDialogClose()
|
||||
|
||||
await fetchDataTenants()
|
||||
//onDialogClose()
|
||||
} catch (error) {
|
||||
toast.push(
|
||||
<Notification type="danger" duration={2000}>
|
||||
|
|
@ -165,8 +174,6 @@ function TenantConnectionString({
|
|||
setLoading(true)
|
||||
setSubmitting(true)
|
||||
|
||||
setLoading(true)
|
||||
|
||||
try {
|
||||
await postSeedTenantData(values)
|
||||
toast.push(
|
||||
|
|
@ -207,7 +214,9 @@ function TenantConnectionString({
|
|||
Connection String
|
||||
</TabNav>
|
||||
<TabNav key="seed" value="seed">
|
||||
Create DB / Seed Data
|
||||
{connectionString.isNew
|
||||
? translate('::Abp.Account.SignUp')
|
||||
: translate('::AbpTenantManagement.Tenants.DatabaseSeed')}
|
||||
</TabNav>
|
||||
</TabList>
|
||||
</Tabs>
|
||||
|
|
@ -224,7 +233,7 @@ function TenantConnectionString({
|
|||
<Form>
|
||||
<FormContainer size="sm">
|
||||
<FormItem
|
||||
label="Name"
|
||||
label={translate('AbpAccount::DisplayName:Name')}
|
||||
invalid={errors.name && touched.name}
|
||||
errorMessage={errors.name}
|
||||
>
|
||||
|
|
@ -239,7 +248,55 @@ function TenantConnectionString({
|
|||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="Value"
|
||||
label={translate('::ListForms.ListFormFieldEdit.LookupDataSourceType')}
|
||||
invalid={errors.dataSourceType && touched.dataSourceType}
|
||||
errorMessage={errors.dataSourceType}
|
||||
>
|
||||
<Field
|
||||
type="text"
|
||||
autoComplete="off"
|
||||
name="dataSourceType"
|
||||
placeholder={translate(
|
||||
'::ListForms.ListFormFieldEdit.LookupDataSourceType',
|
||||
)}
|
||||
>
|
||||
{({ field, form }: FieldProps<DataSourceTypeEnum>) => (
|
||||
<Select
|
||||
field={field}
|
||||
form={form}
|
||||
autoFocus
|
||||
isClearable={true}
|
||||
options={dataSourceTypeOptions}
|
||||
value={dataSourceTypeOptions?.filter(
|
||||
(option) => option.value === values.dataSourceType,
|
||||
)}
|
||||
onChange={(option) => {
|
||||
form.setFieldValue(field.name, option?.value)
|
||||
|
||||
if (option?.value == 1)
|
||||
//PostgreSQL
|
||||
form.setFieldValue(
|
||||
'value',
|
||||
'Server=sql;Database=' +
|
||||
name +
|
||||
';User Id=sa;password=@Password;Trusted_Connection=False;TrustServerCertificate=True;',
|
||||
)
|
||||
else if (option?.value == 2)
|
||||
//MsSql
|
||||
form.setFieldValue(
|
||||
'value',
|
||||
'User ID=sa;Password=@Password;Host=postgres;Port=5432;Database=' +
|
||||
name +
|
||||
';',
|
||||
)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="Connection String"
|
||||
invalid={errors.value && touched.value}
|
||||
errorMessage={errors.value}
|
||||
>
|
||||
|
|
@ -252,6 +309,7 @@ function TenantConnectionString({
|
|||
component={Input}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<div className="mt-6 flex flex-row justify-end gap-3">
|
||||
<Button
|
||||
disabled={connectionString.isNew}
|
||||
|
|
@ -287,15 +345,21 @@ function TenantConnectionString({
|
|||
<Form>
|
||||
<FormContainer size="sm">
|
||||
<FormItem
|
||||
label="Admin Email"
|
||||
label={translate('::Abp.Account.EmailAddress')}
|
||||
invalid={errors.adminEmail && touched.adminEmail}
|
||||
errorMessage={errors.adminEmail}
|
||||
>
|
||||
<Field type="text" autoComplete="off" name="adminEmail" component={Input} />
|
||||
<Field
|
||||
type="text"
|
||||
autoFocus
|
||||
autoComplete="off"
|
||||
name="adminEmail"
|
||||
component={Input}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="Admin Password"
|
||||
label={translate('::Abp.Account.Password')}
|
||||
invalid={errors.adminPassword && touched.adminPassword}
|
||||
errorMessage={errors.adminPassword}
|
||||
>
|
||||
|
|
@ -310,8 +374,12 @@ function TenantConnectionString({
|
|||
<div className="mt-6 flex flex-row justify-end gap-3">
|
||||
<Button variant="solid" loading={isSubmitting} type="submit">
|
||||
{isSubmitting
|
||||
? translate('::AbpTenantManagement.Tenants.DatabaseSeeding')
|
||||
: translate('::AbpTenantManagement.Tenants.DatabaseSeed')}
|
||||
? connectionString.isNew
|
||||
? translate('::Abp.Identity.UserCreating')
|
||||
: translate('::AbpTenantManagement.Tenants.DatabaseSeeding')
|
||||
: connectionString.isNew
|
||||
? translate('::Abp.Identity.CreateUser')
|
||||
: translate('::AbpTenantManagement.Tenants.DatabaseSeed')}
|
||||
</Button>
|
||||
<Button type="button" variant="plain" onClick={onDialogClose}>
|
||||
{translate('::Cancel')}
|
||||
|
|
|
|||
Loading…
Reference in a new issue