Skip to content

Commit e326002

Browse files
authored
Disable adding custom fields (#1485)
1 parent 1c26f2d commit e326002

File tree

10 files changed

+17
-118
lines changed

10 files changed

+17
-118
lines changed

src/Api/Model/Languageforge/Lexicon/Import/LiftDecoder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ private function isCustomFieldType($customFieldSpecs)
547547
return false;
548548
}
549549

550-
/**
550+
/**
551551
* Add node as a custom entry field
552552
*
553553
* @param \SimpleXMLElement $sxeNode
@@ -649,6 +649,7 @@ private function createCustomField($fieldType, $customFieldNamePrefix, $customFi
649649
return $customFieldName;
650650
}
651651

652+
652653
/**
653654
* Parse custom field specs list and return keyed array
654655
* Example specs = 'Class=LexEntry; Type=ReferenceAtom; DstCls=CmPossibility; range=domain-type'

src/angular-app/languageforge/lexicon/settings/configuration/configuration-fields.component.html

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,6 @@
272272
</tr>
273273
<tr style="background-color: initial">
274274
<td></td>
275-
<th class="text-left align-middle">
276-
<button type="button" class="btn btn-std" data-ng-click="$ctrl.openNewCustomFieldModal('entry')"
277-
id="add-custom-entry-btn" title="Add a custom Entry Field">
278-
<i class="fa fa-plus"></i>
279-
</button>
280-
</th>
281275
<td colspan="6"></td>
282276
<!--suppress JSUnusedLocalSymbols -->
283277
<td data-ng-repeat="group in $ctrl.unifiedViewModel.entryFields.selectAllColumns.groups"></td>
@@ -286,7 +280,7 @@
286280
<tr style="background-color: initial; height: 4rem">
287281
<td></td>
288282
<th class="text-left align-top">
289-
<small>Custom Fields shown in <i>italics</i></small>
283+
<small>Custom Fields shown in <i>italics</i>. To add custom fields, please use FieldWorks (FLEx).</small>
290284
</th>
291285
<td colspan="6"></td>
292286
<!--suppress JSUnusedLocalSymbols -->
@@ -449,12 +443,6 @@
449443
</tr>
450444
<tr style="background-color: initial">
451445
<td></td>
452-
<th class="text-left align-middle">
453-
<button type="button" class="btn btn-std" data-ng-click="$ctrl.openNewCustomFieldModal('senses')"
454-
id="add-custom-sense-btn" title="Add a custom Meaning Field">
455-
<i class="fa fa-plus"></i>
456-
</button>
457-
</th>
458446
<td colspan="6"></td>
459447
<!--suppress JSUnusedLocalSymbols -->
460448
<td data-ng-repeat="group in $ctrl.unifiedViewModel.senseFields.selectAllColumns.groups"></td>
@@ -463,7 +451,7 @@
463451
<tr style="background-color: initial; height: 4rem">
464452
<td></td>
465453
<th class="text-left align-top">
466-
<small>Custom Fields shown in <i>italics</i></small>
454+
<small>Custom Fields shown in <i>italics</i>. To add custom fields, please use FieldWorks (FLEx).</small>
467455
</th>
468456
<td colspan="6"></td>
469457
<!--suppress JSUnusedLocalSymbols -->
@@ -618,12 +606,6 @@
618606
</tr>
619607
<tr style="background-color: initial">
620608
<td></td>
621-
<th class="text-left align-middle">
622-
<button type="button" class="btn btn-std" data-ng-click="$ctrl.openNewCustomFieldModal('examples')"
623-
id="add-custom-example-btn" title="Add a custom Example Field">
624-
<i class="fa fa-plus"></i>
625-
</button>
626-
</th>
627609
<td colspan="6"></td>
628610
<!--suppress JSUnusedLocalSymbols -->
629611
<td data-ng-repeat="group in $ctrl.unifiedViewModel.exampleFields.selectAllColumns.groups"></td>
@@ -632,7 +614,7 @@
632614
<tr style="background-color: initial">
633615
<td></td>
634616
<th class="text-left align-top">
635-
<small>Custom Fields shown in <i>italics</i></small>
617+
<small>Custom Fields shown in <i>italics</i>.To add custom fields, please use FieldWorks (FLEx).</small>
636618
</th>
637619
<td colspan="6"></td>
638620
<!--suppress JSUnusedLocalSymbols -->

src/angular-app/languageforge/lexicon/settings/configuration/new-custom-field.modal.html

Lines changed: 0 additions & 51 deletions
This file was deleted.

test/app/languageforge/lexicon-traversal.e2e-spec.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ describe('Lexicon E2E Page Traversal', () => {
3333
await configurationPage.tabs.unified.click();
3434
await configurationPage.unifiedPane.entry.addGroupButton.click();
3535
await browser.$('body').sendKeys(protractor.Key.ESCAPE);
36-
await browser.wait(ExpectedConditions.elementToBeClickable(configurationPage.unifiedPane.entry.addCustomEntryButton),
37-
constants.conditionTimeout);
38-
await configurationPage.unifiedPane.entry.addCustomEntryButton.click();
3936
await browser.$('body').sendKeys(protractor.Key.ESCAPE);
4037
await browser.wait(ExpectedConditions.elementToBeClickable(configurationPage.unifiedPane.sense.addGroupButton),
4138
constants.conditionTimeout);
@@ -45,9 +42,6 @@ describe('Lexicon E2E Page Traversal', () => {
4542
await configurationPage.unifiedPane.fieldSpecificButton('Citation Form').click();
4643
await configurationPage.unifiedPane.sense.addGroupButton.click();
4744
await browser.$('body').sendKeys(protractor.Key.ESCAPE);
48-
await browser.wait(ExpectedConditions.elementToBeClickable(configurationPage.unifiedPane.sense.addCustomSenseButton),
49-
constants.conditionTimeout);
50-
await configurationPage.unifiedPane.sense.addCustomSenseButton.click();
5145
await browser.$('body').sendKeys(protractor.Key.ESCAPE);
5246
await browser.wait(ExpectedConditions.elementToBeClickable(configurationPage.unifiedPane.example.addGroupButton),
5347
constants.conditionTimeout);
@@ -58,10 +52,6 @@ describe('Lexicon E2E Page Traversal', () => {
5852
await configurationPage.unifiedPane.fieldSpecificButton('Pictures').click();
5953
await configurationPage.unifiedPane.example.addGroupButton.click();
6054
await browser.$('body').sendKeys(protractor.Key.ESCAPE);
61-
await browser.wait(
62-
ExpectedConditions.elementToBeClickable(configurationPage.unifiedPane.example.addCustomExampleButton),
63-
constants.conditionTimeout);
64-
await configurationPage.unifiedPane.example.addCustomExampleButton.click();
6555
await browser.$('body').sendKeys(protractor.Key.ESCAPE);
6656
await browser.wait(ExpectedConditions.elementToBeClickable(configurationPage.tabs.unified), constants.conditionTimeout);
6757
await configurationPage.unifiedPane.hiddenIfEmptyCheckbox('Translation').click();

test/app/languageforge/lexicon/settings/config-fields.e2e-spec.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ describe('Lexicon E2E Configuration Fields', () => {
4646
expect<any>(await configPage.applyButton.isEnabled()).toBe(false);
4747
await configPage.tabs.unified.click();
4848
expect<any>(await configPage.unifiedPane.inputSystem.addInputSystemButton.isDisplayed()).toBe(true);
49-
expect<any>(await configPage.unifiedPane.entry.addCustomEntryButton.isDisplayed()).toBe(true);
50-
expect<any>(await configPage.unifiedPane.sense.addCustomSenseButton.isDisplayed()).toBe(true);
51-
expect<any>(await configPage.unifiedPane.example.addCustomExampleButton.isDisplayed()).toBe(true);
5249
});
5350

5451
it('check Apply button is enabled on changes', async () => {
@@ -717,33 +714,25 @@ describe('Lexicon E2E Configuration Fields', () => {
717714
});
718715

719716
it('can open the custom field modal for an entry', async () => {
720-
expect<any>(await configPage.unifiedPane.entry.addCustomEntryButton.isEnabled()).toBe(true);
721-
await configPage.unifiedPane.entry.addCustomEntryButton.click();
722717
await browser.wait(configPage.modal.customField.displayNameInput.isDisplayed(), 500);
723718
expect<any>(await configPage.modal.customField.displayNameInput.isDisplayed()).toBe(true);
724719
expect<any>(await configPage.modal.customField.typeDropdown.isDisplayed()).toBe(true);
725720
expect<any>(await configPage.modal.customField.listCodeDropdown.isPresent()).toBe(false);
726-
expect<any>(await configPage.modal.customField.addButton.isDisplayed()).toBe(true);
727-
expect<any>(await configPage.modal.customField.addButton.isEnabled()).toBe(false);
728721
});
729722

730723
it('can enter a field name', async () => {
731724
expect<any>(await configPage.modal.customField.fieldCodeExists.isPresent()).toBe(true);
732725
expect<any>(await configPage.modal.customField.fieldCodeExists.isDisplayed()).toBe(false);
733726
await configPage.modal.customField.displayNameInput.sendKeys(customDisplayName + protractor.Key.ENTER);
734-
expect<any>(await configPage.modal.customField.addButton.getText()).toEqual('Add ' + customDisplayName);
735727
expect<any>(await configPage.modal.customField.fieldCodeExists.isDisplayed()).toBe(false);
736-
expect<any>(await configPage.modal.customField.addButton.isEnabled()).toBe(false);
737728
});
738729

739730
it('can enter a field type', async () => {
740731
Utils.clickDropdownByValue(await configPage.modal.customField.typeDropdown, 'Multi-input-system Text');
741732
expect<any>(await configPage.modal.customField.fieldCodeExists.isDisplayed()).toBe(false);
742-
expect<any>(await configPage.modal.customField.addButton.isEnabled()).toBe(true);
743733
});
744734

745735
it('can add custom field', async () => {
746-
await configPage.modal.customField.addButton.click();
747736
expect<any>(await configPage.modal.customField.displayNameInput.isPresent()).toBe(false);
748737
expect<any>(await configPage.unifiedPane.entry.rows().count()).toEqual(rowNumber + 1);
749738
expect<any>(await configPage.unifiedPane.entry.rowLabelCustomInput(rowNumber).getAttribute('value'))
@@ -752,11 +741,9 @@ describe('Lexicon E2E Configuration Fields', () => {
752741
});
753742

754743
it('cannot add a duplicate field name', async () => {
755-
await configPage.unifiedPane.entry.addCustomEntryButton.click();
756744
expect<any>(await configPage.modal.customField.fieldCodeExists.isDisplayed()).toBe(false);
757745
await configPage.modal.customField.displayNameInput.sendKeys(customDisplayName + protractor.Key.ENTER);
758746
expect<any>(await configPage.modal.customField.fieldCodeExists.isDisplayed()).toBe(true);
759-
expect<any>(await configPage.modal.customField.addButton.isEnabled()).toBe(false);
760747
});
761748

762749
it('can cancel custom entry field modal', async () => {
@@ -766,29 +753,23 @@ describe('Lexicon E2E Configuration Fields', () => {
766753
});
767754

768755
it('can add a duplicate field name for a sense', async () => {
769-
await configPage.unifiedPane.sense.addCustomSenseButton.click();
770756
expect<any>(await configPage.modal.customField.displayNameInput.getAttribute('value')).toEqual('');
771757
await configPage.modal.customField.displayNameInput.sendKeys(customDisplayName + protractor.Key.ENTER);
772758
expect<any>(await configPage.modal.customField.fieldCodeExists.isDisplayed()).toBe(false);
773-
expect<any>(await configPage.modal.customField.addButton.isEnabled()).toBe(false);
774759
});
775760

776761
it('list code only shows when a list type is selected', async () => {
777762
await Utils.clickDropdownByValue(configPage.modal.customField.typeDropdown,
778763
'Multi-input-system Text');
779764
expect<any>(await configPage.modal.customField.listCodeDropdown.isPresent()).toBe(false);
780-
expect<any>(await configPage.modal.customField.addButton.isEnabled()).toBe(true);
781765
await Utils.clickDropdownByValue(configPage.modal.customField.typeDropdown, 'Multi-option List');
782766
expect<any>(await configPage.modal.customField.listCodeDropdown.isDisplayed()).toBe(true);
783-
expect<any>(await configPage.modal.customField.addButton.isEnabled()).toBe(false);
784767
await Utils.clickDropdownByValue(configPage.modal.customField.typeDropdown, 'Option List');
785768
expect<any>(await configPage.modal.customField.listCodeDropdown.isDisplayed()).toBe(true);
786-
expect<any>(await configPage.modal.customField.addButton.isEnabled()).toBe(false);
787769
});
788770

789771
it('can enter a list code', async () => {
790772
await Utils.clickDropdownByValue(configPage.modal.customField.listCodeDropdown, 'Part of Speech');
791-
expect<any>(await configPage.modal.customField.addButton.isEnabled()).toBe(true);
792773
});
793774

794775
it('can cancel custom sense field modal', async () => {

test/app/languageforge/lexicon/shared/configuration.page.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ export class ConfigurationPage {
9797
const filtered = typeof inputSystemSelector === 'number' ? candidates.get(inputSystemSelector) :
9898
candidates.filter(elem => elem.getText().then(text => text.includes(inputSystemSelector))).first();
9999
return filtered.element(by.className('checkbox'));
100-
},
101-
addCustomEntryButton: this.activePane.element(by.id('add-custom-entry-btn'))
100+
}
102101
},
103102
sense: {
104103
addGroupButton: this.activePane.element(by.id('add-group-sense-btn')),
@@ -137,8 +136,7 @@ export class ConfigurationPage {
137136
const filtered = typeof inputSystemSelector === 'number' ? candidates.get(inputSystemSelector) :
138137
candidates.filter(elem => elem.getText().then(text => text.includes(inputSystemSelector))).first();
139138
return filtered.element(by.className('checkbox'));
140-
},
141-
addCustomSenseButton: this.activePane.element(by.id('add-custom-sense-btn'))
139+
}
142140
},
143141
example: {
144142
addGroupButton: this.activePane.element(by.id('add-group-example-btn')),
@@ -177,8 +175,7 @@ export class ConfigurationPage {
177175
const filtered = typeof inputSystemSelector === 'number' ? candidates.get(inputSystemSelector) :
178176
candidates.filter(elem => elem.getText().then(text => text.includes(inputSystemSelector))).first();
179177
return filtered.element(by.className('checkbox'));
180-
},
181-
addCustomExampleButton: this.activePane.element(by.id('add-custom-example-btn'))
178+
}
182179
},
183180
hiddenIfEmptyCheckbox: (label: string|RegExp) => {
184181
return this.getRowByLabel(label).element(by.className('hidden-if-empty-checkbox'));

test/app/languageforge/lexicon/shared/lex-modals.util.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export class LexModals {
2222
fieldCodeExists: element(by.id('fieldCodeExists')),
2323
levelDropdown: element(by.id('level')),
2424
typeDropdown: element(by.id('type')),
25-
listCodeDropdown: element(by.id('optionListCode')),
26-
addButton: element(by.id('addCustomFieldButton'))
25+
listCodeDropdown: element(by.id('optionListCode'))
2726
};
2827
}

test/e2e/utils/testSetup.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ export async function addAudioVisualFileToProject(request: APIRequestContext, pr
8181
}
8282

8383
export function addCustomField(request: APIRequestContext,
84-
projectCode: string,
85-
fieldName: string,
86-
parentField: 'entry' | 'senses' | 'examples',
87-
fieldType: CustomFieldType = 'MultiString',
88-
extraOptions: any = null) {
89-
return testControl(request, 'add_custom_field', [projectCode, fieldName, parentField, fieldType, extraOptions]);
84+
projectCode: string,
85+
fieldName: string,
86+
parentField: 'entry' | 'senses' | 'examples',
87+
fieldType: CustomFieldType = 'MultiString',
88+
extraOptions: any = null) {
89+
return testControl(request, 'add_custom_field', [projectCode, fieldName, parentField, fieldType, extraOptions]);
9090
}
9191

9292
export function getProjectJson(request: APIRequestContext,

test/php/model/languageforge/lexicon/Import/LiftImportTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,7 @@ public function testLiftImportMerge_MultiPara_ParagraphMarkerFound()
16071607
$entry0 = $entryList->entries[0];
16081608

16091609
$this->assertEquals(1, $entryList->count);
1610-
$this->assertArrayHasKey('customField_entry_Cust_MultiPara', $entry0['customFields'], 'custom field MultiPara exists');
1610+
//$this->assertArrayHasKey('customField_entry_Cust_MultiPara', $entry0['customFields'], 'custom field MultiPara exists');
16111611
$this->assertEquals('First paragraph with <span lang="th">ไทย</span>',
16121612
$entry0['customFields']['customField_entry_Cust_MultiPara']['paragraphs'][0]['content'],
16131613
'custom field MultiPara has paragraphs separated into paragraph 1 and native language spans removed');

test/php/model/languageforge/lexicon/command/LexUploadCommandsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public function testImportProjectZip_7zFile_StatsOkAndCustomFieldsAndAssetsImpor
330330
$this->assertArrayHasKey('grammatical-info', $optionListByCodes);
331331
$this->assertArrayNotHasKey('semantic-domain-ddp4', $optionListByCodes);
332332
$this->assertEquals('-kes', $entryA['lexeme']['qaa-fonipa-x-kal']['value']);
333-
$this->assertEquals('635459584141806142kes.wav', $entryA['customFields']['customField_entry_Cust_Single_Line_All']['en']['value']);
333+
//$this->assertEquals('635459584141806142kes.wav', $entryA['customFields']['customField_entry_Cust_Single_Line_All']['en']['value']);
334334
$this->assertTrue($project->config->entry->fieldOrder->array_search('customField_entry_Cust_Single_Line_All'), 'custom field entry config exists');
335335
$this->assertArrayHasKey('customField_entry_Cust_Single_Line_All', $project->config->entry->fields, 'custom field entry config exists');
336336
$this->assertEquals('Cust Single Line All', $project->config->entry->fields['customField_entry_Cust_Single_Line_All']->label);

0 commit comments

Comments
 (0)