Skip to content

Commit c2e7d2c

Browse files
Merge pull request #573 from OneSila/development
Hotfix visual issue edit remote property + better loading in matrix
2 parents ec1161f + a17ddbe commit c2e7d2c

File tree

19 files changed

+220
-111
lines changed

19 files changed

+220
-111
lines changed

src/core/integrations/integrations/integrations-show/containers/properties/containers/amazon-properties/configs.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,16 @@ export const amazonPropertiesSearchConfigConstructor = (t: Function): SearchConf
6262
{
6363
type: FieldType.Choice,
6464
name: 'type',
65-
label: t('products.products.labels.type.title'),
65+
label: t('integrations.show.properties.labels.currentType'),
66+
labelBy: 'name',
67+
valueBy: 'code',
68+
options: getPropertyTypeOptions(t),
69+
addLookup: true
70+
},
71+
{
72+
type: FieldType.Choice,
73+
name: 'originalType',
74+
label: t('integrations.show.properties.labels.originalType'),
6675
labelBy: 'name',
6776
valueBy: 'code',
6877
options: getPropertyTypeOptions(t),

src/core/integrations/integrations/integrations-show/containers/properties/containers/amazon-properties/containers/AmazonEditProperty.vue

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const formConfig = ref<FormConfig | null>(null);
4040
const formData = ref<Record<string, any>>({});
4141
const propertyType = ref<string | null>(null);
4242
const originalType = ref<string | null>(null);
43+
const initialCurrentType = ref<string | null>(null);
4344
const originalAllowsUnmappedValues = ref<boolean | null>(null);
4445
const localPropertyType = ref<string | null>(null);
4546
const localTypeCache = new Map<string, string>();
@@ -230,6 +231,28 @@ const updateLocalInstanceHelp = () => {
230231
field.secondaryHelpClass = typeCompatibility.value.compatible ? 'text-orange-600' : 'text-red-600';
231232
};
232233
234+
const updateCurrentTypeHelp = () => {
235+
if (!formConfig.value) {
236+
return;
237+
}
238+
239+
const field = formConfig.value.fields.find((item) => item.name === 'type');
240+
if (!field) {
241+
return;
242+
}
243+
244+
if (!initialCurrentType.value || !localPropertyType.value || initialCurrentType.value === localPropertyType.value) {
245+
delete field.secondaryHelp;
246+
delete field.secondaryHelpClass;
247+
return;
248+
}
249+
250+
field.secondaryHelp = t('integrations.show.properties.help.currentTypeWillBecome', {
251+
type: mappedTypeLabel.value,
252+
});
253+
field.secondaryHelpClass = 'text-orange-600';
254+
};
255+
233256
const insertFieldsAfter = (afterName: string, fieldsToAdd: any[]) => {
234257
if (!formConfig.value) {
235258
return;
@@ -391,6 +414,7 @@ const handleSetData = (data: any) => {
391414
}
392415
393416
originalType.value = propertyData?.originalType || currentType;
417+
initialCurrentType.value = currentType;
394418
originalAllowsUnmappedValues.value = propertyData?.allowsUnmappedValues ?? null;
395419
propertyType.value = originalType.value;
396420
if (formData.value) {
@@ -422,6 +446,7 @@ const handleSetData = (data: any) => {
422446
423447
syncBooleanTextFields(currentType);
424448
updateLocalInstanceHelp();
449+
updateCurrentTypeHelp();
425450
};
426451
427452
const handleFormUpdate = (form: Record<string, any>) => {
@@ -431,10 +456,8 @@ const handleFormUpdate = (form: Record<string, any>) => {
431456
watch(localInstanceId, async (nextId) => {
432457
if (!nextId) {
433458
localPropertyType.value = null;
434-
if (originalType.value) {
435-
formData.value.type = originalType.value;
436-
}
437459
updateLocalInstanceHelp();
460+
updateCurrentTypeHelp();
438461
syncBooleanTextFields();
439462
hasInitializedLocalInstance.value = true;
440463
return;
@@ -460,20 +483,15 @@ watch(localInstanceId, async (nextId) => {
460483
if (compatibility && !compatibility.compatible) {
461484
formData.value.localInstance = null;
462485
localPropertyType.value = null;
463-
if (originalType.value) {
464-
formData.value.type = originalType.value;
465-
}
466486
updateLocalInstanceHelp();
487+
updateCurrentTypeHelp();
467488
syncBooleanTextFields();
468489
hasInitializedLocalInstance.value = true;
469490
return;
470491
}
471492
472-
if (nextType) {
473-
formData.value.type = nextType;
474-
}
475-
476493
updateLocalInstanceHelp();
494+
updateCurrentTypeHelp();
477495
syncBooleanTextFields();
478496
hasInitializedLocalInstance.value = true;
479497
});
@@ -552,7 +570,7 @@ const selectRecommendation = (id: string) => {
552570
:path="{ name: 'properties.properties.create', query: {
553571
remoteRuleId,
554572
name: formData.name,
555-
type: formData.type,
573+
type: localPropertyType || formData.type,
556574
remoteWizard: isWizard ? '1' : '0',
557575
...(amazonCreateValue ? { amazonCreateValue } : {}),
558576
...extractPrefixedQueryParams(route.query, 'next__'),

src/core/integrations/integrations/integrations-show/containers/properties/containers/ebay-properties/configs.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,16 @@ export const ebayPropertiesSearchConfigConstructor = (t: Function, salesChannelI
7878
{
7979
type: FieldType.Choice,
8080
name: 'type',
81-
label: t('products.products.labels.type.title'),
81+
label: t('integrations.show.properties.labels.currentType'),
82+
labelBy: 'name',
83+
valueBy: 'code',
84+
options: getPropertyTypeOptions(t),
85+
addLookup: true,
86+
},
87+
{
88+
type: FieldType.Choice,
89+
name: 'originalType',
90+
label: t('integrations.show.properties.labels.originalType'),
8291
labelBy: 'name',
8392
valueBy: 'code',
8493
options: getPropertyTypeOptions(t),

src/core/integrations/integrations/integrations-show/containers/properties/containers/ebay-properties/containers/EbayEditProperty.vue

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const formConfig = ref<FormConfig | null>(null);
3636
const formData = ref<Record<string, any>>({});
3737
const propertyType = ref<string | null>(null);
3838
const originalType = ref<string | null>(null);
39+
const initialCurrentType = ref<string | null>(null);
3940
const originalAllowsUnmappedValues = ref<boolean | null>(null);
4041
const localPropertyType = ref<string | null>(null);
4142
const localTypeCache = new Map<string, string>();
@@ -249,6 +250,28 @@ const updateLocalInstanceHelp = () => {
249250
field.secondaryHelpClass = typeCompatibility.value.compatible ? 'text-orange-600' : 'text-red-600';
250251
};
251252
253+
const updateCurrentTypeHelp = () => {
254+
if (!formConfig.value) {
255+
return;
256+
}
257+
258+
const field = formConfig.value.fields.find((item) => item.name === 'type');
259+
if (!field) {
260+
return;
261+
}
262+
263+
if (!initialCurrentType.value || !localPropertyType.value || initialCurrentType.value === localPropertyType.value) {
264+
delete field.secondaryHelp;
265+
delete field.secondaryHelpClass;
266+
return;
267+
}
268+
269+
field.secondaryHelp = t('integrations.show.properties.help.currentTypeWillBecome', {
270+
type: mappedTypeLabel.value,
271+
});
272+
field.secondaryHelpClass = 'text-orange-600';
273+
};
274+
252275
const insertFieldsAfter = (afterName: string, fieldsToAdd: any[]) => {
253276
if (!formConfig.value) {
254277
return;
@@ -411,6 +434,7 @@ const handleSetData = (data: any) => {
411434
}
412435
413436
originalType.value = data?.ebayProperty?.originalType || currentType;
437+
initialCurrentType.value = currentType;
414438
originalAllowsUnmappedValues.value = data?.ebayProperty?.allowsUnmappedValues ?? null;
415439
propertyType.value = originalType.value;
416440
if (formData.value) {
@@ -450,6 +474,7 @@ const handleSetData = (data: any) => {
450474
451475
syncBooleanTextFields(currentType);
452476
updateLocalInstanceHelp();
477+
updateCurrentTypeHelp();
453478
};
454479
455480
const handleFormUpdate = (form: Record<string, any>) => {
@@ -459,10 +484,8 @@ const handleFormUpdate = (form: Record<string, any>) => {
459484
watch(localInstanceId, async (nextId) => {
460485
if (!nextId) {
461486
localPropertyType.value = null;
462-
if (originalType.value) {
463-
formData.value.type = originalType.value;
464-
}
465487
updateLocalInstanceHelp();
488+
updateCurrentTypeHelp();
466489
syncBooleanTextFields();
467490
hasInitializedLocalInstance.value = true;
468491
return;
@@ -488,20 +511,15 @@ watch(localInstanceId, async (nextId) => {
488511
if (compatibility && !compatibility.compatible) {
489512
formData.value.localInstance = null;
490513
localPropertyType.value = null;
491-
if (originalType.value) {
492-
formData.value.type = originalType.value;
493-
}
494514
updateLocalInstanceHelp();
515+
updateCurrentTypeHelp();
495516
syncBooleanTextFields();
496517
hasInitializedLocalInstance.value = true;
497518
return;
498519
}
499520
500-
if (nextType) {
501-
formData.value.type = nextType;
502-
}
503-
504521
updateLocalInstanceHelp();
522+
updateCurrentTypeHelp();
505523
syncBooleanTextFields();
506524
hasInitializedLocalInstance.value = true;
507525
});
@@ -610,7 +628,7 @@ const selectRecommendation = (id: string) => {
610628
remoteRuleId,
611629
...(formData.localizedName ? { name: formData.localizedName } : {}),
612630
...(formData.translatedName ? { translatedName: formData.translatedName } : {}),
613-
...(formData.type ? { type: formData.type } : {}),
631+
...(localPropertyType || formData.type ? { type: localPropertyType || formData.type } : {}),
614632
remoteWizard: isWizard ? '1' : '0',
615633
...extractPrefixedQueryParams(route.query, 'next__'),
616634
},

src/core/integrations/integrations/integrations-show/containers/properties/containers/shein-properties/configs.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,16 @@ export const sheinPropertiesSearchConfigConstructor = (t: Function): SearchConfi
9292
{
9393
type: FieldType.Choice,
9494
name: 'type',
95-
label: t('products.products.labels.type.title'),
95+
label: t('integrations.show.properties.labels.currentType'),
96+
labelBy: 'name',
97+
valueBy: 'code',
98+
options: getPropertyTypeOptions(t),
99+
addLookup: true,
100+
},
101+
{
102+
type: FieldType.Choice,
103+
name: 'originalType',
104+
label: t('integrations.show.properties.labels.originalType'),
96105
labelBy: 'name',
97106
valueBy: 'code',
98107
options: getPropertyTypeOptions(t),

src/core/integrations/integrations/integrations-show/containers/properties/containers/shein-properties/containers/SheinEditProperty.vue

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const formConfig = ref<FormConfig | null>(null);
3636
const formData = ref<Record<string, any>>({});
3737
const propertyType = ref<string | null>(null);
3838
const originalType = ref<string | null>(null);
39+
const initialCurrentType = ref<string | null>(null);
3940
const originalAllowsUnmappedValues = ref<boolean | null>(null);
4041
const localPropertyType = ref<string | null>(null);
4142
const localTypeCache = new Map<string, string>();
@@ -231,6 +232,28 @@ const updateLocalInstanceHelp = () => {
231232
field.secondaryHelpClass = typeCompatibility.value.compatible ? 'text-orange-600' : 'text-red-600';
232233
};
233234
235+
const updateCurrentTypeHelp = () => {
236+
if (!formConfig.value) {
237+
return;
238+
}
239+
240+
const field = formConfig.value.fields.find((item) => item.name === 'type');
241+
if (!field) {
242+
return;
243+
}
244+
245+
if (!initialCurrentType.value || !localPropertyType.value || initialCurrentType.value === localPropertyType.value) {
246+
delete field.secondaryHelp;
247+
delete field.secondaryHelpClass;
248+
return;
249+
}
250+
251+
field.secondaryHelp = t('integrations.show.properties.help.currentTypeWillBecome', {
252+
type: mappedTypeLabel.value,
253+
});
254+
field.secondaryHelpClass = 'text-orange-600';
255+
};
256+
234257
const insertFieldsAfter = (afterName: string, fieldsToAdd: any[]) => {
235258
if (!formConfig.value) {
236259
return;
@@ -393,6 +416,7 @@ const handleSetData = (data: any) => {
393416
}
394417
395418
originalType.value = data?.sheinProperty?.originalType || currentType;
419+
initialCurrentType.value = currentType;
396420
originalAllowsUnmappedValues.value = data?.sheinProperty?.allowsUnmappedValues ?? null;
397421
propertyType.value = originalType.value;
398422
if (formData.value) {
@@ -426,6 +450,7 @@ const handleSetData = (data: any) => {
426450
427451
syncBooleanTextFields(currentType);
428452
updateLocalInstanceHelp();
453+
updateCurrentTypeHelp();
429454
};
430455
431456
const handleFormUpdate = (form: Record<string, any>) => {
@@ -435,10 +460,8 @@ const handleFormUpdate = (form: Record<string, any>) => {
435460
watch(localInstanceId, async (nextId) => {
436461
if (!nextId) {
437462
localPropertyType.value = null;
438-
if (originalType.value) {
439-
formData.value.type = originalType.value;
440-
}
441463
updateLocalInstanceHelp();
464+
updateCurrentTypeHelp();
442465
syncBooleanTextFields();
443466
hasInitializedLocalInstance.value = true;
444467
return;
@@ -464,20 +487,15 @@ watch(localInstanceId, async (nextId) => {
464487
if (compatibility && !compatibility.compatible) {
465488
formData.value.localInstance = null;
466489
localPropertyType.value = null;
467-
if (originalType.value) {
468-
formData.value.type = originalType.value;
469-
}
470490
updateLocalInstanceHelp();
491+
updateCurrentTypeHelp();
471492
syncBooleanTextFields();
472493
hasInitializedLocalInstance.value = true;
473494
return;
474495
}
475496
476-
if (nextType) {
477-
formData.value.type = nextType;
478-
}
479-
480497
updateLocalInstanceHelp();
498+
updateCurrentTypeHelp();
481499
syncBooleanTextFields();
482500
hasInitializedLocalInstance.value = true;
483501
});
@@ -575,7 +593,7 @@ const selectRecommendation = (id: string) => {
575593
remoteRuleId,
576594
...(formData.name ? { name: formData.name } : {}),
577595
...(formData.nameEn ? { translatedName: formData.nameEn } : {}),
578-
...(formData.type ? { type: formData.type } : {}),
596+
...(localPropertyType || formData.type ? { type: localPropertyType || formData.type } : {}),
579597
remoteWizard: isWizard ? '1' : '0',
580598
...extractPrefixedQueryParams(route.query, 'next__'),
581599
},

src/core/products/products/product-show/containers/tabs/variations/containers/variations-amazon-bulk-edit/VariationsAmazonBulkEdit.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,8 @@ defineExpose({ hasUnsavedChanges });
15361536
ref="matrixRef"
15371537
v-model:rows="variations"
15381538
:columns="columns"
1539-
:loading="loading || saving"
1539+
:loading="loading"
1540+
:saving="saving"
15401541
:has-changes="hasChanges"
15411542
row-key="id"
15421543
:get-cell-value="getMatrixCellValue"

0 commit comments

Comments
 (0)