id
int64 0
458k
| file_name
stringlengths 4
119
| file_path
stringlengths 14
227
| content
stringlengths 24
9.96M
| size
int64 24
9.96M
| language
stringclasses 1
value | extension
stringclasses 14
values | total_lines
int64 1
219k
| avg_line_length
float64 2.52
4.63M
| max_line_length
int64 5
9.91M
| alphanum_fraction
float64 0
1
| repo_name
stringlengths 7
101
| repo_stars
int64 100
139k
| repo_forks
int64 0
26.4k
| repo_open_issues
int64 0
2.27k
| repo_license
stringclasses 12
values | repo_extraction_date
stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9,800
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/cache/builtin/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Zato
from zato.admin.web.forms.cache.builtin import CreateForm, EditForm
from zato.admin.web.views import CreateEdit, Delete as _Delete, Index as _Index, invoke_service_with_json_response, \
method_allowed
from zato.common.api import CACHE
from zato.common.odb.model import CacheBuiltin
# ################################################################################################################################
class Index(_Index):
method_allowed = 'GET'
url_name = 'cache-builtin'
template = 'zato/cache/builtin/index.html'
service_name = 'zato.cache.builtin.get-list'
output_class = CacheBuiltin
paginate = True
class SimpleIO(_Index.SimpleIO):
input_required = ('cluster_id',)
output_required = ('cache_id', 'name', 'is_active', 'is_default', 'max_size', 'max_item_size', 'extend_expiry_on_get',
'extend_expiry_on_set', 'sync_method', 'persistent_storage', 'cache_type', 'current_size')
output_repeated = True
def handle(self):
return {
'create_form': CreateForm(),
'edit_form': EditForm(prefix='edit'),
'default_max_size': CACHE.DEFAULT.MAX_SIZE,
'default_max_item_size': CACHE.DEFAULT.MAX_ITEM_SIZE,
}
# ################################################################################################################################
class _CreateEdit(CreateEdit):
method_allowed = 'POST'
class SimpleIO(CreateEdit.SimpleIO):
input_required = ('cache_id', 'name', 'is_active', 'is_default', 'max_size', 'max_item_size', 'extend_expiry_on_get',
'extend_expiry_on_set', 'sync_method', 'persistent_storage', 'cache_type', 'current_size')
output_required = ('cache_id', 'name', 'id')
def success_message(self, item):
return 'Successfully {} cache `{}`'.format(self.verb, item.name)
# ################################################################################################################################
class Create(_CreateEdit):
url_name = 'cache-builtin-create'
service_name = 'zato.cache.builtin.create'
# ################################################################################################################################
class Edit(_CreateEdit):
url_name = 'cache-builtin-edit'
form_prefix = 'edit-'
service_name = 'zato.cache.builtin.edit'
# ################################################################################################################################
class Delete(_Delete):
url_name = 'cache-builtin-delete'
error_message = 'Cache could not be deleted'
service_name = 'zato.cache.builtin.delete'
# ################################################################################################################################
@method_allowed('POST')
def clear(req):
return invoke_service_with_json_response(
req, 'zato.cache.builtin.clear', {'cluster_id':req.POST['cluster_id'], 'cache_id':req.POST['cache_id']},
'OK, cache cleared.', 'Cache could not be cleared, e:{e}')
# ################################################################################################################################
| 3,454
|
Python
|
.py
| 62
| 50.548387
| 130
| 0.490952
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,801
|
message.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/pubsub/message.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
from logging import getLogger
from traceback import format_exc
# Django
from django.http import HttpResponse, HttpResponseServerError
from django.template.response import TemplateResponse
# Zato
from zato.admin.web import from_utc_to_user
from zato.admin.web.forms.pubsub import MsgPublishForm
from zato.admin.web.views import method_allowed
from zato.admin.web.views.pubsub import get_message
from zato.common.api import PUBSUB
from zato.common.json_internal import dumps
from zato.common.pubsub import new_msg_id
from zato.common.util.api import asbool
# ################################################################################################################################
logger = getLogger(__name__)
# ################################################################################################################################
@method_allowed('GET')
def get(req, cluster_id, object_type, object_id, msg_id):
return get_message(req, cluster_id, object_type, object_id, msg_id)
# ################################################################################################################################
def _publish_update_action(req, cluster_id, action, msg_id=None, topic_id=None):
has_gd = asbool(req.POST['has_gd'])
expiration = req.POST.get('expiration')
exp_from_now = asbool(req.POST.get('exp_from_now'))
correl_id = req.POST.get('correl_id')
in_reply_to = req.POST.get('in_reply_to')
priority = req.POST['priority']
mime_type = req.POST['mime_type']
data = req.POST['data']
server_name = req.POST['server_name']
server_pid = req.POST['server_pid']
try:
expiration_time = None
size = None
input = {
'cluster_id': cluster_id,
'data': data,
'expiration': expiration,
'exp_from_now': exp_from_now,
'correl_id': correl_id,
'in_reply_to': in_reply_to,
'priority': priority,
'mime_type': mime_type,
'server_name': server_name,
'server_pid': server_pid,
}
if msg_id:
input['msg_id'] = msg_id
if action == 'update':
suffix = '-gd' if has_gd else '-non-gd'
action += suffix
response = req.zato.client.invoke('zato.pubsub.message.{}'.format(action), input).data.response
except Exception:
is_ok = False
message = format_exc()
else:
if not response.found:
is_ok = False
message = 'Could not find message `{}`'.format(response.msg_id)
else:
is_ok = True
message = 'Message {}'.format('updated' if action.startswith('update') else 'created')
size = response.size
if response.expiration_time:
expiration_time = """
<a
id="a_expiration_time"
href="javascript:$.fn.zato.pubsub.message.details.toggle_time('expiration_time', '{exp_time_user}', '{exp_time_utc}')">{exp_time_user}
</a>
""".format(**{
'exp_time_utc': response.expiration_time,
'exp_time_user': from_utc_to_user(response.expiration_time+'+00:00', req.zato.user_profile),
})
return HttpResponse(dumps({
'is_ok': is_ok,
'message': message,
'expiration_time': expiration_time,
'size': size
}))
# ################################################################################################################################
@method_allowed('POST')
def update_action(req, cluster_id, msg_id):
return _publish_update_action(req, cluster_id, 'update', msg_id)
# ################################################################################################################################
@method_allowed('GET')
def publish(req, cluster_id, topic_id):
topic_list = []
publisher_list = []
topic_id = int(topic_id)
initial_topic_name = None
initial_hook_service_name = None
select_changer_data = {}
initial_publisher_id = None
topic_list_response = req.zato.client.invoke('zato.pubsub.topic.get-list', {
'cluster_id': cluster_id,
'needs_details': False,
}).data
for item in topic_list_response:
# Initial data for this topic
if item.id == topic_id:
initial_topic_name = item.name
initial_hook_service_name = item.hook_service_name
# All topics -> hook service names for select changer
select_changer_data[item.name] = item.hook_service_name or ''
topic_list.append({'id':item.name, 'name':item.name}) # Topics are identified by their name, not ID
publisher_list_response = req.zato.client.invoke('zato.pubsub.endpoint.get-list', {'cluster_id':cluster_id}).data
for item in publisher_list_response:
for line in (item.topic_patterns or '').splitlines():
if line.startswith('sub='):
publisher_list.append({'id':item.id, 'name':item.name})
if item.name == PUBSUB.DEFAULT.INTERNAL_ENDPOINT_NAME:
initial_publisher_id = item.id
break
return_data = {
'cluster_id': cluster_id,
'action': 'publish',
'default_message': PUBSUB.DEFAULT.Dashboard_Message_Body,
'form': MsgPublishForm(
req,
dumps(select_changer_data),
initial_topic_name, topic_list,
initial_hook_service_name,
publisher_list,
initial={'publisher_id': initial_publisher_id}
)}
return TemplateResponse(req, 'zato/pubsub/message-publish.html', return_data)
# ################################################################################################################################
@method_allowed('POST')
def publish_action(req):
try:
msg_id = req.POST.get('msg_id') or new_msg_id()
gd = req.POST['gd']
if gd == PUBSUB.GD_CHOICE.DEFAULT_PER_TOPIC.id:
has_gd = None
else:
has_gd = asbool(gd)
service_input = {
'msg_id': msg_id,
'has_gd': has_gd,
'skip_pattern_matching': True,
'endpoint_id': req.POST['publisher_id'],
}
for name in('reply_to_sk', 'deliver_to_sk'):
value = req.POST.get(name, '')
if value:
value = value.split(',')
value = [elem.strip() for elem in value]
service_input[name] = value
for name in('cluster_id', 'topic_name', 'data'):
service_input[name] = req.POST[name]
for name in('correl_id', 'priority', 'ext_client_id', 'position_in_group', 'expiration', 'in_reply_to'):
service_input[name] = req.POST.get(name, None) or None # Always use None instead of ''
req.zato.client.invoke('zato.pubsub.publish.publish', service_input)
except Exception as e:
message = e.args[0]
is_ok = False
else:
message = 'Successfully published message `{}`'.format(msg_id)
is_ok = True
return HttpResponse(dumps({
'is_ok': is_ok,
'message': message,
}))
# ################################################################################################################################
@method_allowed('POST')
def delete(req, cluster_id, msg_id):
input_dict = {
'cluster_id': cluster_id,
'msg_id': msg_id,
}
object_type = req.POST['object_type']
if object_type == 'queue':
input_dict['sub_key'] = req.POST['sub_key']
if req.POST['has_gd']:
service_name = 'zato.pubsub.message.{}-delete-gd'.format(object_type)
else:
service_name = 'zato.pubsub.message.{}-delete-non-gd'.format(object_type)
if service_name == 'zato.pubsub.message.queue-delete-non-gd':
# This is an in-RAM message so it needs additional information
input_dict['server_name'] = req.POST['server_name']
input_dict['server_pid'] = req.POST['server_pid']
try:
req.zato.client.invoke(service_name, input_dict)
except Exception:
return HttpResponseServerError(format_exc())
else:
return HttpResponse('Deleted message `{}`'.format(msg_id))
# ################################################################################################################################
| 8,726
|
Python
|
.py
| 196
| 36.255102
| 154
| 0.533538
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,802
|
topic.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/pubsub/topic.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2022, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# stdlib
import logging
from traceback import format_exc
# Django
from django.http import HttpResponse, HttpResponseServerError
# Zato
from zato.admin.web import from_utc_to_user
from zato.admin.web.forms.pubsub.topic import CreateForm, EditForm
from zato.admin.web.views import CreateEdit, Delete as _Delete, django_url_reverse, Index as _Index, slugify
from zato.admin.web.views.pubsub import get_client_html, get_endpoint_html
from zato.common.odb.model import PubSubEndpoint, PubSubMessage, PubSubTopic
from zato.common.util.api import asbool
# ################################################################################################################################
logger = logging.getLogger(__name__)
# ################################################################################################################################
class Index(_Index):
method_allowed = 'GET'
url_name = 'pubsub-topic'
template = 'zato/pubsub/topic.html'
service_name = 'zato.pubsub.topic.get-list'
output_class = PubSubTopic
paginate = True
class SimpleIO(_Index.SimpleIO):
input_required = ('cluster_id',)
output_required = ('id', 'name', 'is_active', 'is_internal', 'has_gd', 'is_api_sub_allowed', 'max_depth_gd',
'max_depth_non_gd', 'current_depth_gd', 'current_depth_non_gd', 'depth_check_freq', 'hook_service_id',
'pub_buffer_size_gd', 'task_sync_interval', 'task_delivery_interval', 'limit_retention', 'limit_message_expiry',
'limit_sub_inactivity')
output_optional = ('last_pub_time', 'last_pub_msg_id', 'last_endpoint_id', 'last_endpoint_name', 'last_pub_has_gd',
'last_pub_server_pid', 'last_pub_server_name', 'on_no_subs_pub', 'sub_count')
output_repeated = True
def populate_initial_input_dict(self, initial_input_dict):
initial_input_dict['needs_details'] = True
def on_before_append_item(self, item):
if item.last_pub_time:
item.last_pub_time_utc = item.last_pub_time
item.last_pub_time = from_utc_to_user(item.last_pub_time+'+00:00', self.req.zato.user_profile)
return item
def handle(self):
return {
'create_form': CreateForm(self.req),
'edit_form': EditForm(self.req, prefix='edit'),
}
# ################################################################################################################################
class _CreateEdit(CreateEdit):
method_allowed = 'POST'
class SimpleIO(CreateEdit.SimpleIO):
input_required = ('name', 'is_active', 'is_internal', 'has_gd', 'is_api_sub_allowed', 'max_depth_gd',
'max_depth_non_gd', 'depth_check_freq', 'pub_buffer_size_gd', 'task_sync_interval', 'task_delivery_interval',
'on_no_subs_pub', 'limit_retention', 'limit_message_expiry', 'limit_sub_inactivity')
input_optional = ('hook_service_id', 'exp_from_now')
output_required = ('id', 'name', 'has_gd')
def post_process_return_data(self, return_data):
return_data['publishers_link'] = '<a href="{}">{}</a>'.format(
django_url_reverse('pubsub-topic-publishers',
kwargs={'cluster_id':self.req.zato.cluster_id,
'topic_id':return_data['id'], 'name_slug':slugify(return_data['name'])}),
'Publishers')
return_data['subscribers_link'] = '<a href="{}">{}</a>'.format(
django_url_reverse('pubsub-topic-subscribers',
kwargs={'cluster_id':self.req.zato.cluster_id,
'topic_id':return_data['id'], 'name_slug':slugify(return_data['name'])}),
'Subscribers')
item = self.req.zato.client.invoke('zato.pubsub.topic.get', {
'cluster_id': self.req.zato.cluster_id,
'id': return_data['id'],
}).data.response
return_data['has_gd'] = item.has_gd
if item.get('last_pub_time'):
return_data['last_pub_time'] = from_utc_to_user(item.last_pub_time+'+00:00', self.req.zato.user_profile)
else:
return_data['last_pub_time'] = None
return_data['current_depth_link'] = """
<a href="{}?cluster={}">{}</a>
/
{}
""".format(
# GD messages
django_url_reverse('pubsub-topic-messages',
kwargs={'topic_id':return_data['id'], 'name_slug':slugify(return_data['name'])}),
self.req.zato.cluster_id,
item.current_depth_gd,
# Non-GD messages -> Currently shows GD instead of non-GD
item.current_depth_gd,
)
def success_message(self, item):
return 'Pub/sub topic `{}` {} successfully '.format(item.name, self.verb)
# ################################################################################################################################
class Create(_CreateEdit):
url_name = 'pubsub-topic-create'
service_name = 'zato.pubsub.topic.create'
# ################################################################################################################################
class Edit(_CreateEdit):
url_name = 'pubsub-topic-edit'
form_prefix = 'edit-'
service_name = 'zato.pubsub.topic.edit'
# ################################################################################################################################
class Delete(_Delete):
url_name = 'pubsub-topic-delete'
error_message = 'Could not delete pub/sub topic'
service_name = 'zato.pubsub.topic.delete'
# ################################################################################################################################
def topic_clear(req, cluster_id, topic_id):
try:
request = {
'cluster_id': cluster_id,
'id': topic_id,
}
req.zato.client.invoke('zato.pubsub.topic.clear', request)
except Exception:
return HttpResponseServerError(format_exc())
else:
msg = 'Cleared topic `{}`'.format(
req.zato.client.invoke('zato.pubsub.topic.get', request).data.response.name)
return HttpResponse(msg)
# ################################################################################################################################
class TopicPublishers(_Index):
method_allowed = 'GET'
url_name = 'pubsub-topic-publishers'
template = 'zato/pubsub/topic-publishers.html'
service_name = 'zato.pubsub.topic.get-publisher-list'
output_class = PubSubEndpoint
paginate = True
class SimpleIO(_Index.SimpleIO):
input_required = ('cluster_id', 'topic_id')
output_required = ('endpoint_id', 'name', 'is_active', 'is_internal')
output_optional = ('service_id', 'security_id', 'ws_channel_id', 'last_seen', 'last_pub_time', 'last_msg_id',
'last_correl_id', 'last_in_reply_to', 'service_name', 'sec_name', 'ws_channel_name', 'pattern_matched',
'conn_status', 'ext_client_id')
output_repeated = True
def on_before_append_item(self, item):
item.last_seen = from_utc_to_user(item.last_seen+'+00:00', self.req.zato.user_profile)
item.last_pub_time = from_utc_to_user(item.last_pub_time+'+00:00', self.req.zato.user_profile)
item.client_html = get_client_html(item, item.security_id, self.req.zato.cluster_id)
return item
def handle(self):
return {
'topic_id': self.input.topic_id,
'topic_name': self.req.zato.client.invoke(
'zato.pubsub.topic.get', {
'cluster_id':self.req.zato.cluster_id,
'id':self.input.topic_id,
}).data.response.name
}
# ################################################################################################################################
class TopicSubscribers(_Index):
method_allowed = 'GET'
url_name = 'pubsub-topic-subscribers'
template = 'zato/pubsub/topic-subscribers.html'
service_name = 'zato.pubsub.topic.get-subscriber-list'
output_class = PubSubEndpoint
paginate = True
# ################################################################################################################################
class TopicMessages(_Index):
method_allowed = 'GET'
url_name = 'pubsub-topic-messages'
template = 'zato/pubsub/topic-messages.html'
service_name = None
output_class = PubSubMessage
paginate = True
class SimpleIO(_Index.SimpleIO):
input_required = ('cluster_id', 'topic_id', 'has_gd')
output_required = ('msg_id', 'pub_time', 'pub_time_utc', 'data_prefix_short', 'pub_pattern_matched')
output_optional = ('correl_id', 'in_reply_to', 'size', 'service_id', 'security_id', 'ws_channel_id',
'service_name', 'sec_name', 'ws_channel_name', 'endpoint_id', 'endpoint_name', 'server_name', 'server_pid')
output_repeated = True
def get_service_name(self, _ignored):
return 'zato.pubsub.topic.get-gd-message-list' if self.req.has_gd else 'zato.pubsub.topic.get-non-gd-message-list'
def on_before_append_item(self, item):
item.pub_time_utc = item.pub_time
item.pub_time = from_utc_to_user(item.pub_time+'+00:00', self.req.zato.user_profile)
item.endpoint_html = get_endpoint_html(item, self.req.zato.cluster_id)
return item
def set_input(self, *args, **kwargs):
self.req.has_gd = asbool(self.req.GET['has_gd'])
super(TopicMessages, self).set_input(*args, **kwargs)
def handle(self):
return {
'topic_id': self.input.topic_id,
'has_pubsub': True,
'has_gd': self.req.has_gd,
'topic_name': self.req.zato.client.invoke(
'zato.pubsub.topic.get', {
'cluster_id':self.req.zato.cluster_id,
'id':self.input.topic_id,
}).data.response.name
}
# ################################################################################################################################
| 10,251
|
Python
|
.py
| 193
| 44.948187
| 130
| 0.535539
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,803
|
endpoint.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/pubsub/endpoint.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2021, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# stdlib
import logging
from traceback import format_exc
# Bunch
from bunch import Bunch, bunchify
# Django
from django.http import HttpResponse, HttpResponseServerError
# Zato
from zato.admin.web import from_utc_to_user
from zato.admin.web.forms.pubsub.endpoint import CreateForm, EditForm
from zato.admin.web.forms.pubsub.subscription import EditForm as EditSubscriptionForm
from zato.admin.web.views import CreateEdit, Delete as _Delete, django_url_reverse, Index as _Index, method_allowed, slugify
from zato.admin.web.views.pubsub import get_client_html, get_inline_client_html
from zato.common.api import PUBSUB, ZATO_NONE
from zato.common.json_internal import dumps
from zato.common.odb.model import PubSubEndpoint, PubSubEndpointEnqueuedMessage, PubSubSubscription, PubSubTopic
from zato.common.util.api import asbool, get_sa_model_columns
# ################################################################################################################################
logger = logging.getLogger(__name__)
# ################################################################################################################################
sub_attrs = get_sa_model_columns(PubSubSubscription) + ['current_depth_gd', 'current_depth_non_gd',
'sub_id', 'topic_name', 'out_rest_http_soap_id', 'out_soap_http_soap_id']
# ################################################################################################################################
def enrich_item(cluster_id, item):
item.topic_patterns = item.topic_patterns or ''
item.topic_patterns_html = '<br/>'.join(item.topic_patterns.splitlines())
is_pub = 'pub' in item.role
is_sub = 'sub' in item.role
# Making a copy because it will be replaced with a concatenation of sec_type and security_id,
# yet we still need it for the client string.
security_id = item.security_id
if item.security_id:
item.security_id = '{}/{}'.format(item.sec_type, item.security_id)
item.client_html = get_client_html(item, security_id, cluster_id)
html_kwargs={'cluster_id':cluster_id, 'endpoint_id':item.id, 'name_slug':slugify(item.name)}
if is_pub:
endpoint_topics_path = django_url_reverse('pubsub-endpoint-topics', kwargs=html_kwargs)
item.endpoint_topics_html = '<a href="{}?cluster={}">Topics</a>'.format(
endpoint_topics_path, cluster_id)
else:
item.endpoint_topics_html = '<span class="form_hint">---</span>'
if is_sub:
endpoint_queues_path = django_url_reverse('pubsub-endpoint-queues', kwargs=html_kwargs)
item.endpoint_queues_html = '<a href="{}?cluster={}">Queues</a>'.format(
endpoint_queues_path, cluster_id)
else:
item.endpoint_queues_html = '<span class="form_hint">---</span>'
# This is also needed by the edit action so as not to construct it in JavaScript
if item.is_internal:
item.delete_html = '<span class="form_hint">Delete</span>'
else:
item.delete_html = """<a href="javascript:$.fn.zato.pubsub.endpoint.delete_('{}')">Delete</a>""".format(item.id)
return item
# ################################################################################################################################
class Index(_Index):
method_allowed = 'GET'
url_name = 'pubsub-endpoint'
template = 'zato/pubsub/endpoint.html'
service_name = 'zato.pubsub.endpoint.get-list'
output_class = PubSubEndpoint
paginate = True
class SimpleIO(_Index.SimpleIO):
input_required = ('cluster_id',)
output_required = ('id', 'name', 'endpoint_type', 'is_active', 'is_internal', 'role')
output_optional = ('topic_patterns', 'security_id', 'ws_channel_id', 'ws_channel_name',
'sec_type', 'sec_name', 'sub_key', 'service_id', 'service_name')
output_repeated = True
def on_before_append_item(self, item):
return enrich_item(self.req.zato.cluster_id, item)
def handle(self):
data_list = Bunch()
data_list.security_list = []
data_list.ws_channel_list = []
data_list.service_list = []
in_use = Bunch()
in_use.security_list = []
in_use.ws_channel_list = []
in_use.service_list = []
if self.req.zato.cluster_id:
# Security definitions
data_list.security_list = self.get_sec_def_list('basic_auth').def_items
# WebSockets channels
data_list.ws_channel_list = self.req.zato.client.invoke(
'zato.channel.web-socket.get-list', {'cluster_id': self.req.zato.cluster_id}).data
# Services
data_list.service_list = self.req.zato.client.invoke(
'zato.service.get-list', {'cluster_id': self.req.zato.cluster_id}).data
# Build a list of IDs that are already used to make fronted warn of this situation.
# This is also enforced on SQL level by services.
in_use.security_list = self.get_already_in_use(data_list.security_list, 'security_id')
in_use.ws_channel_list = self.get_already_in_use(data_list.ws_channel_list, 'ws_channel_id')
in_use.service_list = self.get_already_in_use(data_list.service_list, 'service_id')
return {
'create_form': CreateForm(self.req, data_list),
'edit_form': EditForm(self.req, data_list, prefix='edit'),
'in_use': dumps(in_use),
}
def get_already_in_use(self, data_list, id_attr):
out = []
id_list = [elem for elem in [getattr(elem, id_attr) for elem in self.items] if elem]
if id_attr == 'security_id':
for elem in data_list:
elem_id = elem[0]
if elem_id in id_list:
out.append(elem)
else:
for elem in data_list:
if elem.id in id_list:
out.append(elem)
return out
# ################################################################################################################################
class _CreateEdit(CreateEdit):
method_allowed = 'POST'
class SimpleIO(CreateEdit.SimpleIO):
input_required = ('name', 'is_internal', 'role', 'is_active', 'endpoint_type')
input_optional = ('is_internal', 'topic_patterns', 'security_id', 'service_id', 'ws_channel_id')
output_required = ('id', 'name')
def on_after_set_input(self):
if self.input.security_id and self.input.security_id != ZATO_NONE:
self.input.security_id = int(self.input.security_id.split('/')[1])
else:
self.input.security_id = None
def post_process_return_data(self, return_data):
response = self.req.zato.client.invoke('zato.pubsub.endpoint.get', {
'cluster_id': self.req.zato.cluster_id,
'id': return_data['id'],
}).data['response']
return_data.update(enrich_item(self.req.zato.cluster_id, response))
def success_message(self, item):
return 'Successfully {} pub/sub endpoint `{}`'.format(self.verb, item.name)
# ################################################################################################################################
class Create(_CreateEdit):
url_name = 'pubsub-endpoint-create'
service_name = 'zato.pubsub.endpoint.create'
# ################################################################################################################################
class Edit(_CreateEdit):
url_name = 'pubsub-endpoint-edit'
form_prefix = 'edit-'
service_name = 'zato.pubsub.endpoint.edit'
# ################################################################################################################################
class Delete(_Delete):
url_name = 'pubsub-endpoint-delete'
error_message = 'Could not delete pub/sub endpoint'
service_name = 'zato.pubsub.endpoint.delete'
# ################################################################################################################################
class _EndpointObjects(_Index):
method_allowed = 'GET'
paginate = True
class SimpleIO(_Index.SimpleIO):
input_required = ('cluster_id', 'endpoint_id')
output_repeated = True
def handle(self):
endpoint = self.req.zato.client.invoke('zato.pubsub.endpoint.get', {
'cluster_id':self.req.zato.cluster_id,
'id':self.input.endpoint_id,
}).data.response
client_html = get_inline_client_html(endpoint, endpoint.security_id, self.req.zato.cluster_id)
return {
'endpoint':endpoint,
'endpoint_type': PUBSUB.ENDPOINT_TYPE,
'client_html': client_html,
}
# ################################################################################################################################
class EndpointTopics(_EndpointObjects):
url_name = 'pubsub-endpoint-topics'
template = 'zato/pubsub/endpoint-topics.html'
service_name = 'zato.pubsub.endpoint.get-topic-list'
output_class = PubSubTopic
class SimpleIO(_EndpointObjects.SimpleIO):
output_required = ('topic_id', 'topic_name', 'pub_time', 'pub_msg_id', 'pattern_matched')
output_optional = ('pub_correl_id', 'in_reply_to', 'ext_client_id', 'ext_pub_time', 'data')
def on_before_append_item(self, item):
item.pub_time_utc = item.pub_time
item.pub_time = from_utc_to_user(item.pub_time+'+00:00', self.req.zato.user_profile)
if item.ext_pub_time:
item.ext_pub_time_utc = item.ext_pub_time
item.ext_pub_time = from_utc_to_user(item.ext_pub_time+'+00:00', self.req.zato.user_profile)
return item
# ################################################################################################################################
class EndpointQueues(_EndpointObjects):
url_name = 'pubsub-endpoint-queues'
template = 'zato/pubsub/endpoint-queues.html'
service_name = 'zato.pubsub.endpoint.get-endpoint-queue-list'
output_class = PubSubSubscription
class SimpleIO(_EndpointObjects.SimpleIO):
output_optional = sub_attrs
def on_before_append_item(self, item):
item.current_depth_gd = item.current_depth_gd or 0
item.current_depth_non_gd = item.current_depth_non_gd or 0
item.name_slug = slugify(item.name)
item.creation_time_utc = item.creation_time
item.creation_time = from_utc_to_user(item.creation_time+'+00:00', self.req.zato.user_profile)
if item.last_interaction_time:
item.last_interaction_time_utc = item.last_interaction_time
item.last_interaction_time = from_utc_to_user(item.last_interaction_time+'+00:00', self.req.zato.user_profile)
return item
def handle(self):
out = super(EndpointQueues, self).handle()
data_list = Bunch()
data_list.service_list = []
data_list.out_amqp_list = self.req.zato.client.invoke('zato.outgoing.amqp.get-list', {
'cluster_id': self.req.zato.cluster_id
}).data
out['edit_form'] = EditSubscriptionForm(self.req, data_list, prefix='edit')
return out
# ################################################################################################################################
class EndpointQueueBrowser(_Index):
method_allowed = 'GET'
url_name = 'pubsub-endpoint-queue-browser'
template = 'zato/pubsub/endpoint-queue-browser.html'
service_name = None
output_class = PubSubEndpointEnqueuedMessage
paginate = True
# ################################################################################################################################
class SimpleIO(_Index.SimpleIO):
input_required = ('cluster_id', 'sub_id', 'has_gd')
output_required = ('msg_id', 'recv_time', 'data_prefix_short', 'has_gd', 'is_in_staging', 'delivery_count',
'last_delivery_time', 'name', 'endpoint_id', 'sub_key', 'published_by_id', 'published_by_name',
'server_name', 'server_pid')
output_repeated = True
# ################################################################################################################################
def on_after_set_input(self):
self.input.has_gd = asbool(self.input.has_gd)
# ################################################################################################################################
def get_service_name(self, _ignored):
suffix = '-gd' if self.input.has_gd else '-non-gd'
return 'zato.pubsub.endpoint.get-endpoint-queue-messages' + suffix
# ################################################################################################################################
def on_before_append_item(self, item):
item.recv_time_utc = item.recv_time
item.recv_time = from_utc_to_user(item.recv_time_utc+'+00:00', self.req.zato.user_profile)
return item
# ################################################################################################################################
def handle(self):
service_response = self.req.zato.client.invoke(
'zato.pubsub.endpoint.get-endpoint-queue', {
'cluster_id':self.req.zato.cluster_id,
'id':self.input.sub_id,
}).data.response
return {
'sub_id': self.input.sub_id,
'has_gd': self.input.has_gd,
'name': service_response.name,
'name_slug': slugify(service_response.name),
'endpoint_id': service_response.endpoint_id,
'endpoint_name': service_response.endpoint_name,
'ext_client_id': service_response.ext_client_id,
'ws_ext_client_id': service_response.ws_ext_client_id
}
# ################################################################################################################################
@method_allowed('POST')
def endpoint_queue_edit(req):
sub_id = req.POST['id']
cluster_id = req.POST['cluster_id']
endpoint_type = req.POST['endpoint_type']
# Always available
request = {
'id': sub_id,
'cluster_id': cluster_id,
'endpoint_type': endpoint_type
}
# Need form prefix
for item in sorted(sub_attrs):
if item not in ('id', 'cluster_id'):
key = 'edit-{}'.format(item)
value = req.POST.get(key)
request[item] = value
# Update subscription ..
req.zato.client.invoke('zato.pubsub.endpoint.update-endpoint-queue', request)
# .. and read it back - but this time it will include current data about depth.
service = 'zato.pubsub.endpoint.get-endpoint-queue'
request = bunchify({
'id': sub_id,
'cluster_id': cluster_id,
})
service_response = req.zato.client.invoke(service, request).data.response
service_response.creation_time = from_utc_to_user(service_response.creation_time+'+00:00', req.zato.user_profile)
if service_response.get('last_interaction_time'):
service_response.last_interaction_time = from_utc_to_user(
service_response.last_interaction_time+'+00:00', req.zato.user_profile)
response = {}
response['id'] = sub_id
response['message'] = 'Subscription updated successfully'
response.update(**service_response)
response.update(**request)
response['name_slug'] = slugify(response['name'])
return HttpResponse(dumps(response), content_type='application/javascript')
# ################################################################################################################################
@method_allowed('GET')
def endpoint_queue_interactions(req):
pass
# ################################################################################################################################
@method_allowed('POST')
def endpoint_queue_clear(req, cluster_id, sub_key):
try:
req.zato.client.invoke('zato.pubsub.endpoint.clear-endpoint-queue', {
'sub_key': sub_key,
'cluster_id': cluster_id,
})
except Exception:
return HttpResponseServerError(format_exc())
else:
queue_name = req.POST['queue_name']
return HttpResponse('Cleared sub queue `{}` for sub_key `{}`'.format(queue_name, sub_key))
# ################################################################################################################################
@method_allowed('POST')
def endpoint_queue_delete(req, sub_id, sub_key, cluster_id):
# Note that sub_id is always ignored, it's sent by JS but we don't use,
# instead we are interested in sub_key.
try:
req.zato.client.invoke('zato.pubsub.endpoint.delete-endpoint-queue', {
'sub_key': sub_key,
'cluster_id': cluster_id,
})
except Exception:
return HttpResponseServerError(format_exc())
else:
return HttpResponse() # 200 OK
# ################################################################################################################################
@method_allowed('POST')
def endpoint_topic_sub_list(req, endpoint_id, cluster_id):
""" Returns a list of topics to which a given endpoint has access for subscription,
including both endpoints that it's already subscribed to or all the remaining ones
the endpoint may be possible subscribe to.
"""
# Note that sub_id is always ignored, it's sent by JS but we don't use,
# instead we are interested in sub_key.
try:
response = req.zato.client.invoke('zato.pubsub.endpoint.get-topic-sub-list', {
'cluster_id': cluster_id,
'endpoint_id': endpoint_id,
'topic_filter_by': req.GET.get('topic_filter_by'),
})
except Exception:
return HttpResponseServerError(format_exc())
else:
return HttpResponse(dumps(response.data.response.topic_sub_list), content_type='application/javascript')
# ################################################################################################################################
| 18,306
|
Python
|
.py
| 343
| 45.994169
| 130
| 0.543983
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,804
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/pubsub/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2021, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# stdlib
from logging import getLogger
from traceback import format_exc
# Bunch
from bunch import bunchify
# Django
from django.template.response import TemplateResponse
# Zato
from zato.admin.web import from_utc_to_user
from zato.admin.web.forms.pubsub import MsgForm
from zato.admin.web.views import django_url_reverse, slugify
from zato.common.api import PUBSUB
from zato.common.util.api import asbool
# ################################################################################################################################
logger = getLogger(__name__)
# ################################################################################################################################
def get_client_html(item, security_id, cluster_id, style='', separator=''):
""" Client is a string representation of a WebSockets channel, HTTP credentials or a service.
"""
style = style or 'font-size:smaller'
separator = separator or '<br/>'
client = ''
path_name = ''
if item.is_internal:
return 'Internal'
elif item.endpoint_type == PUBSUB.ENDPOINT_TYPE.WEB_SOCKETS.id:
path_name = 'channel-web-socket'
name = item.ws_channel_name
protocol = 'WebSockets'
elif item.endpoint_type == PUBSUB.ENDPOINT_TYPE.REST.id:
path_name = 'security-basic-auth'
name = item.sec_name
protocol = 'REST'
elif item.endpoint_type == PUBSUB.ENDPOINT_TYPE.SERVICE.id:
path_name = 'service'
name = item.service_name
protocol = 'Service'
if path_name:
path = django_url_reverse(path_name)
client = '<span style="{}">{}</span>{}<a href="{}?cluster={}&query={}">{}</a>'.format(
style, protocol, separator, path, cluster_id, name, name)
return client
# ################################################################################################################################
def get_inline_client_html(item, security_id, cluster_id):
return get_client_html(
item,
security_id,
cluster_id,
style='font-size:default',
separator=' : '
)
# ################################################################################################################################
def get_endpoint_html(item, cluster_id, endpoint_name_attr='endpoint_name'):
name = getattr(item, endpoint_name_attr, None) or item[endpoint_name_attr]
path = django_url_reverse('pubsub-endpoint')
endpoint = '<span style="font-size:smaller"><a href="{}?cluster={}&query={}">{}</a></span>'.format(
path, cluster_id, name, name)
return endpoint
# ################################################################################################################################
def get_message(req, cluster_id, object_type, object_id, msg_id):
return_data = bunchify({
'action': 'update',
})
_has_gd = asbool(req.GET['has_gd'])
_server_name = req.GET.get('server_name')
_server_pid = req.GET.get('server_pid')
_is_topic = object_type=='topic'
suffix = '-gd' if _has_gd else '-non-gd'
input_dict = {
'cluster_id': cluster_id,
'msg_id': msg_id,
}
if not _has_gd:
input_dict['server_name'] = _server_name
input_dict['server_pid'] = _server_pid
return_data.cluster_id = cluster_id
return_data.object_type = object_type
return_data['{}_id'.format(object_type)] = object_id
return_data.msg_id = msg_id
return_data.server_name = _server_name
return_data.server_pid = _server_pid
return_data.has_gd = _has_gd
if _is_topic:
object_service_name = 'zato.pubsub.topic.get'
msg_service_name = 'zato.pubsub.message.get-from-topic' + suffix
else:
object_service_name = 'zato.pubsub.endpoint.get-endpoint-queue'
msg_service_name = 'zato.pubsub.message.get-from-queue' + suffix
input_dict['sub_key'] = req.GET['sub_key']
object_service_response = req.zato.client.invoke(
object_service_name, {
'cluster_id':cluster_id,
'id':object_id,
}).data.response
return_data.object_name = object_service_response.name
if object_type=='queue':
return_data.ws_ext_client_id = object_service_response.ws_ext_client_id
return_data.object_name_slug = slugify(return_data.object_name)
try:
msg_service_response = req.zato.client.invoke(msg_service_name, input_dict).data.response
except Exception:
logger.warning(format_exc())
return_data.has_msg = False
else:
if not msg_service_response['msg_id']:
return_data.has_msg = False
else:
return_data.has_msg = True
return_data.update(msg_service_response)
if _is_topic:
hook_pub_endpoint_id = return_data.endpoint_id
hook_sub_endpoint_id = None
return_data.object_id = return_data.pop('topic_id')
return_data.pub_endpoint_html = get_endpoint_html(return_data, cluster_id)
else:
# If it's a GD queue, we still need to get metadata about the message's underlying publisher
if _has_gd:
topic_msg_service_response = req.zato.client.invoke(
'zato.pubsub.message.get-from-topic' + suffix, {
'cluster_id': cluster_id,
'msg_id': msg_id,
'needs_sub_queue_check': False,
}).data.response
return_data.topic_id = topic_msg_service_response.topic_id
return_data.topic_name = topic_msg_service_response.topic_name
return_data.pub_endpoint_id = topic_msg_service_response.endpoint_id
return_data.pub_endpoint_name = topic_msg_service_response.endpoint_name
return_data.pub_pattern_matched = topic_msg_service_response.pub_pattern_matched
return_data.pub_endpoint_html = get_endpoint_html(return_data, cluster_id, 'pub_endpoint_name')
return_data.sub_endpoint_html = get_endpoint_html(return_data, cluster_id, 'subscriber_name')
return_data.object_id = return_data.pop('queue_id')
hook_pub_endpoint_id = return_data.pub_endpoint_id
hook_sub_endpoint_id = return_data.subscriber_id
hook_pub_service_response = req.zato.client.invoke(
'zato.pubsub.hook.get-hook-service', {
'cluster_id': cluster_id,
'endpoint_id': hook_pub_endpoint_id,
'hook_type': PUBSUB.HOOK_TYPE.BEFORE_PUBLISH,
}).data.response
return_data.hook_pub_service_id = hook_pub_service_response.get('id')
return_data.hook_pub_service_name = hook_pub_service_response.get('name')
if hook_sub_endpoint_id:
hook_sub_service_response = req.zato.client.invoke(
'zato.pubsub.hook.get-hook-service', {
'cluster_id': cluster_id,
'endpoint_id': hook_sub_endpoint_id,
'hook_type': PUBSUB.HOOK_TYPE.BEFORE_DELIVERY,
}).data.response
return_data.hook_sub_service_id = hook_sub_service_response.get('id')
return_data.hook_sub_service_name = hook_sub_service_response.get('name')
return_data.form = MsgForm(return_data)
for name in('pub_time', 'ext_pub_time', 'expiration_time', 'recv_time'):
value = return_data.get(name)
if value:
return_data[name] = from_utc_to_user(value+'+00:00', req.zato.user_profile)
return_data[name + '_utc'] = value
return TemplateResponse(req, 'zato/pubsub/message-details.html', return_data)
| 8,200
|
Python
|
.py
| 162
| 40.154321
| 130
| 0.557517
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,805
|
subscription.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/pubsub/subscription.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2023, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# stdlib
import logging
# Bunch
from bunch import Bunch
# Zato
from zato.admin.web import from_utc_to_user
from zato.admin.web.forms import Initial_Choices_Dict_Attrs
from zato.admin.web.forms.pubsub.subscription import CreateForm, EditForm
from zato.admin.web.views import CreateEdit, Delete as _Delete, django_url_reverse, Index as _Index, slugify
from zato.common.api import PUBSUB
from zato.common.odb.model import PubSubEndpoint
# ################################################################################################################################
logger = logging.getLogger(__name__)
# ################################################################################################################################
class Index(_Index):
method_allowed = 'GET'
url_name = 'pubsub-subscription'
template = 'zato/pubsub/subscription.html'
service_name = 'zato.pubsub.endpoint.get-endpoint-summary-list'
output_class = PubSubEndpoint
paginate = True
class SimpleIO(_Index.SimpleIO):
input_required = ('cluster_id',)
input_optional = ('topic_id',)
output_required = ('id', 'endpoint_name', 'endpoint_type', 'subscription_count', 'is_active', 'is_internal')
output_optional = ('security_id', 'sec_type', 'sec_name', 'ws_channel_id', 'ws_channel_name',
'service_id', 'service_name', 'last_seen', 'last_deliv_time', 'role', 'endpoint_type_name')
output_repeated = True
def on_before_append_item(self, item): # type: ignore
if item.last_seen:
item.last_seen = from_utc_to_user(item.last_seen+'+00:00', self.req.zato.user_profile)
if item.last_deliv_time:
item.last_deliv_time = from_utc_to_user(item.last_deliv_time+'+00:00', self.req.zato.user_profile)
return item # type: ignore
def handle(self): # type: ignore
data_list = Bunch()
data_list.security_list = []
data_list.service_list = []
select_data_target = Bunch()
topic_name = None
create_form = None
edit_form = None
for endpoint_type in PUBSUB.ENDPOINT_TYPE():
select_data_target[endpoint_type] = [Initial_Choices_Dict_Attrs]
if self.req.zato.cluster_id:
for item in self.items: # type: ignore
targets = select_data_target[item.endpoint_type] # type: ignore
id_key = 'id'
name_key = 'name'
endpoint_name = item.endpoint_name # type: ignore
targets.append({id_key:item.id, name_key:endpoint_name})
# Security definitions
data_list.security_list = self.get_sec_def_list('basic_auth').def_items # type: ignore
# Services
data_list.service_list = self.req.zato.client.invoke('zato.service.get-list', {
'cluster_id': self.req.zato.cluster_id
}).data
data_list.out_amqp_list = self.req.zato.client.invoke('zato.outgoing.amqp.get-list', {
'cluster_id': self.req.zato.cluster_id
}).data
# Topic
if self.input.topic_id:
topic_name = self.req.zato.client.invoke('zato.pubsub.topic.get', {
'cluster_id': self.req.zato.cluster_id,
'id': self.input.topic_id
}).data.response.name
create_form = CreateForm(self.req, data_list)
edit_form = EditForm(self.req, data_list, prefix='edit')
return {
'create_form': create_form,
'edit_form': edit_form,
'select_data_target': select_data_target,
'topic_name': topic_name,
'topic_id': self.input.topic_id,
} # type: ignore
# ################################################################################################################################
class _CreateEdit(CreateEdit):
method_allowed = 'POST'
class SimpleIO(CreateEdit.SimpleIO):
input_required = ('endpoint_id', 'is_active', 'cluster_id', 'server_id', 'is_internal')
input_optional = ('has_gd', 'topic_list_json', 'endpoint_type', 'endpoint_id', 'active_status',
'delivery_method', 'delivery_data_format', 'delivery_batch_size', 'wrap_one_msg_in_list', 'delivery_max_retry',
'delivery_err_should_block', 'wait_sock_err', 'wait_non_sock_err', 'out_amqp_id', 'amqp_exchange',
'amqp_routing_key', 'files_directory_list', 'ftp_directory_list', 'out_rest_http_soap_id', 'rest_delivery_endpoint',
'service_id', 'sms_twilio_from', 'sms_twilio_to_list', 'smtp_is_html', 'smtp_subject', 'smtp_from', 'smtp_to_list',
'smtp_body', 'out_soap_http_soap_id', 'soap_delivery_endpoint', 'out_http_method')
output_required = ('id',)
# ################################################################################################################################
def populate_initial_input_dict(self, initial_input_dict): # type: ignore
topic_list = []
for key in sorted(self.req.POST):
if key.startswith('topic_checkbox_'):
topic_name = key.replace('topic_checkbox_', '')
topic_list.append(topic_name)
initial_input_dict['topic_list_json'] = topic_list
# ################################################################################################################################
def post_process_return_data(self, return_data): # type: ignore
response = self.req.zato.client.invoke('zato.pubsub.endpoint.get-endpoint-summary', {
'cluster_id': self.req.zato.cluster_id,
'endpoint_id': self.input.endpoint_id,
}).data
if response['last_seen']:
response['last_seen'] = from_utc_to_user(response['last_seen']+'+00:00', self.req.zato.user_profile)
if response['last_deliv_time']:
response['last_deliv_time'] = from_utc_to_user(response['last_deliv_time']+'+00:00', self.req.zato.user_profile)
response['pubsub_endpoint_queues_link'] = \
django_url_reverse('pubsub-endpoint-queues',
kwargs={
'cluster_id':self.req.zato.cluster_id,
'endpoint_id':response['id'],
'name_slug':slugify(response['endpoint_name'])}
),
return_data.update(response)
def success_message(self, _ignored_item): # type: ignore
return 'Pub/sub configuration updated successfully'
# ################################################################################################################################
class Create(_CreateEdit):
url_name = 'pubsub-subscription-create'
service_name = 'zato.pubsub.subscription.create'
# ################################################################################################################################
class Edit(_CreateEdit):
url_name = 'pubsub-subscription-edit'
form_prefix = 'edit-'
service_name = 'zato.pubsub.subscription.edit'
# ################################################################################################################################
class Delete(_Delete):
id_elem = 'endpoint_id'
url_name = 'pubsub-subscription-delete-all'
error_message = 'Could not delete pub/sub subscriptions'
service_name = 'zato.pubsub.subscription.delete-all'
# ################################################################################################################################
| 7,728
|
Python
|
.py
| 136
| 47.661765
| 130
| 0.528109
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,806
|
sync.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/pubsub/task/sync.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
import logging
# Zato
from zato.admin.web import from_utc_to_user
from zato.admin.web.views import Index as _Index
from zato.common.pubsub import all_dict_keys, pubsub_main_data
from zato.common.util.event import Event
from zato.common.util.time_ import datetime_from_ms
# ################################################################################################################################
logger = logging.getLogger(__name__)
dict_name_to_url_name = {
'subscriptions_by_topic': 'pubsub-task-sync-dict-values-subscriptions',
'subscriptions_by_sub_key': 'pubsub-task-sync-dict-values-subscriptions',
'sub_key_servers': 'pubsub-task-sync-dict-values-sks',
'endpoints': 'pubsub-task-sync-dict-values-endpoints',
'topics': 'pubsub-task-sync-dict-values-topics',
'sec_id_to_endpoint_id': 'pubsub-task-sync-dict-values-endpoints',
'ws_channel_id_to_endpoint_id': 'pubsub-task-sync-dict-values-endpoints',
'service_id_to_endpoint_id': 'pubsub-task-sync-dict-values-endpoints',
'topic_name_to_id': 'pubsub-task-sync-dict-values-topics',
'pubsub_tool_by_sub_key': 'pubsub-task-sync-dict-values-pst',
'pubsub_tools': 'pubsub-task-sync-dict-values-pst',
'endpoint_msg_counter': 'pubsub-task-sync-dict-values-messages'
}
dict_name_to_template_name = {
'subscriptions_by_topic': 'subscriptions',
'subscriptions_by_sub_key': 'subscriptions',
'sub_key_servers': 'sks',
'endpoints': 'endpoints',
'topics': 'topics',
'sec_id_to_endpoint_id': 'endpoints',
'ws_channel_id_to_endpoint_id': 'endpoints',
'service_id_to_endpoint_id': 'endpoints',
'topic_name_to_id': 'topics',
'pubsub_tool_by_sub_key': 'pubsub-tools',
'pubsub_tools': 'pubsub-tools',
'endpoint_msg_counter': 'messages'
}
# ################################################################################################################################
time_keys = 'creation_time', 'last_synced', 'gd_pub_time_max'
# ################################################################################################################################
class PubSubTool:
def __init__(self):
self.server_name = None
self.server_pid = None
self.server_api_address = None
self.keep_running = None
self.subscriptions_by_topic = None
self.subscriptions_by_sub_key = None
self.sub_key_servers = None
self.endpoints = None
self.topics = None
self.sec_id_to_endpoint_id = None
self.ws_channel_id_to_endpoint_id = None
self.service_id_to_endpoint_id = None
self.topic_name_to_id = None
self.pubsub_tool_by_sub_key = None
self.pubsub_tools = None
self.sync_backlog = None
self.msg_pub_counter = None
self.has_meta_endpoint = None
self.endpoint_meta_store_frequency = None
self.endpoint_meta_data_len = None
self.endpoint_meta_max_history = None
self.data_prefix_len = None
self.data_prefix_short_len = None
def __repr__(self):
attrs = {}
for name in pubsub_main_data:
value = getattr(self, name)
if value:
attrs[name] = value
return '<{} at {} {}>'.format(self.__class__.__name__, hex(id(self)), attrs)
# ################################################################################################################################
class _SubscriptionDictKeys:
def __init__(self):
self.key = None
self.key_len = None
self.id_list = None
# ################################################################################################################################
class _DictValuesData:
pass
# ################################################################################################################################
class _Event:
pass
# ################################################################################################################################
class Index(_Index):
method_allowed = 'GET'
url_name = 'pubsub-task-sync'
template = 'zato/pubsub/task/sync/index.html'
service_name = 'zato.pubsub.task.sync.get-list'
output_class = PubSubTool
paginate = True
class SimpleIO(_Index.SimpleIO):
output_optional = pubsub_main_data
output_repeated = True
def handle(self):
return {}
# ################################################################################################################################
class _DictView(_Index):
method_allowed = 'GET'
paginate = True
class SimpleIO(_Index.SimpleIO):
input_required = 'dict_name', 'server_name', 'server_pid'
output_repeated = True
def handle(self):
return {
'dict_name': self.input.dict_name,
'server_name': self.input.server_name,
'server_pid': self.input.server_pid,
}
def get_initial_input(self):
return {
'dict_name': self.input.dict_name,
}
# ################################################################################################################################
class SubscriptionDictKeys(_DictView):
url_name = 'pubsub-task-sync-subscription-dict-keys'
template = 'zato/pubsub/task/sync/dict/keys.html'
service_name = 'zato.pubsub.task.sync.get-dict-keys'
output_class = _SubscriptionDictKeys
class SimpleIO(_DictView.SimpleIO):
input_optional = 'key_url_name',
output_required = 'key', 'key_len', 'id_list', 'is_list'
def handle(self):
out = super(SubscriptionDictKeys, self).handle()
out['key_url_name'] = self.input.key_url_name
out['values_url_name'] = dict_name_to_url_name[self.input.dict_name]
return out
# ################################################################################################################################
class DictValues(_DictView):
service_name = 'zato.pubsub.task.sync.get-dict-values'
output_class = _DictValuesData
_dict_sort_by = None
class SimpleIO(_DictView.SimpleIO):
input_optional = 'key',
output_optional = all_dict_keys
def handle(self):
out = super(DictValues, self).handle()
out['key'] = self.input.key
return out
def get_initial_input(self):
out = super(DictValues, self).get_initial_input()
if self._dict_sort_by:
out['sort_by'] = self._dict_sort_by
return out
def on_before_append_item(self, item):
for name in time_keys:
raw_time_value = getattr(item, name, None)
if raw_time_value:
raw_key = '{}_raw'.format(name)
utc_key = '{}_utc'.format(name)
if isinstance(raw_time_value, float):
float_value = getattr(item, name)
float_as_dt = datetime_from_ms(float_value, False)
# The float value must have represented seconds rather than seconds
# so we need to retry after converting seconds to milliseconds.
# Year 2000 can be safely used because it will never be a correct value.
if float_as_dt.year < 2000:
float_value = float_value * 1000
float_as_dt = datetime_from_ms(float_value, False)
setattr(item, utc_key, float_as_dt.isoformat())
else:
setattr(item, utc_key, raw_time_value)
utc_value = getattr(item, utc_key)
utc_value_user = from_utc_to_user(utc_value+'+00:00', self.req.zato.user_profile)
setattr(item, raw_key, raw_time_value)
setattr(item, name, utc_value_user)
return item
def get_template_name(self):
pattern = 'zato/pubsub/task/sync/dict/values/{}.html'
name = dict_name_to_template_name[self.input.dict_name]
return pattern.format(name)
# ################################################################################################################################
class DictValuesSubscriptions(DictValues):
url_name = 'pubsub-task-sync-dict-values-subscriptions'
_dict_sort_by = ['creation_time']
# ################################################################################################################################
class DictValuesSubKeyServer(DictValues):
url_name = 'pubsub-task-sync-dict-values-sks'
_dict_sort_by = ['creation_time']
# ################################################################################################################################
class DictValuesEndpoints(DictValues):
url_name = 'pubsub-task-sync-dict-values-endpoints'
_dict_sort_by = ['endpoint_type', 'name']
# ################################################################################################################################
class DictValuesTopics(DictValues):
url_name = 'pubsub-task-sync-dict-values-topics'
_dict_sort_by = ['name']
# ################################################################################################################################
class EventList(_Index):
method_allowed = 'GET'
url_name = 'pubsub-task-event-list'
template = 'zato/pubsub/task/sync/event/index.html'
service_name = 'zato.pubsub.task.sync.get-event-list'
output_class = _Event
paginate = True
class SimpleIO(_Index.SimpleIO):
input_required = 'cluster_id', 'server_name', 'server_pid'
output_optional = Event.__slots__
output_repeated = True
def handle(self):
return {}
# ################################################################################################################################
| 10,079
|
Python
|
.py
| 210
| 40.819048
| 130
| 0.50367
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,807
|
message.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/pubsub/task/delivery/message.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
import logging
# Zato
from zato.admin.web import from_utc_to_user
from zato.admin.web.views import Index as _Index, method_allowed
# ################################################################################################################################
logger = logging.getLogger(__name__)
# ################################################################################################################################
class Message:
def __init__(self):
self.id = None
self.msg_id = None
self.published_by_id = None
self.published_by_name = None
self.delivery_count = None
self.recv_time = None
self.ext_client_id = None
self.data_prefix_short = None
# ################################################################################################################################
# ################################################################################################################################
class MessageBrowserInFlight(_Index):
method_allowed = 'GET'
url_name = 'pubsub-task-message-browser'
template = 'zato/pubsub/task/message/browser.html'
service_name = 'pubsub.task.message.get-list2'
output_class = Message
paginate = True
class SimpleIO(_Index.SimpleIO):
input_required = 'cluster_id', 'server_name', 'server_pid', 'python_id'
output_required = 'msg_id', 'published_by_id', 'published_by_name', 'delivery_count', 'recv_time'
output_optional = 'ext_client_id', 'data_prefix_short'
output_repeated = True
def get_initial_input(self):
return {
'server_pid':self.input.server_pid,
'python_id':self.input.python_id,
}
def handle_return_data(self, return_data):
# Get task metadata from a relevant service
response = self.req.zato.client.invoke('zato.pubsub.task.delivery.get-delivery-task', {
'server_name':self.input.server_name,
'server_pid':self.input.server_pid,
'python_id':self.input.python_id,
})
return_data['task'] = response.data
# Handle the list of results now
for item in return_data['items']:
item.id = item.msg_id
if item.recv_time:
item.recv_time_utc = item.recv_time
item.recv_time = from_utc_to_user(item.recv_time_utc + '+00:00', self.req.zato.user_profile)
return return_data
def handle(self):
return {
'server_name': self.req.zato.args.server_name,
'server_pid': self.req.zato.args.server_pid,
'python_id': self.req.zato.args.python_id,
}
# ################################################################################################################################
# ################################################################################################################################
class MessageBrowserHistory:
url_name = 'zzz'
# ################################################################################################################################
# ################################################################################################################################
@method_allowed('GET')
def get(req, cluster_id, object_id, msg_id):
pass
# ################################################################################################################################
# ################################################################################################################################
| 3,859
|
Python
|
.py
| 75
| 44.933333
| 130
| 0.418574
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,808
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/pubsub/task/delivery/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
import logging
# Zato
from zato.admin.web import from_utc_to_user
from zato.admin.web.views import id_only_service, Index as _Index, method_allowed
from zato.common.util.file_system import fs_safe_name
# ################################################################################################################################
logger = logging.getLogger(__name__)
# ################################################################################################################################
class DeliveryTask:
def __init__(self):
self.id = None
self.is_active = None
self.server_name = None
self.server_pid = None
self.task_id = None
self.sub_keys = None
self.topics = None
self.len_messages = None
self.len_history = None
self.py_object = None
self.python_id = None
self.len_batches = None
self.len_delivered = None
self.endpoint_id = None
self.endpoint_name = None
self.last_sync = None
self.last_sync_utc = None
self.last_sync_sk = None
self.last_sync_sk_utc = None
self.last_iter_run = None
self.last_iter_run_utc = None
# ################################################################################################################################
class Index(_Index):
method_allowed = 'GET'
url_name = 'pubsub-task'
template = 'zato/pubsub/task/delivery/task/index.html'
service_name = 'zato.pubsub.task.delivery.get-delivery-task-list'
output_class = DeliveryTask
paginate = True
class SimpleIO(_Index.SimpleIO):
input_required = 'cluster_id', 'server_name', 'server_pid'
output_required = ('id', 'server_name', 'server_pid', 'py_object', 'python_id',
'endpoint_id', 'endpoint_name', 'sub_key', 'topic_id', 'topic_name',
'len_messages', 'len_history', 'len_batches', 'len_delivered', 'ext_client_id', 'is_active')
output_optional = 'last_sync', 'last_sync_utc', 'last_sync_sk', 'last_sync_sk_utc', 'last_iter_run', 'last_iter_run_utc'
output_repeated = True
def get_initial_input(self):
return {
'server_pid':self.input.server_pid,
}
def handle_return_data(self, return_data):
for item in return_data['items']:
item.id = fs_safe_name(item.py_object)
if item.last_sync:
item.last_sync_utc = item.last_sync
item.last_sync = from_utc_to_user(item.last_sync_utc + '+00:00', self.req.zato.user_profile)
if item.last_sync_sk:
item.last_sync_sk_utc = item.last_sync_sk
item.last_sync_sk = from_utc_to_user(item.last_sync_sk_utc + '+00:00', self.req.zato.user_profile)
if item.last_iter_run:
item.last_iter_run_utc = item.last_iter_run
item.last_iter_run = from_utc_to_user(item.last_iter_run_utc + '+00:00', self.req.zato.user_profile)
return return_data
def handle(self):
return {
'server_name': self.req.zato.args.server_name,
'server_pid': self.req.zato.args.server_pid,
}
# ################################################################################################################################
@method_allowed('POST')
def clear_messages(req, server_name, server_pid, task_id, cluster_id):
return id_only_service(req, 'pubsub.task.clear-messages', id, 'Could not clear messages, e:`{}`')
# ################################################################################################################################
@method_allowed('POST')
def toggle_active(req, server_name, server_pid, task_id, cluster_id):
return id_only_service(req, 'pubsub.task.toggle-active', id, 'Task active flag could not be toggled, e:`{}`')
# ################################################################################################################################
| 4,261
|
Python
|
.py
| 84
| 43.333333
| 130
| 0.513514
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,809
|
server.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/pubsub/task/delivery/server.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
import logging
# Zato
from zato.admin.web import from_utc_to_user
from zato.admin.web.views import Index as _Index
from zato.common.util.file_system import fs_safe_name
# ################################################################################################################################
logger = logging.getLogger(__name__)
# ################################################################################################################################
class DeliveryServer:
def __init__(self):
self.id = None
self.name = None
self.pid = None
self.tasks = None
self.tasks_running = None
self.tasks_stopped = None
self.sub_keys = None
self.topics = None
self.messages = None
self.messages_gd = None
self.messages_non_gd = None
self.msg_handler_counter = 0
self.last_gd_run = None
self.last_gd_run_utc = None
self.last_sync = None
self.last_sync_utc = None
self.last_task_run = None
self.last_task_run_utc = None
# ################################################################################################################################
class Index(_Index):
method_allowed = 'GET'
url_name = 'pubsub-task-delivery-server'
template = 'zato/pubsub/task/delivery/server.html'
service_name = 'zato.pubsub.task.delivery.server.get-list'
output_class = DeliveryServer
paginate = True
class SimpleIO(_Index.SimpleIO):
input_required = ('cluster_id',)
output_required = ('id', 'name', 'pid', 'tasks', 'tasks_running', 'tasks_stopped', 'sub_keys', 'topics',
'messages', 'messages_gd', 'messages_non_gd', 'msg_handler_counter')
output_optional = ('last_gd_run', 'last_gd_run_utc', 'last_task_run', 'last_task_run_utc')
output_repeated = True
def handle_return_data(self, return_data):
for item in return_data['items']:
item.id = fs_safe_name('{}-{}'.format(item.name, item.pid))
if item.last_gd_run:
item.last_gd_run_utc = item.last_gd_run
if item.last_gd_run_utc:
item.last_gd_run = from_utc_to_user(item.last_gd_run_utc + '+00:00', self.req.zato.user_profile)
if item.last_task_run:
item.last_task_run_utc = item.last_task_run
item.last_task_run = from_utc_to_user(item.last_task_run_utc + '+00:00', self.req.zato.user_profile)
return return_data
def handle(self):
return {}
# ################################################################################################################################
| 2,959
|
Python
|
.py
| 63
| 39.666667
| 130
| 0.51341
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,810
|
user.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/stats/user.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2022, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# stdlib
import logging
from enum import Enum, unique
from json import dumps, loads
# Bunch
from bunch import Bunch
# Django
from django.http import HttpResponse
# Zato
from zato.admin.web.views import Index as _Index
from zato.common.typing_ import cast_
# ################################################################################################################################
# ################################################################################################################################
if 0:
from django.core.handlers.wsgi import WSGIRequest
from zato.common.typing_ import any_
# ################################################################################################################################
# ################################################################################################################################
logger = logging.getLogger(__name__)
# ################################################################################################################################
# ################################################################################################################################
form_item_id_prefix = 'item-id-'
item_id_list_param = 'id'
# ################################################################################################################################
# ################################################################################################################################
browse_service = 'stats.browse-stats'
# ################################################################################################################################
# ################################################################################################################################
class BaseEnum(Enum):
@classmethod
def has_value(cls:'any_', value:'str') -> 'bool':
members = cast_('dict', cls.__members__)
values = members.values()
values = [elem.value for elem in values]
return value in values
# ################################################################################################################################
# ################################################################################################################################
@unique
class Action(BaseEnum):
Index = 'Index'
BrowseStats = 'BrowseStats'
DisplayStats = 'DisplayStats'
CompareStats = 'CompareStats'
action_to_service = {
Action.Index.value: 'stats.get-stat-types',
Action.BrowseStats.value: browse_service,
Action.DisplayStats.value: browse_service,
Action.CompareStats.value: browse_service,
}
action_to_template = {
Action.Index.value: 'zato/stats/user/index.html',
Action.BrowseStats.value: 'zato/stats/user/browse.html',
Action.DisplayStats.value: 'zato/stats/user/browse.html',
Action.CompareStats.value: 'zato/stats/user/browse.html',
}
default_action = Action.Index.value # type: str
# ################################################################################################################################
# ################################################################################################################################
class Index(_Index):
method_allowed = 'GET'
url_name = 'stats-user'
paginate = True
clear_self_items = False
update_request_with_self_input = False
class SimpleIO(_Index.SimpleIO):
input_optional = ('action',)
output_repeated = True
def before_invoke_admin_service(self):
self.items = {
'items': [],
'rows': [],
'charts': [],
}
# ################################################################################################################################
def should_extract_top_level(self, _keys):
return False
# ################################################################################################################################
def handle_item_list(self, item_list, is_extracted):
# We have a single list on input
if is_extracted:
self._handle_single_item_list(self.items, item_list)
else:
# Otherwise, it is a dictionary and we need to process each of its values.
# The initial keys in the container (self.items) will be set but a view's
# before_invoke_admin_service method.
for key, value_list in (item_list or {}).items():
container = self.items.get(key, [])
self._handle_single_item_list(container, value_list)
# ################################################################################################################################
def get_initial_input(self):
out = {'id':[]}
for key, value in self.req.GET.items():
if key in {'action', 'cluster_id'}:
continue
else:
if key.startswith(form_item_id_prefix):
data = key.split(form_item_id_prefix)
value = data[1]
out['id'].append(value)
else:
out[key] = value
return out
# ################################################################################################################################
def on_after_set_input(self):
action = self.input.get('action')
action = action or default_action
if not Action.has_value(action):
action = default_action
self.ctx['action'] = action
self.ctx['service_name'] = action_to_service[action]
self.ctx['template_name'] = action_to_template[action]
return action_to_service[action]
# ################################################################################################################################
def get_output_class(self) -> 'any_':
return Bunch
# ################################################################################################################################
def get_service_name(self, _:'WSGIRequest') -> 'str':
return self.ctx['service_name']
# ################################################################################################################################
def get_template_name(self):
return self.ctx['template_name']
# ################################################################################################################################
def _handle_item(self, item:'any_') -> 'any_':
return item
# ################################################################################################################################
def handle_return_data(self, return_data:'any_') -> 'any_':
dicts = self.req.zato.client.invoke('stats.get-dict-containers')
columns = self.req.zato.client.invoke('stats.get-table-columns')
columns = columns.data['columns']
return_data['dicts'] = dicts.data
return_data['columns'] = columns
return_data['action'] = self.ctx['action']
return_data['form_item_id_prefix'] = form_item_id_prefix
# This is needed by a checkbox in each row to make the checkbox know whether it should be checked or not.
id_checked = []
for key in self.req.GET:
if key.startswith(form_item_id_prefix):
key = key.split(form_item_id_prefix)
key
value = key[1]
id_checked.append(value)
return_data['id_checked'] = id_checked
return return_data
# ################################################################################################################################
# ################################################################################################################################
def get_updates(req):
# Assume we do not return anything ..
out = {}
# .. unless we have some query parameters on input
if req.body:
data = loads(req.body)
if item_id_list_param in data:
response = req.zato.client.invoke(browse_service, {
item_id_list_param: data[item_id_list_param],
'needs_rows':False
})
out.update(response.data)
out = dumps(out)
return HttpResponse(out)
# ################################################################################################################################
# ################################################################################################################################
| 8,852
|
Python
|
.py
| 166
| 46.463855
| 130
| 0.366547
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,811
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/stats/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2021, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
| 154
|
Python
|
.py
| 5
| 29.4
| 64
| 0.687075
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,812
|
service_usage.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/stats/service_usage.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2021, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# stdlib
import logging
# Zato
from zato.admin.web.views import Index as _Index
# ################################################################################################################################
# ################################################################################################################################
logger = logging.getLogger(__name__)
# ################################################################################################################################
# ################################################################################################################################
class StatsItem:
pass
# ################################################################################################################################
# ################################################################################################################################
class Index(_Index):
method_allowed = 'GET'
url_name = 'stats-service-usage'
template = 'zato/stats/service-usage.html'
service_name = 'zato.service.get-stats-table'
output_class = StatsItem
paginate = True
class SimpleIO(_Index.SimpleIO):
output_optional = ('name', 'item_mean', 'item_max', 'item_min', 'item_time_share', \
'item_usage_share', 'item_total_usage', 'item_total_time', 'item_total_usage_human',
'item_total_time_human')
output_repeated = True
def handle(self):
return {}
# ################################################################################################################################
# ################################################################################################################################
| 1,922
|
Python
|
.py
| 34
| 52.676471
| 130
| 0.296533
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,813
|
es.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/search/es.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
import logging
# Zato
from zato.admin.web.forms.search.es import CreateForm, EditForm
from zato.admin.web.views import CreateEdit, Delete as _Delete, Index as _Index
from zato.common.api import SEARCH
from zato.common.odb.model import ElasticSearch
logger = logging.getLogger(__name__)
class Index(_Index):
method_allowed = 'GET'
url_name = 'search-es'
template = 'zato/search/es.html'
service_name = 'zato.search.es.get-list'
output_class = ElasticSearch
paginate = True
class SimpleIO(_Index.SimpleIO):
input_required = ('cluster_id',)
output_required = ('id', 'name', 'is_active', 'hosts', 'timeout', 'body_as')
output_repeated = True
def handle(self):
return {
'create_form': CreateForm(),
'edit_form': EditForm(prefix='edit'),
'default_timeout': 90,
'default_body_as': SEARCH.ES.DEFAULTS.BODY_AS
}
class _CreateEdit(CreateEdit):
method_allowed = 'POST'
class SimpleIO(CreateEdit.SimpleIO):
input_required = ('name', 'is_active', 'hosts', 'timeout', 'body_as')
output_required = ('id', 'name')
def success_message(self, item):
return 'Successfully {} the ElasticSearch connection [{}]'.format(self.verb, item.name)
class Create(_CreateEdit):
url_name = 'search-es-create'
service_name = 'zato.search.es.create'
class Edit(_CreateEdit):
url_name = 'search-es-edit'
form_prefix = 'edit-'
service_name = 'zato.search.es.edit'
class Delete(_Delete):
url_name = 'search-es-delete'
error_message = 'Could not delete the ElasticSearch connection'
service_name = 'zato.search.es.delete'
| 1,930
|
Python
|
.py
| 50
| 33.54
| 95
| 0.676676
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,814
|
solr.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/search/solr.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
import logging
# Django
from django.http import HttpResponse, HttpResponseServerError
# Zato
from zato.admin.web.forms.search.solr import CreateForm, EditForm
from zato.admin.web.views import CreateEdit, Delete as _Delete, id_only_service, Index as _Index, method_allowed
from zato.common.api import SEARCH
from zato.common.odb.model import Solr
logger = logging.getLogger(__name__)
class Index(_Index):
method_allowed = 'GET'
url_name = 'search-solr'
template = 'zato/search/solr.html'
service_name = 'zato.search.solr.get-list'
output_class = Solr
paginate = True
class SimpleIO(_Index.SimpleIO):
input_required = ('cluster_id',)
output_required = ('id', 'name', 'is_active', 'address', 'timeout', 'ping_path', 'options', 'pool_size')
output_repeated = True
def handle(self):
return {
'create_form': CreateForm(),
'edit_form': EditForm(prefix='edit'),
'default_timeout': SEARCH.SOLR.DEFAULTS.TIMEOUT,
'default_ping_path': SEARCH.SOLR.DEFAULTS.PING_PATH,
'default_pool_size': SEARCH.SOLR.DEFAULTS.POOL_SIZE,
}
class _CreateEdit(CreateEdit):
method_allowed = 'POST'
class SimpleIO(CreateEdit.SimpleIO):
input_required = ('name', 'is_active', 'address', 'timeout', 'ping_path', 'options', 'pool_size')
output_required = ('id', 'name')
def success_message(self, item):
return 'Successfully {} the Solr connection [{}]'.format(self.verb, item.name)
class Create(_CreateEdit):
url_name = 'search-solr-create'
service_name = 'zato.search.solr.create'
class Edit(_CreateEdit):
url_name = 'search-solr-edit'
form_prefix = 'edit-'
service_name = 'zato.search.solr.edit'
class Delete(_Delete):
url_name = 'search-solr-delete'
error_msolrsage = 'Could not delete the Solr connection'
service_name = 'zato.search.solr.delete'
@method_allowed('POST')
def ping(req, id, cluster_id):
ret = id_only_service(req, 'zato.search.solr.ping', id, 'Could not ping the Solr connection, e:`{}`')
if isinstance(ret, HttpResponseServerError):
return ret
return HttpResponse(ret.data.info)
| 2,444
|
Python
|
.py
| 59
| 36.40678
| 112
| 0.686655
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,815
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/search/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
| 238
|
Python
|
.py
| 6
| 38.166667
| 82
| 0.729258
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,816
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/views/groups/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2024, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# stdlib
import logging
from json import dumps
from operator import attrgetter
from traceback import format_exc
# Django
from django.http import HttpResponse, HttpResponseBadRequest
from django.template.response import TemplateResponse
# Zato
from zato.admin.web.forms.groups import CreateForm, EditForm
from zato.admin.web.views import CreateEdit, Delete as _Delete, get_group_list as common_get_group_list, \
get_security_name_link, Index as _Index, method_allowed
from zato.common.api import Groups, SEC_DEF_TYPE_NAME
from zato.common.model.groups import GroupObject
# ################################################################################################################################
# ################################################################################################################################
if 0:
from zato.common.typing_ import any_, anylist, strdict, strlist, strnone
# ################################################################################################################################
# ################################################################################################################################
logger = logging.getLogger(__name__)
# ################################################################################################################################
# ################################################################################################################################
class Index(_Index):
method_allowed = 'GET'
url_name = 'groups'
template = 'zato/groups/index.html'
service_name = 'zato.groups.get-list'
output_class = GroupObject
paginate = True
class SimpleIO(_Index.SimpleIO):
input_required = ('group_type',)
output_required = ('type', 'id', 'name')
output_repeated = True
def get_initial_input(self) -> 'strdict':
return {
'cluster_id': self.cluster_id,
'group_type': self.input.group_type
}
def handle_return_data(self, return_data:'strdict') -> 'strdict':
return_data['group_type'] = Groups.Type.API_Clients
return_data['group_type_name_title'] = 'API Clients'
return return_data
def handle(self):
# Get information about how many members are in each group ..
response = self.req.zato.client.invoke('zato.groups.get-member-count', {
'group_type': Groups.Type.API_Clients,
})
member_count = response.data
return {
'member_count': member_count,
'create_form': CreateForm(self.req.POST),
'edit_form': EditForm(self.req.POST, prefix='edit'),
}
# ################################################################################################################################
# ################################################################################################################################
class _CreateEdit(CreateEdit):
method_allowed = 'POST'
class SimpleIO(CreateEdit.SimpleIO):
input_required = 'group_type', 'name'
input_optional = 'id',
output_required = 'id', 'name'
def success_message(self, item:'any_') -> 'str':
return 'Successfully {} group `{}`'.format(self.verb, item.name)
# ################################################################################################################################
# ################################################################################################################################
class Create(_CreateEdit):
url_name = 'groups-create'
service_name = 'zato.groups.create'
# ################################################################################################################################
# ################################################################################################################################
class Edit(_CreateEdit):
url_name = 'groups-edit'
form_prefix = 'edit-'
service_name = 'zato.groups.edit'
# ################################################################################################################################
# ################################################################################################################################
class Delete(_Delete):
url_name = 'groups-delete'
error_message = 'Could not delete groups'
service_name = 'zato.groups.delete'
# ################################################################################################################################
# ################################################################################################################################
def _extract_items_from_response(req:'any_', response:'any_') -> 'anylist':
# Type hints
item:'any_'
# Our response to produce
out:'anylist' = []
# .. preprocess all the items received ..
for item in response.data:
name = item['name']
if name in {'pubsub', 'ide_publisher', 'pubapi'}:
continue
elif 'zato.' in name:
continue
else:
sec_type = item['sec_type']
sec_name = item['name']
security_name = get_security_name_link(req, sec_type, sec_name, needs_type=False)
sec_type_name = SEC_DEF_TYPE_NAME[sec_type] # type: ignore
item['sec_type_name'] = sec_type_name
item['security_name'] = security_name
out.append(item)
# .. sort it in a human-readable way ..
out.sort(key=attrgetter('sec_type', 'name'))
# .. and return it to our caller.
return out
# ################################################################################################################################
# ################################################################################################################################
def _get_security_list(req:'any_', sec_type:'strnone | strlist'=None, query:'strnone'=None) -> 'anylist':
# Handle optional parameters
sec_type = sec_type or ['apikey', 'basic_auth']
# Obtain an initial list of members for this group ..
response = req.zato.client.invoke('zato.security.get-list', {
'sec_type': sec_type,
'query': query,
'paginate': False,
})
# .. extract the business data ..
out = _extract_items_from_response(req, response)
# .. and return it to our caller.
return out
# ################################################################################################################################
# ################################################################################################################################
def _get_member_list(req:'any_', group_type:'str', group_id:'int') -> 'anylist':
# Obtain an initial list of members for this group ..
response = req.zato.client.invoke('zato.groups.get-member-list', {
'group_type': group_type,
'group_id': group_id,
'should_serialize': True,
})
# .. extract the business data ..
out = _extract_items_from_response(req, response)
# .. and return it to our caller.
return out
# ################################################################################################################################
# ################################################################################################################################
def _filter_out_members_from_security_list(security_list:'anylist', member_list:'anylist') -> 'anylist':
out:'anylist' = []
for sec_item in security_list:
for member in member_list:
if sec_item.id == member.security_id:
break
else:
out.append(sec_item)
return out
# ################################################################################################################################
# ################################################################################################################################
@method_allowed('POST')
def get_security_list(req:'any_') -> 'HttpResponse':
sec_type = req.GET.get('sec_type')
query = req.GET.get('query')
group_type = req.GET.get('group_type')
group_id = req.GET.get('group_id')
member_list = _get_member_list(req, group_type, group_id)
security_list = _get_security_list(req, sec_type, query)
security_list = _filter_out_members_from_security_list(security_list, member_list)
data = dumps(security_list)
return HttpResponse(data, content_type='application/javascript')
# ################################################################################################################################
# ################################################################################################################################
@method_allowed('POST')
def get_member_list(req:'any_') -> 'HttpResponse':
group_type = req.GET.get('group_type')
group_id = req.GET.get('group_id')
member_list = _get_member_list(req, group_type, group_id)
data = dumps(member_list)
return HttpResponse(data, content_type='application/javascript')
# ################################################################################################################################
# ################################################################################################################################
@method_allowed('GET')
def manage_group_members(req:'any_', group_type:'str', group_id:'str | int') -> 'HttpResponse':
# Local variables
group_id = int(group_id)
template_name = 'zato/groups/members.html'
# Get a list of all groups that exist
group_list = common_get_group_list(req, group_type)
# Obtain an initial list of members for this group
member_list = _get_member_list(req, group_type, group_id)
# Obtain an initial list of security definitions
security_list = _get_security_list(req)
# Filter out security definitions with members that already exist in the current group
security_list = _filter_out_members_from_security_list(security_list, member_list)
# Build the return data for the template ..
return_data = {
'cluster_id': req.zato.cluster_id,
'group_type': group_type,
'group_id': group_id,
'group_list': group_list,
'member_list': member_list,
'security_list': security_list,
}
# .. and return everything to our caller.
return TemplateResponse(req, template_name, return_data)
# ################################################################################################################################
# ################################################################################################################################
@method_allowed('POST')
def members_action(req:'any_', action:'str', group_id:'str', member_id_list:'str') -> 'HttpResponse':
# Local variables
group_id = group_id.replace('group-', '')
member_id_list = member_id_list.split(',') # type: ignore
member_id_list = [elem.strip() for elem in member_id_list] # type: ignore
# Invoke the remote service ..
try:
_ = req.zato.client.invoke('zato.groups.edit-member-list', {
'group_action': action,
'group_id': group_id,
'member_id_list': member_id_list
})
except Exception:
response = format_exc()
response_class = HttpResponseBadRequest
else:
response = ''
response_class = HttpResponse
finally:
return response_class(response, content_type='text/plain') # type: ignore
# ################################################################################################################################
# ################################################################################################################################
@method_allowed('POST')
def get_group_list(req:'any_', group_type:'str') -> 'HttpResponse':
http_soap_channel_id = req.GET.get('http_soap_channel_id')
group_list = common_get_group_list(req, group_type, http_soap_channel_id=http_soap_channel_id)
data = dumps(group_list)
return HttpResponse(data, content_type='application/javascript')
# ################################################################################################################################
# ################################################################################################################################
| 12,707
|
Python
|
.py
| 232
| 49.206897
| 130
| 0.42183
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,817
|
cluster.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/cluster.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.common.util.api import make_repr
# We let the user delete a cluster only if the answer on the form is equal to the
# one given below.
OK_TO_DELETE = 'GO AHEAD'
class EditClusterForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
description = forms.CharField(widget=forms.Textarea(), required=False)
lb_host = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
lb_port = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
lb_agent_port = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
def __repr__(self):
return make_repr(self)
class DeleteClusterForm(forms.Form):
answer = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:10%'}))
cluster_id = forms.CharField(widget=forms.HiddenInput(attrs={'class':'required'}))
def clean_answer(self):
data = self.cleaned_data['answer']
if data != OK_TO_DELETE:
msg = "Can't delete the cluster, answer [{data}] wasn't equal to [{expected}]".format(
data=data, expected=OK_TO_DELETE)
raise Exception(msg)
return data
class EditServerForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
old_name = forms.CharField(widget=forms.HiddenInput(attrs={'class':'required'}))
| 1,735
|
Python
|
.py
| 34
| 46.235294
| 101
| 0.699645
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,818
|
http_soap.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/http_soap.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2022, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_sec_tls_ca_cert_id_select, add_security_select, add_select, add_services, \
SearchForm as _ChooseClusterForm, DataFormatForm, WithAuditLog
from zato.common.api import DEFAULT_HTTP_PING_METHOD, DEFAULT_HTTP_POOL_SIZE, HTTP_SOAP, HTTP_SOAP_SERIALIZATION_TYPE, \
MISC, PARAMS_PRIORITY, RATE_LIMIT, SIMPLE_IO, SOAP_VERSIONS, URL_PARAMS_PRIORITY
# ################################################################################################################################
params_priority = (
(PARAMS_PRIORITY.CHANNEL_PARAMS_OVER_MSG, 'URL over message'),
(PARAMS_PRIORITY.MSG_OVER_CHANNEL_PARAMS, 'Message over URL'),
)
# ################################################################################################################################
url_params_priority = (
(URL_PARAMS_PRIORITY.QS_OVER_PATH, 'QS over path'),
(URL_PARAMS_PRIORITY.PATH_OVER_QS, 'Path over QS'),
)
# ################################################################################################################################
# ################################################################################################################################
class CreateForm(DataFormatForm, WithAuditLog):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
host = forms.CharField(initial='http://', widget=forms.TextInput(attrs={'style':'width:100%'}))
url_path = forms.CharField(initial='/', widget=forms.TextInput(attrs={'style':'width:100%'}))
match_slash = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
merge_url_params_req = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
url_params_pri = forms.ChoiceField(widget=forms.Select())
params_pri = forms.ChoiceField(widget=forms.Select())
serialization_type = forms.ChoiceField(widget=forms.Select())
sec_tls_ca_cert_id = forms.ChoiceField(widget=forms.Select())
method = forms.CharField(widget=forms.TextInput(attrs={'style':'width:20%'}))
soap_action = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
soap_version = forms.ChoiceField(widget=forms.Select())
service = forms.ChoiceField(widget=forms.Select(attrs={'class':'required', 'style':'width:100%'}))
ping_method = forms.CharField(widget=forms.TextInput(attrs={'style':'width:20%'}))
pool_size = forms.CharField(widget=forms.TextInput(attrs={'style':'width:10%'}))
timeout = forms.CharField(widget=forms.TextInput(attrs={'style':'width:10%'}), initial=MISC.DEFAULT_HTTP_TIMEOUT)
security = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:100%'}))
has_rbac = forms.BooleanField(required=False, widget=forms.CheckboxInput())
content_type = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
connection = forms.CharField(widget=forms.HiddenInput())
transport = forms.CharField(widget=forms.HiddenInput())
cache_id = forms.ChoiceField(widget=forms.Select())
cache_expiry = forms.CharField(widget=forms.TextInput(attrs={'style':'width:20%'}), initial=0)
content_encoding = forms.CharField(widget=forms.TextInput(attrs={'style':'width:20%'}))
data_formats_allowed = SIMPLE_IO.HTTP_SOAP_FORMAT
http_accept = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}), initial=HTTP_SOAP.ACCEPT.ANY)
is_rate_limit_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
rate_limit_check_parent_def = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
rate_limit_type = forms.ChoiceField(widget=forms.Select(), initial=RATE_LIMIT.TYPE.APPROXIMATE)
rate_limit_def = forms.CharField(widget=forms.Textarea(
attrs={'style':'overflow:auto; width:100%; white-space: pre-wrap;height:100px'}))
hl7_version = forms.CharField(widget=forms.HiddenInput())
json_path = forms.CharField(widget=forms.HiddenInput())
data_encoding = forms.CharField(widget=forms.HiddenInput())
def __init__(self, security_list=None, sec_tls_ca_cert_list=None, cache_list=None, soap_versions=SOAP_VERSIONS,
prefix=None, post_data=None, req=None):
security_list = security_list or []
sec_tls_ca_cert_list = sec_tls_ca_cert_list or {}
cache_list = cache_list or []
super(CreateForm, self).__init__(post_data, prefix=prefix)
super(WithAuditLog).__init__()
self.fields['url_params_pri'].choices = []
for value, label in url_params_priority:
self.fields['url_params_pri'].choices.append([value, label])
self.fields['params_pri'].choices = []
for value, label in params_priority:
self.fields['params_pri'].choices.append([value, label])
self.fields['serialization_type'].choices = []
for item in HTTP_SOAP_SERIALIZATION_TYPE():
self.fields['serialization_type'].choices.append([item.id, item.name])
self.fields['soap_version'].choices = []
for name in sorted(soap_versions):
self.fields['soap_version'].choices.append([name, name])
self.fields['ping_method'].initial = DEFAULT_HTTP_PING_METHOD
self.fields['pool_size'].initial = DEFAULT_HTTP_POOL_SIZE
add_security_select(self, security_list)
add_sec_tls_ca_cert_id_select(req, self)
add_services(self, req)
add_select(self, 'cache_id', cache_list)
add_select(self, 'rate_limit_type', RATE_LIMIT.TYPE(), needs_initial_select=False)
# ################################################################################################################################
# ################################################################################################################################
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
merge_url_params_req = forms.BooleanField(required=False, widget=forms.CheckboxInput())
match_slash = forms.BooleanField(required=False, widget=forms.CheckboxInput())
has_rbac = forms.BooleanField(required=False, widget=forms.CheckboxInput())
# ################################################################################################################################
# ################################################################################################################################
class SearchForm(_ChooseClusterForm):
connection = forms.CharField(widget=forms.HiddenInput())
transport = forms.CharField(widget=forms.HiddenInput())
def __init__(self, clusters, data=None):
super(SearchForm, self).__init__(clusters, data)
self.initial['connection'] = data.get('connection') or ''
self.initial['transport'] = data.get('transport') or ''
# ################################################################################################################################
# ################################################################################################################################
| 7,459
|
Python
|
.py
| 104
| 66.163462
| 130
| 0.585859
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,819
|
config_file.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/config_file.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
data = forms.CharField(widget=forms.Textarea(attrs={'style':'overflow:auto; width:100%; white-space: pre-wrap;height:400px'}))
class EditForm(CreateForm):
pass
| 554
|
Python
|
.py
| 13
| 40.230769
| 130
| 0.740187
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,820
|
account.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/account.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# pytz
from pytz import common_timezones
# Zato
from zato.admin.web import DATE_FORMATS, TIME_FORMATS
class BasicSettingsForm(forms.Form):
""" All the basic settings not including cluster color markers.
"""
timezone = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:100%'}))
date_format = forms.ChoiceField()
time_format = forms.ChoiceField()
totp_key = forms.CharField(widget=forms.TextInput(attrs={'style':'width:27%'}))
totp_key_label = forms.CharField(widget=forms.TextInput(attrs={'style':'width:27%', 'maxlength':25}))
totp_key_provision_uri = forms.CharField(widget=forms.HiddenInput())
def __init__(self, initial, *args, **kwargs):
super(BasicSettingsForm, self).__init__(initial, *args, **kwargs)
self.fields['timezone'].choices = ((item, item) for item in common_timezones)
self.fields['date_format'].choices = ((item, item) for item in sorted(DATE_FORMATS))
self.fields['time_format'].choices = ((item, '{}-hour'.format(item)) for item in sorted(TIME_FORMATS))
| 1,330
|
Python
|
.py
| 26
| 47.192308
| 110
| 0.70888
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,821
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Python 2/3 compatibility
from zato.common.ext.future.utils import iteritems
from zato.common.py23_.past.builtins import basestring
# Zato
from zato.common.api import AuditLog, DELEGATED_TO_RBAC, RATE_LIMIT, SIMPLE_IO, TLS, ZATO_DEFAULT, ZATO_NONE, ZATO_SEC_USE_RBAC
# ################################################################################################################################
INITIAL_CHOICES_DICT = {'': '----------'}
Initial_Choices_Dict_Attrs = {'id':'', 'name':'----------'}
INITIAL_CHOICES = list(iteritems(INITIAL_CHOICES_DICT))[0]
# ################################################################################################################################
SELECT_SERVICE_FIELDS = [
'hook_service_id',
'hook_service_name',
'on_close_service_name',
'on_connect_service_name',
'on_message_service_name',
'service',
'service_id',
'service_list',
'service_name',
]
# ################################################################################################################################
SELECT_TOPICS_FIELDS = [
'topic_list',
'topic_name',
]
# ################################################################################################################################
def add_initial_select(form, field_name):
form.fields[field_name].choices = []
form.fields[field_name].choices.append(INITIAL_CHOICES)
# ################################################################################################################################
def add_select(form, field_name, elems, needs_initial_select=True, skip=None):
skip = skip or []
if not isinstance(skip, (list, tuple)):
skip = [skip]
if needs_initial_select:
add_initial_select(form, field_name)
else:
form.fields[field_name].choices = []
for elem in elems:
if isinstance(elem, basestring):
id = elem
name = elem
else:
id = getattr(elem, 'id', None) or elem['id']
name = getattr(elem, 'name', None) or elem['name']
if id in skip:
continue
form.fields[field_name].choices.append([id, name])
# ################################################################################################################################
def add_security_select(form, security_list, needs_no_security=True, field_name='security', needs_rbac=True):
form.fields[field_name].choices = []
form.fields[field_name].choices.append(INITIAL_CHOICES)
if needs_no_security:
form.fields[field_name].choices.append([ZATO_NONE, 'No security definition'])
if needs_rbac:
form.fields[field_name].choices.append([ZATO_SEC_USE_RBAC, DELEGATED_TO_RBAC])
for value, label in security_list:
form.fields[field_name].choices.append([value, label])
# ################################################################################################################################
def add_sec_tls_ca_cert_id_select(req, form):
from zato.admin.web.views import get_tls_ca_cert_list
tls_ca_cert_list = get_tls_ca_cert_list(req.zato.client, req.zato.cluster)
form.fields['sec_tls_ca_cert_id'].choices = []
form.fields['sec_tls_ca_cert_id'].choices.append([ZATO_DEFAULT, 'Default bundle'])
form.fields['sec_tls_ca_cert_id'].choices.append([ZATO_NONE, 'Skip validation'])
for value, label in tls_ca_cert_list.items():
form.fields['sec_tls_ca_cert_id'].choices.append([value, label])
# ################################################################################################################################
def add_http_soap_select(form, field_name, req, connection, transport, needs_initial_select=True, skip=None):
skip = skip or []
if not isinstance(skip, (list, tuple)):
skip = [skip]
if needs_initial_select:
add_initial_select(form, field_name)
else:
form.fields[field_name].choices = []
field = form.fields[field_name]
if req.zato.cluster_id:
response = req.zato.client.invoke('zato.http-soap.get-list', {
'cluster_id': req.zato.cluster_id,
'connection': connection,
'transport': transport,
})
for item in response.data:
field.choices.append([item.id, item.name])
# ################################################################################################################################
def add_services(form, req, by_id=False, initial_service=None, api_name='zato.service.get-list', has_name_filter=True,
should_include_scheduler=False):
if req.zato.cluster_id:
fields = {}
for name in SELECT_SERVICE_FIELDS:
field = form.fields.get(name)
if field:
fields[name] = field
if not fields:
raise ValueError('Could not find any service field (tried: `{}` in `{}`)'.format(
SELECT_SERVICE_FIELDS, form.fields))
for field_name, field in fields.items():
field.choices = []
field.choices.append(INITIAL_CHOICES)
request = {
'cluster_id': req.zato.cluster_id,
'name_filter':'*',
'should_include_scheduler': should_include_scheduler,
}
if has_name_filter:
request['name_filter'] = '*'
response = req.zato.client.invoke(api_name, request)
data = response.data
for service in data:
# Older parts of web-admin use service names only but newer ones prefer service ID
id_attr = service.id if by_id else service.name
field.choices.append([id_attr, service.name])
if initial_service:
form.initial[field_name] = initial_service
# ################################################################################################################################
def add_pubsub_services(form, req, by_id=False, initial_service=None):
return add_services(form, req, by_id, initial_service, 'zato.pubsub.hook.get-hook-service-list', False)
# ################################################################################################################################
def add_topics(form, req, by_id=True):
return add_select_from_service(form, req, 'zato.pubsub.topic.get-list', SELECT_TOPICS_FIELDS, by_id=by_id)
# ################################################################################################################################
def add_select_from_service(form, req, service_name, field_names, by_id=True, service_extra=None):
if req.zato.cluster_id:
field_names = field_names if isinstance(field_names, list) else [field_names]
field = None
for name in field_names:
field = form.fields.get(name)
if field:
break
field.choices = []
field.choices.append(INITIAL_CHOICES)
service_request = {'cluster_id': req.zato.cluster_id}
service_request.update(service_extra or {})
response = req.zato.client.invoke(service_name, service_request)
response = response.data if isinstance(response.data, list) else response.data.response
for item in response:
id_attr = item.id if by_id else item.name
field.choices.append([id_attr, item.name])
# ################################################################################################################################
# ################################################################################################################################
class SearchForm(forms.Form):
cluster = forms.ChoiceField(widget=forms.Select())
query = forms.CharField(widget=forms.TextInput(
attrs={'style':'width:40%', 'class':'required', 'placeholder':'Enter search terms'}))
def __init__(self, clusters, data=None):
data = data or {}
#
# https://github.com/zatosource/zato/issues/361
#
# If the length is 1 it we have only one cluster defined in ODB.
# This means we can make use that only one straightaway to display anything that is needed.
#
if len(clusters) == 1:
initial = dict(iteritems(data))
initial.update({'cluster':clusters[0].id})
self.zato_auto_submit = True
else:
initial = {'query': data.get('query', '')}
self.zato_auto_submit = False
super(SearchForm, self).__init__(initial)
self.fields['cluster'].choices = [INITIAL_CHOICES]
for cluster in clusters:
server_info = '{0} - http://{1}:{2}'.format(cluster.name, cluster.lb_host, cluster.lb_port)
self.fields['cluster'].choices.append([cluster.id, server_info])
self.initial['cluster'] = (data.get('cluster') or [''])[0]
# ################################################################################################################################
# ################################################################################################################################
class ChangePasswordForm(forms.Form):
password1 = forms.CharField(widget=forms.PasswordInput(
attrs={'class':'required', 'style':'width:100%'}))
password2 = forms.CharField(widget=forms.PasswordInput(
attrs={'class':'required validate-password-confirm', 'style':'width:100%'}))
# ################################################################################################################################
# ################################################################################################################################
class DataFormatForm(forms.Form):
data_format = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:100px'}))
data_formats_allowed = None
def __init__(self, *args, **kwargs):
super(DataFormatForm, self).__init__(*args, **kwargs)
self.fields['data_format'].choices = []
self.fields['data_format'].choices.append(INITIAL_CHOICES)
for code, name in iteritems(self.data_formats_allowed or SIMPLE_IO.COMMON_FORMAT):
self.fields['data_format'].choices.append([code, name])
# ################################################################################################################################
# ################################################################################################################################
class UploadForm(forms.Form):
file = forms.FileField(widget=forms.FileInput(attrs={'size':'70'}))
# ################################################################################################################################
# ################################################################################################################################
class WithTLSForm(forms.Form):
is_tls_enabled = forms.BooleanField(required=False, widget=forms.CheckboxInput())
tls_private_key_file = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
tls_cert_file = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
tls_ca_certs_file = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
tls_crl_file = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
tls_version = forms.ChoiceField(widget=forms.Select(), initial=TLS.DEFAULT.VERSION)
tls_validate = forms.ChoiceField(widget=forms.Select(), initial=TLS.CERT_VALIDATE.CERT_REQUIRED.id)
tls_pem_passphrase = forms.CharField(widget=forms.PasswordInput(attrs={'style':'width:100%'}))
is_tls_match_hostname_enabled = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
tls_ciphers = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}), initial=TLS.DEFAULT.CIPHERS)
def __init__(self, prefix=None, post_data=None):
super(WithTLSForm, self).__init__(post_data, prefix=prefix)
add_select(self, 'tls_version', TLS.VERSION(), needs_initial_select=False)
add_select(self, 'tls_validate', TLS.CERT_VALIDATE(), needs_initial_select=False)
# ################################################################################################################################
# ################################################################################################################################
class WithJSONSchema(forms.Form):
is_json_schema_enabled = forms.BooleanField(required=False, widget=forms.CheckboxInput())
needs_json_schema_err_details = forms.BooleanField(required=False, widget=forms.CheckboxInput())
# ################################################################################################################################
# ################################################################################################################################
class WithRateLimiting(forms.Form):
rate_limit_type = forms.ChoiceField(widget=forms.Select(), initial=RATE_LIMIT.TYPE.APPROXIMATE)
rate_limit_def = forms.CharField(widget=forms.Textarea(
attrs={'style':'overflow:auto; width:100%; white-space: pre-wrap;height:100px'}))
def __init__(self, *args, **kwargs):
super(WithRateLimiting, self).__init__(*args, **kwargs)
add_select(self, 'rate_limit_type', RATE_LIMIT.TYPE(), needs_initial_select=False)
# ################################################################################################################################
# ################################################################################################################################
class WithAuditLog(forms.Form):
is_audit_log_sent_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
is_audit_log_received_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
max_len_messages_sent = forms.CharField(
initial=AuditLog.Default.max_len_messages, widget=forms.TextInput(attrs={'style':'width:10%'}))
max_len_messages_received = forms.CharField(
initial=AuditLog.Default.max_len_messages, widget=forms.TextInput(attrs={'style':'width:10%'}))
max_bytes_per_message_sent = forms.CharField(
initial=AuditLog.Default.max_data_stored_per_message, widget=forms.TextInput(attrs={'style':'width:13%'}))
max_bytes_per_message_received = forms.CharField(
initial=AuditLog.Default.max_data_stored_per_message, widget=forms.TextInput(attrs={'style':'width:13%'}))
# ################################################################################################################################
# ################################################################################################################################
| 15,160
|
Python
|
.py
| 243
| 55.436214
| 130
| 0.491664
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,822
|
scheduler.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/scheduler.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2021, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_services
class _Base(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
service = forms.ChoiceField(widget=forms.Select(attrs={'class':'required', 'style':'width:100%'}))
extra = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%'}))
start_date = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:30%; height:19px'}))
def __init__(self, prefix, req):
super(_Base, self).__init__(prefix=prefix)
add_services(self, req, should_include_scheduler=True)
class OneTimeSchedulerJobForm(_Base):
pass
class IntervalBasedSchedulerJobForm(_Base):
# Attributes specific to interval-based jobs.
weeks = forms.CharField(widget=forms.TextInput(attrs={'class':'validate-digits', 'style':'width:8%'}))
days = forms.CharField(widget=forms.TextInput(attrs={'class':'validate-digits', 'style':'width:8%'}))
hours = forms.CharField(widget=forms.TextInput(attrs={'class':'validate-digits', 'style':'width:8%'}))
minutes = forms.CharField(widget=forms.TextInput(attrs={'class':'validate-digits', 'style':'width:8%'}))
seconds = forms.CharField(widget=forms.TextInput(attrs={'class':'validate-digits', 'style':'width:8%'}))
start_date = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:30%; height:19px'}))
repeats = forms.CharField(widget=forms.TextInput(attrs={'style':'width:8%'}))
class CronStyleSchedulerJobForm(_Base):
cron_definition = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
| 2,021
|
Python
|
.py
| 32
| 59.25
| 118
| 0.715152
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,823
|
service.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/service.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.admin.web.forms import UploadForm, WithJSONSchema, WithRateLimiting
class CreateForm(WithJSONSchema, WithRateLimiting):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
slow_threshold = forms.CharField(widget=forms.TextInput(attrs={'style':'width:15%'}))
is_rate_limit_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
rate_limit_check_parent_def = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'style':'text-align:left'}))
class WSDLUploadForm(UploadForm):
pass
| 1,015
|
Python
|
.py
| 19
| 50.736842
| 125
| 0.772267
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,824
|
stats.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/stats.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.admin.web.forms import INITIAL_CHOICES
class NForm(forms.Form):
n = forms.IntegerField(widget=forms.TextInput(attrs={'style':'width:30px', 'id':'n'}))
class CompareForm(forms.Form):
compare_to = forms.ChoiceField(widget=forms.Select(attrs={'id':'shift'}))
def __init__(self, compare_to=None, *args, **kwargs):
compare_to = compare_to or []
super(CompareForm, self).__init__(*args, **kwargs)
for name, value in self.fields.items():
if isinstance(value, forms.ChoiceField):
self.fields[name].choices = [INITIAL_CHOICES]
for name, label in compare_to:
self.fields['compare_to'].choices.append([name, label])
self.fields['compare_to'].choices.append(['custom', 'Choose a time span ..'])
class SettingsForm(forms.Form):
""" Various statistics settings.
"""
scheduler_raw_times_interval = forms.CharField(widget=forms.TextInput(attrs={'style':'width:20%'}))
scheduler_raw_times_batch = forms.CharField(widget=forms.TextInput(attrs={'style':'width:20%'}))
scheduler_per_minute_aggr_interval = forms.CharField(widget=forms.TextInput(attrs={'style':'width:20%'}))
atttention_slow_threshold = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100px'}))
atttention_top_threshold = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100px'}))
class MaintenanceForm(forms.Form):
""" Statistics maintenance.
"""
start = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:150px; height:19px'}))
stop = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:150px; height:19px'}))
| 1,977
|
Python
|
.py
| 36
| 49.777778
| 115
| 0.698133
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,825
|
main.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/main.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class AuthenticationForm(forms.Form):
""" A form to log a user in.
"""
username = forms.CharField(max_length=254)
password = forms.CharField(strip=False, widget=forms.PasswordInput)
totp_code = forms.CharField(widget=forms.TextInput())
| 530
|
Python
|
.py
| 14
| 35.071429
| 82
| 0.733855
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,826
|
load_balancer.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/load_balancer.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
from operator import itemgetter
# Django
from django import forms
# Zato
from zato.common.haproxy import timeouts, http_log
from zato.common.util.api import make_repr
def populate_choices(form, fields_choices):
""" A convenience function used in several places for populating a given
form's SELECT choices.
"""
for field_name, choices in fields_choices:
form.fields[field_name].choices = []
choices = sorted(choices.items(), key=itemgetter(0))
for choice_id, choice_info in choices:
choice_name = choice_info[1]
form.fields[field_name].choices.append([choice_id, choice_name])
class ManageLoadBalancerForm(forms.Form):
""" Form for the graphical management of HAProxy.
"""
global_log_host = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:70%'}))
global_log_port = forms.CharField(widget=forms.TextInput(attrs={'class':'required validate-digits', 'style':'width:70%'}))
global_log_facility = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:70%'}))
global_log_level = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:70%'}))
timeout_connect = forms.CharField(widget=forms.TextInput(attrs={'class':'required validate-digits', 'style':'width:30%'}))
timeout_client = forms.CharField(widget=forms.TextInput(attrs={'class':'required validate-digits', 'style':'width:30%'}))
timeout_server = forms.CharField(widget=forms.TextInput(attrs={'class':'required validate-digits', 'style':'width:30%'}))
http_plain_bind_address = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:70%'}))
http_plain_bind_port = forms.CharField(widget=forms.TextInput(attrs={'class':'required validate-digits', 'style':'width:30%'}))
http_plain_log_http_requests = forms.ChoiceField()
http_plain_maxconn = forms.CharField(widget=forms.TextInput(attrs={'class':'required validate-digits', 'style':'width:30%'}))
http_plain_monitor_uri = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:70%'}))
def __init__(self, initial=None):
initial = initial or {}
super(ManageLoadBalancerForm, self).__init__(initial=initial)
fields_choices = (
('http_plain_log_http_requests', http_log),
)
populate_choices(self, fields_choices)
def __repr__(self):
return make_repr(self)
class ManageLoadBalancerSourceCodeForm(forms.Form):
""" Form for the source code-level management of HAProxy.
"""
source_code = forms.CharField(widget=forms.Textarea(attrs={'style':'overflow:auto; width:100%; white-space: pre-wrap;height:400px'}))
class RemoteCommandForm(forms.Form):
""" Form for the direct interface to HAProxy's commands.
"""
command = forms.ChoiceField()
timeout = forms.ChoiceField()
extra = forms.CharField(widget=forms.TextInput(attrs={'style':'width:40%'}))
result = forms.CharField(widget=forms.Textarea(attrs={'style':'overflow:auto; width:100%; white-space: pre-wrap;height:400px'}))
def __init__(self, commands, initial=None):
initial = initial or {}
super(RemoteCommandForm, self).__init__(initial=initial)
fields_choices = (
('command', commands),
('timeout', timeouts),
)
populate_choices(self, fields_choices)
def __repr__(self):
return make_repr(self)
| 3,742
|
Python
|
.py
| 68
| 49.294118
| 137
| 0.695022
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,827
|
twilio.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/sms/twilio.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
account_sid = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
auth_token = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
default_from = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
default_to = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 1,067
|
Python
|
.py
| 18
| 56.166667
| 107
| 0.732502
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,828
|
microsoft_365.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/cloud/microsoft_365.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2022, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# Django
from django import forms
# Zato
from zato.admin.web.forms import WithAuditLog
from zato.common.api import Microsoft365 as Microsoft365Common
# ################################################################################################################################
# ################################################################################################################################
_default = Microsoft365Common.Default
# ################################################################################################################################
# ################################################################################################################################
class CreateForm(WithAuditLog):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
tenant_id = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
client_id = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
secret_value = forms.CharField(widget=forms.PasswordInput(attrs={'style':'width:100%'}))
scopes = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%'}), initial='\n'.join(_default.Scopes))
# ################################################################################################################################
# ################################################################################################################################
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
# ################################################################################################################################
# ################################################################################################################################
| 2,115
|
Python
|
.py
| 28
| 73.035714
| 130
| 0.374337
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,829
|
confluence.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/cloud/confluence.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2022, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# Django
from django import forms
# Zato
from zato.admin.web.forms import WithAuditLog
from zato.common.api import Atlassian as AtlassianCommon
# ################################################################################################################################
# ################################################################################################################################
_default = AtlassianCommon.Default
# ################################################################################################################################
# ################################################################################################################################
class CreateForm(WithAuditLog):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
is_cloud = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
api_version = forms.CharField(widget=forms.TextInput(attrs={'style':'width:20%'}), initial=_default.API_Version)
address = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}), initial=_default.Address)
username = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
password = forms.CharField(strip=False, widget=forms.PasswordInput(attrs={'style':'width:100%'}))
# ################################################################################################################################
# ################################################################################################################################
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
is_cloud = forms.BooleanField(required=False, widget=forms.CheckboxInput())
# ################################################################################################################################
# ################################################################################################################################
| 2,324
|
Python
|
.py
| 30
| 74.8
| 130
| 0.411404
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,830
|
salesforce.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/cloud/salesforce.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# Django
from django import forms
# Zato
from zato.admin.web.forms import WithAuditLog
from zato.common.api import SALESFORCE
# ################################################################################################################################
# ################################################################################################################################
_default = SALESFORCE.Default
# ################################################################################################################################
# ################################################################################################################################
class CreateForm(WithAuditLog):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
api_version = forms.CharField(widget=forms.TextInput(attrs={'style':'width:20%'}), initial=_default.API_Version)
address = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}), initial=_default.Address)
username = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
password = forms.CharField(strip=False, widget=forms.PasswordInput(attrs={'style':'width:100%'}))
consumer_key = forms.CharField(strip=False, widget=forms.PasswordInput(attrs={'style':'width:100%'}))
consumer_secret = forms.CharField(strip=False, widget=forms.PasswordInput(attrs={'style':'width:100%'}))
# ################################################################################################################################
# ################################################################################################################################
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
# ################################################################################################################################
# ################################################################################################################################
| 2,323
|
Python
|
.py
| 30
| 74.766667
| 130
| 0.407635
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,831
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/cloud/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
| 238
|
Python
|
.py
| 6
| 38.166667
| 82
| 0.729258
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,832
|
dropbox.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/cloud/dropbox.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.common.api import DROPBOX
# ################################################################################################################################
# ################################################################################################################################
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
pool_size = forms.CharField(
widget=forms.TextInput(attrs={'style':'width:12%'}), initial=DROPBOX.DEFAULT.POOL_SIZE)
max_retries_on_error = forms.CharField(
widget=forms.TextInput(attrs={'style':'width:12%'}), initial=DROPBOX.DEFAULT.MAX_RETRIES_ON_ERROR)
max_retries_on_rate_limit = forms.CharField(
widget=forms.TextInput(attrs={'style':'width:12%'}), initial=DROPBOX.DEFAULT.MAX_RETRIES_ON_RATE_LIMIT)
timeout = forms.CharField(widget=forms.TextInput(attrs={'style':'width:12%'}), initial=DROPBOX.DEFAULT.TIMEOUT)
oauth2_access_token_expiration = forms.CharField(
widget=forms.TextInput(attrs={'style':'width:12%'}), initial=DROPBOX.DEFAULT.OAUTH2_ACCESS_TOKEN_EXPIRATION)
oauth2_access_token = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
default_scope = forms.CharField(widget=forms.TextInput(attrs={'style':'width:30%'}))
default_directory = forms.CharField(widget=forms.TextInput(attrs={'style':'width:46.7%'}))
user_agent = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
http_headers = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%; height:90px'}))
def __init__(self, prefix=None, req=None):
super(CreateForm, self).__init__(prefix=prefix)
# ################################################################################################################################
# ################################################################################################################################
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
# ################################################################################################################################
# ################################################################################################################################
| 2,737
|
Python
|
.py
| 37
| 69.891892
| 130
| 0.516779
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,833
|
jira.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/cloud/jira.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2022, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# Django
from django import forms
# Zato
from zato.admin.web.forms import WithAuditLog
from zato.common.api import Atlassian as AtlassianCommon
# ################################################################################################################################
# ################################################################################################################################
_default = AtlassianCommon.Default
# ################################################################################################################################
# ################################################################################################################################
class CreateForm(WithAuditLog):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
is_cloud = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
api_version = forms.CharField(widget=forms.TextInput(attrs={'style':'width:20%'}), initial=_default.API_Version)
address = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}), initial=_default.Address)
username = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
password = forms.CharField(strip=False, widget=forms.PasswordInput(attrs={'style':'width:100%'}))
# ################################################################################################################################
# ################################################################################################################################
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
is_cloud = forms.BooleanField(required=False, widget=forms.CheckboxInput())
# ################################################################################################################################
# ################################################################################################################################
| 2,324
|
Python
|
.py
| 30
| 74.8
| 130
| 0.411404
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,834
|
s3.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/cloud/aws/s3.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_security_select
from zato.common.api import CLOUD
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
pool_size = forms.CharField(initial=CLOUD.AWS.S3.DEFAULTS.POOL_SIZE, widget=forms.TextInput(attrs={'style':'width:15%'}))
debug_level = forms.CharField(initial=CLOUD.AWS.S3.DEFAULTS.DEBUG_LEVEL, widget=forms.TextInput(attrs={'style':'width:15%'}))
content_type = forms.CharField(initial=CLOUD.AWS.S3.DEFAULTS.CONTENT_TYPE, widget=forms.TextInput(attrs={'style':'width:100%'}))
suppr_cons_slashes = forms.BooleanField(initial=True, required=False, widget=forms.CheckboxInput())
address = forms.CharField(initial=CLOUD.AWS.S3.DEFAULTS.ADDRESS, widget=forms.TextInput(attrs={'style':'width:100%'}))
metadata_ = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%'}))
bucket = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
encrypt_at_rest = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
storage_class = forms.ChoiceField(widget=forms.Select())
security_id = forms.ChoiceField(widget=forms.Select())
def __init__(self, security_list=None, storage_class_list=None, prefix=None, post_data=None):
super(CreateForm, self).__init__(post_data, prefix=prefix)
add_security_select(self, security_list, False, 'security_id', False)
self.fields['storage_class'].choices = []
for name in CLOUD.AWS.S3.STORAGE_CLASS():
self.fields['storage_class'].choices.append([name, name])
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
suppr_cons_slashes = forms.BooleanField(required=False, widget=forms.CheckboxInput())
encrypt_at_rest = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 2,312
|
Python
|
.py
| 34
| 63.441176
| 132
| 0.737748
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,835
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/cloud/aws/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
| 238
|
Python
|
.py
| 6
| 38.166667
| 82
| 0.729258
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,836
|
ldap.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/ldap.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_select, WithTLSForm
from zato.common.api import LDAP
class CreateForm(WithTLSForm):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
get_info = forms.ChoiceField(widget=forms.Select(), initial=LDAP.GET_INFO.SCHEMA.id)
ip_mode = forms.ChoiceField(widget=forms.Select())
connect_timeout = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=LDAP.DEFAULT.CONNECT_TIMEOUT)
auto_bind = forms.ChoiceField(widget=forms.Select(), initial=LDAP.AUTO_BIND.DEFAULT)
server_list = forms.CharField(
widget=forms.Textarea(attrs={'style':'width:100%; height:30px'}), initial=LDAP.DEFAULT.Server_List)
pool_name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:29%'}))
pool_size = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=LDAP.DEFAULT.POOL_SIZE)
pool_exhaust_timeout = forms.CharField(
widget=forms.TextInput(attrs={'style':'width:9%'}), initial=LDAP.DEFAULT.POOL_EXHAUST_TIMEOUT)
pool_keep_alive = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=LDAP.DEFAULT.POOL_KEEP_ALIVE)
pool_max_cycles = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=LDAP.DEFAULT.POOL_MAX_CYCLES)
pool_lifetime = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=LDAP.DEFAULT.POOL_LIFETIME)
pool_ha_strategy = forms.ChoiceField(widget=forms.Select(), initial=LDAP.POOL_HA_STRATEGY.ROUND_ROBIN.id)
username = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}), initial=LDAP.DEFAULT.Username)
auth_type = forms.ChoiceField(widget=forms.Select())
sasl_mechanism = forms.ChoiceField(widget=forms.Select())
is_read_only = forms.BooleanField(required=False, widget=forms.CheckboxInput())
is_stats_enabled = forms.BooleanField(required=False, widget=forms.CheckboxInput())
should_check_names = forms.BooleanField(required=False, widget=forms.CheckboxInput())
use_auto_range = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
should_return_empty_attrs = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
def __init__(self, *args, **kwargs):
super(CreateForm, self).__init__(*args, **kwargs)
add_select(self, 'get_info', LDAP.GET_INFO(), needs_initial_select=False)
add_select(self, 'ip_mode', LDAP.IP_MODE(), needs_initial_select=False)
add_select(self, 'auto_bind', LDAP.AUTO_BIND(), needs_initial_select=False)
add_select(self, 'pool_ha_strategy', LDAP.POOL_HA_STRATEGY(), needs_initial_select=False)
add_select(self, 'auth_type', LDAP.AUTH_TYPE(), needs_initial_select=False)
add_select(self, 'sasl_mechanism', LDAP.SASL_MECHANISM(), needs_initial_select=True)
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
use_sasl_external = forms.BooleanField(required=False, widget=forms.CheckboxInput())
use_auto_range = forms.BooleanField(required=False, widget=forms.CheckboxInput())
should_return_empty_attrs = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 3,679
|
Python
|
.py
| 49
| 70.081633
| 127
| 0.738517
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,837
|
sftp.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/sftp.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.common.api import SFTP
from zato.admin.web.forms import add_select
# ################################################################################################################################
# ################################################################################################################################
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
log_level = forms.ChoiceField(widget=forms.Select())
host = forms.CharField(widget=forms.TextInput(attrs={'style':'width:70%'}))
port = forms.CharField(widget=forms.TextInput(attrs={'style':'width:12%'}), initial=SFTP.DEFAULT.PORT)
username = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
password = forms.CharField(widget=forms.TextInput(attrs={'style':'width:50%'}))
identity_file = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
ssh_config_file = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
sftp_command = forms.CharField(widget=forms.TextInput(attrs={'style':'width:40%'}), initial=SFTP.DEFAULT.COMMAND_SFTP)
ping_command = forms.CharField(widget=forms.TextInput(attrs={'style':'width:37%'}), initial=SFTP.DEFAULT.COMMAND_PING)
buffer_size = forms.CharField(widget=forms.TextInput(attrs={'style':'width:12%'}), initial=SFTP.DEFAULT.BUFFER_SIZE)
is_compression_enabled = forms.ChoiceField(widget=forms.Select())
bandwidth_limit = forms.CharField(widget=forms.TextInput(attrs={'style':'width:10%'}), initial=SFTP.DEFAULT.BANDWIDTH_LIMIT)
force_ip_type = forms.ChoiceField(widget=forms.Select())
should_flush = forms.BooleanField(required=False, widget=forms.CheckboxInput())
should_preserve_meta = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
default_directory = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
ssh_options = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%'}))
def __init__(self, prefix=None, req=None):
super(CreateForm, self).__init__(prefix=prefix)
add_select(self, 'log_level', SFTP.LOG_LEVEL(), needs_initial_select=False)
add_select(self, 'force_ip_type', SFTP.IP_TYPE())
# ################################################################################################################################
# ################################################################################################################################
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
# ################################################################################################################################
# ################################################################################################################################
class CommandShellForm(forms.Form):
data = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%; height:70px'}), initial='ls .')
stdout = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%; height:170px'}))
stderr = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%; height:270px'}))
log_level = forms.ChoiceField(widget=forms.Select())
def __init__(self):
super(CommandShellForm, self).__init__()
add_select(self, 'log_level', SFTP.LOG_LEVEL(), needs_initial_select=False)
# ################################################################################################################################
# ################################################################################################################################
| 4,151
|
Python
|
.py
| 53
| 74.226415
| 130
| 0.541442
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,838
|
sap.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/sap.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.common.api import SAP
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
host = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
sysnr = forms.CharField(initial=SAP.DEFAULT.INSTANCE, widget=forms.TextInput(attrs={'style':'width:10%'}))
sysid = forms.CharField(widget=forms.TextInput(attrs={'style':'width:20%'}))
user = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
client = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
router = forms.CharField(initial='', widget=forms.TextInput(attrs={'style':'width:100%'}))
pool_size = forms.CharField(initial=SAP.DEFAULT.POOL_SIZE, widget=forms.TextInput(attrs={'style':'width:10%'}))
def __init__(self, prefix=None, post_data=None):
super(CreateForm, self).__init__(post_data, prefix=prefix)
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 1,412
|
Python
|
.py
| 24
| 55.333333
| 115
| 0.726087
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,839
|
sql.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/sql.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_select_from_service
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
engine = forms.ChoiceField(widget=forms.Select(attrs={'class':'required', 'style':'width:50%'}))
host = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:50%'}))
port = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:20%'}))
db_name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:50%'}))
username = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:20%'}))
pool_size = forms.IntegerField(initial=1,
widget=forms.TextInput(attrs={'class':'required validate-digits', 'style':'width:40px'}))
extra = forms.CharField(widget=forms.Textarea(attrs={'style':'height:60px'}))
def __init__(self, req, prefix=None, post_data=None):
super(CreateForm, self).__init__(post_data, prefix=prefix)
add_select_from_service(self, req, 'zato.outgoing.sql.get-engine-list', 'engine')
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 1,638
|
Python
|
.py
| 26
| 59.076923
| 107
| 0.715711
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,840
|
odoo.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/odoo.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.common.api import ODOO
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
host = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
port = forms.CharField(initial=ODOO.DEFAULT.PORT, widget=forms.TextInput(attrs={'style':'width:10%'}))
user = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
database = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
protocol = forms.ChoiceField(widget=forms.Select())
pool_size = forms.CharField(initial=ODOO.DEFAULT.POOL_SIZE, widget=forms.TextInput(attrs={'style':'width:10%'}))
def __init__(self, prefix=None, post_data=None):
super(CreateForm, self).__init__(post_data, prefix=prefix)
self.fields['protocol'].choices = []
for item in ODOO.PROTOCOL():
self.fields['protocol'].choices.append([item.id, item.name])
class EditForm(CreateForm):
pass
| 1,376
|
Python
|
.py
| 26
| 48.653846
| 116
| 0.712155
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,841
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
| 154
|
Python
|
.py
| 5
| 29.4
| 64
| 0.687075
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,842
|
ftp.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/ftp.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
from ftplib import FTP_PORT
# Django
from django import forms
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
host = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
port = forms.CharField(initial=FTP_PORT, widget=forms.TextInput(attrs={'style':'width:10%'}))
user = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
acct = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
timeout = forms.CharField(widget=forms.TextInput(attrs={'style':'width:10%'}))
dircache = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
default_directory = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
def __init__(self, prefix=None, post_data=None):
super(CreateForm, self).__init__(post_data, prefix=prefix)
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
dircache = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 1,467
|
Python
|
.py
| 25
| 55.12
| 107
| 0.732915
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,843
|
wsx.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/wsx.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2023, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_security_select, add_services, DataFormatForm
from zato.common.api import WEB_SOCKET
class CreateForm(DataFormatForm):
data_format = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:60px'}))
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
is_zato = forms.BooleanField(required=False, widget=forms.CheckboxInput())
has_auto_reconnect = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
address = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%', 'placeholder':'wss://'}))
address_masked = forms.CharField(widget=forms.HiddenInput())
ping_interval = forms.CharField(initial=WEB_SOCKET.DEFAULT.PING_INTERVAL,
widget=forms.TextInput(attrs={'style':'width:10%'}))
pings_missed_threshold = forms.CharField(initial=WEB_SOCKET.DEFAULT.PINGS_MISSED_THRESHOLD_OUTGOING,
widget=forms.TextInput(attrs={'style':'width:10%', 'disabled':'disabled'}))
socket_read_timeout = forms.CharField(initial=WEB_SOCKET.DEFAULT.Socket_Read_Timeout,
widget=forms.TextInput(attrs={'style':'width:10%'}))
socket_write_timeout = forms.CharField(initial=WEB_SOCKET.DEFAULT.Socket_Write_Timeout,
widget=forms.TextInput(attrs={'style':'width:10%', 'disabled':'disabled'}))
on_connect_service_name = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:100%'}))
on_message_service_name = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:100%'}))
on_close_service_name = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:100%'}))
security_def = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:100%'}))
subscription_list = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%; height:60px'}))
def __init__(self, security_list=None, prefix=None, post_data=None, req=None):
super(CreateForm, self).__init__(post_data, prefix=prefix)
add_services(self, req, by_id=False)
add_security_select(self, security_list, field_name='security_def', needs_rbac=False)
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
is_zato = forms.BooleanField(required=False, widget=forms.CheckboxInput())
has_auto_reconnect = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 2,718
|
Python
|
.py
| 39
| 64.871795
| 116
| 0.735184
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,844
|
jms_wmq.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/jms_wmq.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
from operator import itemgetter
# Django
from django import forms
# Python 2/3 compatibility
from zato.common.ext.future.utils import iteritems
# Zato
from zato.admin.settings import delivery_friendly_name
from zato.common.odb.const import WMQ_DEFAULT_PRIORITY
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
delivery_mode = forms.ChoiceField(widget=forms.Select())
priority = forms.CharField(initial=WMQ_DEFAULT_PRIORITY, widget=forms.TextInput(attrs={'style':'width:5%'}))
expiration = forms.CharField(widget=forms.TextInput(attrs={'style':'width:20%'}))
def_id = forms.ChoiceField(widget=forms.Select())
def __init__(self, prefix=None, post_data=None):
super(CreateForm, self).__init__(post_data, prefix=prefix)
self.fields['delivery_mode'].choices = []
self.fields['def_id'].choices = []
# Sort modes by their friendly name.
modes = sorted(iteritems(delivery_friendly_name), key=itemgetter(1))
for mode, friendly_name in modes:
self.fields['delivery_mode'].choices.append([mode, friendly_name])
def set_def_id(self, def_ids):
# Sort definitions by their names.
def_ids = sorted(iteritems(def_ids), key=itemgetter(1))
for id, name in def_ids:
self.fields['def_id'].choices.append([id, name])
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 1,854
|
Python
|
.py
| 37
| 45.135135
| 112
| 0.714761
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,845
|
amqp_.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/amqp_.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
from operator import itemgetter
# Django
from django import forms
# Python 2/3 compatibility
from zato.common.ext.future.utils import iteritems
# Zato
from zato.admin.settings import delivery_friendly_name
from zato.common.api import AMQP
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
delivery_mode = forms.ChoiceField(widget=forms.Select())
priority = forms.CharField(initial=AMQP.DEFAULT.PRIORITY, widget=forms.TextInput(attrs={'style':'width:5%'}))
content_type = forms.CharField(widget=forms.TextInput(attrs={'style':'width:50%'}))
content_encoding = forms.CharField(widget=forms.TextInput(attrs={'style':'width:50%'}))
expiration = forms.CharField(widget=forms.TextInput(attrs={'style':'width:20%'}))
pool_size = forms.CharField(
initial=AMQP.DEFAULT.POOL_SIZE, widget=forms.TextInput(attrs={'style':'width:10%', 'class':'required'}))
user_id = forms.CharField(widget=forms.TextInput(attrs={'style':'width:50%'}))
app_id = forms.CharField(widget=forms.TextInput(attrs={'style':'width:50%'}))
def_id = forms.ChoiceField(widget=forms.Select())
def __init__(self, prefix=None, post_data=None):
super(CreateForm, self).__init__(post_data, prefix=prefix)
self.fields['delivery_mode'].choices = []
self.fields['def_id'].choices = []
# Sort modes by their friendly name.
modes = sorted(iteritems(delivery_friendly_name), key=itemgetter(1))
for mode, friendly_name in modes:
self.fields['delivery_mode'].choices.append([mode, friendly_name])
def set_def_id(self, def_ids):
# Sort AMQP definitions by their names.
def_ids = sorted(iteritems(def_ids), key=itemgetter(1))
for id, name in def_ids:
self.fields['def_id'].choices.append([id, name])
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 2,329
|
Python
|
.py
| 43
| 49.093023
| 113
| 0.71026
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,846
|
mongodb.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/mongodb.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_select, WithTLSForm
from zato.common.api import MONGODB
default = MONGODB.DEFAULT
timeout = default.TIMEOUT
class CreateForm(WithTLSForm):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
username = forms.CharField(widget=forms.TextInput(attrs={'style':'width:20%'}))
app_name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:30%'}))
replica_set = forms.CharField(widget=forms.TextInput(attrs={'style':'width:20%'}))
auth_source = forms.CharField(widget=forms.TextInput(attrs={'style':'width:15%'}), initial=default.AUTH_SOURCE)
auth_mechanism = forms.ChoiceField(widget=forms.Select(), initial=MONGODB.AUTH_MECHANISM.SCRAM_SHA_1.id)
pool_size_max = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=default.POOL_SIZE_MAX)
connect_timeout = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=timeout.CONNECT)
socket_timeout = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=timeout.SOCKET)
server_select_timeout = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=timeout.SERVER_SELECT)
wait_queue_timeout = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=timeout.WAIT_QUEUE)
max_idle_time = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=default.MAX_IDLE_TIME)
hb_frequency = forms.CharField(widget=forms.TextInput(attrs={'style':'width:8%'}), initial=default.HB_FREQUENCY)
is_tz_aware = forms.BooleanField(required=False, widget=forms.CheckboxInput())
document_class = forms.CharField(widget=forms.TextInput(attrs={'style':'width:40%'}))
compressor_list = forms.CharField(widget=forms.TextInput(attrs={'style':'width:30%'}))
zlib_level = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=default.ZLIB_LEVEL)
write_to_replica = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=default.WRITE_TO_REPLICA)
write_timeout = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=default.WRITE_TIMEOUT)
is_write_journal_enabled = forms.BooleanField(required=False, widget=forms.CheckboxInput())
is_write_fsync_enabled = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
should_retry_write = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
read_pref_type = forms.ChoiceField(widget=forms.Select(), initial=MONGODB.READ_PREF.PRIMARY.id)
read_pref_tag_list = forms.CharField(widget=forms.TextInput(attrs={'style':'width:23%'}))
read_pref_max_stale = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=default.MAX_STALENESS)
server_list = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%; height:70px'}), initial=default.SERVER_LIST)
def __init__(self, *args, **kwargs):
super(CreateForm, self).__init__(*args, **kwargs)
add_select(self, 'auth_mechanism', MONGODB.AUTH_MECHANISM(), needs_initial_select=False)
add_select(self, 'read_pref_type', MONGODB.READ_PREF(), needs_initial_select=False)
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
tls_match_hostname = forms.BooleanField(required=False, widget=forms.CheckboxInput())
should_retry_write = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 3,951
|
Python
|
.py
| 49
| 76.22449
| 128
| 0.743497
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,847
|
zmq.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/zmq.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.common.api import ZMQ
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
address = forms.CharField(widget=forms.TextInput(attrs={'style':'width:50%'}))
socket_type = forms.ChoiceField(widget=forms.Select())
socket_method = forms.ChoiceField(widget=forms.Select())
def __init__(self, prefix=None, post_data=None):
super(CreateForm, self).__init__(post_data, prefix=prefix)
self._add_field('socket_type', ZMQ.OUTGOING)
self._add_field('socket_method', ZMQ.METHOD)
def _add_field(self, field_name, source):
self.fields[field_name].choices = []
for code, name in source.items():
self.fields[field_name].choices.append([code, name])
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 1,273
|
Python
|
.py
| 26
| 44.346154
| 107
| 0.709782
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,848
|
slack.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/im/slack.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
http_proxy_list = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
https_proxy_list = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 789
|
Python
|
.py
| 15
| 49.8
| 107
| 0.744459
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,849
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/im/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
| 154
|
Python
|
.py
| 5
| 29.4
| 64
| 0.687075
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,850
|
telegram.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/im/telegram.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.common.api import TELEGRAM
default = TELEGRAM.DEFAULT
timeout = TELEGRAM.TIMEOUT
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
address = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}), initial=default.ADDRESS)
connect_timeout = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=timeout.CONNECT)
invoke_timeout = forms.CharField(widget=forms.TextInput(attrs={'style':'width:9%'}), initial=timeout.INVOKE)
http_proxy_list = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
https_proxy_list = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 1,228
|
Python
|
.py
| 22
| 52.863636
| 114
| 0.751464
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,851
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/hl7/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
| 148
|
Python
|
.py
| 5
| 28.2
| 64
| 0.687943
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,852
|
fhir.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/hl7/fhir.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2022, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_select, add_sec_tls_ca_cert_id_select, add_security_select
from zato.common.api import HL7 as HL7Commonn
# ################################################################################################################################
# ################################################################################################################################
_const = HL7Commonn.Const
_default = HL7Commonn.Default
# ################################################################################################################################
# ################################################################################################################################
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
pool_size = forms.CharField(widget=forms.TextInput(attrs={'style':'width:10%'}), initial=_default.pool_size)
address = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}), initial=_default.address_fhir)
auth_type = forms.ChoiceField(widget=forms.Select())
username = forms.CharField(widget=forms.TextInput(attrs={'style':'width:50%'}))
password = forms.CharField(strip=False, widget=forms.PasswordInput(attrs={'style':'width:100%'}))
security_id = forms.ChoiceField(widget=forms.Select())
sec_tls_ca_cert_id = forms.ChoiceField(widget=forms.Select())
extra = forms.CharField(widget=forms.Textarea(attrs={'style':'height:60px'}))
def __init__(self, req, security_list, prefix=None):
super(CreateForm, self).__init__(prefix=prefix)
add_select(self, 'auth_type', _const.FHIR_Auth_Type(), needs_initial_select=True)
add_security_select(self, security_list, field_name='security_id', needs_rbac=False)
add_sec_tls_ca_cert_id_select(req, self)
# ################################################################################################################################
# ################################################################################################################################
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
# ################################################################################################################################
# ################################################################################################################################
| 2,808
|
Python
|
.py
| 38
| 70.315789
| 130
| 0.454215
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,853
|
mllp.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/outgoing/hl7/mllp.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# Django
from django import forms
# Zato
from zato.admin.web.forms import WithAuditLog
from zato.common.api import HL7
# ################################################################################################################################
# ################################################################################################################################
_default = HL7.Default
# ################################################################################################################################
# ################################################################################################################################
class CreateForm(WithAuditLog):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
should_log_messages = forms.BooleanField(required=False, widget=forms.CheckboxInput())
address = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
pool_size = forms.CharField(initial=_default.pool_size, widget=forms.TextInput(attrs={'style':'width:11%'}))
logging_level = forms.ChoiceField(widget=forms.Select())
max_wait_time = forms.CharField(initial=_default.max_wait_time, widget=forms.TextInput(attrs={'style':'width:25%'}))
max_msg_size = forms.CharField(initial=_default.max_msg_size, widget=forms.TextInput(attrs={'style':'width:30%'}))
read_buffer_size = forms.CharField(initial=_default.read_buffer_size, widget=forms.TextInput(attrs={'style':'width:15%'}))
start_seq = forms.CharField(initial=_default.start_seq, widget=forms.TextInput(attrs={'style':'width:35%'}))
end_seq = forms.CharField(initial=_default.end_seq, widget=forms.TextInput(attrs={'style':'width:26%'}))
# ################################################################################################################################
# ################################################################################################################################
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
# ################################################################################################################################
# ################################################################################################################################
| 2,615
|
Python
|
.py
| 33
| 76.454545
| 130
| 0.442629
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,854
|
cassandra.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/definition/cassandra.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.common.api import CASSANDRA
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
contact_points = forms.CharField(initial=CASSANDRA.DEFAULT.CONTACT_POINTS, widget=forms.Textarea(attrs={'style':'width:100%'}))
port = forms.CharField(initial=CASSANDRA.DEFAULT.PORT, widget=forms.TextInput(attrs={'class':'required', 'style':'width:15%'}))
exec_size = forms.CharField(
initial=CASSANDRA.DEFAULT.EXEC_SIZE, widget=forms.TextInput(attrs={'class':'required', 'style':'width:15%'}))
proto_version = forms.CharField(
initial=CASSANDRA.DEFAULT.PROTOCOL_VERSION, widget=forms.TextInput(attrs={'class':'required', 'style':'width:15%'}))
cql_version = forms.CharField(widget=forms.TextInput(attrs={'style':'width:15%'}))
default_keyspace = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:50%'}))
username = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:50%'}))
password = forms.CharField(widget=forms.PasswordInput(attrs={'class':'required', 'style':'width:50%'}))
tls_ca_certs = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
tls_client_cert = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
tls_client_priv_key = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
class EditForm(CreateForm):
pass
| 1,915
|
Python
|
.py
| 29
| 62.172414
| 131
| 0.725918
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,855
|
kafka.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/definition/kafka.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2022, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_services, WithTLSForm
from zato.common.api import Kafka
default = Kafka.Default
timeout = default.Timeout
# ################################################################################################################################
# ################################################################################################################################
if 0:
from zato.common.typing_ import any_
# ################################################################################################################################
# ################################################################################################################################
class CreateForm(WithTLSForm):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
should_use_zookeeper = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
should_exclude_internal_topics = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
socket_timeout = forms.CharField(widget=forms.TextInput(attrs={'style':'width:7%'}), initial=timeout.Socket)
offset_timeout = forms.CharField(widget=forms.TextInput(attrs={'style':'width:7%'}), initial=timeout.Offsets)
source_address = forms.CharField(widget=forms.TextInput(attrs={'style':'width:44%'}))
broker_version = forms.CharField(widget=forms.TextInput(attrs={'style':'width:10%'}), initial=default.Broker_Version)
username = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}), initial=default.Username)
password = forms.CharField(widget=forms.PasswordInput(attrs={'style':'width:100%'}))
server_list = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%; height:40px'}), initial=default.Server_List)
topic_list = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%; height:40px'}))
service = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:100%'}))
def __init__(self, prefix:'any_'=None, post_data:'any_'=None, req:'any_'=None):
super().__init__(post_data=post_data, prefix=prefix)
add_services(self, req)
# ################################################################################################################################
# ################################################################################################################################
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
should_use_zookeeper = forms.BooleanField(required=False, widget=forms.CheckboxInput())
should_exclude_internal_topics = forms.BooleanField(required=False, widget=forms.CheckboxInput())
# ################################################################################################################################
# ################################################################################################################################
| 3,348
|
Python
|
.py
| 43
| 74.372093
| 130
| 0.507608
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,856
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/definition/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
| 154
|
Python
|
.py
| 5
| 29.4
| 64
| 0.687075
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,857
|
jms_wmq.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/definition/jms_wmq.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
MAX_CHARS = 100
PORT = 1414
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:35%'}))
host = forms.CharField(widget=forms.TextInput(attrs={'style':'width:35%'}))
port = forms.CharField(initial=PORT, widget=forms.TextInput(attrs={'style':'width:20%'}))
use_jms = forms.BooleanField(required=False, widget=forms.CheckboxInput())
queue_manager = forms.CharField(widget=forms.TextInput(attrs={'style':'width:35%'}))
channel = forms.CharField(widget=forms.TextInput(attrs={'style':'width:35%'}))
username = forms.CharField(widget=forms.TextInput(attrs={'style':'width:35%'}))
cache_open_send_queues = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
cache_open_receive_queues = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
use_shared_connections = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
ssl = forms.BooleanField(required=False, widget=forms.CheckboxInput())
ssl_cipher_spec = forms.CharField(widget=forms.TextInput(attrs={'style':'width:60%'}))
ssl_key_repository = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
needs_mcd = forms.BooleanField(required=False, widget=forms.CheckboxInput())
max_chars_printed = forms.CharField(initial=MAX_CHARS, widget=forms.TextInput(attrs={'style':'width:20%'}))
class EditForm(CreateForm):
use_jms = forms.BooleanField(required=False, widget=forms.CheckboxInput())
cache_open_send_queues = forms.BooleanField(required=False, widget=forms.CheckboxInput())
cache_open_receive_queues = forms.BooleanField(required=False, widget=forms.CheckboxInput())
use_shared_connections = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 2,135
|
Python
|
.py
| 31
| 65.193548
| 123
| 0.749165
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,858
|
amqp_.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/definition/amqp_.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.common.util.api import make_repr
# Defaults per AMQP spec
FRAME_MAX_SIZE = 131072
PORT = 5672
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
host = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
port = forms.CharField(initial=PORT, widget=forms.TextInput(attrs={'style':'width:20%'}))
vhost = forms.CharField(initial='/', widget=forms.TextInput(attrs={'style':'width:50%'}))
username = forms.CharField(widget=forms.TextInput(attrs={'style':'width:50%'}))
frame_max = forms.CharField(initial=FRAME_MAX_SIZE, widget=forms.TextInput(attrs={'style':'width:20%'}))
heartbeat = forms.CharField(initial=1, widget=forms.TextInput(attrs={'style':'width:10%'}))
def __repr__(self):
return make_repr(self)
class EditForm(CreateForm):
pass
| 1,150
|
Python
|
.py
| 25
| 42.88
| 108
| 0.72043
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,859
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/pattern/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
| 154
|
Python
|
.py
| 5
| 29.4
| 64
| 0.687075
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,860
|
definition.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/pattern/delivery/definition.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# stdlib
from operator import itemgetter
# Django
from django import forms
# Python 2/3 compatibility
from zato.common.ext.future.utils import iteritems
# Zato
from zato.admin.web.forms import INITIAL_CHOICES_DICT
from zato.common.api import BATCH_DEFAULTS, INVOCATION_TARGET
# It's a pity these have to be repeated here in addition to what is in zato.admin.web
# but here the names are shorter.
_targets = {
INVOCATION_TARGET.CHANNEL_AMQP: 'Channel - AMQP',
INVOCATION_TARGET.CHANNEL_WMQ: 'Channel - IBM MQ',
INVOCATION_TARGET.CHANNEL_ZMQ: 'Channel - ZeroMQ',
INVOCATION_TARGET.OUTCONN_AMQP: 'Outgoing conn. - AMQP',
INVOCATION_TARGET.OUTCONN_WMQ: 'Outgoing conn. - IBM MQ',
INVOCATION_TARGET.OUTCONN_ZMQ: 'Outgoing conn. - ZeroMQ',
INVOCATION_TARGET.SERVICE: 'Service',
}
_targets.update(INITIAL_CHOICES_DICT)
class DeliveryTargetForm(forms.Form):
target_type = forms.ChoiceField(widget=forms.Select())
def __init__(self, data=None):
super(DeliveryTargetForm, self).__init__(data)
self.fields['target_type'].choices = []
for id, name in sorted(iteritems(_targets), key=itemgetter(1)):
self.fields['target_type'].choices.append([id, name])
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
target = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
check_after = forms.CharField(widget=forms.TextInput(attrs={'class':'validate-digits', 'style':'width:18%'}))
retry_repeats = forms.CharField(initial=5, widget=forms.TextInput(attrs={'class':'validate-digits', 'style':'width:12%'}))
retry_seconds = forms.CharField(initial=600, widget=forms.TextInput(attrs={'class':'validate-digits', 'style':'width:18%'}))
expire_after = forms.CharField(widget=forms.TextInput(attrs={'class':'validate-digits', 'style':'width:18%'}))
expire_arch_succ_after = forms.CharField(initial=72, widget=forms.TextInput(attrs={'class':'validate-digits', 'style':'width:12%'}))
expire_arch_fail_after = forms.CharField(initial=168, widget=forms.TextInput(attrs={'class':'validate-digits', 'style':'width:12%'}))
callback_list = forms.CharField(widget=forms.Textarea(attrs={'rows':7}), required=False)
class EditForm(CreateForm):
pass
class InstanceListForm(forms.Form):
""" List of delivery instances.
"""
start = forms.CharField(widget=forms.TextInput(attrs={'style':'width:150px; height:19px'}))
stop = forms.CharField(widget=forms.TextInput(attrs={'style':'width:150px; height:19px'}))
current_batch = forms.CharField(initial=BATCH_DEFAULTS.PAGE_NO, widget=forms.TextInput(attrs={'style':'width:50px; height:19px'}))
batch_size = forms.CharField(initial=BATCH_DEFAULTS.SIZE, widget=forms.TextInput(attrs={'style':'width:50px; height:19px'}))
| 2,999
|
Python
|
.py
| 52
| 53.769231
| 137
| 0.727149
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,861
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/pattern/delivery/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
| 154
|
Python
|
.py
| 5
| 29.4
| 64
| 0.687075
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,862
|
sql.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/notif/sql.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_services
from zato.common.api import NOTIF
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
def_id = forms.ChoiceField(widget=forms.Select())
interval = forms.CharField(initial=NOTIF.DEFAULT.CHECK_INTERVAL_SQL, widget=forms.TextInput(attrs={'style':'width:15%'}))
service_name = forms.ChoiceField(widget=forms.Select(attrs={'class':'required', 'style':'width:100%'}))
query = forms.CharField(widget=forms.Textarea(attrs={'class':'required', 'style':'width:100%'}))
def __init__(self, prefix=None, post_data=None, sql_defs=None, req=None):
super(CreateForm, self).__init__(post_data, prefix=prefix)
self.fields['def_id'].choices = ((item.id, item.name) for item in sql_defs)
add_services(self, req)
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 1,416
|
Python
|
.py
| 25
| 52.88
| 125
| 0.724313
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,863
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/notif/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
| 238
|
Python
|
.py
| 6
| 38.166667
| 82
| 0.729258
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,864
|
keysight_vision.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/vendors/keysight_vision.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2023, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_sec_tls_ca_cert_id_select, WithAuditLog
# ################################################################################################################################
# ################################################################################################################################
class CreateForm(WithAuditLog):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
host = forms.CharField(initial='https://', widget=forms.TextInput(attrs={'style':'width:100%'}))
sec_tls_ca_cert_id = forms.ChoiceField(widget=forms.Select())
username = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
password = forms.CharField(strip=False, widget=forms.PasswordInput(attrs={'style':'width:100%'}))
def __init__(self, req=None, prefix=None):
super(CreateForm, self).__init__(prefix=prefix)
add_sec_tls_ca_cert_id_select(req, self)
# ################################################################################################################################
# ################################################################################################################################
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
# ################################################################################################################################
# ################################################################################################################################
| 1,905
|
Python
|
.py
| 27
| 67.296296
| 130
| 0.420912
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,865
|
entry.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/audit_log/entry.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
| 148
|
Python
|
.py
| 5
| 28.2
| 64
| 0.687943
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,866
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/audit_log/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
| 148
|
Python
|
.py
| 5
| 28.2
| 64
| 0.687943
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,867
|
aws.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/aws.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
username = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 775
|
Python
|
.py
| 15
| 48.933333
| 107
| 0.742706
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,868
|
ntlm.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/ntlm.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
username = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 781
|
Python
|
.py
| 15
| 49.333333
| 107
| 0.742105
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,869
|
basic_auth.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/basic_auth.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.admin.web.forms import WithRateLimiting
class CreateForm(WithRateLimiting):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:90%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
username = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:90%'}))
realm = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:90%'}))
is_rate_limit_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
rate_limit_check_parent_def = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 1,162
|
Python
|
.py
| 20
| 55.15
| 125
| 0.750661
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,870
|
apikey.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/apikey.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2024, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# Django
from django import forms
# Zato
from zato.admin.web.forms import WithRateLimiting
from zato.common.api import API_Key
class CreateForm(WithRateLimiting):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
username = forms.CharField(widget=forms.TextInput(
attrs={'class':'required', 'style':'width:100%', 'disabled':True}),
initial=API_Key.Default_Header,
)
is_rate_limit_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
rate_limit_check_parent_def = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 1,087
|
Python
|
.py
| 22
| 45.954545
| 125
| 0.74221
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,871
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2010 Dariusz Suchojad <dsuch at zato.io>
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
| 154
|
Python
|
.py
| 5
| 29.4
| 64
| 0.714286
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,872
|
wss.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/wss.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2021, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:90%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
username = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:90%'}))
reject_empty_nonce_creat = forms.BooleanField(widget=forms.CheckboxInput(attrs={'checked':'checked'}))
reject_stale_tokens = forms.BooleanField(widget=forms.CheckboxInput(attrs={'checked':'checked'}))
reject_expiry_limit = forms.IntegerField(widget=forms.TextInput(attrs={'class':'required validate-digits', 'style':'width:20%'}))
nonce_freshness_time = forms.IntegerField(widget=forms.TextInput(attrs={'class':'required validate-digits', 'style':'width:20%'}))
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
reject_empty_nonce_creat = forms.BooleanField(widget=forms.CheckboxInput())
reject_stale_tokens = forms.BooleanField(widget=forms.CheckboxInput())
| 1,412
|
Python
|
.py
| 21
| 63.857143
| 134
| 0.748736
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,873
|
openstack.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/openstack.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:90%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
username = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:90%'}))
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 779
|
Python
|
.py
| 15
| 49.2
| 107
| 0.741425
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,874
|
jwt.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/jwt.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.admin.web.forms import WithRateLimiting
class CreateForm(WithRateLimiting):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:90%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
username = forms.CharField(widget=forms.TextInput(attrs={'class':'required'}))
ttl = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:30%'}))
is_rate_limit_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
rate_limit_check_parent_def = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 1,139
|
Python
|
.py
| 20
| 54
| 125
| 0.753597
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,875
|
xpath.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/xpath.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
username = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
username_expr = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
password_expr = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 981
|
Python
|
.py
| 17
| 54.705882
| 109
| 0.735908
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,876
|
outconn_client_credentials.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/oauth/outconn_client_credentials.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2023, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# Django
from django import forms
# Zato
from zato.common.api import OAuth as OAuthCommon, SIMPLE_IO
from zato.admin.web.forms import add_select
# ################################################################################################################################
# ################################################################################################################################
_default = OAuthCommon.Default
# ################################################################################################################################
# ################################################################################################################################
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:60%'}))
username = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
auth_server_url = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}), initial=_default.Auth_Server_URL)
scopes = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%; height:30px'}), initial='\n'.join(_default.Scopes))
client_id_field = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}), initial=_default.Client_ID_Field)
client_secret_field = forms.CharField(
widget=forms.TextInput(attrs={'style':'width:100%'}), initial=_default.Client_Secret_Field)
grant_type = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}), initial=_default.Grant_Type)
extra_fields = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%; height:30px'}))
data_format = forms.ChoiceField(widget=forms.Select())
def __init__(self, prefix=None, post_data=None):
super(CreateForm, self).__init__(post_data, prefix=prefix)
add_select(self, 'data_format', SIMPLE_IO.Bearer_Token_Format, needs_initial_select=False)
# ################################################################################################################################
# ################################################################################################################################
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
# ################################################################################################################################
# ################################################################################################################################
| 2,812
|
Python
|
.py
| 36
| 74.611111
| 130
| 0.453952
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,877
|
connection.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/vault/connection.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_initial_select, add_select_from_service, add_services
from zato.common.vault_ import VAULT
_auth_method = VAULT.AUTH_METHOD
vault_methods = [_auth_method.GITHUB, _auth_method.TOKEN, _auth_method.USERNAME_PASSWORD]
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
url = forms.CharField(
initial=VAULT.DEFAULT.URL, widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
token = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
default_auth_method = forms.ChoiceField(widget=forms.Select())
timeout = forms.CharField(
initial=VAULT.DEFAULT.TIMEOUT, widget=forms.TextInput(attrs={'class':'required', 'style':'width:15%'}))
allow_redirects = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
tls_verify = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
service_id = forms.ChoiceField(widget=forms.Select())
tls_key_cert_id = forms.ChoiceField(widget=forms.Select())
tls_ca_cert_id = forms.ChoiceField(widget=forms.Select())
def __init__(self, req, prefix=None, *args, **kwargs):
super(CreateForm, self).__init__(prefix=prefix, *args, **kwargs)
add_services(self, req, True)
add_initial_select(self, 'default_auth_method')
for item in vault_methods:
self.fields['default_auth_method'].choices.append([item.id, item.name])
add_select_from_service(self, req, 'zato.security.tls.key-cert.get-list', 'tls_key_cert_id')
add_select_from_service(self, req, 'zato.security.tls.ca-cert.get-list', 'tls_ca_cert_id')
class EditForm(CreateForm):
pass
| 2,140
|
Python
|
.py
| 37
| 53.027027
| 113
| 0.715311
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,878
|
role.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/rbac/role.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
parent_id = forms.ChoiceField(widget=forms.Select())
def __init__(self, parent_id_list=None, *args, **kwargs):
super(CreateForm, self).__init__(*args, **kwargs)
self.fields['parent_id'].choices = []
for item in parent_id_list:
self.fields['parent_id'].choices.append([item.id, item.name])
EditForm = CreateForm
| 817
|
Python
|
.py
| 18
| 41
| 100
| 0.689873
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,879
|
role_permission.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/rbac/role_permission.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
role_id = forms.ChoiceField(widget=forms.Select())
service_id = forms.ChoiceField(widget=forms.Select())
perm_id = forms.ChoiceField(widget=forms.Select())
def __init__(self, role_id_list, service_id_list, perm_id_list, *args, **kwargs):
super(CreateForm, self).__init__(*args, **kwargs)
self.fields['role_id'].choices = []
for item in role_id_list:
self.fields['role_id'].choices.append([item.id, item.name])
self.fields['service_id'].choices = []
for item in service_id_list:
self.fields['service_id'].choices.append([item.id, item.name])
self.fields['perm_id'].choices = []
for item in perm_id_list:
self.fields['perm_id'].choices.append([item.id, item.name])
| 1,234
|
Python
|
.py
| 25
| 43.32
| 100
| 0.663887
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,880
|
client_role.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/rbac/client_role.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
client_def = forms.ChoiceField(widget=forms.Select())
role_id = forms.ChoiceField(widget=forms.Select())
def __init__(self, client_def_list, role_id_list, *args, **kwargs):
super(CreateForm, self).__init__(*args, **kwargs)
self.fields['client_def'].choices = []
for item in client_def_list:
self.fields['client_def'].choices.append([item.client_def, item.client_name])
self.fields['role_id'].choices = []
for item in role_id_list:
self.fields['role_id'].choices.append([item.id, item.name])
| 1,029
|
Python
|
.py
| 21
| 43.571429
| 100
| 0.675676
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,881
|
permission.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/rbac/permission.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
EditForm = CreateForm
| 481
|
Python
|
.py
| 12
| 37.916667
| 100
| 0.740821
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,882
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/rbac/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
| 238
|
Python
|
.py
| 6
| 38.166667
| 82
| 0.729258
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,883
|
channel.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/tls/channel.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
value = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%', 'checked':'checked'}))
class EditForm(CreateForm):
pass
| 598
|
Python
|
.py
| 14
| 40.142857
| 101
| 0.730104
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,884
|
ca_cert.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/tls/ca_cert.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
value = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%', 'checked':'checked'}))
class EditForm(CreateForm):
pass
| 598
|
Python
|
.py
| 14
| 40.142857
| 101
| 0.730104
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,885
|
key_cert.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/tls/key_cert.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class CreateForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:100%'}))
auth_data = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%', 'checked':'checked'}))
class EditForm(CreateForm):
pass
| 602
|
Python
|
.py
| 14
| 40.428571
| 105
| 0.730241
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,886
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/security/tls/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
| 154
|
Python
|
.py
| 5
| 29.4
| 64
| 0.687075
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,887
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/kvdb/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2021, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# Django
from django import forms
# Zato
from zato.common.api import REDIS
# ################################################################################################################################
# ################################################################################################################################
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:30%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
host = forms.CharField(widget=forms.TextInput(attrs={'style':'width:50%'}))
port = forms.CharField(initial=REDIS.DEFAULT.PORT, widget=forms.TextInput(attrs={'style':'width:15%'}))
db = forms.CharField(initial=REDIS.DEFAULT.DB, widget=forms.TextInput(attrs={'style':'width:8%'}))
use_redis_sentinels = forms.BooleanField(required=False, widget=forms.CheckboxInput())
redis_sentinels_master = forms.CharField(widget=forms.TextInput(attrs={'style':'width:71%'}))
redis_sentinels = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%'}))
def __init__(self, prefix=None, post_data=None):
super(CreateForm, self).__init__(post_data, prefix=prefix)
# ################################################################################################################################
# ################################################################################################################################
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
use_redis_sentinels = forms.BooleanField(required=False, widget=forms.CheckboxInput())
# ################################################################################################################################
# ################################################################################################################################
class RemoteCommandForm(forms.Form):
""" Form to send Redis commands through.
"""
command = forms.CharField(widget=forms.Textarea(attrs={'style':'overflow:auto; width:100%; white-space: pre-wrap;height:80px'}))
result = forms.CharField(widget=forms.Textarea(attrs={'style':'overflow:auto; width:100%; white-space: pre-wrap;height:400px'}))
def __init__(self, initial=None):
initial = initial or {}
super(RemoteCommandForm, self).__init__(initial=initial)
# ################################################################################################################################
# ################################################################################################################################
# ################################################################################################################################
# ################################################################################################################################
| 3,151
|
Python
|
.py
| 41
| 73.365854
| 132
| 0.420543
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,888
|
dictionary.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/kvdb/data_dict/dictionary.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class CreateForm(forms.Form):
system = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
key = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
value = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%'}))
class EditForm(CreateForm):
pass
| 586
|
Python
|
.py
| 14
| 39.285714
| 82
| 0.731449
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,889
|
translation.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/kvdb/data_dict/translation.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.admin.web.forms import INITIAL_CHOICES
class _Base(forms.Form):
system1 = forms.ChoiceField()
key1 = forms.ChoiceField()
value1 = forms.ChoiceField()
system2 = forms.ChoiceField()
key2 = forms.ChoiceField()
def __init__(self, systems=None, *args, **kwargs):
systems = systems or []
super(_Base, self).__init__(*args, **kwargs)
for name, value in self.fields.items():
if isinstance(value, forms.ChoiceField):
self.fields[name].choices = [INITIAL_CHOICES]
for system_id, system in systems:
for name in('system1', 'system2'):
self.fields[name].choices.append([system_id, system])
class CreateForm(_Base):
value2 = forms.ChoiceField()
class EditForm(CreateForm):
pass
class TranslateForm(_Base):
pass
| 1,118
|
Python
|
.py
| 31
| 30.709677
| 82
| 0.670074
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,890
|
soap.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/channel/soap.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
class DefinitionForm(forms.Form):
id = forms.CharField(widget=forms.HiddenInput())
url_pattern = forms.CharField(widget=forms.TextInput(attrs={'class':'required', 'style':'width:90%'}))
| 468
|
Python
|
.py
| 11
| 40.363636
| 106
| 0.738938
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,891
|
file_transfer.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/channel/file_transfer.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_http_soap_select, add_select, add_select_from_service, add_services, add_topics
from zato.common.api import CONNECTION, FILE_TRANSFER, GENERIC, URL_TYPE
# ################################################################################################################################
_default = FILE_TRANSFER.DEFAULT
_source_type = FILE_TRANSFER.SOURCE_TYPE()
_sftp = GENERIC.CONNECTION.TYPE.OUTCONN_SFTP
# ################################################################################################################################
class CreateForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
service_list = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:87%', 'class':'multirow'}))
topic_list = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:87%', 'class':'multirow'}))
outconn_rest_list = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:87%', 'class':'multirow'}))
pickup_from_list = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%; height:75px'}))
move_processed_to = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
file_patterns = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}), initial=_default.FILE_PATTERNS)
parse_with = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
should_read_on_pickup = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
should_parse_on_pickup = forms.BooleanField(required=False, widget=forms.CheckboxInput())
should_delete_after_pickup = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
source_type = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:15%'}))
is_case_sensitive = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
ftp_source_id = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:84%', 'class':'hidden'}))
sftp_source_id = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:84%', 'class':'hidden'}))
scheduler_job_id = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:100%'}))
is_line_by_line = forms.BooleanField(required=False, widget=forms.CheckboxInput())
is_hot_deploy = forms.BooleanField(required=False, widget=forms.CheckboxInput())
binary_file_patterns = forms.CharField(widget=forms.TextInput(attrs={'style':'width:68%'}))
data_encoding = forms.CharField(widget=forms.TextInput(attrs={'style':'width:20%'}), initial=_default.ENCODING)
ftp_source_name = forms.HiddenInput()
sftp_source_name = forms.HiddenInput()
def __init__(self, prefix=None, post_data=None, req=None):
super(CreateForm, self).__init__(post_data, prefix=prefix)
add_select(self, 'source_type', _source_type)
add_services(self, req)
add_topics(self, req, by_id=False)
add_http_soap_select(self, 'outconn_rest_list', req, CONNECTION.OUTGOING, URL_TYPE.PLAIN_HTTP)
add_select_from_service(self, req, 'zato.outgoing.ftp.get-list', 'ftp_source_id')
add_select_from_service(self, req, 'zato.generic.connection.get-list', 'sftp_source_id', service_extra={'type_':_sftp})
add_select_from_service(self, req, 'zato.scheduler.job.get-list', 'scheduler_job_id', service_extra={
'service_name': FILE_TRANSFER.SCHEDULER_SERVICE
})
# ################################################################################################################################
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
should_read_on_pickup = forms.BooleanField(required=False, widget=forms.CheckboxInput())
should_parse_on_pickup = forms.BooleanField(required=False, widget=forms.CheckboxInput())
should_delete_after_pickup = forms.BooleanField(required=False, widget=forms.CheckboxInput())
# ################################################################################################################################
| 4,555
|
Python
|
.py
| 58
| 73.758621
| 130
| 0.644837
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,892
|
json_rpc.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/channel/json_rpc.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_security_select, WithRateLimiting
class CreateForm(WithRateLimiting):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
url_path = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
security_id = forms.ChoiceField(widget=forms.Select())
service_whitelist = forms.CharField(widget=forms.Textarea(attrs={'style':'width:100%; height:100px'}))
is_rate_limit_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
rate_limit_check_parent_def = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
def __init__(self, security_list=None, prefix=None, post_data=None, req=None):
security_list = security_list or []
super(CreateForm, self).__init__(post_data, prefix=prefix)
add_security_select(self, security_list, field_name='security_id')
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
rate_limit_check_parent_def = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
| 1,553
|
Python
|
.py
| 25
| 58.24
| 125
| 0.744079
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,893
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/channel/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
| 154
|
Python
|
.py
| 5
| 29.4
| 64
| 0.687075
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,894
|
jms_wmq.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/channel/jms_wmq.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
from operator import itemgetter
# Django
from django import forms
# Python 2/3 compatibility
from zato.common.ext.future.utils import iteritems
# Zato
from zato.admin.web.forms import add_services, DataFormatForm
class CreateForm(DataFormatForm):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
def_id = forms.ChoiceField(widget=forms.Select())
queue = forms.CharField(widget=forms.TextInput(attrs={'style':'width:50%'}))
service = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:100%'}))
def __init__(self, prefix=None, post_data=None, req=None):
super(CreateForm, self).__init__(post_data, prefix=prefix)
self.fields['def_id'].choices = []
add_services(self, req)
def set_def_id(self, def_ids):
# Sort definitions by their names.
def_ids = sorted(iteritems(def_ids), key=itemgetter(1))
for id, name in def_ids:
self.fields['def_id'].choices.append([id, name])
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 1,460
|
Python
|
.py
| 31
| 42.741935
| 107
| 0.715596
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,895
|
amqp_.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/channel/amqp_.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
from operator import itemgetter
# Django
from django import forms
# Python 2/3 compatibility
from zato.common.ext.future.utils import iteritems
# Zato
from zato.admin.web.forms import add_services, DataFormatForm
from zato.common.api import AMQP
class CreateForm(DataFormatForm):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
def_id = forms.ChoiceField(widget=forms.Select())
queue = forms.CharField(widget=forms.TextInput(attrs={'style':'width:50%'}))
consumer_tag_prefix = forms.CharField(widget=forms.TextInput(attrs={'style':'width:50%'}))
pool_size = forms.CharField(
initial=AMQP.DEFAULT.POOL_SIZE, widget=forms.TextInput(attrs={'style':'width:10%', 'class':'required'}))
ack_mode = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:20%'}))
prefetch_count = forms.CharField(initial=AMQP.DEFAULT.PREFETCH_COUNT, widget=forms.TextInput(attrs={'style':'width:10%'}))
service = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:100%'}))
def __init__(self, prefix=None, post_data=None, req=None):
super(CreateForm, self).__init__(post_data, prefix=prefix)
self.fields['def_id'].choices = []
add_services(self, req)
self.fields['ack_mode'].choices = []
for item in AMQP.ACK_MODE():
self.fields['ack_mode'].choices.append([item.id, item.name])
def set_def_id(self, def_ids):
# Sort AMQP definitions by their names.
def_ids = sorted(iteritems(def_ids), key=itemgetter(1))
for id, name in def_ids:
self.fields['def_id'].choices.append([id, name])
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 2,105
|
Python
|
.py
| 40
| 47.7
| 126
| 0.707115
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,896
|
zmq.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/channel/zmq.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_services, DataFormatForm
from zato.common.api import ZMQ
class CreateForm(DataFormatForm):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
address = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
socket_type = forms.ChoiceField(widget=forms.Select())
socket_method = forms.ChoiceField(widget=forms.Select())
service = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:100%'}))
sub_key = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
pool_strategy = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:20%'}))
service_source = forms.ChoiceField(widget=forms.Select())
def __init__(self, prefix=None, post_data=None, req=None):
super(CreateForm, self).__init__(post_data, prefix=prefix)
self._add_field('socket_type', ZMQ.CHANNEL)
self._add_field('socket_method', ZMQ.METHOD)
self._add_field('pool_strategy', ZMQ.POOL_STRATEGY)
self._add_field('service_source', ZMQ.SERVICE_SOURCE)
add_services(self, req)
def _add_field(self, field_name, source):
self.fields[field_name].choices = []
for code, name in source.items():
self.fields[field_name].choices.append([code, name])
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 1,821
|
Python
|
.py
| 34
| 48.588235
| 107
| 0.711712
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,897
|
web_socket.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/channel/web_socket.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) 2021, Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_security_select, add_services, DataFormatForm, INITIAL_CHOICES, WithAuditLog
from zato.common.api import SIMPLE_IO, WEB_SOCKET
class CreateForm(DataFormatForm, WithAuditLog):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
address = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
service_name = forms.ChoiceField(widget=forms.Select(attrs={'style':'width:100%'}))
security_id = forms.ChoiceField(widget=forms.Select())
token_format = forms.ChoiceField(widget=forms.Select())
new_token_wait_time = forms.CharField(initial=WEB_SOCKET.DEFAULT.NEW_TOKEN_TIMEOUT,
widget=forms.TextInput(attrs={'style':'width:10%'}))
token_ttl = forms.CharField(initial=WEB_SOCKET.DEFAULT.TOKEN_TTL,
widget=forms.TextInput(attrs={'style':'width:20%'}))
ping_interval = forms.CharField(initial=WEB_SOCKET.DEFAULT.PING_INTERVAL,
widget=forms.TextInput(attrs={'style':'width:10%'}))
pings_missed_threshold = forms.CharField(initial=WEB_SOCKET.DEFAULT.PINGS_MISSED_THRESHOLD,
widget=forms.TextInput(attrs={'style':'width:10%'}))
def __init__(self, security_list=None, prefix=None, post_data=None, req=None):
security_list = security_list or []
super(CreateForm, self).__init__(post_data, prefix=prefix)
super(WithAuditLog).__init__()
self.fields['token_format'].choices = []
self.fields['token_format'].choices.append(INITIAL_CHOICES)
for name in sorted(dir(SIMPLE_IO.FORMAT)):
if name.upper() == name:
self.fields['token_format'].choices.append([name.lower(), name])
add_security_select(self, security_list, field_name='security_id', needs_no_security=True, needs_rbac=False)
add_services(self, req)
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
| 2,252
|
Python
|
.py
| 38
| 53.368421
| 116
| 0.710909
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,898
|
rest.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/channel/hl7/rest.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
# Django
from django import forms
# Zato
from zato.admin.web.forms import add_security_select, add_select, add_services, WithAuditLog
from zato.common.api import HL7
# ################################################################################################################################
# ################################################################################################################################
class CreateForm(WithAuditLog):
name = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
should_parse_on_input = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
should_validate = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
should_return_errors = forms.BooleanField(required=False, widget=forms.CheckboxInput())
hl7_version = forms.ChoiceField(widget=forms.Select())
data_encoding = forms.CharField(widget=forms.TextInput(attrs={'style':'width:30%'}))
json_path = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%'}))
url_path = forms.CharField(initial='/', widget=forms.TextInput(attrs={'style':'width:100%'}))
service = forms.ChoiceField(widget=forms.Select(attrs={'class':'required', 'style':'width:100%'}))
security_id = forms.ChoiceField(widget=forms.Select())
def __init__(self, security_list=None, prefix=None, post_data=None, req=None):
security_list = security_list or []
super(WithAuditLog, self).__init__(post_data, prefix=prefix)
add_security_select(self, security_list, field_name='security_id', needs_rbac=False)
add_select(self, 'hl7_version', HL7.Const.Version(), needs_initial_select=False)
add_services(self, req)
# ################################################################################################################################
# ################################################################################################################################
class EditForm(CreateForm):
is_active = forms.BooleanField(required=False, widget=forms.CheckboxInput())
# ################################################################################################################################
# ################################################################################################################################
| 2,669
|
Python
|
.py
| 36
| 70.277778
| 130
| 0.51373
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|
9,899
|
__init__.py
|
zatosource_zato/code/zato-web-admin/src/zato/admin/web/forms/channel/hl7/__init__.py
|
# -*- coding: utf-8 -*-
"""
Copyright (C) Zato Source s.r.o. https://zato.io
Licensed under AGPLv3, see LICENSE.txt for terms and conditions.
"""
| 148
|
Python
|
.py
| 5
| 28.2
| 64
| 0.687943
|
zatosource/zato
| 1,096
| 239
| 0
|
AGPL-3.0
|
9/5/2024, 5:10:54 PM (Europe/Amsterdam)
|