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

[RELEASE] Rare Redwood #602

Merged
merged 122 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
f65bfc7
[TM-1272] Initial API fetcher and types generation for v3.
roguenet Sep 18, 2024
3d87fe6
[TM-1272] Namespace the generated client side files by service.
roguenet Sep 18, 2024
ec064de
[TM-1272] Update the service documentation path.
roguenet Sep 18, 2024
0a469ef
[TM-1272] API Connection system implemented.
roguenet Sep 19, 2024
321cbcd
[TM-1272] Functional login/logout.
roguenet Sep 21, 2024
0624850
[TM-1272] Rename hook.
roguenet Sep 21, 2024
bd5127e
[TM-1272] Remove some props passing of isLoggedIn.
roguenet Sep 21, 2024
945e314
[TM-1272] Remove old AuthContext
roguenet Sep 23, 2024
079b614
[TM-1272] Replaced console usage with a new central logger.
roguenet Sep 23, 2024
a8c6d7b
[TM-1272] Unit tests for useConnection.
roguenet Sep 23, 2024
28679a0
[TM-1272] Document the steps needed when adding a new service or reso…
roguenet Sep 23, 2024
1b9db6e
[TM-1272] Catch the generator up with some changes that happened to t…
roguenet Sep 23, 2024
19342a9
[TM-1272] Add a link to the new Connections documentation.
roguenet Sep 23, 2024
a044bdd
[TM-1272] Specs for the useConnection hook.
roguenet Sep 24, 2024
bec351c
[TM-1272] Get storybook and test:ci fully working.
roguenet Sep 24, 2024
e301b0a
Merge pull request #501 from wri/feat/TM-1272-v3-integration
roguenet Sep 24, 2024
08f6b23
[TM-1312] Adapt to the more robust JSON:API shape the v3 BE is sendin…
roguenet Sep 27, 2024
28f8f24
[TM-1312] Implemented a functional myUserConnection.
roguenet Sep 27, 2024
dbe7c3e
[TM-1312] Implement useConnections
roguenet Sep 27, 2024
75919d9
[TM-1312] Implement connections that take props.
roguenet Sep 27, 2024
ab75cd9
[TM-1312] Get rid of v1/2 users/me access.
roguenet Sep 27, 2024
6513db6
[TM-1312] Get the redux store to play nice with SSR.
roguenet Sep 30, 2024
4e4f9c5
[TM-1312] Get the admin site working again.
roguenet Sep 30, 2024
d19610b
[TM-1312] Make the default pattern for accessing connections be throu…
roguenet Sep 30, 2024
5610324
[TM-1312] Make sure users/me is loaded when the useMyOrg hook is in use.
roguenet Oct 1, 2024
d5cee9a
[TM-1312] Fix the useConnection test.
roguenet Oct 7, 2024
c10af9b
[TM-1312] Fix the middleware tests.
roguenet Oct 7, 2024
358fe67
[TM-1312] Fix up storybook usage of connections.
roguenet Oct 7, 2024
7a9fff8
Merge pull request #513 from wri/feat/TM-1312-users-me
roguenet Oct 8, 2024
1bb94de
Bump markdown-to-jsx from 7.2.0 to 7.5.0
dependabot[bot] Oct 15, 2024
af84405
Merge pull request #563 from wri/dependabot/npm_and_yarn/markdown-to-…
roguenet Oct 17, 2024
7ff5f39
Feat/tm 1343 popup centroids (#571)
egrojMonroy Oct 21, 2024
26e8486
Merge pull request #573 from wri/main
roguenet Oct 22, 2024
28500c3
[TM-1378] call data for project list view table (#574)
LimberHope Oct 22, 2024
69ac0fd
Merge remote-tracking branch 'origin/staging' into merge/staging-v3-epic
roguenet Oct 22, 2024
1e8d5ef
[TM-1269] convert new uses of console to Log
roguenet Oct 22, 2024
f73605f
[TM-1308] fix: restore fileInputProps to file input (#575)
LimberHope Oct 22, 2024
2417563
[TM-1369] implement jobs created data and util functions (#569)
cesarLima1 Oct 22, 2024
fb747bf
[TM-1370] add grouped bar chart for jobs created (#570)
cesarLima1 Oct 22, 2024
d84bf6e
[TM-1269] Regenerate API
roguenet Oct 22, 2024
8506573
[TM-1371] Doughnut chart volunteers (#572)
cesarLima1 Oct 22, 2024
71fb4aa
[TM-1343] add polygons visible in dashboard with popups (#578)
egrojMonroy Oct 22, 2024
605759d
Merge pull request #580 from wri/merge/staging-v3-epic
roguenet Oct 22, 2024
a5145cd
Revert "[MERGE] staging -> v3 epic"
roguenet Oct 22, 2024
ea301d9
Merge pull request #581 from wri/revert-580-merge/staging-v3-epic
roguenet Oct 22, 2024
87cbb35
[TM-1410] dashboard update tooltip definitions and related items (#585)
dottyy Oct 22, 2024
f780f3e
Merge pull request #587 from wri/main
roguenet Oct 23, 2024
8827089
[TM-1374] add data to target land use types graphic (#588)
cesarLima1 Oct 23, 2024
8ca593a
[TM-1272] Initial API fetcher and types generation for v3.
roguenet Sep 18, 2024
c1abcca
[TM-1272] Namespace the generated client side files by service.
roguenet Sep 18, 2024
b17cd1f
[TM-1272] Update the service documentation path.
roguenet Sep 18, 2024
b306f18
[TM-1272] API Connection system implemented.
roguenet Sep 19, 2024
1bb69a2
[TM-1272] Functional login/logout.
roguenet Sep 21, 2024
c7f09bd
[TM-1272] Rename hook.
roguenet Sep 21, 2024
3cdfca6
[TM-1272] Remove some props passing of isLoggedIn.
roguenet Sep 21, 2024
81d8895
[TM-1272] Remove old AuthContext
roguenet Sep 23, 2024
a26aba3
[TM-1272] Replaced console usage with a new central logger.
roguenet Sep 23, 2024
4895d49
[TM-1272] Unit tests for useConnection.
roguenet Sep 23, 2024
6d9e0fb
[TM-1272] Document the steps needed when adding a new service or reso…
roguenet Sep 23, 2024
681dfd1
[TM-1272] Catch the generator up with some changes that happened to t…
roguenet Sep 23, 2024
189bcf0
[TM-1272] Add a link to the new Connections documentation.
roguenet Sep 23, 2024
db3538b
[TM-1272] Specs for the useConnection hook.
roguenet Sep 24, 2024
a09ae3e
[TM-1272] Get storybook and test:ci fully working.
roguenet Sep 24, 2024
a2b1ad1
[TM-1312] Adapt to the more robust JSON:API shape the v3 BE is sendin…
roguenet Sep 27, 2024
12c8327
[TM-1312] Implemented a functional myUserConnection.
roguenet Sep 27, 2024
1ae76dd
[TM-1312] Implement useConnections
roguenet Sep 27, 2024
57f411e
[TM-1312] Implement connections that take props.
roguenet Sep 27, 2024
37f09a7
[TM-1312] Get rid of v1/2 users/me access.
roguenet Sep 27, 2024
1771e2f
[TM-1312] Get the redux store to play nice with SSR.
roguenet Sep 30, 2024
177df14
[TM-1312] Get the admin site working again.
roguenet Sep 30, 2024
0250791
[TM-1312] Make the default pattern for accessing connections be throu…
roguenet Sep 30, 2024
f6c9f27
[TM-1312] Make sure users/me is loaded when the useMyOrg hook is in use.
roguenet Oct 1, 2024
3be91bc
[TM-1312] Fix the useConnection test.
roguenet Oct 7, 2024
ee37b17
[TM-1312] Fix the middleware tests.
roguenet Oct 7, 2024
eae6afb
[TM-1312] Fix up storybook usage of connections.
roguenet Oct 7, 2024
a1dc6d7
[TM-1269] convert new uses of console to Log
roguenet Oct 22, 2024
fd81c92
[TM-1269] Regenerate API
roguenet Oct 22, 2024
2265868
[TM-1269] Fix build error
roguenet Oct 22, 2024
21457ac
[TM-1269] Fix build error
roguenet Oct 22, 2024
4471707
[TM-1372] add metrics for total hectares under restoration and number…
cesarLima1 Oct 23, 2024
e3e350a
[TM-1413] add null safety when calling layers (#590)
pachonjcl Oct 23, 2024
ea255a1
Merge remote-tracking branch 'origin/staging' into epic/TM-1269-v3-in…
roguenet Oct 23, 2024
8ddcb43
[TM-1269] Regenerate API integration with health controller ignored.
roguenet Oct 23, 2024
ab8e1d5
[TM-1354] Generate delayed jobs API integration.
roguenet Oct 23, 2024
6aa5307
[TM-1354] Implement connection and hook for fetching delayed jobs.
roguenet Oct 23, 2024
0ccc0e7
[TM-1373] restoration strategies chart (#591)
cesarLima1 Oct 24, 2024
ab69b53
[TM-1407] project profile dashboard (#592)
cesarLima1 Oct 24, 2024
1bef7d3
[TM-1269] Get us on the same node version as the microservices repo.
roguenet Oct 25, 2024
1dd7b25
Merge pull request #593 from wri/epic/TM-1269-v3-integration
roguenet Oct 25, 2024
5b5cb7c
[TM-1313] Z-index position menu in table active project (#594)
dottyy Oct 25, 2024
43390eb
[TM-1407] update active project table dynamically (#595)
cesarLima1 Oct 25, 2024
eab551c
Merge remote-tracking branch 'origin/staging' into feat/TM-1354-delay…
roguenet Oct 25, 2024
6a3fa7d
[TM-1269] Implement delayed job response as a middleware on apiFetcher.
roguenet Oct 28, 2024
67089b3
[TM-1269] Change how we host v3 services to avoid the Api Gateway loc…
roguenet Oct 28, 2024
ddc3fdd
[TM-1269] Resolved the delayed job endpoint as V3.
roguenet Oct 28, 2024
3e576c6
[TM-1269] Provide examples in the env sample.
roguenet Oct 28, 2024
fee45aa
TM-1407 add read more on objective sec (#598)
diego-morales-flores-1996 Oct 29, 2024
252aee4
TM-1313 remove tolltips and image button (#597)
diego-morales-flores-1996 Oct 29, 2024
9e5bc2b
Merge remote-tracking branch 'origin/staging' into feat/TM-1354-delay…
roguenet Oct 29, 2024
b503f0a
[TM-1411] Fix entity edit for admins.
roguenet Oct 29, 2024
cc40d06
[TM-1407] change from project to organization (#600)
cesarLima1 Oct 29, 2024
a6f9d93
Merge pull request #599 from wri/fix/TM-1411-admin-entity-edit
roguenet Oct 29, 2024
e2a5933
Merge remote-tracking branch 'origin/staging' into feat/TM-1354-delay…
roguenet Oct 29, 2024
8a6afac
[TM-1319] Add HotJar and GoogleAnalytics to the Dashboard (#601)
cesarLima1 Oct 29, 2024
9bc6dd5
[TM-1354] fix loaders
egrojMonroy Oct 29, 2024
19829cc
Merge branch 'feat/TM-1354-delayed-jobs' of https://github.com/wri/wr…
egrojMonroy Oct 29, 2024
a8b7ab2
Merge pull request #596 from wri/feat/TM-1354-delayed-jobs
roguenet Oct 29, 2024
d7d243f
fix: HBF Workday Implementation corrections
Scriptmatico Oct 30, 2024
98274ce
[TM-1407] rename table from organization to project (#604)
cesarLima1 Oct 30, 2024
7bd0b21
Provide redux context in modal react roots.
roguenet Oct 30, 2024
8a9fd41
Merge pull request #605 from wri/fix/redux-context-in-map-modal
roguenet Oct 30, 2024
682a708
fix: add hbf youth
Scriptmatico Oct 30, 2024
e41d2cd
Merge pull request #603 from wri/TM-1415
Scriptmatico Oct 30, 2024
951a18a
[TM-1366] change values in landscape options (#606)
cesarLima1 Oct 30, 2024
c79f3a9
[TM-1415] Provide the framework to getCustomFormSteps when possible.
roguenet Oct 30, 2024
ef8802d
Merge pull request #607 from wri/fix/TM-1415-framework-access
roguenet Oct 30, 2024
439dc81
[TM-1415] Provide framework to all tabs on the entity show pages.
roguenet Oct 31, 2024
b37dcd8
[TM-1415] Get the framework from context.
roguenet Oct 31, 2024
49ea32a
Merge pull request #610 from wri/fix/TM-1415-framework-access
roguenet Oct 31, 2024
cc18e3f
[TM-1429] bulk deletion (#612)
egrojMonroy Oct 31, 2024
2a204ce
[TM-1434] unable to download reports admin (#614)
pachonjcl Nov 1, 2024
681b6ab
[TM-1434] fix url usage (#616)
pachonjcl Nov 1, 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
17 changes: 7 additions & 10 deletions .env.local.sample
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
# Local dev configuration
NEXT_PUBLIC_API_BASE_URL='http://localhost:8080'
NEXT_PUBLIC_USER_SERVICE_URL='http://localhost:4010'
NEXT_PUBLIC_JOB_SERVICE_URL='http://localhost:4020'

# Accessing staging instead of local BE
NEXT_PUBLIC_API_BASE_URL='https://api-staging.terramatch.org'

# Browser accessible variables
NEXT_PUBLIC_API_BASE_URL =
NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN =
NEXT_PUBLIC_SENTRY_DSN =

TRANSIFEX_TOKEN =
TRANSIFEX_SECRET =
TRANSIFEX_TRANSLATIONS_TTL_SEC = 10

SENTRY_DSN =
SENTRY_AUTH_TOKEN =

SENTRY_PROJECT =
SENTRY_ORG =


NEXT_PUBLIC_GEOSERVER_URL =
NEXT_PUBLIC_GEOSERVER_WORKSPACE =

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.17.0
20.11.1
11 changes: 11 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "src/styles/globals.css";
import * as NextImage from "next/image";
import { StoreProvider } from "../src/utils/testStore";

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
Expand All @@ -24,3 +25,13 @@ Object.defineProperty(NextImage, "default", {
/>
)
});

export const decorators = [
(Story, options) => {
const { parameters } = options;

return <StoreProvider storeBuilder={parameters.storeBuilder}>
<Story {...options} />
</StoreProvider>;
},
];
48 changes: 47 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To generate Api types/queries/fetchers/hooks, this repo uses:

#### Usage

In order to generate from the api (whenever there is some backend endpoint/type change) please use this command:
In order to generate from the v1/2 api (whenever there is some backend endpoint/type change) please use this command:

```
yarn generate:api
Expand All @@ -35,6 +35,52 @@ We can customize the `baseUrl` of where we are fetching from by changing the `co
This is super useful if we want to globally set some headers for each request (such as Authorization header).
It exposes a component hook so we can use other hooks (such as Auth hook or context) to get the logged in token for example and inject it in the global request context.

##### v3 API
The V3 API has a different API layer, but the generation is similar:
```
yarn generate:services
```

When adding a new **service** app to the v3 API:
* In your local .env, define the service URL
* In `openapi-codegen.config.ts`, add the new service name to the `SERVICES` object (e.g. `foo-service`).
* This will generate a new target, which needs to be added to `package.json`:
* Under scripts, add `"generate:fooService": "npm run generate:fooService"`
* Under the `"generate:services"` script, add the new service: `"generate:services": "npm run generate:userService && npm run generate:fooService`
* After running `yarn generate:fooService` the first time, open the generated `fooServiceFetcher.ts` and
modify it to match `userServiceFetcher.ts`.
* This file does not get regenerated after the first time, and so it can utilize the same utilities
for interfacing with the redux API layer / connection system that the other v3 services use.
* Follow directions below for all namespaces and resources in the new service

When adding a new **namespace** to the V3 API:
* In `geneated/v3/utils.ts`, add namespace -> service URL mapping to `V3_NAMESPACES`

When adding a new **resource** to the v3 API:
* The resource needs to be specified in shape of the redux API store. In `apiSlice.ts`, add the new
resource plural name (the `type` returned in the API responses) to the store by adding it to the
`RESOURCES` const. This will make sure it's listed in the type of the ApiStore so that resources that match that type are seamlessly folded into the store cache structure.
* The shape of the resource should be specified by the auto-generated API. This type needs to be
added to the `ApiResource` type in `apiSlice.ts`. This allows us to have strongly typed results
coming from the redux API store.

### Connections
Connections are a **declarative** way for components to get access to the data from the cached API
layer that they need. This system is under development, and the current documentation about it is
[available in Confluence](https://gfw.atlassian.net/wiki/spaces/TerraMatch/pages/1423147024/Connections)

Note for Storybook: Because multiple storybook components can be on the page at the same time that each
have their own copy of the redux store, the Connection utilities `loadConnection` (typically used
via `connectionLoaded` in `connectionShortcuts.ts`) and `connectionSelector` will not work as expected
in storybook stories. This is because those utilities rely on `ApiSlice.redux` and `ApiSlice.apiDataStore`,
and in the case of storybook, those will end up with only the redux store from the last component on the
page. Regular connection use through `useConnection` will work because it gets the store from the
Provider in the redux component tree in that case.

When building storybook stories for components that rely on connections via `useConnection`, make sure
that the story is provided with a store that has all dependent data already loaded. See `testStore.tsx`'s
`buildStore` builder, and `Navbar.stories.tsx` for example usage.

## Translation ([Transifex Native SDK](https://developers.transifex.com/docs/native)).

Transifex native sdk provides a simple solution for internationalization.
Expand Down
Loading