Skip to content

Commit 64b9666

Browse files
authored
Merge pull request #573 from dolthub/taylor/agent-doc
web,graphql: Support AGENT.md
2 parents 795eb63 + 758aa16 commit 64b9666

File tree

15 files changed

+240
-20
lines changed

15 files changed

+240
-20
lines changed

graphql-server/schema.gql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ enum DocType {
395395
Unspecified
396396
Readme
397397
License
398+
Agent
398399
}
399400

400401
enum DiffRowType {

graphql-server/src/docs/doc.enum.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export enum DocType {
55
Unspecified = "Unspecified",
66
Readme = "README.md",
77
License = "LICENSE.md",
8+
Agent = "AGENT.md",
89
}
910

1011
registerEnumType(DocType, { name: "DocType" });
@@ -15,6 +16,8 @@ export function toDocType(r: Row): DocType {
1516
return DocType.Readme;
1617
case "LICENSE.md":
1718
return DocType.License;
19+
case "AGENT.md":
20+
return DocType.Agent;
1821
default:
1922
return DocType.Unspecified;
2023
}

graphql-server/src/docs/doc.resolver.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,8 @@ export class DocsResolver {
2222
const conn = this.conn.connection();
2323
const docRows = await conn.getDocs(args);
2424
if (!docRows?.length) return { list: [] };
25-
const sortedDocs = docRows.sort(d =>
26-
d.doc_name === DocType.Readme ? -1 : 1,
27-
);
2825
return {
29-
list: sortedDocs.map(d => fromDoltDocsRow(args.refName, d)),
26+
list: docRows.map(d => fromDoltDocsRow(args.refName, d)),
3027
};
3128
}
3229

graphql-server/src/queryFactory/dolt/doltEntityManager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ export async function getDoltDocs(em: EntityManager): t.UPR {
141141
const sel = em
142142
.createQueryBuilder()
143143
.select("*")
144-
.from(DoltSystemTable.DOCS, "");
144+
.from(DoltSystemTable.DOCS, "")
145+
.orderBy("doc_name", "DESC");
145146
return handleTableNotFound(async () => sel.getRawMany());
146147
}
147148

web/jest.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import nextJest from "next/jest.js";
1+
const nextJest = require("next/jest");
22

33
const TEST_REGEX = "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|js?|tsx?|ts?)$";
44

@@ -36,4 +36,4 @@ const customJestConfig = {
3636
};
3737

3838
// createJestConfig is exported in this way to ensure that next/jest can load the Next.js config which is async
39-
export default createJestConfig(customJestConfig);
39+
module.exports = createJestConfig(customJestConfig);

web/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"uuid": "^11.1.0"
7676
},
7777
"devDependencies": {
78+
"@babel/core": "^7.28.0",
7879
"@electron/osx-sign": "^2.0.0",
7980
"@graphql-codegen/cli": "^5.0.5",
8081
"@graphql-codegen/fragment-matcher": "^5.1.0",
@@ -86,6 +87,7 @@
8687
"@testing-library/user-event": "^14.6.1",
8788
"@types/adm-zip": "^0",
8889
"@types/apollo-upload-client": "^17",
90+
"@types/babel__core": "^7",
8991
"@types/chance": "^1.1.5",
9092
"@types/diff": "^5.2.1",
9193
"@types/jest": "^29.5.6",

web/renderer/components/DatabaseHeaderAndNav/AddItemDropdown/DocItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function Inner(props: InnerProps) {
2323

2424
const canCreateNewDoc =
2525
props.userHasWritePerms &&
26-
(!res.data?.docs || res.data.docs.list.length < 2);
26+
(!res.data?.docs || res.data.docs.list.length < 3);
2727

2828
return <NewDocLink params={props.params} hide={!canCreateNewDoc} />;
2929
}
@@ -55,7 +55,7 @@ function NewDocLink(props: {
5555
doltDisabled={props.doltDisabled}
5656
hide={props.hide}
5757
>
58-
New README/LICENSE
58+
New doc
5959
</DropdownItem>
6060
);
6161
}

web/renderer/components/pageComponents/DatabasePage/ForDocs/DocsPage/DocList/NewDocButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function NewDocButton(props: Props) {
1717
<Button data-cy="add-doc-button">
1818
<div>
1919
<FiPlus />
20-
Add README/LICENSE
20+
Add doc
2121
</div>
2222
</Button>
2323
</Link>

web/renderer/components/pageComponents/DatabasePage/ForDocs/DocsPage/DocList/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type InnerProps = Props & {
1717
};
1818

1919
function Inner({ docs, params }: InnerProps) {
20-
const canCreateNewDoc = docs.list.length < 2;
20+
const canCreateNewDoc = docs.list.length < 3;
2121
return (
2222
<div className={css.docsContainer}>
2323
{docs.list.length > 0 && (

web/renderer/components/pageComponents/DatabasePage/ForDocs/NewDocPage/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default function Header(props: Props) {
1515
pageName="docs"
1616
className={css.goBack}
1717
/>
18-
<div className={css.title}>Add a README or LICENSE</div>
18+
<div className={css.title}>Add a doc</div>
1919
</div>
2020
);
2121
}

0 commit comments

Comments
 (0)