Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Admin API Frontend #362

Draft
wants to merge 10 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,236 changes: 4,236 additions & 0 deletions src/assets/codon_chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/PageLayout/Navbar/EternaLogo.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<b-navbar-brand to="/">
<img src="@/assets/logo_eterna.svg" class="d-inline-block align-top" alt="etenra" />
<img src="@/assets/logo_eterna.svg" class="d-inline-block align-top" alt="Eterna" />
</b-navbar-brand>
</template>
<script lang="ts">
Expand Down
35 changes: 35 additions & 0 deletions src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,41 @@ export default function createRouter() {
path: '/partner/nova-labs',
component: () => import('./views/nova/NovaTransfer.vue'),
},
{
path: '/admin',
name: 'admin-home',
component: () => import('./views/admin/AdminHome.vue'),
meta: {
hideNav: true
}
},
{
path: '/admin/content',
name: 'admin-content',
component: () => import('./views/admin/AdminContent.vue'),
props: { type: true },
meta: {
hideNav: true
}
},
{
path: '/admin/:type',
name: 'admin-list',
component: () => import('./views/admin/AdminList.vue'),
props: { type: true },
meta: {
hideNav: true
}
},
{
path: '/admin/:type/create',
name: 'admin-create',
component: () => import('./views/admin/AdminCreate.vue'),
props: { type: true },
meta: {
hideNav: true
}
},
// Maintaining these old routes in case they're actively linked from anywhere
// important - at some point we should audit if we can remove these, or we may need a
// dedicated section of legacy routes anyways
Expand Down
162 changes: 162 additions & 0 deletions src/views/admin/AdminContent.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<template>
<div class="adminPage">
<Sidebar></Sidebar>
<main>
<h1>What type of content would you like to update?</h1>
<ul class="content-list">
<li v-for="model in models" :key="model.name">
<router-link :to="'/admin/' + model.id">
<card>
<div>
<h2>{{model.name}}</h2>
<span>{{model.description}}</span>
</div>
<b-icon-arrow-right-circle></b-icon-arrow-right-circle>
</card>
</router-link>
</li>
</ul>
</main>
</div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
// import { BSidebar } from 'bootstrap-vue';
import { BIconArrowRightCircle, BIconChevronRight } from 'bootstrap-vue';
import Sidebar from './components/Sidebar.vue';


@Component({
components: {
Sidebar,
BIconArrowRightCircle,
BIconChevronRight
// PlayerHome,
// LandingPage
},
})
export default class AdminHome extends Vue {
models = [];

mounted() {
// Get the details of what content we can edit
fetch("/admin-api/meta")
.then(res => res.json())
.then(json => {
this.models = json.sort((a:{name:string},b:{name:string}) => a.name > b.name);
})
.catch(err => {console.log(err);});
}

get loggedIn() {
return this.$vxm.user.loggedIn;
}
}
</script>

<style lang="scss" scoped>
@import '@/styles/global.scss';

.adminPage {
// background-color: rgb(248, 249, 249);
display: grid;
height:100%;
width: 100%;
grid-template-columns: 1fr 5fr;
}

main {
// color: #000000;
display: flex;
flex-direction: column;
padding: 32px;
// grid-template-columns: 1fr 1fr;
// grid-template-rows: 1fr 1fr;
// grid-gap: 20px;
// margin: 10%;
}

main h1 {
margin-top: 32px;
text-align: center;
width: 100%;
font-size: 2.4rem;
}

router-link {
width: 100%;

@include media-breakpoint-up(lg) {
width: 30%;
}
}

.content-list {
padding: 0;
margin: 32px 0 0 0;
display: flex;
flex-direction: column;
align-items: center;
}

li {
list-style-type: none;
width: 400px;
margin-bottom: 16px;
}

card {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
background-color: #ecf0f1;;
border-radius: 4px;
padding: 16px;
max-width: 600px;
background-color: #2f71c6 !important;
color: white !important;

&:hover {
background-color: #569bf4 !important;
}

h2 {
font-size: 1.4rem;
}

// span { color: #7b8a8b; }

.bi-arrow-right-circle { color: white; font-size: 1.5rem; }
}

.card {
height:100%;
width: 100%;

.card-body { display: flex; flex-direction: row; }
.card-text { flex-grow: 2; }
}

.footer {
width: 100%;
display: flex;
flex-direction: row;
justify-content: flex-end;
font-size: 1.3rem;
align-self: flex-end;
}


.grafana-dashboard {
width: 100%;
height: 50%;
background-color: #666666;
}

// .card {
// height: 20%;
// width: 50%;
// }
</style>
Loading