Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
implement priority handling for cleaning jack (#106)
Browse files Browse the repository at this point in the history
* #20 started

* #20

* implements #20

Co-authored-by: Christian Benjamin Ries <c.ries@beckhoff.com>
  • Loading branch information
cbries and Christian Benjamin Ries committed Apr 16, 2021
1 parent 9d365e2 commit fed673b
Show file tree
Hide file tree
Showing 13 changed files with 614 additions and 210 deletions.
1 change: 0 additions & 1 deletion EcosApp/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ html, body {
/**
Workspace Selection
*/

#workspaceSelection {
padding: 10px;
}
Expand Down
2 changes: 1 addition & 1 deletion EcosApp/railessentials.min.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions EcosApp/src/accessories.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,6 @@ class Accessories {
}

elGrid.save();

//self.__cleanupChangedState();
}
});
}
Expand Down
86 changes: 68 additions & 18 deletions EcosApp/src/locomotives.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,20 +174,48 @@ class Locomotives {
],
sortData: [{ field: 'name', direction: 'asc' }],
columns: [
{ field: 'oid', caption: 'Object ID', size: '10%', sortable: true },
{
field: 'oid',
caption: '<div style="text-align: center; padding-left: 6px;"><i class="far fa-id-badge"></i></div>',
style: 'text-align: center',
size: '5%',
sortable: true
},
{
field: 'locImage',
caption: 'Photo',
caption: '<div style="text-align: center; padding-left: 6px;"><i class="fas fa-camera-retro"></i></div>',
size: '10%',
style: 'text-align: center',
render: self.__renderImage
},
{ field: 'name', caption: 'Name', size: '30%', sortable: true, editable: { type: 'text' } },
{ field: 'protocol', caption: 'Protocol', size: '10%', sortable: true },
{ field: 'addr', caption: 'Address', size: '10%' },
{ field: 'speed', caption: 'Speed', size: '10%', hidden: true },
{ field: 'speedstep', caption: 'Speedstep', size: '10%', hidden: false },
{ field: 'speedstepMax', caption: 'Speedstep (max)', size: '10%', hidden: false },
{
field: 'addr',
caption: '<div style="text-align: center; padding-left: 6px;"><i class="fas fa-at"></i></div>',
style: 'text-align: center',
size: '5%'
},
{
field: 'speed',
caption: 'Speed',
size: '10%',
hidden: true
},
{
field: 'speedstep',
caption: '<div style="text-align: center; padding-left: 6px;"><i class="fas fa-tachometer-alt"></i></div>',
style: 'text-align: center',
size: '5%',
hidden: false
},
{
field: 'speedstepMax',
caption: '<div style="text-align: center; padding-left: 6px;"><i class="fas fa-tachometer-alt"></i> (max)</div>',
style: 'text-align: center',
size: '10%',
hidden: false
},
{
field: 'funcset',
caption: 'Functions',
Expand All @@ -198,8 +226,8 @@ class Locomotives {
{ field: 'noOfFunctions', caption: 'No. of Functions', hidden: true },
{
field: 'locked',
caption: 'Locked',
size: '10%',
caption: '<div style="text-align: center; padding-left: 6px;"><i class="fas fa-unlock-alt"></i></div>',
size: '5%',
style: 'text-align: center',
editable: {
type: 'checkbox',
Expand All @@ -210,6 +238,17 @@ class Locomotives {
{ field: 'speedLevel2', caption: 'Level2', size: '1%', hidden: true },
{ field: 'speedLevel3', caption: 'Level3', size: '1%', hidden: true },
{ field: 'speedLevel4', caption: 'Level4', size: '1%', hidden: true },
{
field: 'isCleaner',
caption: '<div style="text-align: center; padding-left: 6px;"><i class="fas fa-bath"></i></div>',
size: '5%',
hidden: false,
style: 'text-align: center',
editable: {
type: 'checkbox',
style: 'text-align: center'
}
},
],
records: [],
onExpand: function (event) {
Expand Down Expand Up @@ -370,9 +409,24 @@ class Locomotives {
}
});
}

const isCleaner = change.isCleaner;
if (typeof isCleaner !== "undefined" && isCleaner != null) {
row.isCleaner = isCleaner;
elGrid.refreshCell(row, 'isCleaner');
self.__trigger("setting",
{
"mode": "locomotive",
"cmd": "cleaner",
"value": {
"oid": oid,
"cleaner": isCleaner
}
});
}
}

self.__cleanupChangedState();
elGrid.save();
}
});
}
Expand Down Expand Up @@ -566,13 +620,6 @@ class Locomotives {
});
}

__cleanupChangedState() {
const self = this;
$('#' + this.__dialogName + ' td.w2ui-grid-data').each(function () {
$(this).removeClass('w2ui-changed');
});
}

updateLocomotives2(locomotivesData) {
const self = this;
const elGrid = w2ui[self.__gridName];
Expand All @@ -596,6 +643,11 @@ class Locomotives {
elGrid.refreshCell(oid, 'locked');
}

if(row.isCleaner !== dataOid.IsCleaner) {
row.isCleaner = dataOid.IsCleaner;
elGrid.refreshCell(oid, 'isCleaner');
}

try {
let level1 = 0, level2 = 0, level3 = 0, level4 = 0;

Expand Down Expand Up @@ -639,8 +691,6 @@ class Locomotives {
}
}
}

self.__cleanupChangedState();
}

updateLocomotives(ecosDataLocomotives) {
Expand Down
1 change: 1 addition & 0 deletions Workspaces/Basement/locomotives.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"1004": {
"IsCleaner": true,
"IsStopped": true,
"IsLocked": false,
"Settings": {
Expand Down
Loading

0 comments on commit fed673b

Please sign in to comment.