Uploaded image for project: 'Cockpit'
  1. Cockpit
  2. COCKPIT-1215

Design a new File API importable as ESM module

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • None
    • None
    • 10
    • False
    • None
    • False
    • Testable
    • ?
    • ?
    • ?
    • Quarterly Plan 25Q1

      For uploading as administrator and for a recent bug fix in Cockpit the cockpit.file API has to be extended to support setting the owner/group and the file mode.

      Setting the owner/group is already implemented in a draft PR but due to the nature of our existing API's we can't detect if a new owner/group/mode setting is supported. The existing `cockpit.file("/tmp/foo").replace("content", tag)` API can be extended but as JavaScript doesn't error when passing extra arguments we can't detect if a new option was added.

      This and the usage of non native Promise API's (defer) opens up the opportunity to re-design this API and allow it to be importable from the cockpit module. Plus fully written in TypeScript.

      The existing file API will exists and become deprecated and everything slowly moves over to:

      import { File } from "cockpit"
      

      As a first step, this requires collecting all current usages of the (old) file API, and a list of cases/spawn("chown") etc. hacks that we do in cockpit and c-files that we would like to have. Then we can design a new API and check it against that list purely on paper.

              jvanderw@redhat.com Jelle van der Waa
              jvanderw@redhat.com Jelle van der Waa
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: