-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 #16377 from opf/feature/saml-ui
User interface for SAML configuration
- Loading branch information
Showing
109 changed files
with
5,387 additions
and
167 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
21 changes: 21 additions & 0 deletions
21
app/components/op_primer/copy_to_clipboard_component.html.erb
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,21 @@ | ||
<%= | ||
flex_layout(align_items: :center, **@system_arguments) do |flex| | ||
if @scheme == :link | ||
flex.with_column(classes: "ellipsis") do | ||
render(Primer::Beta::Link.new( | ||
id: @id, | ||
href: value, | ||
title: value, | ||
target: :_blank | ||
)) { value } | ||
end | ||
else | ||
flex.with_column(classes: "ellipsis") do | ||
render(Primer::Beta::Text.new(title: value)) { value } | ||
end | ||
end | ||
flex.with_column(ml: 1) do | ||
render(Primer::Beta::ClipboardCopy.new(value:, "aria-label": t(:button_copy_to_clipboard))) | ||
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,43 @@ | ||
#-- copyright | ||
# OpenProject is an open source project management software. | ||
# Copyright (C) 2012-2024 the OpenProject GmbH | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License version 3. | ||
# | ||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: | ||
# Copyright (C) 2006-2013 Jean-Philippe Lang | ||
# Copyright (C) 2010-2013 the ChiliProject Team | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
# | ||
# See COPYRIGHT and LICENSE files for more details. | ||
#++ | ||
|
||
module OpPrimer | ||
class CopyToClipboardComponent < ApplicationComponent | ||
include OpPrimer::ComponentHelpers | ||
|
||
alias_method :value, :model | ||
|
||
def initialize(value = nil, scheme: :value, **system_arguments) | ||
super(value) | ||
|
||
@scheme = scheme | ||
@system_arguments = system_arguments | ||
@id = SecureRandom.hex(8) | ||
end | ||
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
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
30 changes: 30 additions & 0 deletions
30
frontend/src/stimulus/controllers/show-when-checked.controller.ts
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,30 @@ | ||
import { ApplicationController } from 'stimulus-use'; | ||
|
||
export default class OpShowWhenCheckedController extends ApplicationController { | ||
static targets = ['cause', 'effect']; | ||
|
||
static values = { | ||
reversed: Boolean, | ||
}; | ||
|
||
declare reversedValue:boolean; | ||
|
||
declare readonly hasReversedValue:boolean; | ||
|
||
declare readonly effectTargets:HTMLInputElement[]; | ||
|
||
causeTargetConnected(target:HTMLElement) { | ||
target.addEventListener('change', this.toggleDisabled.bind(this)); | ||
} | ||
|
||
causeTargetDisconnected(target:HTMLElement) { | ||
target.removeEventListener('change', this.toggleDisabled.bind(this)); | ||
} | ||
|
||
private toggleDisabled(evt:InputEvent):void { | ||
const checked = (evt.target as HTMLInputElement).checked; | ||
this.effectTargets.forEach((el) => { | ||
el.hidden = (this.hasReversedValue && this.reversedValue) ? checked : !checked; | ||
}); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
frontend/src/stimulus/controllers/show-when-value-selected.controller.ts
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,22 @@ | ||
import { ApplicationController } from 'stimulus-use'; | ||
|
||
export default class OpShowWhenValueSelectedController extends ApplicationController { | ||
static targets = ['cause', 'effect']; | ||
|
||
declare readonly effectTargets:HTMLInputElement[]; | ||
|
||
causeTargetConnected(target:HTMLElement) { | ||
target.addEventListener('change', this.toggleDisabled.bind(this)); | ||
} | ||
|
||
causeTargetDisconnected(target:HTMLElement) { | ||
target.removeEventListener('change', this.toggleDisabled.bind(this)); | ||
} | ||
|
||
private toggleDisabled(evt:InputEvent):void { | ||
const value = (evt.target as HTMLInputElement).value; | ||
this.effectTargets.forEach((el) => { | ||
el.hidden = !(el.dataset.value === value); | ||
}); | ||
} | ||
} |
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
16 changes: 16 additions & 0 deletions
16
lookbook/previews/op_primer/copy_to_clipboard_component_preview.rb
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,16 @@ | ||
# frozen_string_literal: true | ||
|
||
module OpPrimer | ||
# @logical_path OpenProject/Primer | ||
class CopyToClipboardComponentPreview < Lookbook::Preview | ||
# @param value text | ||
def default(value: "Copy me!") | ||
render(OpPrimer::CopyToClipboardComponent.new(value)) | ||
end | ||
|
||
# @param url text | ||
def as_link(url: "http://example.org") | ||
render(OpPrimer::CopyToClipboardComponent.new(url, scheme: :link)) | ||
end | ||
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 @@ | ||
@import "saml/providers/view_component" |
3 changes: 3 additions & 0 deletions
3
modules/auth_saml/app/components/saml/providers/info_component.html.erb
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,3 @@ | ||
<%= render(Primer::Beta::Heading.new(tag: :h4)) { I18n.t('saml.info.title') } %> | ||
|
||
<%= render(Primer::Beta::Text.new) { I18n.t('saml.info.description') }%> |
7 changes: 7 additions & 0 deletions
7
modules/auth_saml/app/components/saml/providers/info_component.rb
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,7 @@ | ||
module Saml | ||
module Providers | ||
class InfoComponent < ApplicationComponent | ||
alias_method :provider, :model | ||
end | ||
end | ||
end |
Oops, something went wrong.