Stable
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
<div class="plugin-urbackup-asset-tab">
|
||||
{% if not linked %}
|
||||
<div class="alert alert-info">
|
||||
{{ __('No UrBackup server linked.', 'urbackup') }}
|
||||
</div>
|
||||
<table class="tab_cadre_fixe">
|
||||
<tr>
|
||||
<th colspan="2">{{ __('UrBackup server selection', 'urbackup') }}</th>
|
||||
</tr>
|
||||
<tr class="tab_bg_1">
|
||||
<td>{{ __('Asset location ID', 'urbackup') }}</td>
|
||||
<td>{{ asset_location_id }}</td>
|
||||
</tr>
|
||||
<tr class="tab_bg_1">
|
||||
<td>{{ __('Root location ID', 'urbackup') }}</td>
|
||||
<td>{{ root_location_id }}</td>
|
||||
</tr>
|
||||
{% if is_sub_location %}
|
||||
<tr class="tab_bg_1">
|
||||
<td colspan="2"><em>
|
||||
{{ __('The asset is in a sub-location. The plugin will use the server assigned to the root location.', 'urbackup') }}
|
||||
</em></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if servers|length == 0 %}
|
||||
<tr class="tab_bg_1">
|
||||
<td colspan="2">
|
||||
<div class="alert alert-warning">
|
||||
{{ __('No UrBackup server available for the root location of this asset.', 'urbackup') }}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% elseif can_connect %}
|
||||
<tr class="tab_bg_1">
|
||||
<td>{{ __('Available servers for root location', 'urbackup') }}</td>
|
||||
<td>
|
||||
<form method="post" action="{{ path('urbackup_asset_action') }}">
|
||||
<input type="hidden" name="_glpi_csrf_token" value="{{ csrf_token() }}">
|
||||
<input type="hidden" name="itemtype" value="{{ itemtype }}">
|
||||
<input type="hidden" name="items_id" value="{{ items_id }}">
|
||||
<select name="plugin_urbackup_servers_id">
|
||||
{% for id, name in servers %}
|
||||
<option value="{{ id }}">{{ name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<button type="submit" name="connect" class="btn btn-primary">{{ __('Connect', 'urbackup') }}</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr class="tab_bg_1">
|
||||
<td colspan="2">
|
||||
{{ __('A server is available, but you do not have permission to link this asset.', 'urbackup') }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
{% else %}
|
||||
<table class="tab_cadre_fixe">
|
||||
<tr>
|
||||
<th colspan="4">{{ __('UrBackup status', 'urbackup') }}</th>
|
||||
</tr>
|
||||
<tr class="tab_bg_1">
|
||||
<td>{{ __('Linked server', 'urbackup') }}</td>
|
||||
<td>{{ server_link }}</td>
|
||||
<td>{{ __('IP address', 'urbackup') }}</td>
|
||||
<td>{{ server_ip }}</td>
|
||||
</tr>
|
||||
<tr class="tab_bg_1">
|
||||
<td>{{ __('UrBackup server version', 'urbackup') }}</td>
|
||||
<td>{{ server_version }}</td>
|
||||
<td>{{ __('Client name', 'urbackup') }}</td>
|
||||
<td>{{ client_name }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -0,0 +1,39 @@
|
||||
<form method="post" action="{{ path('urbackup_config') }}">
|
||||
<div class="center">
|
||||
<table class="tab_cadre_fixe">
|
||||
<tr>
|
||||
<th colspan="3">{{ __('UrBackup configuration', 'urbackup') }}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('Asset type', 'urbackup') }}</th>
|
||||
<th>{{ __('Enabled', 'urbackup') }}</th>
|
||||
<th>{{ __('Default', 'urbackup') }}</th>
|
||||
</tr>
|
||||
{% for itemtype, label in configurable_types %}
|
||||
<tr class="tab_bg_1">
|
||||
<td>{{ label }}</td>
|
||||
{% if itemtype == 'Computer' %}
|
||||
<td>{{ __('Always enabled', 'urbackup') }}</td>
|
||||
{% else %}
|
||||
<td>
|
||||
<input type="checkbox" name="assettypes[{{ itemtype }}]" value="1"{% if enabled_types[itemtype] %} checked{% endif %}>
|
||||
</td>
|
||||
{% endif %}
|
||||
<td>
|
||||
{% if itemtype == 'Computer' %}
|
||||
{{ __('Yes', 'urbackup') }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr>
|
||||
<td colspan="3" class="center">
|
||||
<button type="submit" name="update" class="btn btn-primary">
|
||||
{{ __('Save', 'urbackup') }}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<input type="hidden" name="_glpi_csrf_token" value="{{ csrf_token() }}">
|
||||
</form>
|
||||
@@ -0,0 +1,34 @@
|
||||
{#
|
||||
# UrBackup plugin for GLPI
|
||||
# -------------------------------------------------------------------------
|
||||
# LICENSE
|
||||
#
|
||||
# This file is part of UrBackup.
|
||||
#
|
||||
# UrBackup is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# UrBackup 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 UrBackup. If not, see <http://www.gnu.org/licenses/>.
|
||||
# -------------------------------------------------------------------------
|
||||
#}
|
||||
|
||||
<div class="spaced">
|
||||
<form method="post" action="{{ 'Profile'|itemtype_form_path }}">
|
||||
{% do profile.displayRightsChoiceMatrix(rights, {'title': title}) %}
|
||||
|
||||
<div class="center">
|
||||
<input type="hidden" name="id" value="{{ id }}">
|
||||
{{ call('Html::submit', [_x('button', 'Save'), {'name': 'update'}])|raw }}
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="_glpi_csrf_token" value="{{ csrf_token() }}">
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,118 @@
|
||||
{% extends 'layout.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="center">
|
||||
<form method="post" action="{{ path('urbackup_server_save') }}">
|
||||
<table class="tab_cadre_fixe">
|
||||
<tr>
|
||||
<th colspan="4">{{ __('UrBackup server', 'urbackup') }}</th>
|
||||
</tr>
|
||||
<tr class="tab_bg_1">
|
||||
<td>{{ __('Name') }}</td>
|
||||
<td>
|
||||
<input type="text" name="name" value="{{ server.name ?? '' }}" size="40">
|
||||
</td>
|
||||
<td>{{ __('Active') }}</td>
|
||||
<td>
|
||||
<select name="is_active">
|
||||
<option value="1"{% if server.is_active ?? true %} selected{% endif %}>{{ __('Yes') }}</option>
|
||||
<option value="0"{% if not (server.is_active ?? true) %} selected{% endif %}>{{ __('No') }}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tab_bg_1">
|
||||
<td>{{ __('Entity') }}</td>
|
||||
<td>
|
||||
{{ render_entity_dropdown('entities_id', server.entities_id ?? 0) }}
|
||||
</td>
|
||||
<td>{{ __('Recursive') }}</td>
|
||||
<td>
|
||||
<select name="is_recursive">
|
||||
<option value="1"{% if server.is_recursive ?? false %} selected{% endif %}>{{ __('Yes') }}</option>
|
||||
<option value="0"{% if not (server.is_recursive ?? false) %} selected{% endif %}>{{ __('No') }}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tab_bg_1">
|
||||
<td>{{ __('Location') }}</td>
|
||||
<td>
|
||||
{{ render_location_dropdown('locations_id', server.locations_id ?? 0) }}
|
||||
<br><small>{{ __('Associate the server with the main/root location. Assets in sub-locations will use this root location server.', 'urbackup') }}</small>
|
||||
</td>
|
||||
<td>{{ __('Protocol', 'urbackup') }}</td>
|
||||
<td>
|
||||
<select name="protocol">
|
||||
<option value="http"{% if server.protocol == 'http' %} selected{% endif %}>HTTP</option>
|
||||
<option value="https"{% if server.protocol == 'https' %} selected{% endif %}>HTTPS</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tab_bg_1">
|
||||
<td>{{ __('IP address', 'urbackup') }}</td>
|
||||
<td>
|
||||
<input type="text" name="ip_address" value="{{ server.ip_address ?? '' }}" size="40">
|
||||
</td>
|
||||
<td>{{ __('Network port', 'urbackup') }}</td>
|
||||
<td>
|
||||
<input type="number" name="port" value="{{ server.port ?? 55414 }}" min="1" max="65535">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tab_bg_1">
|
||||
<td>{{ __('UrBackup server version', 'urbackup') }}</td>
|
||||
<td>
|
||||
<input type="text" name="server_version" value="{{ server.server_version ?? '' }}" size="30">
|
||||
</td>
|
||||
<td>{{ __('Ignore SSL verification', 'urbackup') }}</td>
|
||||
<td>
|
||||
<select name="ignore_ssl">
|
||||
<option value="1"{% if server.ignore_ssl ?? false %} selected{% endif %}>{{ __('Yes') }}</option>
|
||||
<option value="0"{% if not (server.ignore_ssl ?? false) %} selected{% endif %}>{{ __('No') }}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tab_bg_1">
|
||||
<td>{{ __('API username', 'urbackup') }}</td>
|
||||
<td>
|
||||
<input type="text" name="api_username" value="{{ server.api_username ?? '' }}" size="40" autocomplete="off">
|
||||
</td>
|
||||
<td>{{ __('API password', 'urbackup') }}</td>
|
||||
<td>
|
||||
<input type="password" name="api_password" value="{{ server.api_password ?? '' }}" autocomplete="new-password">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tab_bg_1">
|
||||
<td>{{ __('Comments') }}</td>
|
||||
<td colspan="3">
|
||||
<textarea name="comment" rows="5" cols="100">{{ server.comment ?? '' }}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
{% if server.id > 0 %}
|
||||
<tr class="tab_bg_1">
|
||||
<td>{{ __('UrBackup web interface', 'urbackup') }}</td>
|
||||
<td colspan="3">
|
||||
{% if server.url %}
|
||||
<a href="{{ server.url }}" target="_blank" rel="noopener" class="btn btn-secondary">
|
||||
{{ __('Open UrBackup interface', 'urbackup') }}
|
||||
</a>
|
||||
{% else %}
|
||||
{{ __('No URL available', 'urbackup') }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tab_bg_1">
|
||||
<td>{{ __('API test', 'urbackup') }}</td>
|
||||
<td colspan="3">
|
||||
<button type="button" class="btn btn-primary plugin-urbackup-test-api" data-server-id="{{ server.id }}">
|
||||
{{ __('Test API connection', 'urbackup') }}
|
||||
</button>
|
||||
<span id="plugin-urbackup-api-test-result"></span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
<input type="hidden" name="id" value="{{ server.id ?? 0 }}">
|
||||
<input type="hidden" name="_glpi_csrf_token" value="{{ csrf_token() }}">
|
||||
<button type="submit" name="save" class="btn btn-primary">{{ __('Save') }}</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,51 @@
|
||||
{% extends 'layout.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="center">
|
||||
<table class="tab_cadre_fixe">
|
||||
<tr>
|
||||
<th colspan="6">{{ __('UrBackup servers', 'urbackup') }}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('Name') }}</th>
|
||||
<th>{{ __('IP address', 'urbackup') }}</th>
|
||||
<th>{{ __('Port') }}</th>
|
||||
<th>{{ __('Version') }}</th>
|
||||
<th>{{ __('Status') }}</th>
|
||||
<th>{{ __('Actions') }}</th>
|
||||
</tr>
|
||||
{% for server in servers %}
|
||||
<tr class="tab_bg_1">
|
||||
<td>{{ server.name }}</td>
|
||||
<td>{{ server.ip_address }}</td>
|
||||
<td>{{ server.port }}</td>
|
||||
<td>{{ server.server_version }}</td>
|
||||
<td>
|
||||
{% if server.last_api_status %}
|
||||
<span class="badge bg-success">{{ __('OK', 'urbackup') }}</span>
|
||||
{% else %}
|
||||
<span class="badge bg-danger">{{ __('Failed', 'urbackup') }}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ path('urbackup_server_show', {'id': server.id}) }}" class="btn btn-sm btn-primary">
|
||||
{{ __('View') }}
|
||||
</a>
|
||||
<button class="btn btn-sm btn-secondary plugin-urbackup-test-api" data-server-id="{{ server.id }}">
|
||||
{{ __('Test API', 'urbackup') }}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr class="tab_bg_1">
|
||||
<td colspan="6" class="center">{{ __('No records found', 'urbackup') }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% if can_create %}
|
||||
<a href="{{ path('urbackup_server_show', {'id': 0}) }}" class="btn btn-success">
|
||||
{{ __('Add') }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user