Skip to content

Create a shared color picker component

What does this MR do?

In anticipation of a new form being created to handle the creating and updating of compliance framework labels, it became apparent that we were going to need to create a color picker component. This component is basically identical to the existing label form but in Vue and using GitLab UI components.

It was decided that first we would make a shared component within GitLab and solve any potential integration bugs during the compliance framework labels form development. Once that is ironed out, there are issues to make it a GitLab UI component instead and also update the label form to use the same component.

This component is not currently being used anywhere. Its first usage will be in #287827 (closed).

Screenshots

mode mobile desktop invalid valid
light image image image image
dark image image image image

Video

Screen_Recording_2020-12-04_at_12.42.42

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

To test this feature locally, you will need to manually add it to an existing Vue app that you have access too. For instance, to add it to the compliance dashboard, you can use the following patch:

Index: ee/app/assets/javascripts/compliance_dashboard/components/dashboard.vue
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ee/app/assets/javascripts/compliance_dashboard/components/dashboard.vue b/ee/app/assets/javascripts/compliance_dashboard/components/dashboard.vue
--- a/ee/app/assets/javascripts/compliance_dashboard/components/dashboard.vue	(revision 683450cb492dc801ae512172a63459785c4a922f)
+++ b/ee/app/assets/javascripts/compliance_dashboard/components/dashboard.vue	(date 1606823632842)
@@ -6,6 +6,7 @@
 import EmptyState from './empty_state.vue';
 import MergeCommitsExportButton from './merge_requests/merge_commits_export_button.vue';
 import { COMPLIANCE_TAB_COOKIE_KEY } from '../constants';
+import ColorPicker from '~/vue_shared/components/color_picker/color_picker.vue';
 
 export default {
   name: 'ComplianceDashboard',
@@ -15,6 +16,7 @@
     GlTab,
     GlTabs,
     MergeCommitsExportButton,
+    ColorPicker,
   },
   props: {
     emptyStateSvgPath: {
@@ -68,6 +70,7 @@
         />
       </div>
       <p>{{ $options.strings.subheading }}</p>
+      <color-picker :label="__('Background color')" set-color="#FF0000" />
     </header>
 
     <gl-tabs v-if="showTabs()">

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] 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

Related to #287826 (closed)

Edited by Robert Hunt

Merge request reports

Loading