Skip to content
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

Release #2794

Merged
merged 6 commits into from Jan 15, 2021
Merged

Release #2794

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/api/src/app/app.module.ts
Expand Up @@ -123,14 +123,14 @@ import { ReportModule } from './reports/report.module';
import { EmployeeProposalTemplateModule } from './employee-proposal-template/employee-proposal-template.module';
import { CustomSmtpModule } from './custom-smtp/custom-smtp.module';
import { FeatureModule } from './feature/feature.module';
import * as unleash from 'unleash-client';
import { Integrations as SentryIntegrations } from '@sentry/node';
import { Integrations as TrackingIntegrations } from '@sentry/tracing';
import { initialize as initializeUnleash } from 'unleash-client';

const { unleashConfig } = environment;

if (unleashConfig.url) {
const instance = unleash.initialize({
const instance = initializeUnleash({
appName: unleashConfig.appName,
url: unleashConfig.url,
instanceId: unleashConfig.instanceId,
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/app/feature/feature-toggle.controller.ts
Expand Up @@ -10,8 +10,8 @@ import {
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { Feature } from './feature.entity';
import { FeatureService } from './feature.service';
import * as unleash from 'unleash-client';
import { FeatureInterface } from 'unleash-client/lib/feature';
import { getFeatureToggleDefinitions } from 'unleash-client';
import { TenantPermissionGuard } from '../shared/guards/auth/tenant-permission.guard';
import { AuthGuard } from '@nestjs/passport';
import { FeatureEnum, IFeatureOrganizationUpdateInput } from '@gauzy/models';
Expand All @@ -28,7 +28,7 @@ export class FeaturesToggleController {

@Get()
async get() {
let featureToggles: FeatureInterface[] = unleash.getFeatureToggleDefinitions();
let featureToggles: FeatureInterface[] = getFeatureToggleDefinitions();

//only support gauzy feature and removed other
const featureEnums: string[] = Object.values(FeatureEnum);
Expand Down
8 changes: 7 additions & 1 deletion apps/api/src/app/product-variant/product-variant.entity.ts
Expand Up @@ -18,7 +18,8 @@ import { IsNumber, IsString, IsOptional, IsEnum } from 'class-validator';
import { TenantOrganizationBase } from '../core/entities/tenant-organization-base';

@Entity('product_variant')
export class ProductVariant extends TenantOrganizationBase
export class ProductVariant
extends TenantOrganizationBase
implements IProductVariant {
@ApiProperty({ type: Number })
@IsNumber()
Expand Down Expand Up @@ -87,4 +88,9 @@ export class ProductVariant extends TenantOrganizationBase
})
@JoinColumn()
product: Product;

@ApiPropertyOptional({ type: String })
@IsOptional()
@Column({ nullable: true })
imageUrl: string;
}
Expand Up @@ -95,9 +95,9 @@ <h5>
>
<nb-option
*ngFor="let lang of languages"
[value]="lang.code"
[value]="lang.value"
>
{{ lang.title }}
{{ lang.name }}
</nb-option>
</nb-select>
</div>
Expand Down
Expand Up @@ -2,6 +2,7 @@ import { TranslationBaseComponent } from '../../language-base/translation-base.c
import { Component, OnInit, Input, OnDestroy } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import {
ILanguage,
IOrganization,
IProductCategoryTranslatable,
IProductCategoryTranslation,
Expand Down Expand Up @@ -34,7 +35,7 @@ export class ProductCategoryMutationComponent

private _ngDestroy$ = new Subject<void>();

languages: Array<object>;
languages: ILanguage[];
translations = [];
activeTranslation: IProductCategoryTranslation;
organization: IOrganization;
Expand All @@ -54,18 +55,21 @@ export class ProductCategoryMutationComponent
this.organization = this.store.selectedOrganization;
this.selectedLanguage =
this.store.preferredLanguage || LanguagesEnum.ENGLISH;

this.translations = this.productCategory
? this.productCategory.translations
: [];
this.setActiveTranslation();

this._initializeForm();
this.languages = this.translateService.getLangs().map((l) => ({
code: l,
title: Object.keys(LanguagesEnum).find(
(lang) => LanguagesEnum[lang] === l
)
}));

this.languages = this.store.systemLanguages.map((item) => {
return {
value: item.code,
name: item.name
};
});

this.form.valueChanges
.pipe(takeUntil(this._ngDestroy$))
.subscribe((formValue) => {
Expand Down
Expand Up @@ -30,8 +30,11 @@ <h5>
[selected]="selectedLanguage"
(selectedChange)="onLangChange($event)"
>
<nb-option *ngFor="let lang of languages" [value]="lang">
{{ lang }}
<nb-option
*ngFor="let lang of languages"
[value]="lang.value"
>
{{ lang.name }}
</nb-option>
</nb-select>
</div>
Expand Down
Expand Up @@ -6,7 +6,8 @@ import {
LanguagesEnum,
IProductTypeTranslation,
IProductTypeTranslatable,
IOrganization
IOrganization,
ILanguage
} from '@gauzy/models';
import { TranslateService } from '@ngx-translate/core';
import { ProductTypeService } from '../../../@core/services/product-type.service';
Expand All @@ -20,15 +21,17 @@ import { takeUntil } from 'rxjs/operators';
templateUrl: './product-type-mutation.component.html',
styleUrls: ['./product-type-mutation.component.scss']
})
export class ProductTypeMutationComponent extends TranslationBaseComponent
export class ProductTypeMutationComponent
extends TranslationBaseComponent
implements OnInit, OnDestroy {
form: FormGroup;
@Input() productType: IProductTypeTranslatable;
icons = Object.values(ProductTypesIconsEnum);

selectedIcon: string = ProductTypesIconsEnum.STAR;
selectedLanguage: string;
languages: Array<string>;

languages: ILanguage[];
private _ngDestroy$ = new Subject<void>();

translations = [];
Expand All @@ -49,13 +52,20 @@ export class ProductTypeMutationComponent extends TranslationBaseComponent
this.organization = this.store.selectedOrganization;
this.selectedLanguage =
this.store.preferredLanguage || LanguagesEnum.ENGLISH;

this.translations = this.productType
? this.productType.translations
: [];
this.setActiveTranslation();

this._initializeForm();
this.languages = this.translateService.getLangs();

this.languages = this.store.systemLanguages.map((item) => {
return {
value: item.code,
name: item.name
};
});

this.form.valueChanges
.pipe(takeUntil(this._ngDestroy$))
Expand Down
Expand Up @@ -73,14 +73,22 @@ <h5>
></div>

<img
*ngIf="!!form"
*ngIf="form && !form.get('imageUrl').value"
[src]="
'https://afostats.imagead.net/uploads/afo/no_img.png'
"
alt="Product Item Photo"
(mouseenter)="hoverState = true"
(mouseleave)="hoverState = false"
/>

<img
*ngIf="form && form.get('imageUrl').value"
[src]="form.get('imageUrl').value"
alt="Product Item Photo"
(mouseenter)="hoverState = true"
(mouseleave)="hoverState = false"
/>
</div>
</div>
</div>
Expand Down
Expand Up @@ -86,7 +86,7 @@ export class InventoryVariantFormComponent

private _initializeForm() {
this.form = this.fb.group({
imageUrl: [],
imageUrl: [this.itemVariant ? this.itemVariant.imageUrl : null],
internationalReference: [
this.itemVariant ? this.itemVariant.internalReference : '',
[Validators.required]
Expand Down Expand Up @@ -182,6 +182,7 @@ export class InventoryVariantFormComponent
taxes: formValue['taxes'],
enabled: formValue['enabled'],
notes: formValue['notes'],
imageUrl: formValue['imageUrl'],
organizationId,
tenantId
},
Expand Down Expand Up @@ -235,5 +236,7 @@ export class InventoryVariantFormComponent
}

//tstodo
handleImageUploadError(event: any) {}
handleImageUploadError(event: any) {
alert('error upload image');
}
}
Expand Up @@ -439,6 +439,7 @@ <h5>
(selectedTagsEvent)="
selectedTagsEvent($event)
"
[isOrgLevel]="true"
>
</ga-tags-color-input>
</div>
Expand Down
Expand Up @@ -11,6 +11,7 @@ import { DeleteConfirmationComponent } from 'apps/gauzy/src/app/@shared/user/for
import { ProductVariantService } from 'apps/gauzy/src/app/@core/services/product-variant.service';
import { EnabledStatusComponent } from '../../table-components/enabled-row.component';
import { ToastrService } from 'apps/gauzy/src/app/@core/services/toastr.service';
import { ImageRowComponent } from '../../table-components/image-row.component';

export interface SelectedProductVariant {
data: IProductVariant;
Expand Down Expand Up @@ -65,6 +66,11 @@ export class VariantTableComponent
this.settingsSmartTable = {
actions: false,
columns: {
image: {
title: this.getTranslation('INVENTORY_PAGE.IMAGE'),
type: 'custom',
renderComponent: ImageRowComponent
},
options: {
title: this.getTranslation('INVENTORY_PAGE.OPTIONS'),
type: 'string',
Expand Down
Expand Up @@ -66,7 +66,7 @@ export class TableInventoryComponent
this._applyTranslationOnSmartTable();
this.selectedLanguage = this.translateService.currentLang;
this.translateService.onLangChange
.pipe(take(1))
.pipe(untilDestroyed(this))
.subscribe((languageEvent) => {
this.selectedLanguage = languageEvent.lang;
});
Expand Down
2 changes: 1 addition & 1 deletion apps/gauzy/src/assets/i18n/ru.json
Expand Up @@ -843,7 +843,7 @@
"COSMIC": "Космический",
"CORPORATE": "Корпоративный",
"LANGUAGE": "Язык",
"ENGLISH": "Russian",
"ENGLISH": "Английский",
"BULGARIAN": "Болгарский",
"HEBREW": "Иврит",
"RUSSIAN": "Русский",
Expand Down
1 change: 1 addition & 0 deletions libs/models/src/lib/product.model.ts
Expand Up @@ -88,6 +88,7 @@ export interface IProductVariant
quantity: number;
billingInvoicingPolicy: string;
internalReference: string;
imageUrl: string;
options: IProductOption[];
settings: IProductVariantSetting;
product?: IProduct;
Expand Down