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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-22 21:08:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-22 21:08:21 +0300
commit1cf95147eabbb193c1db2526e6c8888e950a3987 (patch)
tree88ae9b19860f7d0552efd048f47d494adcaa03af /app
parentd6e421b21ed5574700c165cd3361094f4093ac72 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/monitoring/components/dashboard.vue50
-rw-r--r--app/assets/javascripts/monitoring/constants.js1
-rw-r--r--app/assets/javascripts/monitoring/monitoring_bundle.js33
-rw-r--r--app/assets/javascripts/monitoring/stores/actions.js3
-rw-r--r--app/assets/javascripts/monitoring/stores/index.js12
-rw-r--r--app/assets/javascripts/monitoring/stores/state.js3
-rw-r--r--app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/constants.js3
-rw-r--r--app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view.vue23
-rw-r--r--app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/label_item.vue16
-rw-r--r--app/graphql/types/merge_request_type.rb4
10 files changed, 79 insertions, 69 deletions
diff --git a/app/assets/javascripts/monitoring/components/dashboard.vue b/app/assets/javascripts/monitoring/components/dashboard.vue
index 3ea4a24f421..1d12e1bfcbd 100644
--- a/app/assets/javascripts/monitoring/components/dashboard.vue
+++ b/app/assets/javascripts/monitoring/components/dashboard.vue
@@ -111,28 +111,10 @@ export default {
type: String,
required: true,
},
- projectPath: {
- type: String,
- required: true,
- },
- logsPath: {
- type: String,
- required: false,
- default: invalidUrl,
- },
defaultBranch: {
type: String,
required: true,
},
- metricsEndpoint: {
- type: String,
- required: true,
- },
- deploymentsEndpoint: {
- type: String,
- required: false,
- default: null,
- },
emptyGettingStartedSvgPath: {
type: String,
required: true,
@@ -153,10 +135,6 @@ export default {
type: String,
required: true,
},
- currentEnvironmentName: {
- type: String,
- required: true,
- },
customMetricsAvailable: {
type: Boolean,
required: false,
@@ -172,21 +150,6 @@ export default {
required: false,
default: invalidUrl,
},
- dashboardEndpoint: {
- type: String,
- required: false,
- default: invalidUrl,
- },
- dashboardsEndpoint: {
- type: String,
- required: false,
- default: invalidUrl,
- },
- currentDashboard: {
- type: String,
- required: false,
- default: '',
- },
smallEmptyState: {
type: Boolean,
required: false,
@@ -228,6 +191,8 @@ export default {
'expandedPanel',
'variables',
'isUpdatingStarredValue',
+ 'currentDashboard',
+ 'currentEnvironmentName',
]),
...mapGetters('monitoringDashboard', [
'selectedDashboard',
@@ -281,16 +246,6 @@ export default {
},
},
created() {
- this.setInitialState({
- metricsEndpoint: this.metricsEndpoint,
- deploymentsEndpoint: this.deploymentsEndpoint,
- dashboardEndpoint: this.dashboardEndpoint,
- dashboardsEndpoint: this.dashboardsEndpoint,
- currentDashboard: this.currentDashboard,
- projectPath: this.projectPath,
- logsPath: this.logsPath,
- currentEnvironmentName: this.currentEnvironmentName,
- });
window.addEventListener('keyup', this.onKeyup);
},
destroyed() {
@@ -310,7 +265,6 @@ export default {
'fetchData',
'fetchDashboardData',
'setGettingStartedEmptyState',
- 'setInitialState',
'setPanelGroupMetrics',
'filterEnvironments',
'setExpandedPanel',
diff --git a/app/assets/javascripts/monitoring/constants.js b/app/assets/javascripts/monitoring/constants.js
index 0c2eafeed54..ec1570f0ef9 100644
--- a/app/assets/javascripts/monitoring/constants.js
+++ b/app/assets/javascripts/monitoring/constants.js
@@ -140,7 +140,6 @@ export const dateFormats = {
* Currently used in `receiveMetricsDashboardSuccess` action.
*/
export const endpointKeys = [
- 'metricsEndpoint',
'deploymentsEndpoint',
'dashboardEndpoint',
'dashboardsEndpoint',
diff --git a/app/assets/javascripts/monitoring/monitoring_bundle.js b/app/assets/javascripts/monitoring/monitoring_bundle.js
index 5acb9ebc043..42d9cd1265c 100644
--- a/app/assets/javascripts/monitoring/monitoring_bundle.js
+++ b/app/assets/javascripts/monitoring/monitoring_bundle.js
@@ -3,7 +3,7 @@ import { GlToast } from '@gitlab/ui';
import Dashboard from '~/monitoring/components/dashboard.vue';
import { parseBoolean } from '~/lib/utils/common_utils';
import { getParameterValues } from '~/lib/utils/url_utility';
-import store from './stores';
+import { createStore } from './stores';
Vue.use(GlToast);
@@ -13,6 +13,31 @@ export default (props = {}) => {
if (el && el.dataset) {
const [currentDashboard] = getParameterValues('dashboard');
+ const {
+ deploymentsEndpoint,
+ dashboardEndpoint,
+ dashboardsEndpoint,
+ projectPath,
+ logsPath,
+ currentEnvironmentName,
+ ...dataProps
+ } = el.dataset;
+
+ const store = createStore({
+ currentDashboard,
+ deploymentsEndpoint,
+ dashboardEndpoint,
+ dashboardsEndpoint,
+ projectPath,
+ logsPath,
+ currentEnvironmentName,
+ });
+
+ // HTML attributes are always strings, parse other types.
+ dataProps.hasMetrics = parseBoolean(dataProps.hasMetrics);
+ dataProps.customMetricsAvailable = parseBoolean(dataProps.customMetricsAvailable);
+ dataProps.prometheusAlertsAvailable = parseBoolean(dataProps.prometheusAlertsAvailable);
+
// eslint-disable-next-line no-new
new Vue({
el,
@@ -20,11 +45,7 @@ export default (props = {}) => {
render(createElement) {
return createElement(Dashboard, {
props: {
- ...el.dataset,
- currentDashboard,
- customMetricsAvailable: parseBoolean(el.dataset.customMetricsAvailable),
- prometheusAlertsAvailable: parseBoolean(el.dataset.prometheusAlertsAvailable),
- hasMetrics: parseBoolean(el.dataset.hasMetrics),
+ ...dataProps,
...props,
},
});
diff --git a/app/assets/javascripts/monitoring/stores/actions.js b/app/assets/javascripts/monitoring/stores/actions.js
index fec2aba4575..0de0c362b0c 100644
--- a/app/assets/javascripts/monitoring/stores/actions.js
+++ b/app/assets/javascripts/monitoring/stores/actions.js
@@ -314,8 +314,7 @@ export const receiveEnvironmentsDataFailure = ({ commit }) => {
export const fetchAnnotations = ({ state, dispatch }) => {
const { start } = convertToFixedRange(state.timeRange);
- const dashboardPath =
- state.currentDashboard === '' ? DEFAULT_DASHBOARD_PATH : state.currentDashboard;
+ const dashboardPath = state.currentDashboard || DEFAULT_DASHBOARD_PATH;
return gqClient
.mutate({
mutation: getAnnotations,
diff --git a/app/assets/javascripts/monitoring/stores/index.js b/app/assets/javascripts/monitoring/stores/index.js
index f08a6402aa6..213a8508aa2 100644
--- a/app/assets/javascripts/monitoring/stores/index.js
+++ b/app/assets/javascripts/monitoring/stores/index.js
@@ -15,11 +15,15 @@ export const monitoringDashboard = {
state,
};
-export const createStore = () =>
+export const createStore = (initState = {}) =>
new Vuex.Store({
modules: {
- monitoringDashboard,
+ monitoringDashboard: {
+ ...monitoringDashboard,
+ state: {
+ ...state(),
+ ...initState,
+ },
+ },
},
});
-
-export default createStore();
diff --git a/app/assets/javascripts/monitoring/stores/state.js b/app/assets/javascripts/monitoring/stores/state.js
index 9d47a9a2ad7..29d6f0cf704 100644
--- a/app/assets/javascripts/monitoring/stores/state.js
+++ b/app/assets/javascripts/monitoring/stores/state.js
@@ -2,9 +2,9 @@ import invalidUrl from '~/lib/utils/invalid_url';
export default () => ({
// API endpoints
- metricsEndpoint: null,
deploymentsEndpoint: null,
dashboardEndpoint: invalidUrl,
+ dashboardsEndpoint: invalidUrl,
// Dashboard request parameters
timeRange: null,
@@ -46,6 +46,7 @@ export default () => ({
environments: [],
environmentsSearchTerm: '',
environmentsLoading: false,
+ currentEnvironmentName: null,
// GitLab paths to other pages
projectPath: null,
diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/constants.js b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/constants.js
index ab652c9356a..e94e7d46f85 100644
--- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/constants.js
+++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/constants.js
@@ -1,5 +1,6 @@
-// eslint-disable-next-line import/prefer-default-export
export const DropdownVariant = {
Sidebar: 'sidebar',
Standalone: 'standalone',
};
+
+export const LIST_BUFFER_SIZE = 5;
diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view.vue b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view.vue
index 1ef2e8b3bed..af16088b6b9 100644
--- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view.vue
+++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view.vue
@@ -3,15 +3,20 @@ import { mapState, mapGetters, mapActions } from 'vuex';
import { GlLoadingIcon, GlButton, GlSearchBoxByType, GlLink } from '@gitlab/ui';
import { UP_KEY_CODE, DOWN_KEY_CODE, ENTER_KEY_CODE, ESC_KEY_CODE } from '~/lib/utils/keycodes';
+import SmartVirtualList from '~/vue_shared/components/smart_virtual_list.vue';
import LabelItem from './label_item.vue';
+import { LIST_BUFFER_SIZE } from './constants';
+
export default {
+ LIST_BUFFER_SIZE,
components: {
GlLoadingIcon,
GlButton,
GlSearchBoxByType,
GlLink,
+ SmartVirtualList,
LabelItem,
},
data() {
@@ -139,10 +144,18 @@ export default {
<gl-search-box-by-type v-model="searchKey" :autofocus="true" />
</div>
<div v-show="!labelsFetchInProgress" ref="labelsListContainer" class="dropdown-content">
- <ul class="list-unstyled mb-0">
+ <smart-virtual-list
+ :length="visibleLabels.length"
+ :remain="$options.LIST_BUFFER_SIZE"
+ :size="$options.LIST_BUFFER_SIZE"
+ wclass="list-unstyled mb-0"
+ wtag="ul"
+ class="h-100"
+ >
<li v-for="(label, index) in visibleLabels" :key="label.id" class="d-block text-left">
<label-item
:label="label"
+ :is-label-set="label.set"
:highlight="index === currentHighlightItem"
@clickLabel="handleLabelClick(label)"
/>
@@ -150,7 +163,7 @@ export default {
<li v-show="!visibleLabels.length" class="p-2 text-center">
{{ __('No matching results') }}
</li>
- </ul>
+ </smart-virtual-list>
</div>
<div v-if="isDropdownVariantSidebar" class="dropdown-footer">
<ul class="list-unstyled">
@@ -162,9 +175,9 @@ export default {
>
</li>
<li>
- <gl-link :href="labelsManagePath" class="d-flex flex-row text-break-word label-item">{{
- footerManageLabelTitle
- }}</gl-link>
+ <gl-link :href="labelsManagePath" class="d-flex flex-row text-break-word label-item">
+ {{ footerManageLabelTitle }}
+ </gl-link>
</li>
</ul>
</div>
diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/label_item.vue b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/label_item.vue
index c95221d71b5..002e741ab96 100644
--- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/label_item.vue
+++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/label_item.vue
@@ -11,6 +11,10 @@ export default {
type: Object,
required: true,
},
+ isLabelSet: {
+ type: Boolean,
+ required: true,
+ },
highlight: {
type: Boolean,
required: false,
@@ -19,7 +23,7 @@ export default {
},
data() {
return {
- isSet: this.label.set,
+ isSet: this.isLabelSet,
};
},
computed: {
@@ -29,6 +33,16 @@ export default {
};
},
},
+ watch: {
+ /**
+ * This watcher assures that if user used
+ * `Enter` key to set/unset label, changes
+ * are reflected here too.
+ */
+ isLabelSet(value) {
+ this.isSet = value;
+ },
+ },
methods: {
handleClick() {
this.isSet = !this.isSet;
diff --git a/app/graphql/types/merge_request_type.rb b/app/graphql/types/merge_request_type.rb
index 6ac385a8e31..cb4ff7ea0c5 100644
--- a/app/graphql/types/merge_request_type.rb
+++ b/app/graphql/types/merge_request_type.rb
@@ -28,6 +28,8 @@ module Types
description: 'Timestamp of when the merge request was created'
field :updated_at, Types::TimeType, null: false,
description: 'Timestamp of when the merge request was last updated'
+ field :merged_at, Types::TimeType, null: true, complexity: 5,
+ description: 'Timestamp of when the merge request was merged, null if not merged'
field :source_project, Types::ProjectType, null: true,
description: 'Source project of the merge request'
field :target_project, Types::ProjectType, null: false,
@@ -109,6 +111,8 @@ module Types
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Milestone, obj.milestone_id).find }
field :assignees, Types::UserType.connection_type, null: true, complexity: 5,
description: 'Assignees of the merge request'
+ field :author, Types::UserType, null: true,
+ description: 'User who created this merge request'
field :participants, Types::UserType.connection_type, null: true, complexity: 5,
description: 'Participants in the merge request'
field :subscribed, GraphQL::BOOLEAN_TYPE, method: :subscribed?, null: false, complexity: 5,