Skip to content

Commit

Permalink
Merge pull request #33 from pod-os/josephguillaume-suggested-issuers
Browse files Browse the repository at this point in the history
login: suggested issuers
  • Loading branch information
angelo-v authored Mar 3, 2024
2 parents 4ffc440 + a952210 commit fe7524c
Show file tree
Hide file tree
Showing 26 changed files with 1,231 additions and 732 deletions.
7 changes: 4 additions & 3 deletions apps/tests/actions/signIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ export async function signIn(
idp: string = "http://localhost:4000",
) {
const originalLocation = page.url();
page.on("dialog", (dialog) => {
dialog.accept(idp);
});
const loginButton = page.locator("pos-login").getByRole("button");
await loginButton.click();

const idpUrl = page.getByLabel("Please enter your Identity Provider");
await idpUrl.fill("http://localhost:4000");
await idpUrl.press("Enter");

await expect(page).toHaveURL(
"http://localhost:4000/.account/login/password/",
);
Expand Down
2 changes: 1 addition & 1 deletion apps/tests/text-search.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test("finds a thing based on the label index", async ({ page }) => {
await signIn(page, alice);

// when searching for a text
const navigationBar = page.getByPlaceholder("Search");
const navigationBar = page.getByPlaceholder("Search or enter URI");
await navigationBar.fill("ometh");

// and choosing the first result
Expand Down
6 changes: 3 additions & 3 deletions contacts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
"@pod-os/core": "^0.11.1",
"@pod-os/elements": "^0.15.1",
"@solid-data-modules/contacts-rdflib": "^0.4.0",
"@stencil/core": "^4.12.2",
"@stencil/core": "^4.12.4",
"pollen-css": "^4.6.2"
},
"devDependencies": {
"@testing-library/dom": "^9.3.4",
"@testing-library/jest-dom": "^6.4.2",
"@types/jest": "^29.5.6",
"@types/node": "^16.18.11",
"@types/jest": "^29.5.12",
"@types/node": "^16.18.86",
"jest": "^29.7.0",
"jest-cli": "^29.7.0",
"jest-when": "^3.6.0",
Expand Down
14 changes: 7 additions & 7 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@
"author": "Angelo Veltens",
"license": "MIT",
"devDependencies": {
"@babel/preset-env": "^7.23.8",
"@babel/preset-env": "^7.24.0",
"@babel/preset-typescript": "^7.23.3",
"@types/jest": "^29.5.11",
"@types/jest": "^29.5.12",
"@types/jest-when": "^3.5.5",
"@types/sparqljs": "^3.1.10",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"esbuild": "^0.19.11",
"eslint": "^8.56.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"esbuild": "^0.19.12",
"eslint": "^8.57.0",
"jest": "^29.7.0",
"jest-when": "^3.6.0",
"prettier": "^3.2.1",
"prettier": "^3.2.5",
"rdf-namespaces": "^1.12.0",
"rimraf": "^5.0.5",
"sparqljs": "^3.7.1",
Expand Down
2 changes: 1 addition & 1 deletion dev-solid-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "",
"license": "MIT",
"dependencies": {
"@solid/community-server": "^7.0.3"
"@solid/community-server": "^7.0.4"
},
"repository": {
"type": "git",
Expand Down
6 changes: 3 additions & 3 deletions docs/elements/apps/pos-app-browser/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ graph TD;
pos-login --> pos-resource
pos-login --> pos-picture
pos-login --> pos-label
pos-login --> ion-button
pos-login --> pos-dialog
pos-login --> pos-login-form
pos-resource --> ion-progress-bar
pos-resource --> ion-card
pos-resource --> ion-card-header
Expand All @@ -45,15 +46,14 @@ graph TD;
pos-picture --> pos-image
pos-image --> ion-skeleton-text
pos-image --> ion-icon
ion-button --> ion-ripple-effect
pos-dialog --> ion-icon
pos-router --> pos-add-new-thing
pos-router --> pos-navigation-bar
pos-router --> pos-resource
pos-router --> pos-type-router
pos-add-new-thing --> ion-icon
pos-add-new-thing --> pos-dialog
pos-add-new-thing --> pos-new-thing-form
pos-dialog --> ion-icon
pos-new-thing-form --> pos-select-term
pos-navigation-bar --> ion-searchbar
pos-navigation-bar --> pos-rich-link
Expand Down
2 changes: 2 additions & 0 deletions docs/elements/components/pos-dialog/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Type: `Promise<void>`
### Used by

- [pos-add-new-thing](../pos-add-new-thing)
- [pos-login](../pos-login)

### Depends on

Expand All @@ -47,6 +48,7 @@ Type: `Promise<void>`
graph TD;
pos-dialog --> ion-icon
pos-add-new-thing --> pos-dialog
pos-login --> pos-dialog
style pos-dialog fill:#f9f,stroke:#333,stroke-width:4px
```

Expand Down
30 changes: 30 additions & 0 deletions docs/elements/components/pos-login-form/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# pos-login-form



<!-- Auto Generated Below -->


## Events

| Event | Description | Type |
| ------------------------- | ------------------------------------------- | ------------------ |
| `pod-os:idp-url-selected` | Emits the selected IDP URL to use for login | `CustomEvent<any>` |


## Dependencies

### Used by

- [pos-login](../pos-login)

### Graph
```mermaid
graph TD;
pos-login --> pos-login-form
style pos-login-form fill:#f9f,stroke:#333,stroke-width:4px
```

----------------------------------------------

*Built with [StencilJS](https://stenciljs.com/)*
8 changes: 5 additions & 3 deletions docs/elements/components/pos-login/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@
- [pos-resource](../pos-resource)
- [pos-picture](../pos-picture)
- [pos-label](../pos-label)
- ion-button
- [pos-dialog](../pos-dialog)
- [pos-login-form](../pos-login-form)

### Graph
```mermaid
graph TD;
pos-login --> pos-resource
pos-login --> pos-picture
pos-login --> pos-label
pos-login --> ion-button
pos-login --> pos-dialog
pos-login --> pos-login-form
pos-resource --> ion-progress-bar
pos-resource --> ion-card
pos-resource --> ion-card-header
Expand All @@ -40,7 +42,7 @@ graph TD;
pos-picture --> pos-image
pos-image --> ion-skeleton-text
pos-image --> ion-icon
ion-button --> ion-ripple-effect
pos-dialog --> ion-icon
pos-app-browser --> pos-login
style pos-login fill:#f9f,stroke:#333,stroke-width:4px
```
Expand Down
5 changes: 5 additions & 0 deletions elements/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Added

- [pos-dialog](../docs/elements/components/pos-dialog): A dialog component with a common style
- [pos-login-form](../docs/elements/components/pos-login-form): A form to select a identity provider for logging in

### Changed

- [pos-login](../docs/elements/components/pos-login): Now shows a dedicated login dialog using [pos-login-form](../docs/elements/components/pos-login-form) instead of a browser prompt

## 0.15.0

Expand Down
14 changes: 7 additions & 7 deletions elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@
"generate": "stencil generate"
},
"dependencies": {
"@ionic/core": "^7.6.4",
"@pod-os/core": "^0.11.0",
"@stencil/core": "^4.9.1",
"@stencil/store": "^2.0.12",
"@ionic/core": "^7.7.3",
"@pod-os/core": "^0.11.1",
"@stencil/core": "^4.12.4",
"@stencil/store": "^2.0.14",
"pollen-css": "^4.6.2",
"stencil-router-v2": "^0.6.0"
},
"devDependencies": {
"@testing-library/dom": "^9.3.4",
"@testing-library/jest-dom": "^6.2.0",
"@types/jest": "^29.5.11",
"@testing-library/jest-dom": "^6.4.2",
"@types/jest": "^29.5.12",
"jest": "^29.7.0",
"jest-cli": "^29.7.0",
"jest-when": "^3.6.0",
"prettier": "^3.2.1"
"prettier": "^3.2.5"
},
"license": "MIT",
"repository": {
Expand Down
32 changes: 32 additions & 0 deletions elements/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export namespace Components {
}
interface PosLogin {
}
interface PosLoginForm {
}
interface PosNavigationBar {
"uri": string;
}
Expand Down Expand Up @@ -137,6 +139,10 @@ export interface PosLoginCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLPosLoginElement;
}
export interface PosLoginFormCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLPosLoginFormElement;
}
export interface PosNavigationBarCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLPosNavigationBarElement;
Expand Down Expand Up @@ -430,6 +436,23 @@ declare global {
prototype: HTMLPosLoginElement;
new (): HTMLPosLoginElement;
};
interface HTMLPosLoginFormElementEventMap {
"pod-os:idp-url-selected": any;
}
interface HTMLPosLoginFormElement extends Components.PosLoginForm, HTMLStencilElement {
addEventListener<K extends keyof HTMLPosLoginFormElementEventMap>(type: K, listener: (this: HTMLPosLoginFormElement, ev: PosLoginFormCustomEvent<HTMLPosLoginFormElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof HTMLPosLoginFormElementEventMap>(type: K, listener: (this: HTMLPosLoginFormElement, ev: PosLoginFormCustomEvent<HTMLPosLoginFormElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
var HTMLPosLoginFormElement: {
prototype: HTMLPosLoginFormElement;
new (): HTMLPosLoginFormElement;
};
interface HTMLPosNavigationBarElementEventMap {
"pod-os:init": any;
"pod-os:link": any;
Expand Down Expand Up @@ -665,6 +688,7 @@ declare global {
"pos-label": HTMLPosLabelElement;
"pos-literals": HTMLPosLiteralsElement;
"pos-login": HTMLPosLoginElement;
"pos-login-form": HTMLPosLoginFormElement;
"pos-navigation-bar": HTMLPosNavigationBarElement;
"pos-new-thing-form": HTMLPosNewThingFormElement;
"pos-picture": HTMLPosPictureElement;
Expand Down Expand Up @@ -756,6 +780,12 @@ declare namespace LocalJSX {
interface PosLogin {
"onPod-os:init"?: (event: PosLoginCustomEvent<any>) => void;
}
interface PosLoginForm {
/**
* Emits the selected IDP URL to use for login
*/
"onPod-os:idp-url-selected"?: (event: PosLoginFormCustomEvent<any>) => void;
}
interface PosNavigationBar {
"onPod-os:init"?: (event: PosNavigationBarCustomEvent<any>) => void;
"onPod-os:link"?: (event: PosNavigationBarCustomEvent<any>) => void;
Expand Down Expand Up @@ -836,6 +866,7 @@ declare namespace LocalJSX {
"pos-label": PosLabel;
"pos-literals": PosLiterals;
"pos-login": PosLogin;
"pos-login-form": PosLoginForm;
"pos-navigation-bar": PosNavigationBar;
"pos-new-thing-form": PosNewThingForm;
"pos-picture": PosPicture;
Expand Down Expand Up @@ -877,6 +908,7 @@ declare module "@stencil/core" {
"pos-label": LocalJSX.PosLabel & JSXBase.HTMLAttributes<HTMLPosLabelElement>;
"pos-literals": LocalJSX.PosLiterals & JSXBase.HTMLAttributes<HTMLPosLiteralsElement>;
"pos-login": LocalJSX.PosLogin & JSXBase.HTMLAttributes<HTMLPosLoginElement>;
"pos-login-form": LocalJSX.PosLoginForm & JSXBase.HTMLAttributes<HTMLPosLoginFormElement>;
"pos-navigation-bar": LocalJSX.PosNavigationBar & JSXBase.HTMLAttributes<HTMLPosNavigationBarElement>;
"pos-new-thing-form": LocalJSX.PosNewThingForm & JSXBase.HTMLAttributes<HTMLPosNewThingFormElement>;
"pos-picture": LocalJSX.PosPicture & JSXBase.HTMLAttributes<HTMLPosPictureElement>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ button#new:hover, button#new:focus {
box-shadow: var(--shadow-sm);
}

pos-new-thing-form {
margin: var(--scale-3);
}

2 changes: 1 addition & 1 deletion elements/src/components/pos-dialog/pos-dialog.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dialog header {

dialog > :last-child {
/* This is the content slot*/
margin: var(--scale-3);
margin-top: var(--scale-3);
}

button#close {
Expand Down
43 changes: 43 additions & 0 deletions elements/src/components/pos-login-form/pos-login-form.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
:host {
display: block;
margin: 0
}

form {
display: flex;
flex-direction: column;
gap: var(--size-4);
}

input {
outline: var(--pos-input-outline);
padding: var(--scale-000);
border: none;
border-radius: var(--radius-xs);
width: var(--size-full);
box-sizing: border-box;
}

input:focus-within {
outline: var(--pos-input-focus-outline);
}

input#login {
outline: none;
box-shadow: var(--shadow-sm);
cursor: pointer;
color: var(--pos-primary-text-color);
background-color: var(--pos-primary-color);
}

input#login:disabled {
cursor: default;
color: var(--pos-disabled-text-color);
background-color: var(--pos-disabled-color);
box-shadow: none
}

input#login:hover:not(:disabled), input#login:focus {
filter: brightness(110%);
box-shadow: var(--shadow-md);
}
Loading

0 comments on commit fe7524c

Please sign in to comment.