Merge branch 'master' into tableeditor2

This commit is contained in:
Jan Prochazka
2021-06-24 09:44:05 +02:00
19 changed files with 55 additions and 16 deletions

View File

@@ -52,7 +52,7 @@
</div>
{/if}
{#each filtered as item (module.extractKey(item.data))}
{#each filtered as item}
<AppObjectListItem
{...$$restProps}
{module}

View File

@@ -66,8 +66,6 @@
import _ from 'lodash';
import registerCommand from '../commands/registerCommand';
import { registerMenu } from '../utility/contextMenu';
import { useSettings } from '../utility/metadataLoaders';
import { getCurrentSettings } from '../stores';
import { getBoolSettingsValue } from '../settings/settingsTools';
export let config;

View File

@@ -13,6 +13,18 @@
}
const dateTimeRegex = /^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d\d)?Z?$/;
function formatNumber(value) {
if (value >= 10000 || value <= -10000) {
if (getBoolSettingsValue('dataGrid.thousandsSeparator', false)) {
return value.toLocaleString();
} else {
return value.toString();
}
}
return value.toString();
}
</script>
<script lang="ts">
@@ -20,6 +32,7 @@
import _ from 'lodash';
import { isTypeLogical } from 'dbgate-tools';
import ShowFormButton from '../formview/ShowFormButton.svelte';
import { getBoolSettingsValue } from '../settings/settingsTools';
export let rowIndex;
export let col;
@@ -80,16 +93,10 @@
0
{/if}
{:else if _.isNumber(value)}
{#if value >= 10000 || value <= -10000}
{#if isDynamicStructure}
<span class="value">{value.toLocaleString()}</span>
{:else}
{value.toLocaleString()}
{/if}
{:else if isDynamicStructure}
<span class="value">{value.toString()}</span>
{#if isDynamicStructure}
<span class="value">{formatNumber(value)}</span>
{:else}
{value.toString()}
{formatNumber(value)}
{/if}
{:else if _.isString(value)}
{#if dateTimeRegex.test(value)}

View File

@@ -46,6 +46,8 @@
/>
<FormCheckboxField name="dataGrid.showHintColumns" label="Show foreign key hints" defaultValue={true} />
<FormCheckboxField name="dataGrid.thousandsSeparator" label="Use thounds separator for numbers" />
<div class="heading">Connection</div>
<FormCheckboxField
name="connection.autoRefresh"

View File

@@ -1,3 +1,17 @@
<script lang="ts" context="module">
function generateObjectList(seed = 0) {
const counts = [1000, 1200, 1100, 2100, 720];
const schemas = ['A', 'dev', 'public', 'dbo'];
const types = ['tables', 'views', 'functions', 'procedures', 'matviews', 'triggers'];
const res = _.range(1, counts[seed % counts.length]).map(i => ({
pureName: `name ${i}`,
schemaName: schemas[i % schemas.length],
objectTypeField: types[i % types.length],
}));
return res;
}
</script>
<script lang="ts">
import InlineButton from '../elements/InlineButton.svelte';
import SearchInput from '../elements/SearchInput.svelte';
@@ -33,6 +47,10 @@
)
);
// let generateIndex = 0;
// setInterval(() => (generateIndex += 1), 2000);
// $: objectList = generateObjectList(generateIndex);
const handleRefreshDatabase = () => {
axiosInstance.post('database-connections/refresh', { conid, database });
};