diff --git a/src/hooks/useExpressionsProcessor.ts b/src/hooks/useExpressionsProcessor.ts index a40001c4..a6d341f2 100644 --- a/src/hooks/useExpressionsProcessor.ts +++ b/src/hooks/useExpressionsProcessor.ts @@ -109,7 +109,7 @@ export function useExpressionsSourceProcessor( const keys = Object.keys(resp.data); for (let i = 0; i < config.metricTypes.length; i++) { const type = config.metricTypes[i]; - const c = (config.metricConfig && config.metricConfig[i]) || {}; + const c: MetricConfigOpt = (config.metricConfig && config.metricConfig[i]) || {}; const results = (resp.data[keys[i]] && resp.data[keys[i]].results) || []; const name = ((results[0] || {}).metric || {}).name; @@ -218,7 +218,7 @@ export async function useExpressionsQueryPodsMetrics( const metricTypesArr: string[] = []; const data = pods.map((d: any, idx: number) => { for (let index = 0; index < config.expressions.length; index++) { - const c: any = (config.metricConfig && config.metricConfig[index]) || {}; + const c: MetricConfigOpt = (config.metricConfig && config.metricConfig[index]) || {}; const k = "expression" + idx + index; const sub = "subexpression" + idx + index; const results = (resp.data[k] && resp.data[k].results) || []; diff --git a/src/types/app.d.ts b/src/types/app.d.ts index e22444fd..8967baf7 100644 --- a/src/types/app.d.ts +++ b/src/types/app.d.ts @@ -42,8 +42,7 @@ export type EventParams = { dataIndex: number; data: unknown; dataType: string; - value: number | Array; + value: number | Array; color: string; event: any; - dataIndex: number; }; diff --git a/src/types/dashboard.d.ts b/src/types/dashboard.d.ts index 636db486..ca89f49c 100644 --- a/src/types/dashboard.d.ts +++ b/src/types/dashboard.d.ts @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { DurationTime } from "./app"; export type DashboardItem = { id?: string; @@ -75,8 +76,8 @@ export type MetricConfigOpt = { unit?: string; label?: string; calculation?: string; - labelsIndex: string; - sortOrder: string; + labelsIndex?: string; + sortOrder?: string; topN?: number; index?: number; };