Skip to content

Commit

Permalink
✨ Added record version to app logs
Browse files Browse the repository at this point in the history
  • Loading branch information
abdheshnayak committed Mar 14, 2024
1 parent 49f42e9 commit fb3d244
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 29 deletions.
1 change: 1 addition & 0 deletions gql-queries-generator/doc/queries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ mutation consoleDeleteApp($projectName: String!, $envName: String!, $appName: St
query consoleGetApp($projectName: String!, $envName: String!, $name: String!) {
core_getApp(projectName: $projectName, envName: $envName, name: $name) {
id
recordVersion
createdBy {
userEmail
userId
Expand Down
1 change: 1 addition & 0 deletions lib/client/components/logger/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export interface IuseLog {
account: string;
cluster: string;
trackingId: string;
recordVersion?: number;
}

const hoverClass = `hover:bg-[#ddd]`;
Expand Down
17 changes: 13 additions & 4 deletions lib/client/helpers/socket/useSockLogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,28 @@ interface IuseLog {
account: string;
cluster: string;
trackingId: string;
recordVersion?: number;
}

export const useSocketLogs = ({ account, cluster, trackingId }: IuseLog) => {
export const useSocketLogs = ({
account,
cluster,
trackingId,
recordVersion,
}: IuseLog) => {
const [logs, setLogs] = useState<ISocketResp<ILog>[]>([]);
const { responses, infos, subscribed, errors } = useSubscribe(
{
for: 'logs',
data: {
id: `${account}.${cluster}.${trackingId}`,
spec: {
account,
cluster,
trackingId,
...{
account,
cluster,
trackingId,
recordVersion,
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ const LogsAndMetrics = () => {
account: parseName(account),
cluster: project.clusterName || '',
trackingId: app.id,
recordVersion: app.recordVersion,
},
}}
/>
Expand Down
18 changes: 0 additions & 18 deletions src/apps/console/routes/test2/_index.tsx

This file was deleted.

15 changes: 8 additions & 7 deletions src/apps/console/server/gql/queries/app-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const appQueries = (executor: IExecutor) => ({
`,
{
transformer: (data: ConsoleRestartAppQuery) => data.core_restartApp,
vars: (_: ConsoleRestartAppQueryVariables) => { },
vars: (_: ConsoleRestartAppQueryVariables) => {},
}
),
createApp: executor(
Expand All @@ -55,7 +55,7 @@ export const appQueries = (executor: IExecutor) => ({
`,
{
transformer: (data: ConsoleCreateAppMutation) => data.core_createApp,
vars(_: ConsoleCreateAppMutationVariables) { },
vars(_: ConsoleCreateAppMutationVariables) {},
}
),

Expand All @@ -79,7 +79,7 @@ export const appQueries = (executor: IExecutor) => ({
transformer: (data: ConsoleUpdateAppMutation) => {
return data.core_updateApp;
},
vars(_: ConsoleUpdateAppMutationVariables) { },
vars(_: ConsoleUpdateAppMutationVariables) {},
}
),
interceptApp: executor(
Expand All @@ -103,7 +103,7 @@ export const appQueries = (executor: IExecutor) => ({
{
transformer: (data: ConsoleInterceptAppMutation) =>
data.core_interceptApp,
vars(_: ConsoleInterceptAppMutationVariables) { },
vars(_: ConsoleInterceptAppMutationVariables) {},
}
),
deleteApp: executor(
Expand All @@ -122,7 +122,7 @@ export const appQueries = (executor: IExecutor) => ({
`,
{
transformer: (data: ConsoleDeleteAppMutation) => data.core_deleteApp,
vars(_: ConsoleDeleteAppMutationVariables) { },
vars(_: ConsoleDeleteAppMutationVariables) {},
}
),
getApp: executor(
Expand All @@ -134,6 +134,7 @@ export const appQueries = (executor: IExecutor) => ({
) {
core_getApp(projectName: $projectName, envName: $envName, name: $name) {
id
recordVersion
createdBy {
userEmail
userId
Expand Down Expand Up @@ -274,7 +275,7 @@ export const appQueries = (executor: IExecutor) => ({
transformer(data: ConsoleGetAppQuery) {
return data.core_getApp;
},
vars(_: ConsoleGetAppQueryVariables) { },
vars(_: ConsoleGetAppQueryVariables) {},
}
),
listApps: executor(
Expand Down Expand Up @@ -424,7 +425,7 @@ export const appQueries = (executor: IExecutor) => ({
`,
{
transformer: (data: ConsoleListAppsQuery) => data.core_listApps,
vars(_: ConsoleListAppsQueryVariables) { },
vars(_: ConsoleListAppsQueryVariables) {},
}
),
});
1 change: 1 addition & 0 deletions src/generated/gql/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2438,6 +2438,7 @@ export type ConsoleGetAppQueryVariables = Exact<{
export type ConsoleGetAppQuery = {
core_getApp?: {
id: string;
recordVersion: number;
creationTime: any;
displayName: string;
enabled?: boolean;
Expand Down

0 comments on commit fb3d244

Please sign in to comment.