-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
351 additions
and
51 deletions.
There are no files selected for viewing
112 changes: 112 additions & 0 deletions
112
src/main/client/app/pages/credentials/credentials-list.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<template> | ||
<div> | ||
<b-button | ||
:to="{ name: 'new_credentials' }" | ||
title="Create new credentials" | ||
variant="success" | ||
class="mb-4" | ||
> | ||
<font-awesome-icon icon="plus" /> Create new credentials | ||
</b-button> | ||
|
||
<b-card-group deck> | ||
<b-card | ||
v-for="credentials in credentialsList" | ||
:key="credentials.id" | ||
:title="credentials.name" | ||
style="max-width: 20rem;" | ||
:header-class="credentials.provider" | ||
> | ||
<template v-slot:header> | ||
<b-img | ||
:src="imageUrl(credentials)" | ||
class="rounded-logo" | ||
rounded="circle" | ||
width="80px" | ||
height="80px" | ||
left | ||
/> | ||
<p class="providerName"> | ||
{{ providerName(credentials) }} | ||
</p> | ||
</template> | ||
|
||
<b-button | ||
:to="{ name: 'credentials', params: { credentialsId: credentials.id } }" | ||
title="Edit this credentials" | ||
variant="primary" | ||
class="mr-1" | ||
> | ||
<font-awesome-icon icon="edit" /> | ||
</b-button> | ||
</b-card> | ||
</b-card-group> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { getCredentialsList } from '@/shared/api/credentials-api'; | ||
export default { | ||
name: 'Credentials', | ||
data: function data() { | ||
return { | ||
credentialsList: [], | ||
}; | ||
}, | ||
async created() { | ||
this.credentialsList = await getCredentialsList(); | ||
}, | ||
methods: { | ||
imageUrl(credentials) { | ||
// eslint-disable-next-line global-require, import/no-dynamic-require | ||
return require(`@/assets/images/providers/logos/${credentials.provider}.png`); | ||
}, | ||
providerName(credentials) { | ||
return { | ||
aws: 'AWS', | ||
google: 'GCP', | ||
azurerm: 'Azure', | ||
}[credentials.provider]; | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
.card-header { | ||
display: flex; | ||
align-items: center; | ||
} | ||
.card-header img { | ||
margin-right: 1rem; | ||
} | ||
.card-header.google { | ||
background-color: #2f6fd8; | ||
} | ||
.card-header.aws { | ||
background-color: #ea8c00; | ||
} | ||
.card-header.azurerm { | ||
background-color: #007cc1; | ||
} | ||
.rounded-logo { | ||
background-color: white; | ||
} | ||
.providerName { | ||
color: white; | ||
font-weight: bold; | ||
font-size: x-large; | ||
} | ||
</style> |
15 changes: 13 additions & 2 deletions
15
src/main/client/app/pages/credentials/credentials-routes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
const credentialsRoutes = [ | ||
{ | ||
path: '/credentials', | ||
name: 'credentials', | ||
component: () => import(/* webpackChunkName: "chunk-stacks" */ '@/pages/credentials/credentials.vue'), | ||
name: 'credentialsList', | ||
component: () => import(/* webpackChunkName: "chunk-credentials" */ '@/pages/credentials/credentials-list.vue'), | ||
meta: { | ||
authorities: ['ROLE_USER'], | ||
breadcrumb: [{ text: 'Credentials' }], | ||
title: 'Gaia - Credentials', | ||
}, | ||
}, | ||
{ | ||
path: '/credentials/:credentialsId', | ||
name: 'credentials', | ||
component: () => import(/* webpackChunkName: "chunk-credentials" */ '@/pages/credentials/credentials.vue'), | ||
props: true, | ||
meta: { | ||
authorities: ['ROLE_USER'], | ||
breadcrumb: [{ text: 'Credentials', to: { name: 'credentialsList' } }, { text: 'Credentials edition' }], | ||
title: 'Gaia - Credentials edition', | ||
}, | ||
}, | ||
]; | ||
|
||
export default credentialsRoutes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/client/app/pages/credentials/providers/credentials-aws.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<template> | ||
<div> | ||
<b-form-group | ||
label="Access Key Id" | ||
description="Your AWS Access Key Id (AWS_ACCESS_KEY_ID)" | ||
> | ||
<b-input | ||
id="credentials.name" | ||
v-model="credentials.accessKey" | ||
:state="notEmpty(credentials.accessKey)" | ||
/> | ||
<b-form-invalid-feedback>This field is mandatory</b-form-invalid-feedback> | ||
</b-form-group> | ||
<b-form-group | ||
label="Secret Access Key" | ||
description="Your AWS Secret Access Key (AWS_SECRET_ACCESS_KEY)" | ||
> | ||
<b-input | ||
id="credentials.name" | ||
v-model="credentials.secretKey" | ||
:state="notEmpty(credentials.secretKey)" | ||
/> | ||
<b-form-invalid-feedback>This field is mandatory</b-form-invalid-feedback> | ||
</b-form-group> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'CredentialsAWS', | ||
props: { | ||
credentials: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}, | ||
methods: { | ||
notEmpty(field) { | ||
return typeof field !== 'undefined' && field !== null && field.trim() !== ''; | ||
}, | ||
}, | ||
}; | ||
</script> |
Oops, something went wrong.