Skip to content

Commit

Permalink
feat: display touchTs in grids for checklist, other assets, and revie…
Browse files Browse the repository at this point in the history
…ws (#1217)

* display touchTs in grids for checklist, reviews, and other assets

* replace schema StringDateTime => StringDateTimeNullable

* move sprites and relabel in review.js
  • Loading branch information
csmig authored Feb 29, 2024
1 parent 3e09790 commit a7756b1
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 15 deletions.
5 changes: 4 additions & 1 deletion api/source/service/AssetService.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,10 @@ exports.queryChecklist = async function (inProjection, inPredicates, elevate, us
`result.api as "result"`,
`CASE WHEN review.resultEngine = 0 THEN NULL ELSE review.resultEngine END as resultEngine`,
`review.autoResult`,
`status.api as "status"`
`status.api as "status"`,
`review.statusTs`,
`review.ts`,
`review.touchTs`
]
const joins = [
'current_rev rev',
Expand Down
6 changes: 6 additions & 0 deletions api/source/specification/stig-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4299,6 +4299,12 @@ components:
type: boolean
status:
$ref: '#/components/schemas/ChecklistStatus'
statusTs:
$ref: '#/components/schemas/StringDateTimeNullable'
ts:
$ref: '#/components/schemas/StringDateTimeNullable'
touchTs:
$ref: '#/components/schemas/StringDateTimeNullable'
ChecklistCkl:
type: object
description: The CKL format generated and read by DISA STIG VIewer
Expand Down
14 changes: 13 additions & 1 deletion client/src/css/stigman.css
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@
}
.sm-engine-result-icon {
background-image: url(../img/bot2.svg);
background-repeat: no-repeat
background-repeat: no-repeat;
width: 12px;
}
.sm-engine-override-icon {
background-image: url(../img/override2.svg);
Expand All @@ -258,6 +259,17 @@
height: 14px;
width: 14px
}
.x-menu-item-text .sm-engine-result-icon, .x-menu-item-text .sm-history-icon{
background-size: 12px 12px;
height: 12px
}

.x-grid3-cell.x-grid3-hd .sm-history-icon {
background-size: 12px 12px;
background-position: center;
height: 12px
}

.x-menu-check-item .x-menu-item-icon {
background-image: url(../img/checkboxes.svg);
background-position: 1px 0;
Expand Down
10 changes: 5 additions & 5 deletions client/src/js/SM/Review.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ SM.Review.Form.Panel = Ext.extend(Ext.form.FormPanel, {
})
const mdf = new Ext.form.DisplayField({
// anchor: '100% 2%',
fieldLabel: 'Modified',
fieldLabel: 'Evaluated',
hideLabel: false,
allowBlank: true,
name: 'editStr',
Expand All @@ -281,14 +281,14 @@ SM.Review.Form.Panel = Ext.extend(Ext.form.FormPanel, {
}
})
const sdf = new Ext.form.DisplayField({
fieldLabel: 'Status',
fieldLabel: 'Statused',
hideLabel: false,
allowBlank: true,
name: 'status',
formatValue: function (v) {
this.setValue(`<span class="sm-review-sprite sm-review-sprite-${v.label}"></span>
<span class="sm-review-sprite sm-review-sprite-date">${new Date(v.ts).format('Y-m-d H:i T')}</span>
<span class="sm-review-sprite sm-review-sprite-user">${v.user.username}<span>`)
this.setValue(`<span class="sm-review-sprite sm-review-sprite-date">${new Date(v.ts).format('Y-m-d H:i T')}</span>
<span class="sm-review-sprite sm-review-sprite-user">${v.user.username}</span>
<span class="sm-review-sprite sm-review-sprite-${v.label}"></span>`)
}
})
const btn1 = new SM.Review.Form.Button({
Expand Down
14 changes: 13 additions & 1 deletion client/src/js/collectionReview.js
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ async function addCollectionReview ( params ) {
type: 'string'
},
'resultEngine',
'touchTs',
{
name: 'engineResult',
convert: engineResultConverter
Expand Down Expand Up @@ -1044,7 +1045,18 @@ async function addCollectionReview ( params ) {
filter: {
type: 'values'
}
}
},
{
id: 'touchTs' + idAppend,
header: '<div exportvalue="touchTs" class="sm-history-icon" ext:qtip="Last action"></div>',
fixed: true,
width: 48,
align: 'center',
dataIndex: 'touchTs',
sortable: true,
renderer: renderDurationToNow
}

],
isCellEditable: function(col, row) {
var record = reviewsStore.getAt(row);
Expand Down
31 changes: 24 additions & 7 deletions client/src/js/review.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ async function addReview( params ) {
name: 'engineResult',
convert: engineResultConverter
},
{
name: 'reviewComplete',
type: 'boolean'
}
'touchTs'
]);


Expand Down Expand Up @@ -625,8 +622,17 @@ async function addReview( params ) {
type: 'values',
renderer: SM.ColumnFilters.Renderers.status
}
},
{
id: 'touchTs' + idAppend,
header: '<div exportvalue="touchTs" class="sm-history-icon" ext:qtip="Last action"></div>',
fixed: true,
width: 44,
align: 'center',
dataIndex: 'touchTs',
sortable: true,
renderer: renderDurationToNow
}

],
autoExpandColumn: 'ruleTitle' + idAppend,
loadMask: {msg: ''},
Expand Down Expand Up @@ -762,6 +768,7 @@ async function addReview( params ) {
type: 'string'
},
'resultEngine',
'touchTs',
{
name: 'engineResult',
convert: engineResultConverter
Expand Down Expand Up @@ -909,7 +916,7 @@ async function addReview( params ) {
},
{
header: "Status",
width: 50,
width: 44,
fixed: true,
align: 'center',
dataIndex: 'status',
Expand All @@ -922,6 +929,16 @@ async function addReview( params ) {
renderer: SM.ColumnFilters.Renderers.status
}
},
{
id: 'touchTs' + idAppend,
header: '<div exportvalue="touchTs" class="sm-history-icon" ext:qtip="Last action"></div>',
fixed: true,
width: 44,
align: 'center',
dataIndex: 'touchTs',
sortable: true,
renderer: renderDurationToNow
},
{
header: "User",
width: 50,
Expand Down Expand Up @@ -1385,8 +1402,8 @@ async function addReview( params ) {

// Update group grid
fp.groupGridRecord.data.result = reviewFromApi.result
fp.groupGridRecord.data.reviewComplete = reviewFromApi.reviewComplete
fp.groupGridRecord.data.status = reviewFromApi.status.label
fp.groupGridRecord.data.touchTs = reviewFromApi.touchTs
fp.groupGridRecord.data.resultEngine = reviewFromApi.resultEngine
fp.groupGridRecord.data.engineResult = engineResultConverter('', reviewFromApi)
fp.groupGridRecord.commit()
Expand Down

0 comments on commit a7756b1

Please sign in to comment.