-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e61072c
commit 0734950
Showing
16 changed files
with
577 additions
and
298 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
registry=https://registry.npmjs.org/ |
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 @@ | ||
registry=https://registry.npmjs.org/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
34 changes: 34 additions & 0 deletions
34
nlp/admin/web/src/app/intents/intents-filters/intents-filters.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,34 @@ | ||
<nb-card class="mt-3 mb-2"> | ||
<nb-card-body> | ||
<form | ||
class="grid" | ||
[formGroup]="form" | ||
> | ||
<nb-form-field> | ||
<nb-icon | ||
nbPrefix | ||
icon="search-outline" | ||
></nb-icon> | ||
<input | ||
nbInput | ||
fullWidth | ||
fieldSize="medium" | ||
placeholder="Search intent" | ||
type="text" | ||
formControlName="search" | ||
/> | ||
<button | ||
*ngIf="!!search.value" | ||
nbButton | ||
nbSuffix | ||
nbTooltip="Clear" | ||
ghost | ||
(click)="clearSearch()" | ||
data-testid="clear-button" | ||
> | ||
<nb-icon icon="close-outline"></nb-icon> | ||
</button> | ||
</nb-form-field> | ||
</form> | ||
</nb-card-body> | ||
</nb-card> |
Empty file.
23 changes: 23 additions & 0 deletions
23
nlp/admin/web/src/app/intents/intents-filters/intents-filters.component.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,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { IntentsFiltersComponent } from './intents-filters.component'; | ||
|
||
describe('IntentsFiltersComponent', () => { | ||
let component: IntentsFiltersComponent; | ||
let fixture: ComponentFixture<IntentsFiltersComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ IntentsFiltersComponent ] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(IntentsFiltersComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
45 changes: 45 additions & 0 deletions
45
nlp/admin/web/src/app/intents/intents-filters/intents-filters.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,45 @@ | ||
import { Component, EventEmitter, OnDestroy, OnInit, Output } from '@angular/core'; | ||
import { FormControl, FormGroup } from '@angular/forms'; | ||
import { debounceTime, Subject, takeUntil } from 'rxjs'; | ||
|
||
interface IntentsFilterForm { | ||
search: FormControl<string>; | ||
} | ||
|
||
export interface IntentsFilter { | ||
search: string; | ||
} | ||
|
||
@Component({ | ||
selector: 'tock-intents-filters', | ||
templateUrl: './intents-filters.component.html', | ||
styleUrls: ['./intents-filters.component.scss'] | ||
}) | ||
export class IntentsFiltersComponent implements OnInit, OnDestroy { | ||
private readonly destroy$: Subject<boolean> = new Subject(); | ||
|
||
@Output() onFilter = new EventEmitter<IntentsFilter>(); | ||
|
||
form = new FormGroup<IntentsFilterForm>({ | ||
search: new FormControl() | ||
}); | ||
|
||
get search(): FormControl { | ||
return this.form.get('search') as FormControl; | ||
} | ||
|
||
ngOnInit(): void { | ||
this.form.valueChanges.pipe(takeUntil(this.destroy$), debounceTime(300)).subscribe(() => { | ||
this.onFilter.emit(this.form.value as IntentsFilter); | ||
}); | ||
} | ||
|
||
clearSearch(): void { | ||
this.search.reset(); | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.destroy$.next(true); | ||
this.destroy$.complete(); | ||
} | ||
} |
173 changes: 173 additions & 0 deletions
173
nlp/admin/web/src/app/intents/intents-list/intents-list.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,173 @@ | ||
<div | ||
*ngIf="intents.length" | ||
class="table-list table-list-header" | ||
> | ||
<div class="table-list-entry">Intent</div> | ||
<div class="table-list-entry bordered text-center">Entities</div> | ||
<div class="table-list-entry bordered text-center">Shared Intents</div> | ||
<div class="table-list-entry bordered text-center">Mandatory States</div> | ||
<div class="table-list-entry text-center">Actions</div> | ||
</div> | ||
<div | ||
class="table-list" | ||
*ngFor="let intent of intents" | ||
> | ||
<div class="table-list-entry"> | ||
<div class="font-weight-bold"> | ||
<span nbTooltip="{{ intent.qualifiedName() }}"> | ||
{{ state.isOtherNamespaceIntent(intent) ? intent.qualifiedName() : intent.intentLabel() }} | ||
</span> | ||
<span | ||
class="ml-2 valign-middle" | ||
*ngIf="state.intentExistsInOtherApplication(intent.name)" | ||
nbTooltip="This intent is shared between at least one other application. All changes to the intent will also affect the other applications that use this intent." | ||
> | ||
<nb-icon icon="share-outline"></nb-icon> | ||
</span> | ||
</div> | ||
<span class="text-muted">{{ intent.description }}</span> | ||
</div> | ||
|
||
<div class="table-list-entry bordered text-center"> | ||
<span | ||
class="tag" | ||
*ngFor="let e of intent.entities" | ||
[style.background-color]="e.entityColor" | ||
[style.color]="getContrastYIQ(e.entityColor)" | ||
> | ||
<div | ||
class="ellipsis" | ||
nbTooltip="{{ e.qualifiedName(state.user) }}" | ||
> | ||
{{ e.qualifiedName(state.user) }} | ||
</div> | ||
<button | ||
*ngIf="!state.intentExistsInOtherApplication(intent.name) && !state.isOtherNamespaceIntent(intent)" | ||
nbButton | ||
ghost | ||
size="tiny" | ||
shape="round" | ||
(click)="removeEntity(intent, e)" | ||
nbTooltip="Delete entity" | ||
[style.color]="getContrastYIQ(e.entityColor)" | ||
> | ||
<nb-icon icon="close-outline"></nb-icon> | ||
</button> | ||
</span> | ||
</div> | ||
|
||
<div class="table-list-entry bordered text-center"> | ||
<ng-container *ngIf="!state.isOtherNamespaceIntent(intent)"> | ||
<span | ||
class="tag" | ||
*ngFor="let intentId of intent.sharedIntents" | ||
> | ||
<div | ||
class="ellipsis" | ||
nbTooltip="{{ state.findIntentById(intentId)?.name }}" | ||
> | ||
{{ state.findIntentById(intentId)?.name }} | ||
</div> | ||
<button | ||
*ngIf="!state.intentExistsInOtherApplication(intent.name)" | ||
nbButton | ||
ghost | ||
size="tiny" | ||
shape="round" | ||
(click)="removeSharedIntent(intent, intentId)" | ||
nbTooltip="Remove shared intent" | ||
> | ||
<nb-icon icon="close-outline"></nb-icon> | ||
</button> | ||
</span> | ||
</ng-container> | ||
|
||
<button | ||
*ngIf="!state.isOtherNamespaceIntent(intent)" | ||
nbButton | ||
ghost | ||
shape="round" | ||
size="small" | ||
nbTooltip="Add shared intent" | ||
(click)="displayAddSharedIntentDialog(intent)" | ||
> | ||
<nb-icon icon="plus-circle-outline"></nb-icon> | ||
</button> | ||
</div> | ||
|
||
<div class="table-list-entry bordered text-center"> | ||
<ng-container *ngIf="!state.isOtherNamespaceIntent(intent)"> | ||
<span | ||
class="tag" | ||
*ngFor="let s of intent.mandatoryStates" | ||
> | ||
<div | ||
class="ellipsis" | ||
nbTooltip="{{ s }}" | ||
> | ||
{{ s }} | ||
</div> | ||
<button | ||
*ngIf="!state.intentExistsInOtherApplication(intent.name)" | ||
nbButton | ||
ghost | ||
size="tiny" | ||
shape="round" | ||
(click)="removeState(intent, s)" | ||
nbTooltip="Delete State" | ||
> | ||
<nb-icon icon="close-outline"></nb-icon> | ||
</button> | ||
</span> | ||
</ng-container> | ||
|
||
<button | ||
*ngIf="!state.intentExistsInOtherApplication(intent.name) && !state.isOtherNamespaceIntent(intent)" | ||
nbButton | ||
ghost | ||
shape="round" | ||
size="small" | ||
nbTooltip="Add state" | ||
(click)="addState(intent)" | ||
> | ||
<nb-icon icon="plus-circle-outline"></nb-icon> | ||
</button> | ||
</div> | ||
|
||
<div class="table-list-entry text-center"> | ||
<div | ||
class="d-flex justify-content-center" | ||
*ngIf="!state.isOtherNamespaceIntent(intent)" | ||
> | ||
<button | ||
nbButton | ||
ghost | ||
shape="round" | ||
nbTooltip="Edit the intent" | ||
(click)="updateIntent(intent)" | ||
> | ||
<nb-icon icon="edit-outline"></nb-icon> | ||
</button> | ||
<button | ||
*ngIf="state.hasRole(UserRole.admin)" | ||
nbButton | ||
ghost | ||
shape="round" | ||
nbTooltip="Download a sentences dump" | ||
(click)="downloadSentencesDump(intent)" | ||
> | ||
<nb-icon icon="download-outline"></nb-icon> | ||
</button> | ||
<button | ||
nbButton | ||
ghost | ||
shape="round" | ||
status="danger" | ||
nbTooltip="Delete the intent" | ||
(click)="deleteIntent(intent)" | ||
> | ||
<nb-icon icon="trash-2-outline"></nb-icon> | ||
</button> | ||
</div> | ||
</div> | ||
</div> |
39 changes: 39 additions & 0 deletions
39
nlp/admin/web/src/app/intents/intents-list/intents-list.component.scss
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,39 @@ | ||
.table-list { | ||
display: grid; | ||
grid-template-columns: 2fr 1fr 1fr 1fr 8rem; | ||
column-gap: 0.5rem; | ||
min-width: 50rem; | ||
|
||
&.table-list-header { | ||
font-size: smaller; | ||
font-weight: bold; | ||
opacity: 0.6; | ||
} | ||
&:not(:last-child) { | ||
.table-list-entry { | ||
border-bottom: 1px solid var(--border-basic-color-3); | ||
} | ||
} | ||
|
||
.table-list-entry { | ||
min-width: 8rem; | ||
padding: 1rem 0; | ||
&.bordered { | ||
border-right: 1px solid var(--border-basic-color-3); | ||
} | ||
} | ||
} | ||
|
||
.tag { | ||
display: inline-flex; | ||
width: fit-content; | ||
max-width: 8rem; | ||
padding: 0rem 0.3rem 0rem 0.9rem; | ||
margin-right: 2px; | ||
margin-bottom: 2px; | ||
border-radius: 10rem; | ||
background-color: var(--border-basic-color-3); | ||
font-size: 0.7rem; | ||
line-height: 1.25rem; | ||
white-space: nowrap; | ||
} |
Oops, something went wrong.