Skip to content

0.2.0

Choose a tag to compare

@amermmohammed amermmohammed released this 28 Nov 07:08
· 66 commits to main since this release

Tools run inside Symfony and Laravel, a tool can be closed to some users, a table reads its pages from a database, and a bar shows how far a long task is. Before you update from 0.1.0, read "Security" and "Changed": a few things behave differently, and a class of your own that implements Session needs one more method.

Added

  • progress() shows how far a task is: a label, the browser's own bar and a percentage, or your own words with text:. Without a value the bar only says that work is going on. With refresh() on the same page it follows a task that a worker does somewhere else. There, good news of a button (success(), info()) next to a bar that is not full stays for ten seconds, and the page then goes on by itself. Bad news waits for the user, as on every page. The demo has a tool that exports orders this way.
  • table() takes a function in place of the rows, for a table that is too long to pass in. The table asks it for one page at a time with a TableQuery (the search, the order, a limit and an offset), and the rows stay in the database. sortable: names the columns whose headers sort, and count: says how many rows there are. Without count: the table offers "Previous" and "Next" without a count. Ticks count for the page on the screen, and the table says so when a turned page leaves ticked rows behind.
  • respond() hands the page back instead of sending it, for an application built on Symfony or Laravel: a controller makes the response of its framework from the status, the headers and the body. session: keeps what the tools keep in the session of the application. Tried inside Laravel 12 and 13 and Symfony 7.4 and 8.1.
  • variables: in serve() gives every tool of a folder variables by name.
  • user() and the log name a user object of Symfony or Laravel by its identifier (getUserIdentifier(), getAuthIdentifier()), when the login check returns one.
  • The list of tools says when the folder of tools lies in the web root, where a web server runs a tool file by its name and past the checks of serve(). The note shows only where error details are shown.
  • allow: in serve() and configure() says who may open which tool. It gets what the login check returned and the id of a tool. A tool that is not allowed is left out of the list and answers "Not allowed" before anything of it runs. Only a plain true opens a tool, and the question is asked on every request.

Security

  • What the library keeps in a session belongs to the user the login check named. When another name shows up in the same session, as after a login without a logout before it, the saved inputs, the uploaded files, the waiting messages and the token of the forms are dropped. Before, they went to whoever used the session next. A session that an older version began has no owner yet, so it starts from nothing once as well.

Changed

  • A user object that has getUserIdentifier() or getAuthIdentifier() goes by what that returns, also when the object is a text as well (__toString()). Before, the text was its name.
  • The Session interface has a new method, clear(). A class of your own that implements the interface needs it too.
  • A served tool that ends PHP with exit gets its page sent at that moment, and no longer when PHP shuts down.
  • The list of tools is at the base as base: is written. With base: '/admin/tools' the links to the list now lead to /admin/tools and no longer to /admin/tools/. End the base with a slash to keep the old address.

Fixed

  • After a fatal error in a served tool the page reports the failure also when another shutdown function raised a warning first. Before, that warning hid the error, and the half-drawn page was sent as if all was well.

Update

composer require runio/script-ui:^0.2

A plain composer update stays on 0.1, because Composer treats a new 0.x version as one that may break things.

The readme shows every function, and the full changelog lists every commit.