Skip to content

Commit a61532b

Browse files
Google latest code pulled
2 parents a2572c3 + af41f64 commit a61532b

22 files changed

+4760
-376
lines changed
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# -*- protobuffer -*-
2+
# proto-file: google3/devtools/kokoro/config/proto/build.proto
3+
# proto-message: BuildConfig
4+
5+
# Location of the bash script. Should have value <github_scm.name>/<path_from_repository_root>.
6+
# github_scm.name is specified in the job configuration (next section).
7+
build_file: "dataproc-jupyter-plugin/kokoro/gcp_ubuntu_docker/kokoro_build.sh"
8+
9+
action {
10+
define_artifacts {
11+
regex: "github/dataproc-jupyter-plugin/ui-tests/test-results/**"
12+
regex: "github/dataproc-jupyter-plugin/ui-tests/playwright-report/**"
13+
strip_prefix: "github/dataproc-jupyter-plugin/ui-tests/"
14+
}
15+
}
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
# Fail on any error.
4+
set -e
5+
6+
# Display commands being run.
7+
# WARNING: please only enable 'set -x' if necessary for debugging, and be very
8+
# careful if you handle credentials (e.g. from Keystore) with 'set -x':
9+
# statements like "export VAR=$(cat /tmp/keystore/credentials)" will result in
10+
# the credentials being printed in build logs.
11+
# Additionally, recursive invocation with credentials as command-line
12+
# parameters, will print the full command, with credentials, in the build logs.
13+
# set -x
14+
15+
# Code under repo is checked out to ${KOKORO_ARTIFACTS_DIR}/github.
16+
# The final directory name in this path is determined by the scm name specified
17+
# in the job configuration.
18+
19+
export PATH="$HOME/.local/bin:$PATH"
20+
21+
# configure gcloud
22+
gcloud config set project dataproc-kokoro-tests
23+
gcloud config set compute/region us-central1
24+
25+
# Install dependencies.
26+
sudo apt-get update
27+
sudo apt-get --assume-yes install python3 python3-pip nodejs
28+
29+
# Install jupyter lab.
30+
pip install jupyterlab
31+
32+
# Navigate to repo.
33+
cd "${KOKORO_ARTIFACTS_DIR}/github/dataproc-jupyter-plugin"
34+
35+
# Install the plugin
36+
pip3 install -e ".[test]"
37+
# Link your development version of the extension with JupyterLab
38+
jupyter labextension develop . --overwrite
39+
# Server extension must be manually installed in develop mode
40+
jupyter server extension enable dataproc_jupyter_plugin
41+
# Rebuild extension Typescript source after making changes
42+
jlpm build
43+
44+
45+
# Run Playwright Tests
46+
cd ./ui-tests
47+
jlpm install
48+
jlpm playwright install
49+
PLAYWRIGHT_JUNIT_OUTPUT_NAME=test-results/sponge_log.xml jlpm playwright test --reporter=junit
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# -*- protobuffer -*-
2+
# proto-file: google3/devtools/kokoro/config/proto/build.proto
3+
# proto-message: BuildConfig
4+
5+
# Location of the bash script. Should have value <github_scm.name>/<path_from_repository_root>.
6+
# github_scm.name is specified in the job configuration (next section).
7+
build_file: "dataproc-jupyter-plugin/kokoro/gcp_ubuntu_docker/kokoro_build.sh"
8+
9+
action {
10+
define_artifacts {
11+
regex: "github/dataproc-jupyter-plugin/ui-tests/test-results/**"
12+
regex: "github/dataproc-jupyter-plugin/ui-tests/playwright-report/**"
13+
strip_prefix: "github/dataproc-jupyter-plugin/ui-tests/"
14+
}
15+
}

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@
8080
"react-table": "^7.8.0",
8181
"react-tagsinput": "^3.20.3",
8282
"react-toastify": "^9.1.3",
83-
"semantic-ui-css": "^2.5.0",
84-
"semantic-ui-react": "^2.1.4",
8583
"yup": "^1.2.0"
8684
},
8785
"devDependencies": {
@@ -120,6 +118,7 @@
120118
"react": "^18.2.0",
121119
"react-dom": "^18.2.0",
122120
"rimraf": "^4.4.1",
121+
"semantic-ui-react": "^2.1.4",
123122
"source-map-loader": "^1.0.2",
124123
"storybook": "^7.4.0",
125124
"style-loader": "^3.3.1",

src/batches/createBatch.tsx

+20-27
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
import React, { ChangeEvent, useEffect, useState } from 'react';
1919
import { LabIcon } from '@jupyterlab/ui-components';
2020
import LeftArrowIcon from '../../style/icons/left_arrow_icon.svg';
21-
import 'semantic-ui-css/semantic.min.css';
2221
import 'react-toastify/dist/ReactToastify.css';
23-
import { Input, Radio, Select } from 'semantic-ui-react';
2422
import {
2523
API_HEADER_BEARER,
2624
API_HEADER_CONTENT_TYPE,
@@ -55,7 +53,10 @@ import { ClipLoader } from 'react-spinners';
5553
import { toast } from 'react-toastify';
5654
import ErrorPopup from '../utils/errorPopup';
5755
import errorIcon from '../../style/icons/error_icon.svg';
58-
// import { set } from 'lib0/encoding';
56+
import { Select } from '../controls/MuiWrappedSelect';
57+
import { Input } from '../controls/MuiWrappedInput';
58+
import { Radio } from '@mui/material';
59+
// import { Dropdown } from '../controls/MuiWrappedDropdown';
5960

6061
type Project = {
6162
projectId: string;
@@ -556,9 +557,7 @@ function CreateBatch({
556557
response
557558
.json()
558559
.then((responseResult: { clusters: Cluster[] }) => {
559-
let transformClusterListData = [];
560-
561-
transformClusterListData = responseResult.clusters.filter(
560+
let transformClusterListData = responseResult.clusters.filter(
562561
(data: Cluster) => {
563562
if (data.status.state === STATUS_RUNNING) {
564563
return {
@@ -568,11 +567,9 @@ function CreateBatch({
568567
}
569568
);
570569

571-
const keyLabelStructure = transformClusterListData.map(obj => ({
572-
key: obj.clusterName,
573-
value: obj.clusterName,
574-
text: obj.clusterName
575-
}));
570+
const keyLabelStructure = transformClusterListData.map(
571+
obj => obj.clusterName
572+
);
576573
setClustersList(keyLabelStructure);
577574
})
578575
.catch((e: Error) => {
@@ -746,13 +743,7 @@ function CreateBatch({
746743
response
747744
.json()
748745
.then((responseResult: { subnetworks: string[] }) => {
749-
let transformedSubNetworkList = [];
750-
/*
751-
Extracting subnetworks from Network
752-
Example: "https://www.googleapis.com/compute/v1/projects/{projectName}/global/networks/subnetwork",
753-
*/
754-
755-
transformedSubNetworkList = responseResult.subnetworks.map(
746+
let transformedSubNetworkList = responseResult.subnetworks.map(
756747
(data: string) => {
757748
return {
758749
subnetworks: data.split(
@@ -799,9 +790,7 @@ function CreateBatch({
799790
response
800791
.json()
801792
.then((responseResult: { services: Service[] }) => {
802-
let transformClusterListData = [];
803-
804-
transformClusterListData = responseResult.services.filter(
793+
let transformClusterListData = responseResult.services.filter(
805794
(data: Service) => {
806795
return {
807796
name: data.name
@@ -843,8 +832,7 @@ function CreateBatch({
843832
response
844833
.json()
845834
.then((responseResult: { projects: Project[] }) => {
846-
let transformedProjectList = [];
847-
transformedProjectList = responseResult.projects.map(
835+
let transformedProjectList = responseResult.projects.map(
848836
(data: Project) => {
849837
return {
850838
value: data.projectId,
@@ -881,8 +869,7 @@ function CreateBatch({
881869
response
882870
.json()
883871
.then((responseResult: { items: Region[] }) => {
884-
let transformedRegionList = [];
885-
transformedRegionList = responseResult.items.map(
872+
let transformedRegionList = responseResult.items.map(
886873
(data: Region) => {
887874
return {
888875
value: data.name,
@@ -1196,8 +1183,8 @@ function CreateBatch({
11961183
setKeySelected(data.value);
11971184
};
11981185

1199-
const handleClusterSelected = (event: any, data: any) => {
1200-
setClusterSelected(data.value);
1186+
const handleClusterSelected = (event: any, value: any) => {
1187+
setClusterSelected(value);
12011188
};
12021189
const handleManualKeySelected = (event: ChangeEvent<HTMLInputElement>) => {
12031190
const inputValue = event.target.value;
@@ -1292,6 +1279,7 @@ function CreateBatch({
12921279
<div>
12931280
<div className="create-batch-radio">
12941281
<Radio
1282+
size="small"
12951283
className="select-batch-radio-style"
12961284
value="mainClass"
12971285
checked={selectedRadio === 'mainClass'}
@@ -1339,6 +1327,7 @@ function CreateBatch({
13391327
<div>
13401328
<div className="create-batch-radio">
13411329
<Radio
1330+
size="small"
13421331
className="select-batch-radio-style"
13431332
value="mainJarURI"
13441333
checked={selectedRadio === 'mainJarURI'}
@@ -1833,6 +1822,7 @@ function CreateBatch({
18331822
<div>
18341823
<div className="create-batch-radio">
18351824
<Radio
1825+
size="small"
18361826
className="select-batch-radio-style"
18371827
value="googleManaged"
18381828
checked={selectedEncryptionRadio === 'googleManaged'}
@@ -1849,6 +1839,7 @@ function CreateBatch({
18491839
<div>
18501840
<div className="create-batch-radio">
18511841
<Radio
1842+
size="small"
18521843
className="select-batch-radio-style"
18531844
value="googleManaged"
18541845
checked={selectedEncryptionRadio === 'customerManaged'}
@@ -1876,6 +1867,7 @@ function CreateBatch({
18761867
<div>
18771868
<div className="create-batch-encrypt">
18781869
<Radio
1870+
size="small"
18791871
className="select-batch-encrypt-radio-style"
18801872
value="mainClass"
18811873
checked={selectedRadioValue === 'key'}
@@ -1930,6 +1922,7 @@ function CreateBatch({
19301922
<div className="manual-input">
19311923
<div className="encrypt">
19321924
<Radio
1925+
size="small"
19331926
className="select-batch-encrypt-radio-style "
19341927
value="mainClass"
19351928
checked={selectedRadioValue === 'manually'}

src/controls/MuiWrappedDropdown.tsx

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/**
2+
* @license
3+
* Copyright 2023 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
import {
18+
Autocomplete,
19+
AutocompleteProps,
20+
TextField,
21+
styled
22+
} from '@mui/material';
23+
import React from 'react';
24+
25+
type Props = Omit<
26+
AutocompleteProps<string, undefined, undefined, undefined>,
27+
'renderInput'
28+
>;
29+
30+
function DropdownInternal(props: Props) {
31+
const { className, value, onChange, options } = props;
32+
return (
33+
<Autocomplete
34+
className={className}
35+
value={value}
36+
onChange={onChange}
37+
options={options}
38+
renderInput={params => <TextField {...params} placeholder="Search..." />}
39+
/>
40+
);
41+
}
42+
43+
export const Dropdown = styled(DropdownInternal)<Props>({
44+
'& .MuiInputBase-root': {
45+
padding: 0
46+
},
47+
'& .MuiOutlinedInput-notchedOutline': {
48+
borderStyle: 'none'
49+
}
50+
});

src/controls/MuiWrappedInput.tsx

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* @license
3+
* Copyright 2023 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
import { TextField, styled } from '@mui/material';
18+
import React from 'react';
19+
import type { InputProps } from 'semantic-ui-react';
20+
21+
function InputInternal(props: InputProps) {
22+
const { className, value, onChange, placeholder } = props;
23+
return (
24+
<TextField
25+
className={className}
26+
value={value}
27+
onChange={e =>
28+
onChange?.(e as React.ChangeEvent<HTMLInputElement>, {
29+
value: e.target.value
30+
})
31+
}
32+
placeholder={placeholder}
33+
></TextField>
34+
);
35+
}
36+
37+
export const Input = styled(InputInternal)<InputProps>({
38+
marginTop: '10px',
39+
'& .MuiInputBase-input': {
40+
padding: '9.5px 14px'
41+
},
42+
'& .MuiOutlinedInput-notchedOutline': {
43+
borderColor: 'rgb(0,0,0)'
44+
}
45+
});

src/controls/MuiWrappedSelect.tsx

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* @license
3+
* Copyright 2023 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
import { MenuItem, Select as MuiSelect, styled } from '@mui/material';
18+
import React from 'react';
19+
import type { SelectProps } from 'semantic-ui-react';
20+
21+
function SelectInternal(props: SelectProps) {
22+
const { className, value, onChange, options } = props;
23+
return (
24+
<MuiSelect
25+
className={className}
26+
value={value}
27+
onChange={e =>
28+
onChange?.(e as React.ChangeEvent<HTMLInputElement>, {
29+
value: e.target.value
30+
})
31+
}
32+
>
33+
{options.map(option => (
34+
<MenuItem value={option.value as string}>{option.text}</MenuItem>
35+
))}
36+
</MuiSelect>
37+
);
38+
}
39+
40+
export const Select = styled(SelectInternal)<SelectProps>({
41+
marginTop: '10px',
42+
'& .MuiInputBase-input': {
43+
padding: '9.5px 14px'
44+
},
45+
'& .MuiOutlinedInput-notchedOutline': {
46+
borderStyle: 'none'
47+
}
48+
});

0 commit comments

Comments
 (0)