Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/oceanprotocol/market into f…
Browse files Browse the repository at this point in the history
…eature/issue-1949-fix-file-input-low-connectivity
  • Loading branch information
jamiehewitt15 committed Nov 15, 2023
2 parents cf256ed + f39ddf9 commit a6fa333
Show file tree
Hide file tree
Showing 7 changed files with 3,835 additions and 9,410 deletions.
13,190 changes: 3,802 additions & 9,388 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
"react-string-replace": "^1.1.0",
"react-tabs": "^6.0.0",
"react-toastify": "^9.1.2",
"remark": "^14.0.2",
"remark": "^15.0.1",
"remark-gfm": "^4.0.0",
"remark-html": "^15.0.1",
"remark-html": "^16.0.1",
"remove-markdown": "^0.5.0",
"slugify": "^1.6.5",
"swr": "^1.3.0",
Expand Down
4 changes: 3 additions & 1 deletion src/@utils/assetConvertor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { PublisherTrustedAlgorithm, Asset } from '@oceanprotocol/lib'
import { AssetSelectionAsset } from '@shared/FormInput/InputElement/AssetSelection'
import { getServiceByName } from './ddo'
import normalizeUrl from 'normalize-url'

export async function transformAssetToAssetSelection(
datasetProviderEndpoint: string,
Expand All @@ -15,7 +16,8 @@ export async function transformAssetToAssetSelection(

if (
asset?.stats?.price?.value >= 0 &&
algoService?.serviceEndpoint === datasetProviderEndpoint
normalizeUrl(algoService?.serviceEndpoint) ===
normalizeUrl(datasetProviderEndpoint)
) {
let selected = false
selectedAlgorithms?.forEach((algorithm: PublisherTrustedAlgorithm) => {
Expand Down
6 changes: 4 additions & 2 deletions src/@utils/compute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ export function getQueryString(
const baseParams = {
chainIds: [chainId],
sort: { sortBy: SortTermOptions.Created },
filters: [getFilterTerm('metadata.type', 'algorithm')]
filters: [getFilterTerm('metadata.type', 'algorithm')],
esPaginationOptions: {
size: 3000
}
} as BaseQueryParams
algorithmDidList?.length > 0 &&
baseParams.filters.push(getFilterTerm('_id', algorithmDidList))
Expand Down Expand Up @@ -200,7 +203,6 @@ export async function getAlgorithmsForAsset(
),
token
)

const algorithms: Asset[] = gueryResults?.results
return algorithms
}
Expand Down
11 changes: 4 additions & 7 deletions src/components/@shared/FormInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ export interface InputProps {
disclaimerValues?: string[]
}

function checkError(
form: any,
parsedFieldName: string[],
field: FieldInputProps<any>
) {
function checkError(form: any, field: FieldInputProps<any>) {
const touched = getObjectPropertyByPath(form?.touched, field?.name)
const errors = getObjectPropertyByPath(form?.errors, field?.name)

Expand All @@ -85,7 +81,8 @@ function checkError(
errors &&
!field.name.endsWith('.files') &&
!field.name.endsWith('.links') &&
!field.name.endsWith('consumerParameters')
!field.name.endsWith('consumerParameters') &&
!field.name.endsWith('.providerUrl')
)
}

Expand All @@ -109,7 +106,7 @@ export default function Input(props: Partial<InputProps>): ReactElement {
// handling flat and nested data at same time.
const parsedFieldName =
isFormikField && (isNestedField ? field?.name.split('.') : [field?.name])
const hasFormikError = checkError(form, parsedFieldName, field)
const hasFormikError = checkError(form, field)

const styleClasses = cx({
field: true,
Expand Down
1 change: 1 addition & 0 deletions src/components/Asset/AssetActions/Compute/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ export default function Compute({
asset.metadata.type
)[0]
)

await setDatasetPrice(initializedProvider?.datasets?.[0]?.providerFee)
setComputeStatusText(
getComputeFeedback(
Expand Down
29 changes: 19 additions & 10 deletions src/components/Publish/_validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,33 @@ const validationMetadata = {
}),
dockerImageCustomChecksum: Yup.string().when('type', {
is: 'algorithm',
then: Yup.string().required('Required')
then: Yup.string().when('dockerImage', {
is: 'custom',
then: Yup.string().required('Required')
})
}),
dockerImageCustomEntrypoint: Yup.string().when('type', {
is: 'algorithm',
then: Yup.string().required('Required')
then: Yup.string().when('dockerImage', {
is: 'custom',
then: Yup.string().required('Required')
})
}),
termsAndConditions: Yup.boolean()
.required('Required')
.isTrue('Please agree to the Terms and Conditions.'),
usesConsumerParameters: Yup.boolean(),
consumerParameters: Yup.array().when('usesConsumerParameters', {
is: true,
then: Yup.array()
.of(Yup.object().shape(validationConsumerParameters))
.required('Required'),
otherwise: Yup.array()
.nullable()
.transform((value) => value || null)
consumerParameters: Yup.array().when('type', {
is: 'algorithm',
then: Yup.array().when('usesConsumerParameters', {
is: true,
then: Yup.array()
.of(Yup.object().shape(validationConsumerParameters))
.required('Required'),
otherwise: Yup.array()
.nullable()
.transform((value) => value || null)
})
})
}

Expand Down

0 comments on commit a6fa333

Please sign in to comment.