|
| 1 | +<script> |
| 2 | +// Copyright (c) 2021 Uber Technologies Inc. |
| 3 | +// |
| 4 | +// |
| 5 | +// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 | +// of this software and associated documentation files (the "Software"), to deal |
| 7 | +// in the Software without restriction, including without limitation the rights |
| 8 | +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 9 | +// copies of the Software, and to permit persons to whom the Software is |
| 10 | +// furnished to do so, subject to the following conditions: |
| 11 | +// |
| 12 | +// The above copyright notice and this permission notice shall be included in |
| 13 | +// all copies or substantial portions of the Software. |
| 14 | +// |
| 15 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 21 | +// THE SOFTWARE. |
| 22 | +
|
| 23 | +import { FeatureFlag, SelectInput } from '~components'; |
| 24 | +
|
| 25 | +export default { |
| 26 | + name: 'active-status', |
| 27 | + props: { |
| 28 | + classname: { |
| 29 | + type: String, |
| 30 | + }, |
| 31 | + crossRegion: { |
| 32 | + type: Boolean, |
| 33 | + }, |
| 34 | + cluster: { |
| 35 | + type: Object, |
| 36 | + }, |
| 37 | + isReady: { |
| 38 | + type: Boolean, |
| 39 | + }, |
| 40 | + label: { |
| 41 | + type: String, |
| 42 | + }, |
| 43 | + selectList: { |
| 44 | + type: Array, |
| 45 | + }, |
| 46 | + tag: { |
| 47 | + type: String, |
| 48 | + }, |
| 49 | + }, |
| 50 | + components: { |
| 51 | + 'feature-flag': FeatureFlag, |
| 52 | + 'select-input': SelectInput, |
| 53 | + }, |
| 54 | + methods: { |
| 55 | + onClusterChange(cluster) { |
| 56 | + this.$emit('change', cluster); |
| 57 | + }, |
| 58 | + }, |
| 59 | +}; |
| 60 | +</script> |
| 61 | + |
| 62 | +<template> |
| 63 | + <feature-flag name="crossRegion.activeStatusTag" v-if="crossRegion"> |
| 64 | + <component |
| 65 | + class="active-status" |
| 66 | + :class="{ |
| 67 | + [classname]: classname, |
| 68 | + }" |
| 69 | + :is="tag" |
| 70 | + name="activeStatus" |
| 71 | + :options="selectList" |
| 72 | + :value="cluster" |
| 73 | + v-if="isReady && cluster" |
| 74 | + @change="onClusterChange" |
| 75 | + > |
| 76 | + {{ label }} |
| 77 | + </component> |
| 78 | + </feature-flag> |
| 79 | +</template> |
| 80 | + |
| 81 | +<style lang="stylus"> |
| 82 | +@require "../../styles/definitions" |
| 83 | +
|
| 84 | +.active-status { |
| 85 | + color: white !important; |
| 86 | + padding: 5px 10px; |
| 87 | + text-transform: uppercase; |
| 88 | +
|
| 89 | + &.active { |
| 90 | + background-color: uber-green; |
| 91 | + } |
| 92 | +
|
| 93 | + &.passive { |
| 94 | + background-color: uber-blue; |
| 95 | + } |
| 96 | +
|
| 97 | + &.select-input { |
| 98 | + padding: 0; |
| 99 | +
|
| 100 | + .v-select { |
| 101 | + .vs__dropdown-toggle { |
| 102 | + border: none; |
| 103 | + padding: 0; |
| 104 | + } |
| 105 | +
|
| 106 | + span.vs__selected { |
| 107 | + color: white; |
| 108 | + margin: 0; |
| 109 | + padding: 0; |
| 110 | + } |
| 111 | + } |
| 112 | +
|
| 113 | + .vs__actions { |
| 114 | + height: 24px; |
| 115 | + padding-top: 3px; |
| 116 | + } |
| 117 | +
|
| 118 | + .vs__dropdown-option { |
| 119 | + padding: 0 10px; |
| 120 | + } |
| 121 | +
|
| 122 | + .vs__open-indicator { |
| 123 | + fill: white; |
| 124 | + height: 10px; |
| 125 | + } |
| 126 | +
|
| 127 | + .vs__selected-options { |
| 128 | + padding: 0 4px 0 8px; |
| 129 | + } |
| 130 | + } |
| 131 | +} |
| 132 | +</style> |
0 commit comments