From 628b12cfcfccc76d40c1f0419361bab339127b7b Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Fri, 27 Jan 2023 15:01:35 +0100 Subject: [PATCH 01/51] Copied from PackageKit/docs/api/dbus https://github.com/PackageKit/PackageKit/tree/dadea5f987d7f86baff9abf42f9462d7f76a0e0e/docs/api/dbus The PackageKit license is GPLv2, the same as ours, good --- doc/dbus/dbus-introspect-docs.dtd | 32 +++ doc/dbus/spec-to-docbook.sh | 7 + doc/dbus/spec-to-docbook.xsl | 436 ++++++++++++++++++++++++++++++ 3 files changed, 475 insertions(+) create mode 100644 doc/dbus/dbus-introspect-docs.dtd create mode 100755 doc/dbus/spec-to-docbook.sh create mode 100644 doc/dbus/spec-to-docbook.xsl diff --git a/doc/dbus/dbus-introspect-docs.dtd b/doc/dbus/dbus-introspect-docs.dtd new file mode 100644 index 0000000000..5fe508ef3b --- /dev/null +++ b/doc/dbus/dbus-introspect-docs.dtd @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/dbus/spec-to-docbook.sh b/doc/dbus/spec-to-docbook.sh new file mode 100755 index 0000000000..c5d7f82c4e --- /dev/null +++ b/doc/dbus/spec-to-docbook.sh @@ -0,0 +1,7 @@ +#!/bin/sh +spec_to_docbook_xsl="$1" +input_file="$2" +output_file="$3" + +echo """" > ${output_file} +xsltproc ${spec_to_docbook_xsl} ${input_file} | tail -n +2 >> ${output_file} diff --git a/doc/dbus/spec-to-docbook.xsl b/doc/dbus/spec-to-docbook.xsl new file mode 100644 index 0000000000..fccf887fef --- /dev/null +++ b/doc/dbus/spec-to-docbook.xsl @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + interface + + + + Methods + + + + + + + + + Signals + + + + + + + + + Implemented Interfaces + + implements + org.freedesktop.DBus.Introspectable, + org.freedesktop.DBus.Properties + + + + + Properties + + + + + + + + + Description + + + + + + + Details + + + + + + + Signal Details + + + + + + + Property Details + + + + + + + + + + + + + + +: + + + + + + + + + + + + + + + + + + + + + + <anchor role="function"><xsl:attribute name="id"><xsl:value-of select="$basename"/>:<xsl:value-of select="@name"/></xsl:attribute></anchor>The "<xsl:value-of select="@name"/>" property + +'' + + + + + + + + + + + + + +: + + + + + + + + + + + + + + + + + + + + + <anchor role="function"><xsl:attribute name="id"><xsl:value-of select="$basename"/>::<xsl:value-of select="@name"/></xsl:attribute></anchor>The <xsl:value-of select="@name"/> signal + + () + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Since + + + + + + + + /> + + + + + + + is deprecated since version and should not be used in newly-written code. Use + + + + + : + + + :: + + + . + + + + + + + + + + + + + + + +instead. + + + + + + + + + + + +See also: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +: + + + + + + + + + + + + + + + + + + + + + <anchor role="function"><xsl:attribute name="id"><xsl:value-of select="$basename"/>.<xsl:value-of select="@name"/></xsl:attribute></anchor><xsl:value-of select="@name"/> () + + () + + + + + + + + + + + + + + + + +:'' + + + + + + + + + + + + +::() + + + + + + + + + + + + +.() + + + + + +'' +, + + + + + +'' +, + + + + + + +'' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From a0ebf38eaddbd86fd2cd5e54d933dce677890f70 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Fri, 27 Jan 2023 15:05:33 +0100 Subject: [PATCH 02/51] First skeleton of Manager1 API docs Seed it: sudo busctl \-\-verbose \ \-\-address unix:path=/run/d-installer/bus \ call \ org.opensuse.DInstaller \ /org/opensuse/DInstaller/Manager1 \ org.freedesktop.DBus.Introspectable \ Introspect (the escaped dash is so that a double dash does not invalidate a XML comment, yay) Remove other interfaces, leave only one. Render it: for f in org.opensuse.DInstaller.Manager1.xml; do docbook=${f%.xml}.ref.xml ./spec-to-docbook.sh spec-to-docbook.xsl $f $docbook xmlto --skip-validation html-nochunks $docbook done TODO: Read this with the library and validate that it matches (does not conflict) with what the code declares. Or maybe generate stub code? --- doc/dbus/org.opensuse.Agama.Manager1.xml | 56 ++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 doc/dbus/org.opensuse.Agama.Manager1.xml diff --git a/doc/dbus/org.opensuse.Agama.Manager1.xml b/doc/dbus/org.opensuse.Agama.Manager1.xml new file mode 100644 index 0000000000..e7562ce2fa --- /dev/null +++ b/doc/dbus/org.opensuse.Agama.Manager1.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + All possible phases: + [ + {"id" => 0, "label" => "startup"}, + {"id" => 1, "label" => "config"}, + {"id" => 2, "label" => "install"} + ] + + + + + + + + + + Id of the current phase. + + + + + + + + + + List of names of the currently busy services. + + + + + + From eb69130962ba8dd8db2288c66712fb463bc08e64 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Wed, 29 Mar 2023 13:35:21 +0200 Subject: [PATCH 03/51] doc/dbus: a simple Makefile also put it into toplevel Rakefile? --- doc/dbus/.gitignore | 3 +++ doc/dbus/Makefile | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 doc/dbus/.gitignore create mode 100644 doc/dbus/Makefile diff --git a/doc/dbus/.gitignore b/doc/dbus/.gitignore new file mode 100644 index 0000000000..895594a5da --- /dev/null +++ b/doc/dbus/.gitignore @@ -0,0 +1,3 @@ +# or maybe commit them. depends on the deployment model +*.ref.xml +*.ref.html diff --git a/doc/dbus/Makefile b/doc/dbus/Makefile new file mode 100644 index 0000000000..5117e73d89 --- /dev/null +++ b/doc/dbus/Makefile @@ -0,0 +1,7 @@ +# quick and dirty +all: + for f in org.opensuse.Agama.*1.xml; do \ + docbook=$${f%.xml}.ref.xml; \ + ./spec-to-docbook.sh spec-to-docbook.xsl $$f $$docbook; \ + xmlto --skip-validation html-nochunks $$docbook; \ + done From 6b547d68e9fec29c98a5435b1d2b49893aac4aa6 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Wed, 29 Mar 2023 13:51:27 +0200 Subject: [PATCH 04/51] doc/dbus: seed Language1.xml --- doc/dbus/org.opensuse.Agama.Language1.xml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 doc/dbus/org.opensuse.Agama.Language1.xml diff --git a/doc/dbus/org.opensuse.Agama.Language1.xml b/doc/dbus/org.opensuse.Agama.Language1.xml new file mode 100644 index 0000000000..52a64bf787 --- /dev/null +++ b/doc/dbus/org.opensuse.Agama.Language1.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + From 15a867c4775bfedc4aa1a10b5fe1392984bffe33 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Thu, 30 Mar 2023 11:15:30 +0200 Subject: [PATCH 05/51] doc/dbus: remove the helper script it was there only to insert the DOCTYPE into the result, and XSLT can do it natively --- doc/dbus/Makefile | 2 +- doc/dbus/spec-to-docbook.sh | 7 ------- doc/dbus/spec-to-docbook.xsl | 3 +++ 3 files changed, 4 insertions(+), 8 deletions(-) delete mode 100755 doc/dbus/spec-to-docbook.sh diff --git a/doc/dbus/Makefile b/doc/dbus/Makefile index 5117e73d89..b4eeb03635 100644 --- a/doc/dbus/Makefile +++ b/doc/dbus/Makefile @@ -2,6 +2,6 @@ all: for f in org.opensuse.Agama.*1.xml; do \ docbook=$${f%.xml}.ref.xml; \ - ./spec-to-docbook.sh spec-to-docbook.xsl $$f $$docbook; \ + xsltproc --output $$docbook spec-to-docbook.xsl $$f; \ xmlto --skip-validation html-nochunks $$docbook; \ done diff --git a/doc/dbus/spec-to-docbook.sh b/doc/dbus/spec-to-docbook.sh deleted file mode 100755 index c5d7f82c4e..0000000000 --- a/doc/dbus/spec-to-docbook.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -spec_to_docbook_xsl="$1" -input_file="$2" -output_file="$3" - -echo """" > ${output_file} -xsltproc ${spec_to_docbook_xsl} ${input_file} | tail -n +2 >> ${output_file} diff --git a/doc/dbus/spec-to-docbook.xsl b/doc/dbus/spec-to-docbook.xsl index fccf887fef..b0a03934b4 100644 --- a/doc/dbus/spec-to-docbook.xsl +++ b/doc/dbus/spec-to-docbook.xsl @@ -18,6 +18,9 @@ +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> + From c01be3ac44f008af77adbd00c002e9b8ae82c34c Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Thu, 30 Mar 2023 11:18:13 +0200 Subject: [PATCH 06/51] doc/dbus: don't validate the introspection xml avoiding this warning: > org.opensuse.Agama.Language1.xml:2: warning: failed to load external entity "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd" I guess there is a way to make the validation work via /etc/xml/catalog but let's skip that for now --- doc/dbus/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/dbus/Makefile b/doc/dbus/Makefile index b4eeb03635..f424d82288 100644 --- a/doc/dbus/Makefile +++ b/doc/dbus/Makefile @@ -2,6 +2,6 @@ all: for f in org.opensuse.Agama.*1.xml; do \ docbook=$${f%.xml}.ref.xml; \ - xsltproc --output $$docbook spec-to-docbook.xsl $$f; \ + xsltproc --novalid --output $$docbook spec-to-docbook.xsl $$f; \ xmlto --skip-validation html-nochunks $$docbook; \ done From 5825186b7b181205b6099fcd373e7e437c0ed13b Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Thu, 30 Mar 2023 16:23:49 +0200 Subject: [PATCH 07/51] doc/dbus: docbook: removed "Implemented Interfaces" it is hardcoded and more confusing than helping --- doc/dbus/spec-to-docbook.xsl | 9 --------- 1 file changed, 9 deletions(-) diff --git a/doc/dbus/spec-to-docbook.xsl b/doc/dbus/spec-to-docbook.xsl index b0a03934b4..762b41b409 100644 --- a/doc/dbus/spec-to-docbook.xsl +++ b/doc/dbus/spec-to-docbook.xsl @@ -49,15 +49,6 @@ - - Implemented Interfaces - - implements - org.freedesktop.DBus.Introspectable, - org.freedesktop.DBus.Properties - - - Properties From 714684ad3601f0b6c2afdb6f138538811eea1615 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Thu, 30 Mar 2023 16:24:43 +0200 Subject: [PATCH 08/51] doc/dbus: docbook: reformatted method-details for readability of both xslt and the docbook output --- doc/dbus/spec-to-docbook.xsl | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/doc/dbus/spec-to-docbook.xsl b/doc/dbus/spec-to-docbook.xsl index 762b41b409..4b62601ea9 100644 --- a/doc/dbus/spec-to-docbook.xsl +++ b/doc/dbus/spec-to-docbook.xsl @@ -305,10 +305,32 @@ See also: + - <anchor role="function"><xsl:attribute name="id"><xsl:value-of select="$basename"/>.<xsl:value-of select="@name"/></xsl:attribute></anchor><xsl:value-of select="@name"/> () - - () + + <anchor role="function"> + <xsl:attribute name="id"> + <xsl:value-of select="$basename"/>.<xsl:value-of select="@name"/> + </xsl:attribute> + </anchor> + <xsl:value-of select="@name"/> + <xsl:text> ()</xsl:text> + + + + + + + + + ( + + + + + ) + + From 4bbb8265ca502638f85ade66dbda9edd06a115dc Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Thu, 30 Mar 2023 16:25:16 +0200 Subject: [PATCH 09/51] doc/dbus: docbook: added an "Example:" caption for the examples --- doc/dbus/spec-to-docbook.xsl | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/dbus/spec-to-docbook.xsl b/doc/dbus/spec-to-docbook.xsl index 4b62601ea9..a32f7eb8fe 100644 --- a/doc/dbus/spec-to-docbook.xsl +++ b/doc/dbus/spec-to-docbook.xsl @@ -175,6 +175,7 @@ + Example: From 1ac82db8045716c4bb58bcee44874442927a9b8c Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Thu, 30 Mar 2023 16:50:23 +0200 Subject: [PATCH 10/51] doc/dbus: docbook: added handling of doc:summary it was never in the original stylesheet which originally comes (with design docs!) from https://gitlab.freedesktop.org/dbus/dbus-doc/-/blob/master/tools/spec-to-docbook.xsl also process the _ref_ links in argument descriptions --- doc/dbus/spec-to-docbook.xsl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/dbus/spec-to-docbook.xsl b/doc/dbus/spec-to-docbook.xsl index a32f7eb8fe..1c63ea5871 100644 --- a/doc/dbus/spec-to-docbook.xsl +++ b/doc/dbus/spec-to-docbook.xsl @@ -91,12 +91,13 @@ + : - + @@ -129,12 +130,13 @@ + : - + @@ -171,7 +173,9 @@ - + + + @@ -282,12 +286,13 @@ See also: + : - + From 1c04070c809ac0c2780c91cf62fe2763010fcca3 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Thu, 30 Mar 2023 17:09:17 +0200 Subject: [PATCH 11/51] doc/dbus: add docs of org.opensuse.Agama.Language1 --- doc/dbus/org.opensuse.Agama.Language1.xml | 38 ++++++++++++++++++++--- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/doc/dbus/org.opensuse.Agama.Language1.xml b/doc/dbus/org.opensuse.Agama.Language1.xml index 52a64bf787..360cb98c3c 100644 --- a/doc/dbus/org.opensuse.Agama.Language1.xml +++ b/doc/dbus/org.opensuse.Agama.Language1.xml @@ -4,14 +4,44 @@ sudo busctl -\-verbose -\-address unix:path=/run/agama/bus -\-xml-interface introspect org.opensuse.Agama.Language1 /org/opensuse/Agama/Language1 # but pick only the main interface --> - + - + + Set list of languages to install + + + ToInstall(["cs_CZ", "de_DE"]) + + + + + + List of language IDs from AvailableLanguages + + - - + + + List of all available languages to install on target system. + + Elements are triples: + language ID, human readable language name, and + a dictionary for future extensions to provide more data + + AvailableLanguages -> [["cs_CZ", "Czech", {}]] + + + + + + + List of languages to install. Same format as ToInstall + + From c039b0dd3f04499522fc6b8806d1b2caf47a4680 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Thu, 30 Mar 2023 17:14:55 +0200 Subject: [PATCH 12/51] doc/dbus: org.opensuse.Agama1.Manager.xml fix versioning improve formatting --- doc/dbus/org.opensuse.Agama.Manager1.xml | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/doc/dbus/org.opensuse.Agama.Manager1.xml b/doc/dbus/org.opensuse.Agama.Manager1.xml index e7562ce2fa..cbed9eace8 100644 --- a/doc/dbus/org.opensuse.Agama.Manager1.xml +++ b/doc/dbus/org.opensuse.Agama.Manager1.xml @@ -1,11 +1,11 @@ - - + @@ -23,11 +23,11 @@ sudo busctl -\-address unix:path=/run/agama/bus -\-xml-interface introspect org. All possible phases: - [ + [ {"id" => 0, "label" => "startup"}, {"id" => 1, "label" => "config"}, {"id" => 2, "label" => "install"} - ] +] @@ -35,21 +35,17 @@ sudo busctl -\-address unix:path=/run/agama/bus -\-xml-interface introspect org. - - + Id of the current phase. - - + - - + List of names of the currently busy services. - - + From 35d17067fddc4a6fc3017af8e5f83cd468b27a46 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Thu, 30 Mar 2023 17:18:08 +0200 Subject: [PATCH 13/51] doc/dbus: make it work with funny versioning --- doc/dbus/Makefile | 4 ++-- ...ma.Language1.xml => org.opensuse.Agama.Language1.dbus.xml} | 0 ...gama.Manager1.xml => org.opensuse.Agama1.Manager.dbus.xml} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename doc/dbus/{org.opensuse.Agama.Language1.xml => org.opensuse.Agama.Language1.dbus.xml} (100%) rename doc/dbus/{org.opensuse.Agama.Manager1.xml => org.opensuse.Agama1.Manager.dbus.xml} (100%) diff --git a/doc/dbus/Makefile b/doc/dbus/Makefile index f424d82288..99bbba5350 100644 --- a/doc/dbus/Makefile +++ b/doc/dbus/Makefile @@ -1,7 +1,7 @@ # quick and dirty all: - for f in org.opensuse.Agama.*1.xml; do \ - docbook=$${f%.xml}.ref.xml; \ + for f in org.opensuse.Agama*.dbus.xml; do \ + docbook=$${f%.dbus.xml}.ref.xml; \ xsltproc --novalid --output $$docbook spec-to-docbook.xsl $$f; \ xmlto --skip-validation html-nochunks $$docbook; \ done diff --git a/doc/dbus/org.opensuse.Agama.Language1.xml b/doc/dbus/org.opensuse.Agama.Language1.dbus.xml similarity index 100% rename from doc/dbus/org.opensuse.Agama.Language1.xml rename to doc/dbus/org.opensuse.Agama.Language1.dbus.xml diff --git a/doc/dbus/org.opensuse.Agama.Manager1.xml b/doc/dbus/org.opensuse.Agama1.Manager.dbus.xml similarity index 100% rename from doc/dbus/org.opensuse.Agama.Manager1.xml rename to doc/dbus/org.opensuse.Agama1.Manager.dbus.xml From 7e41ef6f9ff233b145a1d2d49119573c903bac83 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Thu, 30 Mar 2023 17:57:55 +0200 Subject: [PATCH 14/51] doc/dbus: deployment: seeded a static GitHub pages action https://raw.githubusercontent.com/actions/starter-workflows/9e75fa6b3294adf3aa695272b2fbc6104ad75cba/pages/static.yml --- .github/workflows/pages-dbus-doc.yml | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/pages-dbus-doc.yml diff --git a/.github/workflows/pages-dbus-doc.yml b/.github/workflows/pages-dbus-doc.yml new file mode 100644 index 0000000000..43bec60eaf --- /dev/null +++ b/.github/workflows/pages-dbus-doc.yml @@ -0,0 +1,43 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy static content to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: [$default-branch] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + # Upload entire repository + path: '.' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 From 50d272750a7ca4893e379a53a669658a1bba9640 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Thu, 30 Mar 2023 18:28:21 +0200 Subject: [PATCH 15/51] doc/dbus: deployment: do it --- .github/workflows/pages-dbus-doc.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pages-dbus-doc.yml b/.github/workflows/pages-dbus-doc.yml index 43bec60eaf..7dcc953448 100644 --- a/.github/workflows/pages-dbus-doc.yml +++ b/.github/workflows/pages-dbus-doc.yml @@ -23,7 +23,7 @@ concurrency: jobs: # Single deploy job since we're just deploying - deploy: + pages_deploy: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} @@ -31,13 +31,22 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + + - name: Install DocBook tooling + run: | + sudo apt-get update + sudo apt-get --assume-yes --no-install-recommends install xmlto docbook-xsl + + - name: Build HTML via DocBook + run: cd doc/dbus; make + - name: Setup Pages uses: actions/configure-pages@v3 - name: Upload artifact uses: actions/upload-pages-artifact@v1 with: - # Upload entire repository - path: '.' + # upload the D-Bus docs... TODO index... what if we want something else too? + path: 'doc/dbus' - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v2 From aa920a28dc3e59811b1b3e5ff705ff85c0837ab1 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Thu, 30 Mar 2023 18:47:28 +0200 Subject: [PATCH 16/51] doc/dbus: index.html (manually updated) --- doc/dbus/index.html | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 doc/dbus/index.html diff --git a/doc/dbus/index.html b/doc/dbus/index.html new file mode 100644 index 0000000000..dbf9bdadca --- /dev/null +++ b/doc/dbus/index.html @@ -0,0 +1,6 @@ + From 75efd4adc98a12b653e4202aa6f023726a40fd4d Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Wed, 5 Apr 2023 11:15:50 +0200 Subject: [PATCH 17/51] doc/dbus: use *.doc.xml for the human edited files --- doc/dbus/Makefile | 4 ++-- doc/dbus/README.md | 12 ++++++++++++ ...dbus.xml => org.opensuse.Agama.Language1.doc.xml} | 0 ....dbus.xml => org.opensuse.Agama1.Manager.doc.xml} | 0 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 doc/dbus/README.md rename doc/dbus/{org.opensuse.Agama.Language1.dbus.xml => org.opensuse.Agama.Language1.doc.xml} (100%) rename doc/dbus/{org.opensuse.Agama1.Manager.dbus.xml => org.opensuse.Agama1.Manager.doc.xml} (100%) diff --git a/doc/dbus/Makefile b/doc/dbus/Makefile index 99bbba5350..df3d067c8c 100644 --- a/doc/dbus/Makefile +++ b/doc/dbus/Makefile @@ -1,7 +1,7 @@ # quick and dirty all: - for f in org.opensuse.Agama*.dbus.xml; do \ - docbook=$${f%.dbus.xml}.ref.xml; \ + for f in org.opensuse.Agama*.doc.xml; do \ + docbook=$${f%.doc.xml}.ref.xml; \ xsltproc --novalid --output $$docbook spec-to-docbook.xsl $$f; \ xmlto --skip-validation html-nochunks $$docbook; \ done diff --git a/doc/dbus/README.md b/doc/dbus/README.md new file mode 100644 index 0000000000..dabaf177c7 --- /dev/null +++ b/doc/dbus/README.md @@ -0,0 +1,12 @@ + + +## File Names + +**`*.doc.xml`**: documentation authored by humans in the `` tags + +**`*.ref.xml`**: intermediate, produced from `*.doc.xml`, contains DocBook +"**ref**entry" + +**`*.ref.html`**: rendered for publishing on GitHub Pages + +**`*.bus.xml`**: output of D-Bus introspection diff --git a/doc/dbus/org.opensuse.Agama.Language1.dbus.xml b/doc/dbus/org.opensuse.Agama.Language1.doc.xml similarity index 100% rename from doc/dbus/org.opensuse.Agama.Language1.dbus.xml rename to doc/dbus/org.opensuse.Agama.Language1.doc.xml diff --git a/doc/dbus/org.opensuse.Agama1.Manager.dbus.xml b/doc/dbus/org.opensuse.Agama1.Manager.doc.xml similarity index 100% rename from doc/dbus/org.opensuse.Agama1.Manager.dbus.xml rename to doc/dbus/org.opensuse.Agama1.Manager.doc.xml From b6d58c4bb3c8e60baa042781e7958a95f034f7b3 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Wed, 5 Apr 2023 11:17:41 +0200 Subject: [PATCH 18/51] doc/dbus: dtd: added ulink for general hyperlinks text working like docbook ulink --- doc/dbus/dbus-introspect-docs.dtd | 5 ++++- doc/dbus/spec-to-docbook.xsl | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/dbus/dbus-introspect-docs.dtd b/doc/dbus/dbus-introspect-docs.dtd index 5fe508ef3b..07f3ceed22 100644 --- a/doc/dbus/dbus-introspect-docs.dtd +++ b/doc/dbus/dbus-introspect-docs.dtd @@ -15,7 +15,7 @@ - + @@ -30,3 +30,6 @@ + + + diff --git a/doc/dbus/spec-to-docbook.xsl b/doc/dbus/spec-to-docbook.xsl index 1c63ea5871..f91e062c71 100644 --- a/doc/dbus/spec-to-docbook.xsl +++ b/doc/dbus/spec-to-docbook.xsl @@ -285,6 +285,13 @@ See also: + + + + + + + From 9f280f265b8f54daed4d4689b47b913dd1f72e0f Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Wed, 5 Apr 2023 11:19:28 +0200 Subject: [PATCH 19/51] doc/dbus: moved Language and Manager text from dbus_api.md --- doc/dbus/org.opensuse.Agama.Language1.doc.xml | 13 +++ doc/dbus/org.opensuse.Agama1.Manager.doc.xml | 37 +++++++ doc/dbus_api.md | 98 ++----------------- 3 files changed, 60 insertions(+), 88 deletions(-) diff --git a/doc/dbus/org.opensuse.Agama.Language1.doc.xml b/doc/dbus/org.opensuse.Agama.Language1.doc.xml index 360cb98c3c..5debf3b776 100644 --- a/doc/dbus/org.opensuse.Agama.Language1.doc.xml +++ b/doc/dbus/org.opensuse.Agama.Language1.doc.xml @@ -7,6 +7,19 @@ sudo busctl -\-verbose -\-address unix:path=/run/agama/bus -\-xml-interface intr + + + + Implementation note about language identifiers: + + + + Maybe use yast2-packager/LanguageTag. + See its announcement on yast-devel. + See also RFC 4647 Matching of Language Tags. + + + Set list of languages to install diff --git a/doc/dbus/org.opensuse.Agama1.Manager.doc.xml b/doc/dbus/org.opensuse.Agama1.Manager.doc.xml index cbed9eace8..e61451a7f9 100644 --- a/doc/dbus/org.opensuse.Agama1.Manager.doc.xml +++ b/doc/dbus/org.opensuse.Agama1.Manager.doc.xml @@ -29,6 +29,38 @@ sudo busctl -\-address unix:path=/run/agama/bus -\-xml-interface introspect org. {"id" => 2, "label" => "install"} ] + +The installation process follows a set of phases. Only the main service (`Agama::Manager`) +knows the information about the current installation phase. The rest of services will act as utility +services without any knowledge about the whole installation process. + + +A client (e.g., a web UI) will ask to the main service for the current phase of the installation. + + +In principle, the installation will follow 3 possible phases: *Startup*, *Config* and *Install*. + + +* *Startup* Phase: +This is the initial phase. The manager service will start in this phase and it will not change to +another phase until the client asks for performing the next phase. + + +* *Config* Phase: +The installation is configured during this phase. Configuring the installation means that everything +needed from the system is read and the required default proposal are calculated. In YaST terms, the +*config* phase implies to probe some modules like storage, language, etc, and to perform their +proposals. Note that not all modules have to be probed/proposed. Probing some modules could be +delayed to the next *install* phase. + + +* *Install* Phase: +This phase implies to perform everything to install the system according to the selected options and +proposals. Note that this phase is not only a typical YaST commit. For example, some proposals +(software?) could be done during this phase. In short, at the beginning of this phase we have all +the required information to perform the installation, and at the end of the phase the system is +installed. + @@ -46,6 +78,11 @@ sudo busctl -\-address unix:path=/run/agama/bus -\-xml-interface introspect org. List of names of the currently busy services. + +Note that the services are blocked meanwhile they are performing a long task. For this +reason, the *manager* service will store the status of each service and the clients will ask to +*manager* to know that status. + diff --git a/doc/dbus_api.md b/doc/dbus_api.md index ae35e462a9..5788319e50 100644 --- a/doc/dbus_api.md +++ b/doc/dbus_api.md @@ -46,37 +46,12 @@ We use these resources to get more familiar with D-Bus API designing. Iface: o.o.Agama.Language1 -#### methods: - -- ToInstall(array(string LangId)) -> void - Set list of languages to install - Example: - - ToInstall(["cs_CZ", "de_DE"]) -> () # only lang codes from AvailableLanguages is supported - -#### Properties (all read only): - -- AvailableLanguages -> array(struct(string LangId, string LangLabel, dict(string, variant) details)) - List of all available languages to install on target system. - Example: - - AvailableLanguages -> [["cs_CZ", "Czech", {}]] # it is lang code, human readable lang name and dict for future extensions to provide more data - -- MarkedForInstall -> array(string LangId) - List of languages to install. Same format as ToInstall +See the new-style [reference][lang-ref] ([source][lang-src]). -#### Signals: - -- PropertiesChanged ( only standard one from org.freedesktop.DBus.Properties interface ) - - -notes: - -identifiers: maybe LanguageTag https://www.rubydoc.info/github/yast/yast-packager/master/LanguageTag -- move it to yast-yast2 -- link to the standard from yard -- see https://tools.ietf.org/html/rfc4647 Matching of Language Tags -- see https://lists.opensuse.org/archives/list/yast-devel@lists.opensuse.org/message/D52PSZ7TRID2RVM6CE6K2C2RUNNGOS6Z/ + + +[lang-ref]: https://mvidner.github.io/agama/org.opensuse.Agama.Language1.ref.html +[lang-src]: dbus/org.opensuse.Agama.Language1.doc.xml ## Base Product @@ -803,62 +778,9 @@ any issue that might block the installation. ## Manager -### Installation Phases - -The installation process follows a set of phases. Only the main service (`Agama::Manager`) -knows the information about the current installation phase. The rest of services will act as utility -services without any knowledge about the whole installation process. - -A client (e.g., a web UI) will ask to the main service for the current phase of the installation. - -In principle, the installation will follow 3 possible phases: *Startup*, *Config* and *Install*. - -* *Startup* Phase - -This is the initial phase. The manager service will start in this phase and it will not change to -another phase until the client asks for performing the next phase. - -* *Config* Phase - -The installation is configured during this phase. Configuring the installation means that everything -needed from the system is read and the required default proposal are calculated. In YaST terms, the -*config* phase implies to probe some modules like storage, language, etc, and to perform their -proposals. Note that not all modules have to be probed/proposed. Probing some modules could be -delayed to the next *install* phase. - -* *Install* Phase - -This phase implies to perform everything to install the system according to the selected options and -proposals. Note that this phase is not only a typical YaST commit. For example, some proposals -(software?) could be done during this phase. In short, at the beginning of this phase we have all -the required information to perform the installation, and at the end of the phase the system is -installed. - -### Status of the Services - -Note that the services are blocked meanwhile they are performing a long task. For this -reason, the *manager* service will store the status of each service and the clients will ask to -*manager* to know that status. - -### org.opensuse.Agama1.Manager - -#### Properties - -- InstallationPhases -> array(array(dict(string, variant))) (r) - - All possible phases: -~~~ - [ - {"id" => 0, "label" => "startup"}, - {"id" => 1, "label" => "config"}, - {"id" => 2, "label" => "install"} - ] -~~~ - -- CurrentInstallationPhase -> unsigned 32-bit integer (r) - - Id of the current phase. - -- BusyServices -> a(s) (r) +See the new-style [reference][mgr-ref] ([source][mgr-src]). - List of names of the currently busy services. + + +[mgr-ref]: https://mvidner.github.io/agama/org.opensuse.Agama1.Manager.ref.html +[mgr-src]: dbus/org.opensuse.Agama1.Manager.doc.xml From e59d910cf982a7d156dee8fe40a1d1e65df6c6d9 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Wed, 5 Apr 2023 13:29:47 +0200 Subject: [PATCH 20/51] doc/dbus: reorganize dirs; add make diff Allow for other GitHub Pages content than `dbus/` `make diff` (needs `xmlstarlet` now) checks that docs and implementation haven't diverged TODO: figure out how to do the non-main interfaces like ServiceStatus or Software.Proposal --- .github/workflows/pages-dbus-doc.yml | 6 +- doc/.gitignore | 1 + doc/Makefile | 4 ++ doc/dbus/.gitignore | 5 +- doc/dbus/Makefile | 38 +++++++++++-- doc/dbus/README.md | 10 +++- doc/dbus/bus/README.md | 1 + .../bus/org.opensuse.Agama.Language1.bus.xml | 39 +++++++++++++ .../bus/org.opensuse.Agama1.Manager.bus.xml | 55 +++++++++++++++++++ doc/index.html | 10 ++++ 10 files changed, 155 insertions(+), 14 deletions(-) create mode 100644 doc/.gitignore create mode 100644 doc/Makefile create mode 100644 doc/dbus/bus/README.md create mode 100644 doc/dbus/bus/org.opensuse.Agama.Language1.bus.xml create mode 100644 doc/dbus/bus/org.opensuse.Agama1.Manager.bus.xml create mode 100644 doc/index.html diff --git a/.github/workflows/pages-dbus-doc.yml b/.github/workflows/pages-dbus-doc.yml index 7dcc953448..6189325bc1 100644 --- a/.github/workflows/pages-dbus-doc.yml +++ b/.github/workflows/pages-dbus-doc.yml @@ -38,15 +38,15 @@ jobs: sudo apt-get --assume-yes --no-install-recommends install xmlto docbook-xsl - name: Build HTML via DocBook - run: cd doc/dbus; make + run: cd doc; make - name: Setup Pages uses: actions/configure-pages@v3 - name: Upload artifact uses: actions/upload-pages-artifact@v1 with: - # upload the D-Bus docs... TODO index... what if we want something else too? - path: 'doc/dbus' + # upload the built docs + path: 'doc/dist' - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v2 diff --git a/doc/.gitignore b/doc/.gitignore new file mode 100644 index 0000000000..849ddff3b7 --- /dev/null +++ b/doc/.gitignore @@ -0,0 +1 @@ +dist/ diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000000..011fe4a56b --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,4 @@ +all: + mkdir -p dist + $(MAKE) -C dbus + cp index.html dist diff --git a/doc/dbus/.gitignore b/doc/dbus/.gitignore index 895594a5da..d945e9a23a 100644 --- a/doc/dbus/.gitignore +++ b/doc/dbus/.gitignore @@ -1,3 +1,2 @@ -# or maybe commit them. depends on the deployment model -*.ref.xml -*.ref.html +tmp/*.ref.xml +tmp/*.iface.xml diff --git a/doc/dbus/Makefile b/doc/dbus/Makefile index df3d067c8c..4b3acf7471 100644 --- a/doc/dbus/Makefile +++ b/doc/dbus/Makefile @@ -1,7 +1,35 @@ -# quick and dirty -all: - for f in org.opensuse.Agama*.doc.xml; do \ - docbook=$${f%.doc.xml}.ref.xml; \ +distdir=../dist/dbus +tmpdir=./tmp + +# build HTML for GitHub pages +all: ${distdir} ${tmpdir} + for f in org.opensuse.Agama*.doc.xml; do \ + docbook=${tmpdir}/$${f%.doc.xml}.ref.xml; \ xsltproc --novalid --output $$docbook spec-to-docbook.xsl $$f; \ - xmlto --skip-validation html-nochunks $$docbook; \ + xmlto -o ${distdir} --skip-validation html-nochunks $$docbook; \ done + cp index.html ${distdir} + +# check that the implementation and documentation haven't diverged +# TODO: factor out a script to decouple Make syntax from the rest +diff: ${tmpdir} + for doc_xml in org.opensuse.Agama*.doc.xml; do \ + IFACE=$${doc_xml%.doc.xml}; \ + bus_xml=bus/$$IFACE.bus.xml; \ + doc_iface=${tmpdir}/$$IFACE.doc.iface.xml; \ + bus_iface=${tmpdir}/$$IFACE.bus.iface.xml; \ + \ + xmlstarlet ed \ + -N doc="http://www.freedesktop.org/dbus/1.0/doc.dtd" \ + -d "//doc:doc" \ + $${doc_xml} > $${doc_iface}; \ + xmlstarlet ed \ + -d "//interface[@name!='$$IFACE']" \ + $${bus_xml} > $${bus_iface}; \ + diff --ignore-blank-lines --ignore-trailing-space -u $${doc_iface} $${bus_iface}; \ + done + +${distdir}: + mkdir -p $@ +${tmpdir}: + mkdir -p $@ diff --git a/doc/dbus/README.md b/doc/dbus/README.md index dabaf177c7..a140c19964 100644 --- a/doc/dbus/README.md +++ b/doc/dbus/README.md @@ -4,9 +4,13 @@ **`*.doc.xml`**: documentation authored by humans in the `` tags -**`*.ref.xml`**: intermediate, produced from `*.doc.xml`, contains DocBook +`tmp/`**`*.ref.xml`**: intermediate, produced from `*.doc.xml`, contains DocBook "**ref**entry" -**`*.ref.html`**: rendered for publishing on GitHub Pages +`../dist/dbus/`**`*.ref.html`**: rendered for publishing on GitHub Pages + +`bus/`**`*.bus.xml`**: output of D-Bus introspection + +`tmp/`**`*.iface.xml`**: intermediate, simplified `*.doc.xml` and `*.bus.xml` +to leave the common parts for diffing, see `make diff`. -**`*.bus.xml`**: output of D-Bus introspection diff --git a/doc/dbus/bus/README.md b/doc/dbus/bus/README.md new file mode 100644 index 0000000000..13d361c517 --- /dev/null +++ b/doc/dbus/bus/README.md @@ -0,0 +1 @@ +FIXME: describe how to maintain these (semi)automatically diff --git a/doc/dbus/bus/org.opensuse.Agama.Language1.bus.xml b/doc/dbus/bus/org.opensuse.Agama.Language1.bus.xml new file mode 100644 index 0000000000..1ab8363dd8 --- /dev/null +++ b/doc/dbus/bus/org.opensuse.Agama.Language1.bus.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/dbus/bus/org.opensuse.Agama1.Manager.bus.xml b/doc/dbus/bus/org.opensuse.Agama1.Manager.bus.xml new file mode 100644 index 0000000000..135f5d530d --- /dev/null +++ b/doc/dbus/bus/org.opensuse.Agama1.Manager.bus.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000000..58402d52f9 --- /dev/null +++ b/doc/index.html @@ -0,0 +1,10 @@ + +Agama Documentation + + + + + + From 2b76a6935f9c5e2d1521bc49ca8e30f00f18654a Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Wed, 5 Apr 2023 17:51:52 +0200 Subject: [PATCH 21/51] doc/dbus: `make diff` passes; seeded more interfaces --- doc/dbus/Makefile | 8 +- .../bus/org.opensuse.Agama.Questions1.bus.xml | 62 +++++++++++++ ....opensuse.Agama.Software1.Proposal.bus.xml | 56 ++++++++++++ .../bus/org.opensuse.Agama.Software1.bus.xml | 74 ++++++++++++++++ .../bus/org.opensuse.Agama.Storage1.bus.xml | 88 +++++++++++++++++++ .../bus/org.opensuse.Agama.Users1.bus.xml | 69 +++++++++++++++ doc/dbus/bus/seed.sh | 23 +++++ doc/dbus/org.opensuse.Agama.Language1.doc.xml | 4 - doc/dbus/org.opensuse.Agama1.Manager.doc.xml | 3 - doc/dbus_api.md | 8 +- 10 files changed, 380 insertions(+), 15 deletions(-) create mode 100644 doc/dbus/bus/org.opensuse.Agama.Questions1.bus.xml create mode 100644 doc/dbus/bus/org.opensuse.Agama.Software1.Proposal.bus.xml create mode 100644 doc/dbus/bus/org.opensuse.Agama.Software1.bus.xml create mode 100644 doc/dbus/bus/org.opensuse.Agama.Storage1.bus.xml create mode 100644 doc/dbus/bus/org.opensuse.Agama.Users1.bus.xml create mode 100755 doc/dbus/bus/seed.sh diff --git a/doc/dbus/Makefile b/doc/dbus/Makefile index 4b3acf7471..6b618a7a24 100644 --- a/doc/dbus/Makefile +++ b/doc/dbus/Makefile @@ -14,20 +14,24 @@ all: ${distdir} ${tmpdir} # TODO: factor out a script to decouple Make syntax from the rest diff: ${tmpdir} for doc_xml in org.opensuse.Agama*.doc.xml; do \ + DOCNS="http://www.freedesktop.org/dbus/1.0/doc.dtd"; \ IFACE=$${doc_xml%.doc.xml}; \ bus_xml=bus/$$IFACE.bus.xml; \ doc_iface=${tmpdir}/$$IFACE.doc.iface.xml; \ bus_iface=${tmpdir}/$$IFACE.bus.iface.xml; \ \ xmlstarlet ed \ - -N doc="http://www.freedesktop.org/dbus/1.0/doc.dtd" \ + -N doc=$$DOCNS \ -d "//doc:doc" \ - $${doc_xml} > $${doc_iface}; \ + $${doc_xml} \ + | sed -e "s| $${doc_iface}; \ xmlstarlet ed \ -d "//interface[@name!='$$IFACE']" \ $${bus_xml} > $${bus_iface}; \ diff --ignore-blank-lines --ignore-trailing-space -u $${doc_iface} $${bus_iface}; \ done + echo "NO DIFF, YAY" ${distdir}: mkdir -p $@ diff --git a/doc/dbus/bus/org.opensuse.Agama.Questions1.bus.xml b/doc/dbus/bus/org.opensuse.Agama.Questions1.bus.xml new file mode 100644 index 0000000000..72b070ad10 --- /dev/null +++ b/doc/dbus/bus/org.opensuse.Agama.Questions1.bus.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/dbus/bus/org.opensuse.Agama.Software1.Proposal.bus.xml b/doc/dbus/bus/org.opensuse.Agama.Software1.Proposal.bus.xml new file mode 100644 index 0000000000..ae0a38b859 --- /dev/null +++ b/doc/dbus/bus/org.opensuse.Agama.Software1.Proposal.bus.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/dbus/bus/org.opensuse.Agama.Software1.bus.xml b/doc/dbus/bus/org.opensuse.Agama.Software1.bus.xml new file mode 100644 index 0000000000..ae45ba2037 --- /dev/null +++ b/doc/dbus/bus/org.opensuse.Agama.Software1.bus.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/dbus/bus/org.opensuse.Agama.Storage1.bus.xml b/doc/dbus/bus/org.opensuse.Agama.Storage1.bus.xml new file mode 100644 index 0000000000..8dca929024 --- /dev/null +++ b/doc/dbus/bus/org.opensuse.Agama.Storage1.bus.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/dbus/bus/org.opensuse.Agama.Users1.bus.xml b/doc/dbus/bus/org.opensuse.Agama.Users1.bus.xml new file mode 100644 index 0000000000..ade59a4671 --- /dev/null +++ b/doc/dbus/bus/org.opensuse.Agama.Users1.bus.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/dbus/bus/seed.sh b/doc/dbus/bus/seed.sh new file mode 100755 index 0000000000..67f8a2b724 --- /dev/null +++ b/doc/dbus/bus/seed.sh @@ -0,0 +1,23 @@ +#!/bin/bash +abusctl() { + busctl --address=unix:path=/run/agama/bus "$@" +} + +DD=org.opensuse.Agama +SS=/${DD//./\/} + +abusctl introspect --xml-interface ${DD}1 ${SS}1/Manager \ + > ${DD}1.Manager.bus.xml + +look() { + abusctl tree --list $DD.${1%.*} + abusctl introspect --xml-interface $DD.${1%.*} $SS/${1//./\/} \ + > $DD.$1.bus.xml +} + +look Language1 +look Questions1 +look Software1 +look Software1.Proposal +look Storage1 +look Users1 diff --git a/doc/dbus/org.opensuse.Agama.Language1.doc.xml b/doc/dbus/org.opensuse.Agama.Language1.doc.xml index 5debf3b776..59372d2459 100644 --- a/doc/dbus/org.opensuse.Agama.Language1.doc.xml +++ b/doc/dbus/org.opensuse.Agama.Language1.doc.xml @@ -1,9 +1,5 @@ - diff --git a/doc/dbus/org.opensuse.Agama1.Manager.doc.xml b/doc/dbus/org.opensuse.Agama1.Manager.doc.xml index e61451a7f9..d6bb7cce3d 100644 --- a/doc/dbus/org.opensuse.Agama1.Manager.doc.xml +++ b/doc/dbus/org.opensuse.Agama1.Manager.doc.xml @@ -1,8 +1,5 @@ - diff --git a/doc/dbus_api.md b/doc/dbus_api.md index 5788319e50..b5693f45f8 100644 --- a/doc/dbus_api.md +++ b/doc/dbus_api.md @@ -48,9 +48,7 @@ Iface: o.o.Agama.Language1 See the new-style [reference][lang-ref] ([source][lang-src]). - - -[lang-ref]: https://mvidner.github.io/agama/org.opensuse.Agama.Language1.ref.html +[lang-ref]: https://opensuse.github.io/agama/dbus/org.opensuse.Agama.Language1.ref.html [lang-src]: dbus/org.opensuse.Agama.Language1.doc.xml ## Base Product @@ -780,7 +778,5 @@ any issue that might block the installation. See the new-style [reference][mgr-ref] ([source][mgr-src]). - - -[mgr-ref]: https://mvidner.github.io/agama/org.opensuse.Agama1.Manager.ref.html +[mgr-ref]: https://opensuse.github.io/agama/dbus/org.opensuse.Agama1.Manager.ref.html [mgr-src]: dbus/org.opensuse.Agama1.Manager.doc.xml From d252fa6e435e492fdf6aec79c68a74e1a1940aad Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Thu, 6 Apr 2023 12:59:30 +0200 Subject: [PATCH 22/51] doc/dbus: ci: Check that introspected API and its docs have not diverged --- .github/workflows/pages-dbus-doc.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pages-dbus-doc.yml b/.github/workflows/pages-dbus-doc.yml index 6189325bc1..529c6a5841 100644 --- a/.github/workflows/pages-dbus-doc.yml +++ b/.github/workflows/pages-dbus-doc.yml @@ -35,7 +35,10 @@ jobs: - name: Install DocBook tooling run: | sudo apt-get update - sudo apt-get --assume-yes --no-install-recommends install xmlto docbook-xsl + sudo apt-get --assume-yes --no-install-recommends install xmlto docbook-xsl xmlstarlet + + - name: Check that introspected API and its docs have not diverged + run: cd doc/dbus; make diff - name: Build HTML via DocBook run: cd doc; make From e1b1666175d47421f8a7002450746f66429ae0d6 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Thu, 13 Apr 2023 09:35:01 +0200 Subject: [PATCH 23/51] doc/dbus: schema fix: "deprecated" is also optional --- doc/dbus/dbus-introspect-docs.dtd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/dbus/dbus-introspect-docs.dtd b/doc/dbus/dbus-introspect-docs.dtd index 07f3ceed22..cb56e0b4be 100644 --- a/doc/dbus/dbus-introspect-docs.dtd +++ b/doc/dbus/dbus-introspect-docs.dtd @@ -1,6 +1,6 @@ - + From 0aaf16e6d25a99c97ed6bf55a0c79bc259207e41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20D=C3=ADaz=20Gonz=C3=A1lez?= Date: Thu, 20 Apr 2023 12:06:11 +0100 Subject: [PATCH 24/51] [web] Define :hover styles for focused buttons --- web/src/assets/styles/patternfly-overrides.scss | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/web/src/assets/styles/patternfly-overrides.scss b/web/src/assets/styles/patternfly-overrides.scss index 604afa49c2..e88a4e6e9d 100644 --- a/web/src/assets/styles/patternfly-overrides.scss +++ b/web/src/assets/styles/patternfly-overrides.scss @@ -44,6 +44,11 @@ --pf-c-button--m-primary--hover--BackgroundColor: var(--color-button-primary-hover); } +// Make :hover style visible when the button is in a :focus state too +.pf-c-button.pf-m-primary:focus:hover { + --pf-c-button--m-primary--BackgroundColor: var(--color-button-primary-hover); +} + .pf-c-button.pf-m-link { // Colors for buttons modifiers --pf-c-button--m-link--Color: var(--color-link); @@ -61,6 +66,12 @@ --pf-c-button--m-secondary--hover--Color: var(--color-link-hover); } +// Make :hover style visible when the button is in a :focus state too +.pf-c-button.pf-m-secondary:focus:hover { + --pf-c-button--after--BorderColor: var(--color-link-hover); + --pf-c-button--m-secondary--Color: var(--color-link-hover); +} + // SVG icons does not obey font-size .pf-c-empty-state__icon { inline-size: 10rem; From 34544c14ebafb13180795a2d0c9425f5858b045d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20D=C3=ADaz=20Gonz=C3=A1lez?= Date: Thu, 20 Apr 2023 13:46:27 +0100 Subject: [PATCH 25/51] [web] Add entry in the changes file --- web/package/cockpit-agama.changes | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/package/cockpit-agama.changes b/web/package/cockpit-agama.changes index c204d48697..1b27f4cedc 100644 --- a/web/package/cockpit-agama.changes +++ b/web/package/cockpit-agama.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Apr 20 12:44:44 UTC 2023 - David Diaz + +- Make styles consistent when the user is hovering a button, + no matter if it is a focus state or not (gh#openSUSE/agama#544). + ------------------------------------------------------------------- Fri Apr 14 13:08:05 UTC 2023 - José Iván López González From 1a099b78628e8fdfb596425100b7a0198555b0dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20D=C3=ADaz=20Gonz=C3=A1lez?= Date: Tue, 25 Apr 2023 11:48:18 +0100 Subject: [PATCH 26/51] [web] Do not reserve space for section icons To allow having no indentation in pages mounting sections without icons. It's achieved by not using a fixed width but sizing the column with `min-content` [1] CSS keyword instead. [1] https://developer.mozilla.org/en-US/docs/Web/CSS/min-content --- web/src/assets/styles/blocks.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/assets/styles/blocks.scss b/web/src/assets/styles/blocks.scss index ace68ee440..64fcedc7ff 100644 --- a/web/src/assets/styles/blocks.scss +++ b/web/src/assets/styles/blocks.scss @@ -3,7 +3,7 @@ // section layouts. section { display: grid; - grid-template-columns: var(--icon-size-m) 1fr; + grid-template-columns: min-content 1fr; grid-template-areas: "icon title" ".... content"; From 8c1833eeb578b9a0558dec6c588551b5f2263bed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20D=C3=ADaz=20Gonz=C3=A1lez?= Date: Tue, 25 Apr 2023 13:24:31 +0100 Subject: [PATCH 27/51] [web] Add entry to the changes file --- web/package/cockpit-agama.changes | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/package/cockpit-agama.changes b/web/package/cockpit-agama.changes index 1b27f4cedc..97202f4a27 100644 --- a/web/package/cockpit-agama.changes +++ b/web/package/cockpit-agama.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Apr 25 12:23:27 UTC 2023 - David Diaz + +- UI: Do not indent sections whitout icons (gh#openSUSE/agama#549). + ------------------------------------------------------------------- Thu Apr 20 12:44:44 UTC 2023 - David Diaz From de7eccb489b221138aaaf4cba9b5a591852e7d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20D=C3=ADaz=20Gonz=C3=A1lez?= Date: Tue, 25 Apr 2023 10:19:10 +0100 Subject: [PATCH 28/51] [web] Fix a dropdown position Placing its content to the right to avoid horizontal scroll. --- web/src/components/storage/ProposalVolumes.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/web/src/components/storage/ProposalVolumes.jsx b/web/src/components/storage/ProposalVolumes.jsx index c912c9fa2e..0d897c6135 100644 --- a/web/src/components/storage/ProposalVolumes.jsx +++ b/web/src/components/storage/ProposalVolumes.jsx @@ -181,6 +181,7 @@ const GeneralActions = ({ templates, onAdd, onReset }) => { return ( <> Date: Tue, 25 Apr 2023 14:43:19 +0100 Subject: [PATCH 29/51] [web] Add entry in the changes file --- web/package/cockpit-agama.changes | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/package/cockpit-agama.changes b/web/package/cockpit-agama.changes index 97202f4a27..b23519d1ea 100644 --- a/web/package/cockpit-agama.changes +++ b/web/package/cockpit-agama.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Apr 25 13:42:22 UTC 2023 - David Diaz + +- UI: Fix dropdown content alignment at storage proposal page + (gh#openSUSE/agama#547). + ------------------------------------------------------------------- Tue Apr 25 12:23:27 UTC 2023 - David Diaz From 20a77feba62237c2d63849389512c313010903c2 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Fri, 21 Apr 2023 08:42:53 +0200 Subject: [PATCH 30/51] doc/dbus: SWITCH to gdbus-codegen because it is the maintained solution nowadays --- doc/dbus/Makefile | 33 +++++--- doc/dbus/README.md | 9 ++- doc/dbus/index.html | 4 +- doc/dbus/org.opensuse.Agama.Language1.doc.xml | 79 ++++++++----------- doc/dbus/org.opensuse.Agama1.Manager.doc.xml | 73 +++++++---------- 5 files changed, 94 insertions(+), 104 deletions(-) diff --git a/doc/dbus/Makefile b/doc/dbus/Makefile index 6b618a7a24..426a6b824b 100644 --- a/doc/dbus/Makefile +++ b/doc/dbus/Makefile @@ -4,34 +4,45 @@ tmpdir=./tmp # build HTML for GitHub pages all: ${distdir} ${tmpdir} for f in org.opensuse.Agama*.doc.xml; do \ - docbook=${tmpdir}/$${f%.doc.xml}.ref.xml; \ - xsltproc --novalid --output $$docbook spec-to-docbook.xsl $$f; \ + gdbus-codegen \ + --interface-prefix=org.opensuse.Agama. \ + --output-directory=${tmpdir} \ + --generate-docbook=ref \ + $$f; \ + docbook=${tmpdir}/ref-$${f%.doc.xml}.xml; \ xmlto -o ${distdir} --skip-validation html-nochunks $$docbook; \ done cp index.html ${distdir} +# 'foo 2> >(grep ... >&2)' greps stderr and keeps it as stderr +NO_COMMENTS=xmlstarlet canonic --without-comments 2> >(grep -v 'Attempt to load network entity' >&2) +# bash because of the >() process substitution +SHELL=/bin/bash + # check that the implementation and documentation haven't diverged # TODO: factor out a script to decouple Make syntax from the rest diff: ${tmpdir} + ALL_GOOD=true; \ for doc_xml in org.opensuse.Agama*.doc.xml; do \ - DOCNS="http://www.freedesktop.org/dbus/1.0/doc.dtd"; \ IFACE=$${doc_xml%.doc.xml}; \ bus_xml=bus/$$IFACE.bus.xml; \ doc_iface=${tmpdir}/$$IFACE.doc.iface.xml; \ bus_iface=${tmpdir}/$$IFACE.bus.iface.xml; \ \ - xmlstarlet ed \ - -N doc=$$DOCNS \ - -d "//doc:doc" \ + echo "Diffing $$IFACE"; \ + \ + $(NO_COMMENTS) \ $${doc_xml} \ - | sed -e "s| $${doc_iface}; \ xmlstarlet ed \ -d "//interface[@name!='$$IFACE']" \ - $${bus_xml} > $${bus_iface}; \ - diff --ignore-blank-lines --ignore-trailing-space -u $${doc_iface} $${bus_iface}; \ - done - echo "NO DIFF, YAY" + $${bus_xml} \ + | $(NO_COMMENTS) - \ + > $${bus_iface}; \ + diff --ignore-blank-lines --ignore-trailing-space -u $${doc_iface} $${bus_iface} || ALL_GOOD=false; \ + done; \ + $$ALL_GOOD + @echo "NO DIFF, YAY" ${distdir}: mkdir -p $@ diff --git a/doc/dbus/README.md b/doc/dbus/README.md index a140c19964..ca8e059378 100644 --- a/doc/dbus/README.md +++ b/doc/dbus/README.md @@ -2,12 +2,15 @@ ## File Names -**`*.doc.xml`**: documentation authored by humans in the `` tags +**`*.doc.xml`**: documentation authored by humans in XML comments, +as specified in [`gdbus-codegen`][gd-cg]. -`tmp/`**`*.ref.xml`**: intermediate, produced from `*.doc.xml`, contains DocBook +[gd-cg]: https://developer-old.gnome.org/gio/stable/gdbus-codegen.html#id-1.4.25.7.9 + +`tmp/`**`ref-*.xml`**: intermediate, produced from `*.doc.xml`, contains DocBook "**ref**entry" -`../dist/dbus/`**`*.ref.html`**: rendered for publishing on GitHub Pages +`../dist/dbus/`**`ref-*.html`**: rendered for publishing on GitHub Pages `bus/`**`*.bus.xml`**: output of D-Bus introspection diff --git a/doc/dbus/index.html b/doc/dbus/index.html index dbf9bdadca..47ef104813 100644 --- a/doc/dbus/index.html +++ b/doc/dbus/index.html @@ -1,6 +1,6 @@ diff --git a/doc/dbus/org.opensuse.Agama.Language1.doc.xml b/doc/dbus/org.opensuse.Agama.Language1.doc.xml index 59372d2459..4fa4fbe82e 100644 --- a/doc/dbus/org.opensuse.Agama.Language1.doc.xml +++ b/doc/dbus/org.opensuse.Agama.Language1.doc.xml @@ -1,56 +1,45 @@ - + + - - - - Implementation note about language identifiers: - + - - Set list of languages to install - - - ToInstall(["cs_CZ", "de_DE"]) - - - - - - List of language IDs from AvailableLanguages - - + - - - List of all available languages to install on target system. - - Elements are triples: + + + + diff --git a/doc/dbus/org.opensuse.Agama1.Manager.doc.xml b/doc/dbus/org.opensuse.Agama1.Manager.doc.xml index d6bb7cce3d..8d136b54a7 100644 --- a/doc/dbus/org.opensuse.Agama1.Manager.doc.xml +++ b/doc/dbus/org.opensuse.Agama1.Manager.doc.xml @@ -1,7 +1,6 @@ - + @@ -15,72 +14,60 @@ - - - - + + + + + - - - - Id of the current phase. - - - + + From 5722356b48a87f6838b390bdedbc24c54c265dd2 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Tue, 25 Apr 2023 16:18:58 +0200 Subject: [PATCH 31/51] simpler subdir make MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ladislav Slezák --- .github/workflows/pages-dbus-doc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages-dbus-doc.yml b/.github/workflows/pages-dbus-doc.yml index 529c6a5841..3b803acb27 100644 --- a/.github/workflows/pages-dbus-doc.yml +++ b/.github/workflows/pages-dbus-doc.yml @@ -41,7 +41,7 @@ jobs: run: cd doc/dbus; make diff - name: Build HTML via DocBook - run: cd doc; make + run: make -C doc - name: Setup Pages uses: actions/configure-pages@v3 From 9db0ba8fd480300b58711f9e66c6dc2d737f9e1f Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Wed, 26 Apr 2023 10:08:08 +0200 Subject: [PATCH 32/51] doc/dbus/bus: update with ./seed.sh The difference is only removing a subnode that is not part of the interface anyway, but the script works after I forgot how it works yay! Usage: - make a container with the agama backend as described in rust/agama-cli/doc/backend-for-testing.md - podman exec --tty --interactive ${CNAME?} bash In that shell: ```sh cd /checkout cd doc/dbus/bus ./seed.sh ``` --- doc/dbus/bus/org.opensuse.Agama.Questions1.bus.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/dbus/bus/org.opensuse.Agama.Questions1.bus.xml b/doc/dbus/bus/org.opensuse.Agama.Questions1.bus.xml index 72b070ad10..53ba763367 100644 --- a/doc/dbus/bus/org.opensuse.Agama.Questions1.bus.xml +++ b/doc/dbus/bus/org.opensuse.Agama.Questions1.bus.xml @@ -1,7 +1,6 @@ - From 16f6a08bbababdb354773be3f03c7c314db2a9e2 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Wed, 26 Apr 2023 10:15:57 +0200 Subject: [PATCH 33/51] doc/dbus: fix more links after doc engine switch --- doc/dbus/.gitignore | 2 +- doc/dbus_api.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/dbus/.gitignore b/doc/dbus/.gitignore index d945e9a23a..819af2d652 100644 --- a/doc/dbus/.gitignore +++ b/doc/dbus/.gitignore @@ -1,2 +1,2 @@ -tmp/*.ref.xml +tmp/ref-*.xml tmp/*.iface.xml diff --git a/doc/dbus_api.md b/doc/dbus_api.md index b5693f45f8..40a6a2c04c 100644 --- a/doc/dbus_api.md +++ b/doc/dbus_api.md @@ -48,7 +48,7 @@ Iface: o.o.Agama.Language1 See the new-style [reference][lang-ref] ([source][lang-src]). -[lang-ref]: https://opensuse.github.io/agama/dbus/org.opensuse.Agama.Language1.ref.html +[lang-ref]: https://opensuse.github.io/agama/dbus/ref-org.opensuse.Agama.Language1.html [lang-src]: dbus/org.opensuse.Agama.Language1.doc.xml ## Base Product @@ -778,5 +778,5 @@ any issue that might block the installation. See the new-style [reference][mgr-ref] ([source][mgr-src]). -[mgr-ref]: https://opensuse.github.io/agama/dbus/org.opensuse.Agama1.Manager.ref.html +[mgr-ref]: https://opensuse.github.io/agama/dbus/ref-org.opensuse.Agama1.Manager.html [mgr-src]: dbus/org.opensuse.Agama1.Manager.doc.xml From 62f155d933c1187a6cf38a9a578bd6e5eae5b44d Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Wed, 26 Apr 2023 11:00:45 +0200 Subject: [PATCH 34/51] doc/dbus: remove forgotten parts of the abandoned engine --- doc/dbus/dbus-introspect-docs.dtd | 35 --- doc/dbus/spec-to-docbook.xsl | 465 ------------------------------ 2 files changed, 500 deletions(-) delete mode 100644 doc/dbus/dbus-introspect-docs.dtd delete mode 100644 doc/dbus/spec-to-docbook.xsl diff --git a/doc/dbus/dbus-introspect-docs.dtd b/doc/dbus/dbus-introspect-docs.dtd deleted file mode 100644 index cb56e0b4be..0000000000 --- a/doc/dbus/dbus-introspect-docs.dtd +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/dbus/spec-to-docbook.xsl b/doc/dbus/spec-to-docbook.xsl deleted file mode 100644 index f91e062c71..0000000000 --- a/doc/dbus/spec-to-docbook.xsl +++ /dev/null @@ -1,465 +0,0 @@ - - - - - - - - - - - - - - -<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> - - - - - - - - - interface - - - - Methods - - - - - - - - - Signals - - - - - - - - - Properties - - - - - - - - - Description - - - - - - - Details - - - - - - - Signal Details - - - - - - - Property Details - - - - - - - - - - - - - - - -: - - - - - - - - - - - - - - - - - - - - - - <anchor role="function"><xsl:attribute name="id"><xsl:value-of select="$basename"/>:<xsl:value-of select="@name"/></xsl:attribute></anchor>The "<xsl:value-of select="@name"/>" property - -'' - - - - - - - - - - - - - - -: - - - - - - - - - - - - - - - - - - - - - <anchor role="function"><xsl:attribute name="id"><xsl:value-of select="$basename"/>::<xsl:value-of select="@name"/></xsl:attribute></anchor>The <xsl:value-of select="@name"/> signal - - () - - - - - - - - - - - - - - - - - - - - - Example: - - - - - - - - - - - - - - - - -Since - - - - - - - - /> - - - - - - - is deprecated since version and should not be used in newly-written code. Use - - - - - : - - - :: - - - . - - - - - - - - - - - - - - - -instead. - - - - - - - - - - - -See also: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -: - - - - - - - - - - - - - - - - - - - - - - - <anchor role="function"> - <xsl:attribute name="id"> - <xsl:value-of select="$basename"/>.<xsl:value-of select="@name"/> - </xsl:attribute> - </anchor> - <xsl:value-of select="@name"/> - <xsl:text> ()</xsl:text> - - - - - - - - - ( - - - - - ) - - - - - - - - - - - - - - - - - - -:'' - - - - - - - - - - - - -::() - - - - - - - - - - - - -.() - - - - - -'' -, - - - - - -'' -, - - - - - - -'' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 00a5eba602cea964b99079ea76df76a17a806e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 20 Apr 2023 09:25:47 +0200 Subject: [PATCH 35/51] Tooltip for the autocalculated limits --- .../components/storage/ProposalVolumes.jsx | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/web/src/components/storage/ProposalVolumes.jsx b/web/src/components/storage/ProposalVolumes.jsx index 0d897c6135..00fac18614 100644 --- a/web/src/components/storage/ProposalVolumes.jsx +++ b/web/src/components/storage/ProposalVolumes.jsx @@ -25,9 +25,10 @@ import React, { useState } from "react"; import { Dropdown, DropdownToggle, DropdownItem, Form, FormGroup, FormSelect, FormSelectOption, + List, ListItem, Skeleton, - TextInput, - Toolbar, ToolbarContent, ToolbarItem + Text, TextInput, + Toolbar, ToolbarContent, ToolbarItem, Tooltip } from "@patternfly/react-core"; import { TableComposable, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table'; import { filesize } from "filesize"; @@ -56,6 +57,21 @@ const sizeText = (size) => { return filesize(size, { base: 2 }); }; +const calculatedTooltip = (volume) => { + // no tooltip, the size is not affected by snapshots or other volumes + if (!volume.snapshotsAffectSizes && volume.sizeRelevantVolumes.length === 0) return null; + + return ( + <> + These limits are affected by:
+ + {volume.snapshotsAffectSizes && The configuration of snapshots} + {volume.sizeRelevantVolumes.length > 0 && By presence of other volumes ({volume.sizeRelevantVolumes.join(", ")})} + + + ); +}; + /** * Form used for adding a new file system from a list of templates * @component @@ -241,10 +257,19 @@ const VolumeRow = ({ columns, volume, isLoading, onDelete }) => { const autoModeIcon = ; + const OptionalTooltip = ({ volume, children }) => { + const tooltipContent = calculatedTooltip(volume); + + // tooltip content is empty, do not wrap in + if (!tooltipContent) return children; + + return {children}; + }; + return (
{limits} - auto-calculated} /> + auto-calculated} />
); }; From 06a56553416d3b783aaec2effeb1a312969e026b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 20 Apr 2023 09:50:11 +0200 Subject: [PATCH 36/51] Always display a tooltip --- .../components/storage/ProposalVolumes.jsx | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/web/src/components/storage/ProposalVolumes.jsx b/web/src/components/storage/ProposalVolumes.jsx index 00fac18614..ceca62deac 100644 --- a/web/src/components/storage/ProposalVolumes.jsx +++ b/web/src/components/storage/ProposalVolumes.jsx @@ -57,19 +57,27 @@ const sizeText = (size) => { return filesize(size, { base: 2 }); }; -const calculatedTooltip = (volume) => { - // no tooltip, the size is not affected by snapshots or other volumes - if (!volume.snapshotsAffectSizes && volume.sizeRelevantVolumes.length === 0) return null; +const AutoCalculatedTooltip = ({ volume, children }) => { + // the size is not affected by snapshots or other volumes + if (!volume.snapshotsAffectSizes && volume.sizeRelevantVolumes.length === 0) { + const content = These limits are not affected by any other settings; + return {children}; + } - return ( + const content = ( <> These limits are affected by:
- {volume.snapshotsAffectSizes && The configuration of snapshots} - {volume.sizeRelevantVolumes.length > 0 && By presence of other volumes ({volume.sizeRelevantVolumes.join(", ")})} + {volume.snapshotsAffectSizes && + The configuration of snapshots} + {volume.sizeRelevantVolumes.length > 0 && + By presence of other volumes ({volume.sizeRelevantVolumes.join(", ")})} ); + + // align the content to the left so the list looks better + return {children}; }; /** @@ -257,19 +265,10 @@ const VolumeRow = ({ columns, volume, isLoading, onDelete }) => { const autoModeIcon = ; - const OptionalTooltip = ({ volume, children }) => { - const tooltipContent = calculatedTooltip(volume); - - // tooltip content is empty, do not wrap in - if (!tooltipContent) return children; - - return {children}; - }; - return (
{limits} - auto-calculated} /> + auto-calculated} />
); }; From c9c4534ddb41a2ca1e8f6534bc3550c1f26062ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 21 Apr 2023 15:11:00 +0200 Subject: [PATCH 37/51] Use info icon --- web/src/assets/styles/blocks.scss | 5 +++++ web/src/components/storage/ProposalVolumes.jsx | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/web/src/assets/styles/blocks.scss b/web/src/assets/styles/blocks.scss index 64fcedc7ff..ef7f382e63 100644 --- a/web/src/assets/styles/blocks.scss +++ b/web/src/assets/styles/blocks.scss @@ -196,3 +196,8 @@ section > .content { --pf-c-progress--GridGap: var(--spacer-small); } } + +// compact lists in tooltips +[role="tooltip"] li + li { + margin: 0; +} diff --git a/web/src/components/storage/ProposalVolumes.jsx b/web/src/components/storage/ProposalVolumes.jsx index ceca62deac..a81fa839e6 100644 --- a/web/src/components/storage/ProposalVolumes.jsx +++ b/web/src/components/storage/ProposalVolumes.jsx @@ -57,16 +57,18 @@ const sizeText = (size) => { return filesize(size, { base: 2 }); }; -const AutoCalculatedTooltip = ({ volume, children }) => { +const AutoCalculatedInfo = ({ volume }) => { + const info = ; + // the size is not affected by snapshots or other volumes if (!volume.snapshotsAffectSizes && volume.sizeRelevantVolumes.length === 0) { const content = These limits are not affected by any other settings; - return {children}; + return {info}; } const content = ( <> - These limits are affected by:
+ These limits are affected by: {volume.snapshotsAffectSizes && The configuration of snapshots} @@ -77,7 +79,7 @@ const AutoCalculatedTooltip = ({ volume, children }) => { ); // align the content to the left so the list looks better - return {children}; + return {info}; }; /** @@ -268,7 +270,7 @@ const VolumeRow = ({ columns, volume, isLoading, onDelete }) => { return (
{limits} - auto-calculated} /> + auto } />
); }; From 6ed7e762662f0d2e3b5819e716a6dedfe379699b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 21 Apr 2023 15:29:12 +0200 Subject: [PATCH 38/51] Switch order --- web/src/components/storage/ProposalVolumes.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/components/storage/ProposalVolumes.jsx b/web/src/components/storage/ProposalVolumes.jsx index a81fa839e6..e36abc58e9 100644 --- a/web/src/components/storage/ProposalVolumes.jsx +++ b/web/src/components/storage/ProposalVolumes.jsx @@ -73,7 +73,7 @@ const AutoCalculatedInfo = ({ volume }) => { {volume.snapshotsAffectSizes && The configuration of snapshots} {volume.sizeRelevantVolumes.length > 0 && - By presence of other volumes ({volume.sizeRelevantVolumes.join(", ")})} + Presence of other volumes ({volume.sizeRelevantVolumes.join(", ")})}
); @@ -270,7 +270,7 @@ const VolumeRow = ({ columns, volume, isLoading, onDelete }) => { return (
{limits} - auto } /> + auto } />
); }; From e06be97cb86ade183659459f3c5db835b1ffb6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 21 Apr 2023 16:06:24 +0200 Subject: [PATCH 39/51] Use Popover --- web/src/components/storage/ProposalVolumes.jsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/web/src/components/storage/ProposalVolumes.jsx b/web/src/components/storage/ProposalVolumes.jsx index e36abc58e9..023c12a399 100644 --- a/web/src/components/storage/ProposalVolumes.jsx +++ b/web/src/components/storage/ProposalVolumes.jsx @@ -26,9 +26,9 @@ import { Dropdown, DropdownToggle, DropdownItem, Form, FormGroup, FormSelect, FormSelectOption, List, ListItem, - Skeleton, + Popover, Skeleton, Text, TextInput, - Toolbar, ToolbarContent, ToolbarItem, Tooltip + Toolbar, ToolbarContent, ToolbarItem } from "@patternfly/react-core"; import { TableComposable, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table'; import { filesize } from "filesize"; @@ -63,7 +63,7 @@ const AutoCalculatedInfo = ({ volume }) => { // the size is not affected by snapshots or other volumes if (!volume.snapshotsAffectSizes && volume.sizeRelevantVolumes.length === 0) { const content = These limits are not affected by any other settings; - return {info}; + return {info}; } const content = ( @@ -78,8 +78,7 @@ const AutoCalculatedInfo = ({ volume }) => { ); - // align the content to the left so the list looks better - return {info}; + return {info}; }; /** From 4a03d09d7016933bd69c6145fe83ac525399c870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 21 Apr 2023 16:07:06 +0200 Subject: [PATCH 40/51] Hide close button in Popover --- web/src/components/storage/ProposalVolumes.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/components/storage/ProposalVolumes.jsx b/web/src/components/storage/ProposalVolumes.jsx index 023c12a399..193b960a86 100644 --- a/web/src/components/storage/ProposalVolumes.jsx +++ b/web/src/components/storage/ProposalVolumes.jsx @@ -63,7 +63,7 @@ const AutoCalculatedInfo = ({ volume }) => { // the size is not affected by snapshots or other volumes if (!volume.snapshotsAffectSizes && volume.sizeRelevantVolumes.length === 0) { const content = These limits are not affected by any other settings; - return {info}; + return {info}; } const content = ( @@ -78,7 +78,7 @@ const AutoCalculatedInfo = ({ volume }) => { ); - return {info}; + return {info}; }; /** From e112d5d47576fad05b112b731ce1b6b382868f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Mon, 24 Apr 2023 16:23:44 +0200 Subject: [PATCH 41/51] Move the "i" icon inside the label --- web/src/assets/styles/blocks.scss | 9 +++++++++ .../components/storage/ProposalVolumes.jsx | 20 ++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/web/src/assets/styles/blocks.scss b/web/src/assets/styles/blocks.scss index ef7f382e63..848bf62405 100644 --- a/web/src/assets/styles/blocks.scss +++ b/web/src/assets/styles/blocks.scss @@ -201,3 +201,12 @@ section > .content { [role="tooltip"] li + li { margin: 0; } + +// extra margin for "i" icons in labels +.pf-c-label__content > svg { + margin-left: 4px; +} + +.has_help { + cursor: pointer; +} diff --git a/web/src/components/storage/ProposalVolumes.jsx b/web/src/components/storage/ProposalVolumes.jsx index 193b960a86..d8ba4ac532 100644 --- a/web/src/components/storage/ProposalVolumes.jsx +++ b/web/src/components/storage/ProposalVolumes.jsx @@ -57,13 +57,17 @@ const sizeText = (size) => { return filesize(size, { base: 2 }); }; -const AutoCalculatedInfo = ({ volume }) => { - const info = ; - +/** + * Generates an icon with help describing what affects the volume limits. + * If the limits are nor affected then returns `null`. + * @component + * + * @param {object} volume - storage volume object + */ +const AutoCalculatedInfo = ({ volume, children }) => { // the size is not affected by snapshots or other volumes if (!volume.snapshotsAffectSizes && volume.sizeRelevantVolumes.length === 0) { - const content = These limits are not affected by any other settings; - return {info}; + return <>{children}; } const content = ( @@ -78,7 +82,7 @@ const AutoCalculatedInfo = ({ volume }) => { ); - return {info}; + return
{children}
; }; /** @@ -264,12 +268,10 @@ const VolumeRow = ({ columns, volume, isLoading, onDelete }) => { const limits = `${sizeText(volume.minSize)} - ${sizeText(volume.maxSize)}`; const isAuto = volume.adaptiveSizes && !volume.fixedSizeLimits; - const autoModeIcon = ; - return (
{limits} - auto } /> + auto } />
); }; From ffa904bdabc5a39f356d9f00691e6c393f327a6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Wed, 26 Apr 2023 10:12:55 +0200 Subject: [PATCH 42/51] Create separate components --- web/src/assets/styles/blocks.scss | 6 +-- web/src/components/core/Attribute.jsx | 43 +++++++++++++++++++ web/src/components/core/Description.jsx | 36 ++++++++++++++++ web/src/components/core/index.js | 2 + .../components/storage/ProposalVolumes.jsx | 26 ++++++----- 5 files changed, 96 insertions(+), 17 deletions(-) create mode 100644 web/src/components/core/Attribute.jsx create mode 100644 web/src/components/core/Description.jsx diff --git a/web/src/assets/styles/blocks.scss b/web/src/assets/styles/blocks.scss index 848bf62405..f645aedec1 100644 --- a/web/src/assets/styles/blocks.scss +++ b/web/src/assets/styles/blocks.scss @@ -197,8 +197,8 @@ section > .content { } } -// compact lists in tooltips -[role="tooltip"] li + li { +// compact lists in popover +.pf-c-popover li + li { margin: 0; } @@ -207,6 +207,6 @@ section > .content { margin-left: 4px; } -.has_help { +.with_description { cursor: pointer; } diff --git a/web/src/components/core/Attribute.jsx b/web/src/components/core/Attribute.jsx new file mode 100644 index 0000000000..6f36bce7d9 --- /dev/null +++ b/web/src/components/core/Attribute.jsx @@ -0,0 +1,43 @@ +/* + * Copyright (c) [2023] SUSE LLC + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, contact SUSE LLC. + * + * To contact SUSE LLC about this file by physical or electronic mail, you may + * find current contact information at www.suse.com. + */ + +import React from "react"; +import { Label } from "@patternfly/react-core"; + +import { Description } from "~/components/core"; +import { Icon } from "~/components/layout"; + +/** + * @component + * + * @param {object} hint - content displayed in a bubble after clicking the content + */ +export default function Attribute ({ hint = null, children }) { + if (hint) { + return ( + + + + ); + } + + return ; +} diff --git a/web/src/components/core/Description.jsx b/web/src/components/core/Description.jsx new file mode 100644 index 0000000000..961ece0c35 --- /dev/null +++ b/web/src/components/core/Description.jsx @@ -0,0 +1,36 @@ +/* + * Copyright (c) [2023] SUSE LLC + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, contact SUSE LLC. + * + * To contact SUSE LLC about this file by physical or electronic mail, you may + * find current contact information at www.suse.com. + */ + +import React from "react"; +import { Popover } from "@patternfly/react-core"; + +/** + * @component + * + * @param {object} description - content displayed in a bubble after clicking the content + */ +export default function Description ({ description, children, ...otherProps }) { + return ( + + {children} + + ); +} diff --git a/web/src/components/core/index.js b/web/src/components/core/index.js index adfef7db16..c5282bda27 100644 --- a/web/src/components/core/index.js +++ b/web/src/components/core/index.js @@ -20,6 +20,8 @@ */ export { default as About } from "./About"; +export { default as Attribute } from "./Attribute"; +export { default as Description } from "./Description"; export { default as Disclosure } from "./Disclosure"; export { default as Sidebar } from "./Sidebar"; export { default as Section } from "./Section"; diff --git a/web/src/components/storage/ProposalVolumes.jsx b/web/src/components/storage/ProposalVolumes.jsx index d8ba4ac532..d23e3d2ee5 100644 --- a/web/src/components/storage/ProposalVolumes.jsx +++ b/web/src/components/storage/ProposalVolumes.jsx @@ -26,14 +26,14 @@ import { Dropdown, DropdownToggle, DropdownItem, Form, FormGroup, FormSelect, FormSelectOption, List, ListItem, - Popover, Skeleton, - Text, TextInput, + Skeleton, + TextInput, Toolbar, ToolbarContent, ToolbarItem } from "@patternfly/react-core"; import { TableComposable, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table'; import { filesize } from "filesize"; -import { Em, If, Popup, RowActions } from '~/components/core'; +import { Attribute, Em, If, Popup, RowActions } from '~/components/core'; import { Icon } from '~/components/layout'; import { noop } from "~/utils"; @@ -58,21 +58,21 @@ const sizeText = (size) => { }; /** - * Generates an icon with help describing what affects the volume limits. - * If the limits are nor affected then returns `null`. - * @component + * Generates an hint describing which attributes affect the auto-calculated limits. + * If the limits are not affected then it returns `null`. + * @function * * @param {object} volume - storage volume object */ -const AutoCalculatedInfo = ({ volume, children }) => { - // the size is not affected by snapshots or other volumes +const AutoCalculatedHint = (volume) => { + // no hint, the size is not affected by snapshots or other volumes if (!volume.snapshotsAffectSizes && volume.sizeRelevantVolumes.length === 0) { - return <>{children}; + return null; } - const content = ( + return ( <> - These limits are affected by: + These limits are affected by: {volume.snapshotsAffectSizes && The configuration of snapshots} @@ -81,8 +81,6 @@ const AutoCalculatedInfo = ({ volume, children }) => { ); - - return
{children}
; }; /** @@ -271,7 +269,7 @@ const VolumeRow = ({ columns, volume, isLoading, onDelete }) => { return (
{limits} - auto } /> + auto} />
); }; From 8934dd6d5df5572a98722651ce8ce7f7841feeb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 27 Apr 2023 10:22:58 +0200 Subject: [PATCH 43/51] Small improvements --- web/src/components/core/Attribute.jsx | 12 ++++++++---- web/src/components/core/Description.jsx | 19 +++++++++++++------ .../components/storage/ProposalVolumes.jsx | 7 ++++--- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/web/src/components/core/Attribute.jsx b/web/src/components/core/Attribute.jsx index 6f36bce7d9..9b36c46789 100644 --- a/web/src/components/core/Attribute.jsx +++ b/web/src/components/core/Attribute.jsx @@ -26,14 +26,18 @@ import { Description } from "~/components/core"; import { Icon } from "~/components/layout"; /** + * Display a label with additional details. The details are displayed after + * clicking the label and the "i" icon indicates available details. + * If the label is not defined or is empty it behaves like a plain label. * @component * - * @param {object} hint - content displayed in a bubble after clicking the content + * @param {object} description details displayed after clicking the label + * @param {object} children the content of the label */ -export default function Attribute ({ hint = null, children }) { - if (hint) { +export default function Attribute ({ description, children }) { + if (description) { return ( - + ); diff --git a/web/src/components/core/Description.jsx b/web/src/components/core/Description.jsx index 961ece0c35..2012251474 100644 --- a/web/src/components/core/Description.jsx +++ b/web/src/components/core/Description.jsx @@ -23,14 +23,21 @@ import React from "react"; import { Popover } from "@patternfly/react-core"; /** + * Displays details popup after clicking the children elements * @component * - * @param {object} description - content displayed in a bubble after clicking the content + * @param {object} description content displayed in a popup + * @param {object} children the wrapped content */ export default function Description ({ description, children, ...otherProps }) { - return ( - - {children} - - ); + if (description) { + return ( + + {children} + + ); + } + + // none or empty description, just return the children + return children; } diff --git a/web/src/components/storage/ProposalVolumes.jsx b/web/src/components/storage/ProposalVolumes.jsx index d23e3d2ee5..2b4742e83e 100644 --- a/web/src/components/storage/ProposalVolumes.jsx +++ b/web/src/components/storage/ProposalVolumes.jsx @@ -63,10 +63,11 @@ const sizeText = (size) => { * @function * * @param {object} volume - storage volume object + * @returns {object} component to display (can be `null`) */ const AutoCalculatedHint = (volume) => { // no hint, the size is not affected by snapshots or other volumes - if (!volume.snapshotsAffectSizes && volume.sizeRelevantVolumes.length === 0) { + if (!volume.snapshotsAffectSizes && volume.sizeRelevantVolumes && volume.sizeRelevantVolumes.length === 0) { return null; } @@ -76,7 +77,7 @@ const AutoCalculatedHint = (volume) => { {volume.snapshotsAffectSizes && The configuration of snapshots} - {volume.sizeRelevantVolumes.length > 0 && + {volume.sizeRelevantVolumes && volume.sizeRelevantVolumes.length > 0 && Presence of other volumes ({volume.sizeRelevantVolumes.join(", ")})} @@ -269,7 +270,7 @@ const VolumeRow = ({ columns, volume, isLoading, onDelete }) => { return (
{limits} - auto} /> + auto} />
); }; From bd572419ed1c2241fef980b5168ac810d2e05072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 27 Apr 2023 10:23:25 +0200 Subject: [PATCH 44/51] Added unit tests --- web/src/components/core/Attribute.test.jsx | 67 +++++++++++++++++++ web/src/components/core/Description.test.jsx | 68 ++++++++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 web/src/components/core/Attribute.test.jsx create mode 100644 web/src/components/core/Description.test.jsx diff --git a/web/src/components/core/Attribute.test.jsx b/web/src/components/core/Attribute.test.jsx new file mode 100644 index 0000000000..c71be4cf34 --- /dev/null +++ b/web/src/components/core/Attribute.test.jsx @@ -0,0 +1,67 @@ +/* + * Copyright (c) [2023] SUSE LLC + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, contact SUSE LLC. + * + * To contact SUSE LLC about this file by physical or electronic mail, you may + * find current contact information at www.suse.com. + */ + +import React from "react"; +import { screen } from "@testing-library/react"; +import { plainRender } from "~/test-utils"; +import { Attribute } from "~/components/core"; + +describe("Attribute", () => { + const description = "Some great description"; + const label = "Label"; + + describe("The description is not empty", () => { + it("displays the label with the 'info' icon and show the description after click", async () => { + const { user, container } = plainRender({label}); + + // an icon is displayed + expect(container.querySelector("svg")).toBeInTheDocument(); + + // the description is not displayed just after the render + expect(screen.queryByText(description)).not.toBeInTheDocument(); + expect(screen.queryByRole("dialog")).not.toBeInTheDocument(); + + // click it + const label_node = screen.getByText(label); + await user.click(label_node); + + // then the description is visible in a dialog + screen.getByRole("dialog"); + screen.getByText(description); + }); + }); + + describe("The description is not defined", () => { + it("displays the label without the 'info' icon and clicking does not show any popup", async () => { + const { user, container } = plainRender({label}); + + // no icon + expect(container.querySelector("svg")).not.toBeInTheDocument(); + + // click it + const label_node = screen.getByText(label); + await user.click(label_node); + + // no popup + expect(screen.queryByRole("dialog")).not.toBeInTheDocument(); + }); + }); +}); diff --git a/web/src/components/core/Description.test.jsx b/web/src/components/core/Description.test.jsx new file mode 100644 index 0000000000..010b21cd47 --- /dev/null +++ b/web/src/components/core/Description.test.jsx @@ -0,0 +1,68 @@ +/* + * Copyright (c) [2023] SUSE LLC + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, contact SUSE LLC. + * + * To contact SUSE LLC about this file by physical or electronic mail, you may + * find current contact information at www.suse.com. + */ + +import React from "react"; +import { screen } from "@testing-library/react"; +import { plainRender } from "~/test-utils"; +import { Description } from "~/components/core"; + +describe("Description", () => { + const description = "Some great description"; + const item = "Item with description"; + + it("displays the description after clicking the object", async () => { + const { user } = plainRender({item}); + + // the description is not displayed just after the render + expect(screen.queryByText(description)).not.toBeInTheDocument(); + expect(screen.queryByRole("dialog")).not.toBeInTheDocument(); + + // click it + const item_node = screen.getByText(item); + await user.click(item_node); + + // then the description is visible in a dialog + screen.getByRole("dialog"); + screen.getByText(description); + }); + + const empty_tester = async (subject) => { + const { user } = plainRender(subject); + + const item_node = screen.getByText(item); + await user.click(item_node); + + // do not display empty popup + expect(screen.queryByRole("dialog")).not.toBeInTheDocument(); + }; + + it("displays the object without description when it is undefined", async () => { + empty_tester({item}); + }); + + it("displays the object without description when it is null", async () => { + empty_tester({item}); + }); + + it("displays the object without description when it is empty", async () => { + empty_tester({item}); + }); +}); From c3633b89a1192b0a525678fee99a5d90be09effd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 27 Apr 2023 10:26:28 +0200 Subject: [PATCH 45/51] Changes --- web/package/cockpit-agama.changes | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/package/cockpit-agama.changes b/web/package/cockpit-agama.changes index b23519d1ea..e9be18adf4 100644 --- a/web/package/cockpit-agama.changes +++ b/web/package/cockpit-agama.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Apr 27 08:24:27 UTC 2023 - Ladislav Slezák + +- Display details for the autocalculated label in the storage + settings + ------------------------------------------------------------------- Tue Apr 25 13:42:22 UTC 2023 - David Diaz From ccf53bb5be7e70cfb6146c6b1df1161304ded587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 27 Apr 2023 10:30:42 +0200 Subject: [PATCH 46/51] CSS update --- web/src/assets/styles/blocks.scss | 3 --- web/src/assets/styles/utilities.scss | 4 ++++ web/src/components/core/Description.jsx | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/web/src/assets/styles/blocks.scss b/web/src/assets/styles/blocks.scss index f645aedec1..dac4e7a30c 100644 --- a/web/src/assets/styles/blocks.scss +++ b/web/src/assets/styles/blocks.scss @@ -207,6 +207,3 @@ section > .content { margin-left: 4px; } -.with_description { - cursor: pointer; -} diff --git a/web/src/assets/styles/utilities.scss b/web/src/assets/styles/utilities.scss index 5ccf6d7e2a..4a84a0296c 100644 --- a/web/src/assets/styles/utilities.scss +++ b/web/src/assets/styles/utilities.scss @@ -136,3 +136,7 @@ /** END block-size fallbacks **/ block-size: 95dvh; } + +.cursor-pointer { + cursor: pointer; +} diff --git a/web/src/components/core/Description.jsx b/web/src/components/core/Description.jsx index 2012251474..1d96ae0e6d 100644 --- a/web/src/components/core/Description.jsx +++ b/web/src/components/core/Description.jsx @@ -33,7 +33,7 @@ export default function Description ({ description, children, ...otherProps }) { if (description) { return ( - {children} + {children} ); } From aeb98ff19f9b320278b814bc07843c19034b1ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 27 Apr 2023 11:45:18 +0200 Subject: [PATCH 47/51] Update web/src/components/core/Attribute.jsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: David Díaz <1691872+dgdavid@users.noreply.github.com> --- web/src/components/core/Attribute.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/components/core/Attribute.jsx b/web/src/components/core/Attribute.jsx index 9b36c46789..519b40d662 100644 --- a/web/src/components/core/Attribute.jsx +++ b/web/src/components/core/Attribute.jsx @@ -28,7 +28,7 @@ import { Icon } from "~/components/layout"; /** * Display a label with additional details. The details are displayed after * clicking the label and the "i" icon indicates available details. - * If the label is not defined or is empty it behaves like a plain label. + * If the label is not defined or is empty it behaves like a plain label. * @component * * @param {object} description details displayed after clicking the label From 28dd024d301e57c7ccfc4160ed3c89f5ba948229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 27 Apr 2023 12:03:23 +0200 Subject: [PATCH 48/51] Update web/package/cockpit-agama.changes Co-authored-by: Martin Vidner --- web/package/cockpit-agama.changes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/package/cockpit-agama.changes b/web/package/cockpit-agama.changes index e9be18adf4..5cdd4060a7 100644 --- a/web/package/cockpit-agama.changes +++ b/web/package/cockpit-agama.changes @@ -1,7 +1,7 @@ ------------------------------------------------------------------- Thu Apr 27 08:24:27 UTC 2023 - Ladislav Slezák -- Display details for the autocalculated label in the storage +- Display details for the "autocalculated" label in the storage settings ------------------------------------------------------------------- From 2cbe8e19c1f76f00e0d17fc3bfebf1c0a81f37c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 27 Apr 2023 14:37:12 +0200 Subject: [PATCH 49/51] Use spacing instead of styling --- web/src/assets/styles/blocks.scss | 6 ------ web/src/components/core/Attribute.jsx | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/web/src/assets/styles/blocks.scss b/web/src/assets/styles/blocks.scss index dac4e7a30c..16afa6848a 100644 --- a/web/src/assets/styles/blocks.scss +++ b/web/src/assets/styles/blocks.scss @@ -201,9 +201,3 @@ section > .content { .pf-c-popover li + li { margin: 0; } - -// extra margin for "i" icons in labels -.pf-c-label__content > svg { - margin-left: 4px; -} - diff --git a/web/src/components/core/Attribute.jsx b/web/src/components/core/Attribute.jsx index 519b40d662..a090ccaf7d 100644 --- a/web/src/components/core/Attribute.jsx +++ b/web/src/components/core/Attribute.jsx @@ -38,7 +38,7 @@ export default function Attribute ({ description, children }) { if (description) { return ( - + ); } From 25cda5f3898ef198f25550766364590134b63603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 27 Apr 2023 16:03:57 +0200 Subject: [PATCH 50/51] Renames --- web/src/components/core/Description.jsx | 4 ++-- web/src/components/core/Description.test.jsx | 10 +++++----- web/src/components/core/{Attribute.jsx => Tip.jsx} | 6 +++--- .../core/{Attribute.test.jsx => Tip.test.jsx} | 8 ++++---- web/src/components/core/index.js | 2 +- web/src/components/storage/ProposalVolumes.jsx | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) rename web/src/components/core/{Attribute.jsx => Tip.jsx} (87%) rename web/src/components/core/{Attribute.test.jsx => Tip.test.jsx} (89%) diff --git a/web/src/components/core/Description.jsx b/web/src/components/core/Description.jsx index 1d96ae0e6d..83864279fd 100644 --- a/web/src/components/core/Description.jsx +++ b/web/src/components/core/Description.jsx @@ -26,8 +26,8 @@ import { Popover } from "@patternfly/react-core"; * Displays details popup after clicking the children elements * @component * - * @param {object} description content displayed in a popup - * @param {object} children the wrapped content + * @param {(JSX.Element|null)} description content displayed in a popup + * @param {JSX.Element} children the wrapped content */ export default function Description ({ description, children, ...otherProps }) { if (description) { diff --git a/web/src/components/core/Description.test.jsx b/web/src/components/core/Description.test.jsx index 010b21cd47..500f50cd6e 100644 --- a/web/src/components/core/Description.test.jsx +++ b/web/src/components/core/Description.test.jsx @@ -44,8 +44,8 @@ describe("Description", () => { screen.getByText(description); }); - const empty_tester = async (subject) => { - const { user } = plainRender(subject); + const expectNoPopup = async (content) => { + const { user } = plainRender(content); const item_node = screen.getByText(item); await user.click(item_node); @@ -55,14 +55,14 @@ describe("Description", () => { }; it("displays the object without description when it is undefined", async () => { - empty_tester({item}); + expectNoPopup({item}); }); it("displays the object without description when it is null", async () => { - empty_tester({item}); + expectNoPopup({item}); }); it("displays the object without description when it is empty", async () => { - empty_tester({item}); + expectNoPopup({item}); }); }); diff --git a/web/src/components/core/Attribute.jsx b/web/src/components/core/Tip.jsx similarity index 87% rename from web/src/components/core/Attribute.jsx rename to web/src/components/core/Tip.jsx index a090ccaf7d..e71f8bd74b 100644 --- a/web/src/components/core/Attribute.jsx +++ b/web/src/components/core/Tip.jsx @@ -31,10 +31,10 @@ import { Icon } from "~/components/layout"; * If the label is not defined or is empty it behaves like a plain label. * @component * - * @param {object} description details displayed after clicking the label - * @param {object} children the content of the label + * @param {JSX.Element} description details displayed after clicking the label + * @param {JSX.Element} children the content of the label */ -export default function Attribute ({ description, children }) { +export default function Tip ({ description, children }) { if (description) { return ( diff --git a/web/src/components/core/Attribute.test.jsx b/web/src/components/core/Tip.test.jsx similarity index 89% rename from web/src/components/core/Attribute.test.jsx rename to web/src/components/core/Tip.test.jsx index c71be4cf34..967b41edb9 100644 --- a/web/src/components/core/Attribute.test.jsx +++ b/web/src/components/core/Tip.test.jsx @@ -22,15 +22,15 @@ import React from "react"; import { screen } from "@testing-library/react"; import { plainRender } from "~/test-utils"; -import { Attribute } from "~/components/core"; +import { Tip } from "~/components/core"; -describe("Attribute", () => { +describe("Tip", () => { const description = "Some great description"; const label = "Label"; describe("The description is not empty", () => { it("displays the label with the 'info' icon and show the description after click", async () => { - const { user, container } = plainRender({label}); + const { user, container } = plainRender({label}); // an icon is displayed expect(container.querySelector("svg")).toBeInTheDocument(); @@ -51,7 +51,7 @@ describe("Attribute", () => { describe("The description is not defined", () => { it("displays the label without the 'info' icon and clicking does not show any popup", async () => { - const { user, container } = plainRender({label}); + const { user, container } = plainRender({label}); // no icon expect(container.querySelector("svg")).not.toBeInTheDocument(); diff --git a/web/src/components/core/index.js b/web/src/components/core/index.js index c5282bda27..792f23ff35 100644 --- a/web/src/components/core/index.js +++ b/web/src/components/core/index.js @@ -20,7 +20,6 @@ */ export { default as About } from "./About"; -export { default as Attribute } from "./Attribute"; export { default as Description } from "./Description"; export { default as Disclosure } from "./Disclosure"; export { default as Sidebar } from "./Sidebar"; @@ -48,4 +47,5 @@ export { default as ProgressReport } from "./ProgressReport"; export { default as ProgressText } from "./ProgressText"; export { default as ValidationErrors } from "./ValidationErrors"; export { default as Terminal } from "./Terminal"; +export { default as Tip } from "./Tip"; export { default as ShowTerminalButton } from "./ShowTerminalButton"; diff --git a/web/src/components/storage/ProposalVolumes.jsx b/web/src/components/storage/ProposalVolumes.jsx index 2b4742e83e..202f62a5b4 100644 --- a/web/src/components/storage/ProposalVolumes.jsx +++ b/web/src/components/storage/ProposalVolumes.jsx @@ -33,7 +33,7 @@ import { import { TableComposable, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table'; import { filesize } from "filesize"; -import { Attribute, Em, If, Popup, RowActions } from '~/components/core'; +import { Em, If, Popup, RowActions, Tip } from '~/components/core'; import { Icon } from '~/components/layout'; import { noop } from "~/utils"; @@ -63,7 +63,7 @@ const sizeText = (size) => { * @function * * @param {object} volume - storage volume object - * @returns {object} component to display (can be `null`) + * @returns {(ReactComponent|null)} component to display (can be `null`) */ const AutoCalculatedHint = (volume) => { // no hint, the size is not affected by snapshots or other volumes @@ -270,7 +270,7 @@ const VolumeRow = ({ columns, volume, isLoading, onDelete }) => { return (
{limits} - auto} /> + auto} />
); }; From 22b34f5705d3cc9f85ada2d974bc0bed0966af8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20D=C3=ADaz=20Gonz=C3=A1lez?= Date: Tue, 2 May 2023 16:28:42 +0100 Subject: [PATCH 51/51] [web] Use a button for displaying the description Popover Which might help with accessibility. --- web/src/assets/styles/utilities.scss | 4 ---- web/src/components/core/Description.jsx | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/web/src/assets/styles/utilities.scss b/web/src/assets/styles/utilities.scss index 4a84a0296c..5ccf6d7e2a 100644 --- a/web/src/assets/styles/utilities.scss +++ b/web/src/assets/styles/utilities.scss @@ -136,7 +136,3 @@ /** END block-size fallbacks **/ block-size: 95dvh; } - -.cursor-pointer { - cursor: pointer; -} diff --git a/web/src/components/core/Description.jsx b/web/src/components/core/Description.jsx index 83864279fd..849334be31 100644 --- a/web/src/components/core/Description.jsx +++ b/web/src/components/core/Description.jsx @@ -20,7 +20,7 @@ */ import React from "react"; -import { Popover } from "@patternfly/react-core"; +import { Popover, Button } from "@patternfly/react-core"; /** * Displays details popup after clicking the children elements @@ -33,7 +33,7 @@ export default function Description ({ description, children, ...otherProps }) { if (description) { return ( - {children} + ); }