fix: types

This commit is contained in:
Fine 2023-06-07 16:06:03 +08:00
parent 44f6e32953
commit 1e2d81502f
4 changed files with 7 additions and 8 deletions

View File

@ -109,7 +109,7 @@ export function useExpressionsSourceProcessor(
const keys = Object.keys(resp.data); const keys = Object.keys(resp.data);
for (let i = 0; i < config.metrics.length; i++) { for (let i = 0; i < config.metrics.length; i++) {
const type = config.metricTypes[i]; const type = config.metricTypes[i];
const c: any = (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 results = (resp.data[keys[i]] && resp.data[keys[i]].results) || [];
const name = config.metrics[i]; const name = config.metrics[i];
@ -219,7 +219,7 @@ export async function useExpressionsQueryPodsMetrics(
const metricTypesArr: string[] = []; const metricTypesArr: string[] = [];
const data = pods.map((d: any, idx: number) => { const data = pods.map((d: any, idx: number) => {
for (let index = 0; index < config.expressions.length; index++) { 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 k = "expression" + idx + index;
const sub = "subexpression" + idx + index; const sub = "subexpression" + idx + index;
const results = (resp.data[k] && resp.data[k].results) || []; const results = (resp.data[k] && resp.data[k].results) || [];

3
src/types/app.d.ts vendored
View File

@ -42,8 +42,7 @@ export type EventParams = {
dataIndex: number; dataIndex: number;
data: unknown; data: unknown;
dataType: string; dataType: string;
value: number | Array; value: number | any[];
color: string; color: string;
event: any; event: any;
dataIndex: number;
}; };

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { DurationTime } from "./app";
export type DashboardItem = { export type DashboardItem = {
id?: string; id?: string;
entity: string; entity: string;
@ -75,8 +75,8 @@ export type MetricConfigOpt = {
unit?: string; unit?: string;
label?: string; label?: string;
calculation?: string; calculation?: string;
labelsIndex: string; labelsIndex?: string;
sortOrder: string; sortOrder?: string;
topN?: number; topN?: number;
index?: number; index?: number;
}; };

View File

@ -57,7 +57,7 @@ limitations under the License. -->
placeholder="auto" placeholder="auto"
@change=" @change="
updateConfig(index, { updateConfig(index, {
labelsIndex: encodeURIComponent(currentMetric.labelsIndex), labelsIndex: encodeURIComponent(currentMetric.labelsIndex || ''),
}) })
" "
/> />