-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add template and model view changes for organization authorization se…
…ttings (#277) * Add template and model view changes for organization authorization settings This relies on readthedocs/readthedocs-corporate#1730 This drops the very custom form for a more native form, but retains some of the styles of the authorization provider list. This is now just a informational block describing the providers. This also adds the KO view logic back to the view, so that we can conditionally show/require the domain field. Also raised in the PR above, a warning block is added when the provider value is changing, so there is some information that authentication/authorization might fail. * More changes to support additional validation on domain field * Update orb * Copy changes * Review changes on copy Co-authored-by: Manuel Kaufmann <[email protected]> --------- Co-authored-by: Manuel Kaufmann <[email protected]>
- Loading branch information
Showing
4 changed files
with
182 additions
and
95 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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 @@ | ||
<html> | ||
<body> | ||
<div data-bind="using: TestView()"> | ||
<form> | ||
<input | ||
type="text" | ||
name="provider" | ||
value="email" | ||
data-bind="valueInit: provider, value: provider" | ||
/> | ||
</form> | ||
<div data-bind="text: done()"></div> | ||
</div> | ||
|
||
<script type="module"> | ||
import { expect } from "@open-wc/testing"; | ||
import { runTests } from "@web/test-runner-mocha"; | ||
import { default as ko } from "knockout"; | ||
import { default as jquery } from "jquery"; | ||
|
||
import { Application } from "../../application"; | ||
import { Registry } from "../../application/registry"; | ||
import { OrganizationSettingsAuthorizationView } from "../../organization/index"; | ||
|
||
const app = new Application({ debug: true }); | ||
|
||
let view; | ||
let promise; | ||
|
||
class TestView extends OrganizationSettingsAuthorizationView { | ||
static view_name = "TestView"; | ||
|
||
constructor() { | ||
super(); | ||
view = this; | ||
promise = new Promise((resolve) => { | ||
this._promise_resolve = resolve; | ||
}); | ||
} | ||
|
||
done() { | ||
this._promise_resolve(); | ||
} | ||
} | ||
|
||
Registry.add_view(TestView); | ||
app.run(); | ||
|
||
runTests(async () => { | ||
describe("Organization settings authorization view", () => { | ||
it("observables show correct changes", async () => { | ||
await promise; | ||
expect(view.provider_original).to.be.undefined; | ||
expect(view.provider()).to.be.equal("email"); | ||
expect(view.show_warning()).to.be.false; | ||
expect(view.use_domain()).to.be.true; | ||
|
||
view.provider("allauth"); | ||
expect(view.provider_original).to.be.equal("email"); | ||
expect(view.provider()).to.be.equal("allauth"); | ||
expect(view.show_warning()).to.be.true; | ||
expect(view.use_domain()).to.be.false; | ||
}); | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |