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

Edit multiple services #42

Merged
merged 31 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
68927ad
edit service in new tab
FilipMasar Aug 28, 2024
a84a9b0
elimate the need of scrollbar inside accordion
FilipMasar Aug 28, 2024
64ea318
disable scroll on input type number
FilipMasar Aug 28, 2024
7b3098a
fix price type and remove some code
FilipMasar Aug 28, 2024
54f8755
add service functionality
FilipMasar Aug 29, 2024
9912275
use dummySigner so user doesn't need to be connected to get Assets ac…
FilipMasar Sep 4, 2024
4eac6f0
remove service related edits from metadata edits
FilipMasar Sep 4, 2024
1a28fd6
remove timeout field
FilipMasar Sep 4, 2024
95371b8
get price details in accessDetails from blockchain rather than offcha…
FilipMasar Sep 6, 2024
d3ff621
fix undefined accessDetails
FilipMasar Sep 6, 2024
8a08765
add some margin
FilipMasar Sep 6, 2024
a32f8da
unify fields in edit and add services
FilipMasar Sep 6, 2024
ba98c07
remove weird functions
FilipMasar Sep 6, 2024
8767e76
remove logs
FilipMasar Sep 6, 2024
30143cd
change the UI from using Accordion to using Cards
FilipMasar Sep 9, 2024
d4546f1
add compute settings into service settings
FilipMasar Sep 9, 2024
443b85a
update form validation schemas
FilipMasar Sep 9, 2024
1b9fa57
update description
FilipMasar Sep 9, 2024
586f149
update services grid UI
FilipMasar Sep 9, 2024
6228745
add debug view
FilipMasar Sep 11, 2024
6a5bff9
add debug view to AddService
FilipMasar Sep 11, 2024
ad35681
add a comment
FilipMasar Sep 11, 2024
5f0abb3
fix some types, remove unnecessary code
FilipMasar Sep 11, 2024
dfab68a
add asset type in edit metadata just to view
FilipMasar Sep 11, 2024
500b525
update feedback message
FilipMasar Sep 11, 2024
a8d8473
fix boxselection checked prop
FilipMasar Sep 11, 2024
a4cb12b
update logs
FilipMasar Sep 11, 2024
4536b36
get addresses from config instead of process.env
FilipMasar Sep 16, 2024
2eae8b4
update styles
FilipMasar Sep 16, 2024
cee50f0
add try catch
FilipMasar Sep 16, 2024
b5047b2
add datatoken cap to app.config
FilipMasar Sep 16, 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
2 changes: 1 addition & 1 deletion content/pages/edit.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"description": "Updating metadata or updating compute settings will create an on-chain transaction you have to approve in your wallet."
"description": "Updating metadata or updating services will create an on-chain transaction you have to approve in your wallet."
}
2 changes: 0 additions & 2 deletions content/pages/editComputeDataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"form": {
"title": "Set allowed algorithms",
"description": "Only the algorithms selected here will be allowed to run on your dataset. Uncheck all to remove any access to your dataset.",
"success": "🎉 Successfully updated. 🎉\n\nUpdates might not show up right away on your asset. In this case, wait some seconds and reload your asset details page in your browser.",
"error": "Updating DDO failed.",
"data": [
{
"name": "publisherTrustedAlgorithms",
Expand Down
124 changes: 6 additions & 118 deletions content/pages/editMetadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,99 +19,12 @@
"required": true
},
{
"name": "price",
"label": "New Price",
"type": "number",
"min": "1",
"placeholder": "0",
"help": "Enter a new price.",
"required": true
},
{
"name": "files",
"label": "File",
"prominentHelp": false,
"type": "tabs",
"fields": [
{
"value": "ipfs",
"title": "IPFS",
"label": "CID",
"placeholder": "e.g. bafkreidgvpkjawlxz6sffxzwgooowe5yt7i6wsyg236mfoks77nywkptdq",
"help": "This CID will be stored encrypted after publishing.",
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
"prominentHelp": true,
"type": "files",
"required": true
},
{
"value": "arweave",
"title": "Arweave",
"label": "Transaction ID",
"placeholder": "e.g. DBRCL94j3QqdPaUtt4VWRen8rZfJZBb7Ey40iMpXfhtd",
"help": "This Transaction ID will be stored encrypted after publishing.",
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
"prominentHelp": true,
"type": "files",
"required": true
},
{
"value": "url",
"title": "URL",
"label": "File",
"placeholder": "e.g. https://file.com/file.json",
"help": "This URL will be stored encrypted after publishing. **Please make sure that the endpoint is accessible over the internet and is not protected by a firewall or by credentials.**",
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
"prominentHelp": true,
"type": "files",
"required": true,
"innerFields": [
{
"value": "headers",
"title": "Headers",
"label": "Headers",
"placeholder_value": "Authorization",
"help": "This HEADERS will be stored encrypted after publishing.",
"type": "headers",
"required": true
}
]
},
{
"value": "graphql",
"title": "Graphql",
"label": "URL",
"placeholder": "e.g. http://172.15.0.15:8000/subgraphs/name/oceanprotocol/ocean-subgraph",
"help": "This URL will be stored encrypted after publishing.",
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
"prominentHelp": true,
"type": "files",
"required": true,
"headers": true,
"innerFields": [
{
"value": "headers",
"title": "Headers",
"label": "Headers",
"placeholder_value": "Authorization",
"help": "This HEADERS will be stored encrypted after publishing.",
"type": "headers",
"required": true
},
{
"value": "query",
"title": "Query",
"label": "Query",
"placeholder": "query{\n nfts(\n orderBy: createdTimestamp,\n orderDirection:desc\n ){\n id\n symbol\n createdTimestamp\n }\n}",
"help": "This QUERY will be stored encrypted after publishing.",
"type": "codeeditor",
"required": true
}
]
}
],
"sortOptions": false,
"required": true
"name": "type",
"label": "Asset Type",
"type": "boxSelection",
"options": ["Dataset", "Algorithm"],
"disabled": true,
"help": "The asset type cannot be changed once set."
},
{
"name": "links",
Expand All @@ -133,16 +46,6 @@
],
"required": false
},

{
"name": "timeout",
"label": "Timeout",
"help": "Define how long buyers should be able to download the dataset again after the initial purchase.",
"type": "select",
"options": ["Forever", "1 day", "1 week", "1 month", "1 year"],
"sortOptions": false,
"required": true
},
{
"name": "tags",
"label": "New Tags",
Expand Down Expand Up @@ -172,13 +75,6 @@
"help": "Enter an ETH address and click the ADD button to append to the list. If an ETH address is in the deny list, download or compute of this asset will be denied for that ETH address.",
"type": "credentials"
},
{
"name": "paymentCollector",
"label": "Payment Collector Address",
"placeholder": "e.g. 0X123ABC...",
"help": "This address will receive the revenue from all sales. More info available in our [docs](https://docs.oceanprotocol.com/core-concepts/datanft-and-datatoken#revenue).",
"required": false
},
{
"name": "assetState",
"label": "Asset Status",
Expand All @@ -193,14 +89,6 @@
"sortOptions": false,
"required": false
},
{
"name": "usesServiceConsumerParameters",
"label": "User defined parameters",
"help": "User defined parameters are used to filter or query the published asset.",
"type": "checkbox",
"options": ["This asset uses user defined parameters"],
"required": false
},
{
"name": "license",
"label": "License",
Expand Down
168 changes: 168 additions & 0 deletions content/pages/editService.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
{
"form": {
"success": "🎉 Successfully updated. 🎉\n\nUpdates might not show up right away on your asset. In this case, wait some seconds and reload your asset details page in your browser.",
"error": "Updating DDO failed.",
"data": [
{
"name": "name",
"label": "Service Name",
"placeholder": "Service 1",
"help": "Enter a concise title.",
"required": false
},
{
"name": "description",
"label": "Service Description",
"help": "Enter a detailed description.",
"type": "textarea",
"rows": 2,
"required": false
},
{
"name": "access",
"label": "Access Type",
"help": "Choose how you want your files to be accessible for the specified price.",
"type": "boxSelection",
"options": ["Download", "Compute"],
"required": true,
"disclaimer": "Please do not provide downloadable personal data without the consent of the data subjects.",
"disclaimerValues": ["access"]
},
{
"name": "price",
"label": "New Price",
"type": "number",
"min": "1",
"placeholder": "0",
"help": "Enter a new price.",
"required": true
},
{
"name": "providerUrl",
"label": "Provider URL",
"type": "providerUrl",
"help": "Enter the URL for your custom [provider](https://github.com/oceanprotocol/provider/) or leave as is to use the default one. If you change your provider URL after adding your file, please add & validate your file again.",
"placeholder": "e.g. https://provider.oceanprotocol.com/",
"required": true
},
{
"name": "files",
"label": "File",
"prominentHelp": false,
"type": "tabs",
"fields": [
{
"value": "ipfs",
"title": "IPFS",
"label": "CID",
"placeholder": "e.g. bafkreidgvpkjawlxz6sffxzwgooowe5yt7i6wsyg236mfoks77nywkptdq",
"help": "This CID will be stored encrypted after publishing.",
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
"prominentHelp": true,
"type": "files",
"required": true
},
{
"value": "arweave",
"title": "Arweave",
"label": "Transaction ID",
"placeholder": "e.g. DBRCL94j3QqdPaUtt4VWRen8rZfJZBb7Ey40iMpXfhtd",
"help": "This Transaction ID will be stored encrypted after publishing.",
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
"prominentHelp": true,
"type": "files",
"required": true
},
{
"value": "url",
"title": "URL",
"label": "File",
"placeholder": "e.g. https://file.com/file.json",
"help": "This URL will be stored encrypted after publishing. **Please make sure that the endpoint is accessible over the internet and is not protected by a firewall or by credentials.**",
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
"prominentHelp": true,
"type": "files",
"required": true,
"innerFields": [
{
"value": "headers",
"title": "Headers",
"label": "Headers",
"placeholder_value": "Authorization",
"help": "This HEADERS will be stored encrypted after publishing.",
"type": "headers",
"required": true
}
]
},
{
"value": "graphql",
"title": "Graphql",
"label": "URL",
"placeholder": "e.g. http://172.15.0.15:8000/subgraphs/name/oceanprotocol/ocean-subgraph",
"help": "This URL will be stored encrypted after publishing.",
"computeHelp": "For a compute dataset, your file should match the file type required by the algorithm, and should not exceed 1 GB in file size. ",
"prominentHelp": true,
"type": "files",
"required": true,
"headers": true,
"innerFields": [
{
"value": "headers",
"title": "Headers",
"label": "Headers",
"placeholder_value": "Authorization",
"help": "This HEADERS will be stored encrypted after publishing.",
"type": "headers",
"required": true
},
{
"value": "query",
"title": "Query",
"label": "Query",
"placeholder": "query{\n nfts(\n orderBy: createdTimestamp,\n orderDirection:desc\n ){\n id\n symbol\n createdTimestamp\n }\n}",
"help": "This QUERY will be stored encrypted after publishing.",
"type": "codeeditor",
"required": true
}
]
}
],
"sortOptions": false,
"required": true
},
{
"name": "timeout",
"label": "Timeout",
"help": "Define how long buyers should be able to download the dataset again after the initial purchase.",
"type": "select",
"options": ["Forever", "1 day", "1 week", "1 month", "1 year"],
"sortOptions": false,
"required": true
},
{
"name": "usesConsumerParameters",
"label": "Algorithm custom parameters",
"help": "Algorithm custom parameters are used to define required consumer input before running the algorithm in a Compute-to-Data environment.",
"type": "checkbox",
"options": ["This asset uses algorithm custom parameters"],
"required": false
},
{
"name": "paymentCollector",
"label": "Payment Collector Address",
"placeholder": "e.g. 0X123ABC...",
"help": "This address will receive the revenue from all sales. More info available in our [docs](https://docs.oceanprotocol.com/core-concepts/datanft-and-datatoken#revenue).",
"required": false
},
{
"name": "usesServiceConsumerParameters",
"label": "User defined parameters",
"help": "User defined parameters are used to filter or query the published asset.",
"type": "checkbox",
"options": ["This asset uses user defined parameters"],
"required": false
}
]
}
}
6 changes: 2 additions & 4 deletions src/@context/Asset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ function AssetProvider({

const accessDetails = await Promise.all(
asset.services.map((service: Service) =>
getAccessDetails(
asset.offchain?.stats.services.find((s) => s.serviceId === service.id)
)
getAccessDetails(asset.chainId, service)
)
)

Expand All @@ -146,7 +144,7 @@ function AssetProvider({
accessDetails
}))
LoggerInstance.log(`[asset] Got access details for ${did}`, accessDetails)
}, [asset?.chainId, asset?.offchain?.stats.services, asset?.services, did])
}, [asset?.chainId, asset?.services, did])

// -----------------------------------
// 1. Get and set asset based on passed DID
Expand Down
1 change: 1 addition & 0 deletions src/@types/Price.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ declare global {
validOrderTx: string
publisherMarketOrderFee: string
validProviderFees?: ProviderFees
paymentCollector: string
}

interface PricePublishOptions {
Expand Down
Loading