18
18
import React , { ChangeEvent , useEffect , useState } from 'react' ;
19
19
import { LabIcon } from '@jupyterlab/ui-components' ;
20
20
import LeftArrowIcon from '../../style/icons/left_arrow_icon.svg' ;
21
- import 'semantic-ui-css/semantic.min.css' ;
22
21
import 'react-toastify/dist/ReactToastify.css' ;
23
- import { Input , Radio , Select , Dropdown } from 'semantic-ui-react' ;
24
22
import {
25
23
API_HEADER_BEARER ,
26
24
API_HEADER_CONTENT_TYPE ,
@@ -54,6 +52,10 @@ import { ClipLoader } from 'react-spinners';
54
52
import { toast } from 'react-toastify' ;
55
53
import ErrorPopup from '../utils/errorPopup' ;
56
54
import errorIcon from '../../style/icons/error_icon.svg' ;
55
+ import { Select } from '../controls/MuiWrappedSelect' ;
56
+ import { Input } from '../controls/MuiWrappedInput' ;
57
+ import { Radio } from '@mui/material' ;
58
+ import { Dropdown } from '../controls/MuiWrappedDropdown' ;
57
59
58
60
type Project = {
59
61
projectId : string ;
@@ -166,9 +168,7 @@ function CreateBatch({
166
168
const [ additionalPythonFileSelected , setAdditionalPythonFileSelected ] =
167
169
useState ( [ ...pythonFileUris ] ) ;
168
170
const [ mainPythonSelected , setMainPythonSelected ] = useState ( '' ) ;
169
- const [ clustersList , setClustersList ] = useState <
170
- Array < { key : string ; value : string ; text : string } >
171
- > ( [ ] ) ;
171
+ const [ clustersList , setClustersList ] = useState < string [ ] > ( [ ] ) ;
172
172
const [ additionalPythonFileValidation , setAdditionalPythonFileValidation ] =
173
173
useState ( true ) ;
174
174
const [ jarFileValidation , setJarFileValidation ] = useState ( true ) ;
@@ -250,11 +250,7 @@ function CreateBatch({
250
250
251
251
function isSubmitDisabled ( ) {
252
252
const commonConditions =
253
- batchIdSelected === '' ||
254
- regionName === '' ||
255
- batchIdValidation
256
- ;
257
-
253
+ batchIdSelected === '' || regionName === '' || batchIdValidation ;
258
254
switch ( batchTypeSelected ) {
259
255
case 'spark' :
260
256
return (
@@ -350,9 +346,7 @@ function CreateBatch({
350
346
response
351
347
. json ( )
352
348
. then ( ( responseResult : { clusters : Cluster [ ] } ) => {
353
- let transformClusterListData = [ ] ;
354
-
355
- transformClusterListData = responseResult . clusters . filter (
349
+ let transformClusterListData = responseResult . clusters . filter (
356
350
( data : Cluster ) => {
357
351
if ( data . status . state === STATUS_RUNNING ) {
358
352
return {
@@ -362,11 +356,9 @@ function CreateBatch({
362
356
}
363
357
) ;
364
358
365
- const keyLabelStructure = transformClusterListData . map ( obj => ( {
366
- key : obj . clusterName ,
367
- value : obj . clusterName ,
368
- text : obj . clusterName
369
- } ) ) ;
359
+ const keyLabelStructure = transformClusterListData . map (
360
+ obj => obj . clusterName
361
+ ) ;
370
362
setClustersList ( keyLabelStructure ) ;
371
363
} )
372
364
. catch ( ( e : Error ) => {
@@ -540,13 +532,7 @@ function CreateBatch({
540
532
response
541
533
. json ( )
542
534
. then ( ( responseResult : { subnetworks : string [ ] } ) => {
543
- let transformedSubNetworkList = [ ] ;
544
- /*
545
- Extracting subnetworks from Network
546
- Example: "https://www.googleapis.com/compute/v1/projects/{projectName}/global/networks/subnetwork",
547
- */
548
-
549
- transformedSubNetworkList = responseResult . subnetworks . map (
535
+ let transformedSubNetworkList = responseResult . subnetworks . map (
550
536
( data : string ) => {
551
537
return {
552
538
subnetworks : data . split (
@@ -593,9 +579,7 @@ function CreateBatch({
593
579
response
594
580
. json ( )
595
581
. then ( ( responseResult : { services : Service [ ] } ) => {
596
- let transformClusterListData = [ ] ;
597
-
598
- transformClusterListData = responseResult . services . filter (
582
+ let transformClusterListData = responseResult . services . filter (
599
583
( data : Service ) => {
600
584
return {
601
585
name : data . name
@@ -637,8 +621,7 @@ function CreateBatch({
637
621
response
638
622
. json ( )
639
623
. then ( ( responseResult : { projects : Project [ ] } ) => {
640
- let transformedProjectList = [ ] ;
641
- transformedProjectList = responseResult . projects . map (
624
+ let transformedProjectList = responseResult . projects . map (
642
625
( data : Project ) => {
643
626
return {
644
627
value : data . projectId ,
@@ -675,8 +658,7 @@ function CreateBatch({
675
658
response
676
659
. json ( )
677
660
. then ( ( responseResult : { items : Region [ ] } ) => {
678
- let transformedRegionList = [ ] ;
679
- transformedRegionList = responseResult . items . map (
661
+ let transformedRegionList = responseResult . items . map (
680
662
( data : Region ) => {
681
663
return {
682
664
value : data . name ,
@@ -960,8 +942,8 @@ function CreateBatch({
960
942
setKeySelected ( data . value ) ;
961
943
} ;
962
944
963
- const handleClusterSelected = ( event : any , data : any ) => {
964
- setClusterSelected ( data . value ) ;
945
+ const handleClusterSelected = ( event : any , value : any ) => {
946
+ setClusterSelected ( value ) ;
965
947
} ;
966
948
const handleManualKeySelected = ( event : ChangeEvent < HTMLInputElement > ) => {
967
949
const inputValue = event . target . value ;
@@ -1038,6 +1020,7 @@ function CreateBatch({
1038
1020
< div >
1039
1021
< div className = "create-batch-radio" >
1040
1022
< Radio
1023
+ size = "small"
1041
1024
className = "select-batch-radio-style"
1042
1025
value = "mainClass"
1043
1026
checked = { selectedRadio === 'mainClass' }
@@ -1052,7 +1035,8 @@ function CreateBatch({
1052
1035
</ div >
1053
1036
{ selectedRadio === 'mainClass' && (
1054
1037
< div className = "create-batch-input" >
1055
- < div className = "create-batch-message" > Main class*</ div >
1038
+ < span className = "create-batch-message" > Main class*</ span >
1039
+ < br />
1056
1040
< Input
1057
1041
className = "create-batch-style "
1058
1042
value = { mainClassSelected }
@@ -1077,6 +1061,7 @@ function CreateBatch({
1077
1061
< div >
1078
1062
< div className = "create-batch-radio" >
1079
1063
< Radio
1064
+ size = "small"
1080
1065
className = "select-batch-radio-style"
1081
1066
value = "mainJarURI"
1082
1067
checked = { selectedRadio === 'mainJarURI' }
@@ -1090,7 +1075,8 @@ function CreateBatch({
1090
1075
</ div >
1091
1076
{ selectedRadio === 'mainJarURI' && (
1092
1077
< div className = "create-batch-input" >
1093
- < div className = "create-batch-message" > Main jar*</ div >
1078
+ < span className = "create-batch-message" > Main jar*</ span >
1079
+ < br />
1094
1080
< Input
1095
1081
className = "create-batch-style "
1096
1082
value = { mainJarSelected }
@@ -1477,6 +1463,7 @@ function CreateBatch({
1477
1463
< div >
1478
1464
< div className = "create-batch-radio" >
1479
1465
< Radio
1466
+ size = "small"
1480
1467
className = "select-batch-radio-style"
1481
1468
value = "googleManaged"
1482
1469
checked = { selectedEncryptionRadio === 'googleManaged' }
@@ -1493,6 +1480,7 @@ function CreateBatch({
1493
1480
< div >
1494
1481
< div className = "create-batch-radio" >
1495
1482
< Radio
1483
+ size = "small"
1496
1484
className = "select-batch-radio-style"
1497
1485
value = "googleManaged"
1498
1486
checked = { selectedEncryptionRadio === 'customerManaged' }
@@ -1526,6 +1514,7 @@ function CreateBatch({
1526
1514
< div >
1527
1515
< div className = "create-batch-encrypt" >
1528
1516
< Radio
1517
+ size = "small"
1529
1518
className = "select-batch-encrypt-radio-style"
1530
1519
value = "mainClass"
1531
1520
checked = { selectedRadioValue === 'key' }
@@ -1559,6 +1548,7 @@ function CreateBatch({
1559
1548
</ div >
1560
1549
< div className = "encrypt" >
1561
1550
< Radio
1551
+ size = "small"
1562
1552
className = "select-batch-encrypt-radio-style "
1563
1553
value = "mainClass"
1564
1554
checked = { selectedRadioValue === 'manually' }
@@ -1571,16 +1561,13 @@ function CreateBatch({
1571
1561
disabled = { selectedRadioValue === 'key' }
1572
1562
onChange = { handleManualKeySelected }
1573
1563
/>
1574
-
1575
1564
</ div >
1576
1565
{ ! manualValidation && (
1577
- < div className = "error-key-parent" >
1578
- < iconError . react tag = "div" />
1579
- < div className = "error-key-missing" >
1580
- { KEY_MESSAGE }
1581
- </ div >
1582
- </ div >
1583
- ) }
1566
+ < div className = "error-key-parent" >
1567
+ < iconError . react tag = "div" />
1568
+ < div className = "error-key-missing" > { KEY_MESSAGE } </ div >
1569
+ </ div >
1570
+ ) }
1584
1571
</ div >
1585
1572
</ >
1586
1573
) }
@@ -1661,12 +1648,9 @@ function CreateBatch({
1661
1648
1662
1649
< Dropdown
1663
1650
className = "select-job-style"
1664
- search
1665
- selection
1666
1651
value = { clusterSelected }
1667
1652
onChange = { handleClusterSelected }
1668
1653
options = { clustersList }
1669
- placeholder = "Search..."
1670
1654
/>
1671
1655
< div className = "submit-job-label-header" > Properties</ div >
1672
1656
< LabelProperties
0 commit comments