{% if currentUser.featureEnabled('folder.view') %}
{{ forms.hidden('folderId', dataSet.folderId) }}
{% endif %}
{% set title %}{% trans "Name" %}{% endset %}
{% set helpText %}{% trans "A name for this DataSet" %}{% endset %}
{{ forms.input("dataSet", title, dataSet.dataSet, helpText, "", "required") }}
{% set title %}{% trans "Description" %}{% endset %}
{% set helpText %}{% trans "An optional description" %}{% endset %}
{{ forms.input("description", title, dataSet.description, helpText) }}
{% set title %}{% trans "Code" %}{% endset %}
{% set helpText %}{% trans "A code which can be used to lookup this DataSet - usually for an API application" %}{% endset %}
{{ forms.input("code", title, dataSet.code, helpText) }}
{% set title %}{% trans "Remote?" %}{% endset %}
{% set helpText %}{% trans "Is this DataSet connected to a remote data source?" %}{% endset %}
{{ forms.checkbox("isRemote", title, dataSet.isRemote, helpText) }}
{% set title %}{% trans "Method" %}{% endset %}
{% set helpText %}{% trans "What type of request needs to be made to get the remote data?" %}{% endset %}
{% set request_get %}{% trans "GET" %}{% endset %}
{% set request_post %}{% trans "POST" %}{% endset %}
{% set options = [
{ typeid: "GET", type: request_get },
{ typeid: "POST", type: request_post }
] %}
{{ forms.dropdown("method", "single", title, dataSet.method, options, "typeid", "type", helpText) }}
{% set title %}{% trans "URI" %}{% endset %}
{% set helpText %}{% trans "URL to the Remote DataSet for GET and POST." %}{% endset %}
{{ forms.input("uri", title, dataSet.uri, helpText, "", "required") }}
{% set title %}{% trans "Authentication" %}{% endset %}
{% set helpText %}{% trans "Select the authentication requirements for the remote data source. These will be added to the request." %}{% endset %}
{% set auth_none %}{% trans "None" %}{% endset %}
{% set auth_basic %}{% trans "Basic" %}{% endset %}
{% set auth_digest %}{% trans "Digest" %}{% endset %}
{% set auth_ntlm %}{% trans "NTLM" %}{% endset %}
{% set auth_bearer %}{% trans "Bearer" %}{% endset %}
{% set options = [
{ typeid: "none", type: auth_none },
{ typeid: "basic", type: auth_basic },
{ typeid: "digest", type: auth_digest },
{ typeid: "ntlm", type: auth_ntlm },
{ typeid: "bearer", type: auth_bearer }
] %}
{{ forms.dropdown("authentication", "single", title, dataSet.authentication, options, "typeid", "type", helpText) }}
{% set title %}{% trans "Username" %}{% endset %}
{% set helpText %}{% trans "Enter the authentication Username" %}{% endset %}
{{ forms.input("username", title, dataSet.username, helpText, "auth-field-username", "") }}
{% set title %}{% trans "Password" %}{% endset %}
{% set helpText %}{% trans "Corresponding Password" %}{% endset %}
{{ forms.input("password", title, dataSet.password, helpText, "auth-field-password", "") }}
{% set title %}{% trans "Custom Headers" %}{% endset %}
{% set helpText %}{% trans "Comma separated string of custom HTTP headers in headerName:headerValue format" %}{% endset %}
{{ forms.input("customHeaders", title, dataSet.customHeaders, helpText) }}
{% set title %}{% trans "User Agent" %}{% endset %}
{% set helpText %}{% trans "Optionally set specific User Agent for this request, provide only the value, relevant header will be added automatically" %}{% endset %}
{{ forms.input("userAgent", title, dataSet.userAgent, helpText) }}
{% set title %}{% trans "Source" %}{% endset %}
{% set helpText %}{% trans "Select source type of the provided remote Dataset URL" %}{% endset %}
{% set json %}{% trans "JSON" %}{% endset %}
{% set csv %}{% trans "CSV" %}{% endset %}
{% set options = [
{ sourceId: 1, source: json },
{ sourceId: 2, source: csv },
] %}
{{ forms.dropdown("sourceId", "single", title, dataSet.sourceId, options, "sourceId", "source", helpText) }}
{% set title %}{% trans "Data root" %}{% endset %}
{% set helpText %}{% trans "Please enter the element in your remote data which we should use as the starting point when we match the remote Columns. This should be an array or an object. You can use the test button below to see the structure that is returned." %}{% endset %}
{{ forms.input("dataRoot", title, dataSet.dataRoot, helpText, "json-source-field", "") }}
{% set title %}{% trans "CSV separator" %}{% endset %}
{% set helpText %}{% trans "What separator should be used for CSV source?" %}{% endset %}
{% set comma %}{% trans "Comma" %} (,){% endset %}
{% set semicolon %}{% trans "Semicolon" %} (;){% endset %}
{% set space %}{% trans "Space" %} ( ){% endset %}
{% set tab %}{% trans "Tab" %} (\t){% endset %}
{% set pipe %}{% trans "Pipe" %} (|){% endset %}
{% set options = [
{ separatorId: ',', separator: comma },
{ separatorId: ';', separator: semicolon },
{ separatorId: ' ', separator: space },
{ separatorId: '\t', separator: tab },
{ separatorId: '|', separator: pipe },
] %}
{{ forms.dropdown("csvSeparator", "single", title, dataSet.csvSeparator, options, "separatorId", "separator", helpText, "csv-source-field") }}
{% set title %}{% trans "Ignore first row?" %}{% endset %}
{% set helpText %}{% trans "For CSV source, should the first row be ignored?" %}{% endset %}
{{ forms.checkbox("ignoreFirstRow", title, dataSet.ignoreFirstRow, helpText, 'csv-source-field') }}
{% set title %}{% trans "Aggregation" %}{% endset %}
{% set helpText %}{% trans "Aggregate received data by the given method" %}{% endset %}
{% set summ_none %}{% trans "None" %}{% endset %}
{% set summ_sum %}{% trans "Summarize" %}{% endset %}
{% set summ_count %}{% trans "Count" %}{% endset %}
{% set options = [
{ typeid: "none", type: summ_none },
{ typeid: "sum", type: summ_sum },
{ typeid: "count", type: summ_count }
] %}
{{ forms.dropdown("summarize", "single", title, dataSet.summarize, options, "typeid", "type", helpText, "json-source-field") }}
{% set title %}{% trans "Refresh" %}{% endset %}
{% set helpText %}{% trans "How often should this remote data be fetched and imported?" %}{% endset %}
{% set refresh_everytime %}{% trans "Constantly" %}{% endset %}
{% set refresh_hour %}{% trans "Hourly" %}{% endset %}
{% set refresh_day %}{% trans "Daily" %}{% endset %}
{% set refresh_week %}{% trans "Weekly" %}{% endset %}
{% set refresh_two_week %}{% trans "Every two Weeks" %}{% endset %}
{% set refresh_month %}{% trans "Monthly" %}{% endset %}
{% set refresh_quater %}{% trans "Quaterly" %}{% endset %}
{% set refresh_year %}{% trans "Yearly" %}{% endset %}
{% set options = [
{ typeid: "0", type: refresh_everytime },
{ typeid: "3600", type: refresh_hour },
{ typeid: "86400", type: refresh_day },
{ typeid: "604800", type: refresh_week },
{ typeid: "1209600", type: refresh_two_week },
{ typeid: "2419200", type: refresh_month },
{ typeid: "7257600", type: refresh_quater },
{ typeid: "29030400", type: refresh_year }
] %}
{{ forms.dropdown("refreshRate", "single", title, dataSet.refreshRate, options, "typeid", "type", helpText) }}
{% set title %}{% trans "Truncate DataSet" %}{% endset %}
{% set helpText %}{% trans "Select when you would like the Data to be truncated out of this DataSet. The criteria is assessed when synchronisation occurs and is truncated before adding new data." %}{% endset %}
{% set truncate_never %}{% trans "Never" %}{% endset %}
{% set truncate_everytime %}{% trans "Always" %}{% endset %}
{% set truncate_hour %}{% trans "Hourly" %}{% endset %}
{% set truncate_day %}{% trans "Daily" %}{% endset %}
{% set truncate_week %}{% trans "Weekly" %}{% endset %}
{% set truncate_two_week %}{% trans "Every two Weeks" %}{% endset %}
{% set truncate_month %}{% trans "Monthly" %}{% endset %}
{% set truncate_quater %}{% trans "Quaterly" %}{% endset %}
{% set truncate_year %}{% trans "Yearly" %}{% endset %}
{% set truncate_two_year %}{% trans "Every second Year" %}{% endset %}
{% set options = [
{ typeid: "0", type: truncate_never },
{ typeid: "1", type: truncate_everytime },
{ typeid: "3600", type: truncate_hour },
{ typeid: "86400", type: truncate_day },
{ typeid: "604800", type: truncate_week },
{ typeid: "1209600", type: truncate_two_week },
{ typeid: "2419200", type: truncate_month },
{ typeid: "7257600", type: truncate_quater },
{ typeid: "29030400", type: truncate_year },
{ typeid: "58060800", type: truncate_two_year }
] %}
{{ forms.dropdown("clearRate", "single", title, dataSet.clearRate, options, "typeid", "type", helpText) }}
{% set title %}{% trans "Truncate with no new data?" %}{% endset %}
{% set helpText %}{% trans "Should the DataSet data be truncated even if no new data is pulled from the source?" %}{% endset %}
{{ forms.checkbox("truncateOnEmpty", title, dataSet.truncateOnEmpty, helpText) }}
{% set title %}{% trans "Depends on DataSet" %}{% endset %}
{% set dataSets = [{dataSetId: null, dataSet: ""}]|merge(dataSets) %}
{% set helpText %}{% trans "The DataSet you select here will be processed in advance and have its values available for subsitution in the data to add to this request on the Remote tab." %}{% endset %}
{{ forms.dropdown("runsAfter", "single", title, dataSet.runsAfter, dataSets, "dataSetId", "dataSet", helpText) }}
{% set title %}{% trans "Row Limit" %}{% endset %}
{% set helpText %}{% trans "Optionally provide a row limit for this DataSet. When left empty the DataSet row limit from CMS Settings will be used." %}{% endset %}
{{ forms.number("rowLimit", title, dataSet.rowLimit, helpText) }}
{% set title %}{% trans "Limit Policy" %}{% endset %}
{% set helpText %}{% trans "What should happen when this Dataset reaches the row limit?" %}{% endset %}
{% set stop %}{% trans "Stop Syncing" %}{% endset %}
{% set fifo %}{% trans "First In First Out" %}{% endset %}
{% set truncate %}{% trans "Truncate" %}{% endset %}
{% set options = [
{ typeid: "stop", type: stop },
{ typeid: "fifo", type: fifo },
{ typeid: "truncate", type: truncate },
] %}
{{ forms.dropdown("limitPolicy", "single", title, dataSet.limitPolicy, options, "typeid", "type", helpText) }}