Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1eb11771
Commit
1eb11771
authored
Mar 23, 2021
by
Coung Ngo
Committed by
Jacques Erasmus
Mar 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add labels to UI toggles
Add labels to GlToggles with missing labels for accessibility
parent
dbcd4ec7
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
136 additions
and
20 deletions
+136
-20
app/assets/javascripts/behaviors/shortcuts/shortcuts_toggle.vue
...sets/javascripts/behaviors/shortcuts/shortcuts_toggle.vue
+5
-1
app/assets/javascripts/feature_flags/components/form.vue
app/assets/javascripts/feature_flags/components/form.vue
+9
-2
app/assets/javascripts/packages_and_registries/settings/group/components/maven_settings.vue
...d_registries/settings/group/components/maven_settings.vue
+4
-0
app/assets/javascripts/packages_and_registries/settings/group/constants.js
...ripts/packages_and_registries/settings/group/constants.js
+1
-0
app/assets/javascripts/pages/projects/shared/permissions/components/project_feature_setting.vue
...shared/permissions/components/project_feature_setting.vue
+7
-0
app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue
...projects/shared/permissions/components/settings_panel.vue
+50
-15
changelogs/unreleased/cngo-add-gl-toggle-labels.yml
changelogs/unreleased/cngo-add-gl-toggle-labels.yml
+5
-0
ee/app/assets/javascripts/vulnerabilities/components/related_jira_issues.vue
...cripts/vulnerabilities/components/related_jira_issues.vue
+1
-1
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/frontend/feature_flags/components/form_spec.js
spec/frontend/feature_flags/components/form_spec.js
+4
-0
spec/frontend/packages_and_registries/settings/group/components/maven_settings_spec.js
...gistries/settings/group/components/maven_settings_spec.js
+4
-1
spec/frontend/pages/projects/shared/permissions/components/settings_panel_spec.js
...ects/shared/permissions/components/settings_panel_spec.js
+43
-0
No files found.
app/assets/javascripts/behaviors/shortcuts/shortcuts_toggle.vue
View file @
1eb11771
<
script
>
<
script
>
import
{
GlToggle
}
from
'
@gitlab/ui
'
;
import
{
GlToggle
}
from
'
@gitlab/ui
'
;
import
AccessorUtilities
from
'
~/lib/utils/accessor
'
;
import
AccessorUtilities
from
'
~/lib/utils/accessor
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
disableShortcuts
,
enableShortcuts
,
shouldDisableShortcuts
}
from
'
./shortcuts_toggle
'
;
import
{
disableShortcuts
,
enableShortcuts
,
shouldDisableShortcuts
}
from
'
./shortcuts_toggle
'
;
export
default
{
export
default
{
i18n
:
{
toggleLabel
:
__
(
'
Keyboard shortcuts
'
),
},
components
:
{
components
:
{
GlToggle
,
GlToggle
,
},
},
...
@@ -31,7 +35,7 @@ export default {
...
@@ -31,7 +35,7 @@ export default {
<gl-toggle
<gl-toggle
v-model=
"shortcutsEnabled"
v-model=
"shortcutsEnabled"
aria-describedby=
"shortcutsToggle"
aria-describedby=
"shortcutsToggle"
label=
"Keyboard shortcuts
"
:label=
"$options.i18n.toggleLabel
"
label-position=
"left"
label-position=
"left"
@
change=
"onChange"
@
change=
"onChange"
/>
/>
...
...
app/assets/javascripts/feature_flags/components/form.vue
View file @
1eb11771
...
@@ -29,6 +29,9 @@ import EnvironmentsDropdown from './environments_dropdown.vue';
...
@@ -29,6 +29,9 @@ import EnvironmentsDropdown from './environments_dropdown.vue';
import
Strategy
from
'
./strategy.vue
'
;
import
Strategy
from
'
./strategy.vue
'
;
export
default
{
export
default
{
i18n
:
{
statusLabel
:
s__
(
'
FeatureFlags|Status
'
),
},
components
:
{
components
:
{
GlButton
,
GlButton
,
GlBadge
,
GlBadge
,
...
@@ -396,12 +399,14 @@ export default {
...
@@ -396,12 +399,14 @@ export default {
<div
class=
"table-section section-20 text-center"
role=
"gridcell"
>
<div
class=
"table-section section-20 text-center"
role=
"gridcell"
>
<div
class=
"table-mobile-header"
role=
"rowheader"
>
<div
class=
"table-mobile-header"
role=
"rowheader"
>
{{
s__('FeatureFlags|Status')
}}
{{
$options.i18n.statusLabel
}}
</div>
</div>
<div
class=
"table-mobile-content gl-display-flex gl-justify-content-center"
>
<div
class=
"table-mobile-content gl-display-flex gl-justify-content-center"
>
<gl-toggle
<gl-toggle
:value=
"scope.active"
:value=
"scope.active"
:disabled=
"!active || !canUpdateScope(scope)"
:disabled=
"!active || !canUpdateScope(scope)"
:label=
"$options.i18n.statusLabel"
label-position=
"hidden"
@
change=
"(status) => (scope.active = status)"
@
change=
"(status) => (scope.active = status)"
/>
/>
</div>
</div>
...
@@ -529,11 +534,13 @@ export default {
...
@@ -529,11 +534,13 @@ export default {
<div
class=
"table-section section-20 text-center"
role=
"gridcell"
>
<div
class=
"table-section section-20 text-center"
role=
"gridcell"
>
<div
class=
"table-mobile-header"
role=
"rowheader"
>
<div
class=
"table-mobile-header"
role=
"rowheader"
>
{{
s__('FeatureFlags|Status')
}}
{{
$options.i18n.statusLabel
}}
</div>
</div>
<div
class=
"table-mobile-content gl-display-flex gl-justify-content-center"
>
<div
class=
"table-mobile-content gl-display-flex gl-justify-content-center"
>
<gl-toggle
<gl-toggle
:disabled=
"!active"
:disabled=
"!active"
:label=
"$options.i18n.statusLabel"
label-position=
"hidden"
:value=
"false"
:value=
"false"
@
change=
"createNewScope({ active: true })"
@
change=
"createNewScope({ active: true })"
/>
/>
...
...
app/assets/javascripts/packages_and_registries/settings/group/components/maven_settings.vue
View file @
1eb11771
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
{
GlSprintf
,
GlToggle
,
GlFormGroup
,
GlFormInput
}
from
'
@gitlab/ui
'
;
import
{
GlSprintf
,
GlToggle
,
GlFormGroup
,
GlFormInput
}
from
'
@gitlab/ui
'
;
import
{
import
{
MAVEN_TOGGLE_LABEL
,
MAVEN_TITLE
,
MAVEN_TITLE
,
MAVEN_SETTINGS_SUBTITLE
,
MAVEN_SETTINGS_SUBTITLE
,
MAVEN_DUPLICATES_ALLOWED_DISABLED
,
MAVEN_DUPLICATES_ALLOWED_DISABLED
,
...
@@ -15,6 +16,7 @@ import {
...
@@ -15,6 +16,7 @@ import {
export
default
{
export
default
{
name
:
'
MavenSettings
'
,
name
:
'
MavenSettings
'
,
i18n
:
{
i18n
:
{
MAVEN_TOGGLE_LABEL
,
MAVEN_TITLE
,
MAVEN_TITLE
,
MAVEN_SETTINGS_SUBTITLE
,
MAVEN_SETTINGS_SUBTITLE
,
MAVEN_SETTING_EXCEPTION_TITLE
,
MAVEN_SETTING_EXCEPTION_TITLE
,
...
@@ -80,6 +82,8 @@ export default {
...
@@ -80,6 +82,8 @@ export default {
<div
class=
"gl-display-flex"
>
<div
class=
"gl-display-flex"
>
<gl-toggle
<gl-toggle
data-qa-selector=
"allow_duplicates_toggle"
data-qa-selector=
"allow_duplicates_toggle"
:label=
"$options.i18n.MAVEN_TOGGLE_LABEL"
label-position=
"hidden"
:value=
"mavenDuplicatesAllowed"
:value=
"mavenDuplicatesAllowed"
@
change=
"update($options.modelNames.MAVEN_DUPLICATES_ALLOWED, $event)"
@
change=
"update($options.modelNames.MAVEN_DUPLICATES_ALLOWED, $event)"
/>
/>
...
...
app/assets/javascripts/packages_and_registries/settings/group/constants.js
View file @
1eb11771
...
@@ -8,6 +8,7 @@ export const PACKAGE_SETTINGS_DESCRIPTION = s__(
...
@@ -8,6 +8,7 @@ export const PACKAGE_SETTINGS_DESCRIPTION = s__(
export
const
MAVEN_TITLE
=
s__
(
'
PackageRegistry|Maven
'
);
export
const
MAVEN_TITLE
=
s__
(
'
PackageRegistry|Maven
'
);
export
const
MAVEN_SETTINGS_SUBTITLE
=
s__
(
'
PackageRegistry|Settings for Maven packages
'
);
export
const
MAVEN_SETTINGS_SUBTITLE
=
s__
(
'
PackageRegistry|Settings for Maven packages
'
);
export
const
MAVEN_TOGGLE_LABEL
=
s__
(
'
PackageRegistry|Allow duplicates
'
);
export
const
MAVEN_DUPLICATES_ALLOWED_DISABLED
=
s__
(
export
const
MAVEN_DUPLICATES_ALLOWED_DISABLED
=
s__
(
'
PackageRegistry|%{boldStart}Do not allow duplicates%{boldEnd} - Packages with the same name and version are rejected.
'
,
'
PackageRegistry|%{boldStart}Do not allow duplicates%{boldEnd} - Packages with the same name and version are rejected.
'
,
);
);
...
...
app/assets/javascripts/pages/projects/shared/permissions/components/project_feature_setting.vue
View file @
1eb11771
...
@@ -12,6 +12,11 @@ export default {
...
@@ -12,6 +12,11 @@ export default {
event
:
'
change
'
,
event
:
'
change
'
,
},
},
props
:
{
props
:
{
label
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
name
:
{
name
:
{
type
:
String
,
type
:
String
,
required
:
false
,
required
:
false
,
...
@@ -82,6 +87,8 @@ export default {
...
@@ -82,6 +87,8 @@ export default {
class=
"gl-mr-3"
class=
"gl-mr-3"
:value=
"featureEnabled"
:value=
"featureEnabled"
:disabled=
"disabledInput"
:disabled=
"disabledInput"
:label=
"label"
label-position=
"hidden"
@
change=
"toggleFeature"
@
change=
"toggleFeature"
/>
/>
<div
class=
"select-wrapper gl-flex-fill-1"
>
<div
class=
"select-wrapper gl-flex-fill-1"
>
...
...
app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue
View file @
1eb11771
This diff is collapsed.
Click to expand it.
changelogs/unreleased/cngo-add-gl-toggle-labels.yml
0 → 100644
View file @
1eb11771
---
title
:
Add labels to UI toggles
merge_request
:
56848
author
:
type
:
fixed
ee/app/assets/javascripts/vulnerabilities/components/related_jira_issues.vue
View file @
1eb11771
...
@@ -129,7 +129,7 @@ export default {
...
@@ -129,7 +129,7 @@ export default {
target=
"_blank"
target=
"_blank"
class=
"gl-display-flex gl-align-items-center gl-ml-2 gl-text-gray-500"
class=
"gl-display-flex gl-align-items-center gl-ml-2 gl-text-gray-500"
>
>
<gl-icon
name=
"question"
:size=
"12"
role=
"text"
/>
<gl-icon
name=
"question"
:size=
"12"
/>
</gl-link>
</gl-link>
<span
<span
class=
"gl-display-inline-flex gl-align-items-center gl-ml-4"
class=
"gl-display-inline-flex gl-align-items-center gl-ml-4"
...
...
locale/gitlab.pot
View file @
1eb11771
...
@@ -21775,6 +21775,9 @@ msgstr ""
...
@@ -21775,6 +21775,9 @@ msgstr ""
msgid "PackageRegistry|Add composer registry"
msgid "PackageRegistry|Add composer registry"
msgstr ""
msgstr ""
msgid "PackageRegistry|Allow duplicates"
msgstr ""
msgid "PackageRegistry|An error occurred while saving the settings"
msgid "PackageRegistry|An error occurred while saving the settings"
msgstr ""
msgstr ""
...
...
spec/frontend/feature_flags/components/form_spec.js
View file @
1eb11771
...
@@ -123,6 +123,10 @@ describe('feature flag form', () => {
...
@@ -123,6 +123,10 @@ describe('feature flag form', () => {
});
});
});
});
it
(
'
has label
'
,
()
=>
{
expect
(
findGlToggle
().
props
(
'
label
'
)).
toBe
(
Form
.
i18n
.
statusLabel
);
});
it
(
'
should be disabled if the feature flag is not active
'
,
(
done
)
=>
{
it
(
'
should be disabled if the feature flag is not active
'
,
(
done
)
=>
{
wrapper
.
setProps
({
active
:
false
});
wrapper
.
setProps
({
active
:
false
});
wrapper
.
vm
.
$nextTick
(()
=>
{
wrapper
.
vm
.
$nextTick
(()
=>
{
...
...
spec/frontend/packages_and_registries/settings/group/components/maven_settings_spec.js
View file @
1eb11771
...
@@ -59,7 +59,10 @@ describe('Maven Settings', () => {
...
@@ -59,7 +59,10 @@ describe('Maven Settings', () => {
mountComponent
();
mountComponent
();
expect
(
findToggle
().
exists
()).
toBe
(
true
);
expect
(
findToggle
().
exists
()).
toBe
(
true
);
expect
(
findToggle
().
props
(
'
value
'
)).
toBe
(
defaultProps
.
mavenDuplicatesAllowed
);
expect
(
findToggle
().
props
()).
toMatchObject
({
label
:
component
.
i18n
.
MAVEN_TOGGLE_LABEL
,
value
:
defaultProps
.
mavenDuplicatesAllowed
,
});
});
});
it
(
'
toggle emits an update event
'
,
()
=>
{
it
(
'
toggle emits an update event
'
,
()
=>
{
...
...
spec/frontend/pages/projects/shared/permissions/components/settings_panel_spec.js
View file @
1eb11771
...
@@ -46,6 +46,7 @@ const defaultProps = {
...
@@ -46,6 +46,7 @@ const defaultProps = {
pagesHelpPath
:
'
/help/user/project/pages/introduction#gitlab-pages-access-control
'
,
pagesHelpPath
:
'
/help/user/project/pages/introduction#gitlab-pages-access-control
'
,
packagesAvailable
:
false
,
packagesAvailable
:
false
,
packagesHelpPath
:
'
/help/user/packages/index
'
,
packagesHelpPath
:
'
/help/user/packages/index
'
,
requestCveAvailable
:
true
,
};
};
describe
(
'
Settings Panel
'
,
()
=>
{
describe
(
'
Settings Panel
'
,
()
=>
{
...
@@ -76,6 +77,7 @@ describe('Settings Panel', () => {
...
@@ -76,6 +77,7 @@ describe('Settings Panel', () => {
const
findRepositoryFeatureSetting
=
()
=>
const
findRepositoryFeatureSetting
=
()
=>
findRepositoryFeatureProjectRow
().
find
(
projectFeatureSetting
);
findRepositoryFeatureProjectRow
().
find
(
projectFeatureSetting
);
const
findProjectVisibilitySettings
=
()
=>
wrapper
.
find
({
ref
:
'
project-visibility-settings
'
});
const
findProjectVisibilitySettings
=
()
=>
wrapper
.
find
({
ref
:
'
project-visibility-settings
'
});
const
findIssuesSettingsRow
=
()
=>
wrapper
.
find
({
ref
:
'
issues-settings
'
});
const
findAnalyticsRow
=
()
=>
wrapper
.
find
({
ref
:
'
analytics-settings
'
});
const
findAnalyticsRow
=
()
=>
wrapper
.
find
({
ref
:
'
analytics-settings
'
});
const
findProjectVisibilityLevelInput
=
()
=>
wrapper
.
find
(
'
[name="project[visibility_level]"]
'
);
const
findProjectVisibilityLevelInput
=
()
=>
wrapper
.
find
(
'
[name="project[visibility_level]"]
'
);
const
findRequestAccessEnabledInput
=
()
=>
const
findRequestAccessEnabledInput
=
()
=>
...
@@ -174,6 +176,16 @@ describe('Settings Panel', () => {
...
@@ -174,6 +176,16 @@ describe('Settings Panel', () => {
});
});
});
});
describe
(
'
Issues settings
'
,
()
=>
{
it
(
'
has label for CVE request toggle
'
,
()
=>
{
wrapper
=
mountComponent
();
expect
(
findIssuesSettingsRow
().
findComponent
(
GlToggle
).
props
(
'
label
'
)).
toBe
(
settingsPanel
.
i18n
.
cve_request_toggle_label
,
);
});
});
describe
(
'
Repository
'
,
()
=>
{
describe
(
'
Repository
'
,
()
=>
{
it
(
'
should set the repository help text when the visibility level is set to private
'
,
()
=>
{
it
(
'
should set the repository help text when the visibility level is set to private
'
,
()
=>
{
wrapper
=
mountComponent
({
currentSettings
:
{
visibilityLevel
:
visibilityOptions
.
PRIVATE
}
});
wrapper
=
mountComponent
({
currentSettings
:
{
visibilityLevel
:
visibilityOptions
.
PRIVATE
}
});
...
@@ -304,6 +316,17 @@ describe('Settings Panel', () => {
...
@@ -304,6 +316,17 @@ describe('Settings Panel', () => {
expect
(
findContainerRegistryEnabledInput
().
props
(
'
disabled
'
)).
toBe
(
true
);
expect
(
findContainerRegistryEnabledInput
().
props
(
'
disabled
'
)).
toBe
(
true
);
});
});
it
(
'
has label for the toggle
'
,
()
=>
{
wrapper
=
mountComponent
({
currentSettings
:
{
visibilityLevel
:
visibilityOptions
.
PUBLIC
},
registryAvailable
:
true
,
});
expect
(
findContainerRegistrySettings
().
findComponent
(
GlToggle
).
props
(
'
label
'
)).
toBe
(
settingsPanel
.
i18n
.
containerRegistryLabel
,
);
});
});
});
describe
(
'
Git Large File Storage
'
,
()
=>
{
describe
(
'
Git Large File Storage
'
,
()
=>
{
...
@@ -342,6 +365,15 @@ describe('Settings Panel', () => {
...
@@ -342,6 +365,15 @@ describe('Settings Panel', () => {
expect
(
findLFSFeatureToggle
().
props
(
'
disabled
'
)).
toBe
(
true
);
expect
(
findLFSFeatureToggle
().
props
(
'
disabled
'
)).
toBe
(
true
);
});
});
it
(
'
has label for toggle
'
,
()
=>
{
wrapper
=
mountComponent
({
currentSettings
:
{
repositoryAccessLevel
:
featureAccessLevel
.
EVERYONE
},
lfsAvailable
:
true
,
});
expect
(
findLFSFeatureToggle
().
props
(
'
label
'
)).
toBe
(
settingsPanel
.
i18n
.
lfsLabel
);
});
it
(
'
should not change lfsEnabled when disabling the repository
'
,
async
()
=>
{
it
(
'
should not change lfsEnabled when disabling the repository
'
,
async
()
=>
{
// mount over shallowMount, because we are aiming to test rendered state of toggle
// mount over shallowMount, because we are aiming to test rendered state of toggle
wrapper
=
mountComponent
({
currentSettings
:
{
lfsEnabled
:
true
}
},
mount
);
wrapper
=
mountComponent
({
currentSettings
:
{
lfsEnabled
:
true
}
},
mount
);
...
@@ -432,6 +464,17 @@ describe('Settings Panel', () => {
...
@@ -432,6 +464,17 @@ describe('Settings Panel', () => {
expect
(
findPackagesEnabledInput
().
props
(
'
disabled
'
)).
toBe
(
true
);
expect
(
findPackagesEnabledInput
().
props
(
'
disabled
'
)).
toBe
(
true
);
});
});
it
(
'
has label for toggle
'
,
()
=>
{
wrapper
=
mountComponent
({
currentSettings
:
{
repositoryAccessLevel
:
featureAccessLevel
.
EVERYONE
},
packagesAvailable
:
true
,
});
expect
(
findPackagesEnabledInput
().
findComponent
(
GlToggle
).
props
(
'
label
'
)).
toBe
(
settingsPanel
.
i18n
.
packagesLabel
,
);
});
});
});
describe
(
'
Pages
'
,
()
=>
{
describe
(
'
Pages
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment