diff options
author | Mike Greiling <mike@pixelcog.com> | 2019-01-11 01:47:30 +0000 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2019-01-11 01:47:30 +0000 |
commit | 89c4d2ae623dbd666e2eaa58812323b81e02b4ea (patch) | |
tree | 736843b40db79adbf39553e1e6d521b117f40718 /app/controllers | |
parent | a0f77090854b3510543dc42529d7353adab03da0 (diff) | |
parent | 1102deb0bd04a1bdf550ed74cf381a6bd400a7e0 (diff) | |
download | gitlab-ce-89c4d2ae623dbd666e2eaa58812323b81e02b4ea.tar.gz |
Merge branch 'knative-show-page' into 'master'
Initial Serverless Functions detailed view
See merge request gitlab-org/gitlab-ce!23863
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/serverless/functions_controller.rb | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/app/controllers/projects/serverless/functions_controller.rb b/app/controllers/projects/serverless/functions_controller.rb index 0af2b7ef343..39eca10134f 100644 --- a/app/controllers/projects/serverless/functions_controller.rb +++ b/app/controllers/projects/serverless/functions_controller.rb @@ -7,19 +7,17 @@ module Projects before_action :authorize_read_cluster! - INDEX_PRIMING_INTERVAL = 10_000 - INDEX_POLLING_INTERVAL = 30_000 + INDEX_PRIMING_INTERVAL = 15_000 + INDEX_POLLING_INTERVAL = 60_000 def index - finder = Projects::Serverless::FunctionsFinder.new(project.clusters) - respond_to do |format| format.json do functions = finder.execute if functions.any? Gitlab::PollingInterval.set_header(response, interval: INDEX_POLLING_INTERVAL) - render json: Projects::Serverless::ServiceSerializer.new(current_user: @current_user).represent(functions) + render json: serialize_function(functions) else Gitlab::PollingInterval.set_header(response, interval: INDEX_PRIMING_INTERVAL) head :no_content @@ -32,6 +30,29 @@ module Projects end end end + + def show + @service = serialize_function(finder.service(params[:environment_id], params[:id])) + return not_found if @service.nil? + + respond_to do |format| + format.json do + render json: @service + end + + format.html + end + end + + private + + def finder + Projects::Serverless::FunctionsFinder.new(project.clusters) + end + + def serialize_function(function) + Projects::Serverless::ServiceSerializer.new(current_user: @current_user, project: project).represent(function) + end end end end |