Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/lib/utils/listbox_helpers.js45
-rw-r--r--app/assets/stylesheets/pages/notes.scss2
-rw-r--r--app/assets/stylesheets/startup/startup-dark.scss3
-rw-r--r--app/assets/stylesheets/startup/startup-general.scss3
-rw-r--r--app/assets/stylesheets/startup/startup-signin.scss3
-rw-r--r--app/views/admin/application_settings/service_usage_data.html.haml2
6 files changed, 56 insertions, 2 deletions
diff --git a/app/assets/javascripts/lib/utils/listbox_helpers.js b/app/assets/javascripts/lib/utils/listbox_helpers.js
new file mode 100644
index 00000000000..b43a29ad28b
--- /dev/null
+++ b/app/assets/javascripts/lib/utils/listbox_helpers.js
@@ -0,0 +1,45 @@
+import { n__ } from '~/locale';
+
+/**
+ * Accepts an array of options and an array of selected option IDs
+ * and optionally a placeholder and maximum number of options to show.
+ *
+ * Returns a string with the text of the selected options:
+ * - If no options are selected, returns the placeholder or an empty string.
+ * - If less than maxOptionsShown is selected, returns the text of those options comma-separated.
+ * - If more than maxOptionsShown is selected, returns the text of those options comma-separated
+ * followed by the text "+X more", where X is the number of additional selected options
+ *
+ * @param {Object} opts
+ * @param {Array<{ id: number | string, value: string }>} opts.options
+ * @param {Array<{ id: number | string }>} opts.selected
+ * @param {String} opts.placeholder - Placeholder when no option is selected
+ * @param {Integer} opts.maxOptionsShown – Max number of options to show
+ * @returns {String}
+ */
+export const getSelectedOptionsText = ({
+ options,
+ selected,
+ placeholder = '',
+ maxOptionsShown = 1,
+}) => {
+ const selectedOptions = options.filter(({ id, value }) => selected.includes(id || value));
+
+ if (selectedOptions.length === 0) {
+ return placeholder;
+ }
+
+ const optionTexts = selectedOptions.map((option) => option.text);
+
+ if (selectedOptions.length <= maxOptionsShown) {
+ return optionTexts.join(', ');
+ }
+
+ // Prevent showing "+-1 more" when the array is empty.
+ const additionalItemsCount = selectedOptions.length - maxOptionsShown;
+ return `${optionTexts.slice(0, maxOptionsShown).join(', ')} ${n__(
+ '+%d more',
+ '+%d more',
+ additionalItemsCount,
+ )}`;
+};
diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss
index 069ccad4435..c5b644bd72f 100644
--- a/app/assets/stylesheets/pages/notes.scss
+++ b/app/assets/stylesheets/pages/notes.scss
@@ -44,7 +44,7 @@ $system-note-icon-m-left: $avatar-m-left + $icon-size-diff / $avatar-m-ratio;
background: var(--gray-50, $gray-50);
}
- .timeline-entry:last-child::before {
+ .timeline-entry:not(.draft-note):last-child::before {
background: var(--white);
.gl-dark & {
diff --git a/app/assets/stylesheets/startup/startup-dark.scss b/app/assets/stylesheets/startup/startup-dark.scss
index 02cc86a77ea..7be15c2d8f9 100644
--- a/app/assets/stylesheets/startup/startup-dark.scss
+++ b/app/assets/stylesheets/startup/startup-dark.scss
@@ -2,6 +2,9 @@
// Please see the feedback issue for more details and help:
// https://gitlab.com/gitlab-org/gitlab/-/issues/331812
@charset "UTF-8";
+:root {
+ --white: #333238;
+}
*,
*::before,
*::after {
diff --git a/app/assets/stylesheets/startup/startup-general.scss b/app/assets/stylesheets/startup/startup-general.scss
index 5e3944e62f1..65500800ce3 100644
--- a/app/assets/stylesheets/startup/startup-general.scss
+++ b/app/assets/stylesheets/startup/startup-general.scss
@@ -2,6 +2,9 @@
// Please see the feedback issue for more details and help:
// https://gitlab.com/gitlab-org/gitlab/-/issues/331812
@charset "UTF-8";
+:root {
+ --white: #fff;
+}
*,
*::before,
*::after {
diff --git a/app/assets/stylesheets/startup/startup-signin.scss b/app/assets/stylesheets/startup/startup-signin.scss
index d081fdfa50b..40e1e4b1996 100644
--- a/app/assets/stylesheets/startup/startup-signin.scss
+++ b/app/assets/stylesheets/startup/startup-signin.scss
@@ -2,6 +2,9 @@
// Please see the feedback issue for more details and help:
// https://gitlab.com/gitlab-org/gitlab/-/issues/331812
@charset "UTF-8";
+:root {
+ --white: #fff;
+}
*,
*::before,
*::after {
diff --git a/app/views/admin/application_settings/service_usage_data.html.haml b/app/views/admin/application_settings/service_usage_data.html.haml
index e42c1091bf2..24f132b982a 100644
--- a/app/views/admin/application_settings/service_usage_data.html.haml
+++ b/app/views/admin/application_settings/service_usage_data.html.haml
@@ -25,7 +25,7 @@
- c.with_body do
- enable_service_ping_link_url = help_page_path('user/admin_area/settings/usage_statistics', anchor: 'enable-or-disable-usage-statistics')
- enable_service_ping_link = '<a href="%{url}">'.html_safe % { url: enable_service_ping_link_url }
- - generate_manually_link_url = help_page_path('development/service_ping/troubleshooting', anchor: 'generate-service-ping')
+ - generate_manually_link_url = help_page_path('development/internal_analytics/service_ping/troubleshooting', anchor: 'generate-service-ping')
- generate_manually_link = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: generate_manually_link_url }
= html_escape(s_('%{enable_service_ping_link_start}Enable%{link_end} or %{generate_manually_link_start}generate%{link_end} Service Ping to preview and download service usage data payload.')) % { enable_service_ping_link_start: enable_service_ping_link, generate_manually_link_start: generate_manually_link, link_end: '</a>'.html_safe }