Skip to content

Commit b0fdb5c

Browse files
authored
update playwright add dropdown for regions (#7)
* update playwright add dropdown for regions * remove unnessary code
1 parent e54ec3c commit b0fdb5c

File tree

8 files changed

+98
-64
lines changed

8 files changed

+98
-64
lines changed

client/src/components/Select/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ const DropdownList = styled.ul`
3939
4040
&.open {
4141
display: flex;
42+
max-height: 345px;
43+
overflow: scroll;
4244
}
4345
`;
4446

client/src/containers/ExportDeployContainer/index.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
availableCloudProviders,
77
availableMethod,
88
availableTimeRange,
9+
awsRegions,
910
} from '../../utils/selectOptions';
1011
import styled from 'styled-components';
1112
import Toggle from '../../components/Toggle';
@@ -34,10 +35,10 @@ const TopWrapper = styled.div`
3435
justify-content: space-between;
3536
align-items: center;
3637
`;
37-
38-
const SelectWrapper = styled.div`
38+
const WrapperWithProps = styled.div``;
39+
const SelectWrapper = styled(WrapperWithProps)<{ full?: boolean }>`
3940
position: relative;
40-
max-width: 215px;
41+
max-width: ${(props) => (props.full ? '100%;' : '215px;')}
4142
width: 100%;
4243
`;
4344

@@ -80,10 +81,12 @@ interface IProps {
8081
stageDisplay: boolean;
8182
stageDeploy: StatusProps;
8283
methodTest: string;
84+
activeRegion: string;
8385
activeRangeTime: string;
8486
activeCloudProvider: string;
8587
statusGoBackHandler: (option: string) => void;
8688
onChangeMethodTest: (option: string) => void;
89+
onChangeRegion: (option: string) => void;
8790
onChangeRangeTime: (option: string) => void;
8891
onChangeCloudProvider: (option: string) => void;
8992
updateMeta: (data: Meta) => void;
@@ -96,12 +99,14 @@ type Meta = {
9699
const ExportDeploy: FunctionComponent<IProps> = ({
97100
stageDisplay,
98101
stageDeploy,
102+
activeRegion,
99103
methodTest,
100104
activeRangeTime,
101105
activeCloudProvider,
102106
statusGoBackHandler,
103107
onChangeMethodTest,
104108
onChangeRangeTime,
109+
onChangeRegion,
105110
onChangeCloudProvider,
106111
updateMeta,
107112
}) => {
@@ -136,7 +141,7 @@ const ExportDeploy: FunctionComponent<IProps> = ({
136141
</Text>
137142
)}
138143

139-
<SelectWrapper>
144+
<SelectWrapper full={false}>
140145
<Select
141146
options={availableCloudProviders}
142147
onChangeSelect={onChangeCloudProvider}
@@ -272,19 +277,14 @@ const ExportDeploy: FunctionComponent<IProps> = ({
272277
to.
273278
</Tooltip>
274279
</Label>
275-
<Input
276-
name='region'
277-
type='text'
278-
placeholder='Region'
279-
onChange={(
280-
e: React.FormEvent<HTMLInputElement>,
281-
) => {
282-
updateMeta({
283-
field: 'region',
284-
value: e.currentTarget.value,
285-
});
286-
}}
287-
/>
280+
281+
<SelectWrapper full={true}>
282+
<Select
283+
options={awsRegions}
284+
onChangeSelect={onChangeRegion}
285+
currentValue={activeRegion}
286+
/>
287+
</SelectWrapper>
288288
</FormControl>
289289
</TwoColumns>
290290
{methodTest === 'Cloud' ? (

client/src/page/Home/index.tsx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ type MetaConfig = {
5151
value: string;
5252
isValid: boolean;
5353
};
54-
region: {
55-
value: string;
56-
isValid: boolean;
57-
};
5854
listEnvVariables: EnvVariable[];
5955
description?:
6056
| {
@@ -75,6 +71,7 @@ type ErrorObject = {
7571

7672
const Home: FunctionComponent = () => {
7773
const [activeRangeTime, setActiveRangeTime] = useState<string>('1 minute');
74+
const [region, setRegion] = useState<string>('us-east-2');
7875
const [methodTest, setMethodTest] = useState<string>('Cloud');
7976
const [isError, setIsError] = useState<boolean>(false);
8077
const [errorData, setErrorMessage] = useState<ErrorObject>({
@@ -120,10 +117,7 @@ const Home: FunctionComponent = () => {
120117
value: '',
121118
isValid: true,
122119
},
123-
region: {
124-
value: '',
125-
isValid: true,
126-
},
120+
127121
listEnvVariables: [],
128122
description: {
129123
value: '',
@@ -149,7 +143,7 @@ const Home: FunctionComponent = () => {
149143
configs.name.value,
150144
configs.token.value,
151145
configs.listener.value,
152-
configs.region.value,
146+
region,
153147
configs.bucketName.value,
154148
);
155149
if (!validation.status) {
@@ -181,7 +175,7 @@ const Home: FunctionComponent = () => {
181175
configs.name.value,
182176
configs.token.value,
183177
configs.listener.value,
184-
configs.region.value,
178+
region,
185179
configs.bucketName.value,
186180
configs.accessKey.value,
187181
configs.secretKey.value,
@@ -207,7 +201,7 @@ const Home: FunctionComponent = () => {
207201
configs.bucketName.value,
208202
configs.token.value,
209203
configs.listener.value,
210-
configs.region.value,
204+
region,
211205
envList,
212206
(stage: StatusProps) => {
213207
onStage(stage);
@@ -251,6 +245,9 @@ const Home: FunctionComponent = () => {
251245
const updateRangeTimeHandler = (option: string) => {
252246
setActiveRangeTime(option);
253247
};
248+
const onChangeRegion = (option: string) => {
249+
setRegion(option);
250+
};
254251

255252
const onChangeMethodTestHandler = (option: string) => {
256253
setMethodTest(option);
@@ -298,6 +295,8 @@ const Home: FunctionComponent = () => {
298295
methodTest={methodTest}
299296
activeRangeTime={activeRangeTime}
300297
activeCloudProvider={activeCloudProvider}
298+
activeRegion={region}
299+
onChangeRegion={onChangeRegion}
301300
statusGoBackHandler={statusGoBackHandler}
302301
onChangeMethodTest={onChangeMethodTestHandler}
303302
onChangeRangeTime={updateRangeTimeHandler}

client/src/utils/selectOptions.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,36 @@ export const rangeTimeVariable: rangeTimeVarEnvType =
3636
minutes_30: 30,
3737
minutes_60: 60
3838
};
39+
40+
export const awsRegions = [
41+
{ name: 'us-east-2', default: true, isDisabled: false },
42+
{ name: 'us-east-1', default: false, isDisabled: false },
43+
{ name: 'us-west-1', default: false, isDisabled: false },
44+
{ name: 'us-west-2', default: false, isDisabled: false },
45+
{ name: 'ca-central-1', default: false, isDisabled: false },
46+
{ name: 'ap-southeast-3', default: false, isDisabled: false },
47+
{ name: 'ap-south-1', default: false, isDisabled: false },
48+
{ name: 'ap-south-2', default: false, isDisabled: false },
49+
{ name: 'ap-northeast-1', default: false, isDisabled: false },
50+
{ name: 'ap-northeast-2', default: false, isDisabled: false },
51+
{ name: 'ap-northeast-3', default: false, isDisabled: false },
52+
{ name: 'ap-southeast-1', default: false, isDisabled: false },
53+
{ name: 'ap-southeast-2', default: false, isDisabled: false },
54+
{ name: 'eu-central-1', default: false, isDisabled: false },
55+
{ name: 'eu-central-2', default: false, isDisabled: false },
56+
{ name: 'eu-north-1', default: false, isDisabled: false },
57+
{ name: 'me-south-1', default: false, isDisabled: false },
58+
{ name: 'me-central-1', default: false, isDisabled: false },
59+
{ name: 'eu-west-1', default: false, isDisabled: false },
60+
{ name: 'eu-west-2', default: false, isDisabled: false },
61+
{ name: 'eu-west-3', default: false, isDisabled: false },
62+
{ name: 'eu-south-1', default: false, isDisabled: false },
63+
{ name: 'eu-south-2', default: false, isDisabled: false },
64+
{ name: 'sa-east-1', default: false, isDisabled: false },
65+
{ name: 'cn-north-1', default: false, isDisabled: false },
66+
{ name: 'cn-northwest-1', default: false, isDisabled: false },
67+
{ name: 'ap-east-1', default: false, isDisabled: false },
68+
{ name: 'af-south-1', default: false, isDisabled: false },
69+
{ name: 'us-gov-west-1', default: false, isDisabled: false },
70+
{ name: 'us-gov-east-1', default: false, isDisabled: false },
71+
]

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"logzio-nodejs": "^2.1.4",
4040
"node-uuid": "^1.4.8",
4141
"playwright-aws-lambda": "^0.9.0",
42-
"playwright-core": "^1.24.2",
42+
"playwright-core": "^1.30.0",
4343
"playwright-har": "^0.1.1",
4444
"shelljs": "^0.8.5"
4545
},

service/lambdaFunction/package-lock.json

Lines changed: 33 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

service/lambdaFunction/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"moment": "^2.29.4",
2626
"node-uuid": "^1.4.8",
2727
"playwright-aws-lambda": "^0.9.0",
28-
"playwright-core": "^1.24.0",
28+
"playwright-core": "^1.30.0",
2929
"playwright-har": "^0.1.1"
3030
}
3131
}

0 commit comments

Comments
 (0)