Skip to content

Commit

Permalink
Merge pull request #34 from gtt-project/next
Browse files Browse the repository at this point in the history
Next
  • Loading branch information
dkastl authored Jun 11, 2024
2 parents c8a9dd7 + ae20bbd commit 2bb2d7a
Show file tree
Hide file tree
Showing 5 changed files with 199 additions and 31 deletions.
8 changes: 6 additions & 2 deletions app/views/subscription_templates/_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@
var detail = event.detail;
var data = detail[0], status = detail[1], xhr = detail[2];

// Update the subscription templates list with the response data
document.getElementById('subscriptionTemplateList').innerHTML = xhr.responseText;
// Check if event.target has the class 'copy-command-link'
if (!event.target.classList.contains('copy-command-link')) {
// Update the subscription templates list with the response data
document.getElementById('subscriptionTemplateList').innerHTML = xhr.responseText;
}

showNotification(xhr.getResponseHeader('X-Redmine-Message'));
});

Expand Down
5 changes: 4 additions & 1 deletion app/views/subscription_templates/copy.js.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// Build the cURL command with line breaks and formatted JSON
var jsonPayload = JSON.parse('<%= @json_payload.html_safe %>');
var prettifiedJson = JSON.stringify(jsonPayload, null, 2);

var command = "curl -i -X POST '<%= @broker_url %>' \\\n" +
"-H 'Content-Type: application/json' \\\n" +
<% if @subscription_template&.fiware_service&.present? %>
Expand All @@ -7,7 +10,7 @@ var command = "curl -i -X POST '<%= @broker_url %>' \\\n" +
<% if @subscription_template&.fiware_servicepath&.present? %>
"-H 'Fiware-ServicePath: <%= @subscription_template.fiware_servicepath %>' \\\n" +
<% end %>
"--data-binary '" + '<%= @json_payload.html_safe %>' + "'";
"--data-binary '" + prettifiedJson + "'";

var authToken = document.getElementById('subscription_auth_token').value;
if (authToken) {
Expand Down
130 changes: 130 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,132 @@
de:
project_module_gtt_fiware: GTT FIWARE
field_subscription_template_name: 'Name'
gtt_fiware:
tracker_not_found: 'Status nicht gefunden'
version_not_found: 'Version nicht gefunden'
relation_not_found: 'Verknüpfung nicht gefunden'
error_plugin_not_enabled: 'GTT FIWARE Plugin ist für dieses Projekt nicht aktiviert'
category_not_found: 'Kategorie nicht gefunden'
detail_not_found: 'Detailangabe nicht gefunden'
priority_not_found: 'Priorität nicht gefunden'
journal_not_found: 'Aufzeichnung nicht gefunden'
user_not_found: 'Benutzer nicht gefunden'
issue_not_found: 'Ticket nicht gefunden'
issue_deletion_error: 'Beim Versuch, das Ticket zu löschen, ist ein Fehler aufgetreten.'
attachement_not_found: 'Anlage nicht gefunden'
project_not_found: 'Projekt nicht gefunden'
status_not_found: 'Tracker nicht gefunden'
model:
subscription_template:
valid_geometry: '%{value} ist keine gültige Geometrie'
valid_status: '%{value} ist kein gültiger Status'
valid_standard: '%{value} ist kein gültiger Standard'
attrs_must_be_array_of_strings: 'Attribute müssen ein Array aus Strings sein'
name_uniqueness: 'Eine Subscription-Vorlage mit diesem Namen existiert bereits.'
geo_query_fields_must_be_all_or_none: 'Alle Geoabfrage-Felder (Georel, Geometrie,
Koordinaten) müssen angegeben werden oder keines von ihnen'
valid_alteration_types: '%{value} ist kein gültiger Änderungstyp'
must_be_valid_array_of_objects: 'muss ein gültiges Array von Objekten sein'
field_subscription_template_fiware_servicepath: 'FIWARE Service Path'
gtt_fiware_settings_broker: 'FIWARE Broker-Einstellungen'
subscription_published: 'Die Subscription wurde an den Broker übermittelt'
field_subscription_template_expression_geometry: 'Geometry'
link_to_copy: 'Zwischenablage'
field_subscription_template_subject: 'Betreff'
field_subscription_template_notes: 'Ticket-Notiz'
field_subscription_template_subscription_placeholder: 'Eindeutige Kennung der Subscription
(vom Broker bereitgestellt)'
command_copied: 'Befehl in die Zwischenablage kopiert'
field_subscription_auth_token_placeholder: 'Bearer Token'
project_geometry_not_defined: 'Die Projektgrenzen sind nicht definiert'
field_subscription_template_expression_query_placeholder: 'temperature > 30'
field_subscription_template_expression_query: 'Abfrage'
label_subscription_template: 'Vorlage für Subscription'
field_subscription_template_attrs_placeholder: '["temperature"]'
project_geometry_not_supported_multipolygon: 'Die Projektgrenze ist ein Multipolygon,
das für räumliche Suchanfragen nicht unterstützt wird'
subscription_unpublished_warning: 'Es gab ein Problem beim Aufheben der Subscription
im Broker'
link_to_insert_project_geometry_hint: 'Die Projektgrenze wird dabei als räumliche
Suchmaske für die Subscription verwendet'
gtt_fiware_subscription_template_variable_hint: 'Attributwerte können als <code>${Variable}</code>
eingebettet werden.'
field_subscription_template_expression_coords: 'Koordinaten'
field_subscription_template_standard: 'NGSI-Standard'
field_subscription_template_attachments_string: 'Anlagen (Array)'
field_subscription_template_fiware_servicepath_placeholder: '/environment'
field_subscription_template_expression_coords_placeholder: '40.419,-3.691;40.429,-3.691;40.429,-3.701'
field_subscription_template_fiware_service_placeholder: 'smartcity'
field_subscription_template_attachments_placeholder: '[{"filename": "image.jpg",
"url": "https://example.com/image.jpg"}]'
field_ngsi_ld_format: 'Standard NGSI-LD-Format'
field_subscription_template_threshold_create_hours_hint: 'Schwellenwert für die
Erstellung eines neuen Tickets in Stunden.'
field_fiware_broker_subscription_throttling: 'Drosslung von Subscriptions'
field_subscription_template_comment_placeholder: 'Diese Anmerkung wird nur intern
verwendet.'
field_subscription_template_geometry_placeholder: '{"type": "Feature", "geometry":
"${location}"}'
subscription_unauthorized_error: 'Nicht berechtigt, diese Aktion durchzuführen'
field_subscription_template_name_placeholder: 'Temperatur-Alarm'
field_subscription_auth_token_hint: 'Der Autorisierungs-Token, der in den Header
der Anfrage eingefügt wird. Wenn keine Autorisierung erforderlich ist, lassen
Sie das Feld leer. Der Token wird nicht in der Datenbank gespeichert. Wenn die
<code>PROXY</code>-Schaltfläche aktiviert ist (grün), wird die Anfrage über den
Server abgewickelt.'
field_subscription_template_expression_georel: 'Georel'
link_to_publish_hint: 'Die Subscription an den Broker übermitteln'
subscription_unpublished: 'Die Subscription beim Broker wurde aufgehoben'
field_subscription_template_context_placeholder: 'https://smartdatamodels.org/context.jsonld'
label_subscription_template_new: 'Neue Vorlage für Subscriptions'
field_subscription_template_status: 'Subscription Status'
field_subscription_template_alteration_types: 'Änderungsarten'
field_subscription_auth_token: 'Autorisierungs-Token'
gtt_fiware_subscription_template_geoquery: 'Geografische Abfrage'
field_subscription_template_broker_url: 'Broker URL'
field_subscription_template_expiration: 'Gültigkeitsdauer'
field_subscription_template_entities_string: 'Entities (Array)'
field_subscription_template_notify_on_metadata_change: 'Benachrichtigung bei Änderung
der Metadaten'
option_ngsi_ld_format_not_normalized: 'Nicht normalisiert'
field_subscription_template_description_placeholder: "Der Sensor in Raum ${Room}
hat eine Temperatur von ${temperature}°C festgestellt. \n* [ ] Fenster öffnen
\n* [ ] Schalten Sie die Klimaanlage ein"
field_subscription_template_threshold_create_hours: 'Schwellenwert (h)'
link_to_copy_hint: 'Befehl in die Zwischenablage kopieren'
field_subscription_template_description: 'Beschreibung'
label_gtt_fiware: 'FIWARE'
link_to_unpublish: 'Aufheben'
field_subscription_template_comment: 'Anmerkung'
subscription_published_error: 'Es gab ein Problem bei der Übertragung der Subscription
an den Broker'
gtt_fiware_subscription_template_notification: 'Ticket-Vorlage'
field_subscription_template_expression_geometry_placeholder: 'Eine Geometrie auswählen'
permission_manage_subscription_templates: 'Vorlagen für Subscriptions verwalten'
field_subscription_template_broker_url_placeholder: 'https://broker.example.com/'
field_subscription_template_context: 'NGSI-LD Context'
field_subscription_template_attrs: 'Attributes (Array)'
field_subscription_template_notification_user: 'Gesendet vom Nutzer'
option_ngsi_ld_format_normalized: 'Normalisiert'
label_subscription_template_plural: 'Vorlagen für Subscriptions'
field_subscription_template_geometry_string: 'Ticket-Geometrie (GeoJSON)'
field_subscription_template_fiware_service: 'FIWARE Service'
link_to_unpublish_hint: 'Subscription vom Broker aufheben'
field_subscription_template_subject_placeholder: 'Temperaturalarm in ${Room}'
gtt_fiware_subscription_template_general: 'Allgemein'
permission_view_gtt_fiware_ngsi: 'NGSI-LD-Kontextdateien ansehen'
field_subscription_template_entities_string_placeholder: '[{"idPattern": ".*", "type":
"Room"}]'
gtt_fiware_settings_general: 'Allgemeine Einstellungen'
field_subscription_template_expression_georel_placeholder: 'near;maxDistance:1000'
label_gtt_fiware_plural: 'FIWARE'
field_subscription_template_subscription: 'Subscription ID'
link_to_publish: 'Veröffentlichen'
link_to_insert_project_geometry: 'Projektgrenzen eintragen'
field_subscription_template_notes_placeholder: 'Schreiben Sie eine Ticket-Notiz,
anstatt ein neues Ticket zu erstellen, wenn ein Ticket innerhalb der festgelegten
Zeitspanne erstellt worden ist.'
gtt_fiware_subscription_template_subject: 'Einstellungen für Subscriptions'
field_connect_via_proxy: Verbindung über internen Proxy
button_connect_via_proxy_text: PROXY
general_action_error: Beim Ausführen dieser Aktion ist ein Fehler aufgetreten
47 changes: 32 additions & 15 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ en:
field_subscription_template_context_placeholder: "https://smartdatamodels.org/context.jsonld"
field_subscription_template_expiration: "Expiration date"
field_subscription_template_comment: "Comment"
field_subscription_template_comment_placeholder: ""
field_subscription_template_comment_placeholder: "This comment is only used internally."

gtt_fiware_subscription_template_subject: "Subscription Settings"
field_subscription_template_subscription: "Subscription ID"
field_subscription_template_subscription_placeholder: "Subscription unique identifier (provided by the broker)"
field_subscription_template_subscription_placeholder: "Subscription unique identifier
(provided by the broker)"
field_subscription_template_entities_string: "Entities (array of)"
field_subscription_template_entities_string_placeholder: "[{\"idPattern\": \".*\", \"type\": \"Room\"}]"
field_subscription_template_entities_string_placeholder: "[{\"idPattern\": \".*\"\
, \"type\": \"Room\"}]"
field_subscription_template_attrs: "Attributes (array of)"
field_subscription_template_attrs_placeholder: "[\"temperature\"]"
field_subscription_template_expression_query: "Query"
Expand All @@ -57,29 +59,41 @@ en:
field_subscription_template_notify_on_metadata_change: "Notify on metadata change"

gtt_fiware_subscription_template_notification: "Issue Template"
gtt_fiware_subscription_template_variable_hint: "Attribute readings can be embedded as <code>${variable}</code>."
gtt_fiware_subscription_template_variable_hint: "Attribute readings can be embedded
as <code>${variable}</code>."
field_subscription_template_subject: "Subject"
field_subscription_template_subject_placeholder: "Temperature Alert in ${Room}"
field_subscription_template_description: "Description"
field_subscription_template_description_placeholder: "The sensor in room ${Room} recorded a temperature of ${temperature}°C. \n* [ ] Open window \n* [ ] Turn on the air conditioning"
field_subscription_template_description_placeholder: "The sensor in room ${Room}
recorded a temperature of ${temperature}°C. \n* [ ] Open window \n* [ ] Turn on
the air conditioning"
field_subscription_template_attachments_string: "Attachments (array of)"
field_subscription_template_attachments_placeholder: "[{\"filename\": \"image.jpg\", \"url\": \"https://example.com/image.jpg\"}]"
field_subscription_template_attachments_placeholder: "[{\"filename\": \"image.jpg\"\
, \"url\": \"https://example.com/image.jpg\"}]"
field_subscription_template_notification_user: "Sent from user"
field_subscription_template_threshold_create_hours: "Threshold (h)"
field_subscription_template_threshold_create_hours_hint: "Threshold to create new issue in hours."
field_subscription_template_threshold_create_hours_hint: "Threshold to create new
issue in hours."
field_subscription_template_notes: "Issue notes"
field_subscription_template_notes_placeholder: "Post an issue note instead of creating a new issue if an issue has been created within the threshold."
field_subscription_template_notes_placeholder: "Post an issue note instead of creating
a new issue if an issue has been created within the threshold."
field_subscription_template_geometry_string: "Issue geometry (GeoJSON)"
field_subscription_template_geometry_placeholder: "{\"type\": \"Feature\", \"geometry\": \"${location}\"}"
field_subscription_template_geometry_placeholder: "{\"type\": \"Feature\", \"geometry\"\
: \"${location}\"}"

link_to_insert_project_geometry: "Insert project boundary"
link_to_insert_project_geometry_hint: "This will use the project boundary as the geospatial query for the subscription"
link_to_insert_project_geometry_hint: "This will use the project boundary as the
geospatial query for the subscription"
project_geometry_not_defined: "Project boundary is not defined"
project_geometry_not_supported_multipolygon: "Project boundary is a multipolygon, which is not supported for geospatial queries"
project_geometry_not_supported_multipolygon: "Project boundary is a multipolygon,
which is not supported for geospatial queries"

field_subscription_auth_token: "Authorization token"
field_subscription_auth_token_placeholder: "Bearer token"
field_subscription_auth_token_hint: "Authorization token to be included in the request headers. Leave empty for no authorization. The token is not stored in the database. When the <code>PROXY</code> button is enabled (green), the request will be proxied through the server."
field_subscription_auth_token_hint: "Authorization token to be included in the request
headers. Leave empty for no authorization. The token is not stored in the database.
When the <code>PROXY</code> button is enabled (green), the request will be proxied
through the server."

link_to_copy: "Clipboard"
link_to_copy_hint: "Copy command to clipboard"
Expand All @@ -88,12 +102,14 @@ en:
link_to_publish: "Publish"
link_to_publish_hint: "Publish subscription to broker"
subscription_published: "Subscription published to broker"
subscription_published_error: "There was a problem publishing the subscription from the broker"
subscription_published_error: "There was a problem publishing the subscription from
the broker"

link_to_unpublish: "Unpublish"
link_to_unpublish_hint: "Unpublish subscription to broker"
subscription_unpublished: "Subscription unpublished from broker"
subscription_unpublished_warning: "There was a problem unpublishing the subscription from the broker"
subscription_unpublished_warning: "There was a problem unpublishing the subscription
from the broker"

subscription_unauthorized_error: "Unauthorized to perform this action"
general_action_error: "There was an error performing this action"
Expand Down Expand Up @@ -121,7 +137,8 @@ en:
name_uniqueness: A subscription template with that name already exists.
attrs_must_be_array_of_strings: "Attributes must be an array of strings"
must_be_valid_array_of_objects: "must be a valid array of objects"
geo_query_fields_must_be_all_or_none: "All geo query fields (Georel, Geometry, Coordinates) must be provided or none of them"
geo_query_fields_must_be_all_or_none: "All geo query fields (Georel, Geometry,
Coordinates) must be provided or none of them"
valid_standard: "%{value} is not a valid standard"
valid_status: "%{value} is not a valid status"
valid_geometry: "%{value} is not a valid geometry"
Expand Down
Loading

0 comments on commit 2bb2d7a

Please sign in to comment.