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

Update Release #124

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { IAppContext } from '../_layout';
const navItems = [
{ label: 'General', value: 'general' },
{ label: 'Compute', value: 'compute' },
{ label: 'Scaling', value: 'scaling' },
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (llm): The addition of a new 'Scaling' settings tab is a significant change. It's important to ensure that navigating to this new tab works as expected and that the UI renders correctly. Integration or end-to-end tests that simulate user interaction with this new tab would be valuable to confirm its functionality.

{ label: 'Environment', value: 'environment' },
{ label: 'Network', value: 'network' },
{ label: 'Advance', value: 'advance' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,45 +127,39 @@ const SettingCompute = () => {
...(s.spec.containers?.[0] || {}),
image:
values.repoAccountName === undefined ||
values.repoAccountName === ''
values.repoAccountName === ''
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (llm): The changes in the compute settings seem to involve adjustments in how resource limits are set. It's important to validate these changes with tests, especially focusing on the correct application of resource limits based on the selection mode (quick or manual). Please ensure there are tests that verify the logic for setting resourceCpu and resourceMemory based on different user inputs.

? `${values.repoName}:${values.repoImageTag}`
: `${registryHost}/${values.repoAccountName}/${values.repoName}:${values.repoImageTag}`,
name: 'container-0',
resourceCpu:
val.selectionMode === 'quick'
? {
max: `${val.cpu}m`,
min: `${val.cpu}m`,
}
max: `${val.cpu}m`,
min: `${val.cpu}m`,
}
: {
max: `${val.manualCpuMax}m`,
min: `${val.manualCpuMin}m`,
},
max: `${val.manualCpuMax}m`,
min: `${val.manualCpuMin}m`,
},
resourceMemory:
val.selectionMode === 'quick'
? {
max: `${(
(values.cpu || 1) * parseValue(values.memPerCpu, 4)
).toFixed(2)}Mi`,
min: `${val.cpu}Mi`,
}
max: `${(
(values.cpu || 1) * parseValue(values.memPerCpu, 4)
).toFixed(2)}Mi`,
min: `${val.cpu}Mi`,
}
: {
max: `${val.manualMemMax}Mi`,
min: `${val.manualMemMin}Mi`,
},
max: `${val.manualMemMax}Mi`,
min: `${val.manualMemMin}Mi`,
},
},
],
},
}));
},
});

// const getActivePlan = useCallback(() => {
// return plans[values.cpuMode as IcpuMode].find(
// (v) => v.memoryPerCpu === parseValue(values.selectedPlan, 4)
// );
// }, [values.cpuMode, values.selectedPlan]);

const repos = getRepoMapper(data);

const {
Expand Down Expand Up @@ -261,110 +255,12 @@ const SettingCompute = () => {
errors.repoImageTag
? errors.repoImageTag
: digestError
? 'Failed to load Image tags.'
: ''
? 'Failed to load Image tags.'
: ''
}
loading={digestLoading}
/>
</div>
{/* <div className="flex flex-col border border-border-default bg-surface-basic-default rounded overflow-hidden">
<div className="p-2xl gap-2xl flex flex-row items-center border-b border-border-disabled bg-surface-basic-subdued">
<div className="flex-1 bodyMd-medium text-text-default">
Select plan
</div>
<ExtendedFilledTab
size="sm"
items={[
{
value: 'shared',
label: (
<InfoLabel label="Shared" info="some usefull information" />
),
},

{
value: 'dedicated',
label: (
<InfoLabel
label="Dedicated"
info="some usefull information"
/>
),
},
]}
value={values.cpuMode}
onChange={(v) => {
handleChange('cpuMode')(dummyEvent(v));
}}
/>
</div>

<div className="flex flex-row">
<div className="flex-1 flex flex-col border-r border-border-disabled">
<Radio.Root
withBounceEffect={false}
className="gap-y-0"
value={values.selectedPlan}
onChange={(v) => {
handleChange('selectedPlan')(dummyEvent(v));
}}
>
{[...(plans[values.cpuMode as IcpuMode] || [])].map(
({ name, memoryPerCpu, description }) => {
return (
<Radio.Item
key={`${memoryPerCpu}`}
className="p-2xl"
value={`${memoryPerCpu}`}
>
<div className="flex flex-col pl-xl">
<div className="headingMd text-text-default">
{name}
</div>
<div className="bodySm text-text-soft">
{description}
</div>
</div>
</Radio.Item>
);
}
)}
</Radio.Root>
</div>
{getActivePlan() ? (
<div className="flex-1 py-2xl">
<div className="flex flex-row items-center gap-lg py-lg px-2xl">
<div className="bodyMd-medium text-text-strong flex-1">
{getActivePlan()?.name}
</div>
<div className="bodyMd text-text-soft">{values.cpuMode}</div>
</div>
<div className="flex flex-row items-center gap-lg py-lg px-2xl">
<div className="bodyMd-medium text-text-strong flex-1">
Compute
</div>
<div className="bodyMd text-text-soft">{1}vCPU</div>
</div>
<div className="flex flex-row items-center gap-lg py-lg px-2xl">
<div className="bodyMd-medium text-text-strong flex-1">
Memory
</div>
<div className="bodyMd text-text-soft">
{getActivePlan()?.memoryPerCpu}GB
</div>
</div>
</div>
) : (
<div className="flex-1 py-2xl">
<div className="flex flex-row items-center gap-lg py-lg px-2xl">
<div className="bodyMd-medium text-text-strong flex-1">
Please Select any plan
</div>
</div>
</div>
)}
</div>
</div> */}
<div className="flex flex-col">
<div className="flex flex-row gap-lg items-center pb-3xl">
<div className="flex-1">
Expand Down Expand Up @@ -496,28 +392,6 @@ const SettingCompute = () => {
</div>
)}
</div>
{/* <div className="flex flex-col gap-md p-2xl rounded border border-border-default bg-surface-basic-default">
<div className="flex flex-row gap-lg items-center">
<div className="bodyMd-medium text-text-default">Select CPU</div>
<code className="bodySm text-text-soft flex-1 text-end">
{((values.cpu || 1) / 1000).toFixed(2)}vCPU &{' '}
{(
((values.cpu || 1) * parseValue(values.selectedPlan, 4)) /
1000
).toFixed(2)}
GB Memory
</code>
</div>
<Slider
step={25}
min={100}
max={8000}
value={values.cpu}
onChange={(value) => {
handleChange('cpu')(dummyEvent(value));
}}
/>
</div> */}
</Wrapper>
</div>
);
Expand Down
Loading
Loading