Description
The methods we have been using to access and alter the state are incredibly complex and difficult to use, for example:
addZType: function ( context, objectId ) {
var nextId;
context.dispatch( 'setZObjectValue', { id: objectId, value: 'object' } );
// Set type
context.dispatch( 'addZObject', { key: Constants.Z_OBJECT_TYPE, value: Constants.Z_TYPE, parent: objectId } );
// Set identity
context.dispatch( 'addZObject', { key: Constants.Z_TYPE_IDENTITY, value: Constants.NEW_ZID_PLACEHOLDER, parent: objectId } );
// Set keys
nextId = zobjectTreeUtils.getNextObjectId( context.rootState.zobjectModule.zobject );
context.dispatch( 'addZObject', { key: Constants.Z_TYPE_KEYS, value: 'object', parent: objectId } );
context.dispatch( 'changeType', { id: nextId, type: Constants.Z_TYPED_LIST, value: Constants.Z_KEY } );
// Set validator
nextId = zobjectTreeUtils.getNextObjectId( context.rootState.zobjectModule.zobject );
context.dispatch( 'addZObject', { key: Constants.Z_TYPE_VALIDATOR, value: 'object', parent: objectId } );
context.dispatch( 'changeType', { id: nextId, type: Constants.Z_REFERENCE, value: Constants.Z_VALIDATE_OBJECT } );
},Can be simply replaced with the following two lines:
addBlankZType: function ( context, rowId ) {
// Get the JSON to inject in current rowIndex for a blank Z_TYPE
var blankZType = context.getters.getScaffolding( Constants.Z_TYPE );
// Call the function injectZObject to recursively add all the object into the table space
context.dispatch( ‘injectZObjectFromRowId’, { index: rowId, value: blankZType } );
} );As part of the default component POC we have created a set of new store interfaces that are simple and intuitive to use, which will be used for the development of DefaultView.
This task is to replace the complex methods from Function Editor and Function Viewer with the new ones, so that we can have the whole front-end modifying its state with only a few, intuitive, documented and heavily tested methods.
Completion checklist
- Before closing this task, review one by one the checklist available here: https://www.mediawiki.org/wiki/Abstract_Wikipedia_team/Definition_of_Done#Front-end_Task/Bug_Completion_Checklist