summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-18 03:08:54 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-18 03:08:54 +0000
commit5ee120f46740efac7b8a460d7a92e4da82f4fb0b (patch)
treeb44d3bef04e9db472913289e6b53e58a14cb3e61 /app
parent72721699f11187199e89631ce0b5e3d2f7c167e9 (diff)
downloadgitlab-ce-5ee120f46740efac7b8a460d7a92e4da82f4fb0b.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/monitoring/components/charts/time_series.vue5
-rw-r--r--app/assets/javascripts/monitoring/constants.js7
-rw-r--r--app/controllers/oauth/applications_controller.rb4
-rw-r--r--app/controllers/oauth/token_info_controller.rb19
4 files changed, 33 insertions, 2 deletions
diff --git a/app/assets/javascripts/monitoring/components/charts/time_series.vue b/app/assets/javascripts/monitoring/components/charts/time_series.vue
index eaf0780d9e1..e6dbc38402e 100644
--- a/app/assets/javascripts/monitoring/components/charts/time_series.vue
+++ b/app/assets/javascripts/monitoring/components/charts/time_series.vue
@@ -14,6 +14,7 @@ import {
lineWidths,
symbolSizes,
dateFormats,
+ chartColorValues,
} from '../../constants';
import { makeDataSeries } from '~/helpers/monitor_helper';
import { graphDataValidatorForValues } from '../../utils';
@@ -124,7 +125,7 @@ export default {
// Transforms & supplements query data to render appropriate labels & styles
// Input: [{ queryAttributes1 }, { queryAttributes2 }]
// Output: [{ seriesAttributes1 }, { seriesAttributes2 }]
- return this.graphData.metrics.reduce((acc, query) => {
+ return this.graphData.metrics.reduce((acc, query, i) => {
const { appearance } = query;
const lineType =
appearance && appearance.line && appearance.line.type
@@ -145,7 +146,7 @@ export default {
lineStyle: {
type: lineType,
width: lineWidth,
- color: this.primaryColor,
+ color: chartColorValues[i % chartColorValues.length],
},
showSymbol: false,
areaStyle: this.graphData.type === 'area-chart' ? areaStyle : undefined,
diff --git a/app/assets/javascripts/monitoring/constants.js b/app/assets/javascripts/monitoring/constants.js
index b468254b0cf..ddf6c9878df 100644
--- a/app/assets/javascripts/monitoring/constants.js
+++ b/app/assets/javascripts/monitoring/constants.js
@@ -70,6 +70,13 @@ export const colorValues = {
anomalyAreaColor: '#1f78d1',
};
+export const chartColorValues = [
+ '#1f78d1', // $blue-500 (see variables.scss)
+ '#1aaa55', // $green-500
+ '#fc9403', // $orange-500
+ '#6d49cb', // $purple
+];
+
export const lineTypes = {
default: 'solid',
};
diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb
index f0e6cebe0e4..2c3e60d12b7 100644
--- a/app/controllers/oauth/applications_controller.rb
+++ b/app/controllers/oauth/applications_controller.rb
@@ -8,6 +8,10 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
include Gitlab::Experimentation::ControllerConcern
include InitializesCurrentUserMode
+ # Defined by the `Doorkeeper::ApplicationsController` and is redundant as we call `authenticate_user!` below. Not
+ # defining or skipping this will result in a `403` response to all requests.
+ skip_before_action :authenticate_admin!
+
prepend_before_action :verify_user_oauth_applications_enabled, except: :index
prepend_before_action :authenticate_user!
before_action :add_gon_variables
diff --git a/app/controllers/oauth/token_info_controller.rb b/app/controllers/oauth/token_info_controller.rb
new file mode 100644
index 00000000000..492c24b53b1
--- /dev/null
+++ b/app/controllers/oauth/token_info_controller.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class Oauth::TokenInfoController < Doorkeeper::TokenInfoController
+ def show
+ if doorkeeper_token && doorkeeper_token.accessible?
+ token_json = doorkeeper_token.as_json
+
+ # maintain backwards compatibility
+ render json: token_json.merge(
+ 'scopes' => token_json[:scope],
+ 'expires_in_seconds' => token_json[:expires_in]
+ ), status: :ok
+ else
+ error = Doorkeeper::OAuth::ErrorResponse.new(name: :invalid_request)
+ response.headers.merge!(error.headers)
+ render json: error.body, status: error.status
+ end
+ end
+end