-
-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(organization): add new route for organization projects TASK-975 (#…
…5240) Make it possible to view your organization projects in a table. Add new route for viewing your organization projects at `#/projects/organization`. Make it possible to switch into the new route through the View Switcher UI element.
- Loading branch information
1 parent
eb92123
commit 699114b
Showing
7 changed files
with
111 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Libraries | ||
import React, {useState, useEffect} from 'react'; | ||
|
||
// Partial components | ||
import UniversalProjectsRoute from './universalProjectsRoute'; | ||
import LoadingSpinner from 'js/components/common/loadingSpinner'; | ||
|
||
// Stores, hooks and utilities | ||
import {useOrganizationQuery} from 'js/account/stripe.api'; | ||
|
||
// Constants and types | ||
import { | ||
ORG_VIEW, | ||
HOME_ORDERABLE_FIELDS, | ||
HOME_DEFAULT_VISIBLE_FIELDS, | ||
HOME_EXCLUDED_FIELDS, | ||
} from './projectViews/constants'; | ||
import {ROOT_URL} from 'js/constants'; | ||
import {endpoints} from 'js/api.endpoints'; | ||
|
||
/** | ||
* Component responsible for rendering organization projects route | ||
* (`#/organization/projects`). | ||
*/ | ||
export default function MyOrgProjectsRoute() { | ||
const orgQuery = useOrganizationQuery(); | ||
const [apiUrl, setApiUrl] = useState<string | null>(null); | ||
|
||
// We need to load organization data to build the api url. | ||
useEffect(() => { | ||
if (orgQuery.data) { | ||
setApiUrl(endpoints.ORG_ASSETS_URL.replace(':organization_id', orgQuery.data.id)); | ||
} | ||
}, [orgQuery.data]); | ||
|
||
// Display spinner until everything is ready to go forward. | ||
if (!apiUrl) { | ||
return <LoadingSpinner />; | ||
} | ||
|
||
return ( | ||
<UniversalProjectsRoute | ||
viewUid={ORG_VIEW.uid} | ||
baseUrl={`${ROOT_URL}${apiUrl}`} | ||
defaultVisibleFields={HOME_DEFAULT_VISIBLE_FIELDS} | ||
includeTypeFilter={false} | ||
defaultOrderableFields={HOME_ORDERABLE_FIELDS} | ||
defaultExcludedFields={HOME_EXCLUDED_FIELDS} | ||
isExportButtonVisible={false} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters