Skip to content

Commit

Permalink
Merge branch 'release/v2.2.0-RC2' into feat/541/ospm
Browse files Browse the repository at this point in the history
  • Loading branch information
lavanya-bmw authored Aug 29, 2024
2 parents 33050c2 + 83d193b commit 15bda70
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

- **Onboarding Service Provider Management**:
- Create new page for onboarding service provider management [#1052](https://github.com/eclipse-tractusx/portal-frontend/pull/1052)
- Company data
- Disable confirm button if input value is not matching with the regular expression
- Fix infinite loop issue in add New Address Modal
- Service Subscription
- Update auto setup api response data in the service subscription response overlay
- Partner Network
Expand Down
3 changes: 2 additions & 1 deletion DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ npm/npmjs/@babel/template/7.24.0, MIT, approved, clearlydefined
npm/npmjs/@babel/traverse/7.24.1, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #13926
npm/npmjs/@babel/types/7.24.0, MIT, approved, clearlydefined
npm/npmjs/@bcoe/v8-coverage/0.2.3, ISC AND MIT, approved, clearlydefined
npm/npmjs/@catena-x/portal-shared-components/3.2.0, Apache-2.0 AND CC-BY-4.0 AND OFL-1.1, approved, #16029
npm/npmjs/@catena-x/portal-shared-components/3.4.0, Apache-2.0 AND CC-BY-4.0 AND OFL-1.1, approved, #16027
npm/npmjs/@cspotcode/source-map-support/0.8.1, MIT, approved, clearlydefined
npm/npmjs/@date-io/core/3.0.0, MIT, approved, clearlydefined
npm/npmjs/@date-io/date-fns/3.0.0, MIT, approved, #14023
Expand Down Expand Up @@ -738,6 +738,7 @@ npm/npmjs/@tsconfig/node12/1.0.11, MIT, approved, clearlydefined
npm/npmjs/@tsconfig/node14/1.0.3, MIT, approved, clearlydefined
npm/npmjs/@tsconfig/node16/1.0.4, MIT, approved, clearlydefined
npm/npmjs/@types/aria-query/5.0.4, MIT, approved, #10958
npm/npmjs/@types/autosuggest-highlight/3.2.3, MIT, approved, #11672
npm/npmjs/@types/babel__core/7.20.5, MIT, approved, clearlydefined
npm/npmjs/@types/babel__generator/7.6.8, MIT, approved, clearlydefined
npm/npmjs/@types/babel__template/7.4.4, MIT, approved, clearlydefined
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
]
},
"dependencies": {
"@catena-x/portal-shared-components": "^3.1.3",
"@catena-x/portal-shared-components": "^3.4.0",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@hookform/error-message": "^2.0.1",
Expand All @@ -43,6 +43,7 @@
"@mui/x-data-grid": "^6.19.11",
"@react-hook/cache": "^1.1.1",
"@reduxjs/toolkit": "^2.2.6",
"autosuggest-highlight": "^3.3.4",
"axios": "^1.6.8",
"buffer": "^6.0.3",
"dayjs": "^1.11.12",
Expand Down Expand Up @@ -81,6 +82,7 @@
"@types/react-dom": "^18.2.22",
"@types/react-redux": "^7.1.33",
"@types/react-slick": "^0.23.13",
"@types/autosuggest-highlight": "^3.2.3",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"@vitejs/plugin-react": "^4.2.1",
Expand Down
1 change: 1 addition & 0 deletions src/components/pages/CompanyData/components/EditForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export default function EditForm({
})
} catch (e) {
setError(true)
setLoading(false)
}
}

Expand Down
9 changes: 6 additions & 3 deletions src/components/pages/CompanyData/components/FormFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ import {
import type { IHashMap } from 'types/MainTypes'
import { useTranslation } from 'react-i18next'
import ValidatingInput from 'components/shared/basic/Input/ValidatingInput'
import { SelectList } from '@catena-x/portal-shared-components'
import { type CompanyDataFieldsType } from 'features/companyData/companyDataApiSlice'
import { useSelector } from 'react-redux'
import { companyDataSelector } from 'features/companyData/slice'
import {
type UniqueIdentifier,
useFetchUniqueIdentifierQuery,
} from 'features/admin/userApiSlice'
import { SelectList } from './SelectList'

const responseToForm = (data: CompanyDataFieldsType) => {
const form: IHashMap<string> = {}
Expand Down Expand Up @@ -287,10 +287,13 @@ export const FormFields = ({
setFormData(current)
const formValid =
current.siteName &&
isName(current.siteName) &&
current.street &&
isStreet(current.street) &&
current.city &&
current.postalCode &&
current.countryCode
isCity(current.city)
current.postalCode && isPostalCode(current.postalCode)
current.countryCode && isCountry(current.countryCode)
onValid(
formValid
? {
Expand Down
121 changes: 121 additions & 0 deletions src/components/pages/CompanyData/components/SelectList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/********************************************************************************
* Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import { type TextFieldProps } from '@mui/material'
import Autocomplete from '@mui/material/Autocomplete'
import parse from 'autosuggest-highlight/parse'
import match from 'autosuggest-highlight/match'
import { SelectInput, SelectOptions } from '@catena-x/portal-shared-components'
import uniqueId from 'lodash/uniqueId'
import isEqual from 'lodash/isEqual'
import { useState } from 'react'

interface SelectListProps extends Omit<TextFieldProps, 'variant'> {
// eslint-disable-next-line
items: any
label: string
placeholder: string
keyTitle: string
popperHeight?: number
variant?: 'filled'
clearText?: string
noOptionsText?: string
defaultValue?: unknown
disableClearable?: boolean
// eslint-disable-next-line
onChangeItem: (items: any) => void
}

export const SelectList = ({
items,
label,
placeholder,
defaultValue = {},
disableClearable = false,
keyTitle,
variant,
margin,
focused,
helperText,
error = false,
disabled,
popperHeight = 0,
clearText = 'Clear',
noOptionsText = 'No Options',
onChangeItem,
}: SelectListProps) => {
const selectHeight = popperHeight ? `${popperHeight}px` : 'auto'
// Add an ESLint exception until there is a solution
// eslint-disable-next-line
const [selected, setSelected] = useState<any>(defaultValue || {})

// eslint-disable-next-line
const handleChange = (newValue: any) => {
if (newValue) {
setSelected(newValue)
onChangeItem(newValue)
}
}

return (
<Autocomplete
className="cx-select-list"
id="singleSelectList"
sx={{ width: '100%' }}
clearText={clearText}
defaultValue={defaultValue}
disableClearable={disableClearable}
noOptionsText={noOptionsText}
ListboxProps={{ style: { maxHeight: selectHeight } }}
disabled={disabled}
// eslint-disable-next-line
options={items.map((item: any) => item)}
getOptionLabel={(option) => option[keyTitle] || ''}
onChange={(_event, nextValue) => {
handleChange(nextValue)
}}
isOptionEqualToValue={(option, value) => isEqual(option, value)}
renderOption={(props, option, { inputValue }) => (
<SelectOptions
props={props}
parts={parse(option[keyTitle], match(option[keyTitle], inputValue))}
key={uniqueId('select-list-option')}
/>
)}
value={selected}
renderInput={(params) => {
return (
<SelectInput
className="cx-select-list__input"
params={params}
label={label}
placeholder={placeholder}
variant={variant}
margin={margin}
focused={focused}
helperText={helperText}
error={error}
disabled={disabled}
keyTitle={keyTitle}
/>
)
}}
/>
)
}
13 changes: 9 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,10 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==

"@catena-x/portal-shared-components@^3.1.3":
version "3.2.0"
resolved "https://registry.yarnpkg.com/@catena-x/portal-shared-components/-/portal-shared-components-3.2.0.tgz#dcf4b3c4b3c2576801d6c3d9cb5f85ce8a2635d6"
integrity sha512-uy2jgIcGBcbWsg0MBN44b3W0MM6ZXrdmN5YeObGq9PW6D4fiGJviCGbqw12u0Zm20dNgchoCquArkJaSnv1uTw==
"@catena-x/portal-shared-components@^3.4.0":
version "3.4.0"
resolved "https://registry.yarnpkg.com/@catena-x/portal-shared-components/-/portal-shared-components-3.4.0.tgz#68f9b2c6d4a567b347cd008a113a3f5f7bf64a89"
integrity sha512-EYhOSvwuXZt1zXPPpCFfSe+6I8VghH8fClH80aud+x8UhMiZbBzOOn6kjAZKnpKH9qoyEX4TqpE4ZUYxnfagMA==
dependencies:
"@date-io/date-fns" "^3.0.0"
"@emotion/react" "^11.11.4"
Expand Down Expand Up @@ -1366,6 +1366,11 @@
resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.4.tgz#1a31c3d378850d2778dabb6374d036dcba4ba708"
integrity sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==

"@types/autosuggest-highlight@^3.2.3":
version "3.2.3"
resolved "https://registry.yarnpkg.com/@types/autosuggest-highlight/-/autosuggest-highlight-3.2.3.tgz#966b4f6b2b8fc9df2838481600500db6b3795aaa"
integrity sha512-8Mb21KWtpn6PvRQXjsKhrXIcxbSloGqNH50RntwGeJsGPW4xvNhfml+3kKulaKpO/7pgZfOmzsJz7VbepArlGQ==

"@types/babel__core@^7.1.14", "@types/babel__core@^7.20.5":
version "7.20.5"
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017"
Expand Down

0 comments on commit 15bda70

Please sign in to comment.