diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9f2337bc4e08a62f051ffdd7dafda2bf4d5ea8e7..0a18321cdc7842179510fd89a1320ea3926903c4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,10 +18,10 @@ repos: - id: eslint entry: eslint --fix additional_dependencies: - - eslint - - eslint-config-react-app - - eslint-config-prettier - - eslint-plugin-import - - eslint-plugin-react - - eslint-plugin-cypress - - eslint-formatter-gitlab + - eslint@^8.55.0 + - eslint-config-react-app@^7.0.1 + - eslint-config-prettier@^9.1.0 + - eslint-plugin-import@^2.29.0 + - eslint-plugin-react@^7.33.2 + - eslint-plugin-cypress@^2.15.1 + - eslint-formatter-gitlab@^4.0.0 diff --git a/package-lock.json b/package-lock.json index 0ffc373f8189ffc14f8812fc690441df892039b2..5a5a6a1eee465540c9cb0100614669709e078212 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "@ahooksjs/use-url-state": "^3.5.0", "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", - "@ess-ics/ce-ui-common": "^4.11.0", + "@ess-ics/ce-ui-common": "^5.0.0", "@fontsource/roboto": "^4.1.0", "@mui/icons-material": "^5.14.1", "@mui/material": "^5.14.1", @@ -3023,9 +3023,9 @@ } }, "node_modules/@ess-ics/ce-ui-common": { - "version": "4.11.0", - "resolved": "https://artifactory.esss.lu.se/artifactory/api/npm/ics-npm/@ess-ics/ce-ui-common/-/ce-ui-common-4.11.0.tgz", - "integrity": "sha1-fzwY1y6ZV+LEtULgSFcwjR8qKrQ=", + "version": "5.0.0", + "resolved": "https://artifactory.esss.lu.se/artifactory/api/npm/ics-npm/@ess-ics/ce-ui-common/-/ce-ui-common-5.0.0.tgz", + "integrity": "sha1-8kLUz3Zl9TA3sYsL34k0ydGS3PY=", "dependencies": { "@fontsource/titillium-web": "^4.5.9", "@mui/x-data-grid-pro": "^6.5.0", @@ -38829,9 +38829,9 @@ "dev": true }, "@ess-ics/ce-ui-common": { - "version": "4.11.0", - "resolved": "https://artifactory.esss.lu.se/artifactory/api/npm/ics-npm/@ess-ics/ce-ui-common/-/ce-ui-common-4.11.0.tgz", - "integrity": "sha1-fzwY1y6ZV+LEtULgSFcwjR8qKrQ=", + "version": "5.0.0", + "resolved": "https://artifactory.esss.lu.se/artifactory/api/npm/ics-npm/@ess-ics/ce-ui-common/-/ce-ui-common-5.0.0.tgz", + "integrity": "sha1-8kLUz3Zl9TA3sYsL34k0ydGS3PY=", "requires": { "@fontsource/titillium-web": "^4.5.9", "@mui/x-data-grid-pro": "^6.5.0", diff --git a/package.json b/package.json index c47b973de377faed7a0b464aeccfc12e16c5d833..dd153311bd1d8987de4ab0f4fe458c1c5aff5b85 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "@ahooksjs/use-url-state": "^3.5.0", "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", - "@ess-ics/ce-ui-common": "^4.11.0", + "@ess-ics/ce-ui-common": "^5.0.0", "@fontsource/roboto": "^4.1.0", "@mui/icons-material": "^5.14.1", "@mui/material": "^5.14.1", diff --git a/src/components/IOC/IOCDeployDialog/IOCDeployDialog.js b/src/components/IOC/IOCDeployDialog/IOCDeployDialog.js index 8f5abdcb656885e3e765c22a94986e0d1c28ee09..ec7c2cdaa78c76de94eb702283fd99caa04cd371 100644 --- a/src/components/IOC/IOCDeployDialog/IOCDeployDialog.js +++ b/src/components/IOC/IOCDeployDialog/IOCDeployDialog.js @@ -66,8 +66,7 @@ export function IOCDeployDialog({ const [host, setHost] = useState(deployIocFormDefaults); const [query, onHostKeyUp] = useTypingTimer({ interval: 500 }); const [gitRepo, setGitRepo] = useState(deployIocFormDefaults.git || ""); - const [revision, setRevision] = useState(deployIocFormDefaults.version || ""); - const [revisionQuery, onRevisionQueryChange] = useState(""); + const [revision, setRevision] = useState(deployIocFormDefaults); const gitProjectId = deployIocFormDefaults.gitProjectId; const handleClose = () => { @@ -79,8 +78,8 @@ export function IOCDeployDialog({ }, [query, getHosts]); useEffect(() => { - getTagOrCommitId(gitProjectId, revisionQuery, false, "CONTAINS"); - }, [revisionQuery, gitProjectId, getTagOrCommitId]); + getTagOrCommitId(gitProjectId, "", false, "CONTAINS"); + }, [gitProjectId, getTagOrCommitId]); const onSubmit = (event) => { event.preventDefault(); @@ -95,7 +94,7 @@ export function IOCDeployDialog({ { requestBody: { sourceUrl: git, - sourceVersion: revision, + sourceVersion: revision.reference, hostCSEntryId: host ? Number(host.csEntryHost.id) : deployIocFormDefaults.csEntryHost @@ -143,28 +142,18 @@ export function IOCDeployDialog({ label="Revision" options={tagOrCommitId} loading={loadingTagsAndCommitIds} - defaultValue={ - deployIocFormDefaults.version - ? { - reference: deployIocFormDefaults.version, - shortReference: deployIocFormDefaults.shortVersion - ? deployIocFormDefaults.shortVersion - : deployIocFormDefaults.version - } - : null - } - onGitQueryValueSelect={(value) => { - setRevision(value?.reference); + disabled={!gitRepo || gitRepo.trim() === ""} + autocompleteProps={{ + autoSelect: false, + defaultValue: tagOrCommitId.find( + (tagOrCommit) => + tagOrCommit.reference === deployIocFormDefaults.reference + ) + }} + onGitQueryValueSelect={(_, value) => { + setRevision(value); resetError(); - getTagOrCommitId( - gitProjectId, - value?.reference, - false, - "CONTAINS" - ); }} - onGitQueryStringChange={onRevisionQueryChange} - disabled={!gitRepo || gitRepo.trim() === ""} textFieldProps={{ helperText: tagOrCommitIdError ? `Error: ${tagOrCommitId?.message}` diff --git a/src/components/IOC/IOCManage/IOCManage.js b/src/components/IOC/IOCManage/IOCManage.js index 45de0384c80959c482ec65bbc50e3bbe67d51165..19283f0b0bfa87fe92b86ea77f46c4fb6bcd2454 100644 --- a/src/components/IOC/IOCManage/IOCManage.js +++ b/src/components/IOC/IOCManage/IOCManage.js @@ -146,8 +146,8 @@ export function IOCManage({ }; if (ioc.activeDeployment) { - deployIocFormDefaults.version = ioc.activeDeployment.sourceVersion; - deployIocFormDefaults.shortVersion = + deployIocFormDefaults.reference = ioc.activeDeployment.sourceVersion; + deployIocFormDefaults.short_reference = ioc.activeDeployment.sourceVersionShort; deployIocFormDefaults.csEntryHost = { fqdn: ioc.activeDeployment.host.fqdn, @@ -228,7 +228,7 @@ export function IOCManage({ open={deployDialogOpen} setOpen={setDeployDialogOpen} submitCallback={closeDeployModal} - defaultHost={deployIocFormDefaults} + deployIocFormDefaults={deployIocFormDefaults} iocId={ioc.id} hasActiveDeployment={Boolean(ioc.activeDeployment)} buttonDisabled={buttonDisabled}