This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:SUSE/Portus into UI-review-and-fixes
- Loading branch information
Showing
127 changed files
with
2,664 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# SessionFlash adds the `session_flash` method which deals with flashy messages | ||
# on signup/login, while notifying users about their personal namespace. | ||
module SessionFlash | ||
extend ActiveSupport::Concern | ||
|
||
# Sets the flash object accordingly for the given authenticated user. The | ||
# method is the Devise method to be used for greeting the user (e.g. | ||
# `:signed_up`). If method is nil, then a generic greeting will be set. This | ||
# method also notifies users about their personal namespace (and whether it | ||
# changed or not). | ||
def session_flash(user, method) | ||
# First of all we've got a greeting. | ||
if method.nil? | ||
flash[:notice] = "Welcome!" | ||
else | ||
set_flash_message :notice, method unless method.nil? | ||
end | ||
|
||
# This will happen for the first user, which is the admin that has to | ||
# configure the registry. | ||
return if user.namespace.nil? | ||
|
||
# Now inform the user | ||
ns = user.namespace.name | ||
str = " Your personal namespace is '#{ns}'" | ||
if user.username == ns | ||
str += "." | ||
else | ||
str += " (your username was not a valid Docker namespace, so we had to tweak it)." | ||
end | ||
flash[:notice] << str | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# WebhookDeliveriesController manages the updates of webhook deliveries. | ||
class WebhookDeliveriesController < ApplicationController | ||
respond_to :html, :js | ||
|
||
after_action :verify_authorized | ||
|
||
# PATCH/PUT /namespaces/1/webhooks/1/deliveries/1 | ||
def update | ||
namespace = Namespace.find(params[:namespace_id]) | ||
webhook = namespace.webhooks.find(params[:webhook_id]) | ||
webhook_delivery = webhook.deliveries.find(params[:id]) | ||
|
||
authorize webhook_delivery | ||
|
||
webhook_delivery.retrigger | ||
render template: "webhooks/retrigger", locals: { webhook_delivery: webhook_delivery } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# WebhookHeadersController manages the creation/removal of webhook headers. | ||
class WebhookHeadersController < ApplicationController | ||
respond_to :html, :js | ||
|
||
before_action :set_namespace | ||
before_action :set_webhook | ||
|
||
after_action :verify_authorized | ||
|
||
# POST /namespaces/1/webhooks/1/headers | ||
# POST /namespaces/1/webhooks/1/headers.json | ||
def create | ||
@webhook_header = @webhook.headers.build(webhook_header_params) | ||
authorize @webhook_header | ||
|
||
if @webhook_header.save | ||
respond_with @namespace, @webhook, @webhook_header | ||
else | ||
respond_with @webhook_header.errors, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
# DELETE /namespaces/1/webhooks/1/headers/1 | ||
# DELETE /namespaces/1/webhooks/1/headers/1.json | ||
def destroy | ||
@webhook_header = @webhook.headers.find(params[:id]) | ||
|
||
authorize @webhook_header | ||
|
||
@webhook_header.destroy | ||
respond_with @namespace, @webhook, @webhook_header | ||
end | ||
|
||
private | ||
|
||
def set_namespace | ||
@namespace = Namespace.find(params[:namespace_id]) | ||
end | ||
|
||
def set_webhook | ||
@webhook = @namespace.webhooks.find(params[:webhook_id]) | ||
end | ||
|
||
def webhook_header_params | ||
params.require(:webhook_header).permit(:name, :value) | ||
end | ||
end |
Oops, something went wrong.