Commit 8570e64d authored by pburdette's avatar pburdette

Tie url params to filter bar

Take the url params and set
the value of those to the filter
bar and it's tokens.
parent 120ecb65
...@@ -226,8 +226,18 @@ export default { ...@@ -226,8 +226,18 @@ export default {
}, },
}, },
created() { created() {
const { username, ref } = this.params;
this.service = new PipelinesService(this.endpoint); this.service = new PipelinesService(this.endpoint);
this.requestData = { page: this.page, scope: this.scope }; this.requestData = { page: this.page, scope: this.scope };
if (username) {
this.requestData.username = username;
}
if (ref) {
this.requestData.ref = ref;
}
}, },
methods: { methods: {
successCallback(resp) { successCallback(resp) {
...@@ -310,6 +320,7 @@ export default { ...@@ -310,6 +320,7 @@ export default {
v-if="canFilterPipelines" v-if="canFilterPipelines"
:pipelines="state.pipelines" :pipelines="state.pipelines"
:project-id="projectId" :project-id="projectId"
:params="params"
@filterPipelines="filterPipelines" @filterPipelines="filterPipelines"
/> />
......
...@@ -20,6 +20,10 @@ export default { ...@@ -20,6 +20,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
params: {
type: Object,
required: true,
},
}, },
data() { data() {
return { return {
...@@ -52,6 +56,32 @@ export default { ...@@ -52,6 +56,32 @@ export default {
}, },
]; ];
}, },
paramsValue() {
const valueArray = [];
const { username, ref } = this.params;
if (username) {
valueArray.push({
type: 'username',
value: {
data: username,
operator: '=',
},
});
}
if (ref) {
valueArray.push({
type: 'ref',
value: {
data: ref,
operator: '=',
},
});
}
return valueArray;
},
}, },
created() { created() {
Api.projectUsers(this.projectId) Api.projectUsers(this.projectId)
...@@ -85,6 +115,7 @@ export default { ...@@ -85,6 +115,7 @@ export default {
<gl-filtered-search <gl-filtered-search
:placeholder="__('Filter pipelines')" :placeholder="__('Filter pipelines')"
:available-tokens="tokens" :available-tokens="tokens"
:value="paramsValue"
@submit="onSubmit" @submit="onSubmit"
/> />
</div> </div>
......
...@@ -55,7 +55,7 @@ export default { ...@@ -55,7 +55,7 @@ export default {
@input="searchBranches" @input="searchBranches"
> >
<template #suggestions> <template #suggestions>
<gl-loading-icon v-if="loading" /> <gl-loading-icon v-if="loading && !value" />
<template v-else> <template v-else>
<gl-filtered-search-suggestion <gl-filtered-search-suggestion
v-for="(branch, index) in branches" v-for="(branch, index) in branches"
......
...@@ -45,7 +45,7 @@ export default { ...@@ -45,7 +45,7 @@ export default {
return this.value.data.toLowerCase(); return this.value.data.toLowerCase();
}, },
activeUser() { activeUser() {
return this.users.find(user => { return this.config.triggerAuthors.find(user => {
return user.username.toLowerCase() === this.currentValue; return user.username.toLowerCase() === this.currentValue;
}); });
}, },
...@@ -72,6 +72,7 @@ export default { ...@@ -72,6 +72,7 @@ export default {
<template> <template>
<gl-filtered-search-token <gl-filtered-search-token
v-if="config.triggerAuthors"
:config="config" :config="config"
v-bind="{ ...$props, ...$attrs }" v-bind="{ ...$props, ...$attrs }"
v-on="$listeners" v-on="$listeners"
...@@ -93,7 +94,7 @@ export default { ...@@ -93,7 +94,7 @@ export default {
}}</gl-filtered-search-suggestion> }}</gl-filtered-search-suggestion>
<gl-dropdown-divider /> <gl-dropdown-divider />
<gl-loading-icon v-if="loading" /> <gl-loading-icon v-if="loading && !value" />
<template v-else> <template v-else>
<gl-filtered-search-suggestion <gl-filtered-search-suggestion
v-for="user in users" v-for="user in users"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment