diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-09-05 19:06:31 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-09-05 19:06:31 +0300 |
commit | 4c6898bdcf0bff6a0a3b288215271be4e916b27c (patch) | |
tree | 13db382a777a55c8220fcbdd85ebf5bf4cedeb03 | |
parent | ae9b771797cceee76c18376910519e9e71628acc (diff) | |
parent | 063e285e6a8c26a95809873fb32fefc54fe9bdb6 (diff) |
Merge branch 'master' into '36860-migrate-issues-author'
# Conflicts:
# db/schema.rb
219 files changed, 11447 insertions, 2885 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aa7659d1b41..b08c441028b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -212,7 +212,6 @@ update-tests-metadata: flaky-examples-check: <<: *dedicated-runner - <<: *except-docs image: ruby:2.3-alpine services: [] before_script: [] @@ -227,6 +226,7 @@ flaky-examples-check: - branches except: - master + - /(^docs[\/-].*|.*-docs$)/ artifacts: expire_in: 30d paths: diff --git a/README.md b/README.md index 9309922ae39..9ead6d51c5d 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Build status](https://gitlab.com/gitlab-org/gitlab-ce/badges/master/build.svg)](https://gitlab.com/gitlab-org/gitlab-ce/commits/master) [![Overall test coverage](https://gitlab.com/gitlab-org/gitlab-ce/badges/master/coverage.svg)](https://gitlab.com/gitlab-org/gitlab-ce/pipelines) +[![Dependency Status](https://gemnasium.com/gitlabhq/gitlabhq.svg)](https://gemnasium.com/gitlabhq/gitlabhq) [![Code Climate](https://codeclimate.com/github/gitlabhq/gitlabhq.svg)](https://codeclimate.com/github/gitlabhq/gitlabhq) [![Core Infrastructure Initiative Best Practices](https://bestpractices.coreinfrastructure.org/projects/42/badge)](https://bestpractices.coreinfrastructure.org/projects/42) [![Gitter](https://badges.gitter.im/gitlabhq/gitlabhq.svg)](https://gitter.im/gitlabhq/gitlabhq?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index 78cb3def879..8acddd6194c 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -5,7 +5,7 @@ const Api = { groupPath: '/api/:version/groups/:id.json', namespacesPath: '/api/:version/namespaces.json', groupProjectsPath: '/api/:version/groups/:id/projects.json', - projectsPath: '/api/:version/projects.json?simple=true', + projectsPath: '/api/:version/projects.json', labelsPath: '/:namespace_path/:project_path/labels', licensePath: '/api/:version/templates/licenses/:key', gitignorePath: '/api/:version/templates/gitignores/:key', @@ -58,6 +58,7 @@ const Api = { const defaults = { search: query, per_page: 20, + simple: true, }; if (gon.current_user_id) { diff --git a/app/assets/javascripts/commons/index.js b/app/assets/javascripts/commons/index.js index 6db8b3afbef..768453b28f1 100644 --- a/app/assets/javascripts/commons/index.js +++ b/app/assets/javascripts/commons/index.js @@ -2,3 +2,4 @@ import 'underscore'; import './polyfills'; import './jquery'; import './bootstrap'; +import './vue'; diff --git a/app/assets/javascripts/vue_shared/common_vue.js b/app/assets/javascripts/commons/vue.js index eb2a6071fda..8b62d78c043 100644 --- a/app/assets/javascripts/vue_shared/common_vue.js +++ b/app/assets/javascripts/commons/vue.js @@ -1,5 +1,4 @@ import Vue from 'vue'; -import './vue_resource_interceptor'; if (process.env.NODE_ENV !== 'production') { Vue.config.productionTip = false; diff --git a/app/assets/javascripts/diff_notes/components/diff_note_avatars.js b/app/assets/javascripts/diff_notes/components/diff_note_avatars.js index c37249c060a..06ce84d7599 100644 --- a/app/assets/javascripts/diff_notes/components/diff_note_avatars.js +++ b/app/assets/javascripts/diff_notes/components/diff_note_avatars.js @@ -21,11 +21,13 @@ const DiffNoteAvatars = Vue.extend({ }, template: ` <div class="diff-comment-avatar-holders" + :class="discussionClassName" v-show="notesCount !== 0"> <div v-if="!isVisible"> <!-- FIXME: Pass an alt attribute here for accessibility --> <user-avatar-image v-for="note in notesSubset" + :key="note.id" class="diff-comment-avatar js-diff-comment-avatar" @click.native="clickedAvatar($event)" :img-src="note.authorAvatar" @@ -68,7 +70,8 @@ const DiffNoteAvatars = Vue.extend({ }); }); }, - destroyed() { + beforeDestroy() { + this.addNoCommentClass(); $(document).off('toggle.comments'); }, watch: { @@ -85,6 +88,9 @@ const DiffNoteAvatars = Vue.extend({ }, }, computed: { + discussionClassName() { + return `js-diff-avatars-${this.discussionId}`; + }, notesSubset() { let notes = []; diff --git a/app/assets/javascripts/diff_notes/diff_notes_bundle.js b/app/assets/javascripts/diff_notes/diff_notes_bundle.js index 5decfc1dc01..0863c3406bd 100644 --- a/app/assets/javascripts/diff_notes/diff_notes_bundle.js +++ b/app/assets/javascripts/diff_notes/diff_notes_bundle.js @@ -32,6 +32,10 @@ $(() => { const tmpApp = new tmp().$mount(); $(this).replaceWith(tmpApp.$el); + $(tmpApp.$el).one('remove.vue', () => { + tmpApp.$destroy(); + tmpApp.$el.remove(); + }); }); const $components = $(COMPONENT_SELECTOR).filter(function () { diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index 69a6e131b59..f14458c8d41 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -132,6 +132,7 @@ import './project_new'; import './project_select'; import './project_show'; import './project_variables'; +import './projects_dropdown'; import './projects_list'; import './syntax_highlight'; import './render_math'; @@ -249,7 +250,10 @@ $(function () { // Initialize popovers $body.popover({ selector: '[data-toggle="popover"]', - trigger: 'focus' + trigger: 'focus', + // set the viewport to the main content, excluding the navigation bar, so + // the navigation can't overlap the popover + viewport: '.page-with-sidebar' }); $('.trigger-submit').on('change', function () { return $(this).parents('form').submit(); diff --git a/app/assets/javascripts/monitoring/components/graph.vue b/app/assets/javascripts/monitoring/components/graph.vue index 6f6da9e1463..9c785f4ada8 100644 --- a/app/assets/javascripts/monitoring/components/graph.vue +++ b/app/assets/javascripts/monitoring/components/graph.vue @@ -3,11 +3,12 @@ import GraphLegend from './graph/legend.vue'; import GraphFlag from './graph/flag.vue'; import GraphDeployment from './graph/deployment.vue'; + import monitoringPaths from './monitoring_paths.vue'; import MonitoringMixin from '../mixins/monitoring_mixins'; import eventHub from '../event_hub'; import measurements from '../utils/measurements'; - import { formatRelevantDigits } from '../../lib/utils/number_utils'; import { timeScaleFormat } from '../utils/date_time_formatters'; + import createTimeSeries from '../utils/multiple_time_series'; import bp from '../../breakpoints'; const bisectDate = d3.bisector(d => d.time).left; @@ -36,32 +37,29 @@ data() { return { + baseGraphHeight: 450, + baseGraphWidth: 600, graphHeight: 450, graphWidth: 600, graphHeightOffset: 120, - xScale: {}, - yScale: {}, margin: {}, - data: [], unitOfDisplay: '', areaColorRgb: '#8fbce8', lineColorRgb: '#1f78d1', yAxisLabel: '', legendTitle: '', reducedDeploymentData: [], - area: '', - line: '', measurements: measurements.large, currentData: { time: new Date(), value: 0, }, - currentYCoordinate: 0, + currentDataIndex: 0, currentXCoordinate: 0, currentFlagPosition: 0, - metricUsage: '', showFlag: false, showDeployInfo: true, + timeSeries: [], }; }, @@ -69,16 +67,17 @@ GraphLegend, GraphFlag, GraphDeployment, + monitoringPaths, }, computed: { outterViewBox() { - return `0 0 ${this.graphWidth} ${this.graphHeight}`; + return `0 0 ${this.baseGraphWidth} ${this.baseGraphHeight}`; }, innerViewBox() { - if ((this.graphWidth - 150) > 0) { - return `0 0 ${this.graphWidth - 150} ${this.graphHeight}`; + if ((this.baseGraphWidth - 150) > 0) { + return `0 0 ${this.baseGraphWidth - 150} ${this.baseGraphHeight}`; } return '0 0 0 0'; }, @@ -89,7 +88,7 @@ paddingBottomRootSvg() { return { - paddingBottom: `${(Math.ceil(this.graphHeight * 100) / this.graphWidth) || 0}%`, + paddingBottom: `${(Math.ceil(this.baseGraphHeight * 100) / this.baseGraphWidth) || 0}%`, }; }, }, @@ -104,17 +103,16 @@ this.margin = measurements.small.margin; this.measurements = measurements.small; } - this.data = query.result[0].values; this.unitOfDisplay = query.unit || ''; this.yAxisLabel = this.graphData.y_label || 'Values'; this.legendTitle = query.label || 'Average'; this.graphWidth = this.$refs.baseSvg.clientWidth - this.margin.left - this.margin.right; this.graphHeight = this.graphHeight - this.margin.top - this.margin.bottom; - if (this.data !== undefined) { - this.renderAxesPaths(); - this.formatDeployments(); - } + this.baseGraphHeight = this.graphHeight; + this.baseGraphWidth = this.graphWidth; + this.renderAxesPaths(); + this.formatDeployments(); }, handleMouseOverGraph(e) { @@ -123,16 +121,17 @@ point.y = e.clientY; point = point.matrixTransform(this.$refs.graphData.getScreenCTM().inverse()); point.x = point.x += 7; - const timeValueOverlay = this.xScale.invert(point.x); - const overlayIndex = bisectDate(this.data, timeValueOverlay, 1); - const d0 = this.data[overlayIndex - 1]; - const d1 = this.data[overlayIndex]; + const firstTimeSeries = this.timeSeries[0]; + const timeValueOverlay = firstTimeSeries.timeSeriesScaleX.invert(point.x); + const overlayIndex = bisectDate(firstTimeSeries.values, timeValueOverlay, 1); + const d0 = firstTimeSeries.values[overlayIndex - 1]; + const d1 = firstTimeSeries.values[overlayIndex]; if (d0 === undefined || d1 === undefined) return; const evalTime = timeValueOverlay - d0[0] > d1[0] - timeValueOverlay; this.currentData = evalTime ? d1 : d0; - this.currentXCoordinate = Math.floor(this.xScale(this.currentData.time)); + this.currentDataIndex = evalTime ? overlayIndex : (overlayIndex - 1); + this.currentXCoordinate = Math.floor(firstTimeSeries.timeSeriesScaleX(this.currentData.time)); const currentDeployXPos = this.mouseOverDeployInfo(point.x); - this.currentYCoordinate = this.yScale(this.currentData.value); if (this.currentXCoordinate > (this.graphWidth - 200)) { this.currentFlagPosition = this.currentXCoordinate - 103; @@ -145,17 +144,25 @@ } else { this.showFlag = true; } - - this.metricUsage = `${formatRelevantDigits(this.currentData.value)} ${this.unitOfDisplay}`; }, renderAxesPaths() { + this.timeSeries = createTimeSeries(this.graphData.queries[0].result, + this.graphWidth, + this.graphHeight, + this.graphHeightOffset); + + if (this.timeSeries.length > 3) { + this.baseGraphHeight = this.baseGraphHeight += (this.timeSeries.length - 3) * 20; + } + const axisXScale = d3.time.scale() .range([0, this.graphWidth]); - this.yScale = d3.scale.linear() + const axisYScale = d3.scale.linear() .range([this.graphHeight - this.graphHeightOffset, 0]); - axisXScale.domain(d3.extent(this.data, d => d.time)); - this.yScale.domain([0, d3.max(this.data.map(d => d.value))]); + + axisXScale.domain(d3.extent(this.timeSeries[0].values, d => d.time)); + axisYScale.domain([0, d3.max(this.timeSeries[0].values.map(d => d.value))]); const xAxis = d3.svg.axis() .scale(axisXScale) @@ -164,7 +171,7 @@ .orient('bottom'); const yAxis = d3.svg.axis() - .scale(this.yScale) + .scale(axisYScale) .ticks(measurements.yTicks) .orient('left'); @@ -180,25 +187,6 @@ .attr('class', 'axis-tick'); } // Avoid adding the class to the first tick, to prevent coloring }); // This will select all of the ticks once they're rendered - - this.xScale = d3.time.scale() - .range([0, this.graphWidth - 70]); - - this.xScale.domain(d3.extent(this.data, d => d.time)); - - const areaFunction = d3.svg.area() - .x(d => this.xScale(d.time)) - .y0(this.graphHeight - this.graphHeightOffset) - .y1(d => this.yScale(d.value)) - .interpolate('linear'); - - const lineFunction = d3.svg.line() - .x(d => this.xScale(d.time)) - .y(d => this.yScale(d.value)); - - this.line = lineFunction(this.data); - - this.area = areaFunction(this.data); }, }, @@ -245,30 +233,25 @@ :graph-height="graphHeight" :margin="margin" :measurements="measurements" - :area-color-rgb="areaColorRgb" :legend-title="legendTitle" :y-axis-label="yAxisLabel" - :metric-usage="metricUsage" + :time-series="timeSeries" + :unit-of-display="unitOfDisplay" + :current-data-index="currentDataIndex" /> <svg class="graph-data" :viewBox="innerViewBox" ref="graphData"> - <path - class="metric-area" - :d="area" - :fill="areaColorRgb" - transform="translate(-5, 20)"> - </path> - <path - class="metric-line" - :d="line" - :stroke="lineColorRgb" - fill="none" - stroke-width="2" - transform="translate(-5, 20)"> - </path> - <graph-deployment + <monitoring-paths + v-for="(path, index) in timeSeries" + :key="index" + :generated-line-path="path.linePath" + :generated-area-path="path.areaPath" + :line-color="path.lineColor" + :area-color="path.areaColor" + /> + <monitoring-deployment :show-deploy-info="showDeployInfo" :deployment-data="reducedDeploymentData" :graph-height="graphHeight" @@ -277,7 +260,6 @@ <graph-flag v-if="showFlag" :current-x-coordinate="currentXCoordinate" - :current-y-coordinate="currentYCoordinate" :current-data="currentData" :current-flag-position="currentFlagPosition" :graph-height="graphHeight" diff --git a/app/assets/javascripts/monitoring/components/graph/flag.vue b/app/assets/javascripts/monitoring/components/graph/flag.vue index c4d4647d240..a98e3d06c18 100644 --- a/app/assets/javascripts/monitoring/components/graph/flag.vue +++ b/app/assets/javascripts/monitoring/components/graph/flag.vue @@ -7,10 +7,6 @@ type: Number, required: true, }, - currentYCoordinate: { - type: Number, - required: true, - }, currentFlagPosition: { type: Number, required: true, @@ -60,16 +56,7 @@ :y2="calculatedHeight" transform="translate(-5, 20)"> </line> - <circle - class="circle-metric" - :fill="circleColorRgb" - stroke="#000" - :cx="currentXCoordinate" - :cy="currentYCoordinate" - r="5" - transform="translate(-5, 20)"> - </circle> - <svg + <svg class="rect-text-metric" :x="currentFlagPosition" y="0"> diff --git a/app/assets/javascripts/monitoring/components/graph/legend.vue b/app/assets/javascripts/monitoring/components/graph/legend.vue index d08f9cbffd4..a43dad8e601 100644 --- a/app/assets/javascripts/monitoring/components/graph/legend.vue +++ b/app/assets/javascripts/monitoring/components/graph/legend.vue @@ -1,4 +1,6 @@ <script> + import { formatRelevantDigits } from '../../../lib/utils/number_utils'; + export default { props: { graphWidth: { @@ -17,10 +19,6 @@ type: Object, required: true, }, - areaColorRgb: { - type: String, - required: true, - }, legendTitle: { type: String, required: true, @@ -29,15 +27,25 @@ type: String, required: true, }, - metricUsage: { + timeSeries: { + type: Array, + required: true, + }, + unitOfDisplay: { type: String, required: true, }, + currentDataIndex: { + type: Number, + required: true, + }, }, data() { return { yLabelWidth: 0, yLabelHeight: 0, + seriesXPosition: 0, + metricUsageXPosition: 0, }; }, computed: { @@ -63,10 +71,28 @@ yPosition() { return ((this.graphHeight - this.margin.top) + this.measurements.axisLabelLineOffset) || 0; }, + + }, + methods: { + translateLegendGroup(index) { + return `translate(0, ${12 * (index)})`; + }, + + formatMetricUsage(series) { + return `${formatRelevantDigits(series.values[this.currentDataIndex].value)} ${this.unitOfDisplay}`; + }, }, mounted() { this.$nextTick(() => { const bbox = this.$refs.ylabel.getBBox(); + this.metricUsageXPosition = 0; + this.seriesXPosition = 0; + if (this.$refs.legendTitleSvg != null) { + this.seriesXPosition = this.$refs.legendTitleSvg[0].getBBox().width; + } + if (this.$refs.seriesTitleSvg != null) { + this.metricUsageXPosition = this.$refs.seriesTitleSvg[0].getBBox().width; + } this.yLabelWidth = bbox.width + 10; // Added some padding this.yLabelHeight = bbox.height + 5; }); @@ -121,24 +147,33 @@ dy=".35em"> Time </text> - <rect - :fill="areaColorRgb" - :width="measurements.legends.width" - :height="measurements.legends.height" - x="20" - :y="graphHeight - measurements.legendOffset"> - </rect> - <text - class="text-metric-title" - x="50" - :y="graphHeight - 25"> - {{legendTitle}} - </text> - <text - class="text-metric-usage" - x="50" - :y="graphHeight - 10"> - {{metricUsage}} - </text> + <g class="legend-group" + v-for="(series, index) in timeSeries" + :key="index" + :transform="translateLegendGroup(index)"> + <rect + :fill="series.areaColor" + :width="measurements.legends.width" + :height="measurements.legends.height" + x="20" + :y="graphHeight - measurements.legendOffset"> + </rect> + <text + v-if="timeSeries.length > 1" + class="legend-metric-title" + ref="legendTitleSvg" + x="38" + :y="graphHeight - 30"> + {{legendTitle}} Series {{index + 1}} {{formatMetricUsage(series)}} + </text> + <text + v-else + class="legend-metric-title" + ref="legendTitleSvg" + x="38" + :y="graphHeight - 30"> + {{legendTitle}} {{formatMetricUsage(series)}} + </text> + </g> </g> </template> diff --git a/app/assets/javascripts/monitoring/components/monitoring_paths.vue b/app/assets/javascripts/monitoring/components/monitoring_paths.vue new file mode 100644 index 00000000000..043f1bf66bb --- /dev/null +++ b/app/assets/javascripts/monitoring/components/monitoring_paths.vue @@ -0,0 +1,40 @@ +<script> + export default { + props: { + generatedLinePath: { + type: String, + required: true, + }, + generatedAreaPath: { + type: String, + required: true, + }, + lineColor: { + type: String, + required: true, + }, + areaColor: { + type: String, + required: true, + }, + }, + }; +</script> +<template> + <g> + <path + class="metric-area" + :d="generatedAreaPath" + :fill="areaColor" + transform="translate(-5, 20)"> + </path> + <path + class="metric-line" + :d="generatedLinePath" + :stroke="lineColor" + fill="none" + stroke-width="1" + transform="translate(-5, 20)"> + </path> + </g> +</template> diff --git a/app/assets/javascripts/monitoring/mixins/monitoring_mixins.js b/app/assets/javascripts/monitoring/mixins/monitoring_mixins.js index 8e62fa63f13..345a0b37a76 100644 --- a/app/assets/javascripts/monitoring/mixins/monitoring_mixins.js +++ b/app/assets/javascripts/monitoring/mixins/monitoring_mixins.js @@ -21,9 +21,9 @@ const mixins = { formatDeployments() { this.reducedDeploymentData = this.deploymentData.reduce((deploymentDataArray, deployment) => { const time = new Date(deployment.created_at); - const xPos = Math.floor(this.xScale(time)); + const xPos = Math.floor(this.timeSeries[0].timeSeriesScaleX(time)); - time.setSeconds(this.data[0].time.getSeconds()); + time.setSeconds(this.timeSeries[0].values[0].time.getSeconds()); if (xPos >= 0) { deploymentDataArray.push({ diff --git a/app/assets/javascripts/monitoring/stores/monitoring_store.js b/app/assets/javascripts/monitoring/stores/monitoring_store.js index 737c964f12e..0a4cdd88044 100644 --- a/app/assets/javascripts/monitoring/stores/monitoring_store.js +++ b/app/assets/javascripts/monitoring/stores/monitoring_store.js @@ -1,46 +1,52 @@ import _ from 'underscore'; -class MonitoringStore { +function sortMetrics(metrics) { + return _.chain(metrics).sortBy('weight').sortBy('title').value(); +} + +function normalizeMetrics(metrics) { + return metrics.map(metric => ({ + ...metric, + queries: metric.queries.map(query => ({ + ...query, + result: query.result.map(result => ({ + ...result, + values: result.values.map(([timestamp, value]) => ({ + time: new Date(timestamp * 1000), + value, + })), + })), + })), + })); +} + +function collate(array, rows = 2) { + const collatedArray = []; + let row = []; + array.forEach((value, index) => { + row.push(value); + if ((index + 1) % rows === 0) { + collatedArray.push(row); + row = []; + } + }); + if (row.length > 0) { + collatedArray.push(row); + } + return collatedArray; +} + +export default class MonitoringStore { constructor() { this.groups = []; this.deploymentData = []; } - // eslint-disable-next-line class-methods-use-this - createArrayRows(metrics = []) { - const currentMetrics = metrics; - const availableMetrics = []; - let metricsRow = []; - let index = 1; - Object.keys(currentMetrics).forEach((key) => { - const metricValues = currentMetrics[key].queries[0].result[0].values; - if (metricValues != null) { - const literalMetrics = metricValues.map(metric => ({ - time: new Date(metric[0] * 1000), - value: metric[1], - })); - currentMetrics[key].queries[0].result[0].values = literalMetrics; - metricsRow.push(currentMetrics[key]); - if (index % 2 === 0) { - availableMetrics.push(metricsRow); - metricsRow = []; - } - index = index += 1; - } - }); - if (metricsRow.length > 0) { - availableMetrics.push(metricsRow); - } - return availableMetrics; - } - storeMetrics(groups = []) { - this.groups = groups.map((group) => { - const currentGroup = group; - currentGroup.metrics = _.chain(group.metrics).sortBy('weight').sortBy('title').value(); - currentGroup.metrics = this.createArrayRows(currentGroup.metrics); - return currentGroup; - }); + this.groups = groups.map(group => ({ + ...group, + metrics: collate(normalizeMetrics(sortMetrics(group.metrics))), + })); } storeDeploymentData(deploymentData = []) { @@ -57,5 +63,3 @@ class MonitoringStore { return metricsCount; } } - -export default MonitoringStore; diff --git a/app/assets/javascripts/monitoring/utils/measurements.js b/app/assets/javascripts/monitoring/utils/measurements.js index 62cd19c86e1..ee3c45efacc 100644 --- a/app/assets/javascripts/monitoring/utils/measurements.js +++ b/app/assets/javascripts/monitoring/utils/measurements.js @@ -7,15 +7,15 @@ export default { left: 40, }, legends: { - width: 15, - height: 25, + width: 10, + height: 3, }, backgroundLegend: { width: 30, height: 50, }, axisLabelLineOffset: -20, - legendOffset: 35, + legendOffset: 33, }, large: { // This covers both md and lg screen sizes margin: { @@ -25,15 +25,15 @@ export default { left: 80, }, legends: { - width: 20, - height: 30, + width: 15, + height: 3, }, backgroundLegend: { width: 30, height: 150, }, axisLabelLineOffset: 20, - legendOffset: 38, + legendOffset: 36, }, xTicks: 8, yTicks: 3, diff --git a/app/assets/javascripts/monitoring/utils/multiple_time_series.js b/app/assets/javascripts/monitoring/utils/multiple_time_series.js new file mode 100644 index 00000000000..05d551e917c --- /dev/null +++ b/app/assets/javascripts/monitoring/utils/multiple_time_series.js @@ -0,0 +1,80 @@ +import d3 from 'd3'; +import _ from 'underscore'; + +export default function createTimeSeries(seriesData, graphWidth, graphHeight, graphHeightOffset) { + const maxValues = seriesData.map((timeSeries, index) => { + const maxValue = d3.max(timeSeries.values.map(d => d.value)); + return { + maxValue, + index, + }; + }); + + const maxValueFromSeries = _.max(maxValues, val => val.maxValue); + + let timeSeriesNumber = 1; + let lineColor = '#1f78d1'; + let areaColor = '#8fbce8'; + return seriesData.map((timeSeries) => { + const timeSeriesScaleX = d3.time.scale() + .range([0, graphWidth - 70]); + + const timeSeriesScaleY = d3.scale.linear() + .range([graphHeight - graphHeightOffset, 0]); + + timeSeriesScaleX.domain(d3.extent(timeSeries.values, d => d.time)); + timeSeriesScaleY.domain([0, maxValueFromSeries.maxValue]); + + const lineFunction = d3.svg.line() + .x(d => timeSeriesScaleX(d.time)) + .y(d => timeSeriesScaleY(d.value)); + + const areaFunction = d3.svg.area() + .x(d => timeSeriesScaleX(d.time)) + .y0(graphHeight - graphHeightOffset) + .y1(d => timeSeriesScaleY(d.value)) + .interpolate('linear'); + + switch (timeSeriesNumber) { + case 1: + lineColor = '#1f78d1'; + areaColor = '#8fbce8'; + break; + case 2: + lineColor = '#fc9403'; + areaColor = '#feca81'; + break; + case 3: + lineColor = '#db3b21'; + areaColor = '#ed9d90'; + break; + case 4: + lineColor = '#1aaa55'; + areaColor = '#8dd5aa'; + break; + case 5: + lineColor = '#6666c4'; + areaColor = '#d1d1f0'; + break; + default: + lineColor = '#1f78d1'; + areaColor = '#8fbce8'; + break; + } + + if (timeSeriesNumber <= 5) { + timeSeriesNumber = timeSeriesNumber += 1; + } else { + timeSeriesNumber = 1; + } + + return { + linePath: lineFunction(timeSeries.values), + areaPath: areaFunction(timeSeries.values), + timeSeriesScaleX, + values: timeSeries.values, + lineColor, + areaColor, + }; + }); +} diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index b38a6abc8d1..a09270d6d24 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -464,7 +464,6 @@ export default class Notes { } renderDiscussionAvatar(diffAvatarContainer, noteEntity) { - var commentButton = diffAvatarContainer.find('.js-add-diff-note-button'); var avatarHolder = diffAvatarContainer.find('.diff-comment-avatar-holders'); if (!avatarHolder.length) { @@ -475,10 +474,6 @@ export default class Notes { gl.diffNotesCompileComponents(); } - - if (commentButton.length) { - commentButton.remove(); - } } /** @@ -767,6 +762,7 @@ export default class Notes { var $note, $notes; $note = $(el); $notes = $note.closest('.discussion-notes'); + const discussionId = $('.notes', $notes).data('discussion-id'); if (typeof gl.diffNotesCompileComponents !== 'undefined') { if (gl.diffNoteApps[noteElId]) { @@ -783,6 +779,8 @@ export default class Notes { // "Discussions" tab $notes.closest('.timeline-entry').remove(); + $(`.js-diff-avatars-${discussionId}`).trigger('remove.vue'); + // The notes tr can contain multiple lists of notes, like on the parallel diff if (notesTr.find('.discussion-notes').length > 1) { $notes.remove(); diff --git a/app/assets/javascripts/project.js b/app/assets/javascripts/project.js index d7e3ab42f00..fe6602259e2 100644 --- a/app/assets/javascripts/project.js +++ b/app/assets/javascripts/project.js @@ -53,10 +53,6 @@ import Cookies from 'js-cookie'; return _this.changeProject($(e.currentTarget).val()); }; })(this)); - return $('.js-projects-dropdown-toggle').on('click', function(e) { - e.preventDefault(); - return $('.js-projects-dropdown').select2('open'); - }); }; Project.prototype.changeProject = function(url) { diff --git a/app/assets/javascripts/project_select.js b/app/assets/javascripts/project_select.js index 1b4ed6be90a..fb01390f91c 100644 --- a/app/assets/javascripts/project_select.js +++ b/app/assets/javascripts/project_select.js @@ -5,48 +5,6 @@ import ProjectSelectComboButton from './project_select_combo_button'; (function() { this.ProjectSelect = (function() { function ProjectSelect() { - $('.js-projects-dropdown-toggle').each(function(i, dropdown) { - var $dropdown; - $dropdown = $(dropdown); - return $dropdown.glDropdown({ - filterable: true, - filterRemote: true, - search: { - fields: ['name_with_namespace'] - }, - data: function(term, callback) { - var finalCallback, projectsCallback; - var orderBy = $dropdown.data('order-by'); - finalCallback = function(projects) { - return callback(projects); - }; - if (this.includeGroups) { - projectsCallback = function(projects) { - var groupsCallback; - groupsCallback = function(groups) { - var data; - data = groups.concat(projects); - return finalCallback(data); - }; - return Api.groups(term, {}, groupsCallback); - }; - } else { - projectsCallback = finalCallback; - } - if (this.groupId) { - return Api.groupProjects(this.groupId, term, projectsCallback); - } else { - return Api.projects(term, { order_by: orderBy }, projectsCallback); - } - }, - url: function(project) { - return project.web_url; - }, - text: function(project) { - return project.name_with_namespace; - } - }); - }); $('.ajax-project-select').each(function(i, select) { var placeholder; this.groupId = $(select).data('group-id'); diff --git a/app/assets/javascripts/projects_dropdown/components/app.vue b/app/assets/javascripts/projects_dropdown/components/app.vue new file mode 100644 index 00000000000..7606605be32 --- /dev/null +++ b/app/assets/javascripts/projects_dropdown/components/app.vue @@ -0,0 +1,157 @@ +<script> +import bs from '../../breakpoints'; +import eventHub from '../event_hub'; +import loadingIcon from '../../vue_shared/components/loading_icon.vue'; + +import projectsListFrequent from './projects_list_frequent.vue'; +import projectsListSearch from './projects_list_search.vue'; + +import search from './search.vue'; + +export default { + components: { + search, + loadingIcon, + projectsListFrequent, + projectsListSearch, + }, + props: { + currentProject: { + type: Object, + required: true, + }, + store: { + type: Object, + required: true, + }, + service: { + type: Object, + required: true, + }, + }, + data() { + return { + isLoadingProjects: false, + isFrequentsListVisible: false, + isSearchListVisible: false, + isLocalStorageFailed: false, + isSearchFailed: false, + searchQuery: '', + }; + }, + computed: { + frequentProjects() { + return this.store.getFrequentProjects(); + }, + searchProjects() { + return this.store.getSearchedProjects(); + }, + }, + methods: { + toggleFrequentProjectsList(state) { + this.isLoadingProjects = !state; + this.isSearchListVisible = !state; + this.isFrequentsListVisible = state; + }, + toggleSearchProjectsList(state) { + this.isLoadingProjects = !state; + this.isFrequentsListVisible = !state; + this.isSearchListVisible = state; + }, + toggleLoader(state) { + this.isFrequentsListVisible = !state; + this.isSearchListVisible = !state; + this.isLoadingProjects = state; + }, + fetchFrequentProjects() { + const screenSize = bs.getBreakpointSize(); + if (this.searchQuery && (screenSize !== 'sm' && screenSize !== 'xs')) { + this.toggleSearchProjectsList(true); + } else { + this.toggleLoader(true); + this.isLocalStorageFailed = false; + const projects = this.service.getFrequentProjects(); + if (projects) { + this.toggleFrequentProjectsList(true); + this.store.setFrequentProjects(projects); + } else { + this.isLocalStorageFailed = true; + this.toggleFrequentProjectsList(true); + this.store.setFrequentProjects([]); + } + } + }, + fetchSearchedProjects(searchQuery) { + this.searchQuery = searchQuery; + this.toggleLoader(true); + this.service.getSearchedProjects(this.searchQuery) + .then(res => res.json()) + .then((results) => { + this.toggleSearchProjectsList(true); + this.store.setSearchedProjects(results); + }) + .catch(() => { + this.isSearchFailed = true; + this.toggleSearchProjectsList(true); + }); + }, + logCurrentProjectAccess() { + this.service.logProjectAccess(this.currentProject); + }, + handleSearchClear() { + this.searchQuery = ''; + this.toggleFrequentProjectsList(true); + this.store.clearSearchedProjects(); + }, + handleSearchFailure() { + this.isSearchFailed = true; + this.toggleSearchProjectsList(true); + }, + }, + created() { + if (this.currentProject.id) { + this.logCurrentProjectAccess(); + } + + eventHub.$on('dropdownOpen', this.fetchFrequentProjects); + eventHub.$on('searchProjects', this.fetchSearchedProjects); + eventHub.$on('searchCleared', this.handleSearchClear); + eventHub.$on('searchFailed', this.handleSearchFailure); + }, + beforeDestroy() { + eventHub.$off('dropdownOpen', this.fetchFrequentProjects); + eventHub.$off('searchProjects', this.fetchSearchedProjects); + eventHub.$off('searchCleared', this.handleSearchClear); + eventHub.$off('searchFailed', this.handleSearchFailure); + }, +}; +</script> + +<template> + <div> + <search/> + <loading-icon + class="loading-animation prepend-top-20" + size="2" + v-if="isLoadingProjects" + :label="s__('ProjectsDropdown|Loading projects')" + /> + <div + class="section-header" + v-if="isFrequentsListVisible" + > + {{ s__('ProjectsDropdown|Frequently visited') }} + </div> + <projects-list-frequent + v-if="isFrequentsListVisible" + :local-storage-failed="isLocalStorageFailed" + :projects="frequentProjects" + /> + <projects-list-search + v-if="isSearchListVisible" + :search-failed="isSearchFailed" + :matcher="searchQuery" + :projects="searchProjects" + /> + </div> +</template> diff --git a/app/assets/javascripts/projects_dropdown/components/projects_list_frequent.vue b/app/assets/javascripts/projects_dropdown/components/projects_list_frequent.vue new file mode 100644 index 00000000000..093554cd0bc --- /dev/null +++ b/app/assets/javascripts/projects_dropdown/components/projects_list_frequent.vue @@ -0,0 +1,57 @@ +<script> +import { s__ } from '../../locale'; +import projectsListItem from './projects_list_item.vue'; + +export default { + components: { + projectsListItem, + }, + props: { + projects: { + type: Array, + required: true, + }, + localStorageFailed: { + type: Boolean, + required: true, + }, + }, + computed: { + isListEmpty() { + return this.projects.length === 0; + }, + listEmptyMessage() { + return this.localStorageFailed ? + s__('ProjectsDropdown|This feature requires browser localStorage support') : + s__('ProjectsDropdown|Projects you visit often will appear here'); + }, + }, +}; +</script> + +<template> + <div + class="projects-list-frequent-container" + > + <ul + class="list-unstyled" + > + <li + class="section-empty" + v-if="isListEmpty" + > + {{listEmptyMessage}} + </li> + <projects-list-item + v-else + v-for="(project, index) in projects" + :key="index" + :project-id="project.id" + :project-name="project.name" + :namespace="project.namespace" + :web-url="project.webUrl" + :avatar-url="project.avatarUrl" + /> + </ul> + </div> +</template> diff --git a/app/assets/javascripts/projects_dropdown/components/projects_list_item.vue b/app/assets/javascripts/projects_dropdown/components/projects_list_item.vue new file mode 100644 index 00000000000..fe5179de206 --- /dev/null +++ b/app/assets/javascripts/projects_dropdown/components/projects_list_item.vue @@ -0,0 +1,96 @@ +<script> +import identicon from '../../vue_shared/components/identicon.vue'; + +export default { + components: { + identicon, + }, + props: { + matcher: { + type: String, + required: false, + }, + projectId: { + type: Number, + required: true, + }, + projectName: { + type: String, + required: true, + }, + namespace: { + type: String, + required: true, + }, + webUrl: { + type: String, + required: true, + }, + avatarUrl: { + required: true, + validator(value) { + return value === null || typeof value === 'string'; + }, + }, + }, + computed: { + hasAvatar() { + return this.avatarUrl !== null; + }, + highlightedProjectName() { + if (this.matcher) { + const matcherRegEx = new RegExp(this.matcher, 'gi'); + const matches = this.projectName.match(matcherRegEx); + + if (matches && matches.length > 0) { + return this.projectName.replace(matches[0], `<b>${matches[0]}</b>`); + } + } + return this.projectName; + }, + }, +}; +</script> + +<template> + <li + class="projects-list-item-container" + > + <a + class="clearfix" + :href="webUrl" + > + <div + class="project-item-avatar-container" + > + <img + v-if="hasAvatar" + class="avatar s32" + :src="avatarUrl" + /> + <identicon + v-else + size-class="s32" + :entity-id=projectId + :entity-name="projectName" + /> + </div> + <div + class="project-item-metadata-container" + > + <div + class="project-title" + :title="projectName" + v-html="highlightedProjectName" + > + </div> + <div + class="project-namespace" + :title="namespace" + > + {{namespace}} + </div> + </div> + </a> + </li> +</template> diff --git a/app/assets/javascripts/projects_dropdown/components/projects_list_search.vue b/app/assets/javascripts/projects_dropdown/components/projects_list_search.vue new file mode 100644 index 00000000000..fa5efef2919 --- /dev/null +++ b/app/assets/javascripts/projects_dropdown/components/projects_list_search.vue @@ -0,0 +1,63 @@ +<script> +import { s__ } from '../../locale'; +import projectsListItem from './projects_list_item.vue'; + +export default { + components: { + projectsListItem, + }, + props: { + matcher: { + type: String, + required: true, + }, + projects: { + type: Array, + required: true, + }, + searchFailed: { + type: Boolean, + required: true, + }, + }, + computed: { + isListEmpty() { + return this.projects.length === 0; + }, + listEmptyMessage() { + return this.searchFailed ? + s__('ProjectsDropdown|Something went wrong on our end.') : + s__('ProjectsDropdown|No projects matched your query'); + }, + }, +}; +</script> + +<template> + <div + class="projects-list-search-container" + > + <ul + class="list-unstyled" + > + <li + v-if="isListEmpty" + :class="{ 'section-failure': searchFailed }" + class="section-empty" + > + {{ listEmptyMessage }} + </li> + <projects-list-item + v-else + v-for="(project, index) in projects" + :key="index" + :project-id="project.id" + :project-name="project.name" + :namespace="project.namespace" + :web-url="project.webUrl" + :avatar-url="project.avatarUrl" + :matcher="matcher" + /> + </ul> + </div> +</template> diff --git a/app/assets/javascripts/projects_dropdown/components/search.vue b/app/assets/javascripts/projects_dropdown/components/search.vue new file mode 100644 index 00000000000..b71997234e5 --- /dev/null +++ b/app/assets/javascripts/projects_dropdown/components/search.vue @@ -0,0 +1,64 @@ +<script> +import _ from 'underscore'; +import eventHub from '../event_hub'; + +export default { + data() { + return { + searchQuery: '', + }; + }, + watch: { + searchQuery() { + this.handleInput(); + }, + }, + methods: { + setFocus() { + this.$refs.search.focus(); + }, + emitSearchEvents() { + if (this.searchQuery) { + eventHub.$emit('searchProjects', this.searchQuery); + } else { + eventHub.$emit('searchCleared'); + } + }, + /** + * Callback function within _.debounce is intentionally + * kept as ES5 `function() {}` instead of ES6 `() => {}` + * as it otherwise messes up function context + * and component reference is no longer accessible via `this` + */ + // eslint-disable-next-line func-names + handleInput: _.debounce(function () { + this.emitSearchEvents(); + }, 500), + }, + mounted() { + eventHub.$on('dropdownOpen', this.setFocus); + }, + beforeDestroy() { + eventHub.$off('dropdownOpen', this.setFocus); + }, +}; +</script> + +<template> + <div + class="search-input-container hidden-xs" + > + <input + type="search" + class="form-control" + ref="search" + v-model="searchQuery" + :placeholder="s__('ProjectsDropdown|Search projects')" + /> + <i + v-if="!searchQuery" + class="search-icon fa fa-fw fa-search" + aria-hidden="true" + /> + </div> +</template> diff --git a/app/assets/javascripts/projects_dropdown/constants.js b/app/assets/javascripts/projects_dropdown/constants.js new file mode 100644 index 00000000000..8937097184c --- /dev/null +++ b/app/assets/javascripts/projects_dropdown/constants.js @@ -0,0 +1,10 @@ +export const FREQUENT_PROJECTS = { + MAX_COUNT: 20, + LIST_COUNT_DESKTOP: 5, + LIST_COUNT_MOBILE: 3, + ELIGIBLE_FREQUENCY: 3, +}; + +export const HOUR_IN_MS = 3600000; + +export const STORAGE_KEY = 'frequent-projects'; diff --git a/app/assets/javascripts/projects_dropdown/event_hub.js b/app/assets/javascripts/projects_dropdown/event_hub.js new file mode 100644 index 00000000000..0948c2e5352 --- /dev/null +++ b/app/assets/javascripts/projects_dropdown/event_hub.js @@ -0,0 +1,3 @@ +import Vue from 'vue'; + +export default new Vue(); diff --git a/app/assets/javascripts/projects_dropdown/index.js b/app/assets/javascripts/projects_dropdown/index.js new file mode 100644 index 00000000000..2660da3c558 --- /dev/null +++ b/app/assets/javascripts/projects_dropdown/index.js @@ -0,0 +1,68 @@ +import Vue from 'vue'; + +import Translate from '../vue_shared/translate'; +import eventHub from './event_hub'; +import ProjectsService from './service/projects_service'; +import ProjectsStore from './store/projects_store'; + +import projectsDropdownApp from './components/app.vue'; + +Vue.use(Translate); + +document.addEventListener('DOMContentLoaded', () => { + const el = document.getElementById('js-projects-dropdown'); + const navEl = document.getElementById('nav-projects-dropdown'); + + // Don't do anything if element doesn't exist (No projects dropdown) + // This is for when the user accesses GitLab without logging in + if (!el || !navEl) { + return; + } + + $(navEl).on('show.bs.dropdown', (e) => { + const dropdownEl = $(e.currentTarget).find('.projects-dropdown-menu'); + dropdownEl.one('transitionend', () => { + eventHub.$emit('dropdownOpen'); + }); + }); + + // eslint-disable-next-line no-new + new Vue({ + el, + components: { + projectsDropdownApp, + }, + data() { + const dataset = this.$options.el.dataset; + const store = new ProjectsStore(); + const service = new ProjectsService(dataset.userName); + + const project = { + id: Number(dataset.projectId), + name: dataset.projectName, + namespace: dataset.projectNamespace, + webUrl: dataset.projectWebUrl, + avatarUrl: dataset.projectAvatarUrl || null, + lastAccessedOn: Date.now(), + }; + + return { + store, + service, + state: store.state, + currentUserName: dataset.userName, + currentProject: project, + }; + }, + render(createElement) { + return createElement('projects-dropdown-app', { + props: { + currentUserName: this.currentUserName, + currentProject: this.currentProject, + store: this.store, + service: this.service, + }, + }); + }, + }); +}); diff --git a/app/assets/javascripts/projects_dropdown/service/projects_service.js b/app/assets/javascripts/projects_dropdown/service/projects_service.js new file mode 100644 index 00000000000..fad956b4c26 --- /dev/null +++ b/app/assets/javascripts/projects_dropdown/service/projects_service.js @@ -0,0 +1,132 @@ +import Vue from 'vue'; +import VueResource from 'vue-resource'; + +import bp from '../../breakpoints'; +import Api from '../../api'; +import AccessorUtilities from '../../lib/utils/accessor'; + +import { FREQUENT_PROJECTS, HOUR_IN_MS, STORAGE_KEY } from '../constants'; + +Vue.use(VueResource); + +export default class ProjectsService { + constructor(currentUserName) { + this.isLocalStorageAvailable = AccessorUtilities.isLocalStorageAccessSafe(); + this.currentUserName = currentUserName; + this.storageKey = `${this.currentUserName}/${STORAGE_KEY}`; + this.projectsPath = Vue.resource(Api.buildUrl(Api.projectsPath)); + } + + getSearchedProjects(searchQuery) { + return this.projectsPath.get({ + simple: false, + per_page: 20, + membership: !!gon.current_user_id, + order_by: 'last_activity_at', + search: searchQuery, + }); + } + + getFrequentProjects() { + if (this.isLocalStorageAvailable) { + return this.getTopFrequentProjects(); + } + return null; + } + + logProjectAccess(project) { + let matchFound = false; + let storedFrequentProjects; + + if (this.isLocalStorageAvailable) { + const storedRawProjects = localStorage.getItem(this.storageKey); + + // Check if there's any frequent projects list set + if (!storedRawProjects) { + // No frequent projects list set, set one up. + storedFrequentProjects = []; + storedFrequentProjects.push({ ...project, frequency: 1 }); + } else { + // Check if project is already present in frequents list + // When found, update metadata of it. + storedFrequentProjects = JSON.parse(storedRawProjects).map((projectItem) => { + if (projectItem.id === project.id) { + matchFound = true; + const diff = Math.abs(project.lastAccessedOn - projectItem.lastAccessedOn) / HOUR_IN_MS; + const updatedProject = { + ...project, + frequency: projectItem.frequency, + lastAccessedOn: projectItem.lastAccessedOn, + }; + + // Check if duration since last access of this project + // is over an hour + if (diff > 1) { + return { + ...updatedProject, + frequency: updatedProject.frequency + 1, + lastAccessedOn: Date.now(), + }; + } + + return { + ...updatedProject, + }; + } + + return projectItem; + }); + + // Check whether currently logged project is present in frequents list + if (!matchFound) { + // We always keep size of frequents collection to 20 projects + // out of which only 5 projects with + // highest value of `frequency` and most recent `lastAccessedOn` + // are shown in projects dropdown + if (storedFrequentProjects.length === FREQUENT_PROJECTS.MAX_COUNT) { + storedFrequentProjects.shift(); // Remove an item from head of array + } + + storedFrequentProjects.push({ ...project, frequency: 1 }); + } + } + + localStorage.setItem(this.storageKey, JSON.stringify(storedFrequentProjects)); + } + } + + getTopFrequentProjects() { + const storedFrequentProjects = JSON.parse(localStorage.getItem(this.storageKey)); + let frequentProjectsCount = FREQUENT_PROJECTS.LIST_COUNT_DESKTOP; + + if (!storedFrequentProjects) { + return []; + } + + if (bp.getBreakpointSize() === 'sm' || + bp.getBreakpointSize() === 'xs') { + frequentProjectsCount = FREQUENT_PROJECTS.LIST_COUNT_MOBILE; + } + + const frequentProjects = storedFrequentProjects + .filter(project => project.frequency >= FREQUENT_PROJECTS.ELIGIBLE_FREQUENCY); + + // Sort all frequent projects in decending order of frequency + // and then by lastAccessedOn with recent most first + frequentProjects.sort((projectA, projectB) => { + if (projectA.frequency < projectB.frequency) { + return 1; + } else if (projectA.frequency > projectB.frequency) { + return -1; + } else if (projectA.lastAccessedOn < projectB.lastAccessedOn) { + return 1; + } else if (projectA.lastAccessedOn > projectB.lastAccessedOn) { + return -1; + } + + return 0; + }); + + return _.first(frequentProjects, frequentProjectsCount); + } +} diff --git a/app/assets/javascripts/projects_dropdown/store/projects_store.js b/app/assets/javascripts/projects_dropdown/store/projects_store.js new file mode 100644 index 00000000000..ffefbe693f4 --- /dev/null +++ b/app/assets/javascripts/projects_dropdown/store/projects_store.js @@ -0,0 +1,33 @@ +export default class ProjectsStore { + constructor() { + this.state = {}; + this.state.frequentProjects = []; + this.state.searchedProjects = []; + } + + setFrequentProjects(rawProjects) { + this.state.frequentProjects = rawProjects; + } + + getFrequentProjects() { + return this.state.frequentProjects; + } + + setSearchedProjects(rawProjects) { + this.state.searchedProjects = rawProjects.map(rawProject => ({ + id: rawProject.id, + name: rawProject.name, + namespace: rawProject.name_with_namespace, + webUrl: rawProject.web_url, + avatarUrl: rawProject.avatar_url, + })); + } + + getSearchedProjects() { + return this.state.searchedProjects; + } + + clearSearchedProjects() { + this.state.searchedProjects = []; + } +} diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js index c05a76a3b4a..aaca42e3ebc 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js +++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js @@ -75,18 +75,20 @@ export default { class="btn btn-small inline"> Check out branch </a> - <span class="dropdown inline prepend-left-10"> + <span class="dropdown prepend-left-10"> <a - class="btn btn-xs dropdown-toggle" + class="btn btn-small inline dropdown-toggle" data-toggle="dropdown" aria-label="Download as" role="button"> <i class="fa fa-download" - aria-hidden="true" /> + aria-hidden="true"> + </i> <i class="fa fa-caret-down" - aria-hidden="true" /> + aria-hidden="true"> + </i> </a> <ul class="dropdown-menu dropdown-menu-align-right"> <li> diff --git a/app/assets/javascripts/vue_shared/components/identicon.vue b/app/assets/javascripts/vue_shared/components/identicon.vue index 0edd820743f..7cf2e029cf6 100644 --- a/app/assets/javascripts/vue_shared/components/identicon.vue +++ b/app/assets/javascripts/vue_shared/components/identicon.vue @@ -9,6 +9,11 @@ export default { type: String, required: true, }, + sizeClass: { + type: String, + required: false, + default: 's40', + }, }, computed: { /** @@ -38,7 +43,8 @@ export default { <template> <div - class="avatar s40 identicon" + class="avatar identicon" + :class="sizeClass" :style="identiconStyles"> {{identiconTitle}} </div> diff --git a/app/assets/stylesheets/framework/common.scss b/app/assets/stylesheets/framework/common.scss index 68a51c5a461..a85051642dd 100644 --- a/app/assets/stylesheets/framework/common.scss +++ b/app/assets/stylesheets/framework/common.scss @@ -21,6 +21,7 @@ .append-right-default { margin-right: $gl-padding; } .append-right-20 { margin-right: 20px; } .append-bottom-0 { margin-bottom: 0; } +.append-bottom-5 { margin-bottom: 5px; } .append-bottom-10 { margin-bottom: 10px; } .append-bottom-15 { margin-bottom: 15px; } .append-bottom-20 { margin-bottom: 20px; } diff --git a/app/assets/stylesheets/framework/dropdowns.scss b/app/assets/stylesheets/framework/dropdowns.scss index fad991f2c49..e65a78b8dc3 100644 --- a/app/assets/stylesheets/framework/dropdowns.scss +++ b/app/assets/stylesheets/framework/dropdowns.scss @@ -737,6 +737,8 @@ @mixin new-style-dropdown($selector: '') { #{$selector}.dropdown-menu, #{$selector}.dropdown-menu-nav { + margin-bottom: 24px; + li { display: block; padding: 0 1px; @@ -768,7 +770,7 @@ // make sure the text color is not overriden &.text-danger { - @extend .text-danger; + color: $brand-danger; } &.is-focused, @@ -777,6 +779,11 @@ &:focus { background-color: $dropdown-item-hover-bg; color: $gl-text-color; + + // make sure the text color is not overriden + &.text-danger { + color: $brand-danger; + } } &.is-active { @@ -822,3 +829,152 @@ } @include new-style-dropdown('.js-namespace-select + '); + +header.navbar-gitlab-new .header-content .dropdown-menu.projects-dropdown-menu { + padding: 0; + + @media (max-width: $screen-xs-max) { + display: table; + left: -50px; + min-width: 300px; + } +} + +.projects-dropdown-container { + display: flex; + flex-direction: row; + width: 500px; + height: 334px; + + .project-dropdown-sidebar, + .project-dropdown-content { + padding: 8px 0; + } + + .loading-animation { + color: $almost-black; + } + + .project-dropdown-sidebar { + width: 30%; + border-right: 1px solid $border-color; + } + + .project-dropdown-content { + position: relative; + width: 70%; + } + + @media (max-width: $screen-xs-max) { + flex-direction: column; + width: 100%; + height: auto; + flex: 1; + + .project-dropdown-sidebar, + .project-dropdown-content { + width: 100%; + } + + .project-dropdown-sidebar { + border-bottom: 1px solid $border-color; + border-right: 0; + } + } +} + +.projects-dropdown-container { + .projects-list-frequent-container, + .projects-list-search-container, { + padding: 8px 0; + overflow-y: auto; + } + + .section-header, + .projects-list-frequent-container li.section-empty, + .projects-list-search-container li.section-empty { + padding: 0 15px; + } + + .section-header, + .projects-list-frequent-container li.section-empty, + .projects-list-search-container li.section-empty { + color: $gl-text-color-secondary; + font-size: $gl-font-size; + } + + .projects-list-frequent-container, + .projects-list-search-container { + li.section-empty.section-failure { + color: $callout-danger-color; + } + } + + .search-input-container { + position: relative; + padding: 4px $gl-padding; + + .search-icon { + position: absolute; + top: 13px; + right: 25px; + color: $md-area-border; + } + } + + .section-header { + font-weight: 700; + margin-top: 8px; + } + + .projects-list-search-container { + height: 284px; + } + + @media (max-width: $screen-xs-max) { + .projects-list-frequent-container { + width: auto; + height: auto; + padding-bottom: 0; + } + } +} + +.projects-list-item-container { + .project-item-avatar-container + .project-item-metadata-container { + float: left; + } + + .project-title, + .project-namespace { + max-width: 250px; + overflow: hidden; + text-overflow: ellipsis; + } + + &:hover { + .project-item-avatar-container .avatar { + border-color: $md-area-border; + } + } + + .project-title { + font-size: $gl-font-size; + font-weight: 400; + line-height: 16px; + } + + .project-namespace { + margin-top: 4px; + font-size: 12px; + line-height: 12px; + color: $gl-text-color-secondary; + } + + @media (max-width: $screen-xs-max) { + .project-item-metadata-container { + float: none; + } + } +} diff --git a/app/assets/stylesheets/framework/selects.scss b/app/assets/stylesheets/framework/selects.scss index a39927eb0df..6c14e8b97e0 100644 --- a/app/assets/stylesheets/framework/selects.scss +++ b/app/assets/stylesheets/framework/selects.scss @@ -267,14 +267,26 @@ // TODO: change global style .ajax-project-dropdown, +.ajax-users-dropdown, +body[data-page="projects:edit"] #select2-drop, body[data-page="projects:new"] #select2-drop, +body[data-page="projects:merge_requests:edit"] #select2-drop, body[data-page="projects:blob:new"] #select2-drop, body[data-page="profiles:show"] #select2-drop, +body[data-page="admin:groups:show"] #select2-drop, +body[data-page="projects:issues:show"] #select2-drop, body[data-page="projects:blob:edit"] #select2-drop { &.select2-drop { + border: 1px solid $dropdown-border-color; + border-radius: $border-radius-base; color: $gl-text-color; } + &.select2-drop-above { + border-top: none; + margin-top: -4px; + } + .select2-results { .select2-no-results, .select2-searching, diff --git a/app/assets/stylesheets/pages/environments.scss b/app/assets/stylesheets/pages/environments.scss index e7c830cbc69..a52ac0d53e7 100644 --- a/app/assets/stylesheets/pages/environments.scss +++ b/app/assets/stylesheets/pages/environments.scss @@ -169,7 +169,7 @@ } .metric-area { - opacity: 0.8; + opacity: 0.25; } .prometheus-graph-overlay { @@ -251,8 +251,14 @@ font-weight: $gl-font-weight-bold; } - .label-axis-text, - .text-metric-usage { + .label-axis-text { + fill: $black; + font-weight: $gl-font-weight-normal; + font-size: 10px; + } + + .text-metric-usage, + .legend-metric-title { fill: $black; font-weight: $gl-font-weight-normal; font-size: 12px; diff --git a/app/assets/stylesheets/pages/issuable.scss b/app/assets/stylesheets/pages/issuable.scss index 6523376ccc3..9f2cb979518 100644 --- a/app/assets/stylesheets/pages/issuable.scss +++ b/app/assets/stylesheets/pages/issuable.scss @@ -617,6 +617,8 @@ } .issuable-actions { + @include new-style-dropdown; + padding-top: 10px; @media (min-width: $screen-sm-min) { diff --git a/app/assets/stylesheets/pages/issues.scss b/app/assets/stylesheets/pages/issues.scss index 0213e7aa9d9..e8ca5cedaee 100644 --- a/app/assets/stylesheets/pages/issues.scss +++ b/app/assets/stylesheets/pages/issues.scss @@ -143,8 +143,12 @@ ul.related-merge-requests > li { } } -.issue-form .select2-container { - width: 250px !important; +.issue-form { + @include new-style-dropdown; + + .select2-container { + width: 250px !important; + } } .issues-footer { diff --git a/app/assets/stylesheets/pages/note_form.scss b/app/assets/stylesheets/pages/note_form.scss index 8932cff22a8..5d7c85b16ef 100644 --- a/app/assets/stylesheets/pages/note_form.scss +++ b/app/assets/stylesheets/pages/note_form.scss @@ -23,6 +23,8 @@ .new-note, .note-edit-form { .note-form-actions { + @include new-style-dropdown; + position: relative; margin: $gl-padding 0 0; } diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index 19caefa1961..dd600a27545 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -800,8 +800,10 @@ pre.light-well { } } -.new_protected_branch, +.new-protected-branch, .new-protected-tag { + @include new-style-dropdown; + label { margin-top: 6px; font-weight: $gl-font-weight-normal; @@ -821,19 +823,9 @@ pre.light-well { .protected-branches-list, .protected-tags-list { - margin-bottom: 30px; - - a { - color: $gl-text-color; - - &:hover { - color: $gl-link-color; - } + @include new-style-dropdown; - &.is-active { - font-weight: $gl-font-weight-bold; - } - } + margin-bottom: 30px; .settings-message { margin: 0; diff --git a/app/controllers/concerns/issuable_collections.rb b/app/controllers/concerns/issuable_collections.rb index a34a82b7ba6..23909bd2d39 100644 --- a/app/controllers/concerns/issuable_collections.rb +++ b/app/controllers/concerns/issuable_collections.rb @@ -36,6 +36,34 @@ module IssuableCollections @merge_requests_finder ||= issuable_finder_for(MergeRequestsFinder) end + def redirect_out_of_range(relation, total_pages) + return false if total_pages.zero? + + out_of_range = relation.current_page > total_pages + + if out_of_range + redirect_to(url_for(params.merge(page: total_pages, only_path: true))) + end + + out_of_range + end + + def issues_page_count(relation) + page_count_for_relation(relation, issues_finder.row_count) + end + + def merge_requests_page_count(relation) + page_count_for_relation(relation, merge_requests_finder.row_count) + end + + def page_count_for_relation(relation, row_count) + limit = relation.limit_value.to_f + + return 1 if limit.zero? + + (row_count.to_f / limit).ceil + end + def issuable_finder_for(finder_class) finder_class.new(current_user, filter_params) end diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 0d4266f0899..dc9e6f71152 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -27,10 +27,9 @@ class Projects::IssuesController < Projects::ApplicationController @issues = issues_collection @issues = @issues.page(params[:page]) @issuable_meta_data = issuable_meta_data(@issues, @collection_type) + @total_pages = issues_page_count(@issues) - if @issues.out_of_range? && @issues.total_pages != 0 - return redirect_to url_for(params.merge(page: @issues.total_pages, only_path: true)) - end + return if redirect_out_of_range(@issues, @total_pages) if params[:label_name].present? @labels = LabelsFinder.new(current_user, project_id: @project.id, title: params[:label_name]).execute diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index e3fa3736808..5095d7fd445 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -18,10 +18,9 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo @merge_requests = @merge_requests.page(params[:page]) @merge_requests = @merge_requests.preload(merge_request_diff: :merge_request) @issuable_meta_data = issuable_meta_data(@merge_requests, @collection_type) + @total_pages = merge_requests_page_count(@merge_requests) - if @merge_requests.out_of_range? && @merge_requests.total_pages != 0 - return redirect_to url_for(params.merge(page: @merge_requests.total_pages, only_path: true)) - end + return if redirect_out_of_range(@merge_requests, @total_pages) if params[:label_name].present? labels_params = { project_id: @project.id, title: params[:label_name] } diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index c8dd2275730..9848497f258 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -61,6 +61,10 @@ class IssuableFinder execute.find_by(*params) end + def row_count + Gitlab::IssuablesCountForState.new(self).for_state_or_opened(params[:state]) + end + # We often get counts for each state by running a query per state, and # counting those results. This is typically slower than running one query # (even if that query is slower than any of the individual state queries) and diff --git a/app/finders/issues_finder.rb b/app/finders/issues_finder.rb index aa9cef6b08c..d2275139c42 100644 --- a/app/finders/issues_finder.rb +++ b/app/finders/issues_finder.rb @@ -14,6 +14,7 @@ # search: string # label_name: string # sort: string +# my_reaction_emoji: string # class IssuesFinder < IssuableFinder CONFIDENTIAL_ACCESS_LEVEL = Gitlab::Access::REPORTER diff --git a/app/finders/merge_requests_finder.rb b/app/finders/merge_requests_finder.rb index 771da3d441d..d0687d28c21 100644 --- a/app/finders/merge_requests_finder.rb +++ b/app/finders/merge_requests_finder.rb @@ -16,6 +16,7 @@ # label_name: string # sort: string # non_archived: boolean +# my_reaction_emoji: string # class MergeRequestsFinder < IssuableFinder def klass diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index 681615dbf3e..717abf2082d 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -240,7 +240,8 @@ module IssuablesHelper def issuables_count_for_state(issuable_type, state) finder = public_send("#{issuable_type}_finder") # rubocop:disable GitlabSecurity/PublicSend - finder.count_by_state[state] + + Gitlab::IssuablesCountForState.new(finder)[state] end def close_issuable_url(issuable) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 0bf94fd30db..02fe82ea872 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -72,12 +72,6 @@ module ProjectsHelper output.html_safe end - if current_user - project_link << button_tag(type: 'button', class: 'dropdown-toggle-caret js-projects-dropdown-toggle', aria: { label: 'Toggle switch project dropdown' }, data: { target: '.js-dropdown-menu-projects', toggle: 'dropdown', order_by: 'last_activity_at' }) do - icon("chevron-down") - end - end - "#{namespace_link} / #{project_link}".html_safe end diff --git a/app/models/ci/trigger_request.rb b/app/models/ci/trigger_request.rb index c58ce5c3717..2c860598281 100644 --- a/app/models/ci/trigger_request.rb +++ b/app/models/ci/trigger_request.rb @@ -6,6 +6,10 @@ module Ci belongs_to :pipeline, foreign_key: :commit_id has_many :builds + # We switched to Ci::PipelineVariable from Ci::TriggerRequest.variables. + # Ci::TriggerRequest doesn't save variables anymore. + validates :variables, absence: true + serialize :variables # rubocop:disable Cop/ActiveRecordSerialize def user_variables diff --git a/app/models/commit.rb b/app/models/commit.rb index c943365016f..ba3845df867 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -405,6 +405,6 @@ class Commit end def gpg_commit - @gpg_commit ||= Gitlab::Gpg::Commit.for_commit(self) + @gpg_commit ||= Gitlab::Gpg::Commit.new(self) end end diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 842c6e5cb50..f3888528940 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -38,6 +38,14 @@ class CommitStatus < ActiveRecord::Base scope :retried_ordered, -> { retried.ordered.includes(project: :namespace) } scope :after_stage, -> (index) { where('stage_idx > ?', index) } + enum failure_reason: { + unknown_failure: nil, + script_failure: 1, + api_failure: 2, + stuck_or_timeout_failure: 3, + runner_system_failure: 4 + } + state_machine :status do event :process do transition [:skipped, :manual] => :created @@ -79,6 +87,11 @@ class CommitStatus < ActiveRecord::Base commit_status.finished_at = Time.now end + before_transition any => :failed do |commit_status, transition| + failure_reason = transition.args.first + commit_status.failure_reason = failure_reason + end + after_transition do |commit_status, transition| next if transition.loopback? diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index 3731b7c8577..681c3241dbb 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -6,6 +6,7 @@ # module Issuable extend ActiveSupport::Concern + include Gitlab::SQL::Pattern include CacheMarkdownField include Participable include Mentionable @@ -122,7 +123,9 @@ module Issuable # # Returns an ActiveRecord::Relation. def search(query) - where(arel_table[:title].matches("%#{query}%")) + title = to_fuzzy_arel(:title, query) + + where(title) end # Searches for records with a matching title or description. @@ -133,10 +136,10 @@ module Issuable # # Returns an ActiveRecord::Relation. def full_search(query) - t = arel_table - pattern = "%#{query}%" + title = to_fuzzy_arel(:title, query) + description = to_fuzzy_arel(:description, query) - where(t[:title].matches(pattern).or(t[:description].matches(pattern))) + where(title&.or(description)) end def sort(method, excluded_labels: []) diff --git a/app/models/gpg_key.rb b/app/models/gpg_key.rb index 3df60ddc950..1633acd4fa9 100644 --- a/app/models/gpg_key.rb +++ b/app/models/gpg_key.rb @@ -56,7 +56,7 @@ class GpgKey < ActiveRecord::Base def verified_user_infos user_infos.select do |user_info| - user_info[:email] == user.email + user.verified_email?(user_info[:email]) end end @@ -64,13 +64,17 @@ class GpgKey < ActiveRecord::Base user_infos.map do |user_info| [ user_info[:email], - user_info[:email] == user.email + user.verified_email?(user_info[:email]) ] end.to_h end def verified? - emails_with_verified_status.any? { |_email, verified| verified } + emails_with_verified_status.values.any? + end + + def verified_and_belongs_to_email?(email) + emails_with_verified_status.fetch(email, false) end def update_invalid_gpg_signatures @@ -78,11 +82,14 @@ class GpgKey < ActiveRecord::Base end def revoke - GpgSignature.where(gpg_key: self, valid_signature: true).update_all( - gpg_key_id: nil, - valid_signature: false, - updated_at: Time.zone.now - ) + GpgSignature + .where(gpg_key: self) + .where.not(verification_status: GpgSignature.verification_statuses[:unknown_key]) + .update_all( + gpg_key_id: nil, + verification_status: GpgSignature.verification_statuses[:unknown_key], + updated_at: Time.zone.now + ) destroy end diff --git a/app/models/gpg_signature.rb b/app/models/gpg_signature.rb index 50fb35c77ec..454c90d5fc4 100644 --- a/app/models/gpg_signature.rb +++ b/app/models/gpg_signature.rb @@ -1,9 +1,21 @@ class GpgSignature < ActiveRecord::Base include ShaAttribute + include IgnorableColumn + + ignore_column :valid_signature sha_attribute :commit_sha sha_attribute :gpg_key_primary_keyid + enum verification_status: { + unverified: 0, + verified: 1, + same_user_different_email: 2, + other_user: 3, + unverified_key: 4, + unknown_key: 5 + } + belongs_to :project belongs_to :gpg_key @@ -20,6 +32,6 @@ class GpgSignature < ActiveRecord::Base end def gpg_commit - Gitlab::Gpg::Commit.new(project, commit_sha) + Gitlab::Gpg::Commit.new(commit) end end diff --git a/app/models/repository.rb b/app/models/repository.rb index 05f2f851162..035f85a0b46 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -166,32 +166,25 @@ class Repository end def add_branch(user, branch_name, ref) - newrev = commit(ref).try(:sha) - - return false unless newrev - - Gitlab::Git::OperationService.new(user, raw_repository).add_branch(branch_name, newrev) + branch = raw_repository.add_branch(branch_name, committer: user, target: ref) after_create_branch - find_branch(branch_name) + + branch + rescue Gitlab::Git::Repository::InvalidRef + false end def add_tag(user, tag_name, target, message = nil) - newrev = commit(target).try(:id) - options = { message: message, tagger: user_to_committer(user) } if message - - return false unless newrev - - Gitlab::Git::OperationService.new(user, raw_repository).add_tag(tag_name, newrev, options) - - find_tag(tag_name) + raw_repository.add_tag(tag_name, committer: user, target: target, message: message) + rescue Gitlab::Git::Repository::InvalidRef + false end def rm_branch(user, branch_name) before_remove_branch - branch = find_branch(branch_name) - Gitlab::Git::OperationService.new(user, raw_repository).rm_branch(branch) + raw_repository.rm_branch(branch_name, committer: user) after_remove_branch true @@ -199,9 +192,8 @@ class Repository def rm_tag(user, tag_name) before_remove_tag - tag = find_tag(tag_name) - Gitlab::Git::OperationService.new(user, raw_repository).rm_tag(tag) + raw_repository.rm_tag(tag_name, committer: user) after_remove_tag true diff --git a/app/models/user.rb b/app/models/user.rb index 9d48c82e861..c5b5f09722f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1041,6 +1041,10 @@ class User < ActiveRecord::Base ensure_rss_token! end + def verified_email?(email) + self.email == email + end + protected # override, from Devise::Validatable diff --git a/app/presenters/ci/build_presenter.rb b/app/presenters/ci/build_presenter.rb index c495c3f39bb..255475e1fe6 100644 --- a/app/presenters/ci/build_presenter.rb +++ b/app/presenters/ci/build_presenter.rb @@ -17,5 +17,16 @@ module Ci "Job is redundant and is auto-canceled by Pipeline ##{auto_canceled_by_id}" end end + + def trigger_variables + return [] unless trigger_request + + @trigger_variables ||= + if pipeline.variables.any? + pipeline.variables.map(&:to_runner_variable) + else + trigger_request.user_variables + end + end end end diff --git a/app/services/ci/create_trigger_request_service.rb b/app/services/ci/create_trigger_request_service.rb deleted file mode 100644 index b2aa457bbd5..00000000000 --- a/app/services/ci/create_trigger_request_service.rb +++ /dev/null @@ -1,19 +0,0 @@ -# This class is deprecated because we're closing Ci::TriggerRequest. -# New class is PipelineTriggerService (app/services/ci/pipeline_trigger_service.rb) -# which is integrated with Ci::PipelineVariable instaed of Ci::TriggerRequest. -# We remove this class after we removed v1 and v3 API. This class is still being -# referred by such legacy code. -module Ci - module CreateTriggerRequestService - Result = Struct.new(:trigger_request, :pipeline) - - def self.execute(project, trigger, ref, variables = nil) - trigger_request = trigger.trigger_requests.create(variables: variables) - - pipeline = Ci::CreatePipelineService.new(project, trigger.owner, ref: ref) - .execute(:trigger, ignore_skip_ci: true, trigger_request: trigger_request) - - Result.new(trigger_request, pipeline) - end - end -end diff --git a/app/services/projects/update_pages_service.rb b/app/services/projects/update_pages_service.rb index f6b83a2f621..d34903c9989 100644 --- a/app/services/projects/update_pages_service.rb +++ b/app/services/projects/update_pages_service.rb @@ -53,7 +53,7 @@ module Projects log_error("Projects::UpdatePagesService: #{message}") @status.allow_failure = !latest? @status.description = message - @status.drop + @status.drop(:script_failure) super end diff --git a/app/views/layouts/nav/_new_dashboard.html.haml b/app/views/layouts/nav/_new_dashboard.html.haml index cfdfcbebc9f..e670e04928c 100644 --- a/app/views/layouts/nav/_new_dashboard.html.haml +++ b/app/views/layouts/nav/_new_dashboard.html.haml @@ -1,13 +1,16 @@ %ul.list-unstyled.navbar-sub-nav - = nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'dashboard/projects#index'], html_options: {class: "home"}) do - = link_to dashboard_projects_path, title: 'Projects', class: 'dashboard-shortcuts-projects' do + = nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'dashboard/projects#index'], html_options: { id: 'nav-projects-dropdown', class: "home dropdown" }) do + %a{ href: '#', title: 'Projects', data: { toggle: 'dropdown' } } Projects + = icon("chevron-down", class: "dropdown-chevron") + .dropdown-menu.projects-dropdown-menu + = render "layouts/nav/projects_dropdown/show" = nav_link(controller: ['dashboard/groups', 'explore/groups']) do = link_to dashboard_groups_path, class: 'dashboard-shortcuts-groups', title: 'Groups' do Groups - = nav_link(path: 'dashboard#activity', html_options: { class: "hidden-xs hidden-sm" }) do + = nav_link(path: 'dashboard#activity', html_options: { class: "hidden-xs hidden-sm hidden-md" }) do = link_to activity_dashboard_path, class: 'dashboard-shortcuts-activity', title: 'Activity' do Activity @@ -17,7 +20,7 @@ = icon("chevron-down", class: "dropdown-chevron") .dropdown-menu %ul - = nav_link(path: 'dashboard#activity', html_options: { class: "visible-xs visible-sm" }) do + = nav_link(path: 'dashboard#activity', html_options: { class: "visible-xs visible-sm visible-md" }) do = link_to activity_dashboard_path, title: 'Activity' do Activity @@ -31,3 +34,8 @@ %li.divider %li = link_to "Help", help_path, title: 'About GitLab CE' + + -# Shortcut to Dashboard > Projects + %li.hidden + = link_to dashboard_projects_path, title: 'Projects', class: 'dashboard-shortcuts-projects' do + Projects diff --git a/app/views/layouts/nav/projects_dropdown/_show.html.haml b/app/views/layouts/nav/projects_dropdown/_show.html.haml new file mode 100644 index 00000000000..a7370180bf6 --- /dev/null +++ b/app/views/layouts/nav/projects_dropdown/_show.html.haml @@ -0,0 +1,15 @@ +- project_meta = { id: @project.id, name: @project.name, namespace: @project.name_with_namespace, web_url: @project.web_url, avatar_url: @project.avatar_url } if @project&.persisted? +.projects-dropdown-container + .project-dropdown-sidebar + %ul + = nav_link(path: 'dashboard/projects#index') do + = link_to dashboard_projects_path do + = _('Your projects') + = nav_link(path: 'projects#starred') do + = link_to starred_dashboard_projects_path do + = _('Starred projects') + = nav_link(path: 'projects#trending') do + = link_to explore_root_path do + = _('Explore projects') + .project-dropdown-content + #js-projects-dropdown{ data: { user_name: current_user.username, project: project_meta } } diff --git a/app/views/layouts/project.html.haml b/app/views/layouts/project.html.haml index 54d56e9b873..d6db85ee87a 100644 --- a/app/views/layouts/project.html.haml +++ b/app/views/layouts/project.html.haml @@ -14,12 +14,4 @@ :javascript window.uploads_path = "#{project_uploads_path(project)}"; -- content_for :header_content do - .js-dropdown-menu-projects - .dropdown-menu.dropdown-select.dropdown-menu-projects - = dropdown_title("Go to a project") - = dropdown_filter("Search your projects") - = dropdown_content - = dropdown_loading - = render template: "layouts/application" diff --git a/app/views/projects/commit/_invalid_signature_badge.html.haml b/app/views/projects/commit/_invalid_signature_badge.html.haml deleted file mode 100644 index 3a73aae9d95..00000000000 --- a/app/views/projects/commit/_invalid_signature_badge.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -- title = capture do - .gpg-popover-icon.invalid - = render 'shared/icons/icon_status_notfound_borderless.svg' - %div - This commit was signed with an <strong>unverified</strong> signature. - -- locals = { signature: signature, title: title, label: 'Unverified', css_classes: ['invalid'] } - -= render partial: 'projects/commit/signature_badge', locals: locals diff --git a/app/views/projects/commit/_other_user_signature_badge.html.haml b/app/views/projects/commit/_other_user_signature_badge.html.haml new file mode 100644 index 00000000000..80eca96f7ce --- /dev/null +++ b/app/views/projects/commit/_other_user_signature_badge.html.haml @@ -0,0 +1,6 @@ +- title = capture do + This commit was signed with a different user's verified signature. + +- locals = { signature: signature, title: title, label: 'Unverified', css_class: 'invalid', icon: 'icon_status_notfound_borderless', show_user: true } + += render partial: 'projects/commit/signature_badge', locals: locals diff --git a/app/views/projects/commit/_same_user_different_email_signature_badge.html.haml b/app/views/projects/commit/_same_user_different_email_signature_badge.html.haml new file mode 100644 index 00000000000..e737de48e22 --- /dev/null +++ b/app/views/projects/commit/_same_user_different_email_signature_badge.html.haml @@ -0,0 +1,7 @@ +- title = capture do + This commit was signed with a verified signature, but the committer email + is <strong>not verified</strong> to belong to the same user. + +- locals = { signature: signature, title: title, label: 'Unverified', css_class: ['invalid'], icon: 'icon_status_notfound_borderless', show_user: true } + += render partial: 'projects/commit/signature_badge', locals: locals diff --git a/app/views/projects/commit/_signature.html.haml b/app/views/projects/commit/_signature.html.haml index 60fa52557ef..145bc629380 100644 --- a/app/views/projects/commit/_signature.html.haml +++ b/app/views/projects/commit/_signature.html.haml @@ -1,5 +1,2 @@ - if signature - - if signature.valid_signature? - = render partial: 'projects/commit/valid_signature_badge', locals: { signature: signature } - - else - = render partial: 'projects/commit/invalid_signature_badge', locals: { signature: signature } + = render partial: "projects/commit/#{signature.verification_status}_signature_badge", locals: { signature: signature } diff --git a/app/views/projects/commit/_signature_badge.html.haml b/app/views/projects/commit/_signature_badge.html.haml index d06b29db838..edff018ba6d 100644 --- a/app/views/projects/commit/_signature_badge.html.haml +++ b/app/views/projects/commit/_signature_badge.html.haml @@ -1,17 +1,27 @@ -- css_classes = commit_signature_badge_classes(css_classes) +- signature = local_assigns.fetch(:signature) +- title = local_assigns.fetch(:title) +- label = local_assigns.fetch(:label) +- css_class = local_assigns.fetch(:css_class) +- icon = local_assigns.fetch(:icon) +- show_user = local_assigns.fetch(:show_user, false) + +- css_classes = commit_signature_badge_classes(css_class) - title = capture do .gpg-popover-status - = title + .gpg-popover-icon{ class: css_class } + = render "shared/icons/#{icon}.svg" + %div + = title - content = capture do - .clearfix - = content + - if show_user + .clearfix + = render partial: 'projects/commit/signature_badge_user', locals: { signature: signature } GPG Key ID: %span.monospace= signature.gpg_key_primary_keyid - = link_to('Learn more about signing commits', help_page_path('user/project/repository/gpg_signed_commits/index.md'), class: 'gpg-popover-help-link') %button{ class: css_classes, data: { toggle: 'popover', html: 'true', placement: 'auto top', title: title, content: content } } diff --git a/app/views/projects/commit/_signature_badge_user.html.haml b/app/views/projects/commit/_signature_badge_user.html.haml new file mode 100644 index 00000000000..b20198e76db --- /dev/null +++ b/app/views/projects/commit/_signature_badge_user.html.haml @@ -0,0 +1,21 @@ +- gpg_key = signature.gpg_key +- user = gpg_key&.user +- user_name = signature.gpg_key_user_name +- user_email = signature.gpg_key_user_email + +- if user + = link_to user_path(user), class: 'gpg-popover-user-link' do + %div + = user_avatar_without_link(user: user, size: 32) + + %div + %strong= user.name + %div= user.to_reference +- else + = mail_to user_email do + %div + = user_avatar_without_link(user_name: user_name, user_email: user_email, size: 32) + + %div + %strong= user_name + %div= user_email diff --git a/app/views/projects/commit/_unknown_key_signature_badge.html.haml b/app/views/projects/commit/_unknown_key_signature_badge.html.haml new file mode 100644 index 00000000000..75c5cf57bcc --- /dev/null +++ b/app/views/projects/commit/_unknown_key_signature_badge.html.haml @@ -0,0 +1 @@ += render partial: 'projects/commit/unverified_signature_badge', locals: { signature: signature } diff --git a/app/views/projects/commit/_unverified_key_signature_badge.html.haml b/app/views/projects/commit/_unverified_key_signature_badge.html.haml new file mode 100644 index 00000000000..75c5cf57bcc --- /dev/null +++ b/app/views/projects/commit/_unverified_key_signature_badge.html.haml @@ -0,0 +1 @@ += render partial: 'projects/commit/unverified_signature_badge', locals: { signature: signature } diff --git a/app/views/projects/commit/_unverified_signature_badge.html.haml b/app/views/projects/commit/_unverified_signature_badge.html.haml new file mode 100644 index 00000000000..1af58027b83 --- /dev/null +++ b/app/views/projects/commit/_unverified_signature_badge.html.haml @@ -0,0 +1,6 @@ +- title = capture do + This commit was signed with an <strong>unverified</strong> signature. + +- locals = { signature: signature, title: title, label: 'Unverified', css_class: 'invalid', icon: 'icon_status_notfound_borderless' } + += render partial: 'projects/commit/signature_badge', locals: locals diff --git a/app/views/projects/commit/_valid_signature_badge.html.haml b/app/views/projects/commit/_valid_signature_badge.html.haml deleted file mode 100644 index db1a41bbf64..00000000000 --- a/app/views/projects/commit/_valid_signature_badge.html.haml +++ /dev/null @@ -1,32 +0,0 @@ -- title = capture do - .gpg-popover-icon.valid - = render 'shared/icons/icon_status_success_borderless.svg' - %div - This commit was signed with a <strong>verified</strong> signature. - -- content = capture do - - gpg_key = signature.gpg_key - - user = gpg_key&.user - - user_name = signature.gpg_key_user_name - - user_email = signature.gpg_key_user_email - - - if user - = link_to user_path(user), class: 'gpg-popover-user-link' do - %div - = user_avatar_without_link(user: user, size: 32) - - %div - %strong= gpg_key.user.name - %div @#{gpg_key.user.username} - - else - = mail_to user_email do - %div - = user_avatar_without_link(user_name: user_name, user_email: user_email, size: 32) - - %div - %strong= user_name - %div= user_email - -- locals = { signature: signature, title: title, content: content, label: 'Verified', css_classes: ['valid'] } - -= render partial: 'projects/commit/signature_badge', locals: locals diff --git a/app/views/projects/commit/_verified_signature_badge.html.haml b/app/views/projects/commit/_verified_signature_badge.html.haml new file mode 100644 index 00000000000..423beba2120 --- /dev/null +++ b/app/views/projects/commit/_verified_signature_badge.html.haml @@ -0,0 +1,7 @@ +- title = capture do + This commit was signed with a <strong>verified</strong> signature and the + committer email is verified to belong to the same user. + +- locals = { signature: signature, title: title, label: 'Verified', css_class: 'valid', icon: 'icon_status_success_borderless', show_user: true } + += render partial: 'projects/commit/signature_badge', locals: locals diff --git a/app/views/projects/issues/_issues.html.haml b/app/views/projects/issues/_issues.html.haml index 34d5a3e1831..6fb5aa45166 100644 --- a/app/views/projects/issues/_issues.html.haml +++ b/app/views/projects/issues/_issues.html.haml @@ -4,4 +4,4 @@ = render 'shared/empty_states/issues' - if @issues.present? - = paginate @issues, theme: "gitlab" + = paginate @issues, theme: "gitlab", total_pages: @total_pages diff --git a/app/views/projects/jobs/_sidebar.html.haml b/app/views/projects/jobs/_sidebar.html.haml index f5d5bc7eda9..43e23bb2200 100644 --- a/app/views/projects/jobs/_sidebar.html.haml +++ b/app/views/projects/jobs/_sidebar.html.haml @@ -46,14 +46,14 @@ %span.build-light-text Token: #{@build.trigger_request.trigger.short_token} - - if @build.trigger_request.variables + - if @build.trigger_variables.any? %p %button.btn.group.btn-group-justified.reveal-variables Reveal Variables %dl.js-build-variables.trigger-build-variables.hide - - @build.trigger_request.variables.each do |key, value| - %dt.js-build-variable.trigger-build-variable= key - %dd.js-build-value.trigger-build-value= value + - @build.trigger_variables.each do |trigger_variable| + %dt.js-build-variable.trigger-build-variable= trigger_variable[:key] + %dd.js-build-value.trigger-build-value= trigger_variable[:value] %div{ class: (@build.pipeline.stages_count > 1 ? "block" : "block-last") } %p diff --git a/app/views/projects/merge_requests/_merge_requests.html.haml b/app/views/projects/merge_requests/_merge_requests.html.haml index 4e97f74dd6a..bd6f1c05949 100644 --- a/app/views/projects/merge_requests/_merge_requests.html.haml +++ b/app/views/projects/merge_requests/_merge_requests.html.haml @@ -5,4 +5,4 @@ = render 'shared/empty_states/merge_requests' - if @merge_requests.present? - = paginate @merge_requests, theme: "gitlab" + = paginate @merge_requests, theme: "gitlab", total_pages: @total_pages diff --git a/app/views/projects/notes/_actions.html.haml b/app/views/projects/notes/_actions.html.haml index b04f5efe1f9..fb07141d2ac 100644 --- a/app/views/projects/notes/_actions.html.haml +++ b/app/views/projects/notes/_actions.html.haml @@ -31,7 +31,7 @@ %template{ 'v-if' => 'isResolved' } = render 'shared/icons/icon_status_success_solid.svg' %template{ 'v-else' => '' } - = render 'shared/icons/icon_status_success.svg' + = render 'shared/icons/icon_resolve_discussion.svg' - if current_user - if note.emoji_awardable? diff --git a/app/views/shared/icons/_icon_resolve_discussion.svg b/app/views/shared/icons/_icon_resolve_discussion.svg new file mode 100644 index 00000000000..845562e9320 --- /dev/null +++ b/app/views/shared/icons/_icon_resolve_discussion.svg @@ -0,0 +1 @@ +<svg width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"><path d="M0 7a7 7 0 1 1 14 0A7 7 0 0 1 0 7z M13 7A6 6 0 1 0 1 7a6 6 0 0 0 12 0z" fill-rule="evenodd"/><path d="M6.278 7.697L5.045 6.464a.296.296 0 0 0-.42-.002l-.613.614a.298.298 0 0 0 .002.42l1.91 1.909a.5.5 0 0 0 .703.005l.265-.265L9.997 6.04a.291.291 0 0 0-.009-.408l-.614-.614a.29.29 0 0 0-.408-.009L6.278 7.697z"/></svg> diff --git a/app/views/shared/icons/_icon_status_success.svg b/app/views/shared/icons/_icon_status_success.svg index 845562e9320..eed5006bebe 100755 --- a/app/views/shared/icons/_icon_status_success.svg +++ b/app/views/shared/icons/_icon_status_success.svg @@ -1 +1 @@ -<svg width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"><path d="M0 7a7 7 0 1 1 14 0A7 7 0 0 1 0 7z M13 7A6 6 0 1 0 1 7a6 6 0 0 0 12 0z" fill-rule="evenodd"/><path d="M6.278 7.697L5.045 6.464a.296.296 0 0 0-.42-.002l-.613.614a.298.298 0 0 0 .002.42l1.91 1.909a.5.5 0 0 0 .703.005l.265-.265L9.997 6.04a.291.291 0 0 0-.009-.408l-.614-.614a.29.29 0 0 0-.408-.009L6.278 7.697z"/></svg> +<svg width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"><g fill-rule="evenodd"><path d="M0 7a7 7 0 1 1 14 0A7 7 0 0 1 0 7z"/><path d="M13 7A6 6 0 1 0 1 7a6 6 0 0 0 12 0z" fill="#FFF"/><path d="M6.278 7.697L5.045 6.464a.296.296 0 0 0-.42-.002l-.613.614a.298.298 0 0 0 .002.42l1.91 1.909a.5.5 0 0 0 .703.005l.265-.265L9.997 6.04a.291.291 0 0 0-.009-.408l-.614-.614a.29.29 0 0 0-.408-.009L6.278 7.697z"/></g></svg> diff --git a/app/workers/create_gpg_signature_worker.rb b/app/workers/create_gpg_signature_worker.rb index f34dff2d656..9b5ff17aafa 100644 --- a/app/workers/create_gpg_signature_worker.rb +++ b/app/workers/create_gpg_signature_worker.rb @@ -6,7 +6,11 @@ class CreateGpgSignatureWorker project = Project.find_by(id: project_id) return unless project + commit = project.commit(commit_sha) + + return unless commit + # This calculates and caches the signature in the database - Gitlab::Gpg::Commit.new(project, commit_sha).signature + Gitlab::Gpg::Commit.new(commit).signature end end diff --git a/app/workers/stuck_ci_jobs_worker.rb b/app/workers/stuck_ci_jobs_worker.rb index 8b0cfcc8af8..269776a1f62 100644 --- a/app/workers/stuck_ci_jobs_worker.rb +++ b/app/workers/stuck_ci_jobs_worker.rb @@ -53,7 +53,7 @@ class StuckCiJobsWorker def drop_build(type, build, status, timeout) Rails.logger.info "#{self.class}: Dropping #{type} build #{build.id} for runner #{build.runner_id} (status: #{status}, timeout: #{timeout})" Gitlab::OptimisticLocking.retry_lock(build, 3) do |b| - b.drop + b.drop(:stuck_or_timeout_failure) end end end diff --git a/changelogs/unreleased/35010-projects-nav-dropdown.yml b/changelogs/unreleased/35010-projects-nav-dropdown.yml new file mode 100644 index 00000000000..c5bed723f55 --- /dev/null +++ b/changelogs/unreleased/35010-projects-nav-dropdown.yml @@ -0,0 +1,5 @@ +--- +title: Add dropdown to Projects nav item +merge_request: 13866 +author: +type: added diff --git a/changelogs/unreleased/35010-remove-goto-project-from-breadcrumb.yml b/changelogs/unreleased/35010-remove-goto-project-from-breadcrumb.yml new file mode 100644 index 00000000000..6cd7f4e9cc6 --- /dev/null +++ b/changelogs/unreleased/35010-remove-goto-project-from-breadcrumb.yml @@ -0,0 +1,5 @@ +--- +title: Remove project select dropdown from breadcrumb +merge_request: 14010 +author: +type: changed diff --git a/changelogs/unreleased/36821-fix-new-nav-wrapping-caret-and-increasing-height.yml b/changelogs/unreleased/36821-fix-new-nav-wrapping-caret-and-increasing-height.yml new file mode 100644 index 00000000000..54c7a8c8788 --- /dev/null +++ b/changelogs/unreleased/36821-fix-new-nav-wrapping-caret-and-increasing-height.yml @@ -0,0 +1,5 @@ +--- +title: Fix new navigation wrapping and causing height to grow +merge_request: +author: +type: fixed diff --git a/changelogs/unreleased/37204-deprecate-git-user-manual-ssh-config.yml b/changelogs/unreleased/37204-deprecate-git-user-manual-ssh-config.yml new file mode 100644 index 00000000000..593e74593c4 --- /dev/null +++ b/changelogs/unreleased/37204-deprecate-git-user-manual-ssh-config.yml @@ -0,0 +1,5 @@ +--- +title: Deprecate custom SSH client configuration for the git user +merge_request: 13930 +author: +type: deprecated diff --git a/changelogs/unreleased/37331-button-MR-widget.yml b/changelogs/unreleased/37331-button-MR-widget.yml new file mode 100644 index 00000000000..59bc1bd201e --- /dev/null +++ b/changelogs/unreleased/37331-button-MR-widget.yml @@ -0,0 +1,5 @@ +--- +title: Fix buttons with different height in merge request widget +merge_request: +author: +type: fixed diff --git a/changelogs/unreleased/37406-success-status-icon.yml b/changelogs/unreleased/37406-success-status-icon.yml new file mode 100644 index 00000000000..faac947f188 --- /dev/null +++ b/changelogs/unreleased/37406-success-status-icon.yml @@ -0,0 +1,5 @@ +--- +title: Fix broken svg in jobs dropdown for success status +merge_request: +author: +type: fixed diff --git a/changelogs/unreleased/additional-time-series-charts.yml b/changelogs/unreleased/additional-time-series-charts.yml new file mode 100644 index 00000000000..80c1af54881 --- /dev/null +++ b/changelogs/unreleased/additional-time-series-charts.yml @@ -0,0 +1,5 @@ +--- +title: Added support the multiple time series for prometheus monitoring +merge_request: !36893 +author: +type: changed diff --git a/changelogs/unreleased/api-gpg-key-management.yml b/changelogs/unreleased/api-gpg-key-management.yml new file mode 100644 index 00000000000..0be35a5823b --- /dev/null +++ b/changelogs/unreleased/api-gpg-key-management.yml @@ -0,0 +1,5 @@ +--- +title: 'API: Add GPG key management' +merge_request: 13828 +author: Robert Schilling +type: added diff --git a/changelogs/unreleased/api_branches_head.yml b/changelogs/unreleased/api_branches_head.yml new file mode 100644 index 00000000000..68d8d3d5168 --- /dev/null +++ b/changelogs/unreleased/api_branches_head.yml @@ -0,0 +1,5 @@ +--- +title: Add branch existence check to the APIv4 branches via HEAD request +merge_request: 13979 +author: Vitaliy @blackst0ne Klachkov +type: added diff --git a/changelogs/unreleased/dont-remove-add-diff-btn-on-post.yml b/changelogs/unreleased/dont-remove-add-diff-btn-on-post.yml new file mode 100644 index 00000000000..a7db18dbd60 --- /dev/null +++ b/changelogs/unreleased/dont-remove-add-diff-btn-on-post.yml @@ -0,0 +1,5 @@ +--- +title: Fixed add diff note button not showing after deleting a comment +merge_request: +author: +type: fixed diff --git a/changelogs/unreleased/feature-dependency-status-badge.yml b/changelogs/unreleased/feature-dependency-status-badge.yml new file mode 100644 index 00000000000..1becff3585a --- /dev/null +++ b/changelogs/unreleased/feature-dependency-status-badge.yml @@ -0,0 +1,5 @@ +--- +title: Add badge for dependency status +merge_request: 13588 +author: Markus Koller +type: other diff --git a/changelogs/unreleased/feature-gpg-verification-status.yml b/changelogs/unreleased/feature-gpg-verification-status.yml new file mode 100644 index 00000000000..7518fafcdb8 --- /dev/null +++ b/changelogs/unreleased/feature-gpg-verification-status.yml @@ -0,0 +1,6 @@ +--- +title: 'Update the GPG verification semantics: A GPG signature must additionally match + the committer in order to be verified' +merge_request: 13771 +author: Alexis Reigel +type: changed diff --git a/changelogs/unreleased/feature-sm-34518-extend-api-pipeline-schedule-variable-new.yml b/changelogs/unreleased/feature-sm-34518-extend-api-pipeline-schedule-variable-new.yml new file mode 100644 index 00000000000..969a5aeaed3 --- /dev/null +++ b/changelogs/unreleased/feature-sm-34518-extend-api-pipeline-schedule-variable-new.yml @@ -0,0 +1,5 @@ +--- +title: 'Extend API: Pipeline Schedule Variable' +merge_request: 13653 +author: +type: added diff --git a/changelogs/unreleased/feature-sm-37239-implement-failure_reason-on-ci_builds.yml b/changelogs/unreleased/feature-sm-37239-implement-failure_reason-on-ci_builds.yml new file mode 100644 index 00000000000..006b0b45844 --- /dev/null +++ b/changelogs/unreleased/feature-sm-37239-implement-failure_reason-on-ci_builds.yml @@ -0,0 +1,5 @@ +--- +title: Implement `failure_reason` on `ci_builds` +merge_request: 13937 +author: +type: added diff --git a/changelogs/unreleased/fuzzy-issue-search.yml b/changelogs/unreleased/fuzzy-issue-search.yml new file mode 100644 index 00000000000..8195e97ed59 --- /dev/null +++ b/changelogs/unreleased/fuzzy-issue-search.yml @@ -0,0 +1,5 @@ +--- +title: Support a multi-word fuzzy seach issues/merge requests on search bar +merge_request: 13780 +author: Hiroyuki Sato +type: changed diff --git a/changelogs/unreleased/issue-api-my-reaction.yml b/changelogs/unreleased/issue-api-my-reaction.yml new file mode 100644 index 00000000000..1c12478fbc0 --- /dev/null +++ b/changelogs/unreleased/issue-api-my-reaction.yml @@ -0,0 +1,5 @@ +--- +title: Add my_reaction_emoji param to /issues and /merge_requests API +merge_request: 14016 +author: Hiroyuki Sato +type: added diff --git a/changelogs/unreleased/mr-index-page-performance.yml b/changelogs/unreleased/mr-index-page-performance.yml new file mode 100644 index 00000000000..df5f44c04fa --- /dev/null +++ b/changelogs/unreleased/mr-index-page-performance.yml @@ -0,0 +1,5 @@ +--- +title: Re-use issue/MR counts for the pagination system +merge_request: +author: +type: other diff --git a/config/webpack.config.js b/config/webpack.config.js index ad88e48550d..6b0cd023291 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -30,7 +30,7 @@ var config = { blob: './blob_edit/blob_bundle.js', boards: './boards/boards_bundle.js', common: './commons/index.js', - common_vue: ['vue', './vue_shared/common_vue.js'], + common_vue: './vue_shared/vue_resource_interceptor.js', common_d3: ['d3'], cycle_analytics: './cycle_analytics/cycle_analytics_bundle.js', commit_pipelines: './commit/pipelines/pipelines_bundle.js', diff --git a/db/migrate/20170817123339_add_verification_status_to_gpg_signatures.rb b/db/migrate/20170817123339_add_verification_status_to_gpg_signatures.rb new file mode 100644 index 00000000000..128cd109f8d --- /dev/null +++ b/db/migrate/20170817123339_add_verification_status_to_gpg_signatures.rb @@ -0,0 +1,20 @@ +class AddVerificationStatusToGpgSignatures < ActiveRecord::Migration + DOWNTIME = false + + include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + + def up + # First we remove all signatures because we need to re-verify them all + # again anyway (because of the updated verification logic). + # + # This makes adding the column with default values faster + truncate(:gpg_signatures) + + add_column_with_default(:gpg_signatures, :verification_status, :smallint, default: 0) + end + + def down + remove_column(:gpg_signatures, :verification_status) + end +end diff --git a/db/migrate/20170830125940_add_failure_reason_to_ci_builds.rb b/db/migrate/20170830125940_add_failure_reason_to_ci_builds.rb new file mode 100644 index 00000000000..5a7487b9227 --- /dev/null +++ b/db/migrate/20170830125940_add_failure_reason_to_ci_builds.rb @@ -0,0 +1,9 @@ +class AddFailureReasonToCiBuilds < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column :ci_builds, :failure_reason, :integer + end +end diff --git a/db/post_migrate/20170830084744_destroy_gpg_signatures.rb b/db/post_migrate/20170830084744_destroy_gpg_signatures.rb new file mode 100644 index 00000000000..b04d36f6537 --- /dev/null +++ b/db/post_migrate/20170830084744_destroy_gpg_signatures.rb @@ -0,0 +1,10 @@ +class DestroyGpgSignatures < ActiveRecord::Migration + DOWNTIME = false + + def up + truncate(:gpg_signatures) + end + + def down + end +end diff --git a/db/post_migrate/20170831195038_remove_valid_signature_from_gpg_signatures.rb b/db/post_migrate/20170831195038_remove_valid_signature_from_gpg_signatures.rb new file mode 100644 index 00000000000..9b6745e33d9 --- /dev/null +++ b/db/post_migrate/20170831195038_remove_valid_signature_from_gpg_signatures.rb @@ -0,0 +1,11 @@ +class RemoveValidSignatureFromGpgSignatures < ActiveRecord::Migration + DOWNTIME = false + + def up + remove_column :gpg_signatures, :valid_signature + end + + def down + add_column :gpg_signatures, :valid_signature, :boolean + end +end diff --git a/db/schema.rb b/db/schema.rb index 9b45861cde7..f980667a38f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -247,6 +247,7 @@ ActiveRecord::Schema.define(version: 20170901071411) do t.boolean "retried" t.integer "stage_id" t.boolean "protected" + t.integer "failure_reason" end add_index "ci_builds", ["auto_canceled_by_id"], name: "index_ci_builds_on_auto_canceled_by_id", using: :btree @@ -608,11 +609,11 @@ ActiveRecord::Schema.define(version: 20170901071411) do t.datetime "updated_at", null: false t.integer "project_id" t.integer "gpg_key_id" - t.boolean "valid_signature" t.binary "commit_sha" t.binary "gpg_key_primary_keyid" t.text "gpg_key_user_name" t.text "gpg_key_user_email" + t.integer "verification_status", limit: 2, default: 0, null: false end add_index "gpg_signatures", ["commit_sha"], name: "index_gpg_signatures_on_commit_sha", unique: true, using: :btree diff --git a/doc/README.md b/doc/README.md index 63ba8ff03e9..b250fa08382 100644 --- a/doc/README.md +++ b/doc/README.md @@ -160,7 +160,6 @@ have access to GitLab administration tools and settings. ### Integrations - [Integrations](integration/README.md): How to integrate with systems such as JIRA, Redmine, Twitter. -- [Koding](administration/integration/koding.md): Set up Koding to use with GitLab. - [Mattermost](user/project/integrations/mattermost.md): Set up GitLab with Mattermost. ### Monitoring diff --git a/doc/administration/integration/koding.md b/doc/administration/integration/koding.md index b95c425842c..67f9f01efb8 100644 --- a/doc/administration/integration/koding.md +++ b/doc/administration/integration/koding.md @@ -1,6 +1,10 @@ # Koding & GitLab -> [Introduced][ce-5909] in GitLab 8.11. +>**Notes:** +- **As of GitLab 10.0, the Koding integration is deprecated and will be removed + in a future version. The option to configure it is removed from GitLab's admin + area.** +- [Introduced][ce-5909] in GitLab 8.11. This document will guide you through installing and configuring Koding with GitLab. diff --git a/doc/api/issues.md b/doc/api/issues.md index 765246142c1..8ca66049d31 100644 --- a/doc/api/issues.md +++ b/doc/api/issues.md @@ -30,20 +30,22 @@ GET /issues?milestone=1.0.0&state=opened GET /issues?iids[]=42&iids[]=43 GET /issues?author_id=5 GET /issues?assignee_id=5 -``` - -| Attribute | Type | Required | Description | -|-------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------------------| -| `state` | string | no | Return all issues or just those that are `opened` or `closed` | -| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `No+Label` lists all issues with no labels | -| `milestone` | string | no | The milestone title | -| `scope` | string | no | Return issues for the given scope: `created-by-me`, `assigned-to-me` or `all`. Defaults to `created-by-me` _([Introduced][ce-13004] in GitLab 9.5)_ | -| `author_id` | integer | no | Return issues created by the given user `id`. Combine with `scope=all` or `scope=assigned-to-me`. _([Introduced][ce-13004] in GitLab 9.5)_ | -| `assignee_id` | integer | no | Return issues assigned to the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ | -| `iids[]` | Array[integer] | no | Return only the issues having the given `iid` | -| `order_by` | string | no | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at` | -| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` | -| `search` | string | no | Search issues against their `title` and `description` | +GET /issues?my_reaction_emoji=star +``` + +| Attribute | Type | Required | Description | +| ------------------- | ---------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | +| `state` | string | no | Return all issues or just those that are `opened` or `closed` | +| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `No+Label` lists all issues with no labels | +| `milestone` | string | no | The milestone title | +| `scope` | string | no | Return issues for the given scope: `created-by-me`, `assigned-to-me` or `all`. Defaults to `created-by-me` _([Introduced][ce-13004] in GitLab 9.5)_ | +| `author_id` | integer | no | Return issues created by the given user `id`. Combine with `scope=all` or `scope=assigned-to-me`. _([Introduced][ce-13004] in GitLab 9.5)_ | +| `assignee_id` | integer | no | Return issues assigned to the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ | +| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given `emoji` _([Introduced][ce-14016] in GitLab 10.0)_ | +| `iids[]` | Array[integer] | no | Return only the issues having the given `iid` | +| `order_by` | string | no | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at` | +| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` | +| `search` | string | no | Search issues against their `title` and `description` | ```bash curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/issues @@ -131,21 +133,23 @@ GET /groups/:id/issues?iids[]=42&iids[]=43 GET /groups/:id/issues?search=issue+title+or+description GET /groups/:id/issues?author_id=5 GET /groups/:id/issues?assignee_id=5 +GET /groups/:id/issues?my_reaction_emoji=star ``` -| Attribute | Type | Required | Description | -|-------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------------------| -| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | -| `state` | string | no | Return all issues or just those that are `opened` or `closed` | -| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `No+Label` lists all issues with no labels | -| `iids[]` | Array[integer] | no | Return only the issues having the given `iid` | -| `milestone` | string | no | The milestone title | -| `scope` | string | no | Return issues for the given scope: `created-by-me`, `assigned-to-me` or `all` _([Introduced][ce-13004] in GitLab 9.5)_ | -| `author_id` | integer | no | Return issues created by the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ | -| `assignee_id` | integer | no | Return issues assigned to the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ | -| `order_by` | string | no | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at` | -| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` | -| `search` | string | no | Search group issues against their `title` and `description` | +| Attribute | Type | Required | Description | +| ------------------- | ---------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- | +| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | +| `state` | string | no | Return all issues or just those that are `opened` or `closed` | +| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `No+Label` lists all issues with no labels | +| `iids[]` | Array[integer] | no | Return only the issues having the given `iid` | +| `milestone` | string | no | The milestone title | +| `scope` | string | no | Return issues for the given scope: `created-by-me`, `assigned-to-me` or `all` _([Introduced][ce-13004] in GitLab 9.5)_ | +| `author_id` | integer | no | Return issues created by the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ | +| `assignee_id` | integer | no | Return issues assigned to the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ | +| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given `emoji` _([Introduced][ce-14016] in GitLab 10.0)_ | +| `order_by` | string | no | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at` | +| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` | +| `search` | string | no | Search group issues against their `title` and `description` | ```bash @@ -234,23 +238,25 @@ GET /projects/:id/issues?iids[]=42&iids[]=43 GET /projects/:id/issues?search=issue+title+or+description GET /projects/:id/issues?author_id=5 GET /projects/:id/issues?assignee_id=5 -``` - -| Attribute | Type | Required | Description | -|-------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------------------| -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | -| `iids[]` | Array[integer] | no | Return only the milestone having the given `iid` | -| `state` | string | no | Return all issues or just those that are `opened` or `closed` | -| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `No+Label` lists all issues with no labels | -| `milestone` | string | no | The milestone title | -| `scope` | string | no | Return issues for the given scope: `created-by-me`, `assigned-to-me` or `all` _([Introduced][ce-13004] in GitLab 9.5)_ | -| `author_id` | integer | no | Return issues created by the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ | -| `assignee_id` | integer | no | Return issues assigned to the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ | -| `order_by` | string | no | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at` | -| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` | -| `search` | string | no | Search project issues against their `title` and `description` | -| `created_after` | datetime | no | Return issues created after the given time (inclusive) | -| `created_before` | datetime | no | Return issues created before the given time (inclusive) | +GET /projects/:id/issues?my_reaction_emoji=star +``` + +| Attribute | Type | Required | Description | +| ------------------- | ---------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- | +| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | +| `iids[]` | Array[integer] | no | Return only the milestone having the given `iid` | +| `state` | string | no | Return all issues or just those that are `opened` or `closed` | +| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `No+Label` lists all issues with no labels | +| `milestone` | string | no | The milestone title | +| `scope` | string | no | Return issues for the given scope: `created-by-me`, `assigned-to-me` or `all` _([Introduced][ce-13004] in GitLab 9.5)_ | +| `author_id` | integer | no | Return issues created by the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ | +| `assignee_id` | integer | no | Return issues assigned to the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ | +| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given `emoji` _([Introduced][ce-14016] in GitLab 10.0)_ | +| `order_by` | string | no | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at` | +| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` | +| `search` | string | no | Search project issues against their `title` and `description` | +| `created_after` | datetime | no | Return issues created after the given time (inclusive) | +| `created_before` | datetime | no | Return issues created before the given time (inclusive) | ```bash curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/4/issues @@ -1093,3 +1099,4 @@ Example response: ``` [ce-13004]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13004 +[ce-14016]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14016 diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index 4f67aa4b9d4..bff8a2d3e4d 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -22,24 +22,26 @@ GET /merge_requests?state=all GET /merge_requests?milestone=release GET /merge_requests?labels=bug,reproduced GET /merge_requests?author_id=5 +GET /merge_requests?my_reaction_emoji=star GET /merge_requests?scope=assigned-to-me ``` Parameters: -| Attribute | Type | Required | Description | -| --------- | ---- | -------- | ----------- | -| `state` | string | no | Return all merge requests or just those that are `opened`, `closed`, or `merged`| -| `order_by`| string | no | Return requests ordered by `created_at` or `updated_at` fields. Default is `created_at` | -| `sort` | string | no | Return requests sorted in `asc` or `desc` order. Default is `desc` | -| `milestone` | string | no | Return merge requests for a specific milestone | -| `view` | string | no | If `simple`, returns the `iid`, URL, title, description, and basic state of merge request | -| `labels` | string | no | Return merge requests matching a comma separated list of labels | -| `created_after` | datetime | no | Return merge requests created after the given time (inclusive) | -| `created_before` | datetime | no | Return merge requests created before the given time (inclusive) | -| `scope` | string | no | Return merge requests for the given scope: `created-by-me`, `assigned-to-me` or `all`. Defaults to `created-by-me` | -| `author_id` | integer | no | Returns merge requests created by the given user `id`. Combine with `scope=all` or `scope=assigned-to-me` | -| `assignee_id` | integer | no | Returns merge requests assigned to the given user `id` | +| Attribute | Type | Required | Description | +| ------------------- | -------- | -------- | ---------------------------------------------------------------------------------------------------------------------- | +| `state` | string | no | Return all merge requests or just those that are `opened`, `closed`, or `merged` | +| `order_by` | string | no | Return requests ordered by `created_at` or `updated_at` fields. Default is `created_at` | +| `sort` | string | no | Return requests sorted in `asc` or `desc` order. Default is `desc` | +| `milestone` | string | no | Return merge requests for a specific milestone | +| `view` | string | no | If `simple`, returns the `iid`, URL, title, description, and basic state of merge request | +| `labels` | string | no | Return merge requests matching a comma separated list of labels | +| `created_after` | datetime | no | Return merge requests created after the given time (inclusive) | +| `created_before` | datetime | no | Return merge requests created before the given time (inclusive) | +| `scope` | string | no | Return merge requests for the given scope: `created-by-me`, `assigned-to-me` or `all`. Defaults to `created-by-me` | +| `author_id` | integer | no | Returns merge requests created by the given user `id`. Combine with `scope=all` or `scope=assigned-to-me` | +| `assignee_id` | integer | no | Returns merge requests assigned to the given user `id` | +| `my_reaction_emoji` | string | no | Return merge requests reacted by the authenticated user by the given `emoji` _([Introduced][ce-14016] in GitLab 10.0)_ | ```json [ @@ -116,25 +118,27 @@ GET /projects/:id/merge_requests?state=all GET /projects/:id/merge_requests?iids[]=42&iids[]=43 GET /projects/:id/merge_requests?milestone=release GET /projects/:id/merge_requests?labels=bug,reproduced +GET /projects/:id/merge_requests?my_reaction_emoji=star ``` Parameters: -| Attribute | Type | Required | Description | -| --------- | ---- | -------- | ----------- | -| `id` | integer | yes | The ID of a project | -| `iids[]` | Array[integer] | no | Return the request having the given `iid` | -| `state` | string | no | Return all merge requests or just those that are `opened`, `closed`, or `merged`| -| `order_by`| string | no | Return requests ordered by `created_at` or `updated_at` fields. Default is `created_at` | -| `sort` | string | no | Return requests sorted in `asc` or `desc` order. Default is `desc` | -| `milestone` | string | no | Return merge requests for a specific milestone | -| `view` | string | no | If `simple`, returns the `iid`, URL, title, description, and basic state of merge request | -| `labels` | string | no | Return merge requests matching a comma separated list of labels | -| `created_after` | datetime | no | Return merge requests created after the given time (inclusive) | -| `created_before` | datetime | no | Return merge requests created before the given time (inclusive) | -| `scope` | string | no | Return merge requests for the given scope: `created-by-me`, `assigned-to-me` or `all` _([Introduced][ce-13060] in GitLab 9.5)_ | -| `author_id` | integer | no | Returns merge requests created by the given user `id` _([Introduced][ce-13060] in GitLab 9.5)_ | -| `assignee_id` | integer | no | Returns merge requests assigned to the given user `id` _([Introduced][ce-13060] in GitLab 9.5)_ | +| Attribute | Type | Required | Description | +| ------------------- | -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ | +| `id` | integer | yes | The ID of a project | +| `iids[]` | Array[integer] | no | Return the request having the given `iid` | +| `state` | string | no | Return all merge requests or just those that are `opened`, `closed`, or `merged` | +| `order_by` | string | no | Return requests ordered by `created_at` or `updated_at` fields. Default is `created_at` | +| `sort` | string | no | Return requests sorted in `asc` or `desc` order. Default is `desc` | +| `milestone` | string | no | Return merge requests for a specific milestone | +| `view` | string | no | If `simple`, returns the `iid`, URL, title, description, and basic state of merge request | +| `labels` | string | no | Return merge requests matching a comma separated list of labels | +| `created_after` | datetime | no | Return merge requests created after the given time (inclusive) | +| `created_before` | datetime | no | Return merge requests created before the given time (inclusive) | +| `scope` | string | no | Return merge requests for the given scope: `created-by-me`, `assigned-to-me` or `all` _([Introduced][ce-13060] in GitLab 9.5)_ | +| `author_id` | integer | no | Returns merge requests created by the given user `id` _([Introduced][ce-13060] in GitLab 9.5)_ | +| `assignee_id` | integer | no | Returns merge requests assigned to the given user `id` _([Introduced][ce-13060] in GitLab 9.5)_ | +| `my_reaction_emoji` | string | no | Return merge requests reacted by the authenticated user by the given `emoji` _([Introduced][ce-14016] in GitLab 10.0)_ | ```json [ @@ -1315,3 +1319,4 @@ Example response: ``` [ce-13060]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13060 +[ce-14016]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14016 diff --git a/doc/api/pipeline_schedules.md b/doc/api/pipeline_schedules.md index 433654c18cc..c28f48e5fc6 100644 --- a/doc/api/pipeline_schedules.md +++ b/doc/api/pipeline_schedules.md @@ -84,7 +84,13 @@ curl --header "PRIVATE-TOKEN: k5ESFgWY2Qf5xEvDcFxZ" "https://gitlab.example.com/ "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "https://gitlab.example.com/root" - } + }, + "variables": [ + { + "key": "TEST_VARIABLE_1", + "value": "TEST_1" + } + ] } ``` @@ -271,3 +277,86 @@ curl --request DELETE --header "PRIVATE-TOKEN: k5ESFgWY2Qf5xEvDcFxZ" "https://gi } } ``` + +## Pipeline schedule variable + +> [Introduced][ce-34518] in GitLab 10.0. + +## Create a new pipeline schedule variable + +Create a new variable of a pipeline schedule. + +``` +POST /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables +``` + +| Attribute | Type | required | Description | +|------------------------|----------------|----------|--------------------------| +| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | +| `pipeline_schedule_id` | integer | yes | The pipeline schedule id | +| `key` | string | yes | The `key` of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9`, and `_` are allowed | +| `value` | string | yes | The `value` of a variable | + +```sh +curl --request POST --header "PRIVATE-TOKEN: k5ESFgWY2Qf5xEvDcFxZ" --form "key=NEW_VARIABLE" --form "value=new value" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13/variables" +``` + +```json +{ + "key": "NEW_VARIABLE", + "value": "new value" +} +``` + +## Edit a pipeline schedule variable + +Updates the variable of a pipeline schedule. + +``` +PUT /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables/:key +``` + +| Attribute | Type | required | Description | +|------------------------|----------------|----------|--------------------------| +| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | +| `pipeline_schedule_id` | integer | yes | The pipeline schedule id | +| `key` | string | yes | The `key` of a variable | +| `value` | string | yes | The `value` of a variable | + +```sh +curl --request PUT --header "PRIVATE-TOKEN: k5ESFgWY2Qf5xEvDcFxZ" --form "value=updated value" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13/variables/NEW_VARIABLE" +``` + +```json +{ + "key": "NEW_VARIABLE", + "value": "updated value" +} +``` + +## Delete a pipeline schedule variable + +Delete the variable of a pipeline schedule. + +``` +DELETE /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables/:key +``` + +| Attribute | Type | required | Description | +|------------------------|----------------|----------|--------------------------| +| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | +| `pipeline_schedule_id` | integer | yes | The pipeline schedule id | +| `key` | string | yes | The `key` of a variable | + +```sh +curl --request DELETE --header "PRIVATE-TOKEN: k5ESFgWY2Qf5xEvDcFxZ" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13/variables/NEW_VARIABLE" +``` + +```json +{ + "key": "NEW_VARIABLE", + "value": "updated value" +} +``` + +[ce-34518]: https://gitlab.com/gitlab-org/gitlab-ce/issues/34518
\ No newline at end of file diff --git a/doc/api/users.md b/doc/api/users.md index 57a13eb477d..57b4e117cf3 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -550,6 +550,217 @@ Parameters: Will return `200 OK` on success, or `404 Not found` if either user or key cannot be found. +## List all GPG keys + +Get a list of currently authenticated user's GPG keys. + +``` +GET /user/gpg_keys +``` + +```bash +curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/user/gpg_keys +``` + +Example response: + +```json +[ + { + "id": 1, + "key": "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFVjnlIBCACibzXOLCiZiL2oyzYUaTOCkYnSUhymg3pdbfKtd4mpBa58xKBj\r\nt1pTHVpw3Sk03wmzhM/Ndlt1AV2YhLv++83WKr+gAHFYFiCV/tnY8bx3HqvVoy8O\r\nCfxWhw4QZK7+oYzVmJj8ZJm3ZjOC4pzuegNWlNLCUdZDx9OKlHVXLCX1iUbjdYWa\r\nqKV6tdV8hZolkbyjedQgrpvoWyeSHHpwHF7yk4gNJWMMI5rpcssL7i6mMXb/sDzO\r\nVaAtU5wiVducsOa01InRFf7QSTxoAm6Xy0PGv/k48M6xCALa9nY+BzlOv47jUT57\r\nvilf4Szy9dKD0v9S0mQ+IHB+gNukWrnwtXx5ABEBAAHNFm5hbWUgKGNvbW1lbnQp\r\nIDxlbUBpbD7CwHUEEwECACkFAlVjnlIJEINgJNgv009/AhsDAhkBBgsJCAcDAgYV\r\nCAIJCgsEFgIDAQAAxqMIAFBHuBA8P1v8DtHonIK8Lx2qU23t8Mh68HBIkSjk2H7/\r\noO2cDWCw50jZ9D91PXOOyMPvBWV2IE3tARzCvnNGtzEFRtpIEtZ0cuctxeIF1id5\r\ncrfzdMDsmZyRHAOoZ9VtuD6mzj0ybQWMACb7eIHjZDCee3Slh3TVrLy06YRdq2I4\r\nbjMOPePtK5xnIpHGpAXkB3IONxyITpSLKsA4hCeP7gVvm7r7TuQg1ygiUBlWbBYn\r\niE5ROzqZjG1s7dQNZK/riiU2umGqGuwAb2IPvNiyuGR3cIgRE4llXH/rLuUlspAp\r\no4nlxaz65VucmNbN1aMbDXLJVSqR1DuE00vEsL1AItI=\r\n=XQoy\r\n-----END PGP PUBLIC KEY BLOCK-----", + "created_at": "2017-09-05T09:17:46.264Z" + } +] +``` + +## Get a specific GPG key + +Get a specific GPG key of currently authenticated user. + +``` +GET /user/gpg_keys/:key_id +``` + +Parameters: + +| Attribute | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `key_id` | integer | yes | The ID of the GPG key | + +```bash +curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/user/gpg_keys/1 +``` + +Example response: + +```json + { + "id": 1, + "key": "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFVjnlIBCACibzXOLCiZiL2oyzYUaTOCkYnSUhymg3pdbfKtd4mpBa58xKBj\r\nt1pTHVpw3Sk03wmzhM/Ndlt1AV2YhLv++83WKr+gAHFYFiCV/tnY8bx3HqvVoy8O\r\nCfxWhw4QZK7+oYzVmJj8ZJm3ZjOC4pzuegNWlNLCUdZDx9OKlHVXLCX1iUbjdYWa\r\nqKV6tdV8hZolkbyjedQgrpvoWyeSHHpwHF7yk4gNJWMMI5rpcssL7i6mMXb/sDzO\r\nVaAtU5wiVducsOa01InRFf7QSTxoAm6Xy0PGv/k48M6xCALa9nY+BzlOv47jUT57\r\nvilf4Szy9dKD0v9S0mQ+IHB+gNukWrnwtXx5ABEBAAHNFm5hbWUgKGNvbW1lbnQp\r\nIDxlbUBpbD7CwHUEEwECACkFAlVjnlIJEINgJNgv009/AhsDAhkBBgsJCAcDAgYV\r\nCAIJCgsEFgIDAQAAxqMIAFBHuBA8P1v8DtHonIK8Lx2qU23t8Mh68HBIkSjk2H7/\r\noO2cDWCw50jZ9D91PXOOyMPvBWV2IE3tARzCvnNGtzEFRtpIEtZ0cuctxeIF1id5\r\ncrfzdMDsmZyRHAOoZ9VtuD6mzj0ybQWMACb7eIHjZDCee3Slh3TVrLy06YRdq2I4\r\nbjMOPePtK5xnIpHGpAXkB3IONxyITpSLKsA4hCeP7gVvm7r7TuQg1ygiUBlWbBYn\r\niE5ROzqZjG1s7dQNZK/riiU2umGqGuwAb2IPvNiyuGR3cIgRE4llXH/rLuUlspAp\r\no4nlxaz65VucmNbN1aMbDXLJVSqR1DuE00vEsL1AItI=\r\n=XQoy\r\n-----END PGP PUBLIC KEY BLOCK-----", + "created_at": "2017-09-05T09:17:46.264Z" + } +``` + +## Add a GPG key + +Creates a new GPG key owned by the currently authenticated user. + +``` +POST /user/gpg_keys +``` + +Parameters: + +| Attribute | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| key | string | yes | The new GPG key | + +```bash +curl --data "key=-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFV..." --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/user/gpg_keys +``` + +Example response: + +```json +[ + { + "id": 1, + "key": "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFVjnlIBCACibzXOLCiZiL2oyzYUaTOCkYnSUhymg3pdbfKtd4mpBa58xKBj\r\nt1pTHVpw3Sk03wmzhM/Ndlt1AV2YhLv++83WKr+gAHFYFiCV/tnY8bx3HqvVoy8O\r\nCfxWhw4QZK7+oYzVmJj8ZJm3ZjOC4pzuegNWlNLCUdZDx9OKlHVXLCX1iUbjdYWa\r\nqKV6tdV8hZolkbyjedQgrpvoWyeSHHpwHF7yk4gNJWMMI5rpcssL7i6mMXb/sDzO\r\nVaAtU5wiVducsOa01InRFf7QSTxoAm6Xy0PGv/k48M6xCALa9nY+BzlOv47jUT57\r\nvilf4Szy9dKD0v9S0mQ+IHB+gNukWrnwtXx5ABEBAAHNFm5hbWUgKGNvbW1lbnQp\r\nIDxlbUBpbD7CwHUEEwECACkFAlVjnlIJEINgJNgv009/AhsDAhkBBgsJCAcDAgYV\r\nCAIJCgsEFgIDAQAAxqMIAFBHuBA8P1v8DtHonIK8Lx2qU23t8Mh68HBIkSjk2H7/\r\noO2cDWCw50jZ9D91PXOOyMPvBWV2IE3tARzCvnNGtzEFRtpIEtZ0cuctxeIF1id5\r\ncrfzdMDsmZyRHAOoZ9VtuD6mzj0ybQWMACb7eIHjZDCee3Slh3TVrLy06YRdq2I4\r\nbjMOPePtK5xnIpHGpAXkB3IONxyITpSLKsA4hCeP7gVvm7r7TuQg1ygiUBlWbBYn\r\niE5ROzqZjG1s7dQNZK/riiU2umGqGuwAb2IPvNiyuGR3cIgRE4llXH/rLuUlspAp\r\no4nlxaz65VucmNbN1aMbDXLJVSqR1DuE00vEsL1AItI=\r\n=XQoy\r\n-----END PGP PUBLIC KEY BLOCK-----", + "created_at": "2017-09-05T09:17:46.264Z" + } +] +``` + +## Delete a GPG key + +Delete a GPG key owned by currently authenticated user. + +``` +DELETE /user/gpg_keys/:key_id +``` + +Parameters: + +| Attribute | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `key_id` | integer | yes | The ID of the GPG key | + +```bash +curl --request DELETE --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/user/gpg_keys/1 +``` + +Returns `204 No Content` on success, or `404 Not found` if the key cannot be found. + +## List all GPG keys for given user + +Get a list of a specified user's GPG keys. Available only for admins. + +``` +GET /users/:id/gpg_keys +``` + +Parameters: + +| Attribute | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `id` | integer | yes | The ID of the user | + +```bash +curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/users/2/gpg_keys +``` + +Example response: + +```json +[ + { + "id": 1, + "key": "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFVjnlIBCACibzXOLCiZiL2oyzYUaTOCkYnSUhymg3pdbfKtd4mpBa58xKBj\r\nt1pTHVpw3Sk03wmzhM/Ndlt1AV2YhLv++83WKr+gAHFYFiCV/tnY8bx3HqvVoy8O\r\nCfxWhw4QZK7+oYzVmJj8ZJm3ZjOC4pzuegNWlNLCUdZDx9OKlHVXLCX1iUbjdYWa\r\nqKV6tdV8hZolkbyjedQgrpvoWyeSHHpwHF7yk4gNJWMMI5rpcssL7i6mMXb/sDzO\r\nVaAtU5wiVducsOa01InRFf7QSTxoAm6Xy0PGv/k48M6xCALa9nY+BzlOv47jUT57\r\nvilf4Szy9dKD0v9S0mQ+IHB+gNukWrnwtXx5ABEBAAHNFm5hbWUgKGNvbW1lbnQp\r\nIDxlbUBpbD7CwHUEEwECACkFAlVjnlIJEINgJNgv009/AhsDAhkBBgsJCAcDAgYV\r\nCAIJCgsEFgIDAQAAxqMIAFBHuBA8P1v8DtHonIK8Lx2qU23t8Mh68HBIkSjk2H7/\r\noO2cDWCw50jZ9D91PXOOyMPvBWV2IE3tARzCvnNGtzEFRtpIEtZ0cuctxeIF1id5\r\ncrfzdMDsmZyRHAOoZ9VtuD6mzj0ybQWMACb7eIHjZDCee3Slh3TVrLy06YRdq2I4\r\nbjMOPePtK5xnIpHGpAXkB3IONxyITpSLKsA4hCeP7gVvm7r7TuQg1ygiUBlWbBYn\r\niE5ROzqZjG1s7dQNZK/riiU2umGqGuwAb2IPvNiyuGR3cIgRE4llXH/rLuUlspAp\r\no4nlxaz65VucmNbN1aMbDXLJVSqR1DuE00vEsL1AItI=\r\n=XQoy\r\n-----END PGP PUBLIC KEY BLOCK-----", + "created_at": "2017-09-05T09:17:46.264Z" + } +] +``` + +## Get a specific GPG key for a given user + +Get a specific GPG key for a given user. Available only for admins. + +``` +GET /users/:id/gpg_keys/:key_id +``` + +Parameters: + +| Attribute | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `id` | integer | yes | The ID of the user | +| `key_id` | integer | yes | The ID of the GPG key | + +```bash +curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/users/2/gpg_keys/1 +``` + +Example response: + +```json + { + "id": 1, + "key": "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFVjnlIBCACibzXOLCiZiL2oyzYUaTOCkYnSUhymg3pdbfKtd4mpBa58xKBj\r\nt1pTHVpw3Sk03wmzhM/Ndlt1AV2YhLv++83WKr+gAHFYFiCV/tnY8bx3HqvVoy8O\r\nCfxWhw4QZK7+oYzVmJj8ZJm3ZjOC4pzuegNWlNLCUdZDx9OKlHVXLCX1iUbjdYWa\r\nqKV6tdV8hZolkbyjedQgrpvoWyeSHHpwHF7yk4gNJWMMI5rpcssL7i6mMXb/sDzO\r\nVaAtU5wiVducsOa01InRFf7QSTxoAm6Xy0PGv/k48M6xCALa9nY+BzlOv47jUT57\r\nvilf4Szy9dKD0v9S0mQ+IHB+gNukWrnwtXx5ABEBAAHNFm5hbWUgKGNvbW1lbnQp\r\nIDxlbUBpbD7CwHUEEwECACkFAlVjnlIJEINgJNgv009/AhsDAhkBBgsJCAcDAgYV\r\nCAIJCgsEFgIDAQAAxqMIAFBHuBA8P1v8DtHonIK8Lx2qU23t8Mh68HBIkSjk2H7/\r\noO2cDWCw50jZ9D91PXOOyMPvBWV2IE3tARzCvnNGtzEFRtpIEtZ0cuctxeIF1id5\r\ncrfzdMDsmZyRHAOoZ9VtuD6mzj0ybQWMACb7eIHjZDCee3Slh3TVrLy06YRdq2I4\r\nbjMOPePtK5xnIpHGpAXkB3IONxyITpSLKsA4hCeP7gVvm7r7TuQg1ygiUBlWbBYn\r\niE5ROzqZjG1s7dQNZK/riiU2umGqGuwAb2IPvNiyuGR3cIgRE4llXH/rLuUlspAp\r\no4nlxaz65VucmNbN1aMbDXLJVSqR1DuE00vEsL1AItI=\r\n=XQoy\r\n-----END PGP PUBLIC KEY BLOCK-----", + "created_at": "2017-09-05T09:17:46.264Z" + } +``` + +## Add a GPG key for a given user + +Create new GPG key owned by the specified user. Available only for admins. + +``` +POST /users/:id/gpg_keys +``` + +Parameters: + +| Attribute | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `id` | integer | yes | The ID of the user | +| `key_id` | integer | yes | The ID of the GPG key | + +```bash +curl --data "key=-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFV..." --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/users/2/gpg_keys +``` + +Example response: + +```json +[ + { + "id": 1, + "key": "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFVjnlIBCACibzXOLCiZiL2oyzYUaTOCkYnSUhymg3pdbfKtd4mpBa58xKBj\r\nt1pTHVpw3Sk03wmzhM/Ndlt1AV2YhLv++83WKr+gAHFYFiCV/tnY8bx3HqvVoy8O\r\nCfxWhw4QZK7+oYzVmJj8ZJm3ZjOC4pzuegNWlNLCUdZDx9OKlHVXLCX1iUbjdYWa\r\nqKV6tdV8hZolkbyjedQgrpvoWyeSHHpwHF7yk4gNJWMMI5rpcssL7i6mMXb/sDzO\r\nVaAtU5wiVducsOa01InRFf7QSTxoAm6Xy0PGv/k48M6xCALa9nY+BzlOv47jUT57\r\nvilf4Szy9dKD0v9S0mQ+IHB+gNukWrnwtXx5ABEBAAHNFm5hbWUgKGNvbW1lbnQp\r\nIDxlbUBpbD7CwHUEEwECACkFAlVjnlIJEINgJNgv009/AhsDAhkBBgsJCAcDAgYV\r\nCAIJCgsEFgIDAQAAxqMIAFBHuBA8P1v8DtHonIK8Lx2qU23t8Mh68HBIkSjk2H7/\r\noO2cDWCw50jZ9D91PXOOyMPvBWV2IE3tARzCvnNGtzEFRtpIEtZ0cuctxeIF1id5\r\ncrfzdMDsmZyRHAOoZ9VtuD6mzj0ybQWMACb7eIHjZDCee3Slh3TVrLy06YRdq2I4\r\nbjMOPePtK5xnIpHGpAXkB3IONxyITpSLKsA4hCeP7gVvm7r7TuQg1ygiUBlWbBYn\r\niE5ROzqZjG1s7dQNZK/riiU2umGqGuwAb2IPvNiyuGR3cIgRE4llXH/rLuUlspAp\r\no4nlxaz65VucmNbN1aMbDXLJVSqR1DuE00vEsL1AItI=\r\n=XQoy\r\n-----END PGP PUBLIC KEY BLOCK-----", + "created_at": "2017-09-05T09:17:46.264Z" + } +] +``` + +## Delete a GPG key for a given user + +Delete a GPG key owned by a specified user. Available only for admins. + +``` +DELETE /users/:id/gpg_keys/:key_id +``` + +Parameters: + +| Attribute | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `id` | integer | yes | The ID of the user | +| `key_id` | integer | yes | The ID of the GPG key | + +```bash +curl --request DELETE --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/users/2/gpg_keys/1 +``` + ## List emails Get a list of currently authenticated user's emails. diff --git a/doc/ci/environments.md b/doc/ci/environments.md index 28b27921f8b..cbf06afa294 100644 --- a/doc/ci/environments.md +++ b/doc/ci/environments.md @@ -274,9 +274,7 @@ session - and even a multiplexer like `screen` or `tmux`! >**Note:** Container-based deployments often lack basic tools (like an editor), and may be stopped or restarted at any time. If this happens, you will lose all your -changes! Treat this as a debugging tool, not a comprehensive online IDE. You -can use [Koding](../administration/integration/koding.md) for online -development. +changes! Treat this as a debugging tool, not a comprehensive online IDE. --- diff --git a/doc/ci/runners/README.md b/doc/ci/runners/README.md index 4ccf1b56771..f5d3b524d6e 100644 --- a/doc/ci/runners/README.md +++ b/doc/ci/runners/README.md @@ -107,9 +107,26 @@ To lock/unlock a Runner: 1. Check the **Lock to current projects** option 1. Click **Save changes** for the changes to take effect +## Assigning a Runner to another project + +If you are Master on a project where a specific Runner is assigned to, and the +Runner is not [locked only to that project](#locking-a-specific-runner-from-being-enabled-for-other-projects), +you can enable the Runner also on any other project where you have Master permissions. + +To enable/disable a Runner in your project: + +1. Visit your project's **Settings ➔ Pipelines** +1. Find the Runner you wish to enable/disable +1. Click **Enable for this project** or **Disable for this project** + +> **Note**: +Consider that if you don't lock your specific Runner to a specific project, any +user with Master role in you project can assign your runner to another arbitrary +project without requiring your authorization, so use it with caution. + ## Protected Runners ->**Notes:** +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13194) in GitLab 10.0. diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index cacfd2ed254..d0ac3ec6163 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -130,7 +130,7 @@ There are also two edge cases worth mentioning: ### types -> Deprecated, and will be removed in 10.0. Use [stages](#stages) instead. +> Deprecated, and could be removed in one of the future releases. Use [stages](#stages) instead. Alias for [stages](#stages). diff --git a/doc/development/fe_guide/vue.md b/doc/development/fe_guide/vue.md index 0742b202807..2607353782a 100644 --- a/doc/development/fe_guide/vue.md +++ b/doc/development/fe_guide/vue.md @@ -28,8 +28,9 @@ As always, the Frontend Architectural Experts are available to help with any Vue All new features built with Vue.js must follow a [Flux architecture][flux]. The main goal we are trying to achieve is to have only one data flow and only one data entry. -In order to achieve this goal, each Vue bundle needs a Store - where we keep all the data -, -a Service - that we use to communicate with the server - and a main Vue component. +In order to achieve this goal, you can either use [vuex](#vuex) or use the [store pattern][state-management], explained below: + +Each Vue bundle needs a Store - where we keep all the data -,a Service - that we use to communicate with the server - and a main Vue component. Think of the Main Vue Component as the entry point of your application. This is the only smart component that should exist in each Vue feature. @@ -74,6 +75,59 @@ provided as a prop to the main component. Don't forget to follow [these steps.][page_specific_javascript] +### Bootstrapping Gotchas +#### Providing data from Haml to JavaScript +While mounting a Vue application may be a need to provide data from Rails to JavaScript. +To do that, provide the data through `data` attributes in the HTML element and query them while mounting the application. + +_Note:_ You should only do this while initing the application, because the mounted element will be replaced with Vue-generated DOM. + +The advantage of providing data from the DOM to the Vue instance through `props` in the `render` function +instead of querying the DOM inside the main vue component is that makes tests easier by avoiding the need to +create a fixture or an HTML element in the unit test. See the following example: + +```javascript +// haml +.js-vue-app{ data: { endpoint: 'foo' }} + +document.addEventListener('DOMContentLoaded', () => new Vue({ + el: '.js-vue-app', + data() { + const dataset = this.$options.el.dataset; + return { + endpoint: dataset.endpoint, + }; + }, + render(createElement) { + return createElement('my-component', { + props: { + endpoint: this.isLoading, + }, + }); + }, +})); +``` + +#### Accessing the `gl` object +When we need to query the `gl` object for data that won't change during the application's lyfecyle, we should do it in the same place where we query the DOM. +By following this practice, we can avoid the need to mock the `gl` object, which will make tests easier. +It should be done while initializing our Vue instance, and the data should be provided as `props` to the main component: + +##### example: +```javascript + +document.addEventListener('DOMContentLoaded', () => new Vue({ + el: '.js-vue-app', + render(createElement) { + return createElement('my-component', { + props: { + username: gon.current_username, + }, + }); + }, +})); +``` + ### A folder for Components This folder holds all components that are specific of this new feature. @@ -89,6 +143,29 @@ in one table would not be a good use of this pattern. You can read more about components in Vue.js site, [Component System][component-system] +#### Components Gotchas +1. Using SVGs in components: To use an SVG in a template we need to make it a property we can access through the component. +A `prop` and a property returned by the `data` functions require `vue` to set a `getter` and a `setter` for each of them. +The SVG should be a computed property in order to improve performance, note that computed properties are cached based on their dependencies. + +```javascript +// bad +import svg from 'svg.svg'; +data() { + return { + myIcon: svg, + }; +}; + +// good +import svg from 'svg.svg'; +computed: { + myIcon() { + return svg; + } +} +``` + ### A folder for the Store The Store is a class that allows us to manage the state in a single @@ -430,11 +507,23 @@ describe('Todos App', () => { }); }); ``` +#### `mountComponent` helper +There is an helper in `spec/javascripts/helpers/vue_mount_component_helper.js` that allows you to mount a component with the given props: + +```javascript +import Vue from 'vue'; +import mountComponent from 'helpers/vue_mount_component_helper.js' +import component from 'component.vue' + +const Component = Vue.extend(component); +const data = {prop: 'foo'}; +const vm = mountComponent(Component, data); +``` + #### Test the component's output The main return value of a Vue component is the rendered output. In order to test the component we need to test the rendered output. [Vue][vue-test] guide's to unit test show us exactly that: - ### Stubbing API responses [Vue Resource Interceptors][vue-resource-interceptor] allow us to add a interceptor with the response we need: @@ -481,6 +570,198 @@ new Component({ new Component().$mount(); ``` +## Vuex +To manage the state of an application you may use [Vuex][vuex-docs]. + +_Note:_ All of the below is explained in more detail in the official [Vuex documentation][vuex-docs]. + +### Separation of concerns +Vuex is composed of State, Getters, Mutations, Actions and Modules. + +When a user clicks on an action, we need to `dispatch` it. This action will `commit` a mutation that will change the state. +_Note:_ The action itself will not update the state, only a mutation should update the state. + +#### File structure +When using Vuex at GitLab, separate this concerns into different files to improve readability. If you can, separate the Mutation Types as well: + +``` +└── store + ├── index.js # where we assemble modules and export the store + ├── actions.js # actions + ├── mutations.js # mutations + ├── getters.js # getters + └── mutation_types.js # mutation types +``` +The following examples show an application that lists and adds users to the state. + +##### `index.js` +This is the entry point for our store. You can use the following as a guide: + +```javascript +import Vue from 'vue'; +import Vuex from 'vuex'; +import * as actions from './actions'; +import * as mutations from './mutations'; + +Vue.use(Vuex); + +export default new Vuex.Store({ + actions, + getters, + state: { + users: [], + }, +}); +``` +_Note:_ If the state of the application is too complex, an individual file for the state may be better. + +#### `actions.js` +An action commits a mutatation. In this file, we will write the actions that will call the respective mutation: + +```javascript + import * as types from './mutation-types' + + export const addUser = ({ commit }, user) => { + commit(types.ADD_USER, user); + }; +``` + +To dispatch an action from a component, use the `mapActions` helper: +```javascript +import { mapActions } from 'vuex'; + +{ + methods: { + ...mapActions([ + 'addUser', + ]), + onClickUser(user) { + this.addUser(user); + }, + }, +}; +``` + +#### `getters.js` +Sometimes we may need to get derived state based on store state, like filtering for a specific prop. This can be done through the `getters`: + +```javascript +// get all the users with pets +export getUsersWithPets = (state, getters) => { + return state.users.filter(user => user.pet !== undefined); +}; +``` + +To access a getter from a component, use the `mapGetters` helper: +```javascript +import { mapGetters } from 'vuex'; + +{ + computed: { + ...mapGetters([ + 'getUsersWithPets', + ]), + }, +}; +``` + +#### `mutations.js` +The only way to actually change state in a Vuex store is by committing a mutation. + +```javascript + import * as types from './mutation-types' + export default { + [types.ADD_USER](state, user) { + state.users.push(user); + }, + }; +``` + +#### `mutations_types.js` +From [vuex mutations docs][vuex-mutations]: +> It is a commonly seen pattern to use constants for mutation types in various Flux implementations. This allows the code to take advantage of tooling like linters, and putting all constants in a single file allows your collaborators to get an at-a-glance view of what mutations are possible in the entire application. + +```javascript +export const ADD_USER = 'ADD_USER'; +``` + +### How to include the store in your application +The store should be included in the main component of your application: +```javascript + // app.vue + import store from 'store'; // it will include the index.js file + + export default { + name: 'application', + store, + ... + }; +``` + +### Vuex Gotchas +1. Avoid calling a mutation directly. Always use an action to commit a mutation. Doing so will keep consistency through out the application. From Vuex docs: + + > why don't we just call store.commit('action') directly? Well, remember that mutations must be synchronous? Actions aren't. We can perform asynchronous operations inside an action. + + ```javascript + // component.vue + + // bad + created() { + this.$store.commit('mutation'); + } + + // good + created() { + this.$store.dispatch('action'); + } + ``` +1. When possible, use mutation types instead of hardcoding strings. It will be less error prone. +1. The State will be accessible in all components descending from the use where the store is instantiated. + +### Testing Vuex +#### Testing Vuex concerns +Refer to [vuex docs][vuex-testing] regarding testing Actions, Getters and Mutations. + +#### Testing components that need a store +Smaller components might use `store` properties to access the data. +In order to write unit tests for those components, we need to include the store and provide the correct state: + +```javascript +//component_spec.js +import Vue from 'vue'; +import store from './store'; +import component from './component.vue' + +describe('component', () => { + let vm; + let Component; + + beforeEach(() => { + Component = Vue.extend(issueActions); + }); + + afterEach(() => { + vm.$destroy(); + }); + + it('should show a user', () => { + const user = { + name: 'Foo', + age: '30', + }; + + // populate the store + store.dipatch('addUser', user); + + vm = new Component({ + store, + propsData: props, + }).$mount(); + }); +}); +``` + [vue-docs]: http://vuejs.org/guide/index.html [issue-boards]: https://gitlab.com/gitlab-org/gitlab-ce/tree/master/app/assets/javascripts/boards [environments-table]: https://gitlab.com/gitlab-org/gitlab-ce/tree/master/app/assets/javascripts/environments @@ -493,3 +774,7 @@ new Component().$mount(); [vue-test]: https://vuejs.org/v2/guide/unit-testing.html [issue-boards-service]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/assets/javascripts/boards/services/board_service.js.es6 [flux]: https://facebook.github.io/flux +[vuex-docs]: https://vuex.vuejs.org +[vuex-structure]: https://vuex.vuejs.org/en/structure.html +[vuex-mutations]: https://vuex.vuejs.org/en/mutations.html +[vuex-testing]: https://vuex.vuejs.org/en/testing.html diff --git a/doc/integration/README.md b/doc/integration/README.md index d70b9a7f54b..09d96bdd338 100644 --- a/doc/integration/README.md +++ b/doc/integration/README.md @@ -13,7 +13,6 @@ Bitbucket.org account - [External issue tracker](external-issue-tracker.md) Redmine, JIRA, etc. - [Gmail actions buttons](gmail_action_buttons_for_gitlab.md) Adds GitLab actions to messages - [JIRA](../user/project/integrations/jira.md) Integrate with the JIRA issue tracker -- [Koding](../administration/integration/koding.md) Configure Koding to use IDE integration - [LDAP](ldap.md) Set up sign in via LDAP - [OAuth2 provider](oauth_provider.md) OAuth2 application creation - [OmniAuth](omniauth.md) Sign in via Twitter, GitHub, GitLab.com, Google, Bitbucket, Facebook, Shibboleth, SAML, Crowd, Azure and Authentiq ID diff --git a/doc/ssh/README.md b/doc/ssh/README.md index cf28f1a2eca..793de9d777c 100644 --- a/doc/ssh/README.md +++ b/doc/ssh/README.md @@ -193,6 +193,38 @@ How to add your SSH key to Eclipse: https://wiki.eclipse.org/EGit/User_Guide#Ecl [winputty]: https://the.earth.li/~sgtatham/putty/0.67/htmldoc/Chapter8.html#pubkey-puttygen +## SSH on the GitLab server + +GitLab integrates with the system-installed SSH daemon, designating a user +(typically named `git`) through which all access requests are handled. Users +connecting to the GitLab server over SSH are identified by their SSH key instead +of their username. + +SSH *client* operations performed on the GitLab server wil be executed as this +user. Although it is possible to modify the SSH configuration for this user to, +e.g., provide a private SSH key to authenticate these requests by, this practice +is **not supported** and is strongly discouraged as it presents significant +security risks. + +The GitLab check process includes a check for this condition, and will direct you +to this section if your server is configured like this, e.g.: + +``` +$ gitlab-rake gitlab:check +# ... +Git user has default SSH configuration? ... no + Try fixing it: + mkdir ~/gitlab-check-backup-1504540051 + sudo mv /var/lib/git/.ssh/id_rsa ~/gitlab-check-backup-1504540051 + sudo mv /var/lib/git/.ssh/id_rsa.pub ~/gitlab-check-backup-1504540051 + For more information see: + doc/ssh/README.md in section "SSH on the GitLab server" + Please fix the error above and rerun the checks. +``` + +Remove the custom configuration as soon as you're able to. These customizations +are *explicitly not supported* and may stop working at any time. + ## Troubleshooting If on Git clone you are prompted for a password like `git@gitlab.com's password:` diff --git a/doc/user/permissions.md b/doc/user/permissions.md index dcf210e1085..bd0a58c4cca 100644 --- a/doc/user/permissions.md +++ b/doc/user/permissions.md @@ -21,16 +21,16 @@ The following table depicts the various user permission levels in a project. | Action | Guest | Reporter | Developer | Master | Owner | |---------------------------------------|---------|------------|-------------|----------|--------| -| Create new issue | ✓ | ✓ | ✓ | ✓ | ✓ | -| Create confidential issue | ✓ | ✓ | ✓ | ✓ | ✓ | -| View confidential issues | (✓) [^1] | ✓ | ✓ | ✓ | ✓ | -| Leave comments | ✓ | ✓ | ✓ | ✓ | ✓ | -| See a list of jobs | ✓ [^2] | ✓ | ✓ | ✓ | ✓ | -| See a job log | ✓ [^2] | ✓ | ✓ | ✓ | ✓ | -| Download and browse job artifacts | ✓ [^2] | ✓ | ✓ | ✓ | ✓ | -| View wiki pages | ✓ | ✓ | ✓ | ✓ | ✓ | -| Pull project code | | ✓ | ✓ | ✓ | ✓ | -| Download project | | ✓ | ✓ | ✓ | ✓ | +| Create new issue | ✓ [^1] | ✓ | ✓ | ✓ | ✓ | +| Create confidential issue | ✓ [^1] | ✓ | ✓ | ✓ | ✓ | +| View confidential issues | (✓) [^2] | ✓ | ✓ | ✓ | ✓ | +| Leave comments | ✓ [^1] | ✓ | ✓ | ✓ | ✓ | +| See a list of jobs | ✓ [^3] | ✓ | ✓ | ✓ | ✓ | +| See a job log | ✓ [^3] | ✓ | ✓ | ✓ | ✓ | +| Download and browse job artifacts | ✓ [^3] | ✓ | ✓ | ✓ | ✓ | +| View wiki pages | ✓ [^1] | ✓ | ✓ | ✓ | ✓ | +| Pull project code | [^1] | ✓ | ✓ | ✓ | ✓ | +| Download project | [^1] | ✓ | ✓ | ✓ | ✓ | | Create code snippets | | ✓ | ✓ | ✓ | ✓ | | Manage issue tracker | | ✓ | ✓ | ✓ | ✓ | | Manage labels | | ✓ | ✓ | ✓ | ✓ | @@ -71,8 +71,8 @@ The following table depicts the various user permission levels in a project. | Switch visibility level | | | | | ✓ | | Transfer project to another namespace | | | | | ✓ | | Remove project | | | | | ✓ | -| Force push to protected branches [^3] | | | | | | -| Remove protected branches [^3] | | | | | | +| Force push to protected branches [^4] | | | | | | +| Remove protected branches [^4] | | | | | | | Remove pages | | | | | ✓ | ## Project features permissions @@ -215,13 +215,13 @@ users: | Run CI job | | ✓ | ✓ | ✓ | | Clone source and LFS from current project | | ✓ | ✓ | ✓ | | Clone source and LFS from public projects | | ✓ | ✓ | ✓ | -| Clone source and LFS from internal projects | | ✓ [^4] | ✓ [^4] | ✓ | -| Clone source and LFS from private projects | | ✓ [^5] | ✓ [^5] | ✓ [^5] | +| Clone source and LFS from internal projects | | ✓ [^5] | ✓ [^5] | ✓ | +| Clone source and LFS from private projects | | ✓ [^6] | ✓ [^6] | ✓ [^6] | | Push source and LFS | | | | | | Pull container images from current project | | ✓ | ✓ | ✓ | | Pull container images from public projects | | ✓ | ✓ | ✓ | -| Pull container images from internal projects| | ✓ [^4] | ✓ [^4] | ✓ | -| Pull container images from private projects | | ✓ [^5] | ✓ [^5] | ✓ [^5] | +| Pull container images from internal projects| | ✓ [^5] | ✓ [^5] | ✓ | +| Pull container images from private projects | | ✓ [^6] | ✓ [^6] | ✓ [^6] | | Push container images to current project | | ✓ | ✓ | ✓ | | Push container images to other projects | | | | | @@ -243,12 +243,11 @@ with the permissions described on the documentation on [auditor users permission Auditor users are available in [GitLab Enterprise Edition Premium](https://about.gitlab.com/gitlab-ee/) only. ----- - -[^1]: Guest users can only view the confidential issues they created themselves -[^2]: If **Public pipelines** is enabled in **Project Settings > Pipelines** -[^3]: Not allowed for Guest, Reporter, Developer, Master, or Owner -[^4]: Only if user is not external one. -[^5]: Only if user is a member of the project. +[^1]: On public and internal projects, all users are able to perform this action. +[^2]: Guest users can only view the confidential issues they created themselves +[^3]: If **Public pipelines** is enabled in **Project Settings > Pipelines** +[^4]: Not allowed for Guest, Reporter, Developer, Master, or Owner +[^5]: Only if user is not external one. +[^6]: Only if user is a member of the project. [ce-18994]: https://gitlab.com/gitlab-org/gitlab-ce/issues/18994 [new-mod]: project/new_ci_build_permissions_model.md diff --git a/doc/user/project/index.md b/doc/user/project/index.md index 41a96246292..d6b3d59d407 100644 --- a/doc/user/project/index.md +++ b/doc/user/project/index.md @@ -67,8 +67,6 @@ website with GitLab Pages **Other features:** - [Cycle Analytics](cycle_analytics.md): Review your development lifecycle -- [Koding integration](koding.md) (not available on GitLab.com): Integrate -with Koding to have access to a web terminal right from the GitLab UI - [Syntax highlighting](highlighting.md): An alternative to customize your code blocks, overriding GitLab's default choice of language diff --git a/doc/user/project/koding.md b/doc/user/project/koding.md index 455e2ee47b4..86e06a39e59 100644 --- a/doc/user/project/koding.md +++ b/doc/user/project/koding.md @@ -1,6 +1,9 @@ # Koding integration -> [Introduced][ce-5909] in GitLab 8.11. +>**Notes:** +- **As of GitLab 10.0, the Koding integration is deprecated and will be removed + in a future version.** +- [Introduced][ce-5909] in GitLab 8.11. This document will guide you through using Koding integration on GitLab in detail. For configuring and installing please follow the diff --git a/doc/user/project/repository/gpg_signed_commits/img/project_signed_and_unsigned_commits.png b/doc/user/project/repository/gpg_signed_commits/img/project_signed_and_unsigned_commits.png Binary files differindex 33936a7d6d7..088ecfa6d89 100644 --- a/doc/user/project/repository/gpg_signed_commits/img/project_signed_and_unsigned_commits.png +++ b/doc/user/project/repository/gpg_signed_commits/img/project_signed_and_unsigned_commits.png diff --git a/doc/user/project/repository/gpg_signed_commits/img/project_signed_commit_unverified_signature.png b/doc/user/project/repository/gpg_signed_commits/img/project_signed_commit_unverified_signature.png Binary files differindex 22565cf7c7e..4e3392406b1 100644 --- a/doc/user/project/repository/gpg_signed_commits/img/project_signed_commit_unverified_signature.png +++ b/doc/user/project/repository/gpg_signed_commits/img/project_signed_commit_unverified_signature.png diff --git a/doc/user/project/repository/gpg_signed_commits/img/project_signed_commit_verified_signature.png b/doc/user/project/repository/gpg_signed_commits/img/project_signed_commit_verified_signature.png Binary files differindex 1778b2ddf2b..766970dee81 100644 --- a/doc/user/project/repository/gpg_signed_commits/img/project_signed_commit_verified_signature.png +++ b/doc/user/project/repository/gpg_signed_commits/img/project_signed_commit_verified_signature.png diff --git a/doc/user/project/repository/gpg_signed_commits/index.md b/doc/user/project/repository/gpg_signed_commits/index.md index ff419d714f9..afe8066d408 100644 --- a/doc/user/project/repository/gpg_signed_commits/index.md +++ b/doc/user/project/repository/gpg_signed_commits/index.md @@ -22,11 +22,12 @@ GitLab uses its own keyring to verify the GPG signature. It does not access any public key server. In order to have a commit verified on GitLab the corresponding public key needs -to be uploaded to GitLab. For a signature to be verified two prerequisites need +to be uploaded to GitLab. For a signature to be verified three conditions need to be met: 1. The public key needs to be added your GitLab account 1. One of the emails in the GPG key matches your **primary** email +1. The committer's email matches the verified email from the gpg key ## Generating a GPG key diff --git a/doc/user/search/img/issue_search_by_term.png b/doc/user/search/img/issue_search_by_term.png Binary files differnew file mode 100644 index 00000000000..66e612c4ea6 --- /dev/null +++ b/doc/user/search/img/issue_search_by_term.png diff --git a/doc/user/search/index.md b/doc/user/search/index.md index f5c7ce49e8e..21e96d8b11c 100644 --- a/doc/user/search/index.md +++ b/doc/user/search/index.md @@ -40,6 +40,20 @@ The same process is valid for merge requests. Navigate to your project's **Merge and click **Search or filter results...**. Merge requests can be filtered by author, assignee, milestone, and label. +### Searching for specific terms + +You can filter issues and merge requests by specific terms included in titles or descriptions. + +* Syntax + * Searches look for all the words in a query, in any order. E.g.: searching + issues for `display bug` will return all issues matching both those words, in any order. + * To find the exact term, use double quotes: `"display bug"` +* Limitation + * For performance reasons, terms shorter than 3 chars are ignored. E.g.: searching + issues for `included in titles` is same as `included titles` + +![filter issues by specific terms](img/issue_search_by_term.png) + ### Issues and merge requests per group Similar to **Issues and merge requests per project**, you can also search for issues diff --git a/lib/api/branches.rb b/lib/api/branches.rb index a989394ad91..642c1140fcc 100644 --- a/lib/api/branches.rb +++ b/lib/api/branches.rb @@ -24,17 +24,22 @@ module API present paginate(branches), with: Entities::RepoBranch, project: user_project end - desc 'Get a single branch' do - success Entities::RepoBranch - end - params do - requires :branch, type: String, desc: 'The name of the branch' - end - get ':id/repository/branches/:branch', requirements: BRANCH_ENDPOINT_REQUIREMENTS do - branch = user_project.repository.find_branch(params[:branch]) - not_found!("Branch") unless branch + resource ':id/repository/branches/:branch', requirements: BRANCH_ENDPOINT_REQUIREMENTS do + desc 'Get a single branch' do + success Entities::RepoBranch + end + params do + requires :branch, type: String, desc: 'The name of the branch' + end + head do + user_project.repository.branch_exists?(params[:branch]) ? status(204) : status(404) + end + get do + branch = user_project.repository.find_branch(params[:branch]) + not_found!('Branch') unless branch - present branch, with: Entities::RepoBranch, project: user_project + present branch, with: Entities::RepoBranch, project: user_project + end end # Note: This API will be deprecated in favor of the protected branches API. diff --git a/lib/api/commit_statuses.rb b/lib/api/commit_statuses.rb index 6314ea63197..829eef18795 100644 --- a/lib/api/commit_statuses.rb +++ b/lib/api/commit_statuses.rb @@ -103,7 +103,7 @@ module API when 'success' status.success! when 'failed' - status.drop! + status.drop!(:api_failure) when 'canceled' status.cancel! else diff --git a/lib/api/entities.rb b/lib/api/entities.rb index f13f2d723bb..031dd02c6eb 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -491,6 +491,10 @@ module API expose :user, using: Entities::UserPublic end + class GPGKey < Grape::Entity + expose :id, :key, :created_at + end + class Note < Grape::Entity # Only Issue and MergeRequest have iid NOTEABLE_TYPES_WITH_IID = %w(Issue MergeRequest).freeze @@ -819,7 +823,7 @@ module API class Variable < Grape::Entity expose :key, :value - expose :protected?, as: :protected + expose :protected?, as: :protected, if: -> (entity, _) { entity.respond_to?(:protected?) } end class Pipeline < PipelineBasic @@ -840,6 +844,7 @@ module API class PipelineScheduleDetails < PipelineSchedule expose :last_pipeline, using: Entities::PipelineBasic + expose :variables, using: Entities::Variable end class EnvironmentBasic < Grape::Entity diff --git a/lib/api/issues.rb b/lib/api/issues.rb index e4c2c390853..1729df2aad0 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -36,6 +36,7 @@ module API optional :assignee_id, type: Integer, desc: 'Return issues which are assigned to the user with the given ID' optional :scope, type: String, values: %w[created-by-me assigned-to-me all], desc: 'Return issues for the given scope: `created-by-me`, `assigned-to-me` or `all`' + optional :my_reaction_emoji, type: String, desc: 'Return issues reacted by the authenticated user by the given emoji' use :pagination end diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 7bcbf9f20ff..56d72d511da 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -40,6 +40,7 @@ module API optional :assignee_id, type: Integer, desc: 'Return merge requests which are assigned to the user with the given ID' optional :scope, type: String, values: %w[created-by-me assigned-to-me all], desc: 'Return merge requests for the given scope: `created-by-me`, `assigned-to-me` or `all`' + optional :my_reaction_emoji, type: String, desc: 'Return issues reacted by the authenticated user by the given emoji' use :pagination end end diff --git a/lib/api/pipeline_schedules.rb b/lib/api/pipeline_schedules.rb index ef01cbc7875..37f32411296 100644 --- a/lib/api/pipeline_schedules.rb +++ b/lib/api/pipeline_schedules.rb @@ -31,10 +31,6 @@ module API requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id' end get ':id/pipeline_schedules/:pipeline_schedule_id' do - authorize! :read_pipeline_schedule, user_project - - not_found!('PipelineSchedule') unless pipeline_schedule - present pipeline_schedule, with: Entities::PipelineScheduleDetails end @@ -74,9 +70,6 @@ module API optional :active, type: Boolean, desc: 'The activation of pipeline schedule' end put ':id/pipeline_schedules/:pipeline_schedule_id' do - authorize! :read_pipeline_schedule, user_project - - not_found!('PipelineSchedule') unless pipeline_schedule authorize! :update_pipeline_schedule, pipeline_schedule if pipeline_schedule.update(declared_params(include_missing: false)) @@ -93,9 +86,6 @@ module API requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id' end post ':id/pipeline_schedules/:pipeline_schedule_id/take_ownership' do - authorize! :read_pipeline_schedule, user_project - - not_found!('PipelineSchedule') unless pipeline_schedule authorize! :update_pipeline_schedule, pipeline_schedule if pipeline_schedule.own!(current_user) @@ -112,21 +102,84 @@ module API requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id' end delete ':id/pipeline_schedules/:pipeline_schedule_id' do - authorize! :read_pipeline_schedule, user_project - - not_found!('PipelineSchedule') unless pipeline_schedule authorize! :admin_pipeline_schedule, pipeline_schedule destroy_conditionally!(pipeline_schedule) end + + desc 'Create a new pipeline schedule variable' do + success Entities::Variable + end + params do + requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id' + requires :key, type: String, desc: 'The key of the variable' + requires :value, type: String, desc: 'The value of the variable' + end + post ':id/pipeline_schedules/:pipeline_schedule_id/variables' do + authorize! :update_pipeline_schedule, pipeline_schedule + + variable_params = declared_params(include_missing: false) + variable = pipeline_schedule.variables.create(variable_params) + if variable.persisted? + present variable, with: Entities::Variable + else + render_validation_error!(variable) + end + end + + desc 'Edit a pipeline schedule variable' do + success Entities::Variable + end + params do + requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id' + requires :key, type: String, desc: 'The key of the variable' + optional :value, type: String, desc: 'The value of the variable' + end + put ':id/pipeline_schedules/:pipeline_schedule_id/variables/:key' do + authorize! :update_pipeline_schedule, pipeline_schedule + + if pipeline_schedule_variable.update(declared_params(include_missing: false)) + present pipeline_schedule_variable, with: Entities::Variable + else + render_validation_error!(pipeline_schedule_variable) + end + end + + desc 'Delete a pipeline schedule variable' do + success Entities::Variable + end + params do + requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id' + requires :key, type: String, desc: 'The key of the variable' + end + delete ':id/pipeline_schedules/:pipeline_schedule_id/variables/:key' do + authorize! :admin_pipeline_schedule, pipeline_schedule + + status :accepted + present pipeline_schedule_variable.destroy, with: Entities::Variable + end end helpers do def pipeline_schedule @pipeline_schedule ||= - user_project.pipeline_schedules - .preload(:owner, :last_pipeline) - .find_by(id: params.delete(:pipeline_schedule_id)) + user_project + .pipeline_schedules + .preload(:owner, :last_pipeline) + .find_by(id: params.delete(:pipeline_schedule_id)).tap do |pipeline_schedule| + unless can?(current_user, :read_pipeline_schedule, pipeline_schedule) + not_found!('Pipeline Schedule') + end + end + end + + def pipeline_schedule_variable + @pipeline_schedule_variable ||= + pipeline_schedule.variables.find_by(key: params[:key]).tap do |pipeline_schedule_variable| + unless pipeline_schedule_variable + not_found!('Pipeline Schedule Variable') + end + end end end end diff --git a/lib/api/runner.rb b/lib/api/runner.rb index 11999354594..a3987c560dd 100644 --- a/lib/api/runner.rb +++ b/lib/api/runner.rb @@ -114,6 +114,8 @@ module API requires :id, type: Integer, desc: %q(Job's ID) optional :trace, type: String, desc: %q(Job's full trace) optional :state, type: String, desc: %q(Job's status: success, failed) + optional :failure_reason, type: String, values: CommitStatus.failure_reasons.keys, + desc: %q(Job's failure_reason) end put '/:id' do job = authenticate_job! @@ -127,7 +129,7 @@ module API when 'success' job.success when 'failed' - job.drop + job.drop(params[:failure_reason] || :unknown_failure) end end diff --git a/lib/api/users.rb b/lib/api/users.rb index 96f47bb618a..1825c90a23b 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -233,6 +233,86 @@ module API destroy_conditionally!(key) end + desc 'Add a GPG key to a specified user. Available only for admins.' do + detail 'This feature was added in GitLab 10.0' + success Entities::GPGKey + end + params do + requires :id, type: Integer, desc: 'The ID of the user' + requires :key, type: String, desc: 'The new GPG key' + end + post ':id/gpg_keys' do + authenticated_as_admin! + + user = User.find_by(id: params.delete(:id)) + not_found!('User') unless user + + key = user.gpg_keys.new(declared_params(include_missing: false)) + + if key.save + present key, with: Entities::GPGKey + else + render_validation_error!(key) + end + end + + desc 'Get the GPG keys of a specified user. Available only for admins.' do + detail 'This feature was added in GitLab 10.0' + success Entities::GPGKey + end + params do + requires :id, type: Integer, desc: 'The ID of the user' + use :pagination + end + get ':id/gpg_keys' do + authenticated_as_admin! + + user = User.find_by(id: params[:id]) + not_found!('User') unless user + + present paginate(user.gpg_keys), with: Entities::GPGKey + end + + desc 'Delete an existing GPG key from a specified user. Available only for admins.' do + detail 'This feature was added in GitLab 10.0' + end + params do + requires :id, type: Integer, desc: 'The ID of the user' + requires :key_id, type: Integer, desc: 'The ID of the GPG key' + end + delete ':id/gpg_keys/:key_id' do + authenticated_as_admin! + + user = User.find_by(id: params[:id]) + not_found!('User') unless user + + key = user.gpg_keys.find_by(id: params[:key_id]) + not_found!('GPG Key') unless key + + status 204 + key.destroy + end + + desc 'Revokes an existing GPG key from a specified user. Available only for admins.' do + detail 'This feature was added in GitLab 10.0' + end + params do + requires :id, type: Integer, desc: 'The ID of the user' + requires :key_id, type: Integer, desc: 'The ID of the GPG key' + end + post ':id/gpg_keys/:key_id/revoke' do + authenticated_as_admin! + + user = User.find_by(id: params[:id]) + not_found!('User') unless user + + key = user.gpg_keys.find_by(id: params[:key_id]) + not_found!('GPG Key') unless key + + key.revoke + status :accepted + end + desc 'Add an email address to a specified user. Available only for admins.' do success Entities::Email end @@ -492,6 +572,76 @@ module API destroy_conditionally!(key) end + desc "Get the currently authenticated user's GPG keys" do + detail 'This feature was added in GitLab 10.0' + success Entities::GPGKey + end + params do + use :pagination + end + get 'gpg_keys' do + present paginate(current_user.gpg_keys), with: Entities::GPGKey + end + + desc 'Get a single GPG key owned by currently authenticated user' do + detail 'This feature was added in GitLab 10.0' + success Entities::GPGKey + end + params do + requires :key_id, type: Integer, desc: 'The ID of the GPG key' + end + get 'gpg_keys/:key_id' do + key = current_user.gpg_keys.find_by(id: params[:key_id]) + not_found!('GPG Key') unless key + + present key, with: Entities::GPGKey + end + + desc 'Add a new GPG key to the currently authenticated user' do + detail 'This feature was added in GitLab 10.0' + success Entities::GPGKey + end + params do + requires :key, type: String, desc: 'The new GPG key' + end + post 'gpg_keys' do + key = current_user.gpg_keys.new(declared_params) + + if key.save + present key, with: Entities::GPGKey + else + render_validation_error!(key) + end + end + + desc 'Revoke a GPG key owned by currently authenticated user' do + detail 'This feature was added in GitLab 10.0' + end + params do + requires :key_id, type: Integer, desc: 'The ID of the GPG key' + end + post 'gpg_keys/:key_id/revoke' do + key = current_user.gpg_keys.find_by(id: params[:key_id]) + not_found!('GPG Key') unless key + + key.revoke + status :accepted + end + + desc 'Delete a GPG key from the currently authenticated user' do + detail 'This feature was added in GitLab 10.0' + end + params do + requires :key_id, type: Integer, desc: 'The ID of the SSH key' + end + delete 'gpg_keys/:key_id' do + key = current_user.gpg_keys.find_by(id: params[:key_id]) + not_found!('GPG Key') unless key + + status 204 + key.destroy + end + desc "Get the currently authenticated user's email addresses" do success Entities::Email end diff --git a/lib/api/v3/triggers.rb b/lib/api/v3/triggers.rb index e9d4c35307b..534911fde5c 100644 --- a/lib/api/v3/triggers.rb +++ b/lib/api/v3/triggers.rb @@ -16,25 +16,31 @@ module API optional :variables, type: Hash, desc: 'The list of variables to be injected into build' end post ":id/(ref/:ref/)trigger/builds", requirements: { ref: /.+/ } do - project = find_project(params[:id]) - trigger = Ci::Trigger.find_by_token(params[:token].to_s) - not_found! unless project && trigger - unauthorized! unless trigger.project == project - # validate variables - variables = params[:variables].to_h - unless variables.all? { |key, value| key.is_a?(String) && value.is_a?(String) } + params[:variables] = params[:variables].to_h + unless params[:variables].all? { |key, value| key.is_a?(String) && value.is_a?(String) } render_api_error!('variables needs to be a map of key-valued strings', 400) end - # create request and trigger builds - result = Ci::CreateTriggerRequestService.execute(project, trigger, params[:ref].to_s, variables) - pipeline = result.pipeline + project = find_project(params[:id]) + not_found! unless project + + result = Ci::PipelineTriggerService.new(project, nil, params).execute + not_found! unless result - if pipeline.persisted? - present result.trigger_request, with: ::API::V3::Entities::TriggerRequest + if result[:http_status] + render_api_error!(result[:message], result[:http_status]) else - render_validation_error!(pipeline) + pipeline = result[:pipeline] + + # We switched to Ci::PipelineVariable from Ci::TriggerRequest.variables. + # Ci::TriggerRequest doesn't save variables anymore. + # Here is copying Ci::PipelineVariable to Ci::TriggerRequest.variables for presenting the variables. + # The same endpoint in v4 API pressents Pipeline instead of TriggerRequest, so it doesn't need such a process. + trigger_request = pipeline.trigger_requests.last + trigger_request.variables = params[:variables] + + present trigger_request, with: ::API::V3::Entities::TriggerRequest end end diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index c67f7724307..f7577b02d5d 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -605,6 +605,49 @@ module Gitlab # TODO: implement this method end + def add_branch(branch_name, committer:, target:) + target_object = Ref.dereference_object(lookup(target)) + raise InvalidRef.new("target not found: #{target}") unless target_object + + OperationService.new(committer, self).add_branch(branch_name, target_object.oid) + find_branch(branch_name) + rescue Rugged::ReferenceError => ex + raise InvalidRef, ex + end + + def add_tag(tag_name, committer:, target:, message: nil) + target_object = Ref.dereference_object(lookup(target)) + raise InvalidRef.new("target not found: #{target}") unless target_object + + committer = Committer.from_user(committer) if committer.is_a?(User) + + options = nil # Use nil, not the empty hash. Rugged cares about this. + if message + options = { + message: message, + tagger: Gitlab::Git.committer_hash(email: committer.email, name: committer.name) + } + end + + OperationService.new(committer, self).add_tag(tag_name, target_object.oid, options) + + find_tag(tag_name) + rescue Rugged::ReferenceError => ex + raise InvalidRef, ex + end + + def rm_branch(branch_name, committer:) + OperationService.new(committer, self).rm_branch(find_branch(branch_name)) + end + + def rm_tag(tag_name, committer:) + OperationService.new(committer, self).rm_tag(find_tag(tag_name)) + end + + def find_tag(name) + tags.find { |tag| tag.name == name } + end + # Delete the specified branch from the repository # # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/476 diff --git a/lib/gitlab/gpg.rb b/lib/gitlab/gpg.rb index 45e9f9d65ae..025f826e65f 100644 --- a/lib/gitlab/gpg.rb +++ b/lib/gitlab/gpg.rb @@ -39,7 +39,7 @@ module Gitlab fingerprints = CurrentKeyChain.fingerprints_from_key(key) GPGME::Key.find(:public, fingerprints).flat_map do |raw_key| - raw_key.uids.map { |uid| { name: uid.name, email: uid.email } } + raw_key.uids.map { |uid| { name: uid.name, email: uid.email.downcase } } end end end diff --git a/lib/gitlab/gpg/commit.rb b/lib/gitlab/gpg/commit.rb index 606c7576f70..86bd9f5b125 100644 --- a/lib/gitlab/gpg/commit.rb +++ b/lib/gitlab/gpg/commit.rb @@ -1,17 +1,12 @@ module Gitlab module Gpg class Commit - def self.for_commit(commit) - new(commit.project, commit.sha) - end - - def initialize(project, sha) - @project = project - @sha = sha + def initialize(commit) + @commit = commit @signature_text, @signed_text = begin - Rugged::Commit.extract_signature(project.repository.rugged, sha) + Rugged::Commit.extract_signature(@commit.project.repository.rugged, @commit.sha) rescue Rugged::OdbError nil end @@ -26,7 +21,7 @@ module Gitlab return @signature if @signature - cached_signature = GpgSignature.find_by(commit_sha: @sha) + cached_signature = GpgSignature.find_by(commit_sha: @commit.sha) return @signature = cached_signature if cached_signature.present? @signature = create_cached_signature! @@ -73,20 +68,31 @@ module Gitlab def attributes(gpg_key) user_infos = user_infos(gpg_key) + verification_status = verification_status(gpg_key) { - commit_sha: @sha, - project: @project, + commit_sha: @commit.sha, + project: @commit.project, gpg_key: gpg_key, gpg_key_primary_keyid: gpg_key&.primary_keyid || verified_signature.fingerprint, gpg_key_user_name: user_infos[:name], gpg_key_user_email: user_infos[:email], - valid_signature: gpg_signature_valid_signature_value(gpg_key) + verification_status: verification_status } end - def gpg_signature_valid_signature_value(gpg_key) - !!(gpg_key && gpg_key.verified? && verified_signature.valid?) + def verification_status(gpg_key) + return :unknown_key unless gpg_key + return :unverified_key unless gpg_key.verified? + return :unverified unless verified_signature.valid? + + if gpg_key.verified_and_belongs_to_email?(@commit.committer_email) + :verified + elsif gpg_key.user.all_emails.include?(@commit.committer_email) + :same_user_different_email + else + :other_user + end end def user_infos(gpg_key) diff --git a/lib/gitlab/gpg/invalid_gpg_signature_updater.rb b/lib/gitlab/gpg/invalid_gpg_signature_updater.rb index a525ee7a9ee..e085eab26c9 100644 --- a/lib/gitlab/gpg/invalid_gpg_signature_updater.rb +++ b/lib/gitlab/gpg/invalid_gpg_signature_updater.rb @@ -8,7 +8,7 @@ module Gitlab def run GpgSignature .select(:id, :commit_sha, :project_id) - .where('gpg_key_id IS NULL OR valid_signature = ?', false) + .where('gpg_key_id IS NULL OR verification_status <> ?', GpgSignature.verification_statuses[:verified]) .where(gpg_key_primary_keyid: @gpg_key.primary_keyid) .find_each { |sig| sig.gpg_commit.update_signature!(sig) } end diff --git a/lib/gitlab/issuables_count_for_state.rb b/lib/gitlab/issuables_count_for_state.rb new file mode 100644 index 00000000000..505810964bc --- /dev/null +++ b/lib/gitlab/issuables_count_for_state.rb @@ -0,0 +1,50 @@ +module Gitlab + # Class for counting and caching the number of issuables per state. + class IssuablesCountForState + # The name of the RequestStore cache key. + CACHE_KEY = :issuables_count_for_state + + # The state values that can be safely casted to a Symbol. + STATES = %w[opened closed merged all].freeze + + # finder - The finder class to use for retrieving the issuables. + def initialize(finder) + @finder = finder + @cache = + if RequestStore.active? + RequestStore[CACHE_KEY] ||= initialize_cache + else + initialize_cache + end + end + + def for_state_or_opened(state = nil) + self[state || :opened] + end + + # Returns the count for the given state. + # + # state - The name of the state as either a String or a Symbol. + # + # Returns an Integer. + def [](state) + state = state.to_sym if cast_state_to_symbol?(state) + + cache_for_finder[state] || 0 + end + + private + + def cache_for_finder + @cache[@finder] + end + + def cast_state_to_symbol?(state) + state.is_a?(String) && STATES.include?(state) + end + + def initialize_cache + Hash.new { |hash, finder| hash[finder] = finder.count_by_state } + end + end +end diff --git a/lib/gitlab/sql/pattern.rb b/lib/gitlab/sql/pattern.rb index b42bc67ccfc..7c2d1d8f887 100644 --- a/lib/gitlab/sql/pattern.rb +++ b/lib/gitlab/sql/pattern.rb @@ -4,6 +4,7 @@ module Gitlab extend ActiveSupport::Concern MIN_CHARS_FOR_PARTIAL_MATCHING = 3 + REGEX_QUOTED_WORD = /(?<=^| )"[^"]+"(?= |$)/ class_methods do def to_pattern(query) @@ -17,6 +18,28 @@ module Gitlab def partial_matching?(query) query.length >= MIN_CHARS_FOR_PARTIAL_MATCHING end + + def to_fuzzy_arel(column, query) + words = select_fuzzy_words(query) + + matches = words.map { |word| arel_table[column].matches(to_pattern(word)) } + + matches.reduce { |result, match| result.and(match) } + end + + def select_fuzzy_words(query) + quoted_words = query.scan(REGEX_QUOTED_WORD) + + query = quoted_words.reduce(query) { |q, quoted_word| q.sub(quoted_word, '') } + + words = query.split(/\s+/) + + quoted_words.map! { |quoted_word| quoted_word[1..-2] } + + words.concat(quoted_words) + + words.select { |word| partial_matching?(word) } + end end end end diff --git a/lib/system_check/app/git_user_default_ssh_config_check.rb b/lib/system_check/app/git_user_default_ssh_config_check.rb new file mode 100644 index 00000000000..7b486d78cf0 --- /dev/null +++ b/lib/system_check/app/git_user_default_ssh_config_check.rb @@ -0,0 +1,69 @@ +module SystemCheck + module App + class GitUserDefaultSSHConfigCheck < SystemCheck::BaseCheck + # These files are allowed in the .ssh directory. The `config` file is not + # whitelisted as it may change the SSH client's behaviour dramatically. + WHITELIST = %w[ + authorized_keys + authorized_keys2 + known_hosts + ].freeze + + set_name 'Git user has default SSH configuration?' + set_skip_reason 'skipped (git user is not present or configured)' + + def skip? + !home_dir || !File.directory?(home_dir) + end + + def check? + forbidden_files.empty? + end + + def show_error + backup_dir = "~/gitlab-check-backup-#{Time.now.to_i}" + + instructions = forbidden_files.map do |filename| + "sudo mv #{Shellwords.escape(filename)} #{backup_dir}" + end + + try_fixing_it("mkdir #{backup_dir}", *instructions) + for_more_information('doc/ssh/README.md in section "SSH on the GitLab server"') + fix_and_rerun + end + + private + + def git_user + Gitlab.config.gitlab.user + end + + def home_dir + return @home_dir if defined?(@home_dir) + + @home_dir = + begin + File.expand_path("~#{git_user}") + rescue ArgumentError + nil + end + end + + def ssh_dir + return nil unless home_dir + + File.join(home_dir, '.ssh') + end + + def forbidden_files + @forbidden_files ||= + begin + present = Dir[File.join(ssh_dir, '*')] + whitelisted = WHITELIST.map { |basename| File.join(ssh_dir, basename) } + + present - whitelisted + end + end + end + end +end diff --git a/lib/tasks/gettext.rake b/lib/tasks/gettext.rake index f7f2fa2f14c..35ba729c156 100644 --- a/lib/tasks/gettext.rake +++ b/lib/tasks/gettext.rake @@ -1,5 +1,4 @@ require "gettext_i18n_rails/tasks" -require 'simple_po_parser' namespace :gettext do # Customize list of translatable files @@ -23,6 +22,8 @@ namespace :gettext do desc 'Lint all po files in `locale/' task lint: :environment do + require 'simple_po_parser' + FastGettext.silence_errors files = Dir.glob(Rails.root.join('locale/*/gitlab.po')) diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index 1bd36bbe20a..92a3f503fcb 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -33,6 +33,7 @@ namespace :gitlab do SystemCheck::App::RedisVersionCheck, SystemCheck::App::RubyVersionCheck, SystemCheck::App::GitVersionCheck, + SystemCheck::App::GitUserDefaultSSHConfigCheck, SystemCheck::App::ActiveUsersCheck ] diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 2b7c6f7ad33..97bc3d80642 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: gitlab 1.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-08-24 09:29+0200\n" -"PO-Revision-Date: 2017-08-24 09:29+0200\n" +"POT-Creation-Date: 2017-08-31 17:34+0530\n" +"PO-Revision-Date: 2017-08-31 17:34+0530\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "Language: \n" @@ -427,6 +427,9 @@ msgstr "" msgid "Every week (Sundays at 4:00am)" msgstr "" +msgid "Explore projects" +msgstr "" + msgid "Failed to change the owner" msgstr "" @@ -837,6 +840,27 @@ msgstr "" msgid "ProjectNetworkGraph|Graph" msgstr "" +msgid "ProjectsDropdown|Frequently visited" +msgstr "" + +msgid "ProjectsDropdown|Loading projects" +msgstr "" + +msgid "ProjectsDropdown|No projects matched your query" +msgstr "" + +msgid "ProjectsDropdown|Projects you visit often will appear here" +msgstr "" + +msgid "ProjectsDropdown|Search projects" +msgstr "" + +msgid "ProjectsDropdown|Something went wrong on our end." +msgstr "" + +msgid "ProjectsDropdown|This feature requires browser localStorage support" +msgstr "" + msgid "Push events" msgstr "" @@ -950,6 +974,9 @@ msgstr "" msgid "StarProject|Star" msgstr "" +msgid "Starred projects" +msgstr "" + msgid "Start a %{new_merge_request} with these changes" msgstr "" @@ -1271,6 +1298,9 @@ msgstr "" msgid "Your name" msgstr "" +msgid "Your projects" +msgstr "" + msgid "day" msgid_plural "days" msgstr[0] "" diff --git a/spec/controllers/concerns/issuable_collections_spec.rb b/spec/controllers/concerns/issuable_collections_spec.rb new file mode 100644 index 00000000000..c9687af4dd2 --- /dev/null +++ b/spec/controllers/concerns/issuable_collections_spec.rb @@ -0,0 +1,82 @@ +require 'spec_helper' + +describe IssuableCollections do + let(:user) { create(:user) } + + let(:controller) do + klass = Class.new do + def self.helper_method(name); end + + include IssuableCollections + end + + controller = klass.new + + allow(controller).to receive(:params).and_return(state: 'opened') + + controller + end + + describe '#redirect_out_of_range' do + before do + allow(controller).to receive(:url_for) + end + + it 'returns true and redirects if the offset is out of range' do + relation = double(:relation, current_page: 10) + + expect(controller).to receive(:redirect_to) + expect(controller.send(:redirect_out_of_range, relation, 2)).to eq(true) + end + + it 'returns false if the offset is not out of range' do + relation = double(:relation, current_page: 1) + + expect(controller).not_to receive(:redirect_to) + expect(controller.send(:redirect_out_of_range, relation, 2)).to eq(false) + end + end + + describe '#issues_page_count' do + it 'returns the number of issue pages' do + project = create(:project, :public) + + create(:issue, project: project) + + finder = IssuesFinder.new(user) + issues = finder.execute + + allow(controller).to receive(:issues_finder) + .and_return(finder) + + expect(controller.send(:issues_page_count, issues)).to eq(1) + end + end + + describe '#merge_requests_page_count' do + it 'returns the number of merge request pages' do + project = create(:project, :public) + + create(:merge_request, source_project: project, target_project: project) + + finder = MergeRequestsFinder.new(user) + merge_requests = finder.execute + + allow(controller).to receive(:merge_requests_finder) + .and_return(finder) + + pages = controller.send(:merge_requests_page_count, merge_requests) + + expect(pages).to eq(1) + end + end + + describe '#page_count_for_relation' do + it 'returns the number of pages' do + relation = double(:relation, limit_value: 20) + pages = controller.send(:page_count_for_relation, relation, 28) + + expect(pages).to eq(2) + end + end +end diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index 25ec63de94a..c2b59239af9 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -107,7 +107,7 @@ FactoryGirl.define do end trait :triggered do - trigger_request factory: :ci_trigger_request_with_variables + trigger_request factory: :ci_trigger_request end after(:build) do |build, evaluator| diff --git a/spec/factories/ci/pipeline_variable_variables.rb b/spec/factories/ci/pipeline_variables.rb index 7c1a7faec08..7c1a7faec08 100644 --- a/spec/factories/ci/pipeline_variable_variables.rb +++ b/spec/factories/ci/pipeline_variables.rb diff --git a/spec/factories/ci/trigger_requests.rb b/spec/factories/ci/trigger_requests.rb index 10e0ab4fd3c..40b8848920e 100644 --- a/spec/factories/ci/trigger_requests.rb +++ b/spec/factories/ci/trigger_requests.rb @@ -1,14 +1,5 @@ FactoryGirl.define do factory :ci_trigger_request, class: Ci::TriggerRequest do trigger factory: :ci_trigger - - factory :ci_trigger_request_with_variables do - variables do - { - TRIGGER_KEY_1: 'TRIGGER_VALUE_1', - TRIGGER_KEY_2: 'TRIGGER_VALUE_2' - } - end - end end end diff --git a/spec/factories/gpg_signature.rb b/spec/factories/gpg_signature.rb index a5aeffbe12d..c0beecf0bea 100644 --- a/spec/factories/gpg_signature.rb +++ b/spec/factories/gpg_signature.rb @@ -6,6 +6,6 @@ FactoryGirl.define do project gpg_key gpg_key_primary_keyid { gpg_key.primary_keyid } - valid_signature true + verification_status :verified end end diff --git a/spec/features/boards/add_issues_modal_spec.rb b/spec/features/boards/add_issues_modal_spec.rb index a6ad5981f8f..c480b5b7e34 100644 --- a/spec/features/boards/add_issues_modal_spec.rb +++ b/spec/features/boards/add_issues_modal_spec.rb @@ -8,8 +8,8 @@ describe 'Issue Boards add issue modal', :js do let!(:label) { create(:label, project: project) } let!(:list1) { create(:list, board: board, label: planning, position: 0) } let!(:list2) { create(:list, board: board, label: label, position: 1) } - let!(:issue) { create(:issue, project: project) } - let!(:issue2) { create(:issue, project: project) } + let!(:issue) { create(:issue, project: project, title: 'abc', description: 'def') } + let!(:issue2) { create(:issue, project: project, title: 'hij', description: 'klm') } before do project.team << [user, :master] diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 913258ca40f..e010b5f3444 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -73,15 +73,15 @@ describe 'Issue Boards', js: true do let!(:list2) { create(:list, board: board, label: development, position: 1) } let!(:confidential_issue) { create(:labeled_issue, :confidential, project: project, author: user, labels: [planning], relative_position: 9) } - let!(:issue1) { create(:labeled_issue, project: project, assignees: [user], labels: [planning], relative_position: 8) } - let!(:issue2) { create(:labeled_issue, project: project, author: user2, labels: [planning], relative_position: 7) } - let!(:issue3) { create(:labeled_issue, project: project, labels: [planning], relative_position: 6) } - let!(:issue4) { create(:labeled_issue, project: project, labels: [planning], relative_position: 5) } - let!(:issue5) { create(:labeled_issue, project: project, labels: [planning], milestone: milestone, relative_position: 4) } - let!(:issue6) { create(:labeled_issue, project: project, labels: [planning, development], relative_position: 3) } - let!(:issue7) { create(:labeled_issue, project: project, labels: [development], relative_position: 2) } - let!(:issue8) { create(:closed_issue, project: project) } - let!(:issue9) { create(:labeled_issue, project: project, labels: [planning, testing, bug, accepting], relative_position: 1) } + let!(:issue1) { create(:labeled_issue, project: project, title: 'aaa', description: '111', assignees: [user], labels: [planning], relative_position: 8) } + let!(:issue2) { create(:labeled_issue, project: project, title: 'bbb', description: '222', author: user2, labels: [planning], relative_position: 7) } + let!(:issue3) { create(:labeled_issue, project: project, title: 'ccc', description: '333', labels: [planning], relative_position: 6) } + let!(:issue4) { create(:labeled_issue, project: project, title: 'ddd', description: '444', labels: [planning], relative_position: 5) } + let!(:issue5) { create(:labeled_issue, project: project, title: 'eee', description: '555', labels: [planning], milestone: milestone, relative_position: 4) } + let!(:issue6) { create(:labeled_issue, project: project, title: 'fff', description: '666', labels: [planning, development], relative_position: 3) } + let!(:issue7) { create(:labeled_issue, project: project, title: 'ggg', description: '777', labels: [development], relative_position: 2) } + let!(:issue8) { create(:closed_issue, project: project, title: 'hhh', description: '888') } + let!(:issue9) { create(:labeled_issue, project: project, title: 'iii', description: '999', labels: [planning, testing, bug, accepting], relative_position: 1) } before do visit project_board_path(project, board) diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb index 0c9fcc60d30..479fb713297 100644 --- a/spec/features/commits_spec.rb +++ b/spec/features/commits_spec.rb @@ -203,105 +203,4 @@ describe 'Commits' do end end end - - describe 'GPG signed commits', :js do - it 'changes from unverified to verified when the user changes his email to match the gpg key' do - user = create :user, email: 'unrelated.user@example.org' - project.team << [user, :master] - - Sidekiq::Testing.inline! do - create :gpg_key, key: GpgHelpers::User1.public_key, user: user - end - - sign_in(user) - - visit project_commits_path(project, :'signed-commits') - - within '#commits-list' do - expect(page).to have_content 'Unverified' - expect(page).not_to have_content 'Verified' - end - - # user changes his email which makes the gpg key verified - Sidekiq::Testing.inline! do - user.skip_reconfirmation! - user.update_attributes!(email: GpgHelpers::User1.emails.first) - end - - visit project_commits_path(project, :'signed-commits') - - within '#commits-list' do - expect(page).to have_content 'Unverified' - expect(page).to have_content 'Verified' - end - end - - it 'changes from unverified to verified when the user adds the missing gpg key' do - user = create :user, email: GpgHelpers::User1.emails.first - project.team << [user, :master] - - sign_in(user) - - visit project_commits_path(project, :'signed-commits') - - within '#commits-list' do - expect(page).to have_content 'Unverified' - expect(page).not_to have_content 'Verified' - end - - # user adds the gpg key which makes the signature valid - Sidekiq::Testing.inline! do - create :gpg_key, key: GpgHelpers::User1.public_key, user: user - end - - visit project_commits_path(project, :'signed-commits') - - within '#commits-list' do - expect(page).to have_content 'Unverified' - expect(page).to have_content 'Verified' - end - end - - it 'shows popover badges' do - gpg_user = create :user, email: GpgHelpers::User1.emails.first, username: 'nannie.bernhard', name: 'Nannie Bernhard' - Sidekiq::Testing.inline! do - create :gpg_key, key: GpgHelpers::User1.public_key, user: gpg_user - end - - user = create :user - project.team << [user, :master] - - sign_in(user) - visit project_commits_path(project, :'signed-commits') - - # unverified signature - click_on 'Unverified', match: :first - within '.popover' do - expect(page).to have_content 'This commit was signed with an unverified signature.' - expect(page).to have_content "GPG Key ID: #{GpgHelpers::User2.primary_keyid}" - end - - # verified and the gpg user has a gitlab profile - click_on 'Verified', match: :first - within '.popover' do - expect(page).to have_content 'This commit was signed with a verified signature.' - expect(page).to have_content 'Nannie Bernhard' - expect(page).to have_content '@nannie.bernhard' - expect(page).to have_content "GPG Key ID: #{GpgHelpers::User1.primary_keyid}" - end - - # verified and the gpg user's profile doesn't exist anymore - gpg_user.destroy! - - visit project_commits_path(project, :'signed-commits') - - click_on 'Verified', match: :first - within '.popover' do - expect(page).to have_content 'This commit was signed with a verified signature.' - expect(page).to have_content 'Nannie Bernhard' - expect(page).to have_content 'nannie.bernhard@example.com' - expect(page).to have_content "GPG Key ID: #{GpgHelpers::User1.primary_keyid}" - end - end - end end diff --git a/spec/features/merge_requests/user_posts_diff_notes_spec.rb b/spec/features/merge_requests/user_posts_diff_notes_spec.rb index 877f305120e..442ce14eb7e 100644 --- a/spec/features/merge_requests/user_posts_diff_notes_spec.rb +++ b/spec/features/merge_requests/user_posts_diff_notes_spec.rb @@ -97,6 +97,16 @@ feature 'Merge requests > User posts diff notes', :js do visit diffs_project_merge_request_path(project, merge_request, view: 'inline') end + context 'after deleteing a note' do + it 'allows commenting' do + should_allow_commenting(find('[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"]')) + + first('.js-note-delete', visible: false).trigger('click') + + should_allow_commenting(find('[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"]')) + end + end + context 'with a new line' do it 'allows commenting' do should_allow_commenting(find('[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"]')) diff --git a/spec/features/profiles/gpg_keys_spec.rb b/spec/features/profiles/gpg_keys_spec.rb index 6edc482b47e..623e4f341c5 100644 --- a/spec/features/profiles/gpg_keys_spec.rb +++ b/spec/features/profiles/gpg_keys_spec.rb @@ -42,7 +42,7 @@ feature 'Profile > GPG Keys' do scenario 'User revokes a key via the key index' do gpg_key = create :gpg_key, user: user, key: GpgHelpers::User2.public_key - gpg_signature = create :gpg_signature, gpg_key: gpg_key, valid_signature: true + gpg_signature = create :gpg_signature, gpg_key: gpg_key, verification_status: :verified visit profile_gpg_keys_path @@ -51,7 +51,7 @@ feature 'Profile > GPG Keys' do expect(page).to have_content('Your GPG keys (0)') expect(gpg_signature.reload).to have_attributes( - valid_signature: false, + verification_status: 'unknown_key', gpg_key: nil ) end diff --git a/spec/features/projects/import_export/import_file_spec.rb b/spec/features/projects/import_export/import_file_spec.rb index 2eb6fab129d..ad2db1a34f4 100644 --- a/spec/features/projects/import_export/import_file_spec.rb +++ b/spec/features/projects/import_export/import_file_spec.rb @@ -18,23 +18,25 @@ feature 'Import/Export - project import integration test', js: true do context 'when selecting the namespace' do let(:user) { create(:admin) } - let!(:namespace) { create(:namespace, name: "asd", owner: user) } + let!(:namespace) { create(:namespace, name: 'asd', owner: user) } + let(:project_path) { 'test-project-path' + SecureRandom.hex } context 'prefilled the path' do scenario 'user imports an exported project successfully' do visit new_project_path select2(namespace.id, from: '#project_namespace_id') - fill_in :project_path, with: 'test-project-path', visible: true + fill_in :project_path, with: project_path, visible: true click_link 'GitLab export' expect(page).to have_content('Import an exported GitLab project') - expect(URI.parse(current_url).query).to eq("namespace_id=#{namespace.id}&path=test-project-path") - expect(Gitlab::ImportExport).to receive(:import_upload_path).with(filename: /\A\h{32}_test-project-path\z/).and_call_original + expect(URI.parse(current_url).query).to eq("namespace_id=#{namespace.id}&path=#{project_path}") + expect(Gitlab::ImportExport).to receive(:import_upload_path).with(filename: /\A\h{32}_test-project-path\h*\z/).and_call_original attach_file('file', file) + click_on 'Import project' - expect { click_on 'Import project' }.to change { Project.count }.by(1) + expect(Project.count).to eq(1) project = Project.last expect(project).not_to be_nil @@ -64,7 +66,7 @@ feature 'Import/Export - project import integration test', js: true do end scenario 'invalid project' do - namespace = create(:namespace, name: "asd", owner: user) + namespace = create(:namespace, name: 'asdf', owner: user) project = create(:project, namespace: namespace) visit new_project_path diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 037ac00d39f..3b5c6966287 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -292,26 +292,44 @@ feature 'Jobs' do end feature 'Variables' do - let(:trigger_request) { create(:ci_trigger_request_with_variables) } + let(:trigger_request) { create(:ci_trigger_request) } let(:job) do create :ci_build, pipeline: pipeline, trigger_request: trigger_request end - before do - visit project_job_path(project, job) + shared_examples 'expected variables behavior' do + it 'shows variable key and value after click', js: true do + expect(page).to have_css('.reveal-variables') + expect(page).not_to have_css('.js-build-variable') + expect(page).not_to have_css('.js-build-value') + + click_button 'Reveal Variables' + + expect(page).not_to have_css('.reveal-variables') + expect(page).to have_selector('.js-build-variable', text: 'TRIGGER_KEY_1') + expect(page).to have_selector('.js-build-value', text: 'TRIGGER_VALUE_1') + end end - it 'shows variable key and value after click', js: true do - expect(page).to have_css('.reveal-variables') - expect(page).not_to have_css('.js-build-variable') - expect(page).not_to have_css('.js-build-value') + context 'when variables are stored in trigger_request' do + before do + trigger_request.update_attribute(:variables, { 'TRIGGER_KEY_1' => 'TRIGGER_VALUE_1' } ) - click_button 'Reveal Variables' + visit project_job_path(project, job) + end + + it_behaves_like 'expected variables behavior' + end + + context 'when variables are stored in pipeline_variables' do + before do + create(:ci_pipeline_variable, pipeline: pipeline, key: 'TRIGGER_KEY_1', value: 'TRIGGER_VALUE_1') + + visit project_job_path(project, job) + end - expect(page).not_to have_css('.reveal-variables') - expect(page).to have_selector('.js-build-variable', text: 'TRIGGER_KEY_1') - expect(page).to have_selector('.js-build-value', text: 'TRIGGER_VALUE_1') + it_behaves_like 'expected variables behavior' end end diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index baf3d29e6c5..81f7ab80a04 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -95,49 +95,6 @@ feature 'Project' do end end - describe 'project title' do - let(:user) { create(:user) } - let(:project) { create(:project, namespace: user.namespace) } - - before do - sign_in(user) - project.add_user(user, Gitlab::Access::MASTER) - visit project_path(project) - end - - it 'clicks toggle and shows dropdown', js: true do - find('.js-projects-dropdown-toggle').click - expect(page).to have_css('.dropdown-menu-projects .dropdown-content li', count: 1) - end - end - - describe 'project title' do - let(:user) { create(:user) } - let(:project) { create(:project, namespace: user.namespace) } - let(:project2) { create(:project, namespace: user.namespace, path: 'test') } - let(:issue) { create(:issue, project: project) } - - context 'on issues page', js: true do - before do - sign_in(user) - project.add_user(user, Gitlab::Access::MASTER) - project2.add_user(user, Gitlab::Access::MASTER) - visit project_issue_path(project, issue) - end - - it 'clicks toggle and shows dropdown' do - find('.js-projects-dropdown-toggle').click - expect(page).to have_css('.dropdown-menu-projects .dropdown-content li', count: 2) - - page.within '.dropdown-menu-projects' do - click_link project.name_with_namespace - end - - expect(page).to have_content project.name - end - end - end - describe 'tree view (default view is set to Files)' do let(:user) { create(:user, project_view: 'files') } let(:project) { create(:forked_project_with_submodules) } diff --git a/spec/features/signed_commits_spec.rb b/spec/features/signed_commits_spec.rb new file mode 100644 index 00000000000..8efa5b58141 --- /dev/null +++ b/spec/features/signed_commits_spec.rb @@ -0,0 +1,179 @@ +require 'spec_helper' + +describe 'GPG signed commits', :js do + let(:project) { create(:project, :repository) } + + it 'changes from unverified to verified when the user changes his email to match the gpg key' do + user = create :user, email: 'unrelated.user@example.org' + project.team << [user, :master] + + Sidekiq::Testing.inline! do + create :gpg_key, key: GpgHelpers::User1.public_key, user: user + end + + sign_in(user) + + visit project_commits_path(project, :'signed-commits') + + within '#commits-list' do + expect(page).to have_content 'Unverified' + expect(page).not_to have_content 'Verified' + end + + # user changes his email which makes the gpg key verified + Sidekiq::Testing.inline! do + user.skip_reconfirmation! + user.update_attributes!(email: GpgHelpers::User1.emails.first) + end + + visit project_commits_path(project, :'signed-commits') + + within '#commits-list' do + expect(page).to have_content 'Unverified' + expect(page).to have_content 'Verified' + end + end + + it 'changes from unverified to verified when the user adds the missing gpg key' do + user = create :user, email: GpgHelpers::User1.emails.first + project.team << [user, :master] + + sign_in(user) + + visit project_commits_path(project, :'signed-commits') + + within '#commits-list' do + expect(page).to have_content 'Unverified' + expect(page).not_to have_content 'Verified' + end + + # user adds the gpg key which makes the signature valid + Sidekiq::Testing.inline! do + create :gpg_key, key: GpgHelpers::User1.public_key, user: user + end + + visit project_commits_path(project, :'signed-commits') + + within '#commits-list' do + expect(page).to have_content 'Unverified' + expect(page).to have_content 'Verified' + end + end + + context 'shows popover badges' do + let(:user_1) do + create :user, email: GpgHelpers::User1.emails.first, username: 'nannie.bernhard', name: 'Nannie Bernhard' + end + + let(:user_1_key) do + Sidekiq::Testing.inline! do + create :gpg_key, key: GpgHelpers::User1.public_key, user: user_1 + end + end + + let(:user_2) do + create(:user, email: GpgHelpers::User2.emails.first, username: 'bette.cartwright', name: 'Bette Cartwright').tap do |user| + # secondary, unverified email + create :email, user: user, email: GpgHelpers::User2.emails.last + end + end + + let(:user_2_key) do + Sidekiq::Testing.inline! do + create :gpg_key, key: GpgHelpers::User2.public_key, user: user_2 + end + end + + before do + user = create :user + project.team << [user, :master] + + sign_in(user) + end + + it 'unverified signature' do + visit project_commits_path(project, :'signed-commits') + + within(find('.commit', text: 'signed commit by bette cartwright')) do + click_on 'Unverified' + within '.popover' do + expect(page).to have_content 'This commit was signed with an unverified signature.' + expect(page).to have_content "GPG Key ID: #{GpgHelpers::User2.primary_keyid}" + end + end + end + + it 'unverified signature: user email does not match the committer email, but is the same user' do + user_2_key + + visit project_commits_path(project, :'signed-commits') + + within(find('.commit', text: 'signed and authored commit by bette cartwright, different email')) do + click_on 'Unverified' + within '.popover' do + expect(page).to have_content 'This commit was signed with a verified signature, but the committer email is not verified to belong to the same user.' + expect(page).to have_content 'Bette Cartwright' + expect(page).to have_content '@bette.cartwright' + expect(page).to have_content "GPG Key ID: #{GpgHelpers::User2.primary_keyid}" + end + end + end + + it 'unverified signature: user email does not match the committer email' do + user_2_key + + visit project_commits_path(project, :'signed-commits') + + within(find('.commit', text: 'signed commit by bette cartwright')) do + click_on 'Unverified' + within '.popover' do + expect(page).to have_content "This commit was signed with a different user's verified signature." + expect(page).to have_content 'Bette Cartwright' + expect(page).to have_content '@bette.cartwright' + expect(page).to have_content "GPG Key ID: #{GpgHelpers::User2.primary_keyid}" + end + end + end + + it 'verified and the gpg user has a gitlab profile' do + user_1_key + + visit project_commits_path(project, :'signed-commits') + + within(find('.commit', text: 'signed and authored commit by nannie bernhard')) do + click_on 'Verified' + within '.popover' do + expect(page).to have_content 'This commit was signed with a verified signature and the committer email is verified to belong to the same user.' + expect(page).to have_content 'Nannie Bernhard' + expect(page).to have_content '@nannie.bernhard' + expect(page).to have_content "GPG Key ID: #{GpgHelpers::User1.primary_keyid}" + end + end + end + + it "verified and the gpg user's profile doesn't exist anymore" do + user_1_key + + visit project_commits_path(project, :'signed-commits') + + # wait for the signature to get generated + within(find('.commit', text: 'signed and authored commit by nannie bernhard')) do + expect(page).to have_content 'Verified' + end + + user_1.destroy! + + refresh + + within(find('.commit', text: 'signed and authored commit by nannie bernhard')) do + click_on 'Verified' + within '.popover' do + expect(page).to have_content 'This commit was signed with a verified signature and the committer email is verified to belong to the same user.' + expect(page).to have_content 'Nannie Bernhard' + expect(page).to have_content 'nannie.bernhard@example.com' + expect(page).to have_content "GPG Key ID: #{GpgHelpers::User1.primary_keyid}" + end + end + end + end +end diff --git a/spec/finders/issues_finder_spec.rb b/spec/finders/issues_finder_spec.rb index 0e80df94e18..47b173dea0a 100644 --- a/spec/finders/issues_finder_spec.rb +++ b/spec/finders/issues_finder_spec.rb @@ -15,8 +15,8 @@ describe IssuesFinder do set(:award_emoji3) { create(:award_emoji, name: 'thumbsdown', user: user, awardable: issue3) } describe '#execute' do - set(:closed_issue) { create(:issue, author: user2, assignees: [user2], project: project2, state: 'closed') } - set(:label_link) { create(:label_link, label: label, target: issue2) } + let!(:closed_issue) { create(:issue, author: user2, assignees: [user2], project: project2, state: 'closed') } + let!(:label_link) { create(:label_link, label: label, target: issue2) } let(:search_user) { user } let(:params) { {} } let(:issues) { described_class.new(search_user, params.reverse_merge(scope: scope, state: 'opened')).execute } @@ -347,6 +347,20 @@ describe IssuesFinder do end end + describe '#row_count', :request_store do + it 'returns the number of rows for the default state' do + finder = described_class.new(user) + + expect(finder.row_count).to eq(3) + end + + it 'returns the number of rows for a given state' do + finder = described_class.new(user, state: 'closed') + + expect(finder.row_count).to be_zero + end + end + describe '#with_confidentiality_access_check' do let(:guest) { create(:user) } set(:authorized_user) { create(:user) } diff --git a/spec/finders/merge_requests_finder_spec.rb b/spec/finders/merge_requests_finder_spec.rb index b54155a6704..95f445e7905 100644 --- a/spec/finders/merge_requests_finder_spec.rb +++ b/spec/finders/merge_requests_finder_spec.rb @@ -108,4 +108,18 @@ describe MergeRequestsFinder do end end end + + describe '#row_count', :request_store do + it 'returns the number of rows for the default state' do + finder = described_class.new(user) + + expect(finder.row_count).to eq(3) + end + + it 'returns the number of rows for a given state' do + finder = described_class.new(user, state: 'closed') + + expect(finder.row_count).to eq(1) + end + end end diff --git a/spec/fixtures/api/schemas/pipeline_schedule.json b/spec/fixtures/api/schemas/pipeline_schedule.json index f6346bd0fb6..c76c6945117 100644 --- a/spec/fixtures/api/schemas/pipeline_schedule.json +++ b/spec/fixtures/api/schemas/pipeline_schedule.json @@ -31,6 +31,10 @@ "web_url": { "type": "uri" } }, "additionalProperties": false + }, + "variables": { + "type": ["array", "null"], + "items": { "$ref": "pipeline_schedule_variable.json" } } }, "required": [ diff --git a/spec/fixtures/api/schemas/pipeline_schedule_variable.json b/spec/fixtures/api/schemas/pipeline_schedule_variable.json new file mode 100644 index 00000000000..f7ccb2d44a0 --- /dev/null +++ b/spec/fixtures/api/schemas/pipeline_schedule_variable.json @@ -0,0 +1,8 @@ +{ + "type": ["object", "null"], + "properties": { + "key": { "type": "string" }, + "value": { "type": "string" } + }, + "additionalProperties": false +} diff --git a/spec/javascripts/api_spec.js b/spec/javascripts/api_spec.js index 8c68ceff914..2aa4fb1f6c6 100644 --- a/spec/javascripts/api_spec.js +++ b/spec/javascripts/api_spec.js @@ -101,12 +101,13 @@ describe('Api', () => { it('fetches projects with membership when logged in', (done) => { const query = 'dummy query'; const options = { unused: 'option' }; - const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects.json?simple=true`; + const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects.json`; window.gon.current_user_id = 1; const expectedData = Object.assign({ search: query, per_page: 20, membership: true, + simple: true, }, options); spyOn(jQuery, 'ajax').and.callFake((request) => { expect(request.url).toEqual(expectedUrl); @@ -124,10 +125,11 @@ describe('Api', () => { it('fetches projects without membership when not logged in', (done) => { const query = 'dummy query'; const options = { unused: 'option' }; - const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects.json?simple=true`; + const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects.json`; const expectedData = Object.assign({ search: query, per_page: 20, + simple: true, }, options); spyOn(jQuery, 'ajax').and.callFake((request) => { expect(request.url).toEqual(expectedUrl); diff --git a/spec/javascripts/monitoring/graph/flag_spec.js b/spec/javascripts/monitoring/graph/flag_spec.js index 731076a7d2a..14794cbfd50 100644 --- a/spec/javascripts/monitoring/graph/flag_spec.js +++ b/spec/javascripts/monitoring/graph/flag_spec.js @@ -32,10 +32,6 @@ describe('GraphFlag', () => { .toEqual(component.currentXCoordinate); expect(getCoordinate(component, '.selected-metric-line', 'x2')) .toEqual(component.currentXCoordinate); - expect(getCoordinate(component, '.circle-metric', 'cx')) - .toEqual(component.currentXCoordinate); - expect(getCoordinate(component, '.circle-metric', 'cy')) - .toEqual(component.currentYCoordinate); }); it('has a SVG with the class rect-text-metric at the currentFlagPosition', () => { diff --git a/spec/javascripts/monitoring/graph/legend_spec.js b/spec/javascripts/monitoring/graph/legend_spec.js index e877832dffd..da2fbd26e23 100644 --- a/spec/javascripts/monitoring/graph/legend_spec.js +++ b/spec/javascripts/monitoring/graph/legend_spec.js @@ -1,6 +1,8 @@ import Vue from 'vue'; import GraphLegend from '~/monitoring/components/graph/legend.vue'; import measurements from '~/monitoring/utils/measurements'; +import createTimeSeries from '~/monitoring/utils/multiple_time_series'; +import { singleRowMetricsMultipleSeries, convertDatesMultipleSeries } from '../mock_data'; const createComponent = (propsData) => { const Component = Vue.extend(GraphLegend); @@ -10,6 +12,28 @@ const createComponent = (propsData) => { }).$mount(); }; +const convertedMetrics = convertDatesMultipleSeries(singleRowMetricsMultipleSeries); + +const defaultValuesComponent = { + graphWidth: 500, + graphHeight: 300, + graphHeightOffset: 120, + margin: measurements.large.margin, + measurements: measurements.large, + areaColorRgb: '#f0f0f0', + legendTitle: 'Title', + yAxisLabel: 'Values', + metricUsage: 'Value', + unitOfDisplay: 'Req/Sec', + currentDataIndex: 0, +}; + +const timeSeries = createTimeSeries(convertedMetrics[0].queries[0].result, + defaultValuesComponent.graphWidth, defaultValuesComponent.graphHeight, + defaultValuesComponent.graphHeightOffset); + +defaultValuesComponent.timeSeries = timeSeries; + function getTextFromNode(component, selector) { return component.$el.querySelector(selector).firstChild.nodeValue.trim(); } @@ -17,95 +41,67 @@ function getTextFromNode(component, selector) { describe('GraphLegend', () => { describe('Computed props', () => { it('textTransform', () => { - const component = createComponent({ - graphWidth: 500, - graphHeight: 300, - margin: measurements.large.margin, - measurements: measurements.large, - areaColorRgb: '#f0f0f0', - legendTitle: 'Title', - yAxisLabel: 'Values', - metricUsage: 'Value', - }); + const component = createComponent(defaultValuesComponent); expect(component.textTransform).toContain('translate(15, 120) rotate(-90)'); }); it('xPosition', () => { - const component = createComponent({ - graphWidth: 500, - graphHeight: 300, - margin: measurements.large.margin, - measurements: measurements.large, - areaColorRgb: '#f0f0f0', - legendTitle: 'Title', - yAxisLabel: 'Values', - metricUsage: 'Value', - }); + const component = createComponent(defaultValuesComponent); expect(component.xPosition).toEqual(180); }); it('yPosition', () => { - const component = createComponent({ - graphWidth: 500, - graphHeight: 300, - margin: measurements.large.margin, - measurements: measurements.large, - areaColorRgb: '#f0f0f0', - legendTitle: 'Title', - yAxisLabel: 'Values', - metricUsage: 'Value', - }); + const component = createComponent(defaultValuesComponent); expect(component.yPosition).toEqual(240); }); it('rectTransform', () => { - const component = createComponent({ - graphWidth: 500, - graphHeight: 300, - margin: measurements.large.margin, - measurements: measurements.large, - areaColorRgb: '#f0f0f0', - legendTitle: 'Title', - yAxisLabel: 'Values', - metricUsage: 'Value', - }); + const component = createComponent(defaultValuesComponent); expect(component.rectTransform).toContain('translate(0, 120) rotate(-90)'); }); }); - it('has 2 rect-axis-text rect svg elements', () => { - const component = createComponent({ - graphWidth: 500, - graphHeight: 300, - margin: measurements.large.margin, - measurements: measurements.large, - areaColorRgb: '#f0f0f0', - legendTitle: 'Title', - yAxisLabel: 'Values', - metricUsage: 'Value', + describe('methods', () => { + it('translateLegendGroup should only change Y direction', () => { + const component = createComponent(defaultValuesComponent); + + const translatedCoordinate = component.translateLegendGroup(1); + expect(translatedCoordinate.indexOf('translate(0, ')).not.toEqual(-1); }); + it('formatMetricUsage should contain the unit of display and the current value selected via "currentDataIndex"', () => { + const component = createComponent(defaultValuesComponent); + + const formattedMetricUsage = component.formatMetricUsage(timeSeries[0]); + const valueFromSeries = timeSeries[0].values[component.currentDataIndex].value; + expect(formattedMetricUsage.indexOf(component.unitOfDisplay)).not.toEqual(-1); + expect(formattedMetricUsage.indexOf(valueFromSeries)).not.toEqual(-1); + }); + }); + + it('has 2 rect-axis-text rect svg elements', () => { + const component = createComponent(defaultValuesComponent); + expect(component.$el.querySelectorAll('.rect-axis-text').length).toEqual(2); }); it('contains text to signal the usage, title and time', () => { - const component = createComponent({ - graphWidth: 500, - graphHeight: 300, - margin: measurements.large.margin, - measurements: measurements.large, - areaColorRgb: '#f0f0f0', - legendTitle: 'Title', - yAxisLabel: 'Values', - metricUsage: 'Value', - }); + const component = createComponent(defaultValuesComponent); + const titles = component.$el.querySelectorAll('.legend-metric-title'); + + expect(getTextFromNode(component, '.legend-metric-title').indexOf(component.legendTitle)).not.toEqual(-1); + expect(titles[0].textContent.indexOf('Title')).not.toEqual(-1); + expect(titles[1].textContent.indexOf('Series')).not.toEqual(-1); + expect(getTextFromNode(component, '.y-label-text')).toEqual(component.yAxisLabel); + }); + + it('should contain the same number of legend groups as the timeSeries length', () => { + const component = createComponent(defaultValuesComponent); - expect(getTextFromNode(component, '.text-metric-title')).toEqual(component.legendTitle); - expect(getTextFromNode(component, '.text-metric-usage')).toEqual(component.metricUsage); - expect(getTextFromNode(component, '.label-axis-text')).toEqual(component.yAxisLabel); + expect(component.$el.querySelectorAll('.legend-group').length).toEqual(component.timeSeries.length); }); }); diff --git a/spec/javascripts/monitoring/graph_row_spec.js b/spec/javascripts/monitoring/graph_row_spec.js index dd485473ccf..6a79d7c8f82 100644 --- a/spec/javascripts/monitoring/graph_row_spec.js +++ b/spec/javascripts/monitoring/graph_row_spec.js @@ -1,7 +1,7 @@ import Vue from 'vue'; import GraphRow from '~/monitoring/components/graph_row.vue'; import MonitoringMixins from '~/monitoring/mixins/monitoring_mixins'; -import { deploymentData, singleRowMetrics } from './mock_data'; +import { deploymentData, convertDatesMultipleSeries, singleRowMetricsMultipleSeries } from './mock_data'; const createComponent = (propsData) => { const Component = Vue.extend(GraphRow); @@ -11,15 +11,15 @@ const createComponent = (propsData) => { }).$mount(); }; +const convertedMetrics = convertDatesMultipleSeries(singleRowMetricsMultipleSeries); describe('GraphRow', () => { beforeEach(() => { spyOn(MonitoringMixins.methods, 'formatDeployments').and.returnValue({}); }); - describe('Computed props', () => { it('bootstrapClass is set to col-md-6 when rowData is higher/equal to 2', () => { const component = createComponent({ - rowData: singleRowMetrics, + rowData: convertedMetrics, updateAspectRatio: false, deploymentData, }); @@ -29,7 +29,7 @@ describe('GraphRow', () => { it('bootstrapClass is set to col-md-12 when rowData is lower than 2', () => { const component = createComponent({ - rowData: [singleRowMetrics[0]], + rowData: [convertedMetrics[0]], updateAspectRatio: false, deploymentData, }); @@ -40,7 +40,7 @@ describe('GraphRow', () => { it('has one column', () => { const component = createComponent({ - rowData: singleRowMetrics, + rowData: convertedMetrics, updateAspectRatio: false, deploymentData, }); @@ -51,7 +51,7 @@ describe('GraphRow', () => { it('has two columns', () => { const component = createComponent({ - rowData: singleRowMetrics, + rowData: convertedMetrics, updateAspectRatio: false, deploymentData, }); diff --git a/spec/javascripts/monitoring/graph_spec.js b/spec/javascripts/monitoring/graph_spec.js index 6d6fe410113..7d8b0744af1 100644 --- a/spec/javascripts/monitoring/graph_spec.js +++ b/spec/javascripts/monitoring/graph_spec.js @@ -1,9 +1,8 @@ import Vue from 'vue'; -import _ from 'underscore'; import Graph from '~/monitoring/components/graph.vue'; import MonitoringMixins from '~/monitoring/mixins/monitoring_mixins'; import eventHub from '~/monitoring/event_hub'; -import { deploymentData, singleRowMetrics } from './mock_data'; +import { deploymentData, convertDatesMultipleSeries, singleRowMetricsMultipleSeries } from './mock_data'; const createComponent = (propsData) => { const Component = Vue.extend(Graph); @@ -13,6 +12,8 @@ const createComponent = (propsData) => { }).$mount(); }; +const convertedMetrics = convertDatesMultipleSeries(singleRowMetricsMultipleSeries); + describe('Graph', () => { beforeEach(() => { spyOn(MonitoringMixins.methods, 'formatDeployments').and.returnValue({}); @@ -20,7 +21,7 @@ describe('Graph', () => { it('has a title', () => { const component = createComponent({ - graphData: singleRowMetrics[0], + graphData: convertedMetrics[1], classType: 'col-md-6', updateAspectRatio: false, deploymentData, @@ -29,29 +30,10 @@ describe('Graph', () => { expect(component.$el.querySelector('.text-center').innerText.trim()).toBe(component.graphData.title); }); - it('creates a path for the line and area of the graph', (done) => { - const component = createComponent({ - graphData: singleRowMetrics[0], - classType: 'col-md-6', - updateAspectRatio: false, - deploymentData, - }); - - Vue.nextTick(() => { - expect(component.area).toBeDefined(); - expect(component.line).toBeDefined(); - expect(typeof component.area).toEqual('string'); - expect(typeof component.line).toEqual('string'); - expect(_.isFunction(component.xScale)).toBe(true); - expect(_.isFunction(component.yScale)).toBe(true); - done(); - }); - }); - describe('Computed props', () => { it('axisTransform translates an element Y position depending of its height', () => { const component = createComponent({ - graphData: singleRowMetrics[0], + graphData: convertedMetrics[1], classType: 'col-md-6', updateAspectRatio: false, deploymentData, @@ -64,7 +46,7 @@ describe('Graph', () => { it('outterViewBox gets a width and height property based on the DOM size of the element', () => { const component = createComponent({ - graphData: singleRowMetrics[0], + graphData: convertedMetrics[1], classType: 'col-md-6', updateAspectRatio: false, deploymentData, @@ -79,7 +61,7 @@ describe('Graph', () => { it('sends an event to the eventhub when it has finished resizing', (done) => { const component = createComponent({ - graphData: singleRowMetrics[0], + graphData: convertedMetrics[1], classType: 'col-md-6', updateAspectRatio: false, deploymentData, @@ -95,7 +77,7 @@ describe('Graph', () => { it('has a title for the y-axis and the chart legend that comes from the backend', () => { const component = createComponent({ - graphData: singleRowMetrics[0], + graphData: convertedMetrics[1], classType: 'col-md-6', updateAspectRatio: false, deploymentData, diff --git a/spec/javascripts/monitoring/mock_data.js b/spec/javascripts/monitoring/mock_data.js index b69f4eddffc..3d399f2bb95 100644 --- a/spec/javascripts/monitoring/mock_data.js +++ b/spec/javascripts/monitoring/mock_data.js @@ -2473,1754 +2473,5848 @@ export const statePaths = { documentationPath: '/help/administration/monitoring/prometheus/index.md', }; -export const singleRowMetrics = [ - { - 'title': 'CPU usage', - 'weight': 1, - 'y_label': 'Memory', - 'queries': [ - { - 'query_range': 'avg(rate(container_cpu_usage_seconds_total{%{environment_filter}}[2m])) * 100', - 'label': 'Container CPU', - 'result': [ - { - 'metric': { - - }, - 'values': [ - { - 'time': '2017-06-04T21:22:59.508Z', - 'value': '0.06335544298150002' - }, - { - 'time': '2017-06-04T21:23:59.508Z', - 'value': '0.0420347312480917' - }, - { - 'time': '2017-06-04T21:24:59.508Z', - 'value': '0.0023175131665412706' - }, - { - 'time': '2017-06-04T21:25:59.508Z', - 'value': '0.002315870476190476' - }, - { - 'time': '2017-06-04T21:26:59.508Z', - 'value': '0.0025005961904761894' - }, - { - 'time': '2017-06-04T21:27:59.508Z', - 'value': '0.0024612605834341264' - }, - { - 'time': '2017-06-04T21:28:59.508Z', - 'value': '0.002313129398767631' - }, - { - 'time': '2017-06-04T21:29:59.508Z', - 'value': '0.002411067353663882' - }, - { - 'time': '2017-06-04T21:30:59.508Z', - 'value': '0.002577309263721303' - }, - { - 'time': '2017-06-04T21:31:59.508Z', - 'value': '0.00242688307730403' - }, - { - 'time': '2017-06-04T21:32:59.508Z', - 'value': '0.0024168360301330457' - }, - { - 'time': '2017-06-04T21:33:59.508Z', - 'value': '0.0020449528090743714' - }, - { - 'time': '2017-06-04T21:34:59.508Z', - 'value': '0.0019149619047619036' - }, - { - 'time': '2017-06-04T21:35:59.508Z', - 'value': '0.0024491714364625094' - }, - { - 'time': '2017-06-04T21:36:59.508Z', - 'value': '0.002728773131172677' - }, - { - 'time': '2017-06-04T21:37:59.508Z', - 'value': '0.0028439119047618997' - }, - { - 'time': '2017-06-04T21:38:59.508Z', - 'value': '0.0026307480952380917' - }, - { - 'time': '2017-06-04T21:39:59.508Z', - 'value': '0.0025024842620546446' - }, - { - 'time': '2017-06-04T21:40:59.508Z', - 'value': '0.002300662387260825' - }, - { - 'time': '2017-06-04T21:41:59.508Z', - 'value': '0.002052890924848337' - }, - { - 'time': '2017-06-04T21:42:59.508Z', - 'value': '0.0023711195238095275' - }, - { - 'time': '2017-06-04T21:43:59.508Z', - 'value': '0.002513477619047618' - }, - { - 'time': '2017-06-04T21:44:59.508Z', - 'value': '0.0023489776287844897' - }, - { - 'time': '2017-06-04T21:45:59.508Z', - 'value': '0.002542572310212481' - }, - { - 'time': '2017-06-04T21:46:59.508Z', - 'value': '0.0024579470671707952' - }, - { - 'time': '2017-06-04T21:47:59.508Z', - 'value': '0.0028725150236664403' - }, - { - 'time': '2017-06-04T21:48:59.508Z', - 'value': '0.0024356089105610525' - }, - { - 'time': '2017-06-04T21:49:59.508Z', - 'value': '0.002544015828269929' - }, - { - 'time': '2017-06-04T21:50:59.508Z', - 'value': '0.0029595013380824906' - }, - { - 'time': '2017-06-04T21:51:59.508Z', - 'value': '0.0023084015085858' - }, - { - 'time': '2017-06-04T21:52:59.508Z', - 'value': '0.0021070500000000083' - }, - { - 'time': '2017-06-04T21:53:59.508Z', - 'value': '0.0022950066191106617' - }, - { - 'time': '2017-06-04T21:54:59.508Z', - 'value': '0.002492719454470995' - }, - { - 'time': '2017-06-04T21:55:59.508Z', - 'value': '0.00244312761904762' - }, - { - 'time': '2017-06-04T21:56:59.508Z', - 'value': '0.0023495500000000028' - }, - { - 'time': '2017-06-04T21:57:59.508Z', - 'value': '0.0020597072353070005' - }, - { - 'time': '2017-06-04T21:58:59.508Z', - 'value': '0.0021482352044800866' - }, - { - 'time': '2017-06-04T21:59:59.508Z', - 'value': '0.002333490000000004' - }, - { - 'time': '2017-06-04T22:00:59.508Z', - 'value': '0.0025899442857142815' - }, - { - 'time': '2017-06-04T22:01:59.508Z', - 'value': '0.002430299999999999' - }, - { - 'time': '2017-06-04T22:02:59.508Z', - 'value': '0.0023550328092113476' - }, - { - 'time': '2017-06-04T22:03:59.508Z', - 'value': '0.0026521871636872793' - }, - { - 'time': '2017-06-04T22:04:59.508Z', - 'value': '0.0023080671428571398' - }, - { - 'time': '2017-06-04T22:05:59.508Z', - 'value': '0.0024108401032390896' - }, - { - 'time': '2017-06-04T22:06:59.508Z', - 'value': '0.002433249366678738' - }, - { - 'time': '2017-06-04T22:07:59.508Z', - 'value': '0.0023242202306688682' - }, - { - 'time': '2017-06-04T22:08:59.508Z', - 'value': '0.002388222857142859' - }, - { - 'time': '2017-06-04T22:09:59.508Z', - 'value': '0.002115974914046794' - }, - { - 'time': '2017-06-04T22:10:59.508Z', - 'value': '0.0025090043331269917' - }, - { - 'time': '2017-06-04T22:11:59.508Z', - 'value': '0.002445507057277277' - }, - { - 'time': '2017-06-04T22:12:59.508Z', - 'value': '0.0026348773751130976' - }, - { - 'time': '2017-06-04T22:13:59.508Z', - 'value': '0.0025616258583088104' - }, - { - 'time': '2017-06-04T22:14:59.508Z', - 'value': '0.0021544093415751505' - }, - { - 'time': '2017-06-04T22:15:59.508Z', - 'value': '0.002649394767668881' - }, - { - 'time': '2017-06-04T22:16:59.508Z', - 'value': '0.0024023332666685705' - }, - { - 'time': '2017-06-04T22:17:59.508Z', - 'value': '0.0025444105294235306' - }, - { - 'time': '2017-06-04T22:18:59.508Z', - 'value': '0.0027298872305772806' - }, - { - 'time': '2017-06-04T22:19:59.508Z', - 'value': '0.0022880104956379287' - }, - { - 'time': '2017-06-04T22:20:59.508Z', - 'value': '0.002473246666666661' - }, - { - 'time': '2017-06-04T22:21:59.508Z', - 'value': '0.002259948381935587' - }, - { - 'time': '2017-06-04T22:22:59.508Z', - 'value': '0.0025778470886268835' - }, - { - 'time': '2017-06-04T22:23:59.508Z', - 'value': '0.002246127910852894' - }, - { - 'time': '2017-06-04T22:24:59.508Z', - 'value': '0.0020697466666666758' - }, - { - 'time': '2017-06-04T22:25:59.508Z', - 'value': '0.00225859722473547' - }, - { - 'time': '2017-06-04T22:26:59.508Z', - 'value': '0.0026466728254554814' - }, - { - 'time': '2017-06-04T22:27:59.508Z', - 'value': '0.002151247619047619' - }, - { - 'time': '2017-06-04T22:28:59.508Z', - 'value': '0.002324161444543914' - }, - { - 'time': '2017-06-04T22:29:59.508Z', - 'value': '0.002476474313796452' - }, - { - 'time': '2017-06-04T22:30:59.508Z', - 'value': '0.0023922184232080517' - }, - { - 'time': '2017-06-04T22:31:59.508Z', - 'value': '0.0025094934237468933' - }, - { - 'time': '2017-06-04T22:32:59.508Z', - 'value': '0.0025665311098200883' - }, - { - 'time': '2017-06-04T22:33:59.508Z', - 'value': '0.0024154900681661374' - }, - { - 'time': '2017-06-04T22:34:59.508Z', - 'value': '0.0023267450166192037' - }, - { - 'time': '2017-06-04T22:35:59.508Z', - 'value': '0.002156521904761904' - }, - { - 'time': '2017-06-04T22:36:59.508Z', - 'value': '0.0025474356898637007' - }, - { - 'time': '2017-06-04T22:37:59.508Z', - 'value': '0.0025989409624670233' - }, - { - 'time': '2017-06-04T22:38:59.508Z', - 'value': '0.002348336664762987' - }, - { - 'time': '2017-06-04T22:39:59.508Z', - 'value': '0.002665888246554726' - }, - { - 'time': '2017-06-04T22:40:59.508Z', - 'value': '0.002652684787474174' - }, - { - 'time': '2017-06-04T22:41:59.508Z', - 'value': '0.002472620430865355' - }, - { - 'time': '2017-06-04T22:42:59.508Z', - 'value': '0.0020616469210110247' - }, - { - 'time': '2017-06-04T22:43:59.508Z', - 'value': '0.0022434546372311934' - }, - { - 'time': '2017-06-04T22:44:59.508Z', - 'value': '0.0024469386784827982' - }, - { - 'time': '2017-06-04T22:45:59.508Z', - 'value': '0.0026192823809523787' - }, - { - 'time': '2017-06-04T22:46:59.508Z', - 'value': '0.003451999542852798' - }, - { - 'time': '2017-06-04T22:47:59.508Z', - 'value': '0.0031780314285714288' - }, - { - 'time': '2017-06-04T22:48:59.508Z', - 'value': '0.0024403352380952415' - }, - { - 'time': '2017-06-04T22:49:59.508Z', - 'value': '0.001998824761904764' - }, - { - 'time': '2017-06-04T22:50:59.508Z', - 'value': '0.0023792404761904806' - }, - { - 'time': '2017-06-04T22:51:59.508Z', - 'value': '0.002725906190476185' - }, - { - 'time': '2017-06-04T22:52:59.508Z', - 'value': '0.0020989528671155624' - }, - { - 'time': '2017-06-04T22:53:59.508Z', - 'value': '0.00228808226745016' - }, - { - 'time': '2017-06-04T22:54:59.508Z', - 'value': '0.0019860807413192147' - }, - { - 'time': '2017-06-04T22:55:59.508Z', - 'value': '0.0022698085714285897' - }, - { - 'time': '2017-06-04T22:56:59.508Z', - 'value': '0.0022839098467604415' - }, - { - 'time': '2017-06-04T22:57:59.508Z', - 'value': '0.002531114761904749' - }, - { - 'time': '2017-06-04T22:58:59.508Z', - 'value': '0.0028941072550999016' - }, - { - 'time': '2017-06-04T22:59:59.508Z', - 'value': '0.002547169523809506' - }, - { - 'time': '2017-06-04T23:00:59.508Z', - 'value': '0.0024062999999999958' - }, - { - 'time': '2017-06-04T23:01:59.508Z', - 'value': '0.0026939518471604386' - }, - { - 'time': '2017-06-04T23:02:59.508Z', - 'value': '0.002362901428571429' - }, - { - 'time': '2017-06-04T23:03:59.508Z', - 'value': '0.002663927142857154' - }, - { - 'time': '2017-06-04T23:04:59.508Z', - 'value': '0.0026173314285714354' - }, - { - 'time': '2017-06-04T23:05:59.508Z', - 'value': '0.002326527366406044' - }, - { - 'time': '2017-06-04T23:06:59.508Z', - 'value': '0.002035313809523809' - }, - { - 'time': '2017-06-04T23:07:59.508Z', - 'value': '0.002421447414786533' - }, - { - 'time': '2017-06-04T23:08:59.508Z', - 'value': '0.002898313809523804' - }, - { - 'time': '2017-06-04T23:09:59.508Z', - 'value': '0.002544891856112907' - }, - { - 'time': '2017-06-04T23:10:59.508Z', - 'value': '0.002290625356938882' - }, - { - 'time': '2017-06-04T23:11:59.508Z', - 'value': '0.002483028095238096' - }, - { - 'time': '2017-06-04T23:12:59.508Z', - 'value': '0.0023396832350784237' - }, - { - 'time': '2017-06-04T23:13:59.508Z', - 'value': '0.002085529248176153' - }, - { - 'time': '2017-06-04T23:14:59.508Z', - 'value': '0.0022417815068428012' - }, - { - 'time': '2017-06-04T23:15:59.508Z', - 'value': '0.002660293333333341' - }, - { - 'time': '2017-06-04T23:16:59.508Z', - 'value': '0.0029845149093818226' - }, - { - 'time': '2017-06-04T23:17:59.508Z', - 'value': '0.0027716655079475464' - }, - { - 'time': '2017-06-04T23:18:59.508Z', - 'value': '0.0025217708908741128' - }, - { - 'time': '2017-06-04T23:19:59.508Z', - 'value': '0.0025811235131094055' - }, - { - 'time': '2017-06-04T23:20:59.508Z', - 'value': '0.002209904761904762' - }, - { - 'time': '2017-06-04T23:21:59.508Z', - 'value': '0.0025053322926383344' - }, - { - 'time': '2017-06-04T23:22:59.508Z', - 'value': '0.002350917636526411' - }, - { - 'time': '2017-06-04T23:23:59.508Z', - 'value': '0.0018477500000000078' - }, - { - 'time': '2017-06-04T23:24:59.508Z', - 'value': '0.002427629523809527' - }, - { - 'time': '2017-06-04T23:25:59.508Z', - 'value': '0.0019305498147601655' - }, - { - 'time': '2017-06-04T23:26:59.508Z', - 'value': '0.002097250000000006' - }, - { - 'time': '2017-06-04T23:27:59.508Z', - 'value': '0.002675020952780041' - }, - { - 'time': '2017-06-04T23:28:59.508Z', - 'value': '0.0023142214285714374' - }, - { - 'time': '2017-06-04T23:29:59.508Z', - 'value': '0.0023644723809523737' - }, - { - 'time': '2017-06-04T23:30:59.508Z', - 'value': '0.002108696190476198' - }, - { - 'time': '2017-06-04T23:31:59.508Z', - 'value': '0.0019918289697997194' - }, - { - 'time': '2017-06-04T23:32:59.508Z', - 'value': '0.001583584285714283' - }, - { - 'time': '2017-06-04T23:33:59.508Z', - 'value': '0.002073770226383112' - }, - { - 'time': '2017-06-04T23:34:59.508Z', - 'value': '0.0025877664234966818' - }, - { - 'time': '2017-06-04T23:35:59.508Z', - 'value': '0.0021138238095238147' - }, - { - 'time': '2017-06-04T23:36:59.508Z', - 'value': '0.0022140838095238303' - }, - { - 'time': '2017-06-04T23:37:59.508Z', - 'value': '0.0018592674425248847' - }, - { - 'time': '2017-06-04T23:38:59.508Z', - 'value': '0.0020461969533657016' - }, - { - 'time': '2017-06-04T23:39:59.508Z', - 'value': '0.0021593628571428543' - }, - { - 'time': '2017-06-04T23:40:59.508Z', - 'value': '0.0024330682564928188' - }, - { - 'time': '2017-06-04T23:41:59.508Z', - 'value': '0.0021501804779093174' - }, - { - 'time': '2017-06-04T23:42:59.508Z', - 'value': '0.0025787493928397945' - }, - { - 'time': '2017-06-04T23:43:59.508Z', - 'value': '0.002593657082448396' - }, - { - 'time': '2017-06-04T23:44:59.508Z', - 'value': '0.0021316752380952306' - }, - { - 'time': '2017-06-04T23:45:59.508Z', - 'value': '0.0026972905019952086' - }, - { - 'time': '2017-06-04T23:46:59.508Z', - 'value': '0.002580250764292983' - }, - { - 'time': '2017-06-04T23:47:59.508Z', - 'value': '0.00227103000000001' - }, - { - 'time': '2017-06-04T23:48:59.508Z', - 'value': '0.0023678515647321146' - }, - { - 'time': '2017-06-04T23:49:59.508Z', - 'value': '0.002371472857142866' - }, - { - 'time': '2017-06-04T23:50:59.508Z', - 'value': '0.0026181353688500978' - }, - { - 'time': '2017-06-04T23:51:59.508Z', - 'value': '0.0025609667711121217' - }, - { - 'time': '2017-06-04T23:52:59.508Z', - 'value': '0.0027145308139922557' - }, - { - 'time': '2017-06-04T23:53:59.508Z', - 'value': '0.0024249397613310512' - }, - { - 'time': '2017-06-04T23:54:59.508Z', - 'value': '0.002399907142857147' - }, - { - 'time': '2017-06-04T23:55:59.508Z', - 'value': '0.0024753357142857195' - }, - { - 'time': '2017-06-04T23:56:59.508Z', - 'value': '0.0026179149325231575' - }, - { - 'time': '2017-06-04T23:57:59.508Z', - 'value': '0.0024261340368186956' - }, - { - 'time': '2017-06-04T23:58:59.508Z', - 'value': '0.0021061071428571517' - }, - { - 'time': '2017-06-04T23:59:59.508Z', - 'value': '0.0024033971105037015' - }, - { - 'time': '2017-06-05T00:00:59.508Z', - 'value': '0.0028287676190475956' - }, - { - 'time': '2017-06-05T00:01:59.508Z', - 'value': '0.002499719050294778' - }, - { - 'time': '2017-06-05T00:02:59.508Z', - 'value': '0.0026726102153353856' - }, - { - 'time': '2017-06-05T00:03:59.508Z', - 'value': '0.00262582619047618' - }, - { - 'time': '2017-06-05T00:04:59.508Z', - 'value': '0.002280473147363316' - }, - { - 'time': '2017-06-05T00:05:59.508Z', - 'value': '0.002095581470652675' - }, - { - 'time': '2017-06-05T00:06:59.508Z', - 'value': '0.002270768490828408' - }, - { - 'time': '2017-06-05T00:07:59.508Z', - 'value': '0.002728577415023017' - }, - { - 'time': '2017-06-05T00:08:59.508Z', - 'value': '0.002652512857142863' - }, - { - 'time': '2017-06-05T00:09:59.508Z', - 'value': '0.0022781033924455674' - }, - { - 'time': '2017-06-05T00:10:59.508Z', - 'value': '0.0025345038095238234' - }, - { - 'time': '2017-06-05T00:11:59.508Z', - 'value': '0.002376050020000397' - }, - { - 'time': '2017-06-05T00:12:59.508Z', - 'value': '0.002455068143506122' - }, - { - 'time': '2017-06-05T00:13:59.508Z', - 'value': '0.002826705714285719' - }, - { - 'time': '2017-06-05T00:14:59.508Z', - 'value': '0.002343833692070314' - }, - { - 'time': '2017-06-05T00:15:59.508Z', - 'value': '0.00264853297122164' - }, - { - 'time': '2017-06-05T00:16:59.508Z', - 'value': '0.0027656335117426257' - }, - { - 'time': '2017-06-05T00:17:59.508Z', - 'value': '0.0025896543842439564' - }, - { - 'time': '2017-06-05T00:18:59.508Z', - 'value': '0.002180053237081201' - }, - { - 'time': '2017-06-05T00:19:59.508Z', - 'value': '0.002475245002333342' - }, - { - 'time': '2017-06-05T00:20:59.508Z', - 'value': '0.0027559767805101065' - }, - { - 'time': '2017-06-05T00:21:59.508Z', - 'value': '0.0022294836141296607' - }, - { - 'time': '2017-06-05T00:22:59.508Z', - 'value': '0.0021383590476190643' - }, - { - 'time': '2017-06-05T00:23:59.508Z', - 'value': '0.002085417956361494' - }, - { - 'time': '2017-06-05T00:24:59.508Z', - 'value': '0.0024140319047619013' - }, - { - 'time': '2017-06-05T00:25:59.508Z', - 'value': '0.0024513114285714304' - }, - { - 'time': '2017-06-05T00:26:59.508Z', - 'value': '0.0026932152380952446' - }, - { - 'time': '2017-06-05T00:27:59.508Z', - 'value': '0.0022656844350898517' - }, - { - 'time': '2017-06-05T00:28:59.508Z', - 'value': '0.0024483785714285704' - }, - { - 'time': '2017-06-05T00:29:59.508Z', - 'value': '0.002559505804817207' - }, - { - 'time': '2017-06-05T00:30:59.508Z', - 'value': '0.0019485681088751649' - }, - { - 'time': '2017-06-05T00:31:59.508Z', - 'value': '0.00228367984456996' - }, - { - 'time': '2017-06-05T00:32:59.508Z', - 'value': '0.002522149047619049' - }, - { - 'time': '2017-06-05T00:33:59.508Z', - 'value': '0.0026860117715406737' - }, - { - 'time': '2017-06-05T00:34:59.508Z', - 'value': '0.002679669523809523' - }, - { - 'time': '2017-06-05T00:35:59.508Z', - 'value': '0.0022201920970675937' - }, - { - 'time': '2017-06-05T00:36:59.508Z', - 'value': '0.0022917647619047615' - }, - { - 'time': '2017-06-05T00:37:59.508Z', - 'value': '0.0021774059294673576' - }, - { - 'time': '2017-06-05T00:38:59.508Z', - 'value': '0.0024637766666666763' - }, - { - 'time': '2017-06-05T00:39:59.508Z', - 'value': '0.002470468290174195' - }, - { - 'time': '2017-06-05T00:40:59.508Z', - 'value': '0.0022188616082057812' - }, - { - 'time': '2017-06-05T00:41:59.508Z', - 'value': '0.002421840744373875' - }, - { - 'time': '2017-06-05T00:42:59.508Z', - 'value': '0.0023918266666666547' - }, - { - 'time': '2017-06-05T00:43:59.508Z', - 'value': '0.002195743809523809' - }, - { - 'time': '2017-06-05T00:44:59.508Z', - 'value': '0.0025514828571428687' - }, - { - 'time': '2017-06-05T00:45:59.508Z', - 'value': '0.0027981709349612694' - }, - { - 'time': '2017-06-05T00:46:59.508Z', - 'value': '0.002557977142857146' - }, - { - 'time': '2017-06-05T00:47:59.508Z', - 'value': '0.002213244285714286' - }, - { - 'time': '2017-06-05T00:48:59.508Z', - 'value': '0.0025706738095238046' - }, - { - 'time': '2017-06-05T00:49:59.508Z', - 'value': '0.002210976666666671' - }, - { - 'time': '2017-06-05T00:50:59.508Z', - 'value': '0.002055377091646749' - }, - { - 'time': '2017-06-05T00:51:59.508Z', - 'value': '0.002308368095238119' - }, - { - 'time': '2017-06-05T00:52:59.508Z', - 'value': '0.0024687939885141615' - }, - { - 'time': '2017-06-05T00:53:59.508Z', - 'value': '0.002563018571428578' - }, - { - 'time': '2017-06-05T00:54:59.508Z', - 'value': '0.00240563291078959' - } - ] - } +export const singleRowMetricsMultipleSeries = [ + { + 'title': 'Multiple Time Series', + 'weight': 1, + 'y_label': 'Request Rates', + 'queries': [ + { + 'query_range': 'sum(rate(nginx_responses_total{environment="production"}[2m])) by (status_code)', + 'label': 'Requests', + 'unit': 'Req/sec', + 'result': [ + { + 'metric': { + 'status_code': '1xx' + }, + 'values': [ + { + 'time': '2017-08-27T11:01:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:02:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:03:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:04:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:05:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:06:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:07:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:08:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:09:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:10:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:11:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:12:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:13:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:14:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:15:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:16:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:17:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:18:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:19:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:20:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:21:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:22:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:23:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:24:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:25:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:26:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:27:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:28:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:29:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:30:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:31:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:32:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:33:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:34:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:35:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:36:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:37:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:38:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:39:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:40:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:41:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:42:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:43:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:44:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:45:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:46:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:47:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:48:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:49:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:50:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:51:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:52:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:53:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:54:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:55:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:56:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:57:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:58:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T11:59:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:00:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:01:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:02:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:03:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:04:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:05:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:06:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:07:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:08:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:09:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:10:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:11:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:12:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:13:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:14:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:15:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:16:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:17:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:18:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:19:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:20:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:21:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:22:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:23:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:24:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:25:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:26:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:27:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:28:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:29:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:30:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:31:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:32:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:33:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:34:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:35:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:36:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:37:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:38:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:39:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:40:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:41:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:42:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:43:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:44:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:45:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:46:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:47:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:48:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:49:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:50:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:51:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:52:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:53:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:54:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:55:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:56:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:57:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:58:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T12:59:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:00:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:01:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:02:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:03:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:04:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:05:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:06:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:07:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:08:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:09:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:10:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:11:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:12:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:13:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:14:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:15:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:16:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:17:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:18:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:19:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:20:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:21:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:22:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:23:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:24:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:25:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:26:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:27:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:28:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:29:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:30:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:31:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:32:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:33:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:34:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:35:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:36:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:37:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:38:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:39:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:40:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:41:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:42:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:43:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:44:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:45:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:46:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:47:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:48:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:49:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:50:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:51:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:52:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:53:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:54:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:55:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:56:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:57:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:58:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T13:59:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:00:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:01:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:02:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:03:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:04:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:05:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:06:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:07:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:08:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:09:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:10:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:11:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:12:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:13:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:14:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:15:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:16:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:17:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:18:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:19:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:20:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:21:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:22:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:23:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:24:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:25:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:26:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:27:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:28:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:29:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:30:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:31:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:32:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:33:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:34:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:35:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:36:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:37:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:38:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:39:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:40:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:41:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:42:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:43:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:44:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:45:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:46:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:47:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:48:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:49:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:50:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:51:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:52:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:53:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:54:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:55:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:56:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:57:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:58:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T14:59:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:00:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:01:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:02:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:03:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:04:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:05:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:06:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:07:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:08:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:09:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:10:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:11:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:12:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:13:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:14:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:15:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:16:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:17:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:18:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:19:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:20:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:21:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:22:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:23:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:24:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:25:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:26:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:27:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:28:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:29:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:30:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:31:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:32:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:33:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:34:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:35:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:36:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:37:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:38:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:39:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:40:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:41:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:42:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:43:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:44:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:45:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:46:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:47:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:48:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:49:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:50:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:51:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:52:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:53:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:54:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:55:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:56:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:57:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:58:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T15:59:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:00:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:01:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:02:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:03:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:04:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:05:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:06:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:07:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:08:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:09:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:10:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:11:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:12:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:13:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:14:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:15:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:16:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:17:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:18:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:19:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:20:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:21:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:22:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:23:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:24:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:25:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:26:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:27:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:28:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:29:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:30:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:31:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:32:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:33:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:34:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:35:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:36:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:37:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:38:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:39:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:40:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:41:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:42:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:43:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:44:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:45:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:46:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:47:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:48:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:49:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:50:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:51:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:52:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:53:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:54:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:55:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:56:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:57:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:58:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T16:59:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:00:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:01:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:02:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:03:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:04:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:05:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:06:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:07:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:08:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:09:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:10:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:11:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:12:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:13:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:14:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:15:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:16:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:17:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:18:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:19:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:20:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:21:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:22:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:23:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:24:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:25:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:26:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:27:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:28:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:29:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:30:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:31:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:32:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:33:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:34:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:35:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:36:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:37:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:38:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:39:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:40:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:41:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:42:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:43:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:44:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:45:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:46:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:47:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:48:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:49:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:50:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:51:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:52:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:53:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:54:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:55:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:56:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:57:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:58:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T17:59:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:00:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:01:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:02:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:03:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:04:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:05:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:06:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:07:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:08:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:09:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:10:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:11:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:12:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:13:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:14:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:15:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:16:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:17:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:18:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:19:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:20:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:21:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:22:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:23:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:24:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:25:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:26:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:27:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:28:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:29:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:30:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:31:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:32:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:33:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:34:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:35:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:36:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:37:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:38:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:39:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:40:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:41:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:42:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:43:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:44:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:45:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:46:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:47:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:48:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:49:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:50:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:51:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:52:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:53:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:54:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:55:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:56:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:57:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:58:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T18:59:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T19:00:51.462Z', + 'value': '0' + }, + { + 'time': '2017-08-27T19:01:51.462Z', + 'value': '0' + } + ] + }, + { + 'metric': { + 'status_code': '2xx' + }, + 'values': [ + { + 'time': '2017-08-27T11:01:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:02:51.462Z', + 'value': '1.2571428571428571' + }, + { + 'time': '2017-08-27T11:03:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T11:04:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:05:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T11:06:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:07:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T11:08:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:09:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T11:10:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T11:11:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:12:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T11:13:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:14:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T11:15:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:16:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T11:17:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:18:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T11:19:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T11:20:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T11:21:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T11:22:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:23:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:24:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:25:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T11:26:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T11:27:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T11:28:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:29:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T11:30:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:31:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T11:32:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T11:33:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:34:51.462Z', + 'value': '1.333320635041571' + }, + { + 'time': '2017-08-27T11:35:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:36:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:37:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:38:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:39:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T11:40:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:41:51.462Z', + 'value': '1.3333587306424883' + }, + { + 'time': '2017-08-27T11:42:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:43:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T11:44:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:45:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T11:46:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T11:47:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T11:48:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T11:49:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T11:50:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T11:51:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T11:52:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:53:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T11:54:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:55:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T11:56:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:57:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T11:58:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T11:59:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:00:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:01:51.462Z', + 'value': '1.3333460318669703' + }, + { + 'time': '2017-08-27T12:02:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:03:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:04:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:05:51.462Z', + 'value': '1.31427319739812' + }, + { + 'time': '2017-08-27T12:06:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:07:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:08:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:09:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:10:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:11:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:12:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:13:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:14:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:15:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:16:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:17:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:18:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:19:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:20:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:21:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:22:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:23:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:24:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:25:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:26:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:27:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:28:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:29:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:30:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:31:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:32:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:33:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:34:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:35:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:36:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:37:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:38:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:39:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:40:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:41:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:42:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:43:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:44:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:45:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:46:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:47:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:48:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:49:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:50:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:51:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:52:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:53:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:54:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T12:55:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:56:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:57:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T12:58:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T12:59:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T13:00:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T13:01:51.462Z', + 'value': '1.295225759754669' + }, + { + 'time': '2017-08-27T13:02:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:03:51.462Z', + 'value': '1.2952627669098458' + }, + { + 'time': '2017-08-27T13:04:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:05:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:06:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:07:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:08:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:09:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:10:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:11:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:12:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:13:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:14:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:15:51.462Z', + 'value': '1.2571428571428571' + }, + { + 'time': '2017-08-27T13:16:51.462Z', + 'value': '1.3333587306424883' + }, + { + 'time': '2017-08-27T13:17:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:18:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:19:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:20:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T13:21:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:22:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:23:51.462Z', + 'value': '1.276190476190476' + }, + { + 'time': '2017-08-27T13:24:51.462Z', + 'value': '1.2571428571428571' + }, + { + 'time': '2017-08-27T13:25:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T13:26:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:27:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T13:28:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:29:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:30:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:31:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:32:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T13:33:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:34:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:35:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T13:36:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:37:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:38:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:39:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:40:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:41:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:42:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:43:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:44:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:45:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:46:51.462Z', + 'value': '1.2571428571428571' + }, + { + 'time': '2017-08-27T13:47:51.462Z', + 'value': '1.276190476190476' + }, + { + 'time': '2017-08-27T13:48:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T13:49:51.462Z', + 'value': '1.295225759754669' + }, + { + 'time': '2017-08-27T13:50:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:51:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:52:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:53:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:54:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:55:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:56:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T13:57:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T13:58:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T13:59:51.462Z', + 'value': '1.295225759754669' + }, + { + 'time': '2017-08-27T14:00:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T14:01:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T14:02:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:03:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T14:04:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:05:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T14:06:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:07:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T14:08:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:09:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T14:10:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T14:11:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:12:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T14:13:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:14:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T14:15:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:16:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:17:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T14:18:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:19:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T14:20:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:21:51.462Z', + 'value': '1.3333079369916765' + }, + { + 'time': '2017-08-27T14:22:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:23:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T14:24:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:25:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T14:26:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:27:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T14:28:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:29:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:30:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T14:31:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:32:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:33:51.462Z', + 'value': '1.2571428571428571' + }, + { + 'time': '2017-08-27T14:34:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T14:35:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:36:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T14:37:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T14:38:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T14:39:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T14:40:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:41:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T14:42:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:43:51.462Z', + 'value': '1.276190476190476' + }, + { + 'time': '2017-08-27T14:44:51.462Z', + 'value': '1.2571428571428571' + }, + { + 'time': '2017-08-27T14:45:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T14:46:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:47:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T14:48:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:49:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T14:50:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:51:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T14:52:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:53:51.462Z', + 'value': '1.333320635041571' + }, + { + 'time': '2017-08-27T14:54:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:55:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T14:56:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:57:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T14:58:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T14:59:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T15:00:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:01:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:02:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:03:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:04:51.462Z', + 'value': '1.2571428571428571' + }, + { + 'time': '2017-08-27T15:05:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:06:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:07:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:08:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:09:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:10:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:11:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:12:51.462Z', + 'value': '1.31427319739812' + }, + { + 'time': '2017-08-27T15:13:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:14:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:15:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:16:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T15:17:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:18:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:19:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:20:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T15:21:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:22:51.462Z', + 'value': '1.3333460318669703' + }, + { + 'time': '2017-08-27T15:23:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:24:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:25:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:26:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:27:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:28:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:29:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:30:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:31:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T15:32:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:33:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T15:34:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:35:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T15:36:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:37:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:38:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T15:39:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:40:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:41:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:42:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:43:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:44:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:45:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:46:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:47:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:48:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:49:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T15:50:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:51:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:52:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:53:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:54:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:55:51.462Z', + 'value': '1.3333587306424883' + }, + { + 'time': '2017-08-27T15:56:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T15:57:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:58:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T15:59:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:00:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T16:01:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T16:02:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:03:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:04:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:05:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T16:06:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:07:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T16:08:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T16:09:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T16:10:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T16:11:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:12:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T16:13:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:14:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T16:15:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T16:16:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T16:17:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T16:18:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:19:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T16:20:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:21:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T16:22:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:23:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T16:24:51.462Z', + 'value': '1.295225759754669' + }, + { + 'time': '2017-08-27T16:25:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T16:26:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T16:27:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T16:28:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T16:29:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:30:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T16:31:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:32:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T16:33:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:34:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T16:35:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:36:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T16:37:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:38:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T16:39:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:40:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T16:41:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:42:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T16:43:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:44:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T16:45:51.462Z', + 'value': '1.3142982314117277' + }, + { + 'time': '2017-08-27T16:46:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T16:47:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:48:51.462Z', + 'value': '1.333320635041571' + }, + { + 'time': '2017-08-27T16:49:51.462Z', + 'value': '1.31427319739812' + }, + { + 'time': '2017-08-27T16:50:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:51:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T16:52:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:53:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T16:54:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:55:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T16:56:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:57:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T16:58:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T16:59:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:00:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:01:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:02:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:03:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:04:51.462Z', + 'value': '1.2952504309564854' + }, + { + 'time': '2017-08-27T17:05:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T17:06:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:07:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T17:08:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T17:09:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:10:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:11:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:12:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:13:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:14:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:15:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:16:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:17:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:18:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:19:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:20:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:21:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:22:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:23:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:24:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T17:25:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:26:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:27:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:28:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:29:51.462Z', + 'value': '1.295225759754669' + }, + { + 'time': '2017-08-27T17:30:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:31:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:32:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:33:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:34:51.462Z', + 'value': '1.295225759754669' + }, + { + 'time': '2017-08-27T17:35:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:36:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T17:37:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:38:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:39:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:40:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:41:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:42:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:43:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:44:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T17:45:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:46:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:47:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:48:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T17:49:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:50:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T17:51:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:52:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:53:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:54:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:55:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T17:56:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:57:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T17:58:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T17:59:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T18:00:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:01:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:02:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:03:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:04:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:05:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:06:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:07:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:08:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:09:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:10:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:11:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:12:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T18:13:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:14:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:15:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:16:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:17:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:18:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:19:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:20:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:21:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:22:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:23:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:24:51.462Z', + 'value': '1.2571428571428571' + }, + { + 'time': '2017-08-27T18:25:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:26:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:27:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:28:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:29:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:30:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:31:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:32:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:33:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:34:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:35:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:36:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:37:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T18:38:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:39:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:40:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:41:51.462Z', + 'value': '1.580952380952381' + }, + { + 'time': '2017-08-27T18:42:51.462Z', + 'value': '1.7333333333333334' + }, + { + 'time': '2017-08-27T18:43:51.462Z', + 'value': '2.057142857142857' + }, + { + 'time': '2017-08-27T18:44:51.462Z', + 'value': '2.1904761904761902' + }, + { + 'time': '2017-08-27T18:45:51.462Z', + 'value': '1.8285714285714287' + }, + { + 'time': '2017-08-27T18:46:51.462Z', + 'value': '2.1142857142857143' + }, + { + 'time': '2017-08-27T18:47:51.462Z', + 'value': '1.619047619047619' + }, + { + 'time': '2017-08-27T18:48:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:49:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:50:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T18:51:51.462Z', + 'value': '1.2952504309564854' + }, + { + 'time': '2017-08-27T18:52:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:53:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:54:51.462Z', + 'value': '1.3333333333333333' + }, + { + 'time': '2017-08-27T18:55:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:56:51.462Z', + 'value': '1.314285714285714' + }, + { + 'time': '2017-08-27T18:57:51.462Z', + 'value': '1.295238095238095' + }, + { + 'time': '2017-08-27T18:58:51.462Z', + 'value': '1.7142857142857142' + }, + { + 'time': '2017-08-27T18:59:51.462Z', + 'value': '1.7333333333333334' + }, + { + 'time': '2017-08-27T19:00:51.462Z', + 'value': '1.3904761904761904' + }, + { + 'time': '2017-08-27T19:01:51.462Z', + 'value': '1.5047619047619047' + } + ] + }, + ] + } ] - } - ] - }, - { - 'title': 'Memory usage', - 'weight': 1, - 'y_label': 'Values', - 'queries': [ - { - 'query_range': 'avg(container_memory_usage_bytes{%{environment_filter}}) / 2^20', - 'label': 'Container memory', - 'unit': 'MiB', - 'result': [ - { - 'metric': { + }, + { + 'title': 'Throughput', + 'weight': 1, + 'y_label': 'Requests / Sec', + 'queries': [ + { + 'query_range': 'sum(rate(nginx_requests_total{server_zone!=\'*\', server_zone!=\'_\', container_name!=\'POD\',environment=\'production\'}[2m]))', + 'label': 'Total', + 'unit': 'req / sec', + 'result': [ + { + 'metric': { - }, - 'values': [ - { - 'time': '2017-06-04T21:22:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:23:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:24:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:25:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:26:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:27:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:28:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:29:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:30:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:31:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:32:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:33:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:34:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:35:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:36:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:37:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:38:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:39:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:40:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:41:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:42:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:43:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:44:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:45:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:46:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:47:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:48:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:49:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:50:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:51:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:52:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:53:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:54:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:55:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:56:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:57:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:58:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T21:59:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:00:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:01:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:02:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:03:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:04:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:05:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:06:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:07:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:08:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:09:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:10:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:11:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:12:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:13:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:14:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:15:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:16:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:17:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:18:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:19:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:20:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:21:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:22:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:23:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:24:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:25:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:26:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:27:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:28:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:29:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:30:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:31:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:32:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:33:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:34:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:35:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:36:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:37:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:38:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:39:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:40:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:41:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:42:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:43:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:44:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:45:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:46:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:47:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:48:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:49:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:50:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:51:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:52:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:53:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:54:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:55:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:56:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:57:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:58:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T22:59:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:00:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:01:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:02:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:03:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:04:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:05:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:06:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:07:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:08:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:09:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:10:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:11:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:12:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:13:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:14:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:15:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:16:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:17:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:18:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:19:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:20:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:21:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:22:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:23:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:24:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:25:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:26:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:27:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:28:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:29:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:30:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:31:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:32:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:33:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:34:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:35:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:36:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:37:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:38:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:39:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:40:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:41:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:42:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:43:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:44:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:45:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:46:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:47:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:48:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:49:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:50:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:51:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:52:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:53:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:54:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:55:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:56:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:57:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:58:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-04T23:59:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:00:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:01:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:02:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:03:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:04:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:05:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:06:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:07:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:08:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:09:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:10:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:11:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:12:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:13:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:14:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:15:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:16:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:17:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:18:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:19:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:20:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:21:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:22:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:23:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:24:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:25:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:26:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:27:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:28:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:29:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:30:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:31:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:32:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:33:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:34:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:35:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:36:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:37:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:38:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:39:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:40:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:41:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:42:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:43:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:44:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:45:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:46:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:47:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:48:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:49:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:50:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:51:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:52:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:53:59.508Z', - 'value': '15.0859375' - }, - { - 'time': '2017-06-05T00:54:59.508Z', - 'value': '15.0859375' - } - ] - } + }, + 'values': [ + { + 'time': '2017-08-27T11:01:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:02:51.462Z', + 'value': '0.45714285714285713' + }, + { + 'time': '2017-08-27T11:03:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T11:04:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:05:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T11:06:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:07:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T11:08:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:09:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T11:10:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T11:11:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:12:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T11:13:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:14:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T11:15:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:16:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T11:17:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:18:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T11:19:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T11:20:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T11:21:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T11:22:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:23:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:24:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:25:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T11:26:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T11:27:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T11:28:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:29:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T11:30:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:31:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T11:32:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T11:33:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:34:51.462Z', + 'value': '0.4952333787297264' + }, + { + 'time': '2017-08-27T11:35:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:36:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:37:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:38:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:39:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T11:40:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:41:51.462Z', + 'value': '0.49524752852435283' + }, + { + 'time': '2017-08-27T11:42:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:43:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T11:44:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:45:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T11:46:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T11:47:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T11:48:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T11:49:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T11:50:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T11:51:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T11:52:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:53:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T11:54:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:55:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T11:56:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:57:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T11:58:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T11:59:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:00:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:01:51.462Z', + 'value': '0.49524281183630325' + }, + { + 'time': '2017-08-27T12:02:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:03:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:04:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:05:51.462Z', + 'value': '0.4857096599080009' + }, + { + 'time': '2017-08-27T12:06:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:07:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:08:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:09:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:10:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:11:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:12:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:13:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:14:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:15:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:16:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:17:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:18:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:19:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:20:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:21:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:22:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:23:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:24:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:25:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:26:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:27:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:28:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:29:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:30:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:31:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:32:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:33:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:34:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:35:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:36:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:37:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:38:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:39:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:40:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:41:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:42:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:43:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:44:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:45:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:46:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:47:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:48:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:49:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:50:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:51:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:52:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:53:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:54:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T12:55:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:56:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:57:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T12:58:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T12:59:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T13:00:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T13:01:51.462Z', + 'value': '0.4761859410862754' + }, + { + 'time': '2017-08-27T13:02:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:03:51.462Z', + 'value': '0.4761995466580315' + }, + { + 'time': '2017-08-27T13:04:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:05:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:06:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:07:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:08:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:09:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:10:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:11:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:12:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:13:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:14:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:15:51.462Z', + 'value': '0.45714285714285713' + }, + { + 'time': '2017-08-27T13:16:51.462Z', + 'value': '0.49524752852435283' + }, + { + 'time': '2017-08-27T13:17:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:18:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:19:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:20:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T13:21:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:22:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:23:51.462Z', + 'value': '0.4666666666666667' + }, + { + 'time': '2017-08-27T13:24:51.462Z', + 'value': '0.45714285714285713' + }, + { + 'time': '2017-08-27T13:25:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T13:26:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:27:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T13:28:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:29:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:30:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:31:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:32:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T13:33:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:34:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:35:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T13:36:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:37:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:38:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:39:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:40:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:41:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:42:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:43:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:44:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:45:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:46:51.462Z', + 'value': '0.45714285714285713' + }, + { + 'time': '2017-08-27T13:47:51.462Z', + 'value': '0.4666666666666667' + }, + { + 'time': '2017-08-27T13:48:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T13:49:51.462Z', + 'value': '0.4761859410862754' + }, + { + 'time': '2017-08-27T13:50:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:51:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:52:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:53:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:54:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:55:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:56:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T13:57:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T13:58:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T13:59:51.462Z', + 'value': '0.4761859410862754' + }, + { + 'time': '2017-08-27T14:00:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T14:01:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T14:02:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:03:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T14:04:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:05:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T14:06:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:07:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T14:08:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:09:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T14:10:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T14:11:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:12:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T14:13:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:14:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T14:15:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:16:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:17:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T14:18:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:19:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T14:20:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:21:51.462Z', + 'value': '0.4952286623111941' + }, + { + 'time': '2017-08-27T14:22:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:23:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T14:24:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:25:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T14:26:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:27:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T14:28:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:29:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:30:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T14:31:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:32:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:33:51.462Z', + 'value': '0.45714285714285713' + }, + { + 'time': '2017-08-27T14:34:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T14:35:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:36:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T14:37:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T14:38:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T14:39:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T14:40:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:41:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T14:42:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:43:51.462Z', + 'value': '0.4666666666666667' + }, + { + 'time': '2017-08-27T14:44:51.462Z', + 'value': '0.45714285714285713' + }, + { + 'time': '2017-08-27T14:45:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T14:46:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:47:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T14:48:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:49:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T14:50:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:51:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T14:52:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:53:51.462Z', + 'value': '0.4952333787297264' + }, + { + 'time': '2017-08-27T14:54:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:55:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T14:56:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:57:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T14:58:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T14:59:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T15:00:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:01:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:02:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:03:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:04:51.462Z', + 'value': '0.45714285714285713' + }, + { + 'time': '2017-08-27T15:05:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:06:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:07:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:08:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:09:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:10:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:11:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:12:51.462Z', + 'value': '0.4857096599080009' + }, + { + 'time': '2017-08-27T15:13:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:14:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:15:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:16:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T15:17:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:18:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:19:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:20:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T15:21:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:22:51.462Z', + 'value': '0.49524281183630325' + }, + { + 'time': '2017-08-27T15:23:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:24:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:25:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:26:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:27:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:28:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:29:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:30:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:31:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T15:32:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:33:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T15:34:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:35:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T15:36:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:37:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:38:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T15:39:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:40:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:41:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:42:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:43:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:44:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:45:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:46:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:47:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:48:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:49:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T15:50:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:51:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:52:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:53:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:54:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:55:51.462Z', + 'value': '0.49524752852435283' + }, + { + 'time': '2017-08-27T15:56:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T15:57:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:58:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T15:59:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:00:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T16:01:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T16:02:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:03:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:04:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:05:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T16:06:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:07:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T16:08:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T16:09:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T16:10:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T16:11:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:12:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T16:13:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:14:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T16:15:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T16:16:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T16:17:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T16:18:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:19:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T16:20:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:21:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T16:22:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:23:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T16:24:51.462Z', + 'value': '0.4761859410862754' + }, + { + 'time': '2017-08-27T16:25:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T16:26:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T16:27:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T16:28:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T16:29:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:30:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T16:31:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:32:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T16:33:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:34:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T16:35:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:36:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T16:37:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:38:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T16:39:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:40:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T16:41:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:42:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T16:43:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:44:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T16:45:51.462Z', + 'value': '0.485718911608682' + }, + { + 'time': '2017-08-27T16:46:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T16:47:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:48:51.462Z', + 'value': '0.4952333787297264' + }, + { + 'time': '2017-08-27T16:49:51.462Z', + 'value': '0.4857096599080009' + }, + { + 'time': '2017-08-27T16:50:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:51:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T16:52:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:53:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T16:54:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:55:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T16:56:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:57:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T16:58:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T16:59:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:00:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:01:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:02:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:03:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:04:51.462Z', + 'value': '0.47619501138106085' + }, + { + 'time': '2017-08-27T17:05:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T17:06:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:07:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T17:08:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T17:09:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:10:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:11:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:12:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:13:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:14:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:15:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:16:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:17:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:18:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:19:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:20:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:21:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:22:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:23:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:24:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T17:25:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:26:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:27:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:28:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:29:51.462Z', + 'value': '0.4761859410862754' + }, + { + 'time': '2017-08-27T17:30:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:31:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:32:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:33:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:34:51.462Z', + 'value': '0.4761859410862754' + }, + { + 'time': '2017-08-27T17:35:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:36:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T17:37:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:38:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:39:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:40:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:41:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:42:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:43:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:44:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T17:45:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:46:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:47:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:48:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T17:49:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:50:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T17:51:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:52:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:53:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:54:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:55:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T17:56:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:57:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T17:58:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T17:59:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T18:00:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:01:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:02:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:03:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:04:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:05:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:06:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:07:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:08:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:09:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:10:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:11:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:12:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T18:13:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:14:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:15:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:16:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:17:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:18:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:19:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:20:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:21:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:22:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:23:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:24:51.462Z', + 'value': '0.45714285714285713' + }, + { + 'time': '2017-08-27T18:25:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:26:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:27:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:28:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:29:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:30:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:31:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:32:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:33:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:34:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:35:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:36:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:37:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T18:38:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:39:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:40:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:41:51.462Z', + 'value': '0.6190476190476191' + }, + { + 'time': '2017-08-27T18:42:51.462Z', + 'value': '0.6952380952380952' + }, + { + 'time': '2017-08-27T18:43:51.462Z', + 'value': '0.857142857142857' + }, + { + 'time': '2017-08-27T18:44:51.462Z', + 'value': '0.9238095238095239' + }, + { + 'time': '2017-08-27T18:45:51.462Z', + 'value': '0.7428571428571429' + }, + { + 'time': '2017-08-27T18:46:51.462Z', + 'value': '0.8857142857142857' + }, + { + 'time': '2017-08-27T18:47:51.462Z', + 'value': '0.638095238095238' + }, + { + 'time': '2017-08-27T18:48:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:49:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:50:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T18:51:51.462Z', + 'value': '0.47619501138106085' + }, + { + 'time': '2017-08-27T18:52:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:53:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:54:51.462Z', + 'value': '0.4952380952380952' + }, + { + 'time': '2017-08-27T18:55:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:56:51.462Z', + 'value': '0.4857142857142857' + }, + { + 'time': '2017-08-27T18:57:51.462Z', + 'value': '0.47619047619047616' + }, + { + 'time': '2017-08-27T18:58:51.462Z', + 'value': '0.6857142857142856' + }, + { + 'time': '2017-08-27T18:59:51.462Z', + 'value': '0.6952380952380952' + }, + { + 'time': '2017-08-27T19:00:51.462Z', + 'value': '0.5238095238095237' + }, + { + 'time': '2017-08-27T19:01:51.462Z', + 'value': '0.5904761904761905' + } + ] + } + ] + } ] - } - ] - } + } ]; +export function convertDatesMultipleSeries(multipleSeries) { + const convertedMultiple = multipleSeries; + multipleSeries.forEach((column, index) => { + let convertedResult = []; + convertedResult = column.queries[0].result.map((resultObj) => { + const convertedMetrics = {}; + convertedMetrics.values = resultObj.values.map(val => ({ + time: new Date(val.time), + value: val.value, + })); + convertedMetrics.metric = resultObj.metric; + return convertedMetrics; + }); + convertedMultiple[index].queries[0].result = convertedResult; + }); + return convertedMultiple; +} + export function MonitorMockInterceptor(request, next) { const body = responseMockData[request.method.toUpperCase()][request.url]; diff --git a/spec/javascripts/monitoring/monitoring_paths_spec.js b/spec/javascripts/monitoring/monitoring_paths_spec.js new file mode 100644 index 00000000000..d39db945e17 --- /dev/null +++ b/spec/javascripts/monitoring/monitoring_paths_spec.js @@ -0,0 +1,34 @@ +import Vue from 'vue'; +import MonitoringPaths from '~/monitoring/components/monitoring_paths.vue'; +import createTimeSeries from '~/monitoring/utils/multiple_time_series'; +import { singleRowMetricsMultipleSeries, convertDatesMultipleSeries } from './mock_data'; + +const createComponent = (propsData) => { + const Component = Vue.extend(MonitoringPaths); + + return new Component({ + propsData, + }).$mount(); +}; + +const convertedMetrics = convertDatesMultipleSeries(singleRowMetricsMultipleSeries); + +const timeSeries = createTimeSeries(convertedMetrics[0].queries[0].result, 428, 272, 120); + +describe('Monitoring Paths', () => { + it('renders two paths to represent a line and the area underneath it', () => { + const component = createComponent({ + generatedLinePath: timeSeries[0].linePath, + generatedAreaPath: timeSeries[0].areaPath, + lineColor: '#ccc', + areaColor: '#fff', + }); + const metricArea = component.$el.querySelector('.metric-area'); + const metricLine = component.$el.querySelector('.metric-line'); + + expect(metricArea.getAttribute('fill')).toBe('#fff'); + expect(metricArea.getAttribute('d')).toBe(timeSeries[0].areaPath); + expect(metricLine.getAttribute('stroke')).toBe('#ccc'); + expect(metricLine.getAttribute('d')).toBe(timeSeries[0].linePath); + }); +}); diff --git a/spec/javascripts/monitoring/utils/multiple_time_series_spec.js b/spec/javascripts/monitoring/utils/multiple_time_series_spec.js new file mode 100644 index 00000000000..3daf6bf82df --- /dev/null +++ b/spec/javascripts/monitoring/utils/multiple_time_series_spec.js @@ -0,0 +1,21 @@ +import createTimeSeries from '~/monitoring/utils/multiple_time_series'; +import { convertDatesMultipleSeries, singleRowMetricsMultipleSeries } from '../mock_data'; + +const convertedMetrics = convertDatesMultipleSeries(singleRowMetricsMultipleSeries); +const timeSeries = createTimeSeries(convertedMetrics[0].queries[0].result, 428, 272, 120); + +describe('Multiple time series', () => { + it('createTimeSeries returned array contains an object for each element', () => { + expect(typeof timeSeries[0].linePath).toEqual('string'); + expect(typeof timeSeries[0].areaPath).toEqual('string'); + expect(typeof timeSeries[0].timeSeriesScaleX).toEqual('function'); + expect(typeof timeSeries[0].areaColor).toEqual('string'); + expect(typeof timeSeries[0].lineColor).toEqual('string'); + expect(timeSeries[0].values instanceof Array).toEqual(true); + }); + + it('createTimeSeries returns an array', () => { + expect(timeSeries instanceof Array).toEqual(true); + expect(timeSeries.length).toEqual(2); + }); +}); diff --git a/spec/javascripts/project_title_spec.js b/spec/javascripts/project_title_spec.js deleted file mode 100644 index 3d36bb3e4d4..00000000000 --- a/spec/javascripts/project_title_spec.js +++ /dev/null @@ -1,59 +0,0 @@ -/* global Project */ - -import 'select2/select2'; -import '~/gl_dropdown'; -import '~/api'; -import '~/project_select'; -import '~/project'; - -describe('Project Title', () => { - const dummyApiVersion = 'v3000'; - preloadFixtures('issues/open-issue.html.raw'); - loadJSONFixtures('projects.json'); - - beforeEach(() => { - loadFixtures('issues/open-issue.html.raw'); - - window.gon = {}; - window.gon.api_version = dummyApiVersion; - - // eslint-disable-next-line no-new - new Project(); - }); - - describe('project list', () => { - let reqUrl; - let reqData; - - beforeEach(() => { - const fakeResponseData = getJSONFixture('projects.json'); - spyOn(jQuery, 'ajax').and.callFake((req) => { - const def = $.Deferred(); - reqUrl = req.url; - reqData = req.data; - def.resolve(fakeResponseData); - return def.promise(); - }); - }); - - it('toggles dropdown', () => { - const $menu = $('.js-dropdown-menu-projects'); - window.gon.current_user_id = 1; - $('.js-projects-dropdown-toggle').click(); - expect($menu).toHaveClass('open'); - expect(reqUrl).toBe(`/api/${dummyApiVersion}/projects.json?simple=true`); - expect(reqData).toEqual({ - search: '', - order_by: 'last_activity_at', - per_page: 20, - membership: true, - }); - $menu.find('.dropdown-menu-close-icon').click(); - expect($menu).not.toHaveClass('open'); - }); - }); - - afterEach(() => { - window.gon = {}; - }); -}); diff --git a/spec/javascripts/projects_dropdown/components/app_spec.js b/spec/javascripts/projects_dropdown/components/app_spec.js new file mode 100644 index 00000000000..42f0f6fc1af --- /dev/null +++ b/spec/javascripts/projects_dropdown/components/app_spec.js @@ -0,0 +1,348 @@ +import Vue from 'vue'; + +import bp from '~/breakpoints'; +import appComponent from '~/projects_dropdown/components/app.vue'; +import eventHub from '~/projects_dropdown/event_hub'; +import ProjectsStore from '~/projects_dropdown/store/projects_store'; +import ProjectsService from '~/projects_dropdown/service/projects_service'; + +import mountComponent from '../../helpers/vue_mount_component_helper'; +import { currentSession, mockProject, mockRawProject } from '../mock_data'; + +const createComponent = () => { + gon.api_version = currentSession.apiVersion; + const Component = Vue.extend(appComponent); + const store = new ProjectsStore(); + const service = new ProjectsService(currentSession.username); + + return mountComponent(Component, { + store, + service, + currentUserName: currentSession.username, + currentProject: currentSession.project, + }); +}; + +const returnServicePromise = (data, failed) => new Promise((resolve, reject) => { + if (failed) { + reject(data); + } else { + resolve({ + json() { + return data; + }, + }); + } +}); + +describe('AppComponent', () => { + describe('computed', () => { + let vm; + + beforeEach(() => { + vm = createComponent(); + }); + + afterEach(() => { + vm.$destroy(); + }); + + describe('frequentProjects', () => { + it('should return list of frequently accessed projects from store', () => { + expect(vm.frequentProjects).toBeDefined(); + expect(vm.frequentProjects.length).toBe(0); + + vm.store.setFrequentProjects([mockProject]); + expect(vm.frequentProjects).toBeDefined(); + expect(vm.frequentProjects.length).toBe(1); + }); + }); + + describe('searchProjects', () => { + it('should return list of frequently accessed projects from store', () => { + expect(vm.searchProjects).toBeDefined(); + expect(vm.searchProjects.length).toBe(0); + + vm.store.setSearchedProjects([mockRawProject]); + expect(vm.searchProjects).toBeDefined(); + expect(vm.searchProjects.length).toBe(1); + }); + }); + }); + + describe('methods', () => { + let vm; + + beforeEach(() => { + vm = createComponent(); + }); + + afterEach(() => { + vm.$destroy(); + }); + + describe('toggleFrequentProjectsList', () => { + it('should toggle props which control visibility of Frequent Projects list from state passed', () => { + vm.toggleFrequentProjectsList(true); + expect(vm.isLoadingProjects).toBeFalsy(); + expect(vm.isSearchListVisible).toBeFalsy(); + expect(vm.isFrequentsListVisible).toBeTruthy(); + + vm.toggleFrequentProjectsList(false); + expect(vm.isLoadingProjects).toBeTruthy(); + expect(vm.isSearchListVisible).toBeTruthy(); + expect(vm.isFrequentsListVisible).toBeFalsy(); + }); + }); + + describe('toggleSearchProjectsList', () => { + it('should toggle props which control visibility of Searched Projects list from state passed', () => { + vm.toggleSearchProjectsList(true); + expect(vm.isLoadingProjects).toBeFalsy(); + expect(vm.isFrequentsListVisible).toBeFalsy(); + expect(vm.isSearchListVisible).toBeTruthy(); + + vm.toggleSearchProjectsList(false); + expect(vm.isLoadingProjects).toBeTruthy(); + expect(vm.isFrequentsListVisible).toBeTruthy(); + expect(vm.isSearchListVisible).toBeFalsy(); + }); + }); + + describe('toggleLoader', () => { + it('should toggle props which control visibility of list loading animation from state passed', () => { + vm.toggleLoader(true); + expect(vm.isFrequentsListVisible).toBeFalsy(); + expect(vm.isSearchListVisible).toBeFalsy(); + expect(vm.isLoadingProjects).toBeTruthy(); + + vm.toggleLoader(false); + expect(vm.isFrequentsListVisible).toBeTruthy(); + expect(vm.isSearchListVisible).toBeTruthy(); + expect(vm.isLoadingProjects).toBeFalsy(); + }); + }); + + describe('fetchFrequentProjects', () => { + it('should set props for loading animation to `true` while frequent projects list is being loaded', () => { + spyOn(vm, 'toggleLoader'); + + vm.fetchFrequentProjects(); + expect(vm.isLocalStorageFailed).toBeFalsy(); + expect(vm.toggleLoader).toHaveBeenCalledWith(true); + }); + + it('should set props for loading animation to `false` and props for frequent projects list to `true` once data is loaded', () => { + const mockData = [mockProject]; + + spyOn(vm.service, 'getFrequentProjects').and.returnValue(mockData); + spyOn(vm.store, 'setFrequentProjects'); + spyOn(vm, 'toggleFrequentProjectsList'); + + vm.fetchFrequentProjects(); + expect(vm.service.getFrequentProjects).toHaveBeenCalled(); + expect(vm.store.setFrequentProjects).toHaveBeenCalledWith(mockData); + expect(vm.toggleFrequentProjectsList).toHaveBeenCalledWith(true); + }); + + it('should set props for failure message to `true` when method fails to fetch frequent projects list', () => { + spyOn(vm.service, 'getFrequentProjects').and.returnValue(null); + spyOn(vm.store, 'setFrequentProjects'); + spyOn(vm, 'toggleFrequentProjectsList'); + + expect(vm.isLocalStorageFailed).toBeFalsy(); + + vm.fetchFrequentProjects(); + expect(vm.service.getFrequentProjects).toHaveBeenCalled(); + expect(vm.store.setFrequentProjects).toHaveBeenCalledWith([]); + expect(vm.toggleFrequentProjectsList).toHaveBeenCalledWith(true); + expect(vm.isLocalStorageFailed).toBeTruthy(); + }); + + it('should set props for search results list to `true` if search query was already made previously', () => { + spyOn(bp, 'getBreakpointSize').and.returnValue('md'); + spyOn(vm.service, 'getFrequentProjects'); + spyOn(vm, 'toggleSearchProjectsList'); + + vm.searchQuery = 'test'; + vm.fetchFrequentProjects(); + expect(vm.service.getFrequentProjects).not.toHaveBeenCalled(); + expect(vm.toggleSearchProjectsList).toHaveBeenCalledWith(true); + }); + + it('should set props for frequent projects list to `true` if search query was already made but screen size is less than 768px', () => { + spyOn(bp, 'getBreakpointSize').and.returnValue('sm'); + spyOn(vm, 'toggleSearchProjectsList'); + spyOn(vm.service, 'getFrequentProjects'); + + vm.searchQuery = 'test'; + vm.fetchFrequentProjects(); + expect(vm.service.getFrequentProjects).toHaveBeenCalled(); + expect(vm.toggleSearchProjectsList).not.toHaveBeenCalled(); + }); + }); + + describe('fetchSearchedProjects', () => { + const searchQuery = 'test'; + + it('should perform search with provided search query', (done) => { + const mockData = [mockRawProject]; + spyOn(vm, 'toggleLoader'); + spyOn(vm, 'toggleSearchProjectsList'); + spyOn(vm.service, 'getSearchedProjects').and.returnValue(returnServicePromise(mockData)); + spyOn(vm.store, 'setSearchedProjects'); + + vm.fetchSearchedProjects(searchQuery); + setTimeout(() => { + expect(vm.searchQuery).toBe(searchQuery); + expect(vm.toggleLoader).toHaveBeenCalledWith(true); + expect(vm.service.getSearchedProjects).toHaveBeenCalledWith(searchQuery); + expect(vm.toggleSearchProjectsList).toHaveBeenCalledWith(true); + expect(vm.store.setSearchedProjects).toHaveBeenCalledWith(mockData); + done(); + }, 0); + }); + + it('should update props for showing search failure', (done) => { + spyOn(vm, 'toggleSearchProjectsList'); + spyOn(vm.service, 'getSearchedProjects').and.returnValue(returnServicePromise({}, true)); + + vm.fetchSearchedProjects(searchQuery); + setTimeout(() => { + expect(vm.searchQuery).toBe(searchQuery); + expect(vm.service.getSearchedProjects).toHaveBeenCalledWith(searchQuery); + expect(vm.isSearchFailed).toBeTruthy(); + expect(vm.toggleSearchProjectsList).toHaveBeenCalledWith(true); + done(); + }, 0); + }); + }); + + describe('logCurrentProjectAccess', () => { + it('should log current project access via service', (done) => { + spyOn(vm.service, 'logProjectAccess'); + + vm.currentProject = mockProject; + vm.logCurrentProjectAccess(); + + setTimeout(() => { + expect(vm.service.logProjectAccess).toHaveBeenCalledWith(mockProject); + done(); + }, 1); + }); + }); + + describe('handleSearchClear', () => { + it('should show frequent projects list when search input is cleared', () => { + spyOn(vm.store, 'clearSearchedProjects'); + spyOn(vm, 'toggleFrequentProjectsList'); + + vm.handleSearchClear(); + + expect(vm.toggleFrequentProjectsList).toHaveBeenCalledWith(true); + expect(vm.store.clearSearchedProjects).toHaveBeenCalled(); + expect(vm.searchQuery).toBe(''); + }); + }); + + describe('handleSearchFailure', () => { + it('should show failure message within dropdown', () => { + spyOn(vm, 'toggleSearchProjectsList'); + + vm.handleSearchFailure(); + expect(vm.toggleSearchProjectsList).toHaveBeenCalledWith(true); + expect(vm.isSearchFailed).toBeTruthy(); + }); + }); + }); + + describe('created', () => { + it('should bind event listeners on eventHub', (done) => { + spyOn(eventHub, '$on'); + + createComponent().$mount(); + + Vue.nextTick(() => { + expect(eventHub.$on).toHaveBeenCalledWith('dropdownOpen', jasmine.any(Function)); + expect(eventHub.$on).toHaveBeenCalledWith('searchProjects', jasmine.any(Function)); + expect(eventHub.$on).toHaveBeenCalledWith('searchCleared', jasmine.any(Function)); + expect(eventHub.$on).toHaveBeenCalledWith('searchFailed', jasmine.any(Function)); + done(); + }); + }); + }); + + describe('beforeDestroy', () => { + it('should unbind event listeners on eventHub', (done) => { + const vm = createComponent(); + spyOn(eventHub, '$off'); + + vm.$mount(); + vm.$destroy(); + + Vue.nextTick(() => { + expect(eventHub.$off).toHaveBeenCalledWith('dropdownOpen', jasmine.any(Function)); + expect(eventHub.$off).toHaveBeenCalledWith('searchProjects', jasmine.any(Function)); + expect(eventHub.$off).toHaveBeenCalledWith('searchCleared', jasmine.any(Function)); + expect(eventHub.$off).toHaveBeenCalledWith('searchFailed', jasmine.any(Function)); + done(); + }); + }); + }); + + describe('template', () => { + let vm; + + beforeEach(() => { + vm = createComponent(); + }); + + afterEach(() => { + vm.$destroy(); + }); + + it('should render search input', () => { + expect(vm.$el.querySelector('.search-input-container')).toBeDefined(); + }); + + it('should render loading animation', (done) => { + vm.toggleLoader(true); + Vue.nextTick(() => { + const loadingEl = vm.$el.querySelector('.loading-animation'); + + expect(loadingEl).toBeDefined(); + expect(loadingEl.classList.contains('prepend-top-20')).toBeTruthy(); + expect(loadingEl.querySelector('i').getAttribute('aria-label')).toBe('Loading projects'); + done(); + }); + }); + + it('should render frequent projects list header', (done) => { + vm.toggleFrequentProjectsList(true); + Vue.nextTick(() => { + const sectionHeaderEl = vm.$el.querySelector('.section-header'); + + expect(sectionHeaderEl).toBeDefined(); + expect(sectionHeaderEl.innerText.trim()).toBe('Frequently visited'); + done(); + }); + }); + + it('should render frequent projects list', (done) => { + vm.toggleFrequentProjectsList(true); + Vue.nextTick(() => { + expect(vm.$el.querySelector('.projects-list-frequent-container')).toBeDefined(); + done(); + }); + }); + + it('should render searched projects list', (done) => { + vm.toggleSearchProjectsList(true); + Vue.nextTick(() => { + expect(vm.$el.querySelector('.section-header')).toBe(null); + expect(vm.$el.querySelector('.projects-list-search-container')).toBeDefined(); + done(); + }); + }); + }); +}); diff --git a/spec/javascripts/projects_dropdown/components/projects_list_frequent_spec.js b/spec/javascripts/projects_dropdown/components/projects_list_frequent_spec.js new file mode 100644 index 00000000000..fcd0f6a3630 --- /dev/null +++ b/spec/javascripts/projects_dropdown/components/projects_list_frequent_spec.js @@ -0,0 +1,72 @@ +import Vue from 'vue'; + +import projectsListFrequentComponent from '~/projects_dropdown/components/projects_list_frequent.vue'; + +import mountComponent from '../../helpers/vue_mount_component_helper'; +import { mockFrequents } from '../mock_data'; + +const createComponent = () => { + const Component = Vue.extend(projectsListFrequentComponent); + + return mountComponent(Component, { + projects: mockFrequents, + localStorageFailed: false, + }); +}; + +describe('ProjectsListFrequentComponent', () => { + let vm; + + beforeEach(() => { + vm = createComponent(); + }); + + afterEach(() => { + vm.$destroy(); + }); + + describe('computed', () => { + describe('isListEmpty', () => { + it('should return `true` or `false` representing whether if `projects` is empty of not', () => { + vm.projects = []; + expect(vm.isListEmpty).toBeTruthy(); + + vm.projects = mockFrequents; + expect(vm.isListEmpty).toBeFalsy(); + }); + }); + + describe('listEmptyMessage', () => { + it('should return appropriate empty list message based on value of `localStorageFailed` prop', () => { + vm.localStorageFailed = true; + expect(vm.listEmptyMessage).toBe('This feature requires browser localStorage support'); + + vm.localStorageFailed = false; + expect(vm.listEmptyMessage).toBe('Projects you visit often will appear here'); + }); + }); + }); + + describe('template', () => { + it('should render component element with list of projects', (done) => { + vm.projects = mockFrequents; + + Vue.nextTick(() => { + expect(vm.$el.classList.contains('projects-list-frequent-container')).toBeTruthy(); + expect(vm.$el.querySelectorAll('ul.list-unstyled').length).toBe(1); + expect(vm.$el.querySelectorAll('li.projects-list-item-container').length).toBe(5); + done(); + }); + }); + + it('should render component element with empty message', (done) => { + vm.projects = []; + + Vue.nextTick(() => { + expect(vm.$el.querySelectorAll('li.section-empty').length).toBe(1); + expect(vm.$el.querySelectorAll('li.projects-list-item-container').length).toBe(0); + done(); + }); + }); + }); +}); diff --git a/spec/javascripts/projects_dropdown/components/projects_list_item_spec.js b/spec/javascripts/projects_dropdown/components/projects_list_item_spec.js new file mode 100644 index 00000000000..171629fcd6b --- /dev/null +++ b/spec/javascripts/projects_dropdown/components/projects_list_item_spec.js @@ -0,0 +1,65 @@ +import Vue from 'vue'; + +import projectsListItemComponent from '~/projects_dropdown/components/projects_list_item.vue'; + +import mountComponent from '../../helpers/vue_mount_component_helper'; +import { mockProject } from '../mock_data'; + +const createComponent = () => { + const Component = Vue.extend(projectsListItemComponent); + + return mountComponent(Component, { + projectId: mockProject.id, + projectName: mockProject.name, + namespace: mockProject.namespace, + webUrl: mockProject.webUrl, + avatarUrl: mockProject.avatarUrl, + }); +}; + +describe('ProjectsListItemComponent', () => { + let vm; + + beforeEach(() => { + vm = createComponent(); + }); + + afterEach(() => { + vm.$destroy(); + }); + + describe('computed', () => { + describe('hasAvatar', () => { + it('should return `true` or `false` if whether avatar is present or not', () => { + vm.avatarUrl = 'path/to/avatar.png'; + expect(vm.hasAvatar).toBeTruthy(); + + vm.avatarUrl = null; + expect(vm.hasAvatar).toBeFalsy(); + }); + }); + + describe('highlightedProjectName', () => { + it('should enclose part of project name in <b> & </b> which matches with `matcher` prop', () => { + vm.matcher = 'lab'; + expect(vm.highlightedProjectName).toContain('<b>Lab</b>'); + }); + + it('should return project name as it is if `matcher` is not available', () => { + vm.matcher = null; + expect(vm.highlightedProjectName).toBe(mockProject.name); + }); + }); + }); + + describe('template', () => { + it('should render component element', () => { + expect(vm.$el.classList.contains('projects-list-item-container')).toBeTruthy(); + expect(vm.$el.querySelectorAll('a').length).toBe(1); + expect(vm.$el.querySelectorAll('.project-item-avatar-container').length).toBe(1); + expect(vm.$el.querySelectorAll('.project-item-metadata-container').length).toBe(1); + expect(vm.$el.querySelectorAll('.project-title').length).toBe(1); + expect(vm.$el.querySelectorAll('.project-namespace').length).toBe(1); + }); + }); +}); diff --git a/spec/javascripts/projects_dropdown/components/projects_list_search_spec.js b/spec/javascripts/projects_dropdown/components/projects_list_search_spec.js new file mode 100644 index 00000000000..59fc2dedba5 --- /dev/null +++ b/spec/javascripts/projects_dropdown/components/projects_list_search_spec.js @@ -0,0 +1,84 @@ +import Vue from 'vue'; + +import projectsListSearchComponent from '~/projects_dropdown/components/projects_list_search.vue'; + +import mountComponent from '../../helpers/vue_mount_component_helper'; +import { mockProject } from '../mock_data'; + +const createComponent = () => { + const Component = Vue.extend(projectsListSearchComponent); + + return mountComponent(Component, { + projects: [mockProject], + matcher: 'lab', + searchFailed: false, + }); +}; + +describe('ProjectsListSearchComponent', () => { + let vm; + + beforeEach(() => { + vm = createComponent(); + }); + + afterEach(() => { + vm.$destroy(); + }); + + describe('computed', () => { + describe('isListEmpty', () => { + it('should return `true` or `false` representing whether if `projects` is empty of not', () => { + vm.projects = []; + expect(vm.isListEmpty).toBeTruthy(); + + vm.projects = [mockProject]; + expect(vm.isListEmpty).toBeFalsy(); + }); + }); + + describe('listEmptyMessage', () => { + it('should return appropriate empty list message based on value of `searchFailed` prop', () => { + vm.searchFailed = true; + expect(vm.listEmptyMessage).toBe('Something went wrong on our end.'); + + vm.searchFailed = false; + expect(vm.listEmptyMessage).toBe('No projects matched your query'); + }); + }); + }); + + describe('template', () => { + it('should render component element with list of projects', (done) => { + vm.projects = [mockProject]; + + Vue.nextTick(() => { + expect(vm.$el.classList.contains('projects-list-search-container')).toBeTruthy(); + expect(vm.$el.querySelectorAll('ul.list-unstyled').length).toBe(1); + expect(vm.$el.querySelectorAll('li.projects-list-item-container').length).toBe(1); + done(); + }); + }); + + it('should render component element with empty message', (done) => { + vm.projects = []; + + Vue.nextTick(() => { + expect(vm.$el.querySelectorAll('li.section-empty').length).toBe(1); + expect(vm.$el.querySelectorAll('li.projects-list-item-container').length).toBe(0); + done(); + }); + }); + + it('should render component element with failure message', (done) => { + vm.searchFailed = true; + vm.projects = []; + + Vue.nextTick(() => { + expect(vm.$el.querySelectorAll('li.section-empty.section-failure').length).toBe(1); + expect(vm.$el.querySelectorAll('li.projects-list-item-container').length).toBe(0); + done(); + }); + }); + }); +}); diff --git a/spec/javascripts/projects_dropdown/components/search_spec.js b/spec/javascripts/projects_dropdown/components/search_spec.js new file mode 100644 index 00000000000..f2a23e33325 --- /dev/null +++ b/spec/javascripts/projects_dropdown/components/search_spec.js @@ -0,0 +1,101 @@ +import Vue from 'vue'; + +import searchComponent from '~/projects_dropdown/components/search.vue'; +import eventHub from '~/projects_dropdown/event_hub'; + +import mountComponent from '../../helpers/vue_mount_component_helper'; + +const createComponent = () => { + const Component = Vue.extend(searchComponent); + + return mountComponent(Component); +}; + +describe('SearchComponent', () => { + describe('methods', () => { + let vm; + + beforeEach(() => { + vm = createComponent(); + }); + + afterEach(() => { + vm.$destroy(); + }); + + describe('setFocus', () => { + it('should set focus to search input', () => { + spyOn(vm.$refs.search, 'focus'); + + vm.setFocus(); + expect(vm.$refs.search.focus).toHaveBeenCalled(); + }); + }); + + describe('emitSearchEvents', () => { + it('should emit `searchProjects` event via eventHub when `searchQuery` present', () => { + const searchQuery = 'test'; + spyOn(eventHub, '$emit'); + vm.searchQuery = searchQuery; + vm.emitSearchEvents(); + expect(eventHub.$emit).toHaveBeenCalledWith('searchProjects', searchQuery); + }); + + it('should emit `searchCleared` event via eventHub when `searchQuery` is cleared', () => { + spyOn(eventHub, '$emit'); + vm.searchQuery = ''; + vm.emitSearchEvents(); + expect(eventHub.$emit).toHaveBeenCalledWith('searchCleared'); + }); + }); + }); + + describe('mounted', () => { + it('should listen `dropdownOpen` event', (done) => { + spyOn(eventHub, '$on'); + createComponent(); + + Vue.nextTick(() => { + expect(eventHub.$on).toHaveBeenCalledWith('dropdownOpen', jasmine.any(Function)); + done(); + }); + }); + }); + + describe('beforeDestroy', () => { + it('should unbind event listeners on eventHub', (done) => { + const vm = createComponent(); + spyOn(eventHub, '$off'); + + vm.$mount(); + vm.$destroy(); + + Vue.nextTick(() => { + expect(eventHub.$off).toHaveBeenCalledWith('dropdownOpen', jasmine.any(Function)); + done(); + }); + }); + }); + + describe('template', () => { + let vm; + + beforeEach(() => { + vm = createComponent(); + }); + + afterEach(() => { + vm.$destroy(); + }); + + it('should render component element', () => { + const inputEl = vm.$el.querySelector('input.form-control'); + + expect(vm.$el.classList.contains('search-input-container')).toBeTruthy(); + expect(vm.$el.classList.contains('hidden-xs')).toBeTruthy(); + expect(inputEl).not.toBe(null); + expect(inputEl.getAttribute('placeholder')).toBe('Search projects'); + expect(vm.$el.querySelector('.search-icon')).toBeDefined(); + }); + }); +}); diff --git a/spec/javascripts/projects_dropdown/mock_data.js b/spec/javascripts/projects_dropdown/mock_data.js new file mode 100644 index 00000000000..d6a79fb8ac1 --- /dev/null +++ b/spec/javascripts/projects_dropdown/mock_data.js @@ -0,0 +1,96 @@ +export const currentSession = { + username: 'root', + storageKey: 'root/frequent-projects', + apiVersion: 'v4', + project: { + id: 1, + name: 'dummy-project', + namespace: 'SamepleGroup / Dummy-Project', + webUrl: 'http://127.0.0.1/samplegroup/dummy-project', + avatarUrl: null, + lastAccessedOn: Date.now(), + }, +}; + +export const mockProject = { + id: 1, + name: 'GitLab Community Edition', + namespace: 'gitlab-org / gitlab-ce', + webUrl: 'http://127.0.0.1:3000/gitlab-org/gitlab-ce', + avatarUrl: null, +}; + +export const mockRawProject = { + id: 1, + name: 'GitLab Community Edition', + name_with_namespace: 'gitlab-org / gitlab-ce', + web_url: 'http://127.0.0.1:3000/gitlab-org/gitlab-ce', + avatar_url: null, +}; + +export const mockFrequents = [ + { + id: 1, + name: 'GitLab Community Edition', + namespace: 'gitlab-org / gitlab-ce', + webUrl: 'http://127.0.0.1:3000/gitlab-org/gitlab-ce', + avatarUrl: null, + }, + { + id: 2, + name: 'GitLab CI', + namespace: 'gitlab-org / gitlab-ci', + webUrl: 'http://127.0.0.1:3000/gitlab-org/gitlab-ci', + avatarUrl: null, + }, + { + id: 3, + name: 'Typeahead.Js', + namespace: 'twitter / typeahead-js', + webUrl: 'http://127.0.0.1:3000/twitter/typeahead-js', + avatarUrl: '/uploads/-/system/project/avatar/7/TWBS.png', + }, + { + id: 4, + name: 'Intel', + namespace: 'platform / hardware / bsp / intel', + webUrl: 'http://127.0.0.1:3000/platform/hardware/bsp/intel', + avatarUrl: null, + }, + { + id: 5, + name: 'v4.4', + namespace: 'platform / hardware / bsp / kernel / common / v4.4', + webUrl: 'http://localhost:3000/platform/hardware/bsp/kernel/common/v4.4', + avatarUrl: null, + }, +]; + +export const unsortedFrequents = [ + { id: 1, frequency: 12, lastAccessedOn: 1491400843391 }, + { id: 2, frequency: 14, lastAccessedOn: 1488240890738 }, + { id: 3, frequency: 44, lastAccessedOn: 1497675908472 }, + { id: 4, frequency: 8, lastAccessedOn: 1497979281815 }, + { id: 5, frequency: 34, lastAccessedOn: 1488089211943 }, + { id: 6, frequency: 14, lastAccessedOn: 1493517292488 }, + { id: 7, frequency: 42, lastAccessedOn: 1486815299875 }, + { id: 8, frequency: 33, lastAccessedOn: 1500762279114 }, + { id: 10, frequency: 46, lastAccessedOn: 1483251641543 }, +]; + +/** + * This const has a specific order which tests authenticity + * of `ProjectsService.getTopFrequentProjects` method so + * DO NOT change order of items in this const. + */ +export const sortedFrequents = [ + { id: 10, frequency: 46, lastAccessedOn: 1483251641543 }, + { id: 3, frequency: 44, lastAccessedOn: 1497675908472 }, + { id: 7, frequency: 42, lastAccessedOn: 1486815299875 }, + { id: 5, frequency: 34, lastAccessedOn: 1488089211943 }, + { id: 8, frequency: 33, lastAccessedOn: 1500762279114 }, + { id: 6, frequency: 14, lastAccessedOn: 1493517292488 }, + { id: 2, frequency: 14, lastAccessedOn: 1488240890738 }, + { id: 1, frequency: 12, lastAccessedOn: 1491400843391 }, + { id: 4, frequency: 8, lastAccessedOn: 1497979281815 }, +]; diff --git a/spec/javascripts/projects_dropdown/service/projects_service_spec.js b/spec/javascripts/projects_dropdown/service/projects_service_spec.js new file mode 100644 index 00000000000..d5dd8b3449a --- /dev/null +++ b/spec/javascripts/projects_dropdown/service/projects_service_spec.js @@ -0,0 +1,179 @@ +import Vue from 'vue'; +import VueResource from 'vue-resource'; + +import bp from '~/breakpoints'; +import ProjectsService from '~/projects_dropdown/service/projects_service'; +import { FREQUENT_PROJECTS } from '~/projects_dropdown/constants'; +import { currentSession, unsortedFrequents, sortedFrequents } from '../mock_data'; + +Vue.use(VueResource); + +FREQUENT_PROJECTS.MAX_COUNT = 3; + +describe('ProjectsService', () => { + let service; + + beforeEach(() => { + gon.api_version = currentSession.apiVersion; + gon.current_user_id = 1; + service = new ProjectsService(currentSession.username); + }); + + describe('contructor', () => { + it('should initialize default properties of class', () => { + expect(service.isLocalStorageAvailable).toBeTruthy(); + expect(service.currentUserName).toBe(currentSession.username); + expect(service.storageKey).toBe(currentSession.storageKey); + expect(service.projectsPath).toBeDefined(); + }); + }); + + describe('getSearchedProjects', () => { + it('should return promise from VueResource HTTP GET', () => { + spyOn(service.projectsPath, 'get').and.stub(); + + const searchQuery = 'lab'; + const queryParams = { + simple: false, + per_page: 20, + membership: true, + order_by: 'last_activity_at', + search: searchQuery, + }; + + service.getSearchedProjects(searchQuery); + expect(service.projectsPath.get).toHaveBeenCalledWith(queryParams); + }); + }); + + describe('logProjectAccess', () => { + let storage; + + beforeEach(() => { + storage = {}; + + spyOn(window.localStorage, 'setItem').and.callFake((storageKey, value) => { + storage[storageKey] = value; + }); + + spyOn(window.localStorage, 'getItem').and.callFake((storageKey) => { + if (storage[storageKey]) { + return storage[storageKey]; + } + + return null; + }); + }); + + it('should create a project store if it does not exist and adds a project', () => { + service.logProjectAccess(currentSession.project); + + const projects = JSON.parse(storage[currentSession.storageKey]); + expect(projects.length).toBe(1); + expect(projects[0].frequency).toBe(1); + expect(projects[0].lastAccessedOn).toBeDefined(); + }); + + it('should prevent inserting same report multiple times into store', () => { + service.logProjectAccess(currentSession.project); + service.logProjectAccess(currentSession.project); + + const projects = JSON.parse(storage[currentSession.storageKey]); + expect(projects.length).toBe(1); + }); + + it('should increase frequency of report if it was logged multiple times over the course of an hour', () => { + let projects; + spyOn(Math, 'abs').and.returnValue(3600001); // this will lead to `diff` > 1; + service.logProjectAccess(currentSession.project); + + projects = JSON.parse(storage[currentSession.storageKey]); + expect(projects[0].frequency).toBe(1); + + service.logProjectAccess(currentSession.project); + projects = JSON.parse(storage[currentSession.storageKey]); + expect(projects[0].frequency).toBe(2); + expect(projects[0].lastAccessedOn).not.toBe(currentSession.project.lastAccessedOn); + }); + + it('should always update project metadata', () => { + let projects; + const oldProject = { + ...currentSession.project, + }; + + const newProject = { + ...currentSession.project, + name: 'New Name', + avatarUrl: 'new/avatar.png', + namespace: 'New / Namespace', + webUrl: 'http://localhost/new/web/url', + }; + + service.logProjectAccess(oldProject); + projects = JSON.parse(storage[currentSession.storageKey]); + expect(projects[0].name).toBe(oldProject.name); + expect(projects[0].avatarUrl).toBe(oldProject.avatarUrl); + expect(projects[0].namespace).toBe(oldProject.namespace); + expect(projects[0].webUrl).toBe(oldProject.webUrl); + + service.logProjectAccess(newProject); + projects = JSON.parse(storage[currentSession.storageKey]); + expect(projects[0].name).toBe(newProject.name); + expect(projects[0].avatarUrl).toBe(newProject.avatarUrl); + expect(projects[0].namespace).toBe(newProject.namespace); + expect(projects[0].webUrl).toBe(newProject.webUrl); + }); + + it('should not add more than 20 projects in store', () => { + for (let i = 1; i <= 5; i += 1) { + const project = Object.assign(currentSession.project, { id: i }); + service.logProjectAccess(project); + } + + const projects = JSON.parse(storage[currentSession.storageKey]); + expect(projects.length).toBe(3); + }); + }); + + describe('getTopFrequentProjects', () => { + let storage = {}; + + beforeEach(() => { + storage[currentSession.storageKey] = JSON.stringify(unsortedFrequents); + + spyOn(window.localStorage, 'getItem').and.callFake((storageKey) => { + if (storage[storageKey]) { + return storage[storageKey]; + } + + return null; + }); + }); + + it('should return top 5 frequently accessed projects for desktop screens', () => { + spyOn(bp, 'getBreakpointSize').and.returnValue('md'); + const frequentProjects = service.getTopFrequentProjects(); + + expect(frequentProjects.length).toBe(5); + frequentProjects.forEach((project, index) => { + expect(project.id).toBe(sortedFrequents[index].id); + }); + }); + + it('should return top 3 frequently accessed projects for mobile screens', () => { + spyOn(bp, 'getBreakpointSize').and.returnValue('sm'); + const frequentProjects = service.getTopFrequentProjects(); + + expect(frequentProjects.length).toBe(3); + frequentProjects.forEach((project, index) => { + expect(project.id).toBe(sortedFrequents[index].id); + }); + }); + + it('should return empty array if there are no projects available in store', () => { + storage = {}; + expect(service.getTopFrequentProjects().length).toBe(0); + }); + }); +}); diff --git a/spec/javascripts/projects_dropdown/store/projects_store_spec.js b/spec/javascripts/projects_dropdown/store/projects_store_spec.js new file mode 100644 index 00000000000..e57399d37cd --- /dev/null +++ b/spec/javascripts/projects_dropdown/store/projects_store_spec.js @@ -0,0 +1,41 @@ +import ProjectsStore from '~/projects_dropdown/store/projects_store'; +import { mockProject, mockRawProject } from '../mock_data'; + +describe('ProjectsStore', () => { + let store; + + beforeEach(() => { + store = new ProjectsStore(); + }); + + describe('setFrequentProjects', () => { + it('should set frequent projects list to state', () => { + store.setFrequentProjects([mockProject]); + + expect(store.getFrequentProjects().length).toBe(1); + expect(store.getFrequentProjects()[0].id).toBe(mockProject.id); + }); + }); + + describe('setSearchedProjects', () => { + it('should set searched projects list to state', () => { + store.setSearchedProjects([mockRawProject]); + + const processedProjects = store.getSearchedProjects(); + expect(processedProjects.length).toBe(1); + expect(processedProjects[0].id).toBe(mockRawProject.id); + expect(processedProjects[0].namespace).toBe(mockRawProject.name_with_namespace); + expect(processedProjects[0].webUrl).toBe(mockRawProject.web_url); + expect(processedProjects[0].avatarUrl).toBe(mockRawProject.avatar_url); + }); + }); + + describe('clearSearchedProjects', () => { + it('should clear searched projects list from state', () => { + store.setSearchedProjects([mockRawProject]); + expect(store.getSearchedProjects().length).toBe(1); + store.clearSearchedProjects(); + expect(store.getSearchedProjects().length).toBe(0); + }); + }); +}); diff --git a/spec/javascripts/vue_shared/components/identicon_spec.js b/spec/javascripts/vue_shared/components/identicon_spec.js index 4f194e5a64e..647680f00f7 100644 --- a/spec/javascripts/vue_shared/components/identicon_spec.js +++ b/spec/javascripts/vue_shared/components/identicon_spec.js @@ -1,25 +1,30 @@ import Vue from 'vue'; import identiconComponent from '~/vue_shared/components/identicon.vue'; -const createComponent = () => { +const createComponent = (sizeClass) => { const Component = Vue.extend(identiconComponent); return new Component({ propsData: { entityId: 1, entityName: 'entity-name', + sizeClass, }, }).$mount(); }; describe('IdenticonComponent', () => { - let vm; + describe('computed', () => { + let vm; - beforeEach(() => { - vm = createComponent(); - }); + beforeEach(() => { + vm = createComponent(); + }); + + afterEach(() => { + vm.$destroy(); + }); - describe('computed', () => { describe('identiconStyles', () => { it('should return styles attribute value with `background-color` property', () => { vm.entityId = 4; @@ -48,9 +53,20 @@ describe('IdenticonComponent', () => { describe('template', () => { it('should render identicon', () => { + const vm = createComponent(); + expect(vm.$el.nodeName).toBe('DIV'); expect(vm.$el.classList.contains('identicon')).toBeTruthy(); + expect(vm.$el.classList.contains('s40')).toBeTruthy(); expect(vm.$el.getAttribute('style').indexOf('background-color') > -1).toBeTruthy(); + vm.$destroy(); + }); + + it('should render identicon with provided sizing class', () => { + const vm = createComponent('s32'); + + expect(vm.$el.classList.contains('s32')).toBeTruthy(); + vm.$destroy(); }); }); }); diff --git a/spec/lib/gitlab/gpg/commit_spec.rb b/spec/lib/gitlab/gpg/commit_spec.rb index e521fcc6dc1..b07462e4978 100644 --- a/spec/lib/gitlab/gpg/commit_spec.rb +++ b/spec/lib/gitlab/gpg/commit_spec.rb @@ -2,45 +2,9 @@ require 'rails_helper' describe Gitlab::Gpg::Commit do describe '#signature' do - let!(:project) { create :project, :repository, path: 'sample-project' } - let!(:commit_sha) { '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' } - - context 'unsigned commit' do - it 'returns nil' do - expect(described_class.new(project, commit_sha).signature).to be_nil - end - end - - context 'known and verified public key' do - let!(:gpg_key) do - create :gpg_key, key: GpgHelpers::User1.public_key, user: create(:user, email: GpgHelpers::User1.emails.first) - end - - before do - allow(Rugged::Commit).to receive(:extract_signature) - .with(Rugged::Repository, commit_sha) - .and_return( - [ - GpgHelpers::User1.signed_commit_signature, - GpgHelpers::User1.signed_commit_base_data - ] - ) - end - - it 'returns a valid signature' do - expect(described_class.new(project, commit_sha).signature).to have_attributes( - commit_sha: commit_sha, - project: project, - gpg_key: gpg_key, - gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, - gpg_key_user_name: GpgHelpers::User1.names.first, - gpg_key_user_email: GpgHelpers::User1.emails.first, - valid_signature: true - ) - end - + shared_examples 'returns the cached signature on second call' do it 'returns the cached signature on second call' do - gpg_commit = described_class.new(project, commit_sha) + gpg_commit = described_class.new(commit) expect(gpg_commit).to receive(:using_keychain).and_call_original gpg_commit.signature @@ -51,11 +15,140 @@ describe Gitlab::Gpg::Commit do end end - context 'known but unverified public key' do - let!(:gpg_key) { create :gpg_key, key: GpgHelpers::User1.public_key } + let!(:project) { create :project, :repository, path: 'sample-project' } + let!(:commit_sha) { '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' } - before do - allow(Rugged::Commit).to receive(:extract_signature) + context 'unsigned commit' do + let!(:commit) { create :commit, project: project, sha: commit_sha } + + it 'returns nil' do + expect(described_class.new(commit).signature).to be_nil + end + end + + context 'known key' do + context 'user matches the key uid' do + context 'user email matches the email committer' do + let!(:commit) { create :commit, project: project, sha: commit_sha, committer_email: GpgHelpers::User1.emails.first } + + let!(:user) { create(:user, email: GpgHelpers::User1.emails.first) } + + let!(:gpg_key) do + create :gpg_key, key: GpgHelpers::User1.public_key, user: user + end + + before do + allow(Rugged::Commit).to receive(:extract_signature) + .with(Rugged::Repository, commit_sha) + .and_return( + [ + GpgHelpers::User1.signed_commit_signature, + GpgHelpers::User1.signed_commit_base_data + ] + ) + end + + it 'returns a valid signature' do + expect(described_class.new(commit).signature).to have_attributes( + commit_sha: commit_sha, + project: project, + gpg_key: gpg_key, + gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, + gpg_key_user_name: GpgHelpers::User1.names.first, + gpg_key_user_email: GpgHelpers::User1.emails.first, + verification_status: 'verified' + ) + end + + it_behaves_like 'returns the cached signature on second call' + end + + context 'user email does not match the committer email, but is the same user' do + let!(:commit) { create :commit, project: project, sha: commit_sha, committer_email: GpgHelpers::User2.emails.first } + + let(:user) do + create(:user, email: GpgHelpers::User1.emails.first).tap do |user| + create :email, user: user, email: GpgHelpers::User2.emails.first + end + end + + let!(:gpg_key) do + create :gpg_key, key: GpgHelpers::User1.public_key, user: user + end + + before do + allow(Rugged::Commit).to receive(:extract_signature) + .with(Rugged::Repository, commit_sha) + .and_return( + [ + GpgHelpers::User1.signed_commit_signature, + GpgHelpers::User1.signed_commit_base_data + ] + ) + end + + it 'returns an invalid signature' do + expect(described_class.new(commit).signature).to have_attributes( + commit_sha: commit_sha, + project: project, + gpg_key: gpg_key, + gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, + gpg_key_user_name: GpgHelpers::User1.names.first, + gpg_key_user_email: GpgHelpers::User1.emails.first, + verification_status: 'same_user_different_email' + ) + end + + it_behaves_like 'returns the cached signature on second call' + end + + context 'user email does not match the committer email' do + let!(:commit) { create :commit, project: project, sha: commit_sha, committer_email: GpgHelpers::User2.emails.first } + + let(:user) { create(:user, email: GpgHelpers::User1.emails.first) } + + let!(:gpg_key) do + create :gpg_key, key: GpgHelpers::User1.public_key, user: user + end + + before do + allow(Rugged::Commit).to receive(:extract_signature) + .with(Rugged::Repository, commit_sha) + .and_return( + [ + GpgHelpers::User1.signed_commit_signature, + GpgHelpers::User1.signed_commit_base_data + ] + ) + end + + it 'returns an invalid signature' do + expect(described_class.new(commit).signature).to have_attributes( + commit_sha: commit_sha, + project: project, + gpg_key: gpg_key, + gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, + gpg_key_user_name: GpgHelpers::User1.names.first, + gpg_key_user_email: GpgHelpers::User1.emails.first, + verification_status: 'other_user' + ) + end + + it_behaves_like 'returns the cached signature on second call' + end + end + + context 'user does not match the key uid' do + let!(:commit) { create :commit, project: project, sha: commit_sha } + + let(:user) { create(:user, email: GpgHelpers::User2.emails.first) } + + let!(:gpg_key) do + create :gpg_key, key: GpgHelpers::User1.public_key, user: user + end + + before do + allow(Rugged::Commit).to receive(:extract_signature) .with(Rugged::Repository, commit_sha) .and_return( [ @@ -63,33 +156,27 @@ describe Gitlab::Gpg::Commit do GpgHelpers::User1.signed_commit_base_data ] ) - end - - it 'returns an invalid signature' do - expect(described_class.new(project, commit_sha).signature).to have_attributes( - commit_sha: commit_sha, - project: project, - gpg_key: gpg_key, - gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, - gpg_key_user_name: GpgHelpers::User1.names.first, - gpg_key_user_email: GpgHelpers::User1.emails.first, - valid_signature: false - ) - end - - it 'returns the cached signature on second call' do - gpg_commit = described_class.new(project, commit_sha) - - expect(gpg_commit).to receive(:using_keychain).and_call_original - gpg_commit.signature + end + + it 'returns an invalid signature' do + expect(described_class.new(commit).signature).to have_attributes( + commit_sha: commit_sha, + project: project, + gpg_key: gpg_key, + gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, + gpg_key_user_name: GpgHelpers::User1.names.first, + gpg_key_user_email: GpgHelpers::User1.emails.first, + verification_status: 'unverified_key' + ) + end - # consecutive call - expect(gpg_commit).not_to receive(:using_keychain).and_call_original - gpg_commit.signature + it_behaves_like 'returns the cached signature on second call' end end - context 'unknown public key' do + context 'unknown key' do + let!(:commit) { create :commit, project: project, sha: commit_sha } + before do allow(Rugged::Commit).to receive(:extract_signature) .with(Rugged::Repository, commit_sha) @@ -102,27 +189,18 @@ describe Gitlab::Gpg::Commit do end it 'returns an invalid signature' do - expect(described_class.new(project, commit_sha).signature).to have_attributes( + expect(described_class.new(commit).signature).to have_attributes( commit_sha: commit_sha, project: project, gpg_key: nil, gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, gpg_key_user_name: nil, gpg_key_user_email: nil, - valid_signature: false + verification_status: 'unknown_key' ) end - it 'returns the cached signature on second call' do - gpg_commit = described_class.new(project, commit_sha) - - expect(gpg_commit).to receive(:using_keychain).and_call_original - gpg_commit.signature - - # consecutive call - expect(gpg_commit).not_to receive(:using_keychain).and_call_original - gpg_commit.signature - end + it_behaves_like 'returns the cached signature on second call' end end end diff --git a/spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb b/spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb index 4de4419de27..b9fd4d02156 100644 --- a/spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb +++ b/spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb @@ -4,8 +4,29 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do describe '#run' do let!(:commit_sha) { '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' } let!(:project) { create :project, :repository, path: 'sample-project' } + let!(:raw_commit) do + raw_commit = double( + :raw_commit, + signature: [ + GpgHelpers::User1.signed_commit_signature, + GpgHelpers::User1.signed_commit_base_data + ], + sha: commit_sha, + committer_email: GpgHelpers::User1.emails.first + ) + + allow(raw_commit).to receive :save! + + raw_commit + end + + let!(:commit) do + create :commit, git_commit: raw_commit, project: project + end before do + allow_any_instance_of(Project).to receive(:commit).and_return(commit) + allow(Rugged::Commit).to receive(:extract_signature) .with(Rugged::Repository, commit_sha) .and_return( @@ -25,7 +46,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do commit_sha: commit_sha, gpg_key: nil, gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, - valid_signature: true + verification_status: 'verified' end it 'assigns the gpg key to the signature when the missing gpg key is added' do @@ -39,7 +60,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do commit_sha: commit_sha, gpg_key: gpg_key, gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, - valid_signature: true + verification_status: 'verified' ) end @@ -54,7 +75,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do commit_sha: commit_sha, gpg_key: nil, gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, - valid_signature: true + verification_status: 'verified' ) end end @@ -68,7 +89,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do commit_sha: commit_sha, gpg_key: nil, gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, - valid_signature: false + verification_status: 'unknown_key' end it 'updates the signature to being valid when the missing gpg key is added' do @@ -82,7 +103,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do commit_sha: commit_sha, gpg_key: gpg_key, gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, - valid_signature: true + verification_status: 'verified' ) end @@ -97,7 +118,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do commit_sha: commit_sha, gpg_key: nil, gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, - valid_signature: false + verification_status: 'unknown_key' ) end end @@ -115,7 +136,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do commit_sha: commit_sha, gpg_key: nil, gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, - valid_signature: false + verification_status: 'unknown_key' end it 'updates the signature to being valid when the user updates the email address' do @@ -123,7 +144,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do key: GpgHelpers::User1.public_key, user: user - expect(invalid_gpg_signature.reload.valid_signature).to be_falsey + expect(invalid_gpg_signature.reload.verification_status).to eq 'unverified_key' # InvalidGpgSignatureUpdater is called by the after_update hook user.update_attributes!(email: GpgHelpers::User1.emails.first) @@ -133,7 +154,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do commit_sha: commit_sha, gpg_key: gpg_key, gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, - valid_signature: true + verification_status: 'verified' ) end @@ -147,7 +168,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do commit_sha: commit_sha, gpg_key: gpg_key, gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, - valid_signature: false + verification_status: 'unverified_key' ) # InvalidGpgSignatureUpdater is called by the after_update hook @@ -158,7 +179,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do commit_sha: commit_sha, gpg_key: gpg_key, gpg_key_primary_keyid: GpgHelpers::User1.primary_keyid, - valid_signature: false + verification_status: 'unverified_key' ) end end diff --git a/spec/lib/gitlab/gpg_spec.rb b/spec/lib/gitlab/gpg_spec.rb index 30ad033b204..11a2aea1915 100644 --- a/spec/lib/gitlab/gpg_spec.rb +++ b/spec/lib/gitlab/gpg_spec.rb @@ -42,6 +42,21 @@ describe Gitlab::Gpg do described_class.user_infos_from_key('bogus') ).to eq [] end + + it 'downcases the email' do + public_key = double(:key) + fingerprints = double(:fingerprints) + uid = double(:uid, name: 'Nannie Bernhard', email: 'NANNIE.BERNHARD@EXAMPLE.COM') + raw_key = double(:raw_key, uids: [uid]) + allow(Gitlab::Gpg::CurrentKeyChain).to receive(:fingerprints_from_key).with(public_key).and_return(fingerprints) + allow(GPGME::Key).to receive(:find).with(:public, anything).and_return([raw_key]) + + user_infos = described_class.user_infos_from_key(public_key) + expect(user_infos).to eq([{ + name: 'Nannie Bernhard', + email: 'nannie.bernhard@example.com' + }]) + end end describe '.current_home_dir' do diff --git a/spec/lib/gitlab/import_export/safe_model_attributes.yml b/spec/lib/gitlab/import_export/safe_model_attributes.yml index 27f2ce60084..b852ac570a3 100644 --- a/spec/lib/gitlab/import_export/safe_model_attributes.yml +++ b/spec/lib/gitlab/import_export/safe_model_attributes.yml @@ -278,6 +278,7 @@ CommitStatus: - auto_canceled_by_id - retried - protected +- failure_reason Ci::Variable: - id - project_id diff --git a/spec/lib/gitlab/issuables_count_for_state_spec.rb b/spec/lib/gitlab/issuables_count_for_state_spec.rb new file mode 100644 index 00000000000..c262fdfcb61 --- /dev/null +++ b/spec/lib/gitlab/issuables_count_for_state_spec.rb @@ -0,0 +1,37 @@ +require 'spec_helper' + +describe Gitlab::IssuablesCountForState do + let(:finder) do + double(:finder, count_by_state: { opened: 2, closed: 1 }) + end + + let(:counter) { described_class.new(finder) } + + describe '#for_state_or_opened' do + it 'returns the number of issuables for the given state' do + expect(counter.for_state_or_opened(:closed)).to eq(1) + end + + it 'returns the number of open issuables when no state is given' do + expect(counter.for_state_or_opened).to eq(2) + end + + it 'returns the number of open issuables when a nil value is given' do + expect(counter.for_state_or_opened(nil)).to eq(2) + end + end + + describe '#[]' do + it 'returns the number of issuables for the given state' do + expect(counter[:closed]).to eq(1) + end + + it 'casts valid states from Strings to Symbols' do + expect(counter['closed']).to eq(1) + end + + it 'returns 0 when using an invalid state name as a String' do + expect(counter['kittens']).to be_zero + end + end +end diff --git a/spec/lib/gitlab/sql/pattern_spec.rb b/spec/lib/gitlab/sql/pattern_spec.rb index 9d7b2136dab..48d56628ed5 100644 --- a/spec/lib/gitlab/sql/pattern_spec.rb +++ b/spec/lib/gitlab/sql/pattern_spec.rb @@ -52,4 +52,124 @@ describe Gitlab::SQL::Pattern do end end end + + describe '.select_fuzzy_words' do + subject(:select_fuzzy_words) { Issue.select_fuzzy_words(query) } + + context 'with a word equal to 3 chars' do + let(:query) { 'foo' } + + it 'returns array cotaining a word' do + expect(select_fuzzy_words).to match_array(['foo']) + end + end + + context 'with a word shorter than 3 chars' do + let(:query) { 'fo' } + + it 'returns empty array' do + expect(select_fuzzy_words).to match_array([]) + end + end + + context 'with two words both equal to 3 chars' do + let(:query) { 'foo baz' } + + it 'returns array containing two words' do + expect(select_fuzzy_words).to match_array(%w[foo baz]) + end + end + + context 'with two words divided by two spaces both equal to 3 chars' do + let(:query) { 'foo baz' } + + it 'returns array containing two words' do + expect(select_fuzzy_words).to match_array(%w[foo baz]) + end + end + + context 'with two words equal to 3 chars and shorter than 3 chars' do + let(:query) { 'foo ba' } + + it 'returns array containing a word' do + expect(select_fuzzy_words).to match_array(['foo']) + end + end + + context 'with a multi-word surrounded by double quote' do + let(:query) { '"really bar"' } + + it 'returns array containing a multi-word' do + expect(select_fuzzy_words).to match_array(['really bar']) + end + end + + context 'with a multi-word surrounded by double quote and two words' do + let(:query) { 'foo "really bar" baz' } + + it 'returns array containing a multi-word and tow words' do + expect(select_fuzzy_words).to match_array(['foo', 'really bar', 'baz']) + end + end + + context 'with a multi-word surrounded by double quote missing a spece before the first double quote' do + let(:query) { 'foo"really bar"' } + + it 'returns array containing two words with double quote' do + expect(select_fuzzy_words).to match_array(['foo"really', 'bar"']) + end + end + + context 'with a multi-word surrounded by double quote missing a spece after the second double quote' do + let(:query) { '"really bar"baz' } + + it 'returns array containing two words with double quote' do + expect(select_fuzzy_words).to match_array(['"really', 'bar"baz']) + end + end + + context 'with two multi-word surrounded by double quote and two words' do + let(:query) { 'foo "really bar" baz "awesome feature"' } + + it 'returns array containing two multi-words and tow words' do + expect(select_fuzzy_words).to match_array(['foo', 'really bar', 'baz', 'awesome feature']) + end + end + end + + describe '.to_fuzzy_arel' do + subject(:to_fuzzy_arel) { Issue.to_fuzzy_arel(:title, query) } + + context 'with a word equal to 3 chars' do + let(:query) { 'foo' } + + it 'returns a single ILIKE condition' do + expect(to_fuzzy_arel.to_sql).to match(/title.*I?LIKE '\%foo\%'/) + end + end + + context 'with a word shorter than 3 chars' do + let(:query) { 'fo' } + + it 'returns nil' do + expect(to_fuzzy_arel).to be_nil + end + end + + context 'with two words both equal to 3 chars' do + let(:query) { 'foo baz' } + + it 'returns a joining LIKE condition using a AND' do + expect(to_fuzzy_arel.to_sql).to match(/title.+I?LIKE '\%foo\%' AND .*title.*I?LIKE '\%baz\%'/) + end + end + + context 'with a multi-word surrounded by double quote and two words' do + let(:query) { 'foo "really bar" baz' } + + it 'returns a joining LIKE condition using a AND' do + expect(to_fuzzy_arel.to_sql).to match(/title.+I?LIKE '\%foo\%' AND .*title.*I?LIKE '\%baz\%' AND .*title.*I?LIKE '\%really bar\%'/) + end + end + end end diff --git a/spec/lib/system_check/app/git_user_default_ssh_config_check_spec.rb b/spec/lib/system_check/app/git_user_default_ssh_config_check_spec.rb new file mode 100644 index 00000000000..7125bfcab59 --- /dev/null +++ b/spec/lib/system_check/app/git_user_default_ssh_config_check_spec.rb @@ -0,0 +1,79 @@ +require 'spec_helper' + +describe SystemCheck::App::GitUserDefaultSSHConfigCheck do + let(:username) { '_this_user_will_not_exist_unless_it_is_stubbed' } + let(:base_dir) { Dir.mktmpdir } + let(:home_dir) { File.join(base_dir, "/var/lib/#{username}") } + let(:ssh_dir) { File.join(home_dir, '.ssh') } + let(:forbidden_file) { 'id_rsa' } + + before do + allow(Gitlab.config.gitlab).to receive(:user).and_return(username) + end + + after do + FileUtils.rm_rf(base_dir) + end + + it 'only whitelists safe files' do + expect(described_class::WHITELIST).to contain_exactly('authorized_keys', 'authorized_keys2', 'known_hosts') + end + + describe '#skip?' do + subject { described_class.new.skip? } + + where(user_exists: [true, false], home_dir_exists: [true, false]) + + with_them do + let(:expected_result) { !user_exists || !home_dir_exists } + + before do + stub_user if user_exists + stub_home_dir if home_dir_exists + end + + it { is_expected.to eq(expected_result) } + end + end + + describe '#check?' do + subject { described_class.new.check? } + + before do + stub_user + end + + it 'fails if a forbidden file exists' do + stub_ssh_file(forbidden_file) + + is_expected.to be_falsy + end + + it "succeeds if the SSH directory doesn't exist" do + FileUtils.rm_rf(ssh_dir) + + is_expected.to be_truthy + end + + it 'succeeds if all the whitelisted files exist' do + described_class::WHITELIST.each do |filename| + stub_ssh_file(filename) + end + + is_expected.to be_truthy + end + end + + def stub_user + allow(File).to receive(:expand_path).with("~#{username}").and_return(home_dir) + end + + def stub_home_dir + FileUtils.mkdir_p(home_dir) + end + + def stub_ssh_file(filename) + FileUtils.mkdir_p(ssh_dir) + FileUtils.touch(File.join(ssh_dir, filename)) + end +end diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 3fe3ec17d36..08d22f166e4 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1492,10 +1492,12 @@ describe Ci::Build do context 'when build is for triggers' do let(:trigger) { create(:ci_trigger, project: project) } - let(:trigger_request) { create(:ci_trigger_request_with_variables, pipeline: pipeline, trigger: trigger) } + let(:trigger_request) { create(:ci_trigger_request, pipeline: pipeline, trigger: trigger) } + let(:user_trigger_variable) do - { key: :TRIGGER_KEY_1, value: 'TRIGGER_VALUE_1', public: false } + { key: 'TRIGGER_KEY_1', value: 'TRIGGER_VALUE_1', public: false } end + let(:predefined_trigger_variable) do { key: 'CI_PIPELINE_TRIGGERED', value: 'true', public: true } end @@ -1504,8 +1506,26 @@ describe Ci::Build do build.trigger_request = trigger_request end - it { is_expected.to include(user_trigger_variable) } - it { is_expected.to include(predefined_trigger_variable) } + shared_examples 'returns variables for triggers' do + it { is_expected.to include(user_trigger_variable) } + it { is_expected.to include(predefined_trigger_variable) } + end + + context 'when variables are stored in trigger_request' do + before do + trigger_request.update_attribute(:variables, { 'TRIGGER_KEY_1' => 'TRIGGER_VALUE_1' } ) + end + + it_behaves_like 'returns variables for triggers' + end + + context 'when variables are stored in pipeline_variables' do + before do + create(:ci_pipeline_variable, pipeline: pipeline, key: 'TRIGGER_KEY_1', value: 'TRIGGER_VALUE_1') + end + + it_behaves_like 'returns variables for triggers' + end end context 'when pipeline has a variable' do diff --git a/spec/models/ci/trigger_request_spec.rb b/spec/models/ci/trigger_request_spec.rb new file mode 100644 index 00000000000..7dcf3528f73 --- /dev/null +++ b/spec/models/ci/trigger_request_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe Ci::TriggerRequest do + describe 'validation' do + it 'be invalid if saving a variable' do + trigger = build(:ci_trigger_request, variables: { TRIGGER_KEY_1: 'TRIGGER_VALUE_1' } ) + + expect(trigger).not_to be_valid + end + + it 'be valid if not saving a variable' do + trigger = build(:ci_trigger_request) + + expect(trigger).to be_valid + end + end +end diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb index f7583645e69..858ec831200 100644 --- a/spec/models/commit_status_spec.rb +++ b/spec/models/commit_status_spec.rb @@ -443,4 +443,25 @@ describe CommitStatus do end end end + + describe 'set failure_reason when drop' do + let(:commit_status) { create(:commit_status, :created) } + + subject do + commit_status.drop!(reason) + commit_status + end + + context 'when failure_reason is nil' do + let(:reason) { } + + it { is_expected.to be_unknown_failure } + end + + context 'when failure_reason is script_failure' do + let(:reason) { :script_failure } + + it { is_expected.to be_script_failure } + end + end end diff --git a/spec/models/concerns/issuable_spec.rb b/spec/models/concerns/issuable_spec.rb index dfbe1a7c192..37f6fd3a25b 100644 --- a/spec/models/concerns/issuable_spec.rb +++ b/spec/models/concerns/issuable_spec.rb @@ -66,56 +66,76 @@ describe Issuable do end describe ".search" do - let!(:searchable_issue) { create(:issue, title: "Searchable issue") } + let!(:searchable_issue) { create(:issue, title: "Searchable awesome issue") } - it 'returns notes with a matching title' do + it 'returns issues with a matching title' do expect(issuable_class.search(searchable_issue.title)) .to eq([searchable_issue]) end - it 'returns notes with a partially matching title' do + it 'returns issues with a partially matching title' do expect(issuable_class.search('able')).to eq([searchable_issue]) end - it 'returns notes with a matching title regardless of the casing' do + it 'returns issues with a matching title regardless of the casing' do expect(issuable_class.search(searchable_issue.title.upcase)) .to eq([searchable_issue]) end + + it 'returns issues with a fuzzy matching title' do + expect(issuable_class.search('searchable issue')).to eq([searchable_issue]) + end + + it 'returns all issues with a query shorter than 3 chars' do + expect(issuable_class.search('zz')).to eq(issuable_class.all) + end end describe ".full_search" do let!(:searchable_issue) do - create(:issue, title: "Searchable issue", description: 'kittens') + create(:issue, title: "Searchable awesome issue", description: 'Many cute kittens') end - it 'returns notes with a matching title' do + it 'returns issues with a matching title' do expect(issuable_class.full_search(searchable_issue.title)) .to eq([searchable_issue]) end - it 'returns notes with a partially matching title' do + it 'returns issues with a partially matching title' do expect(issuable_class.full_search('able')).to eq([searchable_issue]) end - it 'returns notes with a matching title regardless of the casing' do + it 'returns issues with a matching title regardless of the casing' do expect(issuable_class.full_search(searchable_issue.title.upcase)) .to eq([searchable_issue]) end - it 'returns notes with a matching description' do + it 'returns issues with a fuzzy matching title' do + expect(issuable_class.full_search('searchable issue')).to eq([searchable_issue]) + end + + it 'returns issues with a matching description' do expect(issuable_class.full_search(searchable_issue.description)) .to eq([searchable_issue]) end - it 'returns notes with a partially matching description' do + it 'returns issues with a partially matching description' do expect(issuable_class.full_search(searchable_issue.description)) .to eq([searchable_issue]) end - it 'returns notes with a matching description regardless of the casing' do + it 'returns issues with a matching description regardless of the casing' do expect(issuable_class.full_search(searchable_issue.description.upcase)) .to eq([searchable_issue]) end + + it 'returns issues with a fuzzy matching description' do + expect(issuable_class.full_search('many kittens')).to eq([searchable_issue]) + end + + it 'returns all issues with a query shorter than 3 chars' do + expect(issuable_class.search('zz')).to eq(issuable_class.all) + end end describe '.to_ability_name' do diff --git a/spec/models/gpg_key_spec.rb b/spec/models/gpg_key_spec.rb index e48f20bf53b..9c99c3e5c08 100644 --- a/spec/models/gpg_key_spec.rb +++ b/spec/models/gpg_key_spec.rb @@ -99,14 +99,14 @@ describe GpgKey do end describe '#verified?' do - it 'returns true one of the email addresses in the key belongs to the user' do + it 'returns true if one of the email addresses in the key belongs to the user' do user = create :user, email: 'bette.cartwright@example.com' gpg_key = create :gpg_key, key: GpgHelpers::User2.public_key, user: user expect(gpg_key.verified?).to be_truthy end - it 'returns false if one of the email addresses in the key does not belong to the user' do + it 'returns false if none of the email addresses in the key does not belong to the user' do user = create :user, email: 'someone.else@example.com' gpg_key = create :gpg_key, key: GpgHelpers::User2.public_key, user: user @@ -114,6 +114,32 @@ describe GpgKey do end end + describe 'verified_and_belongs_to_email?' do + it 'returns false if none of the email addresses in the key does not belong to the user' do + user = create :user, email: 'someone.else@example.com' + gpg_key = create :gpg_key, key: GpgHelpers::User2.public_key, user: user + + expect(gpg_key.verified?).to be_falsey + expect(gpg_key.verified_and_belongs_to_email?('someone.else@example.com')).to be_falsey + end + + it 'returns false if one of the email addresses in the key belongs to the user and does not match the provided email' do + user = create :user, email: 'bette.cartwright@example.com' + gpg_key = create :gpg_key, key: GpgHelpers::User2.public_key, user: user + + expect(gpg_key.verified?).to be_truthy + expect(gpg_key.verified_and_belongs_to_email?('bette.cartwright@example.net')).to be_falsey + end + + it 'returns true if one of the email addresses in the key belongs to the user and matches the provided email' do + user = create :user, email: 'bette.cartwright@example.com' + gpg_key = create :gpg_key, key: GpgHelpers::User2.public_key, user: user + + expect(gpg_key.verified?).to be_truthy + expect(gpg_key.verified_and_belongs_to_email?('bette.cartwright@example.com')).to be_truthy + end + end + describe 'notification', :mailer do let(:user) { create(:user) } @@ -129,15 +155,15 @@ describe GpgKey do describe '#revoke' do it 'invalidates all associated gpg signatures and destroys the key' do gpg_key = create :gpg_key - gpg_signature = create :gpg_signature, valid_signature: true, gpg_key: gpg_key + gpg_signature = create :gpg_signature, verification_status: :verified, gpg_key: gpg_key unrelated_gpg_key = create :gpg_key, key: GpgHelpers::User2.public_key - unrelated_gpg_signature = create :gpg_signature, valid_signature: true, gpg_key: unrelated_gpg_key + unrelated_gpg_signature = create :gpg_signature, verification_status: :verified, gpg_key: unrelated_gpg_key gpg_key.revoke expect(gpg_signature.reload).to have_attributes( - valid_signature: false, + verification_status: 'unknown_key', gpg_key: nil ) @@ -145,7 +171,7 @@ describe GpgKey do # unrelated signature is left untouched expect(unrelated_gpg_signature.reload).to have_attributes( - valid_signature: true, + verification_status: 'verified', gpg_key: unrelated_gpg_key ) diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index b70ab5581ac..fd83a58ed9f 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -2102,4 +2102,18 @@ describe User do end end end + + describe '#verified_email?' do + it 'returns true when the email is the primary email' do + user = build :user, email: 'email@example.com' + + expect(user.verified_email?('email@example.com')).to be true + end + + it 'returns false when the email is not the primary email' do + user = build :user, email: 'email@example.com' + + expect(user.verified_email?('other_email@example.com')).to be false + end + end end diff --git a/spec/presenters/ci/build_presenter_spec.rb b/spec/presenters/ci/build_presenter_spec.rb index a7a34ecac72..1a8001be6ab 100644 --- a/spec/presenters/ci/build_presenter_spec.rb +++ b/spec/presenters/ci/build_presenter_spec.rb @@ -100,4 +100,38 @@ describe Ci::BuildPresenter do end end end + + describe '#trigger_variables' do + let(:build) { create(:ci_build, pipeline: pipeline, trigger_request: trigger_request) } + let(:trigger) { create(:ci_trigger, project: project) } + let(:trigger_request) { create(:ci_trigger_request, pipeline: pipeline, trigger: trigger) } + + context 'when variable is stored in ci_pipeline_variables' do + let!(:pipeline_variable) { create(:ci_pipeline_variable, pipeline: pipeline) } + + context 'when pipeline is triggered by trigger API' do + it 'returns variables' do + expect(presenter.trigger_variables).to eq([pipeline_variable.to_runner_variable]) + end + end + + context 'when pipeline is not triggered by trigger API' do + let(:build) { create(:ci_build, pipeline: pipeline) } + + it 'does not return variables' do + expect(presenter.trigger_variables).to eq([]) + end + end + end + + context 'when variable is stored in ci_trigger_requests.variables' do + before do + trigger_request.update_attribute(:variables, { 'TRIGGER_KEY_1' => 'TRIGGER_VALUE_1' } ) + end + + it 'returns variables' do + expect(presenter.trigger_variables).to eq(trigger_request.user_variables) + end + end + end end diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb index b1e011de604..cc794fad3a7 100644 --- a/spec/requests/api/branches_spec.rb +++ b/spec/requests/api/branches_spec.rb @@ -75,6 +75,22 @@ describe API::Branches do let(:route) { "/projects/#{project_id}/repository/branches/#{branch_name}" } shared_examples_for 'repository branch' do + context 'HEAD request' do + it 'returns 204 No Content' do + head api(route, user) + + expect(response).to have_gitlab_http_status(204) + expect(response.body).to be_empty + end + + it 'returns 404 Not Found' do + head api("/projects/#{project_id}/repository/branches/unknown", user) + + expect(response).to have_gitlab_http_status(404) + expect(response.body).to be_empty + end + end + it 'returns the repository branch' do get api(route, current_user) diff --git a/spec/requests/api/commit_statuses_spec.rb b/spec/requests/api/commit_statuses_spec.rb index cc71865e1f3..e4c73583545 100644 --- a/spec/requests/api/commit_statuses_spec.rb +++ b/spec/requests/api/commit_statuses_spec.rb @@ -142,6 +142,9 @@ describe API::CommitStatuses do expect(json_response['ref']).not_to be_empty expect(json_response['target_url']).to be_nil expect(json_response['description']).to be_nil + if status == 'failed' + expect(CommitStatus.find(json_response['id'])).to be_api_failure + end end end end diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb index dee75c96b86..1583d1c2435 100644 --- a/spec/requests/api/issues_spec.rb +++ b/spec/requests/api/issues_spec.rb @@ -138,6 +138,16 @@ describe API::Issues, :mailer do expect(first_issue['id']).to eq(issue2.id) end + it 'returns issues reacted by the authenticated user by the given emoji' do + issue2 = create(:issue, project: project, author: user, assignees: [user]) + award_emoji = create(:award_emoji, awardable: issue2, user: user2, name: 'star') + + get api('/issues', user2), my_reaction_emoji: award_emoji.name, scope: 'all' + + expect_paginated_array_response(size: 1) + expect(first_issue['id']).to eq(issue2.id) + end + it 'returns issues matching given search string for title' do get api("/issues", user), search: issue.title diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 9027090aabd..21d2c9644fb 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -117,6 +117,18 @@ describe API::MergeRequests do expect(json_response.length).to eq(1) expect(json_response.first['id']).to eq(merge_request3.id) end + + it 'returns merge requests reacted by the authenticated user by the given emoji' do + merge_request3 = create(:merge_request, :simple, author: user, assignee: user, source_project: project2, target_project: project2, source_branch: 'other-branch') + award_emoji = create(:award_emoji, awardable: merge_request3, user: user2, name: 'star') + + get api('/merge_requests', user2), my_reaction_emoji: award_emoji.name, scope: 'all' + + expect(response).to have_gitlab_http_status(200) + expect(json_response).to be_an Array + expect(json_response.length).to eq(1) + expect(json_response.first['id']).to eq(merge_request3.id) + end end end diff --git a/spec/requests/api/pipeline_schedules_spec.rb b/spec/requests/api/pipeline_schedules_spec.rb index b6a5a7ffbb5..f650df57383 100644 --- a/spec/requests/api/pipeline_schedules_spec.rb +++ b/spec/requests/api/pipeline_schedules_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe API::PipelineSchedules do set(:developer) { create(:user) } set(:user) { create(:user) } - set(:project) { create(:project, :repository) } + set(:project) { create(:project, :repository, public_builds: false) } before do project.add_developer(developer) @@ -110,6 +110,18 @@ describe API::PipelineSchedules do end end + context 'authenticated user with insufficient permissions' do + before do + project.add_guest(user) + end + + it 'does not return pipeline_schedules list' do + get api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}", user) + + expect(response).to have_http_status(:not_found) + end + end + context 'unauthenticated user' do it 'does not return pipeline_schedules list' do get api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}") @@ -299,4 +311,150 @@ describe API::PipelineSchedules do end end end + + describe 'POST /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables' do + let(:params) { attributes_for(:ci_pipeline_schedule_variable) } + + set(:pipeline_schedule) do + create(:ci_pipeline_schedule, project: project, owner: developer) + end + + context 'authenticated user with valid permissions' do + context 'with required parameters' do + it 'creates pipeline_schedule_variable' do + expect do + post api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables", developer), + params + end.to change { pipeline_schedule.variables.count }.by(1) + + expect(response).to have_http_status(:created) + expect(response).to match_response_schema('pipeline_schedule_variable') + expect(json_response['key']).to eq(params[:key]) + expect(json_response['value']).to eq(params[:value]) + end + end + + context 'without required parameters' do + it 'does not create pipeline_schedule_variable' do + post api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables", developer) + + expect(response).to have_http_status(:bad_request) + end + end + + context 'when key has validation error' do + it 'does not create pipeline_schedule_variable' do + post api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables", developer), + params.merge('key' => '!?!?') + + expect(response).to have_http_status(:bad_request) + expect(json_response['message']).to have_key('key') + end + end + end + + context 'authenticated user with invalid permissions' do + it 'does not create pipeline_schedule_variable' do + post api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables", user), params + + expect(response).to have_http_status(:not_found) + end + end + + context 'unauthenticated user' do + it 'does not create pipeline_schedule_variable' do + post api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables"), params + + expect(response).to have_http_status(:unauthorized) + end + end + end + + describe 'PUT /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables/:key' do + set(:pipeline_schedule) do + create(:ci_pipeline_schedule, project: project, owner: developer) + end + + let(:pipeline_schedule_variable) do + create(:ci_pipeline_schedule_variable, pipeline_schedule: pipeline_schedule) + end + + context 'authenticated user with valid permissions' do + it 'updates pipeline_schedule_variable' do + put api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}", developer), + value: 'updated_value' + + expect(response).to have_http_status(:ok) + expect(response).to match_response_schema('pipeline_schedule_variable') + expect(json_response['value']).to eq('updated_value') + end + end + + context 'authenticated user with invalid permissions' do + it 'does not update pipeline_schedule_variable' do + put api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}", user) + + expect(response).to have_http_status(:not_found) + end + end + + context 'unauthenticated user' do + it 'does not update pipeline_schedule_variable' do + put api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}") + + expect(response).to have_http_status(:unauthorized) + end + end + end + + describe 'DELETE /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables/:key' do + let(:master) { create(:user) } + + set(:pipeline_schedule) do + create(:ci_pipeline_schedule, project: project, owner: developer) + end + + let!(:pipeline_schedule_variable) do + create(:ci_pipeline_schedule_variable, pipeline_schedule: pipeline_schedule) + end + + before do + project.add_master(master) + end + + context 'authenticated user with valid permissions' do + it 'deletes pipeline_schedule_variable' do + expect do + delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}", master) + end.to change { Ci::PipelineScheduleVariable.count }.by(-1) + + expect(response).to have_http_status(:accepted) + expect(response).to match_response_schema('pipeline_schedule_variable') + end + + it 'responds with 404 Not Found if requesting non-existing pipeline_schedule_variable' do + delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/____", master) + + expect(response).to have_http_status(:not_found) + end + end + + context 'authenticated user with invalid permissions' do + let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: master) } + + it 'does not delete pipeline_schedule_variable' do + delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}", developer) + + expect(response).to have_http_status(:forbidden) + end + end + + context 'unauthenticated user' do + it 'does not delete pipeline_schedule_variable' do + delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}") + + expect(response).to have_http_status(:unauthorized) + end + end + end end diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb index 993164aa8fe..12720355a6d 100644 --- a/spec/requests/api/runner_spec.rb +++ b/spec/requests/api/runner_spec.rb @@ -557,17 +557,36 @@ describe API::Runner do { 'key' => 'TRIGGER_KEY_1', 'value' => 'TRIGGER_VALUE_1', 'public' => false }] end + let(:trigger) { create(:ci_trigger, project: project) } + let!(:trigger_request) { create(:ci_trigger_request, pipeline: pipeline, builds: [job], trigger: trigger) } + before do - trigger = create(:ci_trigger, project: project) - create(:ci_trigger_request_with_variables, pipeline: pipeline, builds: [job], trigger: trigger) project.variables << Ci::Variable.new(key: 'SECRET_KEY', value: 'secret_value') end - it 'returns variables for triggers' do - request_job + shared_examples 'expected variables behavior' do + it 'returns variables for triggers' do + request_job - expect(response).to have_http_status(201) - expect(json_response['variables']).to include(*expected_variables) + expect(response).to have_http_status(201) + expect(json_response['variables']).to include(*expected_variables) + end + end + + context 'when variables are stored in trigger_request' do + before do + trigger_request.update_attribute(:variables, { TRIGGER_KEY_1: 'TRIGGER_VALUE_1' } ) + end + + it_behaves_like 'expected variables behavior' + end + + context 'when variables are stored in pipeline_variables' do + before do + create(:ci_pipeline_variable, pipeline: pipeline, key: :TRIGGER_KEY_1, value: 'TRIGGER_VALUE_1') + end + + it_behaves_like 'expected variables behavior' end end @@ -626,13 +645,34 @@ describe API::Runner do it 'mark job as succeeded' do update_job(state: 'success') - expect(job.reload.status).to eq 'success' + job.reload + expect(job).to be_success end it 'mark job as failed' do update_job(state: 'failed') - expect(job.reload.status).to eq 'failed' + job.reload + expect(job).to be_failed + expect(job).to be_unknown_failure + end + + context 'when failure_reason is script_failure' do + before do + update_job(state: 'failed', failure_reason: 'script_failure') + job.reload + end + + it { expect(job).to be_script_failure } + end + + context 'when failure_reason is runner_system_failure' do + before do + update_job(state: 'failed', failure_reason: 'runner_system_failure') + job.reload + end + + it { expect(job).to be_runner_system_failure } end end diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 5fef4437997..37cb95a16e3 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -4,6 +4,7 @@ describe API::Users do let(:user) { create(:user) } let(:admin) { create(:admin) } let(:key) { create(:key, user: user) } + let(:gpg_key) { create(:gpg_key, user: user) } let(:email) { create(:email, user: user) } let(:omniauth_user) { create(:omniauth_user) } let(:ldap_user) { create(:omniauth_user, provider: 'ldapmain') } @@ -753,6 +754,164 @@ describe API::Users do end end + describe 'POST /users/:id/keys' do + before do + admin + end + + it 'does not create invalid GPG key' do + post api("/users/#{user.id}/gpg_keys", admin) + + expect(response).to have_http_status(400) + expect(json_response['error']).to eq('key is missing') + end + + it 'creates GPG key' do + key_attrs = attributes_for :gpg_key + expect do + post api("/users/#{user.id}/gpg_keys", admin), key_attrs + + expect(response).to have_http_status(201) + end.to change { user.gpg_keys.count }.by(1) + end + + it 'returns 400 for invalid ID' do + post api('/users/999999/gpg_keys', admin) + + expect(response).to have_http_status(400) + end + end + + describe 'GET /user/:id/gpg_keys' do + before do + admin + end + + context 'when unauthenticated' do + it 'returns authentication error' do + get api("/users/#{user.id}/gpg_keys") + + expect(response).to have_http_status(401) + end + end + + context 'when authenticated' do + it 'returns 404 for non-existing user' do + get api('/users/999999/gpg_keys', admin) + + expect(response).to have_http_status(404) + expect(json_response['message']).to eq('404 User Not Found') + end + + it 'returns 404 error if key not foud' do + delete api("/users/#{user.id}/gpg_keys/42", admin) + + expect(response).to have_http_status(404) + expect(json_response['message']).to eq('404 GPG Key Not Found') + end + + it 'returns array of GPG keys' do + user.gpg_keys << gpg_key + user.save + + get api("/users/#{user.id}/gpg_keys", admin) + + expect(response).to have_http_status(200) + expect(response).to include_pagination_headers + expect(json_response).to be_an Array + expect(json_response.first['key']).to eq(gpg_key.key) + end + end + end + + describe 'DELETE /user/:id/gpg_keys/:key_id' do + before do + admin + end + + context 'when unauthenticated' do + it 'returns authentication error' do + delete api("/users/#{user.id}/keys/42") + + expect(response).to have_http_status(401) + end + end + + context 'when authenticated' do + it 'deletes existing key' do + user.gpg_keys << gpg_key + user.save + + expect do + delete api("/users/#{user.id}/gpg_keys/#{gpg_key.id}", admin) + + expect(response).to have_http_status(204) + end.to change { user.gpg_keys.count }.by(-1) + end + + it 'returns 404 error if user not found' do + user.keys << key + user.save + + delete api("/users/999999/gpg_keys/#{gpg_key.id}", admin) + + expect(response).to have_http_status(404) + expect(json_response['message']).to eq('404 User Not Found') + end + + it 'returns 404 error if key not foud' do + delete api("/users/#{user.id}/gpg_keys/42", admin) + + expect(response).to have_http_status(404) + expect(json_response['message']).to eq('404 GPG Key Not Found') + end + end + end + + describe 'POST /user/:id/gpg_keys/:key_id/revoke' do + before do + admin + end + + context 'when unauthenticated' do + it 'returns authentication error' do + post api("/users/#{user.id}/gpg_keys/42/revoke") + + expect(response).to have_http_status(401) + end + end + + context 'when authenticated' do + it 'revokes existing key' do + user.gpg_keys << gpg_key + user.save + + expect do + post api("/users/#{user.id}/gpg_keys/#{gpg_key.id}/revoke", admin) + + expect(response).to have_http_status(:accepted) + end.to change { user.gpg_keys.count }.by(-1) + end + + it 'returns 404 error if user not found' do + user.gpg_keys << gpg_key + user.save + + post api("/users/999999/gpg_keys/#{gpg_key.id}/revoke", admin) + + expect(response).to have_http_status(404) + expect(json_response['message']).to eq('404 User Not Found') + end + + it 'returns 404 error if key not foud' do + post api("/users/#{user.id}/gpg_keys/42/revoke", admin) + + expect(response).to have_http_status(404) + expect(json_response['message']).to eq('404 GPG Key Not Found') + end + end + end + describe "POST /users/:id/emails" do before do admin @@ -1153,6 +1312,173 @@ describe API::Users do end end + describe 'GET /user/gpg_keys' do + context 'when unauthenticated' do + it 'returns authentication error' do + get api('/user/gpg_keys') + + expect(response).to have_http_status(401) + end + end + + context 'when authenticated' do + it 'returns array of GPG keys' do + user.gpg_keys << gpg_key + user.save + + get api('/user/gpg_keys', user) + + expect(response).to have_http_status(200) + expect(response).to include_pagination_headers + expect(json_response).to be_an Array + expect(json_response.first['key']).to eq(gpg_key.key) + end + + context 'scopes' do + let(:path) { '/user/gpg_keys' } + let(:api_call) { method(:api) } + + include_examples 'allows the "read_user" scope' + end + end + end + + describe 'GET /user/gpg_keys/:key_id' do + it 'returns a single key' do + user.gpg_keys << gpg_key + user.save + + get api("/user/gpg_keys/#{gpg_key.id}", user) + + expect(response).to have_http_status(200) + expect(json_response['key']).to eq(gpg_key.key) + end + + it 'returns 404 Not Found within invalid ID' do + get api('/user/gpg_keys/42', user) + + expect(response).to have_http_status(404) + expect(json_response['message']).to eq('404 GPG Key Not Found') + end + + it "returns 404 error if admin accesses user's GPG key" do + user.gpg_keys << gpg_key + user.save + + get api("/user/gpg_keys/#{gpg_key.id}", admin) + + expect(response).to have_http_status(404) + expect(json_response['message']).to eq('404 GPG Key Not Found') + end + + it 'returns 404 for invalid ID' do + get api('/users/gpg_keys/ASDF', admin) + + expect(response).to have_http_status(404) + end + + context 'scopes' do + let(:path) { "/user/gpg_keys/#{gpg_key.id}" } + let(:api_call) { method(:api) } + + include_examples 'allows the "read_user" scope' + end + end + + describe 'POST /user/gpg_keys' do + it 'creates a GPG key' do + key_attrs = attributes_for :gpg_key + expect do + post api('/user/gpg_keys', user), key_attrs + + expect(response).to have_http_status(201) + end.to change { user.gpg_keys.count }.by(1) + end + + it 'returns a 401 error if unauthorized' do + post api('/user/gpg_keys'), key: 'some key' + + expect(response).to have_http_status(401) + end + + it 'does not create GPG key without key' do + post api('/user/gpg_keys', user) + + expect(response).to have_http_status(400) + expect(json_response['error']).to eq('key is missing') + end + end + + describe 'POST /user/gpg_keys/:key_id/revoke' do + it 'revokes existing GPG key' do + user.gpg_keys << gpg_key + user.save + + expect do + post api("/user/gpg_keys/#{gpg_key.id}/revoke", user) + + expect(response).to have_http_status(:accepted) + end.to change { user.gpg_keys.count}.by(-1) + end + + it 'returns 404 if key ID not found' do + post api('/user/gpg_keys/42/revoke', user) + + expect(response).to have_http_status(404) + expect(json_response['message']).to eq('404 GPG Key Not Found') + end + + it 'returns 401 error if unauthorized' do + user.gpg_keys << gpg_key + user.save + + post api("/user/gpg_keys/#{gpg_key.id}/revoke") + + expect(response).to have_http_status(401) + end + + it 'returns a 404 for invalid ID' do + post api('/users/gpg_keys/ASDF/revoke', admin) + + expect(response).to have_http_status(404) + end + end + + describe 'DELETE /user/gpg_keys/:key_id' do + it 'deletes existing GPG key' do + user.gpg_keys << gpg_key + user.save + + expect do + delete api("/user/gpg_keys/#{gpg_key.id}", user) + + expect(response).to have_http_status(204) + end.to change { user.gpg_keys.count}.by(-1) + end + + it 'returns 404 if key ID not found' do + delete api('/user/gpg_keys/42', user) + + expect(response).to have_http_status(404) + expect(json_response['message']).to eq('404 GPG Key Not Found') + end + + it 'returns 401 error if unauthorized' do + user.gpg_keys << gpg_key + user.save + + delete api("/user/gpg_keys/#{gpg_key.id}") + + expect(response).to have_http_status(401) + end + + it 'returns a 404 for invalid ID' do + delete api('/users/gpg_keys/ASDF', admin) + + expect(response).to have_http_status(404) + end + end + describe "GET /user/emails" do context "when unauthenticated" do it "returns authentication error" do diff --git a/spec/requests/api/v3/triggers_spec.rb b/spec/requests/api/v3/triggers_spec.rb index d4648136841..7ccf387f2dc 100644 --- a/spec/requests/api/v3/triggers_spec.rb +++ b/spec/requests/api/v3/triggers_spec.rb @@ -37,7 +37,7 @@ describe API::V3::Triggers do it 'returns unauthorized if token is for different project' do post v3_api("/projects/#{project2.id}/trigger/builds"), options.merge(ref: 'master') - expect(response).to have_http_status(401) + expect(response).to have_http_status(404) end end @@ -80,7 +80,8 @@ describe API::V3::Triggers do post v3_api("/projects/#{project.id}/trigger/builds"), options.merge(variables: variables, ref: 'master') expect(response).to have_http_status(201) pipeline.builds.reload - expect(pipeline.builds.first.trigger_request.variables).to eq(variables) + expect(pipeline.variables.map { |v| { v.key => v.value } }.first).to eq(variables) + expect(json_response['variables']).to eq(variables) end end end diff --git a/spec/services/ci/create_trigger_request_service_spec.rb b/spec/services/ci/create_trigger_request_service_spec.rb deleted file mode 100644 index 8295813a1ca..00000000000 --- a/spec/services/ci/create_trigger_request_service_spec.rb +++ /dev/null @@ -1,52 +0,0 @@ -require 'spec_helper' - -describe Ci::CreateTriggerRequestService do - let(:service) { described_class } - let(:project) { create(:project, :repository) } - let(:trigger) { create(:ci_trigger, project: project, owner: owner) } - let(:owner) { create(:user) } - - before do - stub_ci_pipeline_to_return_yaml_file - - project.add_developer(owner) - end - - describe '#execute' do - context 'valid params' do - subject { service.execute(project, trigger, 'master') } - - context 'without owner' do - it { expect(subject.trigger_request).to be_kind_of(Ci::TriggerRequest) } - it { expect(subject.trigger_request.builds.first).to be_kind_of(Ci::Build) } - it { expect(subject.pipeline).to be_kind_of(Ci::Pipeline) } - it { expect(subject.pipeline).to be_trigger } - end - - context 'with owner' do - it { expect(subject.trigger_request).to be_kind_of(Ci::TriggerRequest) } - it { expect(subject.trigger_request.builds.first).to be_kind_of(Ci::Build) } - it { expect(subject.trigger_request.builds.first.user).to eq(owner) } - it { expect(subject.pipeline).to be_kind_of(Ci::Pipeline) } - it { expect(subject.pipeline).to be_trigger } - it { expect(subject.pipeline.user).to eq(owner) } - end - end - - context 'no commit for ref' do - subject { service.execute(project, trigger, 'other-branch') } - - it { expect(subject.pipeline).not_to be_persisted } - end - - context 'no builds created' do - subject { service.execute(project, trigger, 'master') } - - before do - stub_ci_pipeline_yaml_file('script: { only: [develop], script: hello World }') - end - - it { expect(subject.pipeline).not_to be_persisted } - end - end -end diff --git a/spec/services/ci/retry_build_service_spec.rb b/spec/services/ci/retry_build_service_spec.rb index 7c9c117bf71..f5ed9ff608f 100644 --- a/spec/services/ci/retry_build_service_spec.rb +++ b/spec/services/ci/retry_build_service_spec.rb @@ -22,7 +22,7 @@ describe Ci::RetryBuildService do %i[type lock_version target_url base_tags commit_id deployments erased_by_id last_deployment project_id runner_id tag_taggings taggings tags trigger_request_id - user_id auto_canceled_by_id retried].freeze + user_id auto_canceled_by_id retried failure_reason].freeze shared_examples 'build duplication' do let(:stage) do diff --git a/spec/services/projects/update_pages_service_spec.rb b/spec/services/projects/update_pages_service_spec.rb index aa6ad6340f5..031366d1825 100644 --- a/spec/services/projects/update_pages_service_spec.rb +++ b/spec/services/projects/update_pages_service_spec.rb @@ -116,6 +116,7 @@ describe Projects::UpdatePagesService do expect(deploy_status.description) .to match(/artifacts for pages are too large/) + expect(deploy_status).to be_script_failure end end diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index 1e39f80699c..290ded3ff7e 100644 --- a/spec/support/test_env.rb +++ b/spec/support/test_env.rb @@ -5,7 +5,7 @@ module TestEnv # When developing the seed repository, comment out the branch you will modify. BRANCH_SHA = { - 'signed-commits' => '5d4a1cb', + 'signed-commits' => '2d1096e', 'not-merged-branch' => 'b83d6e3', 'branch-merged' => '498214d', 'empty-branch' => '7efb185', diff --git a/spec/views/projects/jobs/show.html.haml_spec.rb b/spec/views/projects/jobs/show.html.haml_spec.rb index 117f48450e2..d4279626e75 100644 --- a/spec/views/projects/jobs/show.html.haml_spec.rb +++ b/spec/views/projects/jobs/show.html.haml_spec.rb @@ -195,20 +195,4 @@ describe 'projects/jobs/show' do text: /\A\n#{Regexp.escape(commit_title)}\n\Z/) end end - - describe 'shows trigger variables in sidebar' do - let(:trigger_request) { create(:ci_trigger_request_with_variables, pipeline: pipeline) } - - before do - build.trigger_request = trigger_request - render - end - - it 'shows trigger variables in separate lines' do - expect(rendered).to have_css('.js-build-variable', visible: false, text: 'TRIGGER_KEY_1') - expect(rendered).to have_css('.js-build-variable', visible: false, text: 'TRIGGER_KEY_2') - expect(rendered).to have_css('.js-build-value', visible: false, text: 'TRIGGER_VALUE_1') - expect(rendered).to have_css('.js-build-value', visible: false, text: 'TRIGGER_VALUE_2') - end - end end diff --git a/spec/workers/create_gpg_signature_worker_spec.rb b/spec/workers/create_gpg_signature_worker_spec.rb index 54978baca88..aa6c347d738 100644 --- a/spec/workers/create_gpg_signature_worker_spec.rb +++ b/spec/workers/create_gpg_signature_worker_spec.rb @@ -7,9 +7,14 @@ describe CreateGpgSignatureWorker do let(:commit_sha) { '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' } it 'calls Gitlab::Gpg::Commit#signature' do - expect(Gitlab::Gpg::Commit).to receive(:new).with(project, commit_sha).and_call_original + commit = instance_double(Commit) + gpg_commit = instance_double(Gitlab::Gpg::Commit) - expect_any_instance_of(Gitlab::Gpg::Commit).to receive(:signature) + allow(Project).to receive(:find_by).with(id: project.id).and_return(project) + allow(project).to receive(:commit).with(commit_sha).and_return(commit) + + expect(Gitlab::Gpg::Commit).to receive(:new).with(commit).and_return(gpg_commit) + expect(gpg_commit).to receive(:signature) described_class.new.perform(commit_sha, project.id) end diff --git a/spec/workers/stuck_ci_jobs_worker_spec.rb b/spec/workers/stuck_ci_jobs_worker_spec.rb index 549635f7f33..ac6f4fefb4e 100644 --- a/spec/workers/stuck_ci_jobs_worker_spec.rb +++ b/spec/workers/stuck_ci_jobs_worker_spec.rb @@ -6,27 +6,31 @@ describe StuckCiJobsWorker do let(:worker) { described_class.new } let(:exclusive_lease_uuid) { SecureRandom.uuid } - subject do - job.reload - job.status - end - before do job.update!(status: status, updated_at: updated_at) allow_any_instance_of(Gitlab::ExclusiveLease).to receive(:try_obtain).and_return(exclusive_lease_uuid) end shared_examples 'job is dropped' do - it 'changes status' do + before do worker.perform - is_expected.to eq('failed') + job.reload + end + + it "changes status" do + expect(job).to be_failed + expect(job).to be_stuck_or_timeout_failure end end shared_examples 'job is unchanged' do - it "doesn't change status" do + before do worker.perform - is_expected.to eq(status) + job.reload + end + + it "doesn't change status" do + expect(job.status).to eq(status) end end diff --git a/vendor/gitignore/Global/JetBrains.gitignore b/vendor/gitignore/Global/JetBrains.gitignore index ff23445e2b0..345e61ae3f2 100644 --- a/vendor/gitignore/Global/JetBrains.gitignore +++ b/vendor/gitignore/Global/JetBrains.gitignore @@ -31,7 +31,7 @@ cmake-build-debug/ ## Plugin-specific files: # IntelliJ -/out/ +out/ # mpeltonen/sbt-idea plugin .idea_modules/ diff --git a/vendor/gitignore/Haskell.gitignore b/vendor/gitignore/Haskell.gitignore index 450f32ec40c..eee88b2f0f7 100644 --- a/vendor/gitignore/Haskell.gitignore +++ b/vendor/gitignore/Haskell.gitignore @@ -18,3 +18,4 @@ cabal.sandbox.config .stack-work/ cabal.project.local .HTF/ +.ghc.environment.* diff --git a/vendor/gitignore/Prestashop.gitignore b/vendor/gitignore/Prestashop.gitignore index 7c6ae1e31cc..81f45e19eba 100644 --- a/vendor/gitignore/Prestashop.gitignore +++ b/vendor/gitignore/Prestashop.gitignore @@ -7,8 +7,10 @@ config/settings.*.php # The following files are generated by PrestaShop. admin-dev/autoupgrade/ -/cache/ +/cache/* !/cache/index.php +!/cache/*/ +/cache/*/* !/cache/cachefs/index.php !/cache/purifier/index.php !/cache/push/index.php diff --git a/vendor/gitignore/Smalltalk.gitignore b/vendor/gitignore/Smalltalk.gitignore index 75272b23472..943995e1172 100644 --- a/vendor/gitignore/Smalltalk.gitignore +++ b/vendor/gitignore/Smalltalk.gitignore @@ -13,6 +13,10 @@ SqueakDebug.log # Monticello package cache /package-cache +# playground cache +/play-cache +/play-stash + # Metacello-github cache /github-cache github-*.zip diff --git a/vendor/gitignore/Symfony.gitignore b/vendor/gitignore/Symfony.gitignore index 6c224e024e9..85fd714a965 100644 --- a/vendor/gitignore/Symfony.gitignore +++ b/vendor/gitignore/Symfony.gitignore @@ -39,3 +39,6 @@ # Backup entities generated with doctrine:generate:entities command **/Entity/*~ + +# Embedded web-server pid file +/.web-server-pid diff --git a/vendor/gitignore/VisualStudio.gitignore b/vendor/gitignore/VisualStudio.gitignore index 22fd88a55a3..89c66054885 100644 --- a/vendor/gitignore/VisualStudio.gitignore +++ b/vendor/gitignore/VisualStudio.gitignore @@ -151,7 +151,7 @@ publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings +# Note: Comment the next line if you want to checkin your web deploy settings, # but database connection strings (with potential passwords) will be unencrypted *.pubxml *.publishproj diff --git a/vendor/gitlab-ci-yml/Go.gitlab-ci.yml b/vendor/gitlab-ci-yml/Go.gitlab-ci.yml index e23b6e212f0..8a214352d2a 100644 --- a/vendor/gitlab-ci-yml/Go.gitlab-ci.yml +++ b/vendor/gitlab-ci-yml/Go.gitlab-ci.yml @@ -1,14 +1,19 @@ image: golang:latest +variables: + # Please edit to your GitLab project + REPO_NAME: gitlab.com/namespace/project + # The problem is that to be able to use go get, one needs to put # the repository in the $GOPATH. So for example if your gitlab domain -# is mydomainperso.com, and that your repository is repos/projectname, and +# is gitlab.com, and that your repository is namespace/project, and # the default GOPATH being /go, then you'd need to have your -# repository in /go/src/mydomainperso.com/repos/projectname +# repository in /go/src/gitlab.com/namespace/project # Thus, making a symbolic link corrects this. before_script: - - ln -s /builds /go/src/mydomainperso.com - - cd /go/src/mydomainperso.com/repos/projectname + - mkdir -p $GOPATH/src/$REPO_NAME + - ln -svf $CI_PROJECT_DIR/* $GOPATH/src/$REPO_NAME + - cd $GOPATH/src/$REPO_NAME stages: - test @@ -17,21 +22,14 @@ stages: format: stage: test script: - # Add here all the dependencies, or use glide/govendor to get - # them automatically. - # - curl https://glide.sh/get | sh - - go get github.com/alecthomas/kingpin - - go tool vet -composites=false -shadow=true *.go - - go test -race $(go list ./... | grep -v /vendor/) + - go fmt $(go list ./... | grep -v /vendor/) + - go vet $(go list ./... | grep -v /vendor/) + - go test -race $(go list ./... | grep -v /vendor/) compile: stage: build script: - # Add here all the dependencies, or use glide/govendor/... - # to get them automatically. - - go get github.com/alecthomas/kingpin - # Better put this in a Makefile - - go build -race -ldflags "-extldflags '-static'" -o mybinary + - go build -race -ldflags "-extldflags '-static'" -o mybinary artifacts: - paths: - - mybinary + paths: + - mybinary diff --git a/vendor/gitlab-ci-yml/Gradle.gitlab-ci.yml b/vendor/gitlab-ci-yml/Gradle.gitlab-ci.yml index a65e48a3389..48d98dddfad 100644 --- a/vendor/gitlab-ci-yml/Gradle.gitlab-ci.yml +++ b/vendor/gitlab-ci-yml/Gradle.gitlab-ci.yml @@ -1,41 +1,36 @@ -# This template uses the java:8 docker image because there isn't any -# official Gradle image at this moment -# # This is the Gradle build system for JVM applications # https://gradle.org/ # https://github.com/gradle/gradle -image: java:8 +image: gradle:alpine # Disable the Gradle daemon for Continuous Integration servers as correctness # is usually a priority over speed in CI environments. Using a fresh # runtime for each build is more reliable since the runtime is completely # isolated from any previous builds. variables: - GRADLE_OPTS: "-Dorg.gradle.daemon=false" + GRADLE_OPTS: "-Dorg.gradle.daemon=false" -# Make the gradle wrapper executable. This essentially downloads a copy of -# Gradle to build the project with. -# https://docs.gradle.org/current/userguide/gradle_wrapper.html -# It is expected that any modern gradle project has a wrapper before_script: - - chmod +x gradlew + - export GRADLE_USER_HOME=`pwd`/.gradle -# We redirect the gradle user home using -g so that it caches the -# wrapper and dependencies. -# https://docs.gradle.org/current/userguide/gradle_command_line.html -# -# Unfortunately it also caches the build output so -# cleaning removes reminants of any cached builds. -# The assemble task actually builds the project. -# If it fails here, the tests can't run. build: stage: build - script: - - ./gradlew -g /cache/.gradle clean assemble - allow_failure: false + script: gradle --build-cache assemble + cache: + key: "$CI_COMMIT_REF_NAME" + policy: push + paths: + - build + - .gradle + -# Use the generated build output to run the tests. test: stage: test - script: - - ./gradlew -g /cache/.gradle check + script: gradle check + cache: + key: "$CI_COMMIT_REF_NAME" + policy: pull + paths: + - build + - .gradle + diff --git a/vendor/gitlab-ci-yml/Laravel.gitlab-ci.yml b/vendor/gitlab-ci-yml/Laravel.gitlab-ci.yml index 434de4f055a..0ad662cf704 100644 --- a/vendor/gitlab-ci-yml/Laravel.gitlab-ci.yml +++ b/vendor/gitlab-ci-yml/Laravel.gitlab-ci.yml @@ -34,6 +34,10 @@ before_script: # Install php extensions - docker-php-ext-install mbstring mcrypt pdo_mysql curl json intl gd xml zip bz2 opcache + # Install & enable Xdebug for code coverage reports + - pecl install xdebug + - docker-php-ext-enable xdebug + # Install Composer and project dependencies. - curl -sS https://getcomposer.org/installer | php - php composer.phar install diff --git a/vendor/gitlab-ci-yml/PHP.gitlab-ci.yml b/vendor/gitlab-ci-yml/PHP.gitlab-ci.yml index bb8caa49d6b..33f44ee9222 100644 --- a/vendor/gitlab-ci-yml/PHP.gitlab-ci.yml +++ b/vendor/gitlab-ci-yml/PHP.gitlab-ci.yml @@ -11,6 +11,9 @@ before_script: - apt-get install -yqq git libmcrypt-dev libpq-dev libcurl4-gnutls-dev libicu-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev # Install PHP extensions - docker-php-ext-install mbstring mcrypt pdo_pgsql curl json intl gd xml zip bz2 opcache +# Install & enable Xdebug for code coverage reports +- pecl install xdebug +- docker-php-ext-enable xdebug # Install and run Composer - curl -sS https://getcomposer.org/installer | php - php composer.phar install diff --git a/vendor/gitlab-ci-yml/Ruby.gitlab-ci.yml b/vendor/gitlab-ci-yml/Ruby.gitlab-ci.yml index 4e181e85451..ff7bdd32239 100644 --- a/vendor/gitlab-ci-yml/Ruby.gitlab-ci.yml +++ b/vendor/gitlab-ci-yml/Ruby.gitlab-ci.yml @@ -1,6 +1,6 @@ # Official language image. Look for the different tagged releases at: # https://hub.docker.com/r/library/ruby/tags/ -image: "ruby:2.3" +image: "ruby:2.4" # Pick zero or more services to be used on all builds. # Only needed when using a docker container to run your tests in. @@ -40,9 +40,9 @@ rails: variables: DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/$POSTGRES_DB" script: - - bundle exec rake db:migrate - - bundle exec rake db:seed - - bundle exec rake test + - rails db:migrate + - rails db:seed + - rails test # This deploy job uses a simple deploy flow to Heroku, other providers, e.g. AWS Elastic Beanstalk # are supported too: https://github.com/travis-ci/dpl |