summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-30 21:06:41 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-30 21:06:41 +0000
commit08f4ce10c04d705148a7e14556443b9e3aee6821 (patch)
treeba58b29874803db12ebec690fb4416b6208ee750 /app
parentb4cdff15ca53312ccbbafe4effac85b1ee4420ae (diff)
downloadgitlab-ce-08f4ce10c04d705148a7e14556443b9e3aee6821.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/performance_bar/components/detailed_metric.vue14
-rw-r--r--app/assets/javascripts/performance_bar/components/performance_bar_app.vue8
-rw-r--r--app/assets/javascripts/performance_bar/components/request_selector.vue29
-rw-r--r--app/assets/javascripts/performance_bar/components/request_warning.vue41
-rw-r--r--app/assets/javascripts/performance_bar/index.js4
-rw-r--r--app/assets/javascripts/performance_bar/stores/performance_bar_store.js8
-rw-r--r--app/models/clusters/platforms/kubernetes.rb1
-rw-r--r--app/views/admin/system_info/show.html.haml44
8 files changed, 118 insertions, 31 deletions
diff --git a/app/assets/javascripts/performance_bar/components/detailed_metric.vue b/app/assets/javascripts/performance_bar/components/detailed_metric.vue
index f2d98cf07e1..7ce32032ed3 100644
--- a/app/assets/javascripts/performance_bar/components/detailed_metric.vue
+++ b/app/assets/javascripts/performance_bar/components/detailed_metric.vue
@@ -1,9 +1,12 @@
<script>
+import RequestWarning from './request_warning.vue';
+
import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue';
import Icon from '~/vue_shared/components/icon.vue';
export default {
components: {
+ RequestWarning,
GlModal: DeprecatedModal2,
Icon,
},
@@ -39,6 +42,16 @@ export default {
detailsList() {
return this.metricDetails.details;
},
+ warnings() {
+ return this.metricDetails.warnings || [];
+ },
+ htmlId() {
+ if (this.currentRequest) {
+ return `performance-bar-warning-${this.currentRequest.id}-${this.metric}`;
+ }
+
+ return '';
+ },
},
};
</script>
@@ -105,5 +118,6 @@ export default {
<div slot="footer"></div>
</gl-modal>
{{ title }}
+ <request-warning :html-id="htmlId" :warnings="warnings" />
</div>
</template>
diff --git a/app/assets/javascripts/performance_bar/components/performance_bar_app.vue b/app/assets/javascripts/performance_bar/components/performance_bar_app.vue
index 9ad6e75b86b..3b07eba02b7 100644
--- a/app/assets/javascripts/performance_bar/components/performance_bar_app.vue
+++ b/app/assets/javascripts/performance_bar/components/performance_bar_app.vue
@@ -1,14 +1,14 @@
<script>
import { glEmojiTag } from '~/emoji';
-import detailedMetric from './detailed_metric.vue';
-import requestSelector from './request_selector.vue';
+import DetailedMetric from './detailed_metric.vue';
+import RequestSelector from './request_selector.vue';
import { s__ } from '~/locale';
export default {
components: {
- detailedMetric,
- requestSelector,
+ DetailedMetric,
+ RequestSelector,
},
props: {
store: {
diff --git a/app/assets/javascripts/performance_bar/components/request_selector.vue b/app/assets/javascripts/performance_bar/components/request_selector.vue
index 297507b85af..793aba3189b 100644
--- a/app/assets/javascripts/performance_bar/components/request_selector.vue
+++ b/app/assets/javascripts/performance_bar/components/request_selector.vue
@@ -1,5 +1,12 @@
<script>
+import { glEmojiTag } from '~/emoji';
+import { n__ } from '~/locale';
+import { GlPopover } from '@gitlab/ui';
+
export default {
+ components: {
+ GlPopover,
+ },
props: {
currentRequest: {
type: Object,
@@ -15,6 +22,18 @@ export default {
currentRequestId: this.currentRequest.id,
};
},
+ computed: {
+ requestsWithWarnings() {
+ return this.requests.filter(request => request.hasWarnings);
+ },
+ warningMessage() {
+ return n__(
+ '%d request with warnings',
+ '%d requests with warnings',
+ this.requestsWithWarnings.length,
+ );
+ },
+ },
watch: {
currentRequestId(newRequestId) {
this.$emit('change-current-request', newRequestId);
@@ -31,6 +50,7 @@ export default {
return truncated;
},
+ glEmojiTag,
},
};
</script>
@@ -44,7 +64,16 @@ export default {
class="qa-performance-bar-request"
>
{{ truncatedUrl(request.url) }}
+ <span v-if="request.hasWarnings">(!)</span>
</option>
</select>
+ <span v-if="requestsWithWarnings.length">
+ <span id="performance-bar-request-selector-warning" v-html="glEmojiTag('warning')"></span>
+ <gl-popover
+ target="performance-bar-request-selector-warning"
+ :content="warningMessage"
+ triggers="hover focus"
+ />
+ </span>
</div>
</template>
diff --git a/app/assets/javascripts/performance_bar/components/request_warning.vue b/app/assets/javascripts/performance_bar/components/request_warning.vue
new file mode 100644
index 00000000000..0da3c271214
--- /dev/null
+++ b/app/assets/javascripts/performance_bar/components/request_warning.vue
@@ -0,0 +1,41 @@
+<script>
+import { glEmojiTag } from '~/emoji';
+import { GlPopover } from '@gitlab/ui';
+
+export default {
+ components: {
+ GlPopover,
+ },
+ props: {
+ htmlId: {
+ type: String,
+ required: true,
+ },
+ warnings: {
+ type: Array,
+ required: true,
+ },
+ },
+ computed: {
+ hasWarnings() {
+ return this.warnings && this.warnings.length;
+ },
+ warningMessage() {
+ if (!this.hasWarnings) {
+ return '';
+ }
+
+ return this.warnings.join('\n');
+ },
+ },
+ methods: {
+ glEmojiTag,
+ },
+};
+</script>
+<template>
+ <span v-if="hasWarnings">
+ <span :id="htmlId" v-html="glEmojiTag('warning')"></span>
+ <gl-popover :target="htmlId" :content="warningMessage" triggers="hover focus" />
+ </span>
+</template>
diff --git a/app/assets/javascripts/performance_bar/index.js b/app/assets/javascripts/performance_bar/index.js
index 29bfb7ee5df..1ae9487f391 100644
--- a/app/assets/javascripts/performance_bar/index.js
+++ b/app/assets/javascripts/performance_bar/index.js
@@ -6,7 +6,7 @@ export default ({ container }) =>
new Vue({
el: container,
components: {
- performanceBarApp: () => import('./components/performance_bar_app.vue'),
+ PerformanceBarApp: () => import('./components/performance_bar_app.vue'),
},
data() {
const performanceBarData = document.querySelector(this.$options.el).dataset;
@@ -41,7 +41,7 @@ export default ({ container }) =>
PerformanceBarService.fetchRequestDetails(this.peekUrl, requestId)
.then(res => {
- this.store.addRequestDetails(requestId, res.data.data);
+ this.store.addRequestDetails(requestId, res.data);
})
.catch(() =>
// eslint-disable-next-line no-console
diff --git a/app/assets/javascripts/performance_bar/stores/performance_bar_store.js b/app/assets/javascripts/performance_bar/stores/performance_bar_store.js
index 031e774d533..64f4f5e0c76 100644
--- a/app/assets/javascripts/performance_bar/stores/performance_bar_store.js
+++ b/app/assets/javascripts/performance_bar/stores/performance_bar_store.js
@@ -3,12 +3,13 @@ export default class PerformanceBarStore {
this.requests = [];
}
- addRequest(requestId, requestUrl, requestDetails) {
+ addRequest(requestId, requestUrl) {
if (!this.findRequest(requestId)) {
this.requests.push({
id: requestId,
url: requestUrl,
- details: requestDetails,
+ details: {},
+ hasWarnings: false,
});
}
@@ -22,7 +23,8 @@ export default class PerformanceBarStore {
addRequestDetails(requestId, requestDetails) {
const request = this.findRequest(requestId);
- request.details = requestDetails;
+ request.details = requestDetails.data;
+ request.hasWarnings = requestDetails.has_warnings;
return request;
}
diff --git a/app/models/clusters/platforms/kubernetes.rb b/app/models/clusters/platforms/kubernetes.rb
index d00a2984a60..943f36299d4 100644
--- a/app/models/clusters/platforms/kubernetes.rb
+++ b/app/models/clusters/platforms/kubernetes.rb
@@ -6,6 +6,7 @@ module Clusters
include Gitlab::Kubernetes
include EnumWithNil
include AfterCommitQueue
+ include ReactiveCaching
RESERVED_NAMESPACES = %w(gitlab-managed-apps).freeze
diff --git a/app/views/admin/system_info/show.html.haml b/app/views/admin/system_info/show.html.haml
index 948a11646f7..b7648979edd 100644
--- a/app/views/admin/system_info/show.html.haml
+++ b/app/views/admin/system_info/show.html.haml
@@ -1,35 +1,35 @@
-- page_title "System Info"
+- page_title _('System Info')
.prepend-top-default
.row
- .col-sm-4
- .card.bg-light.light-well
- %h4 CPU
+ .col-sm
+ .bg-light.light-well
+ %h4= _('CPU')
.data
- if @cpus
- %h1 #{@cpus.length} cores
+ %h2= _('%{cores} cores') % { cores: @cpus.length }
- else
= icon('warning', class: 'text-warning')
- Unable to collect CPU info
- .col-sm-4
- .card.bg-light.light-well
- %h4 Memory Usage
+ = _('Unable to collect CPU info')
+ .bg-light.light-well.prepend-top-default
+ %h4= _('Memory Usage')
.data
- if @memory
- %h1 #{number_to_human_size(@memory.active_bytes)} / #{number_to_human_size(@memory.total_bytes)}
+ %h2 #{number_to_human_size(@memory.active_bytes)} / #{number_to_human_size(@memory.total_bytes)}
- else
= icon('warning', class: 'text-warning')
- Unable to collect memory info
- .col-sm-4
- .card.bg-light.light-well
- %h4 Disk Usage
+ = _('Unable to collect memory info')
+ .bg-light.light-well.prepend-top-default
+ %h4= _('Uptime')
.data
- - @disks.each do |disk|
- %h1 #{number_to_human_size(disk[:bytes_used])} / #{number_to_human_size(disk[:bytes_total])}
- %p= disk[:disk_name]
- %p= disk[:mount_path]
- .col-sm-4
- .card.bg-light.light-well
- %h4 Uptime
+ %h2= distance_of_time_in_words_to_now(Rails.application.config.booted_at)
+ .col-sm
+ .bg-light.light-well
+ %h4= _('Disk Usage')
.data
- %h1= distance_of_time_in_words_to_now(Rails.application.config.booted_at)
+ %ul
+ - @disks.each do |disk|
+ %li
+ %h2 #{number_to_human_size(disk[:bytes_used])} / #{number_to_human_size(disk[:bytes_total])}
+ %p= disk[:disk_name]
+ %p= disk[:mount_path]