Commit 31e966bd authored by Illya Klymov's avatar Illya Klymov

Merge branch '324713-schedule-description' into 'master'

Resolve "timezones don't encode special characters properly"

See merge request gitlab-org/gitlab!56792
parents be6c2db0 0e2c5803
<script> <script>
import { import {
GlIcon,
GlForm, GlForm,
GlFormGroup, GlFormGroup,
GlFormInput, GlFormInput,
GlDropdown, GlDropdown,
GlDropdownItem, GlDropdownItem,
GlSearchBoxByType, GlSearchBoxByType,
GlSafeHtmlDirective as SafeHtml,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { isEqual, isEmpty } from 'lodash'; import { isEqual, isEmpty } from 'lodash';
import { s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
...@@ -39,6 +41,7 @@ export const i18n = { ...@@ -39,6 +41,7 @@ export const i18n = {
export default { export default {
i18n, i18n,
components: { components: {
GlIcon,
GlForm, GlForm,
GlFormGroup, GlFormGroup,
GlFormInput, GlFormInput,
...@@ -46,6 +49,9 @@ export default { ...@@ -46,6 +49,9 @@ export default {
GlDropdownItem, GlDropdownItem,
GlSearchBoxByType, GlSearchBoxByType,
}, },
directives: {
SafeHtml,
},
inject: ['projectPath', 'timezones'], inject: ['projectPath', 'timezones'],
props: { props: {
form: { form: {
...@@ -138,12 +144,15 @@ export default { ...@@ -138,12 +144,15 @@ export default {
> >
<gl-dropdown <gl-dropdown
id="schedule-timezone" id="schedule-timezone"
:text="selectedTimezone"
class="timezone-dropdown gl-w-full" class="timezone-dropdown gl-w-full"
:header-text="$options.i18n.selectTimezone" :header-text="$options.i18n.selectTimezone"
:class="{ 'invalid-dropdown': !validationState.timezone }" :class="{ 'invalid-dropdown': !validationState.timezone }"
@hide="$emit('update-schedule-form', { type: 'timezone', value: selectedDropdownTimezone })" @hide="$emit('update-schedule-form', { type: 'timezone', value: selectedDropdownTimezone })"
> >
<template #button-content>
<span v-safe-html="selectedTimezone" class="gl-new-dropdown-button-text"></span>
<gl-icon class="dropdown-chevron" name="chevron-down" />
</template>
<gl-search-box-by-type v-model.trim="tzSearchTerm" /> <gl-search-box-by-type v-model.trim="tzSearchTerm" />
<gl-dropdown-item <gl-dropdown-item
v-for="tz in filteredTimezones" v-for="tz in filteredTimezones"
...@@ -152,7 +161,7 @@ export default { ...@@ -152,7 +161,7 @@ export default {
is-check-item is-check-item
@click="setTimezone(tz)" @click="setTimezone(tz)"
> >
<span class="gl-white-space-nowrap"> {{ getFormattedTimezone(tz) }}</span> <span v-safe-html="getFormattedTimezone(tz)" class="gl-white-space-nowrap"> </span>
</gl-dropdown-item> </gl-dropdown-item>
<gl-dropdown-item v-if="noResults"> <gl-dropdown-item v-if="noResults">
{{ $options.i18n.noResults }} {{ $options.i18n.noResults }}
......
---
title: Allow oncall schedule timezones to encode special characters correctly
merge_request: 56792
author:
type: fixed
...@@ -45,9 +45,10 @@ exports[`AddEditScheduleForm renders modal layout 1`] = ` ...@@ -45,9 +45,10 @@ exports[`AddEditScheduleForm renders modal layout 1`] = `
hideheaderborder="true" hideheaderborder="true"
id="schedule-timezone" id="schedule-timezone"
size="medium" size="medium"
text="(UTC -12:00) -12 International Date Line West" text=""
variant="default" variant="default"
> >
<gl-search-box-by-type-stub <gl-search-box-by-type-stub
clearbuttontitle="Clear" clearbuttontitle="Clear"
value="" value=""
...@@ -111,7 +112,7 @@ exports[`AddEditScheduleForm renders modal layout 1`] = ` ...@@ -111,7 +112,7 @@ exports[`AddEditScheduleForm renders modal layout 1`] = `
<span <span
class="gl-white-space-nowrap" class="gl-white-space-nowrap"
> >
(UTC -10:00) HST Hawaii (UTC -7:00) PT Pacific Time (US & Canada)
</span> </span>
</gl-dropdown-item-stub> </gl-dropdown-item-stub>
......
...@@ -84,7 +84,7 @@ describe('AddEditScheduleForm', () => { ...@@ -84,7 +84,7 @@ describe('AddEditScheduleForm', () => {
describe('timezones filtering', () => { describe('timezones filtering', () => {
it('should filter options based on search term', async () => { it('should filter options based on search term', async () => {
const searchTerm = 'Hawaii'; const searchTerm = 'Pacific';
findTimezoneSearchBox().vm.$emit('input', searchTerm); findTimezoneSearchBox().vm.$emit('input', searchTerm);
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
const options = findDropdownOptions(); const options = findDropdownOptions();
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
"formatted_offset": "-11:00" "formatted_offset": "-11:00"
}, },
{ {
"identifier": "Pacific/Honolulu", "identifier": "Pacific/US/Canada",
"name": "Hawaii", "name": "Pacific Time (US & Canada)",
"abbr": "HST", "abbr": "PT",
"formatted_offset": "-10:00" "formatted_offset": "-7:00"
} }
] ]
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