Skip to content

Refactor base token to make it reusable

Miguel Rincon requested to merge mrincon-base_token-props-refactor into master

What does this MR do?

Refactor the base_token.vue so it can be used directly as a token in the filtered search. In the next iteration, more customization will be enabled with it.

(Depends on !63745 (merged))

Screenshots (strongly suggested)

I did a small test with the filtered search I am working on to good effect:

Code
diff --git a/app/assets/javascripts/runner/components/runner_filtered_search_bar.vue b/app/assets/javascripts/runner/components/runner_filtered_search_bar.vue
index bec33ce2f44..d297aa06520 100644
--- a/app/assets/javascripts/runner/components/runner_filtered_search_bar.vue
+++ b/app/assets/javascripts/runner/components/runner_filtered_search_bar.vue
@@ -4,6 +4,7 @@ import { cloneDeep } from 'lodash';
 import { __, s__ } from '~/locale';
 import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
 import FilteredSearch from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue';
+import BaseToken from '~/vue_shared/components/filtered_search_bar/tokens/base_token.vue';
 import {
   STATUS_ACTIVE,
   STATUS_PAUSED,
@@ -26,7 +27,7 @@ const searchTokens = [
     icon: 'status',
     title: __('Status'),
     type: PARAM_KEY_STATUS,
-    token: GlFilteredSearchToken,
+    token: BaseToken,
     // TODO Get more than one value when GraphQL API supports OR for "status"
     unique: true,
     options: [
@@ -48,7 +49,7 @@ const searchTokens = [
     icon: 'file-tree',
     title: __('Type'),
     type: PARAM_KEY_RUNNER_TYPE,
-    token: GlFilteredSearchToken,
+    token: BaseToken,
     // TODO Get more than one value when GraphQL API supports OR for "status"
     unique: true,
     options: [

2021-06-07_16.53.11

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Miguel Rincon

Merge request reports

Loading