-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(storefront): Use server pagination for facet detail page
Fixes #2576
- Loading branch information
1 parent
4f42cf1
commit 6ca3265
Showing
28 changed files
with
238 additions
and
209 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
24 changes: 24 additions & 0 deletions
24
...catalog/src/components/create-facet-value-dialog/create-facet-value-dialog.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,24 @@ | ||
<ng-template vdrDialogTitle> | ||
{{ 'catalog.create-facet-value' | translate }} | ||
</ng-template> | ||
<div class="form-grid" [formGroup]="form"> | ||
<vdr-form-field [label]="'common.name' | translate" for="name"> | ||
<input id="name" type="text" formControlName="name" (input)="updateCode()" /> | ||
</vdr-form-field> | ||
<vdr-form-field | ||
[label]="'common.code' | translate" | ||
for="code" | ||
> | ||
<input | ||
id="code" | ||
type="text" | ||
formControlName="code" | ||
/> | ||
</vdr-form-field> | ||
</div> | ||
<ng-template vdrDialogButtons> | ||
<button type="button" class="btn" (click)="cancel()">{{ 'common.cancel' | translate }}</button> | ||
<button type="submit" (click)="confirm()" class="btn btn-primary" [disabled]="form.invalid"> | ||
{{ 'common.confirm' | translate }} | ||
</button> | ||
</ng-template> |
Empty file.
46 changes: 46 additions & 0 deletions
46
...b/catalog/src/components/create-facet-value-dialog/create-facet-value-dialog.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,46 @@ | ||
import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
import { FormBuilder, Validators } from '@angular/forms'; | ||
import { CreateFacetValueInput, Dialog, LanguageCode } from '@vendure/admin-ui/core'; | ||
|
||
import { normalizeString } from '@vendure/common/lib/normalize-string'; | ||
|
||
@Component({ | ||
selector: 'vdr-create-facet-value-dialog', | ||
templateUrl: './create-facet-value-dialog.component.html', | ||
styleUrls: ['./create-facet-value-dialog.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class CreateFacetValueDialogComponent implements Dialog<CreateFacetValueInput> { | ||
resolveWith: (result?: CreateFacetValueInput) => void; | ||
languageCode: LanguageCode; | ||
form = this.formBuilder.group({ | ||
name: ['', Validators.required], | ||
code: ['', Validators.required], | ||
}); | ||
facetId: string; | ||
constructor(private formBuilder: FormBuilder) {} | ||
|
||
updateCode() { | ||
const nameControl = this.form.get('name'); | ||
const codeControl = this.form.get('code'); | ||
if (nameControl && codeControl && codeControl.pristine) { | ||
codeControl.setValue(normalizeString(`${nameControl.value}`, '-')); | ||
} | ||
} | ||
|
||
confirm() { | ||
const { name, code } = this.form.value; | ||
if (!name || !code) { | ||
return; | ||
} | ||
this.resolveWith({ | ||
facetId: this.facetId, | ||
code, | ||
translations: [{ languageCode: this.languageCode, name }], | ||
}); | ||
} | ||
|
||
cancel() { | ||
this.resolveWith(); | ||
} | ||
} |
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.