-
Notifications
You must be signed in to change notification settings - Fork 41
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): support states (#1787)
## Proposed change ![image](https://github.com/AmadeusITGroup/otter/assets/52541061/7ffe3639-a0e1-44b6-b985-c7c3c95dd34f) - [ ] Add current language in state (if has been changed?) - [ ] Add the schema in state json exported file - [ ] Validate the json imported file with the schema - [ ] Add reset button when configuration is changed - [ ] Choose between the save of only the override or all the current value - [ ] Split this choice by category (theming / localization / configuration / language) - [ ] Support the capability to close the chrome extension and reopen without loosing unsaved changes - [ ] Or find a way to block the closing of the devtools if unsaved changes and ask if they want to save it or not - [ ] Add capability to let the app select the state to activate on bootstrap (query param?) - [ ] Move the save button in the select of the states and remove the warning border - [ ] Add new import state methods - [ ] By URL - [ ] By textarea ## Related issues - 🚀 Feature #1498 <!-- Please make sure to follow the contributing guidelines on https://github.com/amadeus-digital/Otter/blob/main/CONTRIBUTING.md -->
- Loading branch information
Showing
38 changed files
with
1,512 additions
and
306 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
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,49 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema", | ||
"$id": "OtterDevtoolsChromeExtensionState", | ||
"description": "Schema of Otter Devtools chrome extension state", | ||
"type": "object", | ||
"required": [ | ||
"color", | ||
"colorContrast", | ||
"name" | ||
], | ||
"properties": { | ||
"color": { | ||
"description": "Background color to identify the state in the selection widget.", | ||
"type": "string" | ||
}, | ||
"colorContrast": { | ||
"description": "Text color for the state in the selection widget in contrast with the background color.", | ||
"type": "string" | ||
}, | ||
"name": { | ||
"description": "User friendly name to identify the state in the Chrome Extension state panel.", | ||
"type": "string" | ||
}, | ||
"configurations": { | ||
"type": "object", | ||
"description": "List of the configuration-override to apply on the application.", | ||
"additionalProperties": { | ||
"type": "object" | ||
} | ||
}, | ||
"localizations": { | ||
"type": "object", | ||
"description": "List of the localization-override to apply on the application.", | ||
"additionalProperties": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"stylingVariables": { | ||
"description": "List of the css-variable-override to apply on the application.", | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} |
111 changes: 72 additions & 39 deletions
111
apps/chrome-devtools/src/app-devtools/app.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,75 @@ | ||
<app-connection> | ||
<ul ngbNav #nav="ngbNav" class="nav-tabs px-2 pt-2 navbar-light bg-light"> | ||
<li [ngbNavItem]="1"> | ||
<a ngbNavLink>General</a> | ||
<ng-template ngbNavContent> | ||
<o3r-debug-panel-pres></o3r-debug-panel-pres> | ||
</ng-template> | ||
</li> | ||
<li [ngbNavItem]="2"> | ||
<a ngbNavLink>Rules Engine</a> | ||
<ng-template ngbNavContent> | ||
<o3r-ruleset-history-pres [rulesetExecutions]="rulesetExecutions$ | async"></o3r-ruleset-history-pres> | ||
</ng-template> | ||
</li> | ||
<li [ngbNavItem]="3"> | ||
<a ngbNavLink>Configuration</a> | ||
<ng-template ngbNavContent> | ||
<o3r-config-panel-pres></o3r-config-panel-pres> | ||
</ng-template> | ||
</li> | ||
<li [ngbNavItem]="4"> | ||
<a ngbNavLink>Component</a> | ||
<ng-template ngbNavContent> | ||
<o3r-component-panel-pres></o3r-component-panel-pres> | ||
</ng-template> | ||
</li> | ||
<li [ngbNavItem]="5"> | ||
<a ngbNavLink>Localization</a> | ||
<ng-template ngbNavContent> | ||
<o3r-localization-panel-pres></o3r-localization-panel-pres> | ||
</ng-template> | ||
</li> | ||
<li [ngbNavItem]="6"> | ||
<a ngbNavLink>Theming</a> | ||
<ng-template ngbNavContent> | ||
<o3r-theming-panel-pres></o3r-theming-panel-pres> | ||
</ng-template> | ||
</li> | ||
</ul> | ||
|
||
<div class="d-flex align-items-stretch"> | ||
<ul ngbNav #nav="ngbNav" class="nav-tabs px-2 pt-2 navbar-light bg-light flex-fill"> | ||
<li [ngbNavItem]="1"> | ||
<a ngbNavLink>General</a> | ||
<ng-template ngbNavContent> | ||
<o3r-debug-panel-pres></o3r-debug-panel-pres> | ||
</ng-template> | ||
</li> | ||
<li [ngbNavItem]="2"> | ||
<a ngbNavLink>Rules Engine</a> | ||
<ng-template ngbNavContent> | ||
<o3r-ruleset-history-pres [rulesetExecutions]="rulesetExecutions$ | async"></o3r-ruleset-history-pres> | ||
</ng-template> | ||
</li> | ||
<li [ngbNavItem]="3"> | ||
<a ngbNavLink>Configuration</a> | ||
<ng-template ngbNavContent> | ||
<o3r-config-panel-pres></o3r-config-panel-pres> | ||
</ng-template> | ||
</li> | ||
<li [ngbNavItem]="4"> | ||
<a ngbNavLink>Component</a> | ||
<ng-template ngbNavContent> | ||
<o3r-component-panel-pres></o3r-component-panel-pres> | ||
</ng-template> | ||
</li> | ||
<li [ngbNavItem]="5"> | ||
<a ngbNavLink>Localization</a> | ||
<ng-template ngbNavContent> | ||
<o3r-localization-panel-pres></o3r-localization-panel-pres> | ||
</ng-template> | ||
</li> | ||
<li [ngbNavItem]="6"> | ||
<a ngbNavLink>Theming</a> | ||
<ng-template ngbNavContent> | ||
<o3r-theming-panel-pres></o3r-theming-panel-pres> | ||
</ng-template> | ||
</li> | ||
<li [ngbNavItem]="7"> | ||
<a ngbNavLink>States</a> | ||
<ng-template ngbNavContent> | ||
<o3r-state-panel></o3r-state-panel> | ||
</ng-template> | ||
</li> | ||
</ul> | ||
<form [formGroup]="form" class="px-4 {{hasLocalChanges() ? 'pt-2' : 'pt-3'}} ng-pristine ng-valid ng-touched border-bottom ms-auto"> | ||
<div> | ||
<ng-select | ||
[ngbTooltip]=" | ||
hasLocalChanges() | ||
? 'There are some local changes unsaved' | ||
: null | ||
" | ||
[style.width]="'250px'" [class.local-change]="hasLocalChanges()" | ||
formControlName="activeStateName" placeholder="No selected state" | ||
[items]="states()" [searchable]="false" [markFirst]="false" [compareWith]="stateCompareWithFn" bindLabel="name" bindValue="name"> | ||
<ng-template ng-label-tmp let-item="item"> | ||
<div class="d-flex align-items-baseline gap-2"> | ||
<span class="rounded-circle" [style.height]="'10px'" [style.width]="'10px'" [style.background]="item.color"></span> | ||
<span>{{item.name}}</span> | ||
</div> | ||
</ng-template> | ||
<ng-template ng-option-tmp let-item="item"> | ||
<div class="d-flex align-items-baseline gap-2"> | ||
<span class="rounded-circle" [style.height]="'10px'" [style.width]="'10px'" [style.background]="item.color"></span> | ||
<span>{{item.name}}</span> | ||
</div> | ||
</ng-template> | ||
</ng-select> | ||
</div> | ||
</form> | ||
</div> | ||
<div [ngbNavOutlet]="nav" class="mt-2 px-2"></div> | ||
</app-connection> |
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
Oops, something went wrong.