-
Notifications
You must be signed in to change notification settings - Fork 0
feat: upgrade access feature #91
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
Open
ErwanDecoster
wants to merge
61
commits into
main
Choose a base branch
from
feature/upgrade-access-feature
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,121
−16
Open
Changes from 56 commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
67ee922
feat: add tab navigation for app details and deals in AppsRoute compo…
ErwanDecoster e2de601
feat: add AppAccessTable component and integrate into AppsRoute
ErwanDecoster ca724b5
feat: enhance AppAccessTable and AppDealsTable with loading and outda…
ErwanDecoster aeae164
feat: rename columns to appColumns and remove app address and price c…
ErwanDecoster 10c2da9
feat: add tab navigation for dataset details, deals, and access in Da…
ErwanDecoster df51a0e
feat: integrate loading and outdated state management in DatasetDeals…
ErwanDecoster 6970d14
feat: add DatasetAccessTable component and integrate it into Datasets…
ErwanDecoster 691c276
feat: add tab navigation for workerpool details, deals, and access
ErwanDecoster 9a9ac27
feat: enhance WorkerpoolDealsTable with loading and outdated state ma…
ErwanDecoster f26634d
feat: add WorkerpoolAccessTable component and integrate it into Worke…
ErwanDecoster d05f864
feat: refactor loading and outdated state management in access and de…
ErwanDecoster 6a02688
feat: add access tables for apps, datasets, and workerpools on addres…
ErwanDecoster f93cdc2
fix: correct import path for WorkerpoolAccessTable component
ErwanDecoster f340188
refactor: remove console logs from access data fetching functions
ErwanDecoster d35aa68
feat: enhance pagination logic to display all pages for 7 or fewer to…
ErwanDecoster 4efb46f
feat: update pagination logic to support mobile-first design and dyna…
ErwanDecoster 6332132
feat: update access data fetching logic to support pagination and tot…
ErwanDecoster 2e677ba
fix: prevent rendering of pagination controls for invalid states
ErwanDecoster 83f837e
refactor: prettier
ErwanDecoster 66d27df
fix: stabilize pagination rendering during lading state
ErwanDecoster 198d0ed
fix: normalize case for order restrictions in CopyButton components
ErwanDecoster 370ab44
Merge branch 'main' into feature/add-assets-order
ErwanDecoster 53f512f
fix: useTabParam() name in dataset
ErwanDecoster 985787e
fix: correct error message wording in loading alerts across multiple …
ErwanDecoster 2f58900
Merge branch 'feature/add-assets-order' of https://github.com/iExecBl…
ErwanDecoster 81c3397
feat: add price column with token symbol for app, dataset, and worker…
ErwanDecoster a811ac9
fix: conditionally apply cursor pointer class based on destination
ErwanDecoster f094a9d
feat: format access data to include destination paths for apps, datas…
ErwanDecoster 2046f43
fix: adjust indicator position calculation to include scroll offset
ErwanDecoster 1afc908
fix: update initIExecSDKs to work without wallet connection
ErwanDecoster 0a52e58
fix: convert price values from NRLC to RLC across app, dataset, and w…
ErwanDecoster f2675be
fix: update orderbook fetch calls to include 'any' for dataset, app, …
ErwanDecoster 5cfa44e
fix: improve pagination stability by updating totalPages reference co…
ErwanDecoster b43dce0
feat: rename "access" tables to "access from"
ErwanDecoster 90c6523
fix: remove unused datasetOwner parameter from dataset orderbook fetch
ErwanDecoster 38a483c
fix: update query keys to use 'accessFrom' for apps, datasets, and wo…
ErwanDecoster b15e315
feat: add access to tables for apps, datasets, and workerpools to add…
ErwanDecoster 65b14e9
fix: stabilize pagination by resetting totalPages reference on chainI…
ErwanDecoster b005643
fix: remove debug log for provider in initIExecSDKs function
ErwanDecoster 732a2e8
fix: include 'requester' parameter as 'any' in access data queries fo…
ErwanDecoster 5c27c6b
fix: reorder AddressAppsAccessTable in AddressRoute component
ErwanDecoster 9dd6585
Merge branch 'feature/add-assets-order' into feature/upgrade-access-f…
ErwanDecoster 1e3ee07
fix: reorder AddressAppsAccessFromTable in AddressRoute component
ErwanDecoster 45d1f8b
feat: rename access table "access from/to" to "granted/received access"
ErwanDecoster 09c2724
feat: add Access page
ErwanDecoster a1509d8
feat: convert dataset prices to RLC format in buildAccessDetails func…
ErwanDecoster cf3144e
feat: update access destination paths to use orderHash for all access…
ErwanDecoster 96179ff
fix: remove unnecessary refetchInterval and console log in useAccessData
ErwanDecoster a5c6739
feat: enhance buildAccessDetails function with type-specific access h…
ErwanDecoster bdd7817
fix: add 'order' type to LinkType in SmartLinkGroup usage in buildAcc…
ErwanDecoster f3e7e3e
feat: implement revoke access functionality for app, dataset, and wor…
ErwanDecoster a2a412a
fix: adjust padding in tab buttons for improved layout
ErwanDecoster 0d9cef6
fix: update comment to reflect correct number of displayed items per …
ErwanDecoster 108ab36
fix: remove unnecessary console log and adjust access check placement…
ErwanDecoster 999d308
Merge branch 'main' into feature/upgrade-access-feature
ErwanDecoster ff4152b
fix: remove unused imports for access tables in address layout
ErwanDecoster 0e57f85
feat: update access routes and components for apps, datasets, and wor…
ErwanDecoster 862ea0b
refactor: remove access hash route and related components
ErwanDecoster 4c814f3
feat: enhance SmartLinkGroup to conditionally display address or ID a…
ErwanDecoster 4afb03f
feat: add revoke access button on user access granted page
ErwanDecoster ccfb71d
Merge branch 'main' into feature/upgrade-access-feature
ErwanDecoster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,34 @@ | ||
| const DatasetIcon = ({ size = 20, className = '' }) => ( | ||
| <svg | ||
| width={size} | ||
| height={size} | ||
| viewBox="0 0 24 25" | ||
| fill="none" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| className={className} | ||
| > | ||
| <path | ||
| d="M12 9.16691C16.1421 9.16691 19.5 8.04764 19.5 6.66695C19.5 5.28626 16.1421 4.16699 12 4.16699C7.85786 4.16699 4.5 5.28626 4.5 6.66695C4.5 8.04764 7.85786 9.16691 12 9.16691Z" | ||
| stroke="currentColor" | ||
| strokeWidth="2.4" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| <path | ||
| d="M19.5 12.5C19.5 13.8834 16.1666 15 12 15C7.83336 15 4.5 13.8832 4.5 12.5" | ||
| stroke="currentColor" | ||
| strokeWidth="2.4" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| <path | ||
| d="M4.5 6.66602V18.3327C4.5 19.716 7.83336 20.8326 12 20.8326C16.1666 20.8326 19.5 19.7159 19.5 18.3327V6.66602" | ||
| stroke="currentColor" | ||
| strokeWidth="2.4" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| </svg> | ||
| ); | ||
|
|
||
| export default DatasetIcon; |
This file contains hidden or 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 hidden or 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,35 @@ | ||
| import { ChainLink } from '@/components/ChainLink'; | ||
| import { | ||
| Breadcrumb, | ||
| BreadcrumbItem, | ||
| BreadcrumbLink, | ||
| BreadcrumbList, | ||
| BreadcrumbPage, | ||
| BreadcrumbSeparator, | ||
| } from '@/components/ui/breadcrumb'; | ||
| import { truncateAddress } from '@/utils/truncateAddress'; | ||
|
|
||
| type AccessBreadcrumbsProps = { | ||
| accessHash: string; | ||
| }; | ||
|
|
||
| export function AccessBreadcrumbs({ accessHash }: AccessBreadcrumbsProps) { | ||
| return ( | ||
| <Breadcrumb> | ||
| <BreadcrumbList> | ||
| <BreadcrumbItem> | ||
| <BreadcrumbLink asChild> | ||
| <ChainLink to="/">Homepage</ChainLink> | ||
| </BreadcrumbLink> | ||
| </BreadcrumbItem> | ||
| <BreadcrumbSeparator /> | ||
| <BreadcrumbItem> | ||
| <BreadcrumbPage> | ||
| Access{' '} | ||
| <span className="font-normal">{truncateAddress(accessHash)}</span> | ||
| </BreadcrumbPage> | ||
| </BreadcrumbItem> | ||
| </BreadcrumbList> | ||
| </Breadcrumb> | ||
| ); | ||
| } |
This file contains hidden or 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,70 @@ | ||
| import { useMutation, useQueryClient } from '@tanstack/react-query'; | ||
| import { | ||
| PublishedApporder, | ||
| PublishedDatasetorder, | ||
| PublishedWorkerpoolorder, | ||
| } from 'iexec/IExecOrderbookModule'; | ||
| import { LoaderCircle } from 'lucide-react'; | ||
| import { Button } from '@/components/ui/button'; | ||
| import { getIExec } from '@/externals/iexecSdkClient'; | ||
| import useUserStore from '@/stores/useUser.store'; | ||
|
|
||
| export default function RevokeAccess({ | ||
| access, | ||
| }: { | ||
| access: PublishedApporder | PublishedDatasetorder | PublishedWorkerpoolorder; | ||
| }) { | ||
| const { chainId } = useUserStore(); | ||
| const queryClient = useQueryClient(); | ||
|
|
||
| const order = access.order; | ||
|
|
||
| const revokeAccessMutation = useMutation({ | ||
| mutationFn: async () => { | ||
| const iexec = await getIExec(); | ||
|
|
||
| if ('app' in order) { | ||
| return await iexec.order.cancelApporder(order); | ||
| } else if ('dataset' in order) { | ||
| return await iexec.order.cancelDatasetorder(order); | ||
| } else if ('workerpool' in order) { | ||
| return await iexec.order.cancelWorkerpoolorder(order); | ||
| } else { | ||
| throw new Error('Unknown order type'); | ||
| } | ||
| }, | ||
| onError: (err) => { | ||
| console.error(err); | ||
| }, | ||
| onSuccess: () => { | ||
| let accessType = ''; | ||
| if ('app' in order) { | ||
| accessType = 'App'; | ||
| } else if ('dataset' in order) { | ||
| accessType = 'Dataset'; | ||
| } else { | ||
| accessType = 'Workerpool'; | ||
| } | ||
| queryClient.invalidateQueries({ | ||
| queryKey: [chainId, 'address', `${accessType}sGrantedAccess`], | ||
| }); | ||
| }, | ||
| }); | ||
|
|
||
| if (!access) return; | ||
|
|
||
| return ( | ||
| <Button | ||
| variant="outline" | ||
| size="sm" | ||
| onClick={() => { | ||
| revokeAccessMutation.mutate(); | ||
| }} | ||
| > | ||
| {revokeAccessMutation.isPending && ( | ||
| <LoaderCircle className="animate-spin" /> | ||
| )} | ||
| Revoke access | ||
| </Button> | ||
| ); | ||
| } |
This file contains hidden or 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,137 @@ | ||
| import { | ||
| PublishedApporder, | ||
| PublishedDatasetorder, | ||
| PublishedWorkerpoolorder, | ||
| } from 'iexec/IExecOrderbookModule'; | ||
| import SmartLinkGroup from '@/components/SmartLinkGroup'; | ||
| import { | ||
| formatDateCompact, | ||
| formatElapsedTime, | ||
| } from '@/utils/formatElapsedTime'; | ||
| import { nrlcToRlc } from '@/utils/nrlcToRlc'; | ||
|
|
||
| export function buildAccessDetails({ | ||
| access, | ||
| }: { | ||
| access: PublishedApporder | PublishedDatasetorder | PublishedWorkerpoolorder; | ||
| }) { | ||
| if (!access) return {}; | ||
|
|
||
| const order = access.order || {}; | ||
|
|
||
| return { | ||
| ...(access.orderHash && { | ||
| 'Order Hash': ( | ||
| <SmartLinkGroup | ||
| type="order" | ||
| isCurrentPage={true} | ||
| addressOrId={access.orderHash.toLowerCase()} | ||
| label={access.orderHash.toLowerCase()} | ||
| /> | ||
| ), | ||
| }), | ||
| ...('dataset' in order && | ||
| order.dataset && { | ||
| Dataset: ( | ||
| <SmartLinkGroup | ||
| type="dataset" | ||
| addressOrId={order.dataset.toLowerCase()} | ||
| label={order.dataset.toLowerCase()} | ||
| /> | ||
| ), | ||
| }), | ||
| ...('datasetprice' in order && | ||
| order.datasetprice && { | ||
| 'Dataset Price': <span>{nrlcToRlc(order.datasetprice)}</span>, | ||
| }), | ||
| ...('app' in order && | ||
| order.app && { | ||
| App: ( | ||
| <SmartLinkGroup | ||
| type="app" | ||
| addressOrId={order.app.toLowerCase()} | ||
| label={order.app.toLowerCase()} | ||
| /> | ||
| ), | ||
| }), | ||
ErwanDecoster marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ...('appprice' in order && | ||
| order.appprice && { | ||
| 'App Price': <span>{nrlcToRlc(order.appprice)}</span>, | ||
| }), | ||
| ...('workerpool' in order && | ||
| order.workerpool && { | ||
| Workerpool: ( | ||
| <SmartLinkGroup | ||
| type="workerpool" | ||
| addressOrId={order.workerpool.toLowerCase()} | ||
| label={order.workerpool.toLowerCase()} | ||
| /> | ||
| ), | ||
| }), | ||
ErwanDecoster marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ...('workerpoolprice' in order && | ||
| order.workerpoolprice !== undefined && { | ||
| 'Workerpool Price': <span>{nrlcToRlc(order.workerpoolprice)}</span>, | ||
| }), | ||
| ...(order.volume !== undefined && { | ||
| Volume: <span>{order.volume}</span>, | ||
| }), | ||
| ...(access.remaining !== undefined && { | ||
| Remaining: <span>{access.remaining}</span>, | ||
| }), | ||
| ...(order.salt && { Salt: <span>{order.salt}</span> }), | ||
| ...(order.tag && { Tag: <span>{order.tag}</span> }), | ||
| ...('apprestrict' in order && | ||
| order.apprestrict && { | ||
| 'App Restrict': ( | ||
| <SmartLinkGroup | ||
| type="app" | ||
| addressOrId={order.apprestrict.toLowerCase()} | ||
| label={order.apprestrict.toLowerCase()} | ||
| /> | ||
| ), | ||
| }), | ||
| ...(order.requesterrestrict && { | ||
| 'Requester Restrict': ( | ||
| <SmartLinkGroup | ||
| type="address" | ||
| addressOrId={order.requesterrestrict.toLowerCase()} | ||
| label={order.requesterrestrict.toLowerCase()} | ||
| /> | ||
| ), | ||
| }), | ||
| ...('workerpoolrestrict' in order && | ||
| order.workerpoolrestrict && { | ||
| 'Workerpool Restrict': ( | ||
| <SmartLinkGroup | ||
| type="workerpool" | ||
| addressOrId={order.workerpoolrestrict.toLowerCase()} | ||
| label={order.workerpoolrestrict.toLowerCase()} | ||
| /> | ||
| ), | ||
| }), | ||
| ...(access.signer && { | ||
| Signer: ( | ||
| <SmartLinkGroup | ||
| type="address" | ||
| addressOrId={access.signer.toLowerCase()} | ||
| label={access.signer.toLowerCase()} | ||
| /> | ||
| ), | ||
| }), | ||
ErwanDecoster marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ...(access.publicationTimestamp && { | ||
| Publication: ( | ||
| <p> | ||
| {formatElapsedTime( | ||
| new Date(access.publicationTimestamp).getTime() / 1000 | ||
| )}{' '} | ||
| ( | ||
| {formatDateCompact( | ||
| new Date(access.publicationTimestamp).getTime() / 1000 | ||
| )} | ||
| ) | ||
| </p> | ||
| ), | ||
| }), | ||
| ...(order.sign && { Signature: <span>{order.sign}</span> }), | ||
| }; | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.