Skip to content

Commit

Permalink
Merge 88cae08 into 652d212
Browse files Browse the repository at this point in the history
  • Loading branch information
FranciscoZapa committed May 19, 2023
2 parents 652d212 + 88cae08 commit 7b848b3
Show file tree
Hide file tree
Showing 16 changed files with 19,782 additions and 63 deletions.
4 changes: 3 additions & 1 deletion lib/deprecation-validators/index.js
Expand Up @@ -4,10 +4,12 @@ const title = require('./title-deprecation');
const titleComponents = require('./title-components-deprecation');
const staticFilters = require('./static-filters-deprecation');
const pathQuery = require('./path-query-deprecation');
const remoteAction = require('./remoteActions-deprecation');

module.exports = {
title,
titleComponents,
staticFilters,
pathQuery
pathQuery,
remoteAction
};
21 changes: 21 additions & 0 deletions lib/deprecation-validators/remoteActions-deprecation.js
@@ -0,0 +1,21 @@
'use strict';

const { getDaysToRemoveFeatureMessage, isEdit } = require('../helpers');

module.exports = class RemoteActionsDeprecation {

static getDayToRemove() {
return '07/15/2023';
}

static getDeprecatedMessage() {

return `The property \`remoteActions\` is going to be deprecated. ${getDaysToRemoveFeatureMessage(this.getDayToRemove())}`;
}

static validate(schema) {

if(isEdit(schema))
return JSON.stringify(schema).indexOf('remoteActions') === -1;
}
};
30 changes: 30 additions & 0 deletions lib/schemas/common/actions.js
@@ -0,0 +1,30 @@
'use strict';

const makeGenericActions = require('../common/generic-actions');

const customCallbacks = ['removeRow', 'reloadRow', 'reloadBrowse'];

module.exports = ({
type: 'object',
properties: {
title: { $ref: 'schemaDefinitions#/definitions/stringPrefix' },
translateTitle: { type: 'boolean' },
source: { $ref: 'schemaDefinitions#/definitions/endpoint' },
sourceEndpointParameters: { $ref: 'schemaDefinitions#/definitions/endpointParameters' },
modalSize: { $ref: 'schemaDefinitions#/definitions/modalSize' },
staticActions: makeGenericActions({ customCallbacks })
},
anyOf: [
{
required: [
'staticActions'
]
},
{
required: [
'source'
]
}
],
additionalProperties: false
});
14 changes: 14 additions & 0 deletions lib/schemas/common/remoteActions.js
@@ -0,0 +1,14 @@
'use strict';

module.exports = {
type: 'object',
properties: {
title: { $ref: 'schemaDefinitions#/definitions/stringPrefix' },
translateTitle: { type: 'boolean' },
source: { $ref: 'schemaDefinitions#/definitions/endpoint' },
sourceEndpointParameters: { $ref: 'schemaDefinitions#/definitions/endpointParameters' },
modalSize: { $ref: 'schemaDefinitions#/definitions/modalSize' }
},
required: ['source'],
additionalProperties: false
};
43 changes: 28 additions & 15 deletions lib/schemas/edit/schema.js
@@ -1,7 +1,9 @@
'use strict';

const { properties, if: conditonal, then: isTrue, else: isFalse } = require('../edit-new/schema');
const { properties, if: conditional, then: isTrue, else: isFalse } = require('../edit-new/schema');
const themes = require('../common/themes');
const actions = require('../common/actions');
const remoteActions = require('../common/remoteActions');

module.exports = {
properties: {
Expand All @@ -10,20 +12,31 @@ module.exports = {
source: { $ref: 'schemaDefinitions#/definitions/endpoint' },
canPrint: { type: 'boolean' },
dependencies: { $ref: 'schemaDefinitions#/definitions/dependencies' },
remoteActions: {
type: 'object',
properties: {
title: { $ref: 'schemaDefinitions#/definitions/stringPrefix' },
translateTitle: { type: 'boolean' },
source: { $ref: 'schemaDefinitions#/definitions/endpoint' },
sourceEndpointParameters: { $ref: 'schemaDefinitions#/definitions/endpointParameters' },
modalSize: { $ref: 'schemaDefinitions#/definitions/modalSize' }
actions,
remoteActions
},
allOf: [
{
if: conditional,
then: isTrue,
else: isFalse
},
{
if: {
properties: { actions: { const: false } }
},
then: {
not: {
properties: { actions },
required: ['actions']
}
},
required: ['source'],
additionalProperties: false
else: {
not: {
properties: { remoteActions },
required: ['remoteActions']
}
}
}
},
if: conditonal,
then: isTrue,
else: isFalse
]
};

0 comments on commit 7b848b3

Please sign in to comment.