aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-09-27 19:32:32 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-09-28 11:23:43 +0300
commitd3f7242eb9e0476fb0c1d3caf1c6cfdfebab63d1 (patch)
tree4d3b52e750d12c45315cf963580cde4b5969a5fe
parentd33e656f1169bb6744ecb3418bed68340d0d3b97 (diff)
Add support for explicit hidden target configuration class
-rw-r--r--mod/mod-build-configs.cxx44
-rw-r--r--mod/mod-build-result.cxx2
-rw-r--r--mod/mod-builds.cxx4
-rw-r--r--mod/mod-package-version-details.cxx2
-rw-r--r--mod/module.cli5
5 files changed, 36 insertions, 21 deletions
diff --git a/mod/mod-build-configs.cxx b/mod/mod-build-configs.cxx
index 79c47f7..74d502a 100644
--- a/mod/mod-build-configs.cxx
+++ b/mod/mod-build-configs.cxx
@@ -54,6 +54,8 @@ handle (request& rq, response& rs)
params::build_configs params;
+ string& selected_class (params.class_name ()); // Note: can be empty.
+
try
{
name_value_scanner s (rq.parameters (1024));
@@ -64,8 +66,7 @@ handle (request& rq, response& rs)
// character (that is otherwise forbidden in a class name) to the plus
// character.
//
- string& cn (params.class_name ());
- replace (cn.begin (), cn.end (), ' ', '+');
+ replace (selected_class.begin (), selected_class.end (), ' ', '+');
}
catch (const cli::exception& e)
{
@@ -90,7 +91,7 @@ handle (request& rq, response& rs)
{
string r (tenant_dir (root, tenant).string () + "?build-configs");
- if (cls != "all")
+ if (!cls.empty ())
{
r += '=';
@@ -125,26 +126,36 @@ handle (request& rq, response& rs)
for (auto b (cls.begin ()), i (b), e (cls.end ()); i != e; ++i)
{
- if (i != b)
- s << ' ';
-
+ // Skip the 'hidden' class.
+ //
const string& c (*i);
- print_class_name (c, c == params.class_name ());
- // Append the base class, if present.
- //
- auto j (im.find (c));
- if (j != im.end ())
+ if (c != "hidden")
{
- s << ':';
- print_class_name (j->second);
+ // Note that here we rely on the fact that the first class in the list
+ // can never be 'hidden' (is always 'all').
+ //
+ if (i != b)
+ s << ' ';
+
+ print_class_name (c, c == selected_class);
+
+ // Append the base class, if present.
+ //
+ auto j (im.find (c));
+ if (j != im.end ())
+ {
+ s << ':';
+ print_class_name (j->second);
+ }
}
}
s << ~P;
}
- // Print build configurations that belong to the selected class.
+ // Print build configurations that belong to the selected class (all
+ // configurations if no class is selected) and are not hidden.
//
// We will calculate the total configuration count and cache configurations
// for printing (skipping an appropriate number of them for page number
@@ -159,7 +170,8 @@ handle (request& rq, response& rs)
size_t print (page_configs);
for (const build_target_config& c: *target_conf_)
{
- if (belongs (c, params.class_name ()))
+ if ((selected_class.empty () || belongs (c, selected_class)) &&
+ !belongs (c, "hidden"))
{
if (skip != 0)
--skip;
@@ -214,7 +226,7 @@ handle (request& rq, response& rs)
count,
page_configs,
options_->build_config_pages (),
- url (params.class_name ()))
+ url (selected_class))
<< ~DIV
<< ~BODY
<< ~HTML;
diff --git a/mod/mod-build-result.cxx b/mod/mod-build-result.cxx
index b1b7db7..71cc59a 100644
--- a/mod/mod-build-result.cxx
+++ b/mod/mod-build-result.cxx
@@ -378,7 +378,7 @@ handle (request& rq, response&)
// `skip`, the configuration is hidden, or is now excluded by the
// package.
//
- if (rs != result_status::skip && belongs (*tc, "all"))
+ if (rs != result_status::skip && !belongs (*tc, "hidden"))
{
shared_ptr<build_package> p (
build_db_->load<build_package> (b->id.package));
diff --git a/mod/mod-builds.cxx b/mod/mod-builds.cxx
index 58aa3aa..7ad5fc7 100644
--- a/mod/mod-builds.cxx
+++ b/mod/mod-builds.cxx
@@ -511,7 +511,7 @@ handle (request& rq, response& rs)
for (const auto& c: *target_conf_map_)
{
- if (!exclude_hidden || belongs (*c.second, "all"))
+ if (!exclude_hidden || !belongs (*c.second, "hidden"))
conf_ids.push_back (c.first);
}
@@ -798,7 +798,7 @@ handle (request& rq, response& rs)
//
(tgt.empty () || path_match (c.target.string (), tgt)) &&
- (!exclude_hidden || belongs (c, "all"))) // Filter hidden.
+ (!exclude_hidden || !belongs (c, "hidden"))) // Filter hidden.
{
target_configs.push_back (&c);
diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx
index 632e2ca..3744d95 100644
--- a/mod/mod-package-version-details.cxx
+++ b/mod/mod-package-version-details.cxx
@@ -756,7 +756,7 @@ handle (request& rq, response& rs)
{
const build_target_config& tc (*bc.second);
- if (belongs (tc, "all") && !exclude (pc, tc))
+ if (!belongs (tc, "hidden") && !exclude (pc, tc))
{
const build_target_config_id& id (bc.first);
diff --git a/mod/module.cli b/mod/module.cli
index ab72a9a..3fdd7e3 100644
--- a/mod/module.cli
+++ b/mod/module.cli
@@ -969,10 +969,13 @@ namespace brep
class build_configs
{
+ // By default, display all build configurations except those which
+ // belong to the 'hidden' class.
+ //
// Note that the build-configs parameter is renamed to '_' by the root
// handler (see the request_proxy class for details).
//
- string class_name | _ = "all";
+ string class_name | _;
// Display build configurations list starting from this page.
//