language fixes
This commit is contained in:
parent
7cf0795660
commit
fbfe85f225
1 changed files with 40 additions and 1 deletions
|
|
@ -18,6 +18,7 @@ type LangRow = {
|
||||||
entriesCount: number;
|
entriesCount: number;
|
||||||
uiCount: number;
|
uiCount: number;
|
||||||
gatewayCount: number;
|
gatewayCount: number;
|
||||||
|
updating: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type ProgressInfo = {
|
type ProgressInfo = {
|
||||||
|
|
@ -42,7 +43,34 @@ function _getColumns(t: (key: string) => string): ColumnConfig[] {
|
||||||
return [
|
return [
|
||||||
{ key: 'id', label: t('Code'), type: 'text', sortable: true, filterable: true, width: 90 },
|
{ key: 'id', label: t('Code'), type: 'text', sortable: true, filterable: true, width: 90 },
|
||||||
{ key: 'label', label: t('Bezeichnung'), type: 'text', sortable: true, filterable: true, width: 200 },
|
{ key: 'label', label: t('Bezeichnung'), type: 'text', sortable: true, filterable: true, width: 200 },
|
||||||
{ key: 'status', label: t('Status'), type: 'text', sortable: true, filterable: true, width: 120 },
|
{
|
||||||
|
key: 'status',
|
||||||
|
label: t('Status'),
|
||||||
|
type: 'text',
|
||||||
|
sortable: true,
|
||||||
|
filterable: true,
|
||||||
|
width: 160,
|
||||||
|
formatter: (_val: any, row: any) => {
|
||||||
|
const r = row as LangRow;
|
||||||
|
if (r.updating) {
|
||||||
|
return (
|
||||||
|
<span style={{ display: 'inline-flex', alignItems: 'center', gap: 6, color: 'var(--color-warning, #e6a700)' }}>
|
||||||
|
<FaSync style={{ animation: 'spin 1s linear infinite', fontSize: '0.85em' }} />
|
||||||
|
{t('wird aktualisiert…')}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (r.status === 'generating') {
|
||||||
|
return (
|
||||||
|
<span style={{ display: 'inline-flex', alignItems: 'center', gap: 6, color: 'var(--color-warning, #e6a700)' }}>
|
||||||
|
<FaSync style={{ animation: 'spin 1s linear infinite', fontSize: '0.85em' }} />
|
||||||
|
{t('wird erzeugt…')}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return r.status;
|
||||||
|
},
|
||||||
|
},
|
||||||
{ key: 'uiCount', label: t('UI'), type: 'number', sortable: true, width: 80 },
|
{ key: 'uiCount', label: t('UI'), type: 'number', sortable: true, width: 80 },
|
||||||
{ key: 'gatewayCount', label: t('API'), type: 'number', sortable: true, width: 80 },
|
{ key: 'gatewayCount', label: t('API'), type: 'number', sortable: true, width: 80 },
|
||||||
{ key: 'entriesCount', label: t('Gesamt'), type: 'number', sortable: true, width: 80 },
|
{ key: 'entriesCount', label: t('Gesamt'), type: 'number', sortable: true, width: 80 },
|
||||||
|
|
@ -328,6 +356,7 @@ export const AdminLanguagesPage: React.FC = () => {
|
||||||
entriesCount: r.entriesCount ?? 0,
|
entriesCount: r.entriesCount ?? 0,
|
||||||
uiCount: r.uiCount ?? 0,
|
uiCount: r.uiCount ?? 0,
|
||||||
gatewayCount: r.gatewayCount ?? 0,
|
gatewayCount: r.gatewayCount ?? 0,
|
||||||
|
updating: !!r.updating,
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
|
|
@ -364,6 +393,16 @@ export const AdminLanguagesPage: React.FC = () => {
|
||||||
_load();
|
_load();
|
||||||
}, [_load]);
|
}, [_load]);
|
||||||
|
|
||||||
|
const _hasUpdating = rows.some((r) => r.updating || r.status === 'generating');
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!_hasUpdating) return;
|
||||||
|
const id = window.setInterval(() => {
|
||||||
|
_load();
|
||||||
|
}, 5000);
|
||||||
|
return () => window.clearInterval(id);
|
||||||
|
}, [_hasUpdating, _load]);
|
||||||
|
|
||||||
const displayRows = useMemo(() => {
|
const displayRows = useMemo(() => {
|
||||||
const term = search.trim().toLowerCase();
|
const term = search.trim().toLowerCase();
|
||||||
const filtered = term
|
const filtered = term
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue