@ -1,53 +1,63 @@
< template >
< template >
< div >
< div >
< div class = "add-btn" >
< div
< button class = "btn btn-primary me-2" type = "button" @click ="$refs.apiKeyDialog.show()" >
v - if = "settings.disableAuth"
< font -awesome -icon icon = "plus" / > { { $t ( "Add API Key" ) } }
class = "mt-5 d-flex align-items-center justify-content-center my-3"
< / button >
>
{ { $t ( "apiKeysDisabledMsg" ) } }
< / div >
< / div >
< div v-else >
< div class = "add-btn" >
< button class = "btn btn-primary me-2" type = "button" @click ="$refs.apiKeyDialog.show()" >
< font -awesome -icon icon = "plus" / > { { $t ( "Add API Key" ) } }
< / button >
< / div >
< div >
< div >
< span v-if ="Object.keys(keyList).length === 0" class="d-flex align-items-center justify-content-center my-3" >
< span
{ { $t ( "No API Keys" ) } }
v - if = "Object.keys(keyList).length === 0"
< / span >
class = "d-flex align-items-center justify-content-center my-3"
>
< div
{ { $t ( "No API Keys" ) } }
v - for = "(item, index) in keyList"
< / span >
: key = "index"
class = "item"
< div
: class = "item.status"
v - for = "(item, index) in keyList"
>
: key = "index"
< div class = "left-part" >
class = "item"
< div
: class = "item.status"
class = "circle"
>
> < / div >
< div class = "left-part" >
< div class = "info" >
< div class = "circle" > < / div >
< div class = "title" > { { item . name } } < / div >
< div class = "info" >
< div class = "status" >
< div class = "title" > { { item . name } } < / div >
{ { $t ( "apiKey-" + item . status ) } }
< div class = "status" >
< / div >
{ { $t ( "apiKey-" + item . status ) } }
< div class = "date" >
< / div >
{ { $t ( "Created" ) } } : { { item . createdDate } }
< div class = "date" >
< / div >
{ { $t ( "Created" ) } } : { { item . createdDate } }
< div class = "date" >
< / div >
{ { $t ( "Expires" ) } } : { { item . expires || $t ( "Never" ) } }
< div class = "date" >
{ { $t ( "Expires" ) } } :
{ { item . expires || $t ( "Never" ) } }
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
< div class = "buttons" >
< div class = "buttons" >
< div class = "btn-group" role = "group" >
< div class = "btn-group" role = "group" >
< button v-if ="item.active" class="btn btn-normal" @click="disableDialog(item.id)" >
< button v-if ="item.active" class="btn btn-normal" @click="disableDialog(item.id)" >
< font -awesome -icon icon = "pause" / > { { $t ( "Disable" ) } }
< font -awesome -icon icon = "pause" / > { { $t ( "Disable" ) } }
< / button >
< / button >
< button v-if ="!item.active" class="btn btn-primary" @click="enableKey(item.id)" >
< button v-if ="!item.active" class="btn btn-primary" @click="enableKey(item.id)" >
< font -awesome -icon icon = "play" / > { { $t ( "Enable" ) } }
< font -awesome -icon icon = "play" / > { { $t ( "Enable" ) } }
< / button >
< / button >
< button class = "btn btn-danger" @click ="deleteDialog(item.id)" >
< button class = "btn btn-danger" @click ="deleteDialog(item.id)" >
< font -awesome -icon icon = "trash" / > { { $t ( "Delete" ) } }
< font -awesome -icon icon = "trash" / > { { $t ( "Delete" ) } }
< / button >
< / button >
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
@ -90,6 +100,9 @@ export default {
let result = Object . values ( this . $root . apiKeyList ) ;
let result = Object . values ( this . $root . apiKeyList ) ;
return result ;
return result ;
} ,
} ,
settings ( ) {
return this . $parent . $parent . $parent . settings ;
} ,
} ,
} ,
methods : {
methods : {
@ -127,9 +140,11 @@ export default {
* Pause maintenance
* Pause maintenance
* /
* /
disableKey ( ) {
disableKey ( ) {
this . $root . getSocket ( ) . emit ( "disableAPIKey" , this . selectedKeyID , ( res ) => {
this . $root
this . $root . toastRes ( res ) ;
. getSocket ( )
} ) ;
. emit ( "disableAPIKey" , this . selectedKeyID , ( res ) => {
this . $root . toastRes ( res ) ;
} ) ;
} ,
} ,
/ * *
/ * *
@ -145,113 +160,113 @@ export default {
< / script >
< / script >
< style lang = "scss" scoped >
< style lang = "scss" scoped >
@ import "../../assets/vars.scss" ;
@ import "../../assets/vars.scss" ;
. mobile {
. mobile {
. item {
. item {
flex - direction : column ;
flex - direction : column ;
align - items : flex - start ;
align - items : flex - start ;
margin - bottom : 20 px ;
margin - bottom : 20 px ;
}
}
}
}
. add - btn {
padding - top : 20 px ;
. add - btn {
padding - bottom : 20 px ;
padding - top : 20 px ;
padding - bottom : 20 px ;
}
. item {
display : flex ;
align - items : center ;
gap : 10 px ;
text - decoration : none ;
border - radius : 10 px ;
transition : all ease - in - out 0.15 s ;
justify - content : space - between ;
padding : 10 px ;
min - height : 90 px ;
margin - bottom : 5 px ;
& : hover {
background - color : $highlight - white ;
}
}
. item {
& . active {
display : flex ;
. circle {
align - items : center ;
background - color : $primary ;
gap : 10 px ;
}
text - decoration : none ;
}
border - radius : 10 px ;
transition : all ease - in - out 0.15 s ;
justify - content : space - between ;
padding : 10 px ;
min - height : 90 px ;
margin - bottom : 5 px ;
& : hover {
& . inactive {
background - color : $highlight - white ;
. circle {
background - color : $danger ;
}
}
}
& . active {
& . expired {
. circle {
. left - part {
background - color : $primary ;
opacity : 0.3 ;
}
}
}
& . inactive {
. circle {
. circle {
background - color : $dark - font - color ;
background - color : $danger ;
}
}
}
}
& . expired {
. left - part {
. left - part {
display : flex ;
opacity : 0.3 ;
gap : 12 px ;
}
align - items : center ;
. circle {
. circle {
background - color : $dark - font - color ;
width : 25 px ;
}
height : 25 px ;
border - radius : 50 rem ;
}
}
. left - part {
. info {
display : flex ;
. title {
gap : 12 px ;
font - weight : bold ;
align - items : center ;
font - size : 20 px ;
. circle {
width : 25 px ;
height : 25 px ;
border - radius : 50 rem ;
}
}
. info {
. status {
. title {
font - size : 14 px ;
font - weight : bold ;
font - size : 20 px ;
}
. status {
font - size : 14 px ;
}
}
}
}
}
}
. buttons {
. buttons {
display : flex ;
display : flex ;
gap : 8 px ;
gap : 8 px ;
flex - direction : row - reverse ;
flex - direction : row - reverse ;
. btn - group {
. btn - group {
width : 310 px ;
width : 310 px ;
}
}
}
}
}
}
. date {
margin - top : 5 px ;
. date {
display : block ;
margin - top : 5 px ;
font - size : 14 px ;
display : block ;
background - color : rgba ( 255 , 255 , 255 , 0.5 ) ;
font - size : 14 px ;
border - radius : 20 px ;
background - color : rgba ( 255 , 255 , 255 , 0.5 ) ;
padding : 0 1 0px ;
border - radius : 2 0px ;
width : fit - content ;
padding : 0 10 px ;
width : fit - content ;
. dark & {
color : white ;
. dark & {
background - color : rgba ( 255 , 255 , 255 , 0.1 ) ;
color : white ;
}
background - color : rgba ( 255 , 255 , 255 , 0.1 ) ;
}
}
}
. dark {
. dark {
. item {
. item {
& : hover {
& : hover {
background - color : $dark - bg2 ;
background - color : $dark - bg2 ;
}
}
}
}
}
}
< / style >
< / style >