We've just started using the remote server functionality of Aegir a lot, and now we have lots of remote servers with fairly non-helpful names, so choosing which server to create a platform on is a major pain. A lot of this pain would go away if we could have an additional 'friendly' name to go along with the server, this would be displayed additionally to the existing information when picking a server.

This could be done entirely in contrib land for now, and then rolled into Aegir for 2.x if wanted, but it would need adding a small drupal_alter to hosting_get_servers so that I can add my friendly name in.

Can we sneak this API change in for 6.x-1.x?

Comments

Steven Jones’s picture

The change would be this:

function hosting_get_servers($service) {
  $return = array();
  $result = db_query("SELECT n.nid, n.title FROM {node} n INNER JOIN {hosting_service} s ON n.vid = s.vid AND s.available = 1 AND s.service = '%s'", $service);
  while ($server = db_fetch_object($result)) {
    $return[$server->nid] = $server->title;
  }
  return $return;
}

becomes:

function hosting_get_servers($service) {
  $return = array();
  $result = db_query("SELECT n.nid, n.title FROM {node} n INNER JOIN {hosting_service} s ON n.vid = s.vid AND s.available = 1 AND s.service = '%s'", $service);
  while ($server = db_fetch_object($result)) {
    $return[$server->nid] = $server->title;
  }
  drupal_alter('hosting_get_servers', $return, $service); 
  return $return;
}

Which is a very simple change no?

anarcat’s picture

Yes, although I'm not sure I like the API... What about hook_hosting_server_titles()?

Steven Jones’s picture

Cool beans.

Sure, so it'll be hook_hosting_servers_titles_alter.

Steven Jones’s picture

Status: Active » Fixed

Fixed, documented and pushed to all branches.

Aces!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

hejazee’s picture

Status: Closed (fixed) » Needs work

It would be great if the server's friendly name also was shown on the server list (?q=hosting/servers)

This means that not only the hosting_get_servers() function, but also all functions that return the name of a server, should use the friendly name (or trigger that hook)

related: #1496360: This module doesn't work at all!

Steven Jones’s picture

Title: Alter hook for hosting_get_servers » Add friendly name for Servers
Project: Hosting » Hostmaster (Aegir)
Version: 6.x-0.4-alpha3 » 6.x-2.x-dev
Assigned: Unassigned » Steven Jones

It would be really nice if we could add some kind of display name for Servers in 2.x

helmo’s picture

Assigned: Steven Jones » Unassigned

@hejazee: I added a patch for this in #1829992: Use replaced title in /hosting/servers list

The proper solution could become easier when #1876354: Convert list of servers to use views is done...

ergonlogic’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Issue summary: View changes

New features need to be implemented in Aegir 3.x, then we can consider back-porting to Aegir 2.x.

ergonlogic’s picture

We're just talking about an additional field ('name'), on server nodes, right? And using that instead of the title throughout the UI? Token support, as in the hosting_server_titles contrib module, isn't required either then. We should probably rename 'title' to hostname as well.

helmo’s picture

Yes, a name field that's not necessarily the hostname would probably do.

I personally created a cck field called friendly_name. With the token pattern "[title-raw] - [field_friendly_name-raw]" this allowed me to add a general purpose description to the server listing.

> We should probably rename 'title' to hostname as well.

Definitely .. all for predictability.

ergonlogic’s picture

Status: Needs work » Fixed

This required a tweak to eldir's preprocess function, since it was independently looking up the node name.

Fixed in 25d218d (hosting) and 8e1d5fe (eldir).

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

  • Commit d475774 on 7.x-2.x, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-588728-views-integration, dev-1403208-new_roles, dev-helmo-3.x by Steven Jones:
    Issue #1189398 by Steven Jones: Added Alter hook for hosting_get_servers...

  • Commit d475774 on 7.x-2.x, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-588728-views-integration, dev-1403208-new_roles, dev-helmo-3.x by Steven Jones:
    Issue #1189398 by Steven Jones: Added Alter hook for hosting_get_servers...