generated from kyma-project/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eddbdb9
commit d4e7987
Showing
10 changed files
with
123 additions
and
7 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
src/calculatorFunctions/additionalConfig/calculateAdditionalCosts.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import calculateAdditionalCosts from './calculateAdditionalCosts'; | ||
|
||
test('total costs', () => { | ||
const redis = 74; | ||
|
||
const additionalCosts = calculateAdditionalCosts({ redis }); | ||
|
||
expect(additionalCosts).toBe(74); | ||
}); |
11 changes: 11 additions & 0 deletions
11
src/calculatorFunctions/additionalConfig/calculateAdditionalCosts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
interface Props { | ||
redis: number; | ||
} | ||
|
||
export default function calculateAdditionalCosts(props: Props): number { | ||
const { redis } = props; | ||
|
||
return ( | ||
redis | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/components/CostWizard/UserInputs/additionalConfig/RedisSelect.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react'; | ||
import config from '../../../../config.json'; | ||
import { Option, Select, Title } from '@ui5/webcomponents-react'; | ||
import { RedisSize, redisState } from '../../../../state/additionalConfig/redisState'; | ||
import { useSetRecoilState } from 'recoil'; | ||
|
||
export default function RedisSelect() { | ||
const redisConfigOptions = config.RedisCosts.Tiers; | ||
const setVmSize = useSetRecoilState<RedisSize>(redisState); | ||
|
||
const onChange = (event: any) => { | ||
const selection = event.detail.selectedOption.dataset; | ||
setVmSize({ | ||
value: +selection.value, | ||
tsize: selection.key | ||
}); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Title className="wizard-subheader" level="H5"> | ||
Cloud-managed Redis cache | ||
</Title> | ||
<Select onChange={onChange}> | ||
{redisConfigOptions.map((item) => ( | ||
<Option | ||
key={item.key} | ||
data-key={item.key} | ||
data-value={item.value} | ||
> | ||
{item.key} | ||
</Option> | ||
))} | ||
</Select> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { atom, RecoilState } from 'recoil'; | ||
import config from '../../config.json'; | ||
|
||
export interface RedisSize { | ||
tsize: string; | ||
value: number; | ||
} | ||
|
||
export const redisState: RecoilState<RedisSize> = atom<RedisSize>({ | ||
key: 'redisState', | ||
default: { | ||
tsize: config.RedisCosts.Tiers[0].key, | ||
value: config.RedisCosts.Tiers[0].value} | ||
}); |