Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/1010 dropdowns infra #1014

Merged
merged 56 commits into from
Dec 9, 2024
Merged
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
b5e9375
feat: fetch from devhub-cache-api-rs.fly.dev
Tguntenaar Nov 6, 2024
48d8365
@Megha-Dev-19 WIP
Tguntenaar Nov 13, 2024
c6fde60
wip
Tguntenaar Nov 13, 2024
97d10d5
fmt
Tguntenaar Nov 13, 2024
c4d856e
wip
Tguntenaar Nov 15, 2024
32965d6
events and devhub are ready to be reviewed
Tguntenaar Nov 15, 2024
bc05626
feat: infra proposals
Tguntenaar Nov 15, 2024
f126fc8
fmt
Tguntenaar Nov 15, 2024
a4980a5
feat: rfps infra
Tguntenaar Nov 15, 2024
d9a8b6a
remove comments
Tguntenaar Nov 15, 2024
e796489
fix: spelling
Tguntenaar Nov 19, 2024
ec7c610
fix: spelling
Tguntenaar Nov 20, 2024
96ab80c
replace all nearqueryapi in devhub related to proposals and rfps
Tguntenaar Nov 20, 2024
6d9bbdf
devhub: simplemde, acceptedTerms, passing instance
Tguntenaar Nov 21, 2024
e721ee6
fix: devhub
Tguntenaar Nov 21, 2024
e17e72c
refactor events: deleted SimpleMDE and LinkedProposalsDropdown for both
Tguntenaar Nov 21, 2024
0d25bac
test: replace all references of queryapi in tests
Tguntenaar Nov 21, 2024
f63612a
test: fix linkedProposals and simpleMDE test :)
Tguntenaar Nov 21, 2024
0484689
test: skip discussions test for now
Tguntenaar Nov 21, 2024
7546c0f
clean up SimpleMDE
Tguntenaar Nov 22, 2024
330476a
infra: SimpleMDE, LinkedDropdown rfp + proposal, Proposal + Rfp.jsx, …
Tguntenaar Nov 22, 2024
a6a28a3
test: fix events test, 1. had to deploy events with new cors policy, …
Tguntenaar Nov 22, 2024
f744909
test: infra -- fix: should show correct linked RFP to a proposal in f…
Tguntenaar Nov 22, 2024
7f6a2f4
test: infra -- fix: should create proposal and link an RFP
Tguntenaar Nov 22, 2024
f6fa221
remove comments
Tguntenaar Nov 22, 2024
dff2af3
test: @petersalomonsen fixed!
Tguntenaar Nov 22, 2024
d904a6b
fmt
Tguntenaar Nov 22, 2024
99bf15a
test: discussions test back in
Tguntenaar Nov 22, 2024
b08601f
test: skip discussions test
Tguntenaar Nov 23, 2024
4805d33
revert: changes to rfp comment test
Tguntenaar Nov 24, 2024
83785a6
initial commit 1002
Tguntenaar Dec 3, 2024
14a1341
fmt
Tguntenaar Dec 3, 2024
5061189
Merge branch 'main' into feature/1002-feed
petersalomonsen Dec 3, 2024
7edd4ad
test for comparing local feed with production
petersalomonsen Dec 3, 2024
4a8f7b3
add events committee feed components + by-sort component
Tguntenaar Dec 4, 2024
9f4b5f0
fmt
Tguntenaar Dec 4, 2024
a938540
compare links in prod and local
petersalomonsen Dec 4, 2024
d8f882e
test: update events test
Tguntenaar Dec 5, 2024
3d95784
add events committee feed components + by-sort component
Tguntenaar Dec 4, 2024
be199e6
fmt
Tguntenaar Dec 4, 2024
3211999
test: update events test
Tguntenaar Dec 5, 2024
bf4ac5f
Merge branch 'feature/1002-feed' of github.com:Tguntenaar/neardevhub-…
Tguntenaar Dec 5, 2024
ea1d5bb
test: comment spec
Tguntenaar Dec 5, 2024
29ab16a
test: included some test from pr 982
Tguntenaar Dec 5, 2024
98d752a
revert commit
Tguntenaar Dec 6, 2024
444dee5
feat: simpleMDE to new api
Tguntenaar Dec 6, 2024
6fc1d60
fmt
Tguntenaar Dec 6, 2024
c768b10
feat: linkedproposaldropdown to new api
Tguntenaar Dec 6, 2024
8984298
fmt
Tguntenaar Dec 6, 2024
ca5f1e0
test: proposal autolink
Tguntenaar Dec 6, 2024
0292094
Merge branch 'main' of github.com:NEAR-DevHub/neardevhub-bos into fea…
Tguntenaar Dec 7, 2024
dba0972
Merge branch 'feature/replace-indexer-with-api' of github.com:Tgunten…
Tguntenaar Dec 7, 2024
6e310da
fix: simplemde + test
Tguntenaar Dec 8, 2024
2a55cfc
linked dropdowns
Tguntenaar Dec 8, 2024
1a63613
Merge branch 'main' of github.com:NEAR-DevHub/neardevhub-bos into fea…
Tguntenaar Dec 8, 2024
cc5cd2a
test: search for rfp by id
Tguntenaar Dec 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: fetch from devhub-cache-api-rs.fly.dev
  • Loading branch information
Tguntenaar committed Nov 6, 2024
commit b5e9375cadab052460bb38817df525226878262b
80 changes: 47 additions & 33 deletions instances/devhub.near/widget/devhub/entity/proposal/Feed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,6 @@ const FeedPage = () => {

const buildWhereClause = () => {
let where = {};
if (state.author) {
where = { author_id: { _eq: state.author }, ...where };
}

if (state.category) {
if (isInfra || isEvents) {
Expand All @@ -366,13 +363,6 @@ const FeedPage = () => {
}
}

if (state.stage) {
// timeline is stored as jsonb
where = {
timeline: { _cast: { String: { _regex: `${state.stage}` } } },
...where,
};
}
if (state.input) {
const { number, text } = separateNumberAndText(state.input);
if (number) {
Expand All @@ -399,6 +389,30 @@ const FeedPage = () => {
fetchProposals(state.data.length);
};

/**
* { name: { _iregex: `${text}` } },
{ summary: { _iregex: `${text}` } },
{ descriptio
*/

function fetchCacheApi(variables) {
// TODO: move to config
const ENDPOINT = "https://devhub-cache-api-rs.fly.dev";
console.log("Fetching cache api", variables);

return asyncFetch(
`${ENDPOINT}/proposals?offset=${variables.offset}&limit=${variables.limit}&stage=${variables.stage}&author_id=${variables.author_id}&category=${variables.category}`,
{
method: "GET",
headers: {
accept: "application/json",
},
}
).catch((error) => {
console.log("Error fetching cache api", error);
});
}

const fetchProposals = (offset) => {
if (!offset) {
offset = 0;
Expand All @@ -409,32 +423,32 @@ const FeedPage = () => {
const variables = {
limit: FETCH_LIMIT,
offset,
where: buildWhereClause(),
author_id: state.author,
stage: state.stage,
category: state.category,
};
fetchGraphQL(query, "GetLatestSnapshot", variables).then(async (result) => {
if (result.status === 200) {
if (result.body.data) {
const data = result.body.data[proposalFeedIndexerQueryName];
const totalResult =
result.body.data[`${proposalFeedIndexerQueryName}_aggregate`];
const promises = data.map((item) => {
if (isNumber(item.linked_rfp)) {
return fetchGraphQL(rfpQuery, "GetLatestSnapshot", {
where: { rfp_id: { _eq: item.linked_rfp } },
}).then((result) => {
const rfpData = result.body.data?.[rfpFeedIndexerQueryName];
return { ...item, rfpData: rfpData[0] };
});
} else {
return Promise.resolve(item);
}
});
Promise.all(promises).then((res) => {
State.update({ aggregatedCount: totalResult.aggregate.count });
fetchBlockHeights(res, offset);
fetchCacheApi(variables).then((result) => {
console.log("result", result);
let data = result.body.records;
let totalResult = { aggregate: { count: data.length } }; // TODO

const promises = data.map((item) => {
if (isNumber(item.linked_rfp)) {
return; // TODO index RFPs
fetchGraphQL(rfpQuery, "GetLatestSnapshot", {
where: { rfp_id: { _eq: item.linked_rfp } },
}).then((result) => {
const rfpData = result.body.data?.[rfpFeedIndexerQueryName];
return { ...item, rfpData: rfpData[0] };
});
} else {
return Promise.resolve(item);
}
}
});
Promise.all(promises).then((res) => {
State.update({ aggregatedCount: totalResult.aggregate.count });
fetchBlockHeights(res, offset);
});
});
};

Expand Down
Loading