Skip to content

Commit

Permalink
Missing parts
Browse files Browse the repository at this point in the history
  • Loading branch information
plyhun committed Oct 4, 2023
1 parent e017d55 commit 542b8de
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 3 deletions.
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
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 @@ -161,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 @@ -107,6 +107,7 @@ export class SchemaEditorComponent extends AbstractSchemaEditorComponent<
label: [],
type: [Validators.required],
required: [],
noIndex: [],
listType: [],
allow: []
}
Expand Down Expand Up @@ -148,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 @@ -285,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 @@ -408,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 @@ -424,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
10 changes: 8 additions & 2 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 @@ -5017,7 +5023,7 @@ 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;
Expand Down Expand Up @@ -5077,7 +5083,7 @@ 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;
Expand Down

0 comments on commit 542b8de

Please sign in to comment.