Skip to content

Commit

Permalink
Merge pull request labring#23 from zjy365/cutom-app
Browse files Browse the repository at this point in the history
fix image list
  • Loading branch information
EthanD4869 authored Nov 25, 2024
2 parents dae29ad + d3867c1 commit d38fd69
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions frontend/providers/applaunchpad/src/api/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
adaptEvents,
sortAppListByTime
} from '@/utils/adapt';
import type { AppPatchPropsType } from '@/types/app';
import type { AppPatchPropsType, PodDetailType } from '@/types/app';
import { MonitorDataResult, MonitorQueryKey } from '@/types/monitor';
import { ExportAppPayload } from '@/pages/api/exportApp';
import { NodeInfo } from '@/pages/api/getNodes';
Expand Down Expand Up @@ -86,9 +86,10 @@ export const getAppByName = (namespace: string, name: string) =>
GET(`/api/getAppByAppName?namespace=${namespace}&&appName=${name}`).then(adaptAppDetail);

export const getAppPodsByAppName = (namespace: string, name: string) =>
GET<V1Pod[]>(`/api/getAppPodsByAppName?namespace=${namespace}`, { name }).then((item) =>
item.map(adaptPod)
);
GET<PodDetailType[]>(`/api/getAppPodsByAppName?namespace=${namespace}`, { name });
// .then((item) =>
// item.map(adaptPod)
// );

export const getPodsMetrics = (namespace: string, podsName: string[]) =>
POST<SinglePodMetrics[]>(`/api/getPodsMetrics?namespace=${namespace}`, { podsName }).then(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { ApiResp } from '@/services/kubernet';
import { authSession } from '@/services/backend/auth';
import { getK8s } from '@/services/backend/kubernetes';
import { jsonRes } from '@/services/backend/response';
import dayjs from 'dayjs';
import { adaptPod } from '@/utils/adapt';

// get App Metrics By DeployName. compute average value
export default async function handler(req: NextApiRequest, res: NextApiResponse<ApiResp>) {
Expand Down Expand Up @@ -31,7 +33,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
);

jsonRes(res, {
data: pods
data: pods.map((item) => adaptPod(item))
});
} catch (err: any) {
// console.log(err, 'get metrics error')
Expand Down
2 changes: 1 addition & 1 deletion frontend/providers/applaunchpad/src/pages/api/getImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const PASSWORD = process.env.IMAGE_REPO_PASSWORD;
const authHeader = 'Basic ' + Buffer.from(`${USERNAME}:${PASSWORD}`).toString('base64');

export async function fetchCatalog() {
const response = await fetch(`${BASE_URL}/_catalog`, {
const response = await fetch(`${BASE_URL}/_catalog?n=1000`, {
headers: {
Authorization: authHeader
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class ImageRegistryClient {
}

async getRepositories(): Promise<string[]> {
const result = await this.fetch<{ repositories: string[] }>('/_catalog');
const result = await this.fetch<{ repositories: string[] }>('/_catalog?n=1000');
return result?.repositories || [];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ const Header = ({
} = useDisclosure();

const { appDetail = MOCK_APP_DETAIL } = useAppStore();
console.log(appDetail, 'appDetail');

const { openConfirm: openRestartConfirm, ConfirmChild: RestartConfirmChild } = useConfirm({
content: 'Confirm to restart this application?'
Expand Down

0 comments on commit d38fd69

Please sign in to comment.