1
1
<template >
2
2
<base-layout >
3
- <!-- Start Node main layouts -->
4
-
5
3
<div class =" w-full h-full grid grid-cols-24 relative select-none" >
6
4
<div class =" col-start-1 col-span-1 flex justify-center items-center" >
7
- <SidebarSection
8
- @network-modal =" displaySwitchNetwork"
9
- @nuke-node =" openNukeNodeModal"
10
- />
5
+ <SidebarSection @network-modal =" displaySwitchNetwork" @nuke-node =" openNukeNodeModal" />
11
6
</div >
12
7
<div class =" col-start-2 col-end-17 w-full h-full relative" >
13
8
<EditBody
24
19
</div >
25
20
<div class =" col-start-17 col-end-21 ml-1 grid grid-cols-2 grid-rows-9" >
26
21
<NetworkStatus />
27
- <ServiceSection
28
- @change-connection =" serviceModifyHandler"
29
- @delete-service =" selectedServiceToRemove"
30
- />
22
+ <ServiceSection @change-connection =" serviceModifyHandler" @delete-service =" selectedServiceToRemove" />
31
23
</div >
32
24
<div class =" col-start-21 col-end-25 px-1 flex flex-col justify-between" >
33
- <ChangesSection
34
- @remove-change =" cancelChangeHandler"
35
- @confirm-changes =" confirmHandler"
36
- />
25
+ <ChangesSection @remove-change =" cancelChangeHandler" @confirm-changes =" confirmHandler" />
37
26
</div >
38
27
</div >
39
28
<!-- End Node main layout -->
62
51
@create-devnet =" createDevnetModal"
63
52
@get-network =" getSetupNetwork"
64
53
/>
65
- <ServicesDrawer
66
- v-else-if =" manageStore.isServicesDrawerActive"
67
- :dragging =" startDrag"
68
- @add-services =" addServices"
69
- />
54
+ <ServicesDrawer v-else-if =" manageStore.isServicesDrawerActive" :dragging =" startDrag" @add-services =" addServices" />
70
55
</template >
71
56
</drawer-box >
72
57
</transition >
73
58
<!-- End drawer layout -->
74
59
<!-- Custom Modals -->
75
60
<TransitionGroup name =" fadeModal" >
76
61
<!-- Start Network Switch Modal -->
77
- <NetworkModal
78
- v-if =" manageStore.displayNetworkList"
79
- @close-window =" closeNetworkModal"
80
- @switch-confirm =" switchNetworkConfirm"
81
- />
62
+ <NetworkModal v-if =" manageStore.displayNetworkList" @close-window =" closeNetworkModal" @switch-confirm =" switchNetworkConfirm" />
82
63
<!-- End Switch Network Modal -->
83
64
<!-- Start Switch Client Modal -->
84
65
<SwitchModal
89
70
/>
90
71
<!-- End Switch Client Modal -->
91
72
<!-- Start Info Modal -->
92
- <InfoModal
93
- v-if =" isInfoModalOpen"
94
- :client =" clientForInfo"
95
- @close-window =" closeInfoModal"
96
- @ok-button =" isInfoModalOpen = false"
97
- />
73
+ <InfoModal v-if =" isInfoModalOpen" :client =" clientForInfo" @close-window =" closeInfoModal" @ok-button =" isInfoModalOpen = false" />
98
74
<!-- End Info Modal -->
99
75
<!-- Start Modify Services Modal -->
100
76
<ModifyModal
134
110
<!-- End Nuke Modal -->
135
111
136
112
<!-- Start Import Setup -->
137
- <ImportSetup
138
- v-if =" manageStore.isImportSetupYamlActive"
139
- @confirm-import =" confirmImportSingleSetup"
140
- />
113
+ <ImportSetup v-if =" manageStore.isImportSetupYamlActive" @confirm-import =" confirmImportSingleSetup" />
141
114
<!-- End Import Setup -->
142
115
<!-- Start Create Setup -->
143
- <CreateSetup
144
- v-if =" setupStore.isCreateSetupModalActive"
145
- :network =" selectedSetupNetwork"
146
- />
116
+ <CreateSetup v-if =" setupStore.isCreateSetupModalActive" :network =" selectedSetupNetwork" />
147
117
<!-- End Create Setup -->
148
118
149
119
<!-- Start Setup Infos -->
150
120
<SetupInfos v-if =" setupStore.selectedSetupInfos" />
151
121
<!-- End Setup Infos -->
152
122
<!-- Start Devnet Configs Modal -->
153
- <DevnetSetup
154
- v-if =" setupStore.isDevnetSetupModalActive"
155
- @confirm-devnet =" setupDevnet"
156
- />
123
+ <DevnetSetup v-if =" setupStore.isDevnetSetupModalActive" @confirm-devnet =" setupDevnet" />
157
124
</TransitionGroup >
158
- <LoaderAnime
159
- v-if =" manageStore.disableConfirmButton || setupStore.isImportAnimeActive"
160
- :anime =" getAimationSrc"
161
- />
125
+ <LoaderAnime v-if =" manageStore.disableConfirmButton || setupStore.isImportAnimeActive" :anime =" getAimationSrc" />
162
126
</base-layout >
163
127
</template >
128
+
164
129
<script setup>
165
130
import { useFrontendServices } from " @/composables/services" ;
166
131
import { useDeepClone } from " @/composables/utils" ;
@@ -353,9 +318,7 @@ const switchClientModalhandler = (item) => {
353
318
354
319
const switchClientConfirm = (properties ) => {
355
320
isSwitchModalOpen .value = false ;
356
- const current = manageStore .newConfiguration .find (
357
- (e ) => e? .config .serviceID === properties .itemToReplace .config .serviceID
358
- );
321
+ const current = manageStore .newConfiguration .find ((e ) => e? .config .serviceID === properties .itemToReplace .config .serviceID );
359
322
360
323
const currentClientIndex = manageStore .newConfiguration .indexOf (current);
361
324
@@ -392,9 +355,7 @@ const switchClientConfirm = (properties) => {
392
355
executionClients: [],
393
356
consensusClients: [],
394
357
otherServices: [],
395
- checkpointURL: properties .checkPointSyncUrl
396
- ? properties .checkPointSyncUrl
397
- : false ,
358
+ checkpointURL: properties .checkPointSyncUrl ? properties .checkPointSyncUrl : false ,
398
359
},
399
360
},
400
361
});
@@ -433,7 +394,6 @@ const hideModifyModal = () => {
433
394
isModifyModalOpen .value = false ;
434
395
435
396
manageStore .newConfiguration = useDeepClone (serviceStore .installedServices );
436
-
437
397
};
438
398
const confirmConsensusConnection = (item ) => {
439
399
clientToConnect .value .isNotConnectedToConsensus = false ;
@@ -509,17 +469,13 @@ const createDevnetModal = () => {
509
469
const setupDevnet = async () => {
510
470
manageStore .disableConfirmButton = true ;
511
471
try {
512
- setupStore .genesisFile = useDeepClone (
513
- setupStore .uploadedGenesisConfig || genesisStore .genesis
514
- );
472
+ setupStore .genesisFile = useDeepClone (setupStore .uploadedGenesisConfig || genesisStore .genesis );
515
473
516
474
setupStore .isDevnetSetupModalActive = false ;
517
475
setupStore .currentStep = 1 ;
518
476
519
477
await ControlService .writeGenesisJsonDevnet (useDeepClone (setupStore .genesisFile ));
520
- const existDepositContract = setupStore .genesisFile .alloc .hasOwnProperty (
521
- " 4242424242424242424242424242424242424242"
522
- );
478
+ const existDepositContract = setupStore .genesisFile .alloc .hasOwnProperty (" 4242424242424242424242424242424242424242" );
523
479
524
480
const writeConfigData = {
525
481
configYaml: genesisStore .configYaml ,
@@ -550,13 +506,10 @@ const setupDevnet = async () => {
550
506
const executionClients = services .filter ((e ) => e .category === " execution" );
551
507
const consensusClients = services .filter ((e ) => e .category === " consensus" );
552
508
553
- const installPromises = services .map ((client ) =>
554
- installService (client, setupId, executionClients, consensusClients)
555
- );
509
+ const installPromises = services .map ((client ) => installService (client, setupId, executionClients, consensusClients));
556
510
557
511
await Promise .all (installPromises);
558
512
559
-
560
513
await ControlService .handleServiceChanges (useDeepClone (manageStore .confirmChanges ));
561
514
562
515
await ControlService .startServicesForSetup (setupId);
@@ -577,10 +530,8 @@ const installService = async (client, setupId, executionClients, consensusClient
577
530
network: " devnet" ,
578
531
chainId: useDeepClone (setupStore .genesisFile ? .config ? .chainId ),
579
532
installDir: client .installDir || " /opt/stereum" ,
580
- executionClients:
581
- client .category === " consensus" ? executionClients : client .executionClients ,
582
- consensusClients:
583
- client .category === " validator" ? consensusClients : client .consensusClients ,
533
+ executionClients: client .category === " consensus" ? executionClients : client .executionClients ,
534
+ consensusClients: client .category === " validator" ? consensusClients : client .consensusClients ,
584
535
otherServices: client .otherServices ,
585
536
relays: null ,
586
537
checkpointURL: client .checkPointSyncUrl || false ,
@@ -630,7 +581,6 @@ const cancelChangeHandler = (item) => {
630
581
manageStore .newConfiguration .splice (eventIdx, 1 );
631
582
632
583
manageStore .newConfiguration = useDeepClone (serviceStore .installedServices );
633
-
634
584
}
635
585
636
586
if (item .content === " MODIFY" ) {
@@ -670,10 +620,7 @@ const addServices = (service) => {
670
620
const addServerServices = (service ) => {
671
621
let item = useDeepClone (service);
672
622
673
- if (
674
- item .category === " service" &&
675
- manageStore .newConfiguration .map ((s ) => s? .service ).includes (item? .service )
676
- ) {
623
+ if (item .category === " service" && manageStore .newConfiguration .map ((s ) => s? .service ).includes (item? .service )) {
677
624
return ;
678
625
} else {
679
626
item .id = manageStore .newConfiguration .length ;
@@ -683,9 +630,7 @@ const addServerServices = (service) => {
683
630
};
684
631
manageStore .newConfiguration .push (newItem);
685
632
686
- setupStore .editSetups
687
- .find ((s ) => s .setupId === setupStore .selectedSetup ? .setupId )
688
- ? .services .push (newItem);
633
+ setupStore .editSetups .find ((s ) => s .setupId === setupStore .selectedSetup ? .setupId )? .services .push (newItem);
689
634
690
635
clientToInstall .value = newItem;
691
636
clientToInstall .value .addPanel = true ;
@@ -708,10 +653,7 @@ const onDrop = (event) => {
708
653
const allServices = useDeepClone (serviceStore .allServices );
709
654
const itemId = event .dataTransfer .getData (" itemId" );
710
655
let item = allServices .find ((item ) => item .id == itemId);
711
- if (
712
- item .category === " service" &&
713
- manageStore .newConfiguration .map ((s ) => s .service ).includes (item .service )
714
- ) {
656
+ if (item .category === " service" && manageStore .newConfiguration .map ((s ) => s .service ).includes (item .service )) {
715
657
return ;
716
658
} else {
717
659
item .id = manageStore .newConfiguration .length ;
@@ -798,9 +740,7 @@ const switchNetworkConfirm = (network) => {
798
740
manageStore .displayNetworkList = false ;
799
741
if (network? .network != setupStore .selectedSetup ? .network ) {
800
742
if (manageStore .confirmChanges .map ((j ) => j .content ).includes (" CHANGE NETWORK" )) {
801
- let index = manageStore .confirmChanges .findIndex ((j ) =>
802
- j .content .includes (" CHANGE NETWORK" )
803
- );
743
+ let index = manageStore .confirmChanges .findIndex ((j ) => j .content .includes (" CHANGE NETWORK" ));
804
744
if (setupStore .selectedSetup .network === network .network ) {
805
745
manageStore .confirmChanges .splice (index, 1 );
806
746
} else {
@@ -844,12 +784,7 @@ const selectedServiceToRemove = (item) => {
844
784
let commonService = setupStore .editSetups .find ((s ) => {
845
785
return s .setupName === " commonServices" ;
846
786
});
847
- if (
848
- item .isNotConnectedToConsensus ||
849
- item .isNotConnectedToValidator ||
850
- item .isNotConnectedToMevboost ||
851
- item .isDisplayPluginMenu
852
- ) {
787
+ if (item .isNotConnectedToConsensus || item .isNotConnectedToValidator || item .isNotConnectedToMevboost || item .isDisplayPluginMenu ) {
853
788
return ;
854
789
} else {
855
790
clientToRemove .value = item;
@@ -864,9 +799,7 @@ const selectedServiceToRemove = (item) => {
864
799
content: " DELETE" ,
865
800
contentIcon: " /img/icon/edit-node-icons/delete-service.png" ,
866
801
service: item,
867
- setupId: commonServiceExistance
868
- ? commonService .setupId
869
- : setupStore .selectedSetup ? .setupId ,
802
+ setupId: commonServiceExistance ? commonService .setupId : setupStore .selectedSetup ? .setupId ,
870
803
};
871
804
const itemExists = manageStore .confirmChanges .some (
872
805
(e ) => (e .id === item .config ? .serviceID || e .id === item .id ) && e .content === " DELETE"
@@ -942,41 +875,26 @@ const confirmHandler = async () => {
942
875
manageStore .disableConfirmButton = true ;
943
876
944
877
const setupExists = manageStore .confirmChanges .some (
945
- (item ) =>
946
- item .service ? .hasOwnProperty (" setupName" ) &&
947
- item .service ? .hasOwnProperty (" setupId" ) &&
948
- item .service .setupId == item .id
878
+ (item ) => item .service ? .hasOwnProperty (" setupName" ) && item .service ? .hasOwnProperty (" setupId" ) && item .service .setupId == item .id
949
879
);
950
880
951
881
const serverServiceExists = manageStore .confirmChanges .some (
952
- (change ) =>
953
- change .content === " INSTALL" &&
954
- setupStore .serverServices .includes (change .service .service )
882
+ (change ) => change .content === " INSTALL" && setupStore .serverServices .includes (change .service .service )
955
883
);
956
884
957
885
try {
958
886
if (serverServiceExists) {
959
887
await handleServerServiceChanges ();
960
- } else if (
961
- setupExists &&
962
- manageStore .confirmChanges .some ((e ) => e .content === " DELETE" )
963
- ) {
888
+ } else if (setupExists && manageStore .confirmChanges .some ((e ) => e .content === " DELETE" )) {
964
889
await handleSetupChanges ();
965
890
} else if (manageStore .confirmChanges .some ((e ) => e .content === " NETWORK" )) {
966
891
await handleSwitchSetupNetwork ();
967
892
968
- await ControlService .handleServiceChanges (
969
- JSON .parse (JSON .stringify (manageStore .confirmChanges ))
970
- );
893
+ await ControlService .handleServiceChanges (JSON .parse (JSON .stringify (manageStore .confirmChanges )));
971
894
} else if (manageStore .confirmChanges .some ((e ) => e .content === " MODIFY" )) {
972
- await ControlService .handleServiceChanges (
973
- JSON .parse (JSON .stringify (manageStore .confirmChanges ))
974
- );
895
+ await ControlService .handleServiceChanges (JSON .parse (JSON .stringify (manageStore .confirmChanges )));
975
896
} else {
976
- await ControlService .handleServiceChanges (
977
- JSON .parse (JSON .stringify (manageStore .confirmChanges ))
978
- );
979
-
897
+ await ControlService .handleServiceChanges (JSON .parse (JSON .stringify (manageStore .confirmChanges )));
980
898
}
981
899
} catch (error) {
982
900
console .error (" Error processing changes:" , error);
@@ -988,28 +906,18 @@ const confirmHandler = async () => {
988
906
};
989
907
990
908
const handleServerServiceChanges = async () => {
991
- const commonServicesId = setupStore .editSetups .find (
992
- (s ) => s .setupName === " commonServices"
993
- )? .setupId ;
909
+ const commonServicesId = setupStore .editSetups .find ((s ) => s .setupName === " commonServices" )? .setupId ;
994
910
manageStore .confirmChanges .forEach ((change ) => {
995
911
change .data .setupId = commonServicesId ?? change .data .setupId ;
996
912
});
997
913
998
- await ControlService .handleServiceChanges (
999
- JSON .parse (JSON .stringify (manageStore .confirmChanges ))
1000
- );
1001
-
914
+ await ControlService .handleServiceChanges (JSON .parse (JSON .stringify (manageStore .confirmChanges )));
915
+ };
1002
916
1003
917
const handleSetupChanges = async () => {
1004
- const setupsToRemoveIds = new Set (
1005
- setupStore .selectedSetupToRemove .map ((s ) => s .setupId )
1006
- );
1007
- setupStore .allSetups = setupStore .allSetups .filter (
1008
- (e ) => ! setupsToRemoveIds .has (e .setupId )
1009
- );
1010
- setupStore .editSetups = setupStore .editSetups .filter (
1011
- (e ) => ! setupsToRemoveIds .has (e .setupId )
1012
- );
918
+ const setupsToRemoveIds = new Set (setupStore .selectedSetupToRemove .map ((s ) => s .setupId ));
919
+ setupStore .allSetups = setupStore .allSetups .filter ((e ) => ! setupsToRemoveIds .has (e .setupId ));
920
+ setupStore .editSetups = setupStore .editSetups .filter ((e ) => ! setupsToRemoveIds .has (e .setupId ));
1013
921
1014
922
let subtasks = manageStore .confirmChanges .flatMap ((e ) => e .subTasks );
1015
923
await ControlService .handleServiceChanges (useDeepClone (subtasks));
@@ -1074,11 +982,7 @@ const deleteSetup = async (item) => {
1074
982
});
1075
983
const subtasks =
1076
984
item? .services .flatMap ((service ) => {
1077
-
1078
- const matchedServices = manageStore .newConfiguration .filter (
1079
- (e ) => e .config ? .serviceID === service .config ? .serviceID
1080
- );
1081
-
985
+ const matchedServices = manageStore .newConfiguration .filter ((e ) => e .config ? .serviceID === service .config ? .serviceID );
1082
986
1083
987
return matchedServices .map ((e ) => ({
1084
988
id: e .config ? .serviceID ,
@@ -1098,9 +1002,7 @@ const deleteSetup = async (item) => {
1098
1002
subTasks: subtasks,
1099
1003
};
1100
1004
1101
- const itemExists = manageStore .confirmChanges .some (
1102
- (e ) => e .id === item .setupId && e .content === " DELETE"
1103
- );
1005
+ const itemExists = manageStore .confirmChanges .some ((e ) => e .id === item .setupId && e .content === " DELETE" );
1104
1006
if (! itemExists) {
1105
1007
manageStore .confirmChanges .push (confirmDelete);
1106
1008
}
@@ -1125,10 +1027,7 @@ const closeSwitchModal = () => {
1125
1027
isSwitchModalOpen .value = false ;
1126
1028
manageStore .isLineHidden = false ;
1127
1029
1128
- manageStore .newConfiguration = JSON .parse (
1129
- JSON .stringify (serviceStore .installedServices )
1130
- );
1131
-
1030
+ manageStore .newConfiguration = JSON .parse (JSON .stringify (serviceStore .installedServices ));
1132
1031
};
1133
1032
1134
1033
const closeInfoModal = () => {
0 commit comments