-
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
7 changed files
with
155 additions
and
11 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const credentialsRoutes = [ | ||
{ | ||
path: '/credentials', | ||
name: 'credentials', | ||
component: () => import(/* webpackChunkName: "chunk-stacks" */ '@/pages/credentials/credentials.vue'), | ||
meta: { | ||
authorities: ['ROLE_USER'], | ||
breadcrumb: [{ text: 'Credentials' }], | ||
title: 'Gaia - Credentials', | ||
}, | ||
}, | ||
]; | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
<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) { | ||
console.log(`@/assets/images/providers/${JSON.stringify(credentials)}.png`); | ||
// 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> |
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 @@ | ||
export { default as credentialsRoutes } from '@/pages/credentials/credentials-routes'; |
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
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,9 @@ | ||
import axios from 'axios'; | ||
|
||
export const getCredentialsList = async () => axios.get('/api/credentials'); | ||
|
||
export const getCredentials = async (credentialsId) => axios.get(`/api/credentials/${credentialsId}`); | ||
|
||
export const updateCredentials = async (credentials) => axios.put(`/api/credentials/${credentials.id}`, credentials); | ||
|
||
export const createCredentials = async (credentials) => axios.post('/api/credentials', credentials); |
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
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