Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

Commit

Permalink
Merge branch 'unified'
Browse files Browse the repository at this point in the history
  • Loading branch information
David Garcia committed Feb 7, 2020
2 parents 2947e91 + 7828204 commit 0367a42
Show file tree
Hide file tree
Showing 87 changed files with 644 additions and 1,416 deletions.
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "0.2.1",
"version": "0.3.1",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ export default {
},
computed: {
...mapGetters({ auth_status: "auth_status" })
},
beforeMount: function() {
if (this.$store.getters["is_authenticated"]) {
this.$router.push("/");
}
}
};
</script>
21 changes: 10 additions & 11 deletions frontend/src/components/MultipleResourceInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,13 @@ export default {
preprocess_resources() {
if (!this.resource_list_model) return;
let values = this.resource_list_model.trim().split("\n");
let values = this.resource_list_model
.trim()
.split("\n")
.filter(elem => elem.length > 0);
values = [...new Set(values)];
let classified_resources = [];
values.forEach(element => {
Expand Down Expand Up @@ -210,14 +216,10 @@ export default {
send() {
this.preprocess_resources.forEach(new_resource => {
let payload = {
to_server: {
url: "/api/create_resource",
resource_name: new_resource.resource,
resource_type: new_resource.type
},
mutation: "add_resource"
resource_name: new_resource.resource,
resource_type: new_resource.type
};
this.$store.dispatch("resource_action", payload);
this.$store.dispatch("add_new_resource", payload);
});
},
patch_type(resource, type) {
Expand All @@ -240,12 +242,9 @@ export default {
max-height: 500px;
overflow-y: auto;
overflow-x: hidden;
}
.v-btn--bottom:not(.v-btn--absolute) {
bottom: 50px;
}
</style>
82 changes: 0 additions & 82 deletions frontend/src/components/ResourceInput.vue

This file was deleted.

62 changes: 13 additions & 49 deletions frontend/src/components/ResourceListing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,7 @@
<v-flex>
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
icon
flat
color="grey"
v-on="on"
@click.stop="copy_resource_list"
>
<v-btn icon flat color="grey" v-on="on" @click.stop="copy_resource_list">
<v-icon>mdi-content-copy</v-icon>
</v-btn>
</template>
Expand All @@ -116,12 +110,12 @@
:class="{ selected: selected_resource._id === item._id }"
>
<v-list-tile-content>
<v-list-tile-title
v-text="item.canonical_name"
></v-list-tile-title>
<v-list-tile-sub-title v-if="headers.length > 1">{{
<v-list-tile-title v-text="item.canonical_name"></v-list-tile-title>
<v-list-tile-sub-title v-if="headers.length > 1">
{{
item[headers[1].value]
}}</v-list-tile-sub-title>
}}
</v-list-tile-sub-title>
</v-list-tile-content>
</v-list-tile>
</v-list>
Expand All @@ -144,7 +138,7 @@
<v-layout justify-center align-center row wrap>
<v-flex pt-5>
<v-spacer>
<div class="headline white--text">No resources yet.</div>
<div class="headline white--text">No resources yet</div>
</v-spacer>
</v-flex>
</v-layout>
Expand All @@ -154,7 +148,6 @@
v-if="a_resource_is_selected"
:resource="selected_resource"
:grid_space="grid_space"
:resource_list="resourceDescription.resource_list"
:key="component_key"
></resource-detail>
<v-flex v-if="!a_resource_is_selected && resource_list.length > 0">
Expand Down Expand Up @@ -189,7 +182,7 @@ export default {
return 0;
}
},
resourceDescription: Object,
resourceType: String,
headers: Array,
grid_space: Number
},
Expand All @@ -205,10 +198,7 @@ export default {
},
computed: {
resource_list: function() {
let resources = this.$store.getters.get_resources(
this.resourceDescription.resource_list
);
let resources = this.$store.getters.get_resources(this.resourceType);
this.resource_count = resources.length;
resources = resources.sort(this.sortcriteria);
Expand Down Expand Up @@ -236,22 +226,6 @@ export default {
}
},
methods: {
get_resource_list: function() {
let payload = {
to_server: {
url: "/api/get_resources",
type: this.resourceDescription.type,
fields: this.resourceDescription.fields
},
mutation: "set_resource_list",
mutation_args: {
list_name: this.resourceDescription.resource_list,
list_values: []
}
};
this.$store.dispatch("resource_action", payload);
},
copy_resource_to_json: async function() {
await navigator.clipboard.writeText(
JSON.stringify(this.selected_resource, null, 2)
Expand Down Expand Up @@ -290,16 +264,10 @@ export default {
remove_resource_with_confirmation: function() {
this.remove_resource = false;
let payload = {
to_server: {
url: "/api/unlink_resource",
resource_id: this.selected_resource._id
},
mutation: "remove_resource",
mutation_args: {
list_name: this.resourceDescription.resource_list
}
resource_id: this.selected_resource._id
};
this.$store.dispatch("resource_action", payload);
this.$store.dispatch("remove_resource", payload);
this.selected_resource = {};
},
Expand All @@ -309,8 +277,7 @@ export default {
tag_shake: function() {
let payload = {
resource_id: this.selected_resource._id,
resource_type: this.selected_resource.resource_type
resource_id: this.selected_resource._id
};
this.$store.dispatch("update_resource", payload);
},
Expand All @@ -320,9 +287,6 @@ export default {
rerender_component: function() {
this.component_key += 1;
}
},
mounted() {
this.get_resource_list();
}
};
</script>
Expand Down
Loading

0 comments on commit 0367a42

Please sign in to comment.