-
@@ -19,12 +19,39 @@ export default {
computed: {
...mapGetters({
routeCollection: 'routeCollection',
+ filter: 'filter',
}),
+ filteredCollection() {
+ if (this.filter.routeVerb.length === 0 && this.filter.status.length === 0) {
+ return this.routeCollection;
+ }
+ const filtered = this.routeCollection.filter(
+ (r) => (
+ this.filter.routeVerb.includes(r.routeVerb)
+ || this.filter.routeVerb.length === 0
+ )
+ && (
+ this.getStatusEvaluation(this.filter.status, r.apiResponse)
+ || this.filter.status.length === 0
+ ),
+ );
+ return filtered;
+ },
},
methods: {
addRoute() {
this.$store.dispatch('ADD_ROUTE');
},
+ getStatusEvaluation(statusFilter, res) {
+ const resStatus = res.status ?? undefined;
+ let statusIs = 'NOP';
+ if (resStatus < 400) {
+ statusIs = 'OK';
+ } else if (resStatus > 400) {
+ statusIs = 'KO';
+ }
+ return statusFilter.includes(statusIs);
+ },
},
};
diff --git a/src/components/UserSettings.vue b/src/components/UserSettings.vue
index 59d1d4a27c882487e5e728dab8d6bc632be4d1a6..470b409e47fa23ad59edb45b0268892af90f2cb1 100644
--- a/src/components/UserSettings.vue
+++ b/src/components/UserSettings.vue
@@ -18,6 +18,12 @@
max="100"
step="5"
value="10">
+
+
+ Danger zone
+ In case you're stuck with the app, the RED button
+
+