USF-IMARS/grafana-erddap

do not show duplicate images

Opened this issue · 1 comments

7yl4r commented

Setting a time delta of higher granularity than the source data will result in duplicated images.
That ok, but even better might be to replace the duplicates with a placeholder image.

I just created a placeholder image ellipsis.png and stuck a TODO in the function where this test ought to go.

The trouble is that comparing the content of two images w/ different URLs is not easy.
Just another enhancement that is very doable but not worth the time until someone asks for it.

7yl4r commented

This is kind-of fixed because angular throws errors on duplicate images inside the ng-repeat.
I introduced this accidentally, but I think it is an accidental "feature".

Error: [ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: url in ctrl.panel.urls track by url.request_time, Duplicate key: Thursday, Dec 27th, Duplicate value: {"display":"http://imars-physalis.marine.usf.edu:8080/erddap/griddap/jplMURSST41anom1day.png?sstAnom[(2018-12-27T22:28:00Z)][(23.5):(26)][(-84):(-79.5)]&.draw=surface&.vars=longitude%7Clatitude%7CsstAnom&.colorBar=%7C%7C%7C%7C%7C&.bgColor=0xffccccff&.trim=1&.legend=Bottom&.size=16800%7C","link":"http://imars-physalis.marine.usf.edu:8080/erddap/griddap/jplMURSST41anom1day.largePng?sstAnom[(2018-12-27T22:28:00Z)][(23.5):(26)][(-84):(-79.5)]&.draw=surface&.vars=longitude%7Clatitude%7CsstAnom&.colorBar=%7C%7C%7C%7C%7C&.bgColor=0xffccccff&.trim=1&.legend=Bottom&.size=%7C","request_time":"Thursday, Dec 27th"}
http://errors.angularjs.org/1.6.6/ngRepeat/dupes?p0=url%20in%20ctrl.panel.urls%20track%20by%20url.request_time&p1=Thursday%2C%20Dec%2027th&p2=%7B%22display%22%3A%22http%3A%2F%2Fimars-physalis.marine.usf.edu%3A8080%2Ferddap%2Fgriddap%2FjplMURSST41anom1day.png%3FsstAnom%5B(2018-12-27T22%3A28%3A00Z)%5D%5B(23.5)%3A(26)%5D%5B(-84)%3A(-79.5)%5D%26.draw%3Dsurface%26.vars%3Dlongitude%257Clatitude%257CsstAnom%26.colorBar%3D%257C%257C%257C%257C%257C%26.bgColor%3D0xffccccff%26.trim%3D1%26.legend%3DBottom%26.size%3D16800%257C%22%2C%22link%22%3A%22http%3A%2F%2Fimars-physalis.marine.usf.edu%3A8080%2Ferddap%2Fgriddap%2FjplMURSST41anom1day.largePng%3FsstAnom%5B(2018-12-27T22%3A28%3A00Z)%5D%5B(23.5)%3A(26)%5D%5B(-84)%3A(-79.5)%5D%26.draw%3Dsurface%26.vars%3Dlongitude%257Clatitude%257CsstAnom%26.colorBar%3D%257C%257C%257C%257C%257C%26.bgColor%3D0xffccccff%26.trim%3D1%26.legend%3DBottom%26.size%3D%257C%22%2C%22request_time%22%3A%22Thursday%2C%20Dec%2027th%22%7D

I keep thinking something like the following is going to fix this, but the data isn't on the client-side until the actual image data comes back out. I am pretty baffled as to how angular is identifying the duplicates since display and link urls and request_time are unique.

            if (this.panel.urls.includes(this_url)){
                console.log('dup')
            } else {
                this.panel.urls.push(this_url)
            }