MCPcopy
hub / github.com/openstf/stf / DeviceModelCell

Function DeviceModelCell

res/app/device-list/column/device-column-service.js:574–612  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

572}
573
574function DeviceModelCell(options) {
575 return _.defaults(options, {
576 title: options.title
577 , defaultOrder: 'asc'
578 , build: function() {
579 var td = document.createElement('td')
580 var span = document.createElement('span')
581 var image = document.createElement('img')
582 span.className = 'device-small-image'
583 image.className = 'device-small-image-img pointer'
584 span.appendChild(image)
585 td.appendChild(span)
586 td.appendChild(document.createTextNode(''))
587 return td
588 }
589 , update: function(td, device) {
590 var span = td.firstChild
591 var image = span.firstChild
592 var t = span.nextSibling
593 var src = '/static/app/devices/icon/x24/' +
594 (device.image || '_default.jpg')
595
596 // Only change if necessary so that we don't trigger a download
597 if (image.getAttribute('src') !== src) {
598 image.setAttribute('src', src)
599 }
600
601 t.nodeValue = options.value(device)
602
603 return td
604 }
605 , compare: function(a, b) {
606 return compareRespectCase(options.value(a), options.value(b))
607 }
608 , filter: function(device, filter) {
609 return filterIgnoreCase(options.value(device), filter.query)
610 }
611 })
612}
613
614function DeviceNameCell(options, ownerEmail) {
615 return _.defaults(options, {

Callers 1

Calls 2

compareRespectCaseFunction · 0.85
filterIgnoreCaseFunction · 0.85

Tested by

no test coverage detected