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

View File

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