feat(commits): commit and task list.

This commit is contained in:
Ivan Li
2021-05-09 15:29:11 +08:00
parent 5d3f97667a
commit dbb81fa952
16 changed files with 784 additions and 32 deletions

View File

@ -1,6 +1,29 @@
import { ApolloClient, InMemoryCache } from "@apollo/client";
import { ApolloClient, ApolloLink, HttpLink, InMemoryCache } from "@apollo/client";
import { withScalars } from 'apollo-link-scalars';
import { buildClientSchema, IntrospectionQuery } from 'graphql';
import { DateTimeResolver } from 'graphql-scalars';
import introspectionResult from "../../generated/graphql.schema.json";
export const client = new ApolloClient({
const schema = buildClientSchema(
(introspectionResult as unknown) as IntrospectionQuery
);
const httpLink = new HttpLink({
uri: "/api/graphql",
cache: new InMemoryCache(),
});
const typesMap = {
DateTime: DateTimeResolver,
};
const link = ApolloLink.from([
(withScalars({ schema, typesMap }) as unknown) as ApolloLink,
httpLink,
]);
export function createApolloClient() {
return new ApolloClient({
ssrMode: typeof window === "undefined",
link,
cache: new InMemoryCache(),
});
}

View File

@ -0,0 +1,26 @@
import { gql } from '@apollo/client';
export const COMMIT_LIST_QUERY = gql`
query CommitListQuery($projectId: String!, $pipelineId: String!) {
project(id: $projectId) {
id
name
comment
webUrl
sshUrl
webHookSecret
}
pipeline(id: $pipelineId) {
id
name
branch
workUnitMetadata {
version
units {
type
scripts
}
}
}
}
`;