-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(chrome-ext): toggle button for placeholder
- Loading branch information
1 parent
e030189
commit e16c26c
Showing
57 changed files
with
541 additions
and
72 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
2 changes: 1 addition & 1 deletion
2
apps/chrome-devtools/src/components/config-form/config-form.component.html
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
Binary file modified
BIN
+1.22 KB
(100%)
...ight/sanity/screenshots/visual-sanity.e2e.ts/chromium/component-replacement.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.28 KB
(99%)
...e-playwright/sanity/screenshots/visual-sanity.e2e.ts/chromium/configuration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+71 Bytes
(100%)
...2e-playwright/sanity/screenshots/visual-sanity.e2e.ts/chromium/design-token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+686 Bytes
(100%)
...playwright/sanity/screenshots/visual-sanity.e2e.ts/chromium/dynamic-content.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-88 Bytes
(100%)
...owcase/e2e-playwright/sanity/screenshots/visual-sanity.e2e.ts/chromium/home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-4.59 KB
(98%)
...2e-playwright/sanity/screenshots/visual-sanity.e2e.ts/chromium/localization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+103 KB
...e2e-playwright/sanity/screenshots/visual-sanity.e2e.ts/chromium/placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.42 KB
(99%)
...2e-playwright/sanity/screenshots/visual-sanity.e2e.ts/chromium/rules-engine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+993 Bytes
(100%)
...playwright/sanity/screenshots/visual-sanity.e2e.ts/chromium/run-app-locally.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+211 Bytes
(100%)
...e-playwright/sanity/screenshots/visual-sanity.e2e.ts/chromium/sdk-generator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 +1,12 @@ | ||
[] | ||
[ | ||
{ | ||
"library": "@o3r/showcase", | ||
"name": "PlaceholderComponent", | ||
"placeholders": [ | ||
{ | ||
"id": "placeholder-showcase", | ||
"description": "Showcase placeholder in app" | ||
} | ||
] | ||
} | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './placeholder.component'; |
69 changes: 69 additions & 0 deletions
69
apps/showcase/src/app/placeholder/placeholder.component.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,69 @@ | ||
import { AsyncPipe } from '@angular/common'; | ||
import { type AfterViewInit, ChangeDetectionStrategy, Component, type QueryList, ViewChildren, ViewEncapsulation } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
import { O3rComponent } from '@o3r/core'; | ||
import { PlaceholderRulesEngineActionHandler, PlaceholderRulesEngineActionModule } from '@o3r/components/rules-engine'; | ||
import { DynamicContentModule, DynamicContentService } from '@o3r/dynamic-content'; | ||
import { RulesEngineDevtoolsModule, RulesEngineRunnerModule, RulesEngineRunnerService, RulesetsStore, setRulesetsEntities } from '@o3r/rules-engine'; | ||
import { Store } from '@ngrx/store'; | ||
import { firstValueFrom } from 'rxjs'; | ||
import { IN_PAGE_NAV_PRES_DIRECTIVES, type InPageNavLink, InPageNavLinkDirective, InPageNavPresService, PlaceholderPresComponent } from '../../components'; | ||
import { environment } from '../../environments/environment.development'; | ||
import { TripFactsService } from '../../facts'; | ||
|
||
@O3rComponent({ componentType: 'Page' }) | ||
@Component({ | ||
selector: 'o3r-placeholder-page', | ||
standalone: true, | ||
imports: [ | ||
PlaceholderPresComponent, | ||
DynamicContentModule, | ||
RulesEngineRunnerModule, | ||
RulesEngineDevtoolsModule, | ||
PlaceholderRulesEngineActionModule, | ||
RouterModule, | ||
IN_PAGE_NAV_PRES_DIRECTIVES, | ||
AsyncPipe | ||
], | ||
templateUrl: './placeholder.template.html', | ||
styleUrl: './placeholder.style.scss', | ||
encapsulation: ViewEncapsulation.None, | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class PlaceholderComponent implements AfterViewInit { | ||
@ViewChildren(InPageNavLinkDirective) | ||
private readonly inPageNavLinkDirectives!: QueryList<InPageNavLink>; | ||
public links$ = this.inPageNavPresService.links$; | ||
|
||
constructor( | ||
private readonly inPageNavPresService: InPageNavPresService, | ||
private readonly tripFactsService: TripFactsService, | ||
private readonly store: Store<RulesetsStore>, | ||
private readonly dynamicContentService: DynamicContentService, | ||
rulesEngine: RulesEngineRunnerService, | ||
placeholderRulesEngineActionHandler: PlaceholderRulesEngineActionHandler | ||
) { | ||
// We recommend to do the 3 next lines in the AppComponent | ||
// Here we do it for the sake of the example | ||
this.tripFactsService.register(); | ||
rulesEngine.actionHandlers.add(placeholderRulesEngineActionHandler); | ||
void this.loadRuleSet(); | ||
} | ||
|
||
private async loadRuleSet() { | ||
const path = await firstValueFrom( | ||
this.dynamicContentService.getContentPathStream( | ||
`${!environment.production ? 'assets/' : ''}rules/rulesets.json` | ||
) | ||
); | ||
|
||
const resultCall = await fetch(path); | ||
const result = await resultCall.json(); | ||
|
||
this.store.dispatch(setRulesetsEntities({ entities: result.rulesets })); | ||
} | ||
|
||
public ngAfterViewInit() { | ||
this.inPageNavPresService.initialize(this.inPageNavLinkDirectives); | ||
} | ||
} |
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,37 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { EffectsModule } from '@ngrx/effects'; | ||
import { StoreModule } from '@ngrx/store'; | ||
import { RulesEngineRunnerModule } from '@o3r/rules-engine'; | ||
import { PlaceholderComponent } from './placeholder.component'; | ||
|
||
describe('PlaceholderComponent', () => { | ||
let component: PlaceholderComponent; | ||
let fixture: ComponentFixture<PlaceholderComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ | ||
PlaceholderComponent, | ||
StoreModule.forRoot(), | ||
EffectsModule.forRoot(), | ||
RulesEngineRunnerModule.forRoot() | ||
] | ||
}).compileComponents(); | ||
|
||
global.fetch = jest.fn(() => | ||
Promise.resolve({ | ||
json: () => Promise.resolve({ | ||
rulesets: [] | ||
}) | ||
}) | ||
) as jest.Mock; | ||
|
||
fixture = TestBed.createComponent(PlaceholderComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
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 @@ | ||
o3r-placeholder-page { | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
apps/showcase/src/app/placeholder/placeholder.template.html
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 @@ | ||
<h1>Placeholder</h1> | ||
<div class="row"> | ||
<div class="right-nav order-1 order-lg-2 col-12 col-lg-2 sticky-lg-top pt-5 pt-lg-0"> | ||
<o3r-in-page-nav-pres | ||
id="localization-nav" | ||
[links]="links$ | async" | ||
> | ||
</o3r-in-page-nav-pres> | ||
</div> | ||
<div class="order-2 order-lg-1 col-12 col-lg-10"> | ||
<h2 id="localization-description">Description</h2> | ||
<div> | ||
<p>The Otter framework provides a placeholder component mechanism to help integrate dynamic HTML elements (with a basic rendering system) at a predefined position in the application.</p> | ||
</div> | ||
|
||
<h2 id="localization-example">Example</h2> | ||
<div class="d-flex flex-column"> | ||
<o3r-placeholder-pres></o3r-placeholder-pres> | ||
</div> | ||
<h2 id="localization-references">References</h2> | ||
<div> | ||
<ul> | ||
<li> | ||
<a href="https://github.com/AmadeusITGroup/otter/blob/main/docs/components/PLACEHOLDERS.md" target="_blank" rel="noopener">Placeholder documentation</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> |
Oops, something went wrong.