-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12104 from rubhanazeem/token-show
Simplify token creation code
- Loading branch information
Showing
13 changed files
with
117 additions
and
54 deletions.
There are no files selected for viewing
3 changes: 1 addition & 2 deletions
3
src/api/app/components/copy_to_clipboard_input_component.html.haml
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
class CopyToClipboardInputComponent < ApplicationComponent | ||
def initialize(form_builder:) | ||
def initialize(token_string:) | ||
super | ||
@form_builder = form_builder | ||
@token_string = token_string | ||
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
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 |
---|---|---|
|
@@ -43,6 +43,6 @@ def webui_trigger? | |
end | ||
|
||
def show? | ||
webui_trigger? | ||
record.user == user && !record.type.in?(['Token::Rss']) | ||
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 |
---|---|---|
@@ -1 +1 @@ | ||
= link_to('Back to List of Tokens', tokens_path, title: 'Back to List of Tokens', class: 'btn btn-outline-secondary px-4 mt-3 mt-sm-0') | ||
= link_to('Back to the list of tokens', tokens_path, title: 'Back to the list of tokens', class: 'btn btn-outline-secondary btn-sm') |
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 was deleted.
Oops, something went wrong.
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,68 @@ | ||
- @pagetitle = "Token - #{@token.name.presence || 'No name'}" | ||
|
||
.card | ||
.card-body | ||
%h3.mb-3 | ||
= @pagetitle | ||
|
||
.row | ||
.col-12.col-md-10.col-lg-8 | ||
- if session[:show_token] | ||
%p.font-weight-bold Your new OBS Personal Access Token | ||
|
||
.form-row | ||
.col-sm | ||
%label.font-weight-bold | ||
Id: | ||
%span | ||
= @token.id | ||
|
||
- if session[:show_token] | ||
- session[:show_token] = nil # Ensure we're only showing the token once | ||
.form-row | ||
.col-12.col-md-10.col-lg-9 | ||
%fieldset.form-group | ||
%label.col-form-label.font-weight-bold | ||
Secret: | ||
.input-group | ||
= render CopyToClipboardInputComponent.new(token_string: @token.string) | ||
%hr | ||
|
||
.form-row | ||
.col | ||
.form-group | ||
%label.col-form-label.mr-2.font-weight-bold | ||
Type: | ||
%span | ||
= @token.token_name | ||
|
||
- if @token.package | ||
.form-row | ||
.col-sm | ||
.form-group.ui-front | ||
%label.font-weight-bold | ||
Project: | ||
%span | ||
= link_to(@token.package.project.name, project_show_path(@token.package.project)) | ||
|
||
.form-row | ||
.col-sm | ||
.form-group.ui-front | ||
%label.font-weight-bold | ||
Package: | ||
%span | ||
= link_to(@token.package.name, package_show_path(@token.package.project, @token.package)) | ||
|
||
.actions | ||
- if policy(@token).edit? | ||
= link_to(edit_token_path(@token), class: 'pl-2', title: 'Edit') do | ||
%i.fas.fa-edit | ||
%span.nav-item-name Edit | ||
- if policy(@token).webui_trigger? | ||
= link_to(token_trigger_path(@token), class: 'pl-2', title: 'Trigger Token') do | ||
%i.fas.fa-project-diagram | ||
%span.nav-item-name Trigger Token | ||
- if @token.type == 'Token::Workflow' | ||
= link_to(token_workflow_runs_path(@token.id), class: 'pl-2', title: 'Workflow Runs') do | ||
%i.fas.fa-book-open | ||
%span.nav-item-name Workflow Runs |
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