Skip to content
This repository has been archived by the owner on Aug 20, 2023. It is now read-only.

Commit

Permalink
enhancements to export params
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueSCar committed Apr 25, 2021
1 parent 0fa696f commit 0f3170b
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 99 deletions.
206 changes: 112 additions & 94 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions src/components/Endpoint.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
</autocomplete>
<autocomplete v-else-if="qp.parameter.name == 'statTypeId'" :items='playStatTypes' displayProp='name' valueProp='id' v-on:selection='qp.value = $event' :placeholder='qp.parameter.description' :is-required='qp.parameter.required'>
</autocomplete>
<player-search v-else-if="qp.parameter.name == 'athleteId' || qp.parameter.name == 'playerId'" :clearOnSelection="false" :show-team="true" @selection="qp.value = $event.id"></player-search>
<b-form-checkbox v-else-if="qp.parameter.type == 'boolean'" v-model="qp.value" />
<b-form-select v-else-if="qp.parameter.name == 'seasonType'" v-model="qp.value"
:options="['regular', 'postseason', 'both']" class="mb-3" />
<b-form-input v-else :placeholder='qp.parameter.description'
Expand Down Expand Up @@ -84,11 +86,13 @@

<script>
import Autocomplete from './Autocomplete.vue';
import PlayerSearch from './PlayerSearch.vue';
export default {
name: 'endpoint',
components: {
Autocomplete
Autocomplete,
PlayerSearch
},
props: {
endpoint: Object,
Expand Down Expand Up @@ -136,7 +140,7 @@
let params = {};
for (let qp of this.queryParams) {
if (qp.value) {
if (qp.value || qp.value === false) {
params[qp.parameter.name] = qp.value;
}
}
Expand Down Expand Up @@ -185,7 +189,7 @@
},
isTeamParameter(inputName) {
return inputName.toLowerCase().indexOf('team') !== -1 || inputName == 'home' || inputName == 'away' ||
inputName == 'offense' || inputName == 'defense';
inputName == 'offense' || inputName == 'defense' || inputName == 'college';
},
isConferenceParameter(inputName) {
return inputName.toLowerCase().indexOf('conference') != -1;
Expand Down Expand Up @@ -399,6 +403,9 @@
if (this.endpoint && this.endpoint.path && this.endpoint.path.get && this.endpoint.path.get.parameters) {
for (let parameter of this.endpoint.path.get.parameters) {
let value = parameter.default ? parameter.default : null;
if (parameter.type == 'boolean' && value === null) {
value = false;
}
if (this.query) {
let queryParam = this.query[parameter.name];
Expand Down
12 changes: 10 additions & 2 deletions src/components/PlayerSearch.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<autocomplete :clear-on-selection='clearOnSelection' :is-async='true' display-prop='name' @input='queryPlayers' @selection='emitSelection' :items='players' />
<autocomplete :clear-on-selection='clearOnSelection' :is-async='true' display-prop='displayName' @input='queryPlayers' @selection='emitSelection' :items='players' />
</template>

<script>
Expand Down Expand Up @@ -30,6 +30,11 @@
type: Number,
required: false,
default: null
},
showTeam: {
type: Boolean,
required: false,
default: false
}
},
data() {
Expand All @@ -48,7 +53,10 @@
searchTerm
}
}).then(result => {
this.players = result.data.slice(0, 10);
this.players = result.data.slice(0, 10).map(p => ({
displayName: this.showTeam ? `${p.name} (${p.team})` : p.name,
...p
}));
});
}
},
Expand Down

0 comments on commit 0f3170b

Please sign in to comment.