-
-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: new acore_string editor #3210
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a3c6d36
Add working acore string editor
Exitare 23a533e
Rename files to match table
Exitare 079cf0e
Fix linter
Exitare 6ad59f0
Adress code review
Exitare 77a5179
Merge branch 'master' into Acore-Strings
FrancescoBorzi 21cc698
Add missing acore string handler
Exitare 0fb07ad
Update service used for if clause
Exitare File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
27 changes: 27 additions & 0 deletions
27
libs/features/texts/src/acore-text/acore-string-handler.service.spec.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,27 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
import { AcoreStringHandlerService } from './acore-string-handler.service'; | ||
import { ACORE_STRING_TABLE } from '@keira/shared/acore-world-model'; | ||
|
||
describe(AcoreStringHandlerService.name, () => { | ||
beforeEach(() => | ||
TestBed.configureTestingModule({ | ||
providers: [AcoreStringHandlerService], | ||
}), | ||
); | ||
|
||
const setup = () => { | ||
const service = TestBed.inject(AcoreStringHandlerService); | ||
return { service }; | ||
}; | ||
|
||
it('isUnsaved should return the value of the statusMap for the broadcast_text table', () => { | ||
const { service } = setup(); | ||
expect(service.isUnsaved).toBe(false); // defaults to false | ||
|
||
service.statusMap[ACORE_STRING_TABLE] = true; | ||
expect(service.isUnsaved).toBe(true); | ||
|
||
service.statusMap[ACORE_STRING_TABLE] = false; | ||
expect(service.isUnsaved).toBe(false); | ||
}); | ||
}); |
18 changes: 18 additions & 0 deletions
18
libs/features/texts/src/acore-text/acore-string-handler.service.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,18 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { HandlerService } from '@keira/shared/base-abstract-classes'; | ||
import { ACORE_STRING_TABLE, AcoreString } from '@keira/shared/acore-world-model'; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class AcoreStringHandlerService extends HandlerService<AcoreString> { | ||
protected readonly mainEditorRoutePath = 'texts/acore-string'; | ||
|
||
get isUnsaved(): boolean { | ||
return this.statusMap[ACORE_STRING_TABLE]; | ||
} | ||
|
||
protected _statusMap = { | ||
[ACORE_STRING_TABLE]: false, | ||
}; | ||
} |
73 changes: 73 additions & 0 deletions
73
libs/features/texts/src/acore-text/acore-string.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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<keira-top-bar [selected]="handlerService.selected" [selectedName]="handlerService.selectedName" [isNew]="handlerService.isNew" /> | ||
|
||
<div class="container-fluid"> | ||
@if (editorService.loading) { | ||
<span [translate]="'LOADING'"></span> | ||
} | ||
|
||
@if (editorService.form && !!editorService.loadedEntityId && !editorService.loading) { | ||
<div> | ||
<div class="content-block"> | ||
<keira-query-output [docUrl]="docUrl" [editorService]="editorService" (executeQuery)="save($event)" /> | ||
</div> | ||
<form [formGroup]="editorService.form" class="form-group edit-form"> | ||
<div class="content-block"> | ||
<div class="row"> | ||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3 col-xl-2"> | ||
<label class="control-label" for="entry">Entry</label> | ||
<i class="fas fa-info-circle ms-1" placement="auto" [tooltip]="'OTHER_TEXTS.BROADCAST_TEXT.ID' | translate"></i> | ||
<input [formControlName]="'entry'" id="entry" type="text" class="form-control form-control-sm" /> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="form-group col-12"> | ||
<label class="control-label" for="content_default">Content Default</label> | ||
<textarea [formControlName]="'content_default'" id="content_default" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="form-group col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<label class="control-label" for="locale_koKR">Locale koKR</label> | ||
<textarea [formControlName]="'locale_koKR'" id="locale_koKR" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
<div class="form-group col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<label class="control-label" for="locale_frFR">Locale frFr</label> | ||
<textarea [formControlName]="'locale_frFR'" id="locale_frFR" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="form-group col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<label class="control-label" for="locale_deDE">Locale deDe</label> | ||
<textarea [formControlName]="'locale_deDE'" id="locale_deDE" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
<div class="form-group col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<label class="control-label" for="locale_zhCN">Locale zhCN</label> | ||
<textarea [formControlName]="'locale_zhCN'" id="locale_zhCN" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="form-group col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<label class="control-label" for="locale_zhTW">Locale zhTW</label> | ||
<textarea [formControlName]="'locale_zhTW'" id="locale_zhTW" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
<div class="form-group col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<label class="control-label" for="locale_esES">Locale esES</label> | ||
<textarea [formControlName]="'locale_esES'" id="locale_esES" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="form-group col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<label class="control-label" for="locale_esMX">Locale esMX</label> | ||
<textarea [formControlName]="'locale_esMX'" id="locale_esMX" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
<div class="form-group col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<label class="control-label" for="locale_ruRU">Locale ruRU</label> | ||
<textarea [formControlName]="'locale_ruRU'" id="locale_ruRU" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
} | ||
</div> |
20 changes: 20 additions & 0 deletions
20
libs/features/texts/src/acore-text/acore-string.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,20 @@ | ||
import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; | ||
import { ReactiveFormsModule } from '@angular/forms'; | ||
import { AcoreString } from '@keira/shared/acore-world-model'; | ||
import { SingleRowEditorComponent } from '@keira/shared/base-abstract-classes'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { TooltipModule } from 'ngx-bootstrap/tooltip'; | ||
import { AcoreStringHandlerService } from './acore-string-handler.service'; | ||
import { AcoreStringService } from './acore-string.service'; | ||
import { QueryOutputComponent, TopBarComponent } from '@keira/shared/base-editor-components'; | ||
|
||
@Component({ | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
templateUrl: './acore-string.component.html', | ||
standalone: true, | ||
imports: [TranslateModule, ReactiveFormsModule, TooltipModule, QueryOutputComponent, TopBarComponent], | ||
}) | ||
export class AcoreStringComponent extends SingleRowEditorComponent<AcoreString> { | ||
override readonly editorService = inject(AcoreStringService); | ||
protected override readonly handlerService = inject(AcoreStringHandlerService); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since Angular 14 we can access
protected
attributes also from the template, so there is very rarely a reason to usepublic
and when we don't it's just because it's old code :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change causes this error:
TS2415: Class AcoreStringComponent incorrectly extends base class SingleRowEditorComponent
Property editorService is protected in type AcoreStringComponent but public in type SingleRowEditorComponent<AcoreString
And changing the editor causes a follow up issue.
IMO; this is a separate problem to be addressed