-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatic ACS URL in IdP forms w/ copy button (#2510)
* Add copyable prop to input; set up automatic ACS URL * unnecessary comment * Add tooltip when value is too long to see * No need for useEffect * Revert to useEffect; add tests for getSubdomain * Update design of copyable input * Remove right padding for copyable text * full-height button * slightly wider * Combobox border tweaks * slightly taller Listbox to match other inputs * shuffle files around, make helper not depend on window * constrain TextInput value to be a string * test IdP create and edit * Add checkbox to allow user to use custom ACS URL * Update test to handle unchecking/rechecking standard ACS URL * Update microcopy * use regular useState instead of form for the checkbox --------- Co-authored-by: David Crespo <[email protected]>
- Loading branch information
1 parent
8da7b6d
commit 48693a2
Showing
8 changed files
with
173 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
* | ||
* Copyright Oxide Computer Company | ||
*/ | ||
import { describe, expect, it } from 'vitest' | ||
|
||
import { getDelegatedDomain } from './util' | ||
|
||
describe('getDomainSuffix', () => { | ||
it('handles arbitrary URLs by falling back to placeholder', () => { | ||
expect(getDelegatedDomain({ hostname: 'localhost' })).toBe('placeholder') | ||
expect(getDelegatedDomain({ hostname: 'console-preview.oxide.computer' })).toBe( | ||
'placeholder' | ||
) | ||
}) | ||
|
||
it('handles 1 subdomain after sys', () => { | ||
const location = { hostname: 'oxide.sys.r3.oxide-preview.com' } | ||
expect(getDelegatedDomain(location)).toBe('r3.oxide-preview.com') | ||
}) | ||
|
||
it('handles 2 subdomains after sys', () => { | ||
const location = { hostname: 'oxide.sys.rack2.eng.oxide.computer' } | ||
expect(getDelegatedDomain(location)).toBe('rack2.eng.oxide.computer') | ||
}) | ||
}) |
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,17 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
* | ||
* Copyright Oxide Computer Company | ||
*/ | ||
|
||
// note: this lives in its own file for fast refresh reasons | ||
|
||
/** | ||
* When given a full URL hostname for an Oxide silo, return the domain | ||
* (everything after `<silo>.sys.`). Placeholder logic should only apply | ||
* in local dev or Vercel previews. | ||
*/ | ||
export const getDelegatedDomain = (location: { hostname: string }) => | ||
location.hostname.split('.sys.')[1] || 'placeholder' |
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