Fix db connection test result, #1590

This commit is contained in:
Alexander Zobnin
2023-03-22 10:51:40 +01:00
parent 24708032e3
commit 1605b764c2
2 changed files with 7 additions and 7 deletions

View File

@@ -49,8 +49,8 @@ export const ConfigEditor = (props: Props) => {
.then((ds) => { .then((ds) => {
if (ds) { if (ds) {
const selectedDs = getDirectDBDatasources().find((dsOption) => dsOption.id === ds.id); const selectedDs = getDirectDBDatasources().find((dsOption) => dsOption.id === ds.id);
setSelectedDBDatasource({ label: selectedDs.name, value: selectedDs.id }); setSelectedDBDatasource({ label: selectedDs?.name, value: selectedDs?.id });
setCurrentDSType(selectedDs.type); setCurrentDSType(selectedDs?.type);
onOptionsChange({ onOptionsChange({
...options, ...options,
jsonData: { jsonData: {
@@ -64,8 +64,8 @@ export const ConfigEditor = (props: Props) => {
const selectedDs = getDirectDBDatasources().find( const selectedDs = getDirectDBDatasources().find(
(dsOption) => dsOption.id === options.jsonData.dbConnectionDatasourceId (dsOption) => dsOption.id === options.jsonData.dbConnectionDatasourceId
); );
setSelectedDBDatasource({ label: selectedDs.name, value: selectedDs.id }); setSelectedDBDatasource({ label: selectedDs?.name, value: selectedDs?.id });
setCurrentDSType(selectedDs.type); setCurrentDSType(selectedDs?.type);
} }
} }
}, []); }, []);
@@ -225,13 +225,13 @@ export const ConfigEditor = (props: Props) => {
<h3 className="page-heading">Other</h3> <h3 className="page-heading">Other</h3>
<Switch <Switch
label="Disable acknowledges for read-only users" label="Disable acknowledges for read-only users"
labelClass="width-16" labelClass="width-20"
checked={options.jsonData.disableReadOnlyUsersAck} checked={options.jsonData.disableReadOnlyUsersAck}
onChange={jsonDataSwitchHandler('disableReadOnlyUsersAck', options, onOptionsChange)} onChange={jsonDataSwitchHandler('disableReadOnlyUsersAck', options, onOptionsChange)}
/> />
<Switch <Switch
label="Disable data alignment" label="Disable data alignment"
labelClass="width-16" labelClass="width-20"
checked={!!options.jsonData.disableDataAlignment} checked={!!options.jsonData.disableDataAlignment}
onChange={jsonDataSwitchHandler('disableDataAlignment', options, onOptionsChange)} onChange={jsonDataSwitchHandler('disableDataAlignment', options, onOptionsChange)}
tooltip="Data alignment feature aligns points based on item update interval. tooltip="Data alignment feature aligns points based on item update interval.

View File

@@ -227,7 +227,7 @@ export class Zabbix implements ZabbixConnector {
.then((testResult) => { .then((testResult) => {
if (testResult) { if (testResult) {
dbConnectorStatus = { dbConnectorStatus = {
dsType: this.dbConnector.datasourceTypeName, dsType: this.dbConnector.datasourceTypeName || this.dbConnector.datasourceTypeId,
dsName: this.dbConnector.datasourceName, dsName: this.dbConnector.datasourceName,
}; };
} }