Skip to content

Commit e89f395

Browse files
committed
Proper validation messaging for offline
1 parent 4ae5875 commit e89f395

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/CheckBoxFilter/Validate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export class Validate {
55
static validateProps(props: ContainerProps & { isWebModeler?: boolean }): ReactChild {
66
const errorMessages = [];
77

8-
if (!window.mx.isOffline() && props.filterBy === "XPath" && !props.constraint) {
8+
if ((props.isWebModeler || !window.mx.isOffline()) && props.filterBy === "XPath" && !props.constraint) {
99
errorMessages.push("The checked 'XPath constraint' is required when 'Filter by' is set to 'XPath'");
1010
}
1111
if (props.filterBy === "attribute" && !props.attribute) {
@@ -14,7 +14,7 @@ export class Validate {
1414
if (props.filterBy === "attribute" && !props.attributeValue) {
1515
errorMessages.push("The checked 'Attribute value' is required when 'Filter by' is set to 'Attribute'");
1616
}
17-
if (!window.mx.isOffline() && props.unCheckedFilterBy === "XPath" && !props.unCheckedConstraint) {
17+
if ((props.isWebModeler || !window.mx.isOffline()) && props.unCheckedFilterBy === "XPath" && !props.unCheckedConstraint) {
1818
errorMessages.push("The unchecked 'XPath constraint' is required when 'Filter by' is set to 'XPath'");
1919
}
2020
if (props.unCheckedFilterBy === "attribute" && !props.unCheckedAttribute) {

src/DropDownFilter/Validate.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export class Validate {
66
const errorMessages: string[] = [];
77

88
props.filters.forEach((filter, index) => {
9-
if (!window.mx.isOffline() && filter.filterBy === "XPath" && !filter.constraint) {
9+
if ((props.isWebModeler || !window.mx.isOffline()) && filter.filterBy === "XPath" && !filter.constraint) {
1010
errorMessages.push(`Filter position: {${index + 1 }} is missing XPath constraint`);
1111
}
1212
if (filter.filterBy === "attribute" && !filter.attribute) {
@@ -15,10 +15,10 @@ export class Validate {
1515
if (filter.filterBy === "attribute" && !filter.attributeValue) {
1616
errorMessages.push(`Filter position: {${index + 1 }} 'Attribute value' is required`);
1717
}
18-
if (!window.mx.isOffline() && !props.isWebModeler && filter.filterBy === "XPath" && filter.constraint.indexOf("[%CurrentObject%]'") > -1 && !props.mxObject) {
18+
if ((props.isWebModeler || !window.mx.isOffline()) && !props.isWebModeler && filter.filterBy === "XPath" && filter.constraint.indexOf("[%CurrentObject%]'") > -1 && !props.mxObject) {
1919
errorMessages.push(`Filter position: {${index + 1 }} is XPath constraint, requires a context object`);
2020
}
21-
if (window.mx.isOffline()) {
21+
if (!props.isWebModeler && window.mx.isOffline()) {
2222
if (filter.filterBy === "attribute" && filter.attribute && filter.attribute.indexOf("/") > -1) {
2323
errorMessages.push(`Filter position: {${index + 1 }} 'Attribute' over reference is not supported in offline mode`);
2424
}

src/TextBoxSearch/Validate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export class Validate {
55
static validateProps(props: ContainerProps & { isWebModeler?: boolean }): ReactChild {
66
const errorMessages: string[] = [];
77

8-
if (window.mx.isOffline()) {
8+
if (!props.isWebModeler && window.mx.isOffline()) {
99
props.attributeList.forEach((searchAttribute, index) => {
1010
if (searchAttribute.attribute.indexOf("/") > -1) {
1111
errorMessages.push(`'Search attribute' at position {${index + 1}} over reference is not supported in offline application`);

0 commit comments

Comments
 (0)