Commit 25a773ea authored by Domeshow Emmanuel's avatar Domeshow Emmanuel Committed by Adrien Mbuya Maloba
Browse files

[FIX] Tiki Manager - Make actions consistent

parent e80f378c
Pipeline #599351566 passed with stages
in 8 minutes and 16 seconds
......@@ -175,7 +175,7 @@ class Tracker_Field_TikiManager extends Tracker_Field_Abstract
});
// taken from Tiki manager available commands, TODO: hook these up with the interface
$available_actions = ['access', 'backup', 'blank', 'check', 'clone', 'cloneandupgrade', 'console', 'copysshkey', 'create', 'delete', 'detect', 'edit', 'fixpermissions', 'import', 'list', 'maintenance', 'patch_apply', 'patch_delete', 'patch_list', 'profile_apply', 'restore', 'revert', 'setup-scheduler-cron', 'stats', 'update', 'upgrade', 'watch', 'info'];
$available_actions = ['access', 'backup', 'blank', 'check', 'clone', 'cloneandupgrade', 'console', 'copysshkey', 'create', 'delete', 'detect', 'edit', 'fixpermissions', 'import', 'list', 'maintenance', 'patch_apply', 'patch_delete', 'patch_list', 'profile_apply', 'restore', 'revert', 'setup-scheduler-cron', 'stats', 'update', 'upgrade', 'watch', 'info', 'verify'];
if ($showactions) {
$available_actions = array_filter($available_actions, function($action) use ($showactions) {
return in_array($action, $showactions);
......
......@@ -81,7 +81,7 @@ function wikiplugin_tikimanager($data, $params)
});
// taken from Tiki manager available commands, TODO: hook these up with the interface
$available_actions = ['access', 'backup', 'blank', 'check', 'clone', 'cloneandupgrade', 'console', 'copysshkey', 'create', 'delete', 'detect', 'edit', 'fixpermissions', 'import', 'list', 'maintenance', 'patch_apply', 'patch_delete', 'patch_list', 'profile_apply', 'restore', 'revert', 'setup-scheduler-cron', 'stats', 'update', 'upgrade', 'watch', 'info', 'tiki_versions', 'test_send_email', 'setup_watch', 'clear_cache'];
$available_actions = ['access', 'backup', 'blank', 'check', 'clone', 'cloneandupgrade', 'console', 'copysshkey', 'create', 'delete', 'detect', 'edit', 'fixpermissions', 'import', 'list', 'maintenance', 'patch_apply', 'patch_delete', 'patch_list', 'profile_apply', 'restore', 'revert', 'setup-scheduler-cron', 'stats', 'update', 'upgrade', 'watch', 'info', 'tiki_versions', 'test_send_email', 'setup_watch', 'clear_cache', 'verify'];
if ($showactions) {
$available_actions = array_filter($available_actions, function($action) use ($showactions) {
return in_array($action, $showactions);
......
......@@ -35,18 +35,18 @@
<td class="action">
{actions}{strip}
<action>
<a href="{service controller=manager action=watch instanceId=$instance->id}">
{icon name=eye _menu_text='y' _menu_icon='y' alt="{tr}Watch{/tr}"}
<a href="{service controller=manager action=access instanceId=$instance->id}">
{icon name=tags _menu_text='y' _menu_icon='y' alt="{tr}Access{/tr}"}
</a>
</action>
<action>
<a href="{service controller=manager action=detect instanceId=$instance->id}">
{icon name=info _menu_text='y' _menu_icon='y' alt="{tr}Detect{/tr}"}
<a href="{service controller=manager action=apply instanceId=$instance->id}">
{icon name=user _menu_text='y' _menu_icon='y' alt="{tr}Apply profile{/tr}"}
</a>
</action>
<action>
<a href="{service controller=manager action=clone instanceId=$instance->id}">
{icon name=copy _menu_text='y' _menu_icon='y' alt="{tr}Clone{/tr}"}
<a href="{service controller=manager action=backup instanceId=$instance->id}">
{icon name=download _menu_text='y' _menu_icon='y' alt="{tr}Backup{/tr}"}
</a>
</action>
<action>
......@@ -55,23 +55,23 @@
</a>
</action>
<action>
<a href="{service controller=manager action=update instanceId=$instance->id}">
{icon name=import _menu_text='y' _menu_icon='y' alt="{tr}Update{/tr}"}
<a href="{service controller=manager action=clone instanceId=$instance->id}">
{icon name=copy _menu_text='y' _menu_icon='y' alt="{tr}Clone{/tr}"}
</a>
</action>
<action>
<a href="{service controller=manager action=backup instanceId=$instance->id}">
{icon name=download _menu_text='y' _menu_icon='y' alt="{tr}Backup{/tr}"}
<a href="{service controller=manager action=console instanceId=$instance->id}">
{icon name=pen _menu_text='y' _menu_icon='y' alt="{tr}Console Command{/tr}"}
</a>
</action>
<action>
<a href="{service controller=manager action=fix instanceId=$instance->id}">
{icon name=wrench _menu_text='y' _menu_icon='y' alt="{tr}Fix{/tr}"}
<a href="{service controller=manager action=delete instanceId=$instance->id}">
{icon name=times _menu_text='y' _menu_icon='y' alt="{tr}Delete{/tr}"}
</a>
</action>
<action>
<a href="{service controller=manager action=access instanceId=$instance->id}">
{icon name=tags _menu_text='y' _menu_icon='y' alt="{tr}Access{/tr}"}
<a href="{service controller=manager action=detect instanceId=$instance->id}">
{icon name=info _menu_text='y' _menu_icon='y' alt="{tr}Detect{/tr}"}
</a>
</action>
<action>
......@@ -80,18 +80,18 @@
</a>
</action>
<action>
<a href="{service controller=manager action=delete instanceId=$instance->id}">
{icon name=times _menu_text='y' _menu_icon='y' alt="{tr}Delete{/tr}"}
<a href="{service controller=manager action=fix instanceId=$instance->id}">
{icon name=wrench _menu_text='y' _menu_icon='y' alt="{tr}Fix{/tr}"}
</a>
</action>
<action>
<a href="{service controller=manager action=console instanceId=$instance->id}">
{icon name=pen _menu_text='y' _menu_icon='y' alt="{tr}Console Command{/tr}"}
<a href="{service controller=manager action=maintenance mode=off instanceId=$instance->id}">
{icon name=hammer _menu_text='y' _menu_icon='y' alt="{tr}Maintenance Off{/tr}"}
</a>
</action>
<action>
<a href="{service controller=manager action=apply instanceId=$instance->id}">
{icon name=user _menu_text='y' _menu_icon='y' alt="{tr}Apply profile{/tr}"}
<a href="{service controller=manager action=maintenance mode=on instanceId=$instance->id}">
{icon name=hammer _menu_text='y' _menu_icon='y' alt="{tr}Maintenance On{/tr}"}
</a>
</action>
<action>
......@@ -100,17 +100,19 @@
</a>
</action>
<action>
<a href="{service controller=manager action=maintenance mode=on instanceId=$instance->id}">
{icon name=hammer _menu_text='y' _menu_icon='y' alt="{tr}Maintenance On{/tr}"}
<a href="{service controller=manager action=update instanceId=$instance->id}">
{icon name=import _menu_text='y' _menu_icon='y' alt="{tr}Update{/tr}"}
</a>
</action>
<action>
<a href="{service controller=manager action=maintenance mode=off instanceId=$instance->id}">
{icon name=hammer _menu_text='y' _menu_icon='y' alt="{tr}Maintenance Off{/tr}"}
</a>
</action>
<action>
<a href="{service controller=manager action=verify instanceId=$instance->id}">
{icon name=check _menu_text='y' _menu_icon='y' alt="{tr}Verify{/tr}"}
</a>
</action>
<action>
<a href="{service controller=manager action=watch instanceId=$instance->id}">
{icon name=eye _menu_text='y' _menu_icon='y' alt="{tr}Watch{/tr}"}
</a>
</action>
{/strip}{/actions}
</td>
......
......@@ -19,12 +19,14 @@
<a class="dropdown-item" href="{$instance->weburl}" target="_blank">
<span class="icon icon-file-archive-open fas fa-folder-open "></span> Open
</a>
{if in_array('update', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=update instanceId=$instance->id}">
{icon name=import _menu_text='y' _menu_icon='y' alt="{tr}Update{/tr}"}
{if in_array('access', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=access instanceId=$instance->id}">
{icon name=tags _menu_text='y' _menu_icon='y' alt="{tr}Access{/tr}"}
</a>
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=update instanceId=$instance->id mode=bg}">
{icon name=import _menu_text='y' _menu_icon='y' alt="{tr}Update (background){/tr}"}
{/if}
{if in_array('profile_apply', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=apply instanceId=$instance->id}">
{icon name=user _menu_text='y' _menu_icon='y' alt="{tr}Apply profile{/tr}"}
</a>
{/if}
{if in_array('backup', $field.available_actions)}
......@@ -32,19 +34,14 @@
{icon name=download _menu_text='y' _menu_icon='y' alt="{tr}Backup{/tr}"}
</a>
{/if}
{if in_array('fixpermissions', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=fix instanceId=$instance->id modal=1}">
{icon name=wrench _menu_text='y' _menu_icon='y' alt="{tr}Fix{/tr}"}
</a>
{/if}
{if in_array('edit', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=edit instanceId=$instance->id}">
{icon name=edit _menu_text='y' _menu_icon='y' alt="{tr}Edit{/tr}"}
{if in_array('check', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=check instanceId=$instance->id}">
{icon name=check _menu_text='y' _menu_icon='y' alt="{tr}Check{/tr}"}
</a>
{/if}
{if in_array('delete', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager_field action=delete instanceId=$instance->id itemId=$field.id fieldId=$field.fieldId}">
{icon name=times _menu_text='y' _menu_icon='y' alt="{tr}Delete{/tr}"}
{if in_array('clone', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=clone instanceId=$instance->id}">
{icon name=copy _menu_text='y' _menu_icon='y' alt="{tr}Clone{/tr}"}
</a>
{/if}
{if in_array('console', $field.available_actions)}
......@@ -52,29 +49,32 @@
{icon name=pen _menu_text='y' _menu_icon='y' alt="{tr}Console Command{/tr}"}
</a>
{/if}
{if in_array('delete', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager_field action=delete instanceId=$instance->id itemId=$field.id fieldId=$field.fieldId}">
{icon name=times _menu_text='y' _menu_icon='y' alt="{tr}Delete{/tr}"}
</a>
{/if}
{if in_array('detect', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=detect instanceId=$instance->id}">
{icon name=wrench _menu_text='y' _menu_icon='y' alt="{tr}Detect{/tr}"}
{icon name=info _menu_text='y' _menu_icon='y' alt="{tr}Detect{/tr}"}
</a>
{/if}
{if in_array('clone', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=clone instanceId=$instance->id}">
{icon name=edit _menu_text='y' _menu_icon='y' alt="{tr}Clone{/tr}"}
{if in_array('edit', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=edit instanceId=$instance->id}">
{icon name=edit _menu_text='y' _menu_icon='y' alt="{tr}Edit{/tr}"}
</a>
{/if}
{if in_array('check', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=check instanceId=$instance->id}">
{icon name=times _menu_text='y' _menu_icon='y' alt="{tr}Check{/tr}"}
{if in_array('fixpermissions', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=fix instanceId=$instance->id modal=1}">
{icon name=wrench _menu_text='y' _menu_icon='y' alt="{tr}Fix{/tr}"}
</a>
{/if}
{if in_array('watch', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=watch instanceId=$instance->id}">
{icon name=pen _menu_text='y' _menu_icon='y' alt="{tr}Watch{/tr}"}
{if in_array('maintenance', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=maintenance mode=off instanceId=$instance->id}">
{icon name=hammer _menu_text='y' _menu_icon='y' alt="{tr}Maintenance Off{/tr}"}
</a>
{/if}
{if in_array('profile_apply', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=apply instanceId=$instance->id}">
{icon name=user _menu_text='y' _menu_icon='y' alt="{tr}Apply profile{/tr}"}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=maintenance mode=on instanceId=$instance->id}">
{icon name=hammer _menu_text='y' _menu_icon='y' alt="{tr}Maintenance On{/tr}"}
</a>
{/if}
{if in_array('patch_list', $field.available_actions)}
......@@ -82,12 +82,12 @@
{icon name=tools _menu_text='y' _menu_icon='y' alt="{tr}Patches{/tr}"}
</a>
{/if}
{if in_array('maintenance', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=maintenance mode=on instanceId=$instance->id}">
{icon name=hammer _menu_text='y' _menu_icon='y' alt="{tr}Maintenance On{/tr}"}
{if in_array('update', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=update instanceId=$instance->id}">
{icon name=import _menu_text='y' _menu_icon='y' alt="{tr}Update{/tr}"}
</a>
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=maintenance mode=off instanceId=$instance->id}">
{icon name=hammer _menu_text='y' _menu_icon='y' alt="{tr}Maintenance Off{/tr}"}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=update instanceId=$instance->id mode=bg}">
{icon name=import _menu_text='y' _menu_icon='y' alt="{tr}Update (background){/tr}"}
</a>
{/if}
{if in_array('verify', $field.available_actions)}
......@@ -95,6 +95,11 @@
{icon name=check _menu_text='y' _menu_icon='y' alt="{tr}Verify{/tr}"}
</a>
{/if}
{if in_array('watch', $field.available_actions)}
<a class="dropdown-item" href="{bootstrap_modal controller=manager action=watch instanceId=$instance->id}">
{icon name=eye _menu_text='y' _menu_icon='y' alt="{tr}Watch{/tr}"}
</a>
{/if}
</div>
</div>
</div>
......
......@@ -47,12 +47,19 @@
<td>{if $instance->app != null }{tr}False{/tr}{else}{tr}True{/tr}{/if}</td>
<td class="action">
{actions}{strip}
{if in_array('update', $available_actions)}
<action>
<a href="{bootstrap_modal controller=manager action=update instanceId=$instance->id}" onclick="$('[data-bs-toggle=popover]').popover('hide');">
{icon name=import _menu_text='y' _menu_icon='y' alt="{tr}Update{/tr}"}
</a>
</action>
{if in_array('access', $available_actions)}
<action>
<a href="{bootstrap_modal controller=manager action=access instanceId=$instance->id}" onclick="$('[data-toggle=popover]').popover('hide');">
{icon name=tags _menu_text='y' _menu_icon='y' alt="{tr}Access{/tr}"}
</a>
</action>
{/if}
{if in_array('profile_apply', $available_actions)}
<action>
<a href="{bootstrap_modal controller=manager action=apply instanceId=$instance->id}" onclick="$('[data-toggle=popover]').popover('hide');">
{icon name=user _menu_text='y' _menu_icon='y' alt="{tr}Apply profile{/tr}"}
</a>
</action>
{/if}
{if in_array('backup', $available_actions)}
<action>
......@@ -61,31 +68,31 @@
</a>
</action>
{/if}
{if in_array('fixpermissions', $available_actions)}
{if in_array('check', $available_actions)}
<action>
<a href="{bootstrap_modal controller=manager action=fix instanceId=$instance->id modal=1}" onclick="$('[data-bs-toggle=popover]').popover('hide');">
{icon name=wrench _menu_text='y' _menu_icon='y' alt="{tr}Fix{/tr}"}
<a href="{service controller=manager action=check instanceId=$instance->id}">
{icon name=check _menu_text='y' _menu_icon='y' alt="{tr}Check{/tr}"}
</a>
</action>
{/if}
{if in_array('edit', $available_actions)}
{if in_array('clone', $available_actions)}
<action>
<a href="{bootstrap_modal controller=manager action=edit instanceId=$instance->id}" onclick="$('[data-bs-toggle=popover]').popover('hide');">
{icon name=edit _menu_text='y' _menu_icon='y' alt="{tr}Edit{/tr}"}
<a href="{service controller=manager action=clone instanceId=$instance->id}">
{icon name=copy _menu_text='y' _menu_icon='y' alt="{tr}Clone{/tr}"}
</a>
</action>
{/if}
{if in_array('delete', $available_actions)}
{if in_array('console', $available_actions)}
<action>
<a href="{bootstrap_modal controller=manager action=delete instanceId=$instance->id}" onclick="$('[data-bs-toggle=popover]').popover('hide');">
{icon name=times _menu_text='y' _menu_icon='y' alt="{tr}Delete{/tr}"}
<a href="{bootstrap_modal controller=manager action=console instanceId=$instance->id}" onclick="$('[data-bs-toggle=popover]').popover('hide');">
{icon name=pen _menu_text='y' _menu_icon='y' alt="{tr}Console Command{/tr}"}
</a>
</action>
{/if}
{if in_array('console', $available_actions)}
{if in_array('delete', $available_actions)}
<action>
<a href="{bootstrap_modal controller=manager action=console instanceId=$instance->id}" onclick="$('[data-bs-toggle=popover]').popover('hide');">
{icon name=pen _menu_text='y' _menu_icon='y' alt="{tr}Console Command{/tr}"}
<a href="{bootstrap_modal controller=manager action=delete instanceId=$instance->id}" onclick="$('[data-bs-toggle=popover]').popover('hide');">
{icon name=times _menu_text='y' _menu_icon='y' alt="{tr}Delete{/tr}"}
</a>
</action>
{/if}
......@@ -96,60 +103,60 @@
</a>
</action>
{/if}
{if in_array('clone', $available_actions)}
{if in_array('edit', $available_actions)}
<action>
<a href="{service controller=manager action=clone instanceId=$instance->id}">
{icon name=copy _menu_text='y' _menu_icon='y' alt="{tr}Clone{/tr}"}
<a href="{bootstrap_modal controller=manager action=edit instanceId=$instance->id}" onclick="$('[data-bs-toggle=popover]').popover('hide');">
{icon name=edit _menu_text='y' _menu_icon='y' alt="{tr}Edit{/tr}"}
</a>
</action>
{/if}
{if in_array('check', $available_actions)}
{if in_array('fixpermissions', $available_actions)}
<action>
<a href="{service controller=manager action=check instanceId=$instance->id}">
{icon name=check _menu_text='y' _menu_icon='y' alt="{tr}Check{/tr}"}
<a href="{bootstrap_modal controller=manager action=fix instanceId=$instance->id modal=1}" onclick="$('[data-bs-toggle=popover]').popover('hide');">
{icon name=wrench _menu_text='y' _menu_icon='y' alt="{tr}Fix{/tr}"}
</a>
</action>
{/if}
{if in_array('watch', $available_actions)}
{if in_array('maintenance', $available_actions)}
<action>
<a href="{service controller=manager action=watch instanceId=$instance->id}">
{icon name=eye _menu_text='y' _menu_icon='y' alt="{tr}Watch{/tr}"}
<a href="{service controller=manager action=maintenance mode=off instanceId=$instance->id}">
{icon name=hammer _menu_text='y' _menu_icon='y' alt="{tr}Maintenance Off{/tr}"}
</a>
</action>
{/if}
{if in_array('profile_apply', $available_actions)}
<action>
<a href="{bootstrap_modal controller=manager action=apply instanceId=$instance->id}" onclick="$('[data-toggle=popover]').popover('hide');">
{icon name=user _menu_text='y' _menu_icon='y' alt="{tr}Apply profile{/tr}"}
</a>
</action>
{/if}
{if in_array('patch_list', $available_actions)}
<action>
<a href="{bootstrap_modal controller=manager_patch action=index instanceId=$instance->id}" onclick="$('[data-toggle=popover]').popover('hide');">
{icon name=tools _menu_text='y' _menu_icon='y' alt="{tr}Patches{/tr}"}
</a>
</action>
{/if}
{if in_array('maintenance', $available_actions)}
<action>
<a href="{service controller=manager action=maintenance mode=on instanceId=$instance->id}">
{icon name=hammer _menu_text='y' _menu_icon='y' alt="{tr}Maintenance On{/tr}"}
</a>
</action>
{/if}
{if in_array('patch_list', $available_actions)}
<action>
<a href="{service controller=manager action=maintenance mode=off instanceId=$instance->id}">
{icon name=hammer _menu_text='y' _menu_icon='y' alt="{tr}Maintenance Off{/tr}"}
<a href="{bootstrap_modal controller=manager_patch action=index instanceId=$instance->id}" onclick="$('[data-toggle=popover]').popover('hide');">
{icon name=tools _menu_text='y' _menu_icon='y' alt="{tr}Patches{/tr}"}
</a>
</action>
{/if}
{if in_array('verify', $available_actions)}
{/if}
{if in_array('update', $available_actions)}
<action>
<a href="{bootstrap_modal controller=manager action=update instanceId=$instance->id}" onclick="$('[data-bs-toggle=popover]').popover('hide');">
{icon name=import _menu_text='y' _menu_icon='y' alt="{tr}Update{/tr}"}
</a>
</action>
{/if}
{if in_array('verify', $available_actions)}
<action>
<a href="{service controller=manager action=verify instanceId=$instance->id}">
{icon name=check _menu_text='y' _menu_icon='y' alt="{tr}Verify{/tr}"}
</a>
</action>
{/if}
{/if}
{if in_array('watch', $available_actions)}
<action>
<a href="{service controller=manager action=watch instanceId=$instance->id}">
{icon name=eye _menu_text='y' _menu_icon='y' alt="{tr}Watch{/tr}"}
</a>
</action>
{/if}
{/strip}{/actions}
</td>
</tr>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment