Skip to content

Commit 3e11781

Browse files
committed
Check if index and timeField are not empty before saving datasource.
1 parent 2331823 commit 3e11781

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/configuration/utils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export const coerceOptions = (
88
...options,
99
jsonData: {
1010
...options.jsonData,
11-
timeField: options.jsonData.timeField || 'timestamp',
1211
logMessageField: options.jsonData.logMessageField || '',
1312
logLevelField: options.jsonData.logLevelField || '',
1413
},

src/datasource.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@ export class QuickwitDataSource
9393
* see public/app/features/datasources/state/actions.ts for what needs to be returned here
9494
*/
9595
async testDatasource() {
96+
if (this.index === '' ) {
97+
return {
98+
status: 'error',
99+
message: 'Cannot save datasource, `index` is required',
100+
};
101+
}
102+
if (this.timeField === '' ) {
103+
return {
104+
status: 'error',
105+
message: 'Cannot save datasource, `timeField` is required',
106+
};
107+
}
96108
return lastValueFrom(
97109
from(this.getResource('indexes/' + this.index)).pipe(
98110
mergeMap((indexMetadata) => {

0 commit comments

Comments
 (0)