Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playout history flash buttons are not executed #518

Closed
Tracked by #249
dosmanak opened this issue Sep 16, 2018 · 13 comments · Fixed by #1164
Closed
Tracked by #249

Playout history flash buttons are not executed #518

dosmanak opened this issue Sep 16, 2018 · 13 comments · Fixed by #1164

Comments

@dosmanak
Copy link

Hello. On playout history there are three buttons that should execute flash script to copy/csv/pdf export.
I can not run any button both from google chrome and firefox .
I am not sure how to debug it. When I allow flash on the page I can see puzzle button, but nothing happens when I click it on network view nor console. There is not any request made to server so I can not check logs.

Perhaps I am doing something wrong or my installation is wrong. But perhaps someone could test it?
I am at commit 4508d0d

BTW Is there a reason for flash?

Thank you.

@Robbt
Copy link
Member

Robbt commented Sep 17, 2018

Honestly I am not sure if this code is complete. This was written before we forked the project to LibreTime so it will require some detective work to determine the status of these features.

@hairmare
Copy link
Member

hairmare commented Oct 6, 2018

It did work at some point. From what I remember it isn't working anymore because it tries to use outdated Flash features that any sane, modern browser will block.

I think the reason for Flash here was to allow copying to the clipboard (which couldn't be done natively at the time). Personally I feel a csv download should be enough for any use cases.

Pull-Requests to refactor this are very much welcome ;)

@Robbt Robbt added this to High priority in Bug Triage Board Apr 23, 2019
@Robbt Robbt moved this from High priority to Low priority in Bug Triage Board Apr 23, 2019
@Robbt Robbt moved this from Low priority to High priority in Bug Triage Board Apr 23, 2019
@kmahelona
Copy link
Contributor

kmahelona commented Aug 13, 2019

Aloha. I’ve had a quick look at this and it appears that the DataTables.js package is used to generate the CSV files. On initial inspection I thought it's just a matter of updating that package, but I think DataTables is used throughout the site not just on the playouthistory view.

We need playout history for reporting purposes so I'm happy to take a look at this. But because it touches a bunch of IMPORTANT areas ... I'm not sure I'm the best to do this? One alternative is to build a custom button that does the export rather than updating DataTables. That might be the easier route but not the best one.

Update: And on further inspection, yea pretty much the core of the UI for LibreTime is driven by manipulating tables which uses DataTables ... so I'm definitely hesitant to lead this :/.

@Robbt
Copy link
Member

Robbt commented Aug 13, 2019

Yeah you are right, DataTables is pretty much the UI for LibreTime and so updating it will be a pain, partially because there are a number of hacked plugins and extensions that modify the functionality. It is one of these points in the codebase where we might be better off rebuilding it with an alternative to datatables. It is hard to say for sure, it is one of our biggest instances of technical debt.

So the issue I think isn't that playout history doesn't exist but that it isn't generating an easy to export CSV correct ? We can probably fix that without overhauling datatables completely.

@hairmare
Copy link
Member

I've been down the rabbit-hole that is updating datatables (without success).

One of my motivating factors at the time was that modern versions of datatables have support for using HTML5 APIs instead of just Flash in their export bits.

@zklosko
Copy link
Member

zklosko commented Aug 6, 2020

Bumping this because this is still an issue that needs to be fixed, especially by the time Flash Player is no longer supported (this December).

@hairmare
Copy link
Member

hairmare commented Nov 30, 2020

As dicussed at the meetup we consider this (+ the ui it's on) as a candidate for early in the vue frontend rewite.

Looking at it from a feature perspective the current, mostly datatables based ui widget does the following:

  • copy data to clipboard
  • download data in csv representation
  • download data in pdf representation
  • print data to printer

Personally I've never used any of these features so I don't know much about how they are to be used (esp. in the context of the playout history page).

Of the use cases the widget does only the csv download seems obvious in both what it is for and how to implement it.

I'll try to use this widget to help init the vue based frontend, but I'd like to clarify a couple of questions first...

  • What data/format would you expect on you clipboard when pressing "copy"?
  • How would a PDF render/print of this data look?

Maybe it makes more sense to reason about the actual requirement...

  • Is the CSV important for futher use of the data?
  • Does a download vs. copy-to-clipboard feature have relevance to the where this might be used?
  • Would there be any need for precice formatting (ie. station logo) in the print/PDF output?

When I get to thinking about it I'd like to suggest leaving out a couple of features while re-implementing the mainly flash based "copy/csv/pdf/print" component.

Proposal

The new component would support less options:

  • Download data as JSON (native dl from new API)
  • Download data as CSV (either via native API Accept header or with something like vue-json-csv)

IMO the print and PDF features are better realized outside of LibreTime, using either the new API or CSV exports the data can be transformed to printable output or a PDF easily.

From a frontend PoV this leads to a simplified component that consists of simple inline menu with options for various export formats:

unclicked widget
image

clicked widget
image

The choice of JSON or CSV would trigger a download. Later we have to option of extending this component to export other formats (ie. vendorized JSON, XML, ...) depending on what we decide to support.

Further we can also consider using the component with other data where a UI to download some data is helpful to hint at the existance of the API.

(the oversized mockups are based on vue/vuetify withou any styling and do not reflect how the component will end up looking)

As always, feedback is highly appreciated!

@paddatrapper
Copy link
Contributor

Our use case here is for producing payout reports for specific tracks for spot reports. It would be great to be able to filter based on track, creator, etc. That proposal sounds like it would work for us

@zklosko
Copy link
Member

zklosko commented Dec 24, 2020

Does anyone know Libretime uses TableTools or the TableTools plugins for anything besides the Flash export buttons?

@zklosko
Copy link
Member

zklosko commented Dec 26, 2020

Related to #249:

The good news: I found a way to remove the Flash exporting buttons for the playout history page, which doesn't break the rest of the interface. The bad news: there's nothing in the Datatables API for 1.9.4 (the version we're using) for exporting data; that requires an upgrade to Datatables 1.10 which completely breaks Libretime.

In the short term, we can:

  1. Create a custom exporting component in Javascript using PDFMake and friends, or
  2. Completely scrap the exporting feature until the rewrite is complete

@dosmanak
Copy link
Author

dosmanak commented Dec 26, 2020 via email

@zklosko
Copy link
Member

zklosko commented Dec 26, 2020

@dosmanak I'm not too familiar with that method, but I'd love to hear more. I do know we use a PHP ORM which can be used to get the data. I do wonder if we would need the script to allow selection/omission of records for export...

@zklosko
Copy link
Member

zklosko commented Dec 28, 2020

@paddatrapper @hairmare @Robbt and others... I'm trying to find a way to pull JSON data for the playout history page. I found this line in historytable.js

columns = JSON.parse(localStorage.getItem('datatables-historyfile-aoColumns'));

but I haven't found a way to return actual data from it. Can someone please show me how to get this piece of JSON data?

Bug Triage Board automation moved this from High priority to Closed Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Bug Triage Board
  
Closed
Development

Successfully merging a pull request may close this issue.

6 participants