@@ -772,25 +772,37 @@ function loadInstanceSettings(){
772
772
}
773
773
774
774
$(" #instanceHostsBox " ).on(" click " , " #addHostBtn " , function(){
775
- $.confirm({
776
- icon: " fa fa - server " ,
777
- title: " Add Host " ,
778
- content: `<div class=" mb - 2 " >
775
+ $.confirm({
776
+ icon: " fa fa - server " ,
777
+ title: " Add Host " ,
778
+ columnClass: " col - md - 6 col - md - offset - 3 col - sm - 6 col - sm - offset - 3 col - xs - 10 col - xs - offset - 1 " ,
779
+ content: `<div class=" mb - 2 " >
779
780
<label>Alias</label>
780
781
<input class=" form - control " name=" alias " placeholder=" PC , Laptop , Server - 1 " />
781
782
</div>
782
783
<label class=" mb - 2 " >How Do You Want To Access The Host?</label>
783
- <nav class= " text - dark " >
784
+ <nav>
784
785
<div class=" nav nav - pills mb - 3 " id=" host - nav " role=" tablist " >
785
- <button class=" nav - link w - 50 text - dark active " id=" nav - network - tab " data-bs-toggle=" tab " data-bs-target=" #nav - network " type=" button " role=" tab " aria-controls=" nav - network " aria-selected=" true " >Trust Password</button>
786
- <button class=" nav - link w - 50 text - dark " id=" nav - socket - tab " data-bs-toggle=" tab " data-bs-target=" #nav - socket " type=" button " role=" tab " aria-controls=" nav - socket " aria-selected=" false " >Socket</button>
786
+ <button class=" nav - link text - dark active " id=" nav - token - tab " data-bs-toggle=" tab " data-bs-target=" #nav - token " type=" button " role=" tab " aria-controls=" nav - token " aria-selected=" true " >Token</button>
787
+ <button class=" nav - link text - dark " id=" nav - network - tab " data-bs-toggle=" tab " data-bs-target=" #nav - network " type=" button " role=" tab " aria-controls=" nav - network " aria-selected=" true " >Trust Password (Depreciated)</button>
788
+ <button class=" nav - link text - dark " id=" nav - socket - tab " data-bs-toggle=" tab " data-bs-target=" #nav - socket " type=" button " role=" tab " aria-controls=" nav - socket " aria-selected=" false " >Socket</button>
787
789
</div>
788
790
</nav>
789
791
<div class=" tab - content " id=" host - navContent " >
790
- <div class=" tab - pane fade show active " id=" nav - network " role=" tabpanel " aria-labelledby=" nav - network - tab " >
792
+ <div class=" tab - pane fade show active " id=" nav - token " role=" tabpanel " aria-labelledby=" nav - token - tab " >
791
793
<div class=" mb - 2 " >
792
794
<label>IP Address / Hostname</label>
793
- <input class=" form - control " name=" name " placeholder=" " />
795
+ <input class=" form - control " name=" name " placeholder=" " autocomplete=" off " />
796
+ </div>
797
+ <div class=" mb - 2 " >
798
+ <label>Token</label>
799
+ <textarea class=" form - control " type=" text " name=" token " placeholder=" " autocomplete=" off " ></textarea>
800
+ </div>
801
+ </div>
802
+ <div class=" tab - pane fade show " id=" nav - network " role=" tabpanel " aria-labelledby=" nav - network - tab " >
803
+ <div class=" mb - 2 " >
804
+ <label>IP Address / Hostname</label>
805
+ <input class=" form - control " name=" name " placeholder=" " autocomplete=" off " />
794
806
</div>
795
807
<div class=" mb - 2 " >
796
808
<label>Trust Password</label>
@@ -800,7 +812,7 @@ function loadInstanceSettings(){
800
812
<div class=" tab - pane fade " id=" nav - socket " role=" tabpanel " aria-labelledby=" nav - socket - tab " >
801
813
<div class=" mb - 2 " >
802
814
<label>Socket Path</label>
803
- <input class=" form - control " name=" socketPath " placeholder =" / var / snap / lxd / common / lxd / unix . socket " />
815
+ <input class=" form - control " name=" socketPath " value =" / var / snap / lxd / common / lxd / unix . socket " />
804
816
</div>
805
817
</div>
806
818
</div>
@@ -819,6 +831,7 @@ function loadInstanceSettings(){
819
831
820
832
let name = " "
821
833
let trustPassword = " "
834
+ let token = " "
822
835
let socketPath = " "
823
836
824
837
let activeNav = this.$content .find(" #host - nav . active " ).data().bsTarget
@@ -832,19 +845,31 @@ function loadInstanceSettings(){
832
845
}
833
846
}else{
834
847
name = this.$content .find('input[name=name]').val().trim();
835
- trustPassword = this. $content .find('input[name=trustPassword]').val().trim();
848
+
836
849
if(name === " " ){
837
850
$.alert(" Please enter ip address / hostname " )
838
851
return false;
839
- }else if(trustPassword === " " ){
840
- $.alert(" Please enter trust password " )
841
- return false;
842
852
}
853
+ if(activeNav == " #nav - token " ){
854
+ token = this.$content .find('textarea[name=token]').val().trim();
855
+ if(token === " " ){
856
+ $.alert(" Please enter token " )
857
+ return false;
858
+ }
859
+ }else{
860
+ trustPassword = this.$content .find('input[name=trustPassword]').val().trim();
861
+ if(trustPassword === " " ){
862
+ $.alert(" Please enter trust password " )
863
+ return false;
864
+ }
865
+ }
866
+
843
867
}
844
868
let x = {hostsDetails: [
845
869
{
846
870
name: name,
847
871
trustPassword: trustPassword,
872
+ token: token,
848
873
socketPath: socketPath,
849
874
alias: alias
850
875
}
0 commit comments