Skip to content

Commit

Permalink
refactor: Reorganize CustomFields TypeScript & GraphQL types
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Jul 11, 2019
1 parent 3178578 commit e0583dd
Show file tree
Hide file tree
Showing 55 changed files with 852 additions and 530 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { combineLatest, Observable } from 'rxjs';
import { mergeMap, shareReplay, take } from 'rxjs/operators';
import { CustomFieldConfig } from 'shared/shared-types';

import { BaseDetailComponent } from '../../../common/base-detail.component';
import {
Collection,
ConfigurableOperation,
ConfigurableOperationInput,
CreateCollectionInput,
CustomFieldConfig,
FacetWithValues,
GetActiveChannel,
LanguageCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { ActivatedRoute, Router } from '@angular/router';
import { combineLatest, EMPTY, forkJoin, Observable } from 'rxjs';
import { map, mergeMap, switchMap, take } from 'rxjs/operators';
import { normalizeString } from 'shared/normalize-string';
import { CustomFieldConfig } from 'shared/shared-types';
import { notNullOrUndefined } from 'shared/shared-utils';

import { BaseDetailComponent } from '../../../common/base-detail.component';
import {
CreateFacetInput,
CreateFacetValueInput,
CustomFieldConfig,
DeletionResult,
FacetWithValues,
LanguageCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { ActivatedRoute, Router } from '@angular/router';
import { combineLatest, EMPTY, merge, Observable } from 'rxjs';
import { distinctUntilChanged, map, mergeMap, switchMap, take, withLatestFrom } from 'rxjs/operators';
import { normalizeString } from 'shared/normalize-string';
import { CustomFieldConfig } from 'shared/shared-types';
import { notNullOrUndefined } from 'shared/shared-utils';
import { unique } from 'shared/unique';
import { IGNORE_CAN_DEACTIVATE_GUARD } from 'src/app/shared/providers/routing/can-deactivate-detail-guard';

import { BaseDetailComponent } from '../../../common/base-detail.component';
import {
CreateProductInput,
CustomFieldConfig,
FacetWithValues,
LanguageCode,
ProductWithVariants,
Expand Down
13 changes: 6 additions & 7 deletions admin-ui/src/app/common/base-detail.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { FormGroup } from '@angular/forms';
import { ActivatedRoute, Data, Router } from '@angular/router';
import { combineLatest, Observable, of, Subject } from 'rxjs';
import { distinctUntilChanged, map, share, shareReplay, switchMap, takeUntil, tap } from 'rxjs/operators';
import { CustomFieldConfig, CustomFields } from 'shared/shared-types';
import { ActivatedRoute, Router } from '@angular/router';
import { combineLatest, Observable, Subject } from 'rxjs';
import { distinctUntilChanged, map, shareReplay, switchMap, takeUntil, tap } from 'rxjs/operators';

import { ServerConfigService } from '../data/server-config';

import { LanguageCode } from './generated-types';
import { CustomFieldConfig, CustomFields, LanguageCode } from './generated-types';
import { getDefaultLanguage } from './utilities/get-default-language';

export abstract class BaseDetailComponent<Entity extends { id: string; updatedAt?: string }> {
Expand Down Expand Up @@ -62,8 +61,8 @@ export abstract class BaseDetailComponent<Entity extends { id: string; updatedAt

protected abstract setFormValues(entity: Entity, languageCode: LanguageCode): void;

protected getCustomFieldConfig(key: keyof CustomFields): CustomFieldConfig[] {
return this.serverConfigService.serverConfig.customFields[key] || [];
protected getCustomFieldConfig(key: Exclude<keyof CustomFields, '__typename'>): CustomFieldConfig[] {
return this.serverConfigService.serverConfig.customFieldConfig[key] || [];
}

protected setQueryParam(key: string, value: any) {
Expand Down
Loading

0 comments on commit e0583dd

Please sign in to comment.