Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
feat(ui): removed agent tab in favor of block info into computer UI
Browse files Browse the repository at this point in the history
  • Loading branch information
DIOHz0r committed Dec 12, 2017
1 parent 987e068 commit 614042f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
16 changes: 6 additions & 10 deletions inc/agent.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,6 @@ static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtem
self::showForFleet($item);
return true;
break;

case Computer::class:
self::displayTabContentForComputer($item, false);
break;
}
}

Expand Down Expand Up @@ -337,21 +333,21 @@ public static function showForFleet(PluginFlyvemdmFleet $item) {
}

/**
* @param PluginFlyvemdmAgent $item
* @param bool $defaultTpl
* @param CommonDBTM $item
*/
public static function displayTabContentForComputer(PluginFlyvemdmAgent $item, $defaultTpl= true) {
public static function displayTabContentForComputer(CommonDBTM $item) {

$agent = new static();
$agent->getFromDBByCrit(['computers_id' => $item->getID()]);
if(!$agent->getFromDBByCrit(['computers_id' => $item->getID()])){
return;
}
$fields = $agent->fields;
$fields['fleet']=$agent->getFleet();
if (empty($fields['last_contact'])) {
$fields['last_contact'] = __('Never seen online', 'flyvemdm');
}
$twig = plugin_flyvemdm_getTemplateEngine();
$template = ($defaultTpl) ? 'agentComputerInfo.html' : 'agentComputerTab.html';
echo $twig->render($template, [
echo $twig->render('agentComputerInfo.html', [
'agent' => $fields,
'agentUrl' => Toolbox::getItemTypeFormURL(self::class),
'fleetUrl' => Toolbox::getItemTypeFormURL(PluginFlyvemdmFleet::class)
Expand Down
2 changes: 1 addition & 1 deletion setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function plugin_init_flyvemdm() {
* Register classes
*/
function plugin_flyvemdm_registerClasses() {
Plugin::registerClass(PluginFlyvemdmAgent::class, ['addtabon' => Computer::class]);
Plugin::registerClass(PluginFlyvemdmAgent::class);
Plugin::registerClass(PluginFlyvemdmFleet::class);
Plugin::registerClass(PluginFlyvemdmPolicy::class);
Plugin::registerClass(PluginFlyvemdmTask::class);
Expand Down
6 changes: 0 additions & 6 deletions tpl/agentComputerTab.html

This file was deleted.

0 comments on commit 614042f

Please sign in to comment.