From 25989ab7ef1a444ed2abd5479f176d58e1d9462a Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 18 Oct 2019 11:11:44 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../monitoring/components/dashboard.vue | 71 ++++------ .../date_time_picker/date_time_picker.vue | 151 +++++++++++++++++++++ .../date_time_picker/date_time_picker_input.vue | 77 +++++++++++ app/assets/javascripts/monitoring/constants.js | 10 ++ app/assets/javascripts/monitoring/utils.js | 47 ++++++- app/assets/stylesheets/pages/prometheus.scss | 14 ++ app/finders/issuable_finder.rb | 9 +- app/models/ci/pipeline.rb | 2 + app/models/concerns/issuable.rb | 28 +++- app/models/concerns/issuable_states.rb | 22 ++- app/models/concerns/milestoneish.rb | 6 +- app/models/concerns/versioned_description.rb | 31 +++++ app/models/concerns/worker_attributes.rb | 48 +++++++ app/models/description_version.rb | 22 +++ app/models/issue.rb | 13 +- app/models/merge_request.rb | 27 ++-- app/models/merge_request_diff.rb | 4 +- app/models/project_services/hipchat_service.rb | 2 +- app/models/push_event.rb | 2 +- app/models/system_note_metadata.rb | 1 + .../projects/serverless/service_entity.rb | 2 +- app/services/issuable/clone/content_rewriter.rb | 4 + app/services/note_summary.rb | 4 + app/uploaders/object_storage.rb | 9 +- app/views/projects/issues/index.html.haml | 3 +- app/views/shared/empty_states/_issues.html.haml | 3 +- app/workers/admin_email_worker.rb | 2 + app/workers/authorized_projects_worker.rb | 2 + app/workers/auto_merge_process_worker.rb | 1 + app/workers/background_migration_worker.rb | 2 + app/workers/build_hooks_worker.rb | 1 + app/workers/build_queue_worker.rb | 1 + app/workers/chat_notification_worker.rb | 2 + app/workers/ci/archive_traces_cron_worker.rb | 2 + app/workers/ci/build_prepare_worker.rb | 1 + app/workers/ci/build_schedule_worker.rb | 1 + app/workers/cleanup_container_repository_worker.rb | 1 + app/workers/concerns/application_worker.rb | 1 + app/workers/concerns/auto_devops_queue.rb | 1 + app/workers/concerns/chaos_queue.rb | 1 + app/workers/concerns/cluster_queue.rb | 1 + .../gitlab/github_import/object_importer.rb | 2 + app/workers/concerns/gitlab/github_import/queue.rb | 1 + app/workers/concerns/object_pool_queue.rb | 1 + app/workers/concerns/pipeline_background_queue.rb | 1 + app/workers/concerns/pipeline_queue.rb | 1 + app/workers/concerns/repository_check_queue.rb | 2 +- app/workers/concerns/todos_destroyer_queue.rb | 1 + app/workers/create_evidence_worker.rb | 2 + app/workers/create_gpg_signature_worker.rb | 2 + app/workers/create_note_diff_file_worker.rb | 2 + app/workers/create_pipeline_worker.rb | 1 + app/workers/delete_container_repository_worker.rb | 1 + app/workers/delete_diff_files_worker.rb | 2 + app/workers/delete_merged_branches_worker.rb | 2 + app/workers/delete_stored_files_worker.rb | 2 + app/workers/delete_user_worker.rb | 2 + app/workers/deployments/finished_worker.rb | 1 + app/workers/deployments/success_worker.rb | 1 + app/workers/detect_repository_languages_worker.rb | 1 + app/workers/email_receiver_worker.rb | 2 + app/workers/emails_on_push_worker.rb | 2 + app/workers/expire_build_artifacts_worker.rb | 2 + .../expire_build_instance_artifacts_worker.rb | 2 + app/workers/git_garbage_collect_worker.rb | 1 + .../gitlab/github_import/advance_stage_worker.rb | 1 + app/workers/gitlab_shell_worker.rb | 2 + app/workers/gitlab_usage_ping_worker.rb | 2 + app/workers/group_destroy_worker.rb | 2 + app/workers/hashed_storage/base_worker.rb | 3 + app/workers/hashed_storage/migrator_worker.rb | 1 + app/workers/hashed_storage/rollbacker_worker.rb | 1 + .../import_export_project_cleanup_worker.rb | 2 + app/workers/import_issues_csv_worker.rb | 2 + app/workers/invalid_gpg_signature_update_worker.rb | 2 + app/workers/irker_worker.rb | 2 + app/workers/issue_due_scheduler_worker.rb | 2 + app/workers/mail_scheduler/issue_due_worker.rb | 2 + .../mail_scheduler/notification_service_worker.rb | 2 + app/workers/merge_worker.rb | 2 + app/workers/migrate_external_diffs_worker.rb | 2 + .../namespaceless_project_destroy_worker.rb | 4 +- .../prune_aggregation_schedules_worker.rb | 2 + app/workers/namespaces/root_statistics_worker.rb | 1 + .../namespaces/schedule_aggregation_worker.rb | 1 + app/workers/new_issue_worker.rb | 2 + app/workers/new_merge_request_worker.rb | 2 + app/workers/new_note_worker.rb | 2 + app/workers/new_release_worker.rb | 1 + .../object_storage/background_move_worker.rb | 1 + .../object_storage/migrate_uploads_worker.rb | 2 + app/workers/pages_domain_removal_cron_worker.rb | 2 + .../pages_domain_ssl_renewal_cron_worker.rb | 2 + app/workers/pages_domain_ssl_renewal_worker.rb | 2 + .../pages_domain_verification_cron_worker.rb | 2 + app/workers/pages_domain_verification_worker.rb | 2 + app/workers/pages_worker.rb | 1 + app/workers/pipeline_process_worker.rb | 1 + app/workers/pipeline_schedule_worker.rb | 2 + app/workers/plugin_worker.rb | 1 + app/workers/post_receive.rb | 2 + app/workers/process_commit_worker.rb | 2 + app/workers/project_cache_worker.rb | 2 + app/workers/project_daily_statistics_worker.rb | 2 + app/workers/project_destroy_worker.rb | 2 + app/workers/project_export_worker.rb | 1 + app/workers/project_service_worker.rb | 1 + app/workers/propagate_service_template_worker.rb | 2 + app/workers/prune_old_events_worker.rb | 2 + app/workers/prune_web_hook_logs_worker.rb | 2 + app/workers/reactive_caching_worker.rb | 2 + app/workers/rebase_worker.rb | 2 + app/workers/remote_mirror_notification_worker.rb | 2 + app/workers/remove_expired_group_links_worker.rb | 2 + app/workers/remove_expired_members_worker.rb | 2 + .../remove_unreferenced_lfs_objects_worker.rb | 2 + app/workers/repository_archive_cache_worker.rb | 2 + app/workers/repository_check/dispatch_worker.rb | 2 + app/workers/repository_cleanup_worker.rb | 1 + app/workers/repository_fork_worker.rb | 2 + app/workers/repository_import_worker.rb | 2 + app/workers/repository_remove_remote_worker.rb | 2 + .../repository_update_remote_mirror_worker.rb | 1 + app/workers/requests_profiles_worker.rb | 2 + app/workers/run_pipeline_schedule_worker.rb | 1 + .../schedule_migrate_external_diffs_worker.rb | 2 + app/workers/stuck_ci_jobs_worker.rb | 2 + app/workers/stuck_import_jobs_worker.rb | 2 + app/workers/stuck_merge_jobs_worker.rb | 4 +- app/workers/system_hook_push_worker.rb | 2 + app/workers/trending_projects_worker.rb | 2 + .../update_external_pull_requests_worker.rb | 2 + ...pdate_head_pipeline_for_merge_request_worker.rb | 1 + app/workers/update_merge_requests_worker.rb | 2 + app/workers/update_project_statistics_worker.rb | 2 + app/workers/upload_checksum_worker.rb | 2 + app/workers/web_hook_worker.rb | 1 + 137 files changed, 706 insertions(+), 95 deletions(-) create mode 100644 app/assets/javascripts/monitoring/components/date_time_picker/date_time_picker.vue create mode 100644 app/assets/javascripts/monitoring/components/date_time_picker/date_time_picker_input.vue create mode 100644 app/models/concerns/versioned_description.rb create mode 100644 app/models/concerns/worker_attributes.rb create mode 100644 app/models/description_version.rb (limited to 'app') diff --git a/app/assets/javascripts/monitoring/components/dashboard.vue b/app/assets/javascripts/monitoring/components/dashboard.vue index 2e35ef8d4b0..b4ea415bb51 100644 --- a/app/assets/javascripts/monitoring/components/dashboard.vue +++ b/app/assets/javascripts/monitoring/components/dashboard.vue @@ -12,23 +12,19 @@ import { GlTooltipDirective, } from '@gitlab/ui'; import { __, s__ } from '~/locale'; +import createFlash from '~/flash'; import Icon from '~/vue_shared/components/icon.vue'; -import { getParameterValues, mergeUrlParams } from '~/lib/utils/url_utility'; +import { getParameterValues, mergeUrlParams, redirectTo } from '~/lib/utils/url_utility'; import invalidUrl from '~/lib/utils/invalid_url'; import PanelType from 'ee_else_ce/monitoring/components/panel_type.vue'; +import DateTimePicker from './date_time_picker/date_time_picker.vue'; import MonitorTimeSeriesChart from './charts/time_series.vue'; import MonitorSingleStatChart from './charts/single_stat.vue'; import GraphGroup from './graph_group.vue'; import EmptyState from './empty_state.vue'; -import { sidebarAnimationDuration, timeWindows } from '../constants'; +import { sidebarAnimationDuration } from '../constants'; import TrackEventDirective from '~/vue_shared/directives/track_event'; - -import { - getTimeDiff, - getTimeWindow, - downloadCSVOptions, - generateLinkToChartOptions, -} from '../utils'; +import { getTimeDiff, isValidDate, downloadCSVOptions, generateLinkToChartOptions } from '../utils'; let sidebarMutationObserver; @@ -46,6 +42,7 @@ export default { GlDropdownItem, GlFormGroup, GlModal, + DateTimePicker, }, directives: { GlModal: GlModalDirective, @@ -171,10 +168,8 @@ export default { return { state: 'gettingStarted', elWidth: 0, - selectedTimeWindow: '', - selectedTimeWindowKey: '', formIsValid: null, - timeWindows: {}, + selectedTimeWindow: {}, isRearrangingPanels: false, }; }, @@ -237,11 +232,13 @@ export default { end, }; - this.timeWindows = timeWindows; - this.selectedTimeWindowKey = getTimeWindow(range); - this.selectedTimeWindow = this.timeWindows[this.selectedTimeWindowKey]; + this.selectedTimeWindow = range; - this.fetchData(range); + if (!isValidDate(start) || !isValidDate(end)) { + this.showInvalidDateError(); + } else { + this.fetchData(range); + } sidebarMutationObserver = new MutationObserver(this.onSidebarMutation); sidebarMutationObserver.observe(document.querySelector('.layout-page'), { @@ -298,6 +295,9 @@ export default { // See https://gitlab.com/gitlab-org/gitlab/issues/27835 metrics.splice(graphIndex, 1); }, + showInvalidDateError() { + createFlash(s__('Metrics|Link contains an invalid time window.')); + }, generateLink(group, title, yLabel) { const dashboard = this.currentDashboard || this.firstDashboard.path; const params = _.pick({ dashboard, group, title, y_label: yLabel }, value => value != null); @@ -320,16 +320,12 @@ export default { submitCustomMetricsForm() { this.$refs.customMetricsForm.submit(); }, - activeTimeWindow(key) { - return this.timeWindows[key] === this.selectedTimeWindow; - }, - setTimeWindowParameter(key) { - const { start, end } = getTimeDiff(key); - return `?start=${encodeURIComponent(start)}&end=${encodeURIComponent(end)}`; - }, groupHasData(group) { return this.chartsWithData(group.metrics).length > 0; }, + onDateTimePickerApply(timeWindowUrlParams) { + return redirectTo(mergeUrlParams(timeWindowUrlParams, window.location.href)); + }, downloadCSVOptions, generateLinkToChartOptions, }, @@ -342,14 +338,14 @@ export default {