diff --git a/src/apps/console/routes/_main+/$account+/$project+/$environment+/app+/$app+/settings+/compute/route.tsx b/src/apps/console/routes/_main+/$account+/$project+/$environment+/app+/$app+/settings+/compute/route.tsx index 6cf949c8e..d70303d5e 100644 --- a/src/apps/console/routes/_main+/$account+/$project+/$environment+/app+/$app+/settings+/compute/route.tsx +++ b/src/apps/console/routes/_main+/$account+/$project+/$environment+/app+/$app+/settings+/compute/route.tsx @@ -65,7 +65,8 @@ const SettingCompute = () => { repoName: app.metadata?.annotations?.[keyconstants.repoName] || '', repoImageTag: app.metadata?.annotations?.[keyconstants.imageTag] || '', - repoImageUrl: '', + repoImageUrl: app.metadata?.annotations?.[keyconstants.repoImageUrl] || '', + image: app.metadata?.annotations?.[keyconstants.image] || '', cpu: parseValue( app.spec.containers[activeContIndex]?.resourceCpu?.max, @@ -110,6 +111,8 @@ const SettingCompute = () => { [keyconstants.selectedPlan]: val.selectedPlan, [keyconstants.repoName]: val.repoName, [keyconstants.imageTag]: val.repoImageTag, + [keyconstants.image]: val.image, + [keyconstants.repoImageUrl]: val.repoImageUrl, }, }, spec: { @@ -117,7 +120,8 @@ const SettingCompute = () => { containers: [ { ...(s.spec.containers?.[0] || {}), - image: val.imageUrl, + // image: val.imageUrl, + image: val.repoImageUrl == '' ? val.imageUrl : val.repoImageUrl, name: 'container-0', resourceCpu: val.selectionMode === 'quick' @@ -207,16 +211,18 @@ const SettingCompute = () => { }} >
- - } - size="lg" - value={values.imageUrl} - onChange={handleChange('imageUrl')} - error={!!errors.imageUrl} - message={errors.imageUrl} - /> + {!values.repoImageUrl && ( + + } + size="lg" + value={values.imageUrl} + onChange={handleChange('imageUrl')} + error={!!errors.imageUrl} + message={errors.imageUrl} + /> + )} {/* @@ -228,62 +234,66 @@ const SettingCompute = () => { // onChange={handleChange('pullSecret')} /> */} -
OR
+ {values.repoImageUrl && ( + { - handleChange('repoName')(dummyEvent(val.value)); - setAccountName(val.accName); - }} - options={async () => [...repos]} - error={!!errors.repos || !!repoLoadingError} - message={ - repoLoadingError ? 'Error fetching repositories.' : errors.app - } - loading={repoLoading} - /> + {values.repoImageUrl && ( + { - handleChange('repoImageTag')(dummyEvent(val.value)); - handleChange('repoImageUrl')( - dummyEvent( - `registry.kloudlite.io/${accountName}/${values.repoName}:${val.value}` - ) - ); - }} - options={async () => - [ - ...new Set( - parseNodes(digestData) - .map((item) => item.tags) - .flat() - ), - ].map((item) => ({ - label: item, - value: item, - })) - } - error={!!errors.repoImageTag || !!digestError} - message={ - errors.repoImageTag - ? errors.repoImageTag - : digestError - ? 'Failed to load Image tags.' - : '' - } - loading={digestLoading} - />
{/*
diff --git a/src/apps/console/routes/_main+/$account+/$project+/$environment+/new-app/app-compute.tsx b/src/apps/console/routes/_main+/$account+/$project+/$environment+/new-app/app-compute.tsx index 029bcabe2..57d220cae 100644 --- a/src/apps/console/routes/_main+/$account+/$project+/$environment+/new-app/app-compute.tsx +++ b/src/apps/console/routes/_main+/$account+/$project+/$environment+/new-app/app-compute.tsx @@ -68,7 +68,8 @@ const AppCompute = () => { repoName: app.metadata?.annotations?.[keyconstants.repoName] || '', repoImageTag: app.metadata?.annotations?.[keyconstants.imageTag] || '', - repoImageUrl: '', + repoImageUrl: app.metadata?.annotations?.[keyconstants.repoImageUrl] || '', + image: app.metadata?.annotations?.[keyconstants.image] || '', selectedPlan: app.metadata?.annotations[keyconstants.selectedPlan] || 'shared-1', @@ -111,6 +112,8 @@ const AppCompute = () => { [keyconstants.selectedPlan]: val.selectedPlan, [keyconstants.repoName]: val.repoName, [keyconstants.imageTag]: val.repoImageTag, + [keyconstants.image]: val.image, + [keyconstants.repoImageUrl]: val.repoImageUrl, }, }, spec: { @@ -118,7 +121,7 @@ const AppCompute = () => { containers: [ { ...(s.spec.containers?.[0] || {}), - image: val.imageUrl === '' ? val.repoImageUrl : val.imageUrl, + image: val.image === '' ? val.repoImageUrl : val.imageUrl, name: 'container-0', resourceCpu: val.selectionMode === 'quick' @@ -191,11 +194,12 @@ const AppCompute = () => { } size="lg" - value={values.imageUrl} + value={values.image} onChange={(e) => { handleChange('imageUrl')( dummyEvent(e.target.value.toLowerCase()) ); + handleChange('image')(dummyEvent(e.target.value.toLowerCase())); handleChange('repoName')(dummyEvent('')); handleChange('repoImageTag')(dummyEvent('')); }} @@ -208,7 +212,7 @@ const AppCompute = () => { onClick={() => { setShowImageUrl(!showImageUrl); }} - content={showImageUrl ? 'Advanced options' : 'Normal options'} + content={showImageUrl ? 'Advanced options' : 'Image option'} variant="primary-plain" size="sm" /> @@ -222,7 +226,7 @@ const AppCompute = () => { searchable onChange={(val) => { handleChange('repoName')(dummyEvent(val.value)); - handleChange('imageUrl')(dummyEvent('')); + handleChange('image')(dummyEvent('')); setAccountName(val.accName); }} options={async () => [...repos]} diff --git a/src/apps/console/server/r-utils/key-constants.js b/src/apps/console/server/r-utils/key-constants.js index 8c7a6a488..24506662f 100644 --- a/src/apps/console/server/r-utils/key-constants.js +++ b/src/apps/console/server/r-utils/key-constants.js @@ -10,4 +10,6 @@ export const keyconstants = { nodeType: 'kloudlite.io/ui-node-type', repoName: 'kloudlite.io/ui-repoName', imageTag: 'kloudlite.io/ui-imageTag', + image: 'kloudlite.io/ui-image', + repoImageUrl: 'kloudlite.io/ui-repoImageUrl', };