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

No Index feature - UI part #364

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions e2e/page-objects/schema-editor/microschema-editor-field.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export class MicroschemaEditorField {
value: () => SchemaEditorUtils.getInputCheckboxValueByFormControlName('required', this.root),
setValue: (value: boolean) => SchemaEditorUtils.inputCheckboxSetValue(value, 'required', this.root)
},
noIndex: {
element: () => SchemaEditorUtils.getInputTextElementByFormControlName('noIndex', this.root),
value: () => SchemaEditorUtils.getInputCheckboxValueByFormControlName('noIndex', this.root),
setValue: (value: boolean) => SchemaEditorUtils.inputCheckboxSetValue(value, 'noIndex', this.root)
},
listType: {
element: () => SchemaEditorUtils.getInputSelectElementByFormControlName('listType', this.root),
value: () => SchemaEditorUtils.getInputSelectSingleValueByFormControlName('listType', this.root),
Expand Down Expand Up @@ -91,6 +96,10 @@ export class MicroschemaEditorField {
expect(inputCheckboxRequiredElement.isPresent()).toBeTruthy();
const inputCheckboxRequiredValue = await this.input.required.value();

const inputCheckboxNoIndexElement = await this.input.noIndex.element();
expect(inputCheckboxNoIndexElement.isPresent()).toBeTruthy();
const inputCheckboxNoIndexValue = await this.input.noIndex.value();

// provide unconditional values
const state: any = {
name: {
Expand All @@ -107,6 +116,9 @@ export class MicroschemaEditorField {
},
required: {
value: inputCheckboxRequiredValue
},
noIndex: {
value: inputCheckboxNoIndexValue
}
};

Expand Down Expand Up @@ -179,6 +191,7 @@ export class MicroschemaEditorField {
name: state.name.value,
label: state.label.value,
...(typeof state.required.value === 'boolean' && ({ required: state.required.value } as any)),
...(typeof state.noIndex.value === 'boolean' && ({ required: state.noIndex.value } as any)),
...(state.type &&
state.type.value &&
this.schemaFieldDataConditions.listType(state.type.value) &&
Expand Down
13 changes: 13 additions & 0 deletions e2e/page-objects/schema-editor/schema-editor-field.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export class SchemaEditorField {
value: () => SchemaEditorUtils.getInputCheckboxValueByFormControlName('required', this.root),
setValue: (value: boolean) => SchemaEditorUtils.inputCheckboxSetValue(value, 'required', this.root)
},
noIndex: {
element: () => SchemaEditorUtils.getInputTextElementByFormControlName('noIndex', this.root),
value: () => SchemaEditorUtils.getInputCheckboxValueByFormControlName('noIndex', this.root),
setValue: (value: boolean) => SchemaEditorUtils.inputCheckboxSetValue(value, 'noIndex', this.root)
},
listType: {
element: () => SchemaEditorUtils.getInputSelectElementByFormControlName('listType', this.root),
value: () => SchemaEditorUtils.getInputSelectSingleValueByFormControlName('listType', this.root),
Expand Down Expand Up @@ -91,6 +96,10 @@ export class SchemaEditorField {
expect(inputCheckboxRequiredElement.isPresent()).toBeTruthy();
const inputCheckboxRequiredValue = await this.input.required.value();

const inputCheckboxNoIndexElement = await this.input.noIndex.element();
expect(inputCheckboxNoIndexElement.isPresent()).toBeTruthy();
const inputCheckboxNoIndexValue = await this.input.noIndex.value();

// provide unconditional values
const state: any = {
name: {
Expand All @@ -107,6 +116,9 @@ export class SchemaEditorField {
},
required: {
value: inputCheckboxRequiredValue
},
noIndex: {
value: inputCheckboxNoIndexValue
}
};

Expand Down Expand Up @@ -179,6 +191,7 @@ export class SchemaEditorField {
name: state.name.value,
label: state.label.value,
...(typeof state.required.value === 'boolean' && ({ required: state.required.value } as any)),
...(typeof state.noIndex.value === 'boolean' && ({ required: state.noIndex.value } as any)),
...(state.type &&
state.type.value &&
this.schemaFieldDataConditions.listType(state.type.value) &&
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.gentics.mesh</groupId>
<artifactId>mesh-admin-ui2</artifactId>
<version>1.3.6</version>
<version>1.3.7</version>

<packaging>pom</packaging>
<name>Mesh - Admin UI</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
class="formgroup row">

<h2 class="section-header medium-12 columns">{{ 'admin.schema_editor_sectionlabel_microschemaproperties' | i18n }}:</h2>
<div class="input-container small-12 medium-12 columns">
<div class="input-container small-12 medium-10 columns">
<gtx-input type="text"
[label]="'admin.schema_editor_inputlabel_name' | i18n"
formControlName="name"></gtx-input>
Expand All @@ -16,6 +16,15 @@ <h2 class="section-header medium-12 columns">{{ 'admin.schema_editor_sectionlabe
</div>
</div>

<div class="small-12 medium-2 columns">
<div class="checkbox-wrapper">
<div>
<gtx-checkbox [label]="'admin.schema_editor_inputlabel_noindex' | i18n"
formControlName="noIndex"></gtx-checkbox>
</div>
</div>
</div>

<gtx-input type="text"
class="small-12 medium-12 columns"
[label]="'admin.schema_editor_inputlabel_description' | i18n"
Expand Down Expand Up @@ -94,6 +103,15 @@ <h3>{{field.value?.name}}</h3>
</div>
</div>
</div>

<div class="small-12 medium-2 columns">
<div class="checkbox-wrapper">
<div>
<gtx-checkbox [label]="'admin.schema_editor_inputlabel_noindex' | i18n"
formControlName="noIndex"></gtx-checkbox>
</div>
</div>
</div>
</div>

<div class="row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export class MicroschemaEditorComponent extends AbstractSchemaEditorComponent<
name: [Validators.required, Validators.pattern(this.allowedCharsRegExp)],
type: [Validators.required],
required: [],
noIndex: [],
listType: []
}
};
Expand All @@ -107,6 +108,7 @@ export class MicroschemaEditorComponent extends AbstractSchemaEditorComponent<
type: () => true,
label: () => true,
required: field => field.required === true,
noIndex: field => field.noIndex === true,
listType: field => (field.type === 'list' && field.listType && field.listType.length > 0) || false,
allow: () => true
};
Expand Down Expand Up @@ -188,6 +190,7 @@ export class MicroschemaEditorComponent extends AbstractSchemaEditorComponent<
...(this.schemaFieldDataConditions.type(field) && ({ type: field.type } as any)),
...(this.schemaFieldDataConditions.label(field) && ({ label: field.label } as any)),
...({ required: field.required || false } as any),
...({ noIndex: field.noIndex || false } as any),
// check conditions and only assign if type has changed
...(this.schemaFieldDataConditions.listType(field) && ({ listType: field.listType } as any))
};
Expand Down Expand Up @@ -298,6 +301,7 @@ export class MicroschemaEditorComponent extends AbstractSchemaEditorComponent<
label: ['', this.formValidators.fields.label],
type: ['', this.formValidators.fields.type],
required: [false, this.formValidators.fields.required],
noIndex: [false, this.formValidators.fields.noIndex],
listType: [null, this.formValidators.fields.listType],
allow: ['', this.formValidators.fields.allow]
});
Expand All @@ -314,6 +318,7 @@ export class MicroschemaEditorComponent extends AbstractSchemaEditorComponent<
label: [field.label || '', this.formValidators.fields.label],
type: [field.type || '', this.formValidators.fields.type],
required: [field.required || false, this.formValidators.fields.required],
noIndex: [field.noIndex || false, this.formValidators.fields.noIndex],
listType: [field.listType || null, this.formValidators.fields.listType],
allow: ['', this.formValidators.fields.allow]
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ const updateFields: Array<keyof SchemaResponse> = [
'urlFields',
'container',
'autoPurge',
'noIndex',
'elasticsearch'
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
class="formgroup row">

<h2 class="section-header medium-12 columns">{{ 'admin.schema_editor_sectionlabel_schemaproperties' | i18n }}:</h2>
<div class="input-container small-12 medium-8 columns">
<div class="input-container small-12 medium-6 columns">
<gtx-input type="text"
[label]="'admin.schema_editor_inputlabel_name' | i18n"
formControlName="name"></gtx-input>
Expand Down Expand Up @@ -34,6 +34,15 @@ <h2 class="section-header medium-12 columns">{{ 'admin.schema_editor_sectionlabe
</div>
</div>

<div class="small-12 medium-2 columns">
<div class="checkbox-wrapper">
<div>
<gtx-checkbox [label]="'admin.schema_editor_inputlabel_noindex' | i18n"
formControlName="noIndex"></gtx-checkbox>
</div>
</div>
</div>

<gtx-input type="text"
class="small-12 medium-12 columns"
[label]="'admin.schema_editor_inputlabel_description' | i18n"
Expand Down Expand Up @@ -152,6 +161,15 @@ <h3>{{field.value?.name}}</h3>
</div>
</div>
</div>

<div class="small-12 medium-2 columns">
<div class="checkbox-wrapper">
<div>
<gtx-checkbox [label]="'admin.schema_editor_inputlabel_noindex' | i18n"
formControlName="noIndex"></gtx-checkbox>
</div>
</div>
</div>
</div>

<div class="row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export class SchemaEditorComponent extends AbstractSchemaEditorComponent<
name: [Validators.required, Validators.pattern(this.allowedCharsRegExp)],
container: [],
autoPurge: [],
noIndex: [],
description: [],
displayField: [],
segmentField: [],
Expand All @@ -106,6 +107,7 @@ export class SchemaEditorComponent extends AbstractSchemaEditorComponent<
label: [],
type: [Validators.required],
required: [],
noIndex: [],
listType: [],
allow: []
}
Expand All @@ -116,6 +118,7 @@ export class SchemaEditorComponent extends AbstractSchemaEditorComponent<
name: property => property.name,
container: property => property.container,
autoPurge: property => property.autoPurge,
noIndex: property => property.noIndex,
description: property => property.description.length > 0,
displayField: () => {
return (
Expand Down Expand Up @@ -146,6 +149,7 @@ export class SchemaEditorComponent extends AbstractSchemaEditorComponent<
type: () => true,
label: () => true,
required: () => true,
noIndex: () => true,
listType: field => (field.type === 'list' && field.listType && field.listType.length > 0) as boolean,
allowNodeInputSelect: field => field.type === 'node' || field.listType === 'node',
allowMicroodeInputSelect: field => field.type === 'micronode' || field.listType === 'micronode',
Expand Down Expand Up @@ -225,6 +229,7 @@ export class SchemaEditorComponent extends AbstractSchemaEditorComponent<
name: [this._schemaJson.name || this.schemaTitlePrefilled || '', this.formValidators.name],
container: [this._schemaJson.container || false, this.formValidators.container],
autoPurge: [this._schemaJson.autoPurge || false, this.formValidators.autoPurge],
noIndex: [this._schemaJson.noIndex || false, this.formValidators.noIndex],
description: [this._schemaJson.description || '', this.formValidators.description],
displayField: [this._schemaJson.displayField || '', this.formValidators.displayField],
segmentField: [this._schemaJson.segmentField || '', this.formValidators.segmentField],
Expand Down Expand Up @@ -260,6 +265,7 @@ export class SchemaEditorComponent extends AbstractSchemaEditorComponent<
...(this.schemaDataConditions.name(value) && ({ name: value.name } as any)),
...({ container: value.container ? true : false } as any),
...({ autoPurge: value.autoPurge ? true : false } as any),
...({ noIndex: value.noIndex ? true : false } as any),
...(this.schemaDataConditions.description(value) && ({ description: value.description } as any)),
// assign data meeting conditions only
...this.displayFieldAssign(value),
Expand All @@ -281,6 +287,7 @@ export class SchemaEditorComponent extends AbstractSchemaEditorComponent<
...(this.schemaFieldDataConditions.type(field) && ({ type: field.type } as any)),
...(this.schemaFieldDataConditions.label(field) && ({ label: field.label } as any)),
...({ required: field.required || false } as any),
...({ noIndex: field.noIndex || false } as any),
// check conditions and only assign if type has changed
...(this.schemaFieldDataConditions.listType(field) && ({ listType: field.listType } as any))
};
Expand Down Expand Up @@ -404,6 +411,7 @@ export class SchemaEditorComponent extends AbstractSchemaEditorComponent<
label: ['', this.formValidators.fields.label],
type: ['', this.formValidators.fields.type],
required: [false, this.formValidators.fields.required],
noIndex: [false, this.formValidators.fields.noIndex],
listType: [null, this.formValidators.fields.listType],
allow: ['', this.formValidators.fields.allow]
});
Expand All @@ -420,6 +428,7 @@ export class SchemaEditorComponent extends AbstractSchemaEditorComponent<
label: [field.label || '', this.formValidators.fields.label],
type: [field.type || '', this.formValidators.fields.type],
required: [field.required || false, this.formValidators.fields.required],
noIndex: [field.noIndex || false, this.formValidators.fields.noIndex],
listType: [field.listType || null, this.formValidators.fields.listType],
allow: ['', this.formValidators.fields.allow]
});
Expand Down
1 change: 1 addition & 0 deletions src/app/common/models/schema.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type ListTypeFieldType = CommonFieldType | 'micronode';

export interface BaseSchemaField {
autoPurge?: boolean;
noIndex?: boolean;
name: string;
type: SchemaFieldType | MicroschemaFieldType;
allow?: string[];
Expand Down
18 changes: 18 additions & 0 deletions src/app/common/models/server-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4153,6 +4153,8 @@ export interface FieldSchemaFromServer {
/** Name of the field. */
readonly name: string;
readonly required?: boolean;
/** Omit indexing */
readonly noIndex?: boolean;
/** Type of the field. */
readonly type: string;
/** Type of the field. */
Expand Down Expand Up @@ -4463,11 +4465,15 @@ export interface MicroschemaResponse {
readonly uuid: string;
/** Version of the microschema */
readonly version: string;
/** Exclude micronode entities from indexing */
readonly noIndex?: boolean;
}

export interface MicroschemaUpdateRequest {
/** Description of the microschema */
readonly description?: string;
/** Exclude the microschema instances from indexing */
readonly noIndex?: boolean;
/**
* Additional search index configuration. This can be used to setup custom analyzers
* and filters.
Expand Down Expand Up @@ -4944,6 +4950,10 @@ export interface SchemaCreateRequest {
* See Mesh docs: https://getmesh.io/docs/features/#auto-purge
*/
readonly autoPurge?: boolean;
/**
* Flag which indicates whether the nodes of this version should be excluded from the indexing.
*/
readonly noIndex?: boolean;
/**
* Flag which indicates whether nodes which use this schema store additional child
* nodes.
Expand Down Expand Up @@ -5013,6 +5023,10 @@ export interface SchemaResponse {
* See Mesh docs: https://getmesh.io/docs/features/#auto-purge
*/
readonly autoPurge: boolean;
/**
* Flag which indicates whether the nodes of this version should be excluded from the indexing.
*/
readonly noIndex?: boolean;
/**
* Flag which indicates whether nodes which use this schema store additional child
* nodes.
Expand Down Expand Up @@ -5069,6 +5083,10 @@ export interface SchemaUpdateRequest {
* nodes.
*/
readonly container?: boolean;
/**
* Flag which indicates whether nodes which use this schema should be excluded from the indexing.
*/
readonly noIndex?: boolean;
/** New description of the schema. */
readonly description?: string;
/** Name of the display field. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,13 @@
"pt": "Auto-Purge",
"hu": "Automatikus tisztítás"
},
"schema_editor_inputlabel_noindex": {
"en": "No Index",
"de": "Kein Index",
"zh": "无索引",
"pt": "Sem índice",
"hu": "Nincs index"
},
"schema_editor_inputlabel_description": {
"en": "Description",
"de": "Beschreibung",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const mockSchema: Schema = {
editor: mockUser,
edited: '2017-01-19T12:08:05Z',
autoPurge: false,
noIndex: false,
permissions: {
create: true,
read: true,
Expand Down