Finished with Apollo testing lol, this branch should have been closed long ago. #2
24
17th Website/src/api/request.js
Normal file
24
17th Website/src/api/request.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
async function QueryApolloGraphQL (setName, query) {
|
||||||
|
return await fetch(
|
||||||
|
'https://unit-tracker-api.iceberg-gaming.com/',
|
||||||
|
{
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
cache: 'no-cache',
|
||||||
|
body: JSON.stringify({
|
||||||
|
"query": query
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(response => {
|
||||||
|
return response.data[setName].items;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
return console.error('Error:', error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default QueryApolloGraphQL
|
||||||
@@ -12,7 +12,13 @@ export default {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div id="ProfileWrapper">
|
<div id="ProfileWrapper">
|
||||||
|
<div>
|
||||||
<profileHeader></profileHeader>
|
<profileHeader></profileHeader>
|
||||||
|
<div id="profileSubnavWrapper">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
test words
|
test words
|
||||||
<div id="profileContentWrapper">
|
<div id="profileContentWrapper">
|
||||||
<RouterView />
|
<RouterView />
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
// import {subnav} from './profileSubNav.vue'
|
import profileSubNav from './profileSubNav.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'profileHeader',
|
name: 'profileHeader',
|
||||||
@@ -8,14 +8,19 @@ export default {
|
|||||||
count: 0
|
count: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// components: {
|
components: {
|
||||||
// subnav,
|
profileSubNav,
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
|
<div>
|
||||||
|
<profileSubNav link="profile" content="Home"></profileSubNav>
|
||||||
|
<profileSubNav link="activityHistory" content="History"></profileSubNav>
|
||||||
|
<profileSubNav link="shadowbox" content="Shadowbox"></profileSubNav>
|
||||||
|
</div>
|
||||||
<div id="headerImages">
|
<div id="headerImages">
|
||||||
<img id="rankImg" src="../icons/misc/test.png" />
|
<img id="rankImg" src="../icons/misc/test.png" />
|
||||||
<img id="rangerTab" src="#" />
|
<img id="rangerTab" src="#" />
|
||||||
@@ -25,6 +30,7 @@ export default {
|
|||||||
<h2>Rank</h2>
|
<h2>Rank</h2>
|
||||||
<h2>Unit</h2>
|
<h2>Unit</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -62,5 +68,4 @@ export default {
|
|||||||
margin-left: 25vw;
|
margin-left: 25vw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@@ -1,19 +1,18 @@
|
|||||||
<script>
|
<script>
|
||||||
import { stringLiteral } from '@babel/types';
|
|
||||||
import { RouterLink } from 'vue-router'
|
import { RouterLink } from 'vue-router'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'subnav',
|
props: ['link', 'content', 'active'],
|
||||||
props: {
|
components: {
|
||||||
link: String,
|
RouterLink
|
||||||
content: String,
|
|
||||||
active: Boolean
|
|
||||||
},
|
},
|
||||||
|
setup(props) {
|
||||||
|
console.log(props.link);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<RouterLink :to="link">
|
<RouterLink :to="link">
|
||||||
<p :class="{active: active}">{{ content }}</p>
|
<p class="ring-1 ring-blue rounded-md my-3 p-2 " :class="{ active: active }">{{ content }}</p>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
<script setup>
|
|
||||||
import { Icon } from '@iconify/vue'
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export const Alert = {
|
import { Icon } from '@iconify/vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
name: 'Alert',
|
name: 'Alert',
|
||||||
props: {
|
props: {
|
||||||
icon: String,
|
icon: String,
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
<h1 class="bg-gray-dark rounded-xl w-fit p-5">HELLO</h1>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.card {
|
.card {
|
||||||
background-color: #ffffff;
|
|
||||||
color: var(--white);
|
color: var(--white);
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
|
|||||||
@@ -11,18 +11,23 @@ export default createRouter({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/profile',
|
path: '/profile',
|
||||||
name: 'Profile',
|
name: 'profile',
|
||||||
component: () => import('./components/ProfilePage/profile.vue'),
|
component: () => import('./components/ProfilePage/profile.vue'),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '/',
|
||||||
name: 'personnel',
|
name: 'personnel',
|
||||||
component: () => import('./components/ProfilePage/personnel.vue')
|
component: () => import('./components/ProfilePage/personnel.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'activityHistory',
|
path: '/activityHistory',
|
||||||
name: 'activityHistory',
|
name: 'activityHistory',
|
||||||
component: () => import('./components/ProfilePage/activityHistory.vue')
|
component: () => import('./components/ProfilePage/activityHistory.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/shadowbox',
|
||||||
|
name: 'shadowbox',
|
||||||
|
component: () => import('./components/ProfilePage/shadowbox.vue')
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
|
<script setup>
|
||||||
|
import card from '../components/cards/Card.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<h1>Here is a child component!</h1>
|
||||||
<h1>Home screen</h1>
|
<card></card>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
@@ -2,24 +2,24 @@
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { Listbox, ListboxButton, ListboxOptions, ListboxOption } from '@headlessui/vue'
|
import { Listbox, ListboxButton, ListboxOptions, ListboxOption } from '@headlessui/vue'
|
||||||
import { Icon } from '@iconify/vue'
|
import { Icon } from '@iconify/vue'
|
||||||
|
import QueryApolloGraphQL from '../api/request'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
parentMessage: 'Parent',
|
items: [],
|
||||||
items: [{ message: 'Foo' }, { message: 'Bar' }],
|
|
||||||
dropped: false,
|
dropped: false,
|
||||||
search: '',
|
search: '',
|
||||||
|
|
||||||
unitFilters: [
|
unitFilters: [
|
||||||
{ id: 1, name: 'All Groups', disabled: false },
|
{ id: 1, name: 'All Groups', filter: 'none', disabled: false },
|
||||||
{ id: 2, name: 'Alpha', disabled: false },
|
{ id: 2, name: 'Alpha', filter: 'Alpha Company', disabled: false },
|
||||||
{ id: 3, name: 'Echo', disabled: false },
|
{ id: 3, name: 'Echo', filter: 'Echo Company', disabled: false },
|
||||||
{ id: 4, name: 'HHC', disabled: false },
|
{ id: 4, name: 'HHC', filter: 'HHC', disabled: false },
|
||||||
{ id: 5, name: 'Recruit', disabled: false },
|
{ id: 5, name: 'Recruit', filter: 'Recruit', disabled: false },
|
||||||
],
|
],
|
||||||
|
|
||||||
unitFilter: { id: 1, name: 'All Groups', disabled: false },
|
unitFilter: { id: 1, name: 'All Groups', filter: 'none', disabled: false },
|
||||||
|
|
||||||
roleFilters: [
|
roleFilters: [
|
||||||
{ id: 1, name: 'All Roles', disabled: false },
|
{ id: 1, name: 'All Roles', disabled: false },
|
||||||
@@ -40,6 +40,21 @@ export default {
|
|||||||
this.search = ''
|
this.search = ''
|
||||||
this.unitFilter = this.unitFilters[0];
|
this.unitFilter = this.unitFilters[0];
|
||||||
this.roleFilter = this.roleFilters[0];
|
this.roleFilter = this.roleFilters[0];
|
||||||
|
},
|
||||||
|
filterByName(item) {
|
||||||
|
if (this.search != '')
|
||||||
|
return item.member_name.toLowerCase().includes(this.search.toLowerCase());
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
filterByUnit(item) {
|
||||||
|
if (this.unitFilter.filter != 'none')
|
||||||
|
return item.status == this.unitFilter.filter;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
filterByRole(item) { //THIS IS NOT IMPLEMENTED YET
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@@ -49,9 +64,19 @@ export default {
|
|||||||
ListboxOptions,
|
ListboxOptions,
|
||||||
Icon,
|
Icon,
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
QueryApolloGraphQL("getPageViewMemberRankStatusAll", "query Query {getPageViewMemberRankStatusAll {items {member_name,rank,status}}}").then(value => { this.items = value }) //console.log(value); for debug reasons
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
filteredTable() {
|
||||||
|
var newTable = this.items;
|
||||||
|
newTable = newTable.filter(this.filterByUnit);
|
||||||
|
newTable = newTable.filter(this.filterByName);
|
||||||
|
return newTable;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// const unitFilter = ref(unitFilters[1])
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -60,7 +85,7 @@ export default {
|
|||||||
|
|
||||||
<h1>Members</h1>
|
<h1>Members</h1>
|
||||||
<div id="searchRow">
|
<div id="searchRow">
|
||||||
<input type="text" v-model="search" placeholder="Search..." />
|
<input type="text" v-model="search" placeholder="Search..." v-on:input="console.log('hello')" />
|
||||||
<div id="dropdownWrapper">
|
<div id="dropdownWrapper">
|
||||||
|
|
||||||
<Listbox v-model="unitFilter" class="w-32 mx-2">
|
<Listbox v-model="unitFilter" class="w-32 mx-2">
|
||||||
@@ -128,10 +153,10 @@ export default {
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="tableBody">
|
<tbody id="tableBody">
|
||||||
<tr v-for="(item, index) in items">
|
<tr v-for="(item, index) in filteredTable">
|
||||||
<td>{{ parentMessage }}</td>
|
<td>{{ item.member_name }}</td>
|
||||||
<td>{{ index }}</td>
|
<td>{{ item.status }}</td>
|
||||||
<td>{{ item.message }}</td>
|
<td>{{ item.rank }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user