2019-01-24 20:15:10 +00:00
// Copyright (C) 2019 Storj Labs, Inc.
2019-01-02 13:46:55 +00:00
// See LICENSE for copying information.
< template >
< div >
2019-02-01 16:19:30 +00:00
< div v-if ="!isEmpty" class="api-keys-header" >
2019-01-02 13:46:55 +00:00
< HeaderArea / >
< / div >
2019-02-01 16:19:30 +00:00
< div v-if ="!isEmpty" class="api-keys-container" >
2019-01-02 13:46:55 +00:00
< div class = "api-keys-container__content" >
2019-02-01 16:19:30 +00:00
< div v-for ="apiKey in apiKeys" v-on:click="toggleSelection(apiKey.id)" >
< ApiKeysItem
v - bind : class = "[apiKey.isSelected ? 'selected': null]"
: apiKey = "apiKey" / >
< / div >
2019-01-02 13:46:55 +00:00
< / div >
2019-02-01 16:19:30 +00:00
< Footer v -if = " isSelected " / >
2019-01-02 13:46:55 +00:00
< / div >
< EmptyState
2019-02-01 16:19:30 +00:00
: onButtonClick = "togglePopup"
v - if = "isEmpty"
2019-01-02 13:46:55 +00:00
mainTitle = "You have no API Keys yet"
2019-01-31 12:23:04 +00:00
additional - text = "<p>We recommend you to create your first API Key for this project. API Keys allow developers to manage their project and build applications over Storj Network through our Uplink CLI.</p>"
2019-01-02 13:46:55 +00:00
: imageSource = "emptyImage"
buttonLabel = "New Api Key"
isButtonShown / >
2019-02-01 16:19:30 +00:00
< AddAPIKeyPopup v -if = " isPopupShown " / >
2019-01-02 13:46:55 +00:00
< / div >
< / template >
< script lang = "ts" >
import { Component , Vue } from 'vue-property-decorator' ;
import EmptyState from '@/components/common/EmptyStateArea.vue' ;
import HeaderArea from '@/components/apiKeys/headerArea/HeaderArea.vue' ;
import { EMPTY _STATE _IMAGES } from '@/utils/constants/emptyStatesImages' ;
import ApiKeysItem from '@/components/apiKeys/ApiKeysItem.vue' ;
2019-02-01 16:19:30 +00:00
import AddAPIKeyPopup from '@/components/apiKeys/AddApiKeyPopup.vue' ;
2019-01-30 13:18:07 +00:00
import Footer from '@/components/apiKeys/footerArea/Footer.vue' ;
2019-02-20 13:33:56 +00:00
import { API _KEYS _ACTIONS , APP _STATE _ACTIONS } from '@/utils/constants/actionNames' ;
2019-01-02 13:46:55 +00:00
@ Component ( {
data : function ( ) {
return {
emptyImage : EMPTY _STATE _IMAGES . API _KEY ,
} ;
} ,
2019-02-01 16:19:30 +00:00
methods : {
toggleSelection : function ( id : string ) : void {
this . $store . dispatch ( API _KEYS _ACTIONS . TOGGLE _SELECTION , id ) ;
} ,
togglePopup : function ( ) : void {
this . $store . dispatch ( APP _STATE _ACTIONS . TOGGLE _NEW _API _KEY ) ;
} ,
} ,
computed : {
apiKeys : function ( ) : any {
return this . $store . state . apiKeysModule . apiKeys ;
} ,
isEmpty : function ( ) : boolean {
return this . $store . state . apiKeysModule . apiKeys . length === 0 ;
} ,
isSelected : function ( ) : boolean {
return this . $store . getters . selectedAPIKeys . length > 0 ;
} ,
isPopupShown : function ( ) : boolean {
return this . $store . state . appStateModule . appState . isNewAPIKeyPopupShown ;
}
} ,
2019-01-02 13:46:55 +00:00
components : {
EmptyState ,
HeaderArea ,
ApiKeysItem ,
2019-02-01 16:19:30 +00:00
AddAPIKeyPopup ,
2019-01-09 16:13:43 +00:00
Footer
2019-02-01 16:19:30 +00:00
} ,
2019-01-02 13:46:55 +00:00
} )
export default class ApiKeysArea extends Vue {
}
< / script >
< style scoped lang = "scss" >
2019-01-09 16:13:43 +00:00
// .api-keys-header {
// padding: 44px 40px 0 40px;
// }
// .api-keys-container {
// padding: 0px 40px 0 60px;
// }
2019-01-02 13:46:55 +00:00
. api - keys - header {
2019-01-09 16:13:43 +00:00
position : fixed ;
2019-01-30 13:18:07 +00:00
padding : 55 px 30 px 0 px 64 px ;
2019-01-09 16:13:43 +00:00
max - width : 79.7 % ;
width : 100 % ;
2019-01-30 13:18:07 +00:00
background - color : # F5F6FA ;
2019-01-09 16:13:43 +00:00
z - index : 999 ;
2019-01-02 13:46:55 +00:00
}
. api - keys - container {
2019-01-09 16:13:43 +00:00
padding : 0 px 30 px 55 px 64 px ;
overflow - y : scroll ;
max - height : 84 vh ;
position : relative ;
& _ _content {
display : grid ;
2019-01-30 13:18:07 +00:00
grid - template - columns : 190 px 190 px 190 px 190 px 190 px 190 px 190 px ;
2019-01-09 16:13:43 +00:00
width : 100 % ;
grid - row - gap : 20 px ;
2019-01-30 13:18:07 +00:00
grid - column - gap : 20 px ;
2019-01-09 16:13:43 +00:00
justify - content : space - between ;
2019-01-30 13:18:07 +00:00
margin - top : 150 px ;
2019-01-09 16:13:43 +00:00
margin - bottom : 100 px ;
}
}
@ media screen and ( max - width : 1600 px ) {
. api - keys - container {
& _ _content {
2019-01-30 13:18:07 +00:00
grid - template - columns : 200 px 200 px 200 px 200 px 200 px ;
2019-01-09 16:13:43 +00:00
}
}
. api - keys - header {
2019-01-30 13:18:07 +00:00
max - width : 75 % ;
2019-01-09 16:13:43 +00:00
}
}
@ media screen and ( max - width : 1366 px ) {
. api - keys - container {
& _ _content {
2019-01-30 13:18:07 +00:00
grid - template - columns : 180 px 180 px 180 px 180 px 180 px ;
2019-01-09 16:13:43 +00:00
}
}
. api - keys - header {
max - width : 72 % ;
}
}
2019-01-30 13:18:07 +00:00
@ media screen and ( max - width : 1281 px ) {
2019-01-09 16:13:43 +00:00
. api - keys - container {
& _ _content {
2019-01-30 13:18:07 +00:00
grid - template - columns : 210 px 210 px 210 px 210 px ;
}
}
. api - keys - header {
max - width : 69 % ;
}
. apikey - item - container {
height : 200 px ;
}
}
@ media screen and ( max - width : 1025 px ) {
. api - keys - container {
& _ _content {
grid - template - columns : 200 px 200 px 200 px 200 px ;
}
}
. api - keys - header {
max - width : 80 % ;
}
. apikey - item - container {
height : 180 px ;
}
}
@ media screen and ( max - width : 801 px ) {
. api - keys - container {
& _ _content {
grid - template - columns : 200 px 200 px 200 px ;
2019-01-09 16:13:43 +00:00
grid - row - gap : 0 px ;
}
}
. api - keys - header {
2019-01-30 13:18:07 +00:00
max - width : 80 % ;
}
. apikey - item - container {
height : 200 px ;
2019-01-09 16:13:43 +00:00
}
2019-01-02 13:46:55 +00:00
}
< / style >