Skip to content

Commit

Permalink
chore: deprecate the vdp-sdk/metric in toolkit (#1559)
Browse files Browse the repository at this point in the history
Because

- deprecate the vdp-sdk/metric in toolkit

This commit

- deprecate the vdp-sdk/metric in toolkit
  • Loading branch information
EiffelFly authored Oct 25, 2024
1 parent 365a5b9 commit 8ca0ad9
Show file tree
Hide file tree
Showing 24 changed files with 69 additions and 292 deletions.
4 changes: 2 additions & 2 deletions packages/toolkit/src/components/PipelineRunStateLabel.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";

import { cn } from "@instill-ai/design-system";
import type { Nullable, PipelineTriggerStatus } from "instill-sdk";

import type { Nullable, PipelineTriggerStatus } from "../lib";
import { cn } from "@instill-ai/design-system";

export type PipelineRunStateLabelProps = {
state?: Nullable<PipelineTriggerStatus>;
Expand Down
9 changes: 6 additions & 3 deletions packages/toolkit/src/components/cells/GeneralStateCell.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
"use client";

import type { ModelState, PipelineReleaseState } from "instill-sdk";
import type {
ModelState,
Nullable,
PipelineReleaseState,
PipelineTriggerStatus,
} from "instill-sdk";
import { ReactElement } from "react";
import cn from "clsx";

import { Tag } from "@instill-ai/design-system";

import { Nullable, PipelineTriggerStatus } from "../../lib";

export type GeneralStateCellProps = {
state: ModelState | PipelineReleaseState | PipelineTriggerStatus;
width: Nullable<string>;
Expand Down
5 changes: 3 additions & 2 deletions packages/toolkit/src/lib/dashboard/generateChartData.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { PipelinesChart } from "../vdp-sdk";
import type { PipelineTriggerChartRecord } from "instill-sdk";

import { formatDateTime } from "./formatDateTime";
import { getDateRange } from "./getDateRange";
import { sortByDate } from "./sortByDate";

export function generateChartData(
apiResponse: PipelinesChart[],
apiResponse: PipelineTriggerChartRecord[],
range: string,
): { xAxis: string[]; yAxis: number[][] } {
const pipelineData = apiResponse;
Expand Down
22 changes: 19 additions & 3 deletions packages/toolkit/src/lib/dashboard/getPipelineTriggersSummary.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
import { PipelineTriggersStatusSummary, TriggeredPipeline } from "../vdp-sdk";
import type {
PipelineTriggerStatus,
PipelineTriggerTableRecord,
} from "instill-sdk";

import { calculatePercentageDelta } from "./calculatePercentageDelta";

export type PipelineTriggersStatusSummaryItem = {
statusType: PipelineTriggerStatus;
amount: number;
type: "pipeline" | "model";
delta: number;
};

export type PipelineTriggersStatusSummary = {
completed: PipelineTriggersStatusSummaryItem;
errored: PipelineTriggersStatusSummaryItem;
};

export function getPipelineTriggersSummary(
pipelines: TriggeredPipeline[],
pipelinesPrevious: TriggeredPipeline[],
pipelines: PipelineTriggerTableRecord[],
pipelinesPrevious: PipelineTriggerTableRecord[],
): PipelineTriggersStatusSummary {
let pipelineCompleteAmount = 0;
let pipelineCompleteAmountPrevious = 0;
Expand Down
7 changes: 3 additions & 4 deletions packages/toolkit/src/lib/dashboard/getTriggersSummary.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import {
PipelineTriggerRecord,
PipelineTriggersStatusSummary,
} from "../vdp-sdk";
import type { PipelineTriggerRecord } from "instill-sdk";

import { calculatePercentageDelta } from "./calculatePercentageDelta";
import { PipelineTriggersStatusSummary } from "./getPipelineTriggersSummary";

export function getTriggersSummary(
triggers: PipelineTriggerRecord[],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { Count } from "../vdp-sdk";
export type Count = {
triggerTime: string | Date;
count: number;
};

export function orderCountsByTriggerTime(counts: Count[]): Count[] {
const formattedCounts: Count[] = counts.map((count) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PipelineTriggerStatus } from "../vdp-sdk";
import type { PipelineTriggerStatus } from "instill-sdk";

export function parseTriggerStatusLabel(status: PipelineTriggerStatus) {
const convertedStatus = status
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/src/lib/dashboard/sortByTriggerTime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PipelineTriggerRecord } from "../vdp-sdk";
import type { PipelineTriggerRecord } from "instill-sdk";

export function sortByTriggerTime(
data: PipelineTriggerRecord[],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"use client";

import type { Nullable } from "instill-sdk";
import { useQuery } from "@tanstack/react-query";

import { Nullable } from "../../type";
import { getInstillAPIClient } from "../../vdp-sdk";

export function useCreditConsumptionChartRecords({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"use client";

import type { Nullable } from "instill-sdk";
import { useQuery } from "@tanstack/react-query";

import { env } from "../../../server";
import { Nullable } from "../../type";
import { getInstillAPIClient } from "../../vdp-sdk";

export function usePipelineTriggerComputationTimeCharts({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"use client";

import type { Nullable } from "instill-sdk";
import { useQuery } from "@tanstack/react-query";

import { env } from "../../../server";
import { Nullable } from "../../type";
import { getInstillAPIClient } from "../../vdp-sdk";

export function usePipelineTriggerMetric({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"use client";

import type { Nullable } from "instill-sdk";
import { useQuery } from "@tanstack/react-query";

import { env } from "../../../server";
import { Nullable } from "../../type";
import { getInstillAPIClient } from "../../vdp-sdk";

export function usePipelineTriggers({
Expand Down
1 change: 0 additions & 1 deletion packages/toolkit/src/lib/vdp-sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { env } from "../../server";
import { Nullable } from "../type";

export * from "./helper";
export * from "./metric";
export * from "./model";
export * from "./operation";
export * from "./organization";
Expand Down
2 changes: 0 additions & 2 deletions packages/toolkit/src/lib/vdp-sdk/metric/credit/index.ts

This file was deleted.

43 changes: 0 additions & 43 deletions packages/toolkit/src/lib/vdp-sdk/metric/credit/queries.ts

This file was deleted.

5 changes: 0 additions & 5 deletions packages/toolkit/src/lib/vdp-sdk/metric/credit/types.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/toolkit/src/lib/vdp-sdk/metric/index.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/toolkit/src/lib/vdp-sdk/metric/pipeline/index.ts

This file was deleted.

142 changes: 0 additions & 142 deletions packages/toolkit/src/lib/vdp-sdk/metric/pipeline/queries.ts

This file was deleted.

Loading

0 comments on commit 8ca0ad9

Please sign in to comment.