Skip to content

Commit

Permalink
Adds message that delete formula has not been implemented. (#1337)
Browse files Browse the repository at this point in the history
Adds styling to disabled menu items.
  • Loading branch information
eireland authored Jul 11, 2024
1 parent 023e17c commit b1fac7e
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 51 deletions.
1 change: 1 addition & 0 deletions v3/src/components/case-card/case-card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ tr:nth-child(even) td.attr-cell {

.react-data-card-attribute-menu-item.disabled {
color: #333333;
opacity: 0.35;
}

$column-resize-handle-interaction-width: 10px;
Expand Down
106 changes: 55 additions & 51 deletions v3/src/utilities/v2/dg-data-context-utilities.v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,60 +328,64 @@ DG.DataContextUtilities = {
*
*/
deleteAttributeFormula (iDataContext, iAttrID, iUpdateFunc) {
var tRef = iDataContext?.getAttrRefByID(iAttrID),
tAttrName = tRef.attribute.get('name'),
tCollection = tRef && iDataContext.getCollectionForAttribute(tRef.attribute),
tFormula = '',
tPrevFormula = tRef?.attribute.get('formula')
// show an alert that this has not been implemented yet
console.log("This feature has not been implemented yet.")

Check warning on line 332 in v3/src/utilities/v2/dg-data-context-utilities.v2.js

View workflow job for this annotation

GitHub Actions / S3 Deploy

Unexpected console statement
alert("This feature has not been implemented yet.")

DG.UndoHistory.execute(DG.Command.create({
name: "caseTable.editAttributeFormula",
undoString: 'DG.Undo.caseTable.editAttributeFormula',
redoString: 'DG.Redo.caseTable.editAttributeFormula',
execute () {
var tChange = {
operation: 'createAttributes',
collection: tCollection,
attrPropsArray: [{ name: tAttrName, formula: tFormula }]
},
tResult = iDataContext?.applyChange(tChange)
if (tResult.success) {
tRef.attribute.set('formula', tFormula)
tRef.attribute.set('deletedFormula', tPrevFormula)
iUpdateFunc?.()
// var tRef = iDataContext?.getAttrRefByID(iAttrID),
// tAttrName = tRef.attribute.get('name'),
// tCollection = tRef && iDataContext.getCollectionForAttribute(tRef.attribute),
// tFormula = '',
// tPrevFormula = tRef?.attribute.get('formula')

var action = "attributeEditFormula"
this.log = "%@: { name: '%@', collection: '%@', formula: '%@' }".fmt(
action, tAttrName, tCollection.get('name'), tFormula)
} else {
this.set('causedChange', false)
}
},
undo () {
var tChange, tResult, action
tChange = {
operation: 'createAttributes',
collection: tCollection,
attrPropsArray: [{ name: tAttrName, formula: tPrevFormula }]
}

tResult = iDataContext?.applyChange(tChange)
if (tResult.success) {
tRef.attribute.set('formula', tPrevFormula)
tRef.attribute.set('deletedFormula', tFormula)
iUpdateFunc?.()
// DG.UndoHistory.execute(DG.Command.create({
// name: "caseTable.editAttributeFormula",
// undoString: 'DG.Undo.caseTable.editAttributeFormula',
// redoString: 'DG.Redo.caseTable.editAttributeFormula',
// execute () {
// var tChange = {
// operation: 'createAttributes',
// collection: tCollection,
// attrPropsArray: [{ name: tAttrName, formula: tFormula }]
// },
// tResult = iDataContext?.applyChange(tChange)
// if (tResult.success) {
// tRef.attribute.set('formula', tFormula)
// tRef.attribute.set('deletedFormula', tPrevFormula)
// iUpdateFunc?.()

// var action = "attributeEditFormula"
// this.log = "%@: { name: '%@', collection: '%@', formula: '%@' }".fmt(
// action, tAttrName, tCollection.get('name'), tFormula)
// } else {
// this.set('causedChange', false)
// }
// },
// undo () {
// var tChange, tResult, action
// tChange = {
// operation: 'createAttributes',
// collection: tCollection,
// attrPropsArray: [{ name: tAttrName, formula: tPrevFormula }]
// }

action = "attributeEditFormula"
this.log = "%@: { name: '%@', collection: '%@', formula: '%@' }".fmt(
action, tAttrName, tCollection.get('name'), tPrevFormula)
} else {
this.set('causedChange', false)
}
},
redo () {
this.execute()
}
}))
// tResult = iDataContext?.applyChange(tChange)
// if (tResult.success) {
// tRef.attribute.set('formula', tPrevFormula)
// tRef.attribute.set('deletedFormula', tFormula)
// iUpdateFunc?.()

// action = "attributeEditFormula"
// this.log = "%@: { name: '%@', collection: '%@', formula: '%@' }".fmt(
// action, tAttrName, tCollection.get('name'), tPrevFormula)
// } else {
// this.set('causedChange', false)
// }
// },
// redo () {
// this.execute()
// }
// }))
},

/**
Expand Down

0 comments on commit b1fac7e

Please sign in to comment.