Quality of life changes
This commit is contained in:
parent
a0e907ba2d
commit
00b8076806
|
@ -6,10 +6,7 @@
|
||||||
#
|
#
|
||||||
# Distributed under terms of the BSD-3-Clause license.
|
# Distributed under terms of the BSD-3-Clause license.
|
||||||
|
|
||||||
import json
|
from os import environ
|
||||||
|
|
||||||
from os import listdir, environ
|
|
||||||
from os.path import isfile, join
|
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework import authentication # , permissions
|
from rest_framework import authentication # , permissions
|
||||||
|
@ -59,12 +56,6 @@ class Perks(APIView):
|
||||||
'links': [],
|
'links': [],
|
||||||
}
|
}
|
||||||
|
|
||||||
# link ={
|
|
||||||
# 'source': link_source,
|
|
||||||
# 'target': i,
|
|
||||||
# 'value': 1,
|
|
||||||
# }
|
|
||||||
|
|
||||||
tree = Tree.objects.get(id=tree_id)
|
tree = Tree.objects.get(id=tree_id)
|
||||||
perks = list(Perk.objects.filter(trees__name__contains=tree.name))
|
perks = list(Perk.objects.filter(trees__name__contains=tree.name))
|
||||||
all_perks = list(perks)
|
all_perks = list(perks)
|
||||||
|
@ -84,8 +75,11 @@ class Perks(APIView):
|
||||||
})
|
})
|
||||||
|
|
||||||
for perk in all_perks:
|
for perk in all_perks:
|
||||||
serialized_perk = PerkSerializer(perk)
|
serialized_perk = PerkSerializer(perk).data
|
||||||
output_data['nodes'].append(serialized_perk.data)
|
tree_list = perk.trees.all()
|
||||||
|
if tree_list and 'Skill Focus' not in perk.name and 'Ability Focus' not in perk.name and tree not in tree_list:
|
||||||
|
serialized_perk['name'] = f'{serialized_perk["name"]} ({tree_list[0].name})'
|
||||||
|
output_data['nodes'].append(serialized_perk)
|
||||||
|
|
||||||
return Response(output_data)
|
return Response(output_data)
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,11 @@
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
|
|
||||||
<v-toolbar-items>
|
<v-toolbar-items>
|
||||||
|
<v-text-field
|
||||||
|
hide-details
|
||||||
|
prepend-icon="search"
|
||||||
|
single-line
|
||||||
|
></v-text-field>
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
flat
|
||||||
v-for="item in toolbarItems"
|
v-for="item in toolbarItems"
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
>
|
>
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-card-title
|
<v-card-title
|
||||||
class="headline grey darken-2"
|
class="headline grey darken-2"
|
||||||
primary-title
|
primary-title
|
||||||
>{{ perk }}</v-card-title>
|
>{{ perk }}</v-card-title>
|
||||||
<v-card-text>{{ effect }}</v-card-text>
|
<v-card-text>{{ effect }}</v-card-text>
|
||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
|
@ -58,17 +58,17 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
renderGraph(graphData) {
|
renderGraph(graphData) {
|
||||||
for (let i = 0; i < graphData.nodes.length; i++) {
|
|
||||||
graphData.nodes[i].name = `${graphData.nodes[i].name} [${graphData.nodes[i].level}]`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const svg = d3.select('#perktree').append('svg');
|
const svg = d3.select('#perktree').append('svg');
|
||||||
const chart = new Sankey.Path(svg);
|
const chart = new Sankey.Path(svg);
|
||||||
const nodes = graphData.nodes;
|
const nodes = graphData.nodes;
|
||||||
|
|
||||||
chart.nodeWidth(24)
|
chart.nodeWidth(24)
|
||||||
.nodePadding(6)
|
.nodePadding(6)
|
||||||
|
.iterations(32)
|
||||||
.spread(false)
|
.spread(false)
|
||||||
|
.name((n) => {
|
||||||
|
return `${n.name} [${n.level}]`;
|
||||||
|
})
|
||||||
.colorNodes((name, node) => {
|
.colorNodes((name, node) => {
|
||||||
return this.colorScheme[node.type];
|
return this.colorScheme[node.type];
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,9 +2,46 @@
|
||||||
<v-layout>
|
<v-layout>
|
||||||
<v-flex md12 lg6 offset-lg3>
|
<v-flex md12 lg6 offset-lg3>
|
||||||
<v-card class="admin-form-card">
|
<v-card class="admin-form-card">
|
||||||
<upload-button :fileChangedCallback="upload"/>
|
<upload-button
|
||||||
|
:fileChangedCallback="upload"
|
||||||
|
:title="buttonText"
|
||||||
|
>
|
||||||
|
<template
|
||||||
|
v-if="loading"
|
||||||
|
slot="icon-left"
|
||||||
|
>
|
||||||
|
<v-icon left>fas fa-spinner</v-icon>
|
||||||
|
</template>
|
||||||
|
<template
|
||||||
|
v-else
|
||||||
|
slot="icon-left"
|
||||||
|
>
|
||||||
|
<v-icon left>fas fa-upload</v-icon>
|
||||||
|
</template>
|
||||||
|
</upload-button>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-flex>
|
</v-flex>
|
||||||
|
<v-dialog
|
||||||
|
v-model="dialog"
|
||||||
|
width="500"
|
||||||
|
>
|
||||||
|
<v-card>
|
||||||
|
<v-card-title
|
||||||
|
class="headline grey darken-2"
|
||||||
|
error-title
|
||||||
|
>Error while uploading</v-card-title>
|
||||||
|
<v-card-text>{{ error }}</v-card-text>
|
||||||
|
<v-divider></v-divider>
|
||||||
|
<v-card-actions>
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
<v-btn
|
||||||
|
color="primary"
|
||||||
|
flat
|
||||||
|
@click="dialog = false"
|
||||||
|
>Close</v-btn>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-dialog>
|
||||||
</v-layout>
|
</v-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -20,16 +57,27 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
username: '',
|
loading: false,
|
||||||
password: '',
|
error: '',
|
||||||
passwordConfirm: '',
|
dialog: false,
|
||||||
admin: false,
|
|
||||||
messages: [],
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
buttonText() {
|
||||||
|
return this.loading ? 'Loading...' : 'Upload'
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
upload(file) {
|
upload(file) {
|
||||||
PerksController.uploadPerks(file);
|
this.loading = true;
|
||||||
|
PerksController.uploadPerks(file).then(() => {
|
||||||
|
this.loading = false;
|
||||||
|
this.$router.push({ name: 'trees' });
|
||||||
|
}).catch((error) => {
|
||||||
|
this.error = error.response.data;
|
||||||
|
this.dialog = true;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,11 +1,24 @@
|
||||||
h1, h2, h3, h4, h5, h6, p, span
|
*
|
||||||
color #ebdbb2
|
color #ebdbb2
|
||||||
|
|
||||||
.v-toolbar__title
|
.v-toolbar
|
||||||
a
|
.v-toolbar__title
|
||||||
|
a
|
||||||
|
color #ebdbb2
|
||||||
|
text-decoration none
|
||||||
|
|
||||||
|
input
|
||||||
|
color #ebdbb2 !important
|
||||||
|
caret-color #fbf1c7
|
||||||
|
|
||||||
|
.v-btn, .v-icon
|
||||||
color #ebdbb2
|
color #ebdbb2
|
||||||
text-decoration none
|
|
||||||
|
|
||||||
.v-btn
|
.v-input__slot
|
||||||
color #ebdbb2 !important
|
&::before
|
||||||
|
border-color #bdae93 !important
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
&::before
|
||||||
|
border-color #ebdbb2 !important
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
padding-top 3rem
|
padding-top 3rem
|
||||||
|
|
||||||
.v-btn
|
.v-btn
|
||||||
|
color #ebdbb2 !important
|
||||||
height 6rem
|
height 6rem
|
||||||
margin 0.3rem
|
margin 0.3rem
|
||||||
display flex
|
display flex
|
||||||
|
|
Reference in New Issue