Created Project
|
After Width: | Height: | Size: 6.0 KiB |
@ -0,0 +1,879 @@
|
||||
import com.amazonaws.services.s3.AmazonS3ClientBuilder as AmazonS3ClientBuilder
|
||||
import com.amazonaws.services.s3.model.GeneratePresignedUrlRequest as GeneratePresignedUrlRequest
|
||||
import com.amazonaws.HttpMethod as HttpMethod
|
||||
|
||||
import boto3
|
||||
from botocore.client import BaseClient
|
||||
from botocore.exceptions import ClientError
|
||||
import json
|
||||
from pprint import pformat
|
||||
from urllib2_aws4auth import aws_urlopen, Request
|
||||
from urllib2 import HTTPError
|
||||
from urllib import urlencode
|
||||
from helper.helper import sanitize_tree
|
||||
from loggerConfig import getLogger
|
||||
|
||||
REGION_NAME = 'us-east-1'
|
||||
LOGGER = getLogger('S3Manager', 'debug')
|
||||
|
||||
def getPresignedURL(self, objectKey):
|
||||
"""
|
||||
Generates a uri to retrieve images from an S3 bucket.
|
||||
Bucket names are globally unique so different regions
|
||||
must use a prefix for the bucket name.
|
||||
Region and prefix are stored as custom session variables.
|
||||
|
||||
Args:
|
||||
self: Refrence to the object calling the function.
|
||||
param2: key to the s3 object returned.
|
||||
|
||||
Returns:
|
||||
s3 Url to display the image in S3.
|
||||
|
||||
Raises:
|
||||
KeyError: None.
|
||||
"""
|
||||
|
||||
|
||||
bucket_names = {"eu":"ignition-image-repo", "na":"ignition-image-repo-na",
|
||||
"jp":"jp-ignition-image-repo"}
|
||||
|
||||
# aws = system.tag.readBlocking("Configuration/aws")[0].value
|
||||
# aws = system.util.jsonDecode(aws)
|
||||
# clientRegion = aws.get("region")
|
||||
# prefix = aws.get("prefix")
|
||||
clientRegion = self.session.custom.aws.region
|
||||
prefix = self.session.custom.aws.prefix
|
||||
|
||||
|
||||
bucketName = bucket_names.get(prefix, "ignition-image-repo")
|
||||
|
||||
s3Client = AmazonS3ClientBuilder.standard().withRegion(clientRegion).build();
|
||||
generatePresignedUrlRequest = GeneratePresignedUrlRequest(bucketName, objectKey).withMethod(HttpMethod.GET);
|
||||
url = s3Client.generatePresignedUrl(generatePresignedUrlRequest);
|
||||
|
||||
return url
|
||||
|
||||
S3_REPO_BUCKET_NAME = 'ignition-image-repo-na'
|
||||
S3_SOURCE_BUCKET_NAME = 'ignition-image-source-na'
|
||||
# api stage config
|
||||
API_STAGES = ['beta', 'prod']
|
||||
API_REGIONS = ['na', 'eu']
|
||||
STAGE_CONFIG = {
|
||||
'beta': {
|
||||
'na': {
|
||||
'region': 'us-east-1',
|
||||
'lambda_name': 'RMESDScadaS3ManagementFlaskLambda-beta',
|
||||
'endpoint': 'https://us-east-1.beta.scada-s3-management.scada.eurme.amazon.dev/',
|
||||
'repo_bucket': 'ignition-image-repo-na',
|
||||
'source_bucket': 'ignition-image-source-na',
|
||||
's3_region': 'us-east-1',
|
||||
'account_id': '006306898152',
|
||||
'api_call_role': 'arn:aws:iam::604741092380:role/RMESDScadaS3ManagementAPIcallRole-beta-us-east-1'
|
||||
},
|
||||
'eu': {
|
||||
'region': 'eu-west-2',
|
||||
'lambda_name': 'RMESDScadaS3ManagementFlaskLambda-beta',
|
||||
'endpoint': 'https://eu-west-2.beta.scada-s3-management.scada.eurme.amazon.dev/',
|
||||
'repo_bucket': 'ignition-image-repo',
|
||||
'source_bucket': 'ignition-image-source',
|
||||
's3_region': 'eu-west-1',
|
||||
'account_id': '006306898152',
|
||||
'api_call_role': 'arn:aws:iam::604741092380:role/RMESDScadaS3ManagementAPIcallRole-beta-eu-west-2'
|
||||
}
|
||||
},
|
||||
'prod': {
|
||||
'na': {
|
||||
'region': 'us-east-2',
|
||||
'lambda_name': 'RMESDScadaS3ManagementFlaskLambda-prod',
|
||||
'endpoint': 'https://us-east-2.scada-s3-management.scada.eurme.amazon.dev/',
|
||||
'repo_bucket': 'ignition-image-repo-na',
|
||||
'source_bucket': 'ignition-image-source-na',
|
||||
's3_region': 'us-east-1',
|
||||
'account_id': '006306898152',
|
||||
'api_call_role': 'arn:aws:iam::609617486056:role/RMESDScadaS3ManagementAPIcallRole-prod-us-east-2'
|
||||
},
|
||||
'eu': {
|
||||
'region': 'eu-west-1',
|
||||
'lambda_name': 'RMESDScadaS3ManagementFlaskLambda-prod',
|
||||
'endpoint': 'https://eu-west-1.scada-s3-management.scada.eurme.amazon.dev/',
|
||||
'repo_bucket': 'ignition-image-repo',
|
||||
'source_bucket': 'ignition-image-source',
|
||||
's3_region': 'eu-west-1',
|
||||
'account_id': '006306898152',
|
||||
'api_call_role': 'arn:aws:iam::609617486056:role/RMESDScadaS3ManagementAPIcallRole-prod-eu-west-1'
|
||||
}
|
||||
}
|
||||
}
|
||||
OPERATION_MAP = {
|
||||
'download': {
|
||||
'method': 'GET',
|
||||
'reqd_args': ['bucket', 'obj_key']
|
||||
},
|
||||
'get_presigned_url': {
|
||||
'method': 'GET',
|
||||
'reqd_args': ['bucket', 'obj_key']
|
||||
},
|
||||
'list_objects': {
|
||||
'method': 'GET',
|
||||
'reqd_args': ['bucket']
|
||||
},
|
||||
'list_object_versions': {
|
||||
'method': 'GET',
|
||||
'reqd_args': ['bucket']
|
||||
},
|
||||
'list_object_delete_markers': {
|
||||
'method': 'GET',
|
||||
'reqd_args': ['bucket']
|
||||
},
|
||||
'delete': {
|
||||
'method': 'DELETE',
|
||||
'reqd_args': ['bucket', 'obj_key']
|
||||
},
|
||||
'upload': {
|
||||
'method': 'PUT',
|
||||
'reqd_args': ['bucket', 'obj_key', 'obj_data']
|
||||
},
|
||||
'add_new_site': {
|
||||
'method': 'PUT',
|
||||
'reqd_args': ['site', 'bucket']
|
||||
},
|
||||
'copy_single': {
|
||||
'method': 'POST',
|
||||
'reqd_args': ['source_bucket', 'dest_bucket', 'source_key', 'dest_key']
|
||||
},
|
||||
'fetch_site_list': {
|
||||
'method': 'GET',
|
||||
'reqd_args': ['bucket']
|
||||
},
|
||||
'fetch_object_list_by_site_and_bucket': {
|
||||
'method': 'GET',
|
||||
'reqd_args': ['site', 'bucket']
|
||||
},
|
||||
'fetch_upload_url': {
|
||||
'method': 'PUT',
|
||||
'reqd_args': ['bucket', 'obj_key', 'region', 'content_type']
|
||||
},
|
||||
'query_audit_table': {
|
||||
'method': 'POST',
|
||||
'reqd_args': []
|
||||
}
|
||||
}
|
||||
|
||||
class S3Manager(object):
|
||||
"""
|
||||
This class contains convenience methods for working with S3 objects from Ignition python 2.7
|
||||
"""
|
||||
|
||||
def __init__(self, api_stage='prod', api_region_name='na', username='', profile_name=None):
|
||||
"""
|
||||
Instantiates an S3 Class.
|
||||
|
||||
:param api_stage: str; (default='prod') api target stage (and default S3 folder)
|
||||
:param api_region_name: str; (default='na') api target region (and account)
|
||||
:param username: str; ignition session username (from `session.props.auth.user.userName`)
|
||||
:return: None
|
||||
"""
|
||||
self._logger = LOGGER
|
||||
# sanitize api stage and region values
|
||||
if api_stage not in API_STAGES:
|
||||
self._logger.info("`api_stage` must be one of: %s, received: %s" % (API_STAGES, api_stage))
|
||||
api_stage = 'prod'
|
||||
if api_region_name not in API_REGIONS:
|
||||
self._logger.info("`api_region_name` must be one of: %s, received: %s" % (API_REGIONS, api_region_name))
|
||||
api_region_name = 'na'
|
||||
self._api_stage = api_stage
|
||||
self._api_region_name = api_region_name
|
||||
# grab stage config for this instance from global object
|
||||
self._stage_config = STAGE_CONFIG.get(api_stage, STAGE_CONFIG['prod']).get(api_region_name, STAGE_CONFIG['prod']['na'])
|
||||
d = self._stage_config
|
||||
self._api_region = d.get('region', 'us-east-2')
|
||||
self._s3_region = d.get('s3_region', 'us-east-1')
|
||||
self._repo_bucket = d.get('repo_bucket', 'ignition-image-repo-na')
|
||||
self._source_bucket = d.get('source_bucket', 'ignition-image-source-na')
|
||||
self._lambda_name = d.get('lambda_name', 'RMESDScadaS3ManagementFlaskLambda-prod')
|
||||
self._account_id = d.get('account_id', '006306898152')
|
||||
self._endpoint = d.get('endpoint', 'https://us-east-2.scada-s3-management.scada.eurme.amazon.dev/')
|
||||
self._service = 'execute-api'
|
||||
if profile_name:
|
||||
self._creds = boto3.Session(profile_name=profile_name).get_credentials()
|
||||
# Define an opener method. The opener will apply AWS Sigv4 signing to requests
|
||||
self._opener = aws_urlopen(
|
||||
self._creds.access_key,
|
||||
self._creds.secret_key,
|
||||
self._api_region,
|
||||
self._service,
|
||||
session_token=self._creds.token,
|
||||
verify=False
|
||||
)
|
||||
else:
|
||||
# DEVNOTE: As the API has been segregated from the AWS account for the dev server, assume a dedicated role here
|
||||
sts_client = boto3.Session().client('sts')
|
||||
role_arn = d.get('api_call_role', None)
|
||||
if role_arn:
|
||||
response = sts_client.assume_role(RoleArn=role_arn, RoleSessionName='ignition-s3-mgmt-client')
|
||||
creds = response['Credentials']
|
||||
# Define an opener method. The opener will apply AWS Sigv4 signing to requests
|
||||
self._opener = aws_urlopen(
|
||||
creds['AccessKeyId'],
|
||||
creds['SecretAccessKey'],
|
||||
self._api_region,
|
||||
self._service,
|
||||
session_token=creds['SessionToken'],
|
||||
verify=False
|
||||
)
|
||||
else:
|
||||
# use native boto3 creds if 'api_call_role' not defined in STAGE_CONFIG
|
||||
self._creds = boto3.Session(profile_name=profile_name).get_credentials()
|
||||
self._opener = aws_urlopen(
|
||||
self._creds.access_key,
|
||||
self._creds.secret_key,
|
||||
self._api_region,
|
||||
self._service,
|
||||
session_token=self._creds.token,
|
||||
verify=False
|
||||
)
|
||||
self._headers = {'Content-type': 'application/json', 'X-Remote-User': username}
|
||||
|
||||
def _send(self, operation='download', params={}, print_resp=False, **kwargs):
|
||||
"""
|
||||
private method to compile and send the request to api endpoint
|
||||
|
||||
:param operation: str; api endpoint method for request (See `OPERATION_MAP` for options)
|
||||
:param params: dict; dictionary of parameters to pass to request (See `OPERATION_MAP` for reqd args)
|
||||
:param print_resp: bool; if True, the associated logger will receive a print statement of the raw response, pprint.format'd
|
||||
:return resp: dict; response object from api
|
||||
"""
|
||||
l = self._logger
|
||||
if operation not in OPERATION_MAP.keys():
|
||||
msg = 'operation "%s" is not a valid S3Manager operation! Options: %s' % (operation, list(OPERATION_MAP.keys()))
|
||||
l.error(msg)
|
||||
raise InvalidOperationS3Manager(msg)
|
||||
op_config = OPERATION_MAP[operation]
|
||||
method = op_config['method']
|
||||
reqd_args = op_config['reqd_args']
|
||||
missing_args = [x for x in reqd_args if x not in params.keys()]
|
||||
if len(missing_args):
|
||||
msg = 'The following required args were not provided in params for "%s" operation: %s' % (operation, missing_args)
|
||||
l.error(msg)
|
||||
raise InvalidParametersS3Manager(msg)
|
||||
if method in ('GET', 'DELETE'):
|
||||
querystring = '?%s' % urlencode(params)
|
||||
payload = None
|
||||
url = self._endpoint + operation + querystring
|
||||
else:
|
||||
try:
|
||||
payload = json.dumps(params)
|
||||
l.debug('payload for %s operation successfully serialized' % operation)
|
||||
except:
|
||||
payload = urlencode(params)
|
||||
l.debug('payload for %s operation not serialized using json.dumps(), instead used urlencode()' % operation)
|
||||
url = self._endpoint + operation
|
||||
# Create a request object
|
||||
req = Request(url=url, method=method, headers=self._headers, data=payload)
|
||||
# open the request and process the read
|
||||
try:
|
||||
# use self._opener to sign and send the prepared request
|
||||
resp = self._opener(req)
|
||||
data = json.loads(resp.read())
|
||||
if print_resp:
|
||||
l.info('Response data: %s' % pformat(sanitize_tree(data)))
|
||||
return data
|
||||
except HTTPError, e:
|
||||
try:
|
||||
body = json.loads(e.fp.read())
|
||||
e_msg = body.get('message', e.reason)
|
||||
msg = 'Error sending S3Manager request: %s. Message: %s' % (str(e), e_msg)
|
||||
l.error(msg)
|
||||
raise HTTPErrorS3Manager(e.code, e_msg)
|
||||
except AttributeError, e2:
|
||||
# failed to extract reason or code from urllib2.HTTPError for some reason
|
||||
import traceback
|
||||
msg = 'Failed to extract reason and/or error code from urllib2.HTTPError. Trace: %s' % traceback.format_exc()
|
||||
l.error(msg)
|
||||
msg = 'Error sending S3Manager request: %s' % (str(e))
|
||||
l.error(msg)# raise HTTPErrorS3Manager(e.code, msg)
|
||||
raise HTTPErrorS3Manager(400, msg)
|
||||
|
||||
def upload(self, obj_data, obj_key, bucket=None, content_type='', region=None, **kwargs):
|
||||
"""
|
||||
Method to upload a JSON object to S3. Converts S3 to a compressed binary parquet file, then writes
|
||||
the file to S3.
|
||||
|
||||
:param obj_data: JSON data object to upload to S3
|
||||
:param obj_key: Path and object name of the object to create in S3
|
||||
:param bucket: S3 bucket to write data to.
|
||||
:param content_type: str; 'application/json' for json files, 'image/svg+xml' for svg files
|
||||
:param region: AWS region that hosts the target S3 bucket.
|
||||
:return: Boto3 `put_object` response
|
||||
"""
|
||||
l = self._logger
|
||||
if not bucket:
|
||||
# if no bucket provided, use repo bucket name from stage config
|
||||
bucket = self._repo_bucket
|
||||
if not region:
|
||||
# if no region provided, use region name from stage config
|
||||
region = self._s3_region
|
||||
l.info('Uploading %s dataset to bucket %s' % (obj_key, bucket))
|
||||
l.debug('++ Storing data file in S3')
|
||||
operation = 'upload'
|
||||
# check the suffix of obj_key and auto-populate content_type accordingly
|
||||
if obj_key.endswith('json'):
|
||||
content_type = 'application/json'
|
||||
elif obj_key.endswith('svg'):
|
||||
content_type = 'image/svg+xml'
|
||||
elif obj_key.endswith('drawio'):
|
||||
content_type = 'binary/octet-stream'
|
||||
try:
|
||||
if isinstance(obj_data, dict):
|
||||
# serialize the object to a JSON string
|
||||
obj_data = json.dumps(obj_data)
|
||||
msg = '++ Uploading. Successfully serialized (json dump) object data for %s' % obj_key
|
||||
l.debug(msg)
|
||||
else:
|
||||
msg = 'Uploading. Type of incoming object data: %s' % type(obj_data)
|
||||
l.debug(msg)
|
||||
except:
|
||||
import traceback
|
||||
msg = '++ Uploading. Error trying to serialize (json dump) object data: %s' % traceback.format_exc()
|
||||
l.error(msg)
|
||||
return msg
|
||||
# params = {
|
||||
# 'bucket': bucket,
|
||||
# 'obj_key': obj_key,
|
||||
# 'obj_data': obj_data,
|
||||
# 'content_type': content_type,
|
||||
# 'region': region
|
||||
# }
|
||||
# try:
|
||||
# resp = self._send(operation, params, print_resp=kwargs.get('print_resp', False))
|
||||
# l.debug('** Uploading Complete. Successfully uploaded %s' % obj_key)
|
||||
# return resp
|
||||
# except HTTPErrorS3Manager, e:
|
||||
# return {'code': e.code, 'message': e.message}
|
||||
# DEVNOTE: As there is a 10mb limitation on payload size to API gateway calls, going to use the
|
||||
# `fetch_upload_url` method to get a presigned upload link and upload via system.net.httpPut
|
||||
# so the above code will be commented out to use the below code
|
||||
params = {
|
||||
'bucket': bucket,
|
||||
'obj_key': obj_key,
|
||||
'region': region,
|
||||
'content_type': content_type
|
||||
}
|
||||
try:
|
||||
upload_url = self.fetch_upload_url(**params)
|
||||
l.debug('** Fetching Upload URL Complete for object key: %s' % obj_key)
|
||||
except HTTPErrorS3Manager, e:
|
||||
return {'code': e.code, 'message': e.message}
|
||||
try:
|
||||
# DEVNOTE: Test code below to upload to pre-signed S3 PUT url using urllib2_aws4auth module
|
||||
# Create a request object using urllib2_aws4auth.Request and aws_urlopen methods
|
||||
# see if this is limited like with the upload call to API gateway.
|
||||
# system.net.httpPut call below is not limited
|
||||
# Results: what works with `system.net.httpPut` fails with `urllib2_aws4auth` module (returns 400: BadRequest)
|
||||
# if the file is > ~ 75 kb
|
||||
# req = Request(url=upload_url, method='PUT', headers=self._headers, data=obj_data)
|
||||
# resp = self._opener(req).read()
|
||||
# msg = '** Successfully uploaded %s to %s bucket!\nResponse: %s' % (obj_key, bucket, pformat(resp))
|
||||
resp = system.net.httpPut(upload_url, putData=obj_data, contentType=content_type)
|
||||
msg = '** Successfully uploaded %s to %s bucket!' % (obj_key, bucket)
|
||||
l.debug(msg)
|
||||
return {'code': 200, 'message': msg}
|
||||
except Exception, e:
|
||||
msg = '++ Error uploading %s to %s bucket: %s' % (obj_key, bucket, str(e))
|
||||
l.error(msg)
|
||||
return {'code': 400, 'message': msg}
|
||||
|
||||
def fetch_upload_url(self, obj_key, bucket=None, region=None, expiration=3600, content_type="image/svg+xml", **kwargs):
|
||||
"""
|
||||
Retrieves a pre-signed URL for the obj key and bucket and the `put_object` client method.
|
||||
Caller then uses pre-signed URL to upload the file to S3 directly.
|
||||
|
||||
:param obj_key: Path and object name of the object to create in S3
|
||||
:param bucket: S3 bucket to write data to.
|
||||
:param region: AWS region that hosts the target S3 bucket.
|
||||
:param expiration: int; number of seconds until the link expires (default = 3600, 1 hour)
|
||||
:param content_type: str; the content-type of the object (default = 'image/svg+xml')
|
||||
:return: str; presigned URL as string.
|
||||
"""
|
||||
l = self._logger
|
||||
if not bucket:
|
||||
# if no bucket provided, use repo bucket name from stage config
|
||||
bucket = self._repo_bucket
|
||||
if not region:
|
||||
# if no region provided, use region name from stage config
|
||||
region = self._s3_region
|
||||
l.info('Fetching upload pre-signed URL for %s object in %s bucket' % (obj_key, bucket))
|
||||
operation = 'fetch_upload_url'
|
||||
params = {
|
||||
'bucket': bucket,
|
||||
'obj_key': obj_key,
|
||||
'expiration': expiration,
|
||||
'region': region,
|
||||
'content_type': content_type
|
||||
}
|
||||
try:
|
||||
resp = self._send(operation, params, print_resp=kwargs.get('print_resp', False))
|
||||
l.debug('** Fetching Upload URL Completed for %s' % obj_key)
|
||||
return resp
|
||||
except HTTPErrorS3Manager, e:
|
||||
return {'code': e.code, 'message': e.message}
|
||||
|
||||
def add_new_site(self, site=None, bucket='both', **kwargs):
|
||||
"""
|
||||
Adds a new site folder to either repo, source, or both buckets
|
||||
|
||||
:param site: str; name of site/WHID. Must be 4 chars in format of "ABC1"
|
||||
:param bucket: str; name of the bucket (S3_REPO_BUCKET_NAME, S3_SOURCE_BUCKET_NAME, or 'both') to add site folder to
|
||||
if = 'both', then site folder will be added to both buckets
|
||||
:return: dict; {'message': str} summarizing the folder add operation
|
||||
"""
|
||||
l = self._logger
|
||||
l.info('Adding site %s folder' % (site))
|
||||
operation = 'add_new_site'
|
||||
params = {'site': site, 'bucket': bucket}
|
||||
try:
|
||||
resp = self._send(operation, params, print_resp=kwargs.get('print_resp', False))
|
||||
l.debug('** Adding Site Complete. Successfully added %s to %s bucket(s)' % (site, bucket))
|
||||
return resp
|
||||
except HTTPErrorS3Manager, e:
|
||||
return {'code': e.code, 'message': e.message}
|
||||
|
||||
def download(self, obj_key, bucket=None, region=None):
|
||||
"""
|
||||
Downloads a JSON object from S3. File is received as a compressed binary Parquet file
|
||||
:param obj_key: Path and object name of the data stored in S3
|
||||
:param bucket: Bucket the target object is stored in.
|
||||
:param region: AWS Region of the target bucket.
|
||||
:return: JSON data object generated from the Parquet file stored in S3
|
||||
"""
|
||||
l = self._logger
|
||||
if not bucket:
|
||||
# if no bucket provided, use repo bucket name from stage config
|
||||
bucket = self._repo_bucket
|
||||
if not region:
|
||||
# if no region provided, use region name from stage config
|
||||
region = self._s3_region
|
||||
# - Only used for logging; extract dates and data source from the object key
|
||||
obj_key_parts = obj_key.split('/')
|
||||
l.info('-- Downloading %s object from bucket %s' % (obj_key, bucket))
|
||||
operation = 'download'
|
||||
params = {
|
||||
'bucket': bucket,
|
||||
'obj_key': obj_key,
|
||||
'region': region
|
||||
}
|
||||
try:
|
||||
resp = self._send(operation, params)
|
||||
return resp
|
||||
except HTTPErrorS3Manager, e:
|
||||
return {'code': e.code, 'message': e.message}
|
||||
|
||||
def get_presigned_url(self, bucket=None, obj_key='', client_method='get_object', expiration=3600, region=None, content_type="text/plain"):
|
||||
"""
|
||||
Generate a presigned URL to object from S3.
|
||||
Used primarily for retreiving image objects in Ignition
|
||||
|
||||
:param obj_key: str; uri of object to fetch
|
||||
:param bucket_: str; bucket name where object resides
|
||||
:param client_method: str; (default = 'get_object')
|
||||
:param expiration: int; number of seconds until the link expires (default = 3600, 1 hour)
|
||||
:param content_type: str; the content-type of the object (default = 'text/plain')
|
||||
:return: str; presigned URL as string. If no client_method or error, returns None.
|
||||
"""
|
||||
l = self._logger
|
||||
if not bucket:
|
||||
# if no bucket provided, use repo bucket name from stage config
|
||||
bucket = self._repo_bucket
|
||||
if not region:
|
||||
# if no region provided, use region name from stage config
|
||||
region = self._s3_region
|
||||
if not content_type:
|
||||
msg = 'content_type cannot be null!'
|
||||
l.error(msg)
|
||||
raise InvalidParametersS3Manager(msg)
|
||||
l.info('Fetching pre-signed url for %s from bucket %s' % (obj_key, bucket))
|
||||
operation = 'get_presigned_url'
|
||||
params = {
|
||||
'bucket': bucket,
|
||||
'obj_key': obj_key,
|
||||
'client_method': client_method,
|
||||
'expiration': expiration,
|
||||
'content_type': content_type
|
||||
}
|
||||
try:
|
||||
resp = self._send(operation, params)
|
||||
return resp
|
||||
except HTTPErrorS3Manager, e:
|
||||
return {'code': e.code, 'message': e.message}
|
||||
|
||||
def delete(self, obj_key, bucket=None, region=None):
|
||||
"""
|
||||
Deletes a JSON object from S3. File is flagged for deletion in the S3 bucket
|
||||
:param obj_key: Path and object name of the data stored in S3
|
||||
:param bucket: Bucket the target object is stored in.
|
||||
:param region: AWS Region of the target bucket.
|
||||
:return: Boto3 `delete_object` response
|
||||
"""
|
||||
l = self._logger
|
||||
if not bucket:
|
||||
# if no bucket provided, use repo bucket name from stage config
|
||||
bucket = self._repo_bucket
|
||||
if not region:
|
||||
# if no region provided, use region name from stage config
|
||||
region = self._s3_region
|
||||
l.info('Deleting %s object from bucket %s' % (obj_key, bucket))
|
||||
operation = 'delete'
|
||||
params = {
|
||||
'bucket': bucket,
|
||||
'obj_key': obj_key,
|
||||
'region': region
|
||||
}
|
||||
try:
|
||||
resp = self._send(operation, params)
|
||||
l.debug('** Complete. Successfully deleted %s' % obj_key)
|
||||
return resp
|
||||
except HTTPErrorS3Manager, e:
|
||||
return {'code': e.code, 'message': e.message}
|
||||
|
||||
def list_objects(self, bucket=None, prefix='', start_after='', region=None):
|
||||
"""
|
||||
Fetches a list of objects within a specified bucket, prefix, and starting point
|
||||
|
||||
:param bucket: str; Bucket target object is located
|
||||
:param prefix: str; Limits the response to keys that begin with the specified prefix
|
||||
:param start_after: str; StartAfter is where you want Amazon S3 to start listing from.
|
||||
Amazon S3 starts listing after this specified key. StartAfter can be any key in the bucket.
|
||||
:param region: Region of the target S3 Bucket
|
||||
:return: Boto3 `list_objects_v2.Contents` response. This consists of the following keys per object returned:
|
||||
{
|
||||
'ETag': str; unique id,
|
||||
'Key': str; path to object in bucket,
|
||||
'LastModified': datetime.datetime(); time object last modified,
|
||||
'Size': int; size in bytes of the object,
|
||||
'StorageClass': str; type of storage used on the object
|
||||
}
|
||||
"""
|
||||
l = self._logger
|
||||
if not bucket:
|
||||
# if no bucket provided, use repo bucket name from stage config
|
||||
bucket = self._repo_bucket
|
||||
if not region:
|
||||
# if no region provided, use region name from stage config
|
||||
region = self._s3_region
|
||||
l.info('Fetching list of objects from bucket %s' % bucket)
|
||||
operation = 'list_objects'
|
||||
params = {
|
||||
'bucket': bucket,
|
||||
'prefix': prefix,
|
||||
'start_after': start_after,
|
||||
'region': region
|
||||
}
|
||||
try:
|
||||
resp = self._send(operation, params)
|
||||
return resp
|
||||
except HTTPErrorS3Manager, e:
|
||||
return {'code': e.code, 'message': e.message}
|
||||
|
||||
def list_object_versions(self, bucket=None, prefix='', region=None):
|
||||
"""
|
||||
Fetches a list of object versions within a specified bucket, prefix, and starting point
|
||||
|
||||
:param bucket: str; Bucket target object is located
|
||||
:param prefix: str; Limits the response to keys that begin with the specified prefix
|
||||
:param region: Region of the target S3 Bucket
|
||||
:return: Boto3 `list_object_versions.Versions` response. This consists of the following keys per object returned:
|
||||
{
|
||||
'ETag': str; unique id,
|
||||
'IsLatest': bool; only true for the current version,
|
||||
'Key': str; path to object in bucket,
|
||||
'LastModified': datetime.datetime(); time object last modified,
|
||||
'Owner': {'DisplayName': str; name of owner/group, 'ID': str;,}
|
||||
'Size': int; size in bytes of the object,
|
||||
'StorageClass': str; type of storage used on the object,
|
||||
'VersionId': str; ID of object version
|
||||
}
|
||||
"""
|
||||
l = self._logger
|
||||
if not bucket:
|
||||
# if no bucket provided, use repo bucket name from stage config
|
||||
bucket = self._repo_bucket
|
||||
if not region:
|
||||
# if no region provided, use region name from stage config
|
||||
region = self._s3_region
|
||||
l.info('Fetching list of object versions from bucket %s' % bucket)
|
||||
operation = 'list_object_versions'
|
||||
params = {
|
||||
'bucket': bucket,
|
||||
'prefix': prefix,
|
||||
'region': region
|
||||
}
|
||||
try:
|
||||
resp = self._send(operation, params)
|
||||
return resp
|
||||
except HTTPErrorS3Manager, e:
|
||||
return {'code': e.code, 'message': e.message}
|
||||
|
||||
def list_object_delete_markers(self, bucket=None, prefix='', region=None):
|
||||
"""
|
||||
Fetches a list of object delete markers within a specified bucket, prefix, and starting point
|
||||
|
||||
:param bucket: str; Bucket target object is located
|
||||
:param prefix: str; Limits the response to keys that begin with the specified prefix
|
||||
:param region: Region of the target S3 Bucket
|
||||
:return: Boto3 `list_object_versions.DeleteMarkers` response. This consists of the following keys per object returned:
|
||||
{
|
||||
'IsLatest': bool; only true for the current version,
|
||||
'Key': str; path to object in bucket,
|
||||
'LastModified': datetime.datetime(); time object last modified,
|
||||
'Owner': {'DisplayName': str; name of owner/group, 'ID': str;,}
|
||||
'VersionId': str; ID of object version
|
||||
}
|
||||
"""
|
||||
l = self._logger
|
||||
if not bucket:
|
||||
# if no bucket provided, use repo bucket name from stage config
|
||||
bucket = self._repo_bucket
|
||||
if not region:
|
||||
# if no region provided, use region name from stage config
|
||||
region = self._s3_region
|
||||
l.info('Fetching list of object delete markers from bucket %s' % bucket)
|
||||
operation = 'list_object_delete_markers'
|
||||
params = {
|
||||
'bucket': bucket,
|
||||
'prefix': prefix,
|
||||
'region': region
|
||||
}
|
||||
try:
|
||||
resp = self._send(operation, params)
|
||||
return resp
|
||||
except HTTPErrorS3Manager, e:
|
||||
return {'code': e.code, 'message': e.message}
|
||||
|
||||
def copy_single(self, source_bucket=None, dest_bucket=None, source_key='', dest_key='', region=None):
|
||||
"""
|
||||
Method to copy a single object from source bucket|key to destination bucket|key.
|
||||
|
||||
:param source_bucket: str; Source bucket name to copy from
|
||||
:param dest_bucket: str; Destination bucket name to copy to
|
||||
:param source_key: str; Source object key name to copy
|
||||
:param dest_key: str; Destination object key name to copy to
|
||||
:param region: Region of the target S3 Bucket
|
||||
:return: null or ClientError; returns null if successfully copied
|
||||
"""
|
||||
l = self._logger
|
||||
if not source_bucket:
|
||||
# if no source bucket provided, use repo bucket name from stage config
|
||||
source_bucket = self._repo_bucket
|
||||
if not dest_bucket:
|
||||
# if no destination bucket provided, use repo bucket name from stage config
|
||||
dest_bucket = self._repo_bucket
|
||||
if not region:
|
||||
# if no region provided, use region name from stage config
|
||||
region = self._s3_region
|
||||
l.info('Copying %s object from bucket %s to object %s in bucket %s' % (source_key, source_bucket, dest_key, dest_bucket))
|
||||
l.debug('++ Copying data in S3')
|
||||
operation = 'copy_single'
|
||||
params = {
|
||||
'source_bucket': source_bucket,
|
||||
'dest_bucket': dest_bucket,
|
||||
'source_key': source_key,
|
||||
'dest_key': dest_key,
|
||||
'region': region
|
||||
}
|
||||
try:
|
||||
resp = self._send(operation, params)
|
||||
l.debug('** Complete. Successfully copied object %s from bucket %s to object %s in bucket %s' %
|
||||
(source_key, source_bucket, dest_key, dest_bucket))
|
||||
return resp
|
||||
except HTTPErrorS3Manager, e:
|
||||
return {'code': e.code, 'message': e.message}
|
||||
|
||||
def fetch_site_list(self, bucket=None):
|
||||
"""
|
||||
This method will compile a list of all sites configured in the requested S3 bucket
|
||||
|
||||
:param bucket: str; the S3 bucket to fetch sites from. (Default = S3_REPO_BUCKET_NAME)
|
||||
:return: list; array of whids present in the S3 bucket
|
||||
"""
|
||||
l = self._logger
|
||||
if not bucket:
|
||||
# if no bucket provided, use repo bucket name from stage config
|
||||
bucket = self._repo_bucket
|
||||
l.info('Requesting site list for bucket: %s' % bucket)
|
||||
operation = 'fetch_site_list'
|
||||
params = {
|
||||
'bucket': bucket
|
||||
}
|
||||
try:
|
||||
resp = self._send(operation, params)
|
||||
l.debug('** Complete. Successfully returned %d sites for bucket %s' % (len(resp), bucket))
|
||||
return resp
|
||||
except HTTPErrorS3Manager, e:
|
||||
return {'code': e.code, 'message': e.message}
|
||||
|
||||
def fetch_object_list_by_site_and_bucket(self, site='', bucket=None):
|
||||
"""
|
||||
This function fetches the list of file objects
|
||||
from the S3 folder specified by the bucket and site args supplied.
|
||||
|
||||
:param site: str; whid name of the site to fetch from
|
||||
:param bucket: str; name of the bucket where the files reside
|
||||
:return: Dict[str, Any]; {'instance_configs': Dict[str,Any], 'flow_views': List[str]}
|
||||
"""
|
||||
l = self._logger
|
||||
if not bucket:
|
||||
# if no bucket provided, use repo bucket name from stage config
|
||||
bucket = self._repo_bucket
|
||||
l.info('Requesting object list for site %s in bucket: %s' % (site, bucket))
|
||||
operation = 'fetch_object_list_by_site_and_bucket'
|
||||
params = {
|
||||
'site': site,
|
||||
'bucket': bucket
|
||||
}
|
||||
try:
|
||||
resp = self._send(operation, params)
|
||||
l.debug('** Complete. Successfully returned object list for site %s on bucket %s' % (site, bucket))
|
||||
return resp
|
||||
except HTTPErrorS3Manager, e:
|
||||
return {'code': e.code, 'message': e.message}
|
||||
|
||||
def query_audit_table(self, start_time = None, end_time = None, operation = None, copy_option = None,
|
||||
destination_bucket = None, destination_view = None, destination_object_key = None,
|
||||
destination_site = None, destination_stage = None, destination_version_id = None,
|
||||
error_message = None, error_occurred = None, expires = None,
|
||||
source_bucket = None, source_view = None, source_object_key = None, source_site = None,
|
||||
source_stage = None, source_version_id = None, timestamp = None, username = None,
|
||||
return_items_only = True, **kwargs):
|
||||
"""
|
||||
Query/scan the audit table and return records matching the supplied parameters
|
||||
|
||||
:param start_time: Optional[Union[str,datetime]]; if provided, will define the beginning of the
|
||||
time range to filter on the `timestamp` column. `timestamp` column is a string in the format
|
||||
"%Y-%m-%d %H:%M:%S"
|
||||
:param end_time: Optional[Union[str,datetime]]; if provided, will define the beginning of the
|
||||
time range to filter on the `timestamp` column. `timestamp` column is a string in the format
|
||||
"%Y-%m-%d %H:%M:%S"
|
||||
:param operation: Optional[Union[str,List,Dict]]; match on operation column
|
||||
:param copy_option: Optional[Union[str,List,Dict]]; match on copy_option column ('svg', 'json', 'both')
|
||||
:param destination_bucket: Optional[Union[str,List,Dict]]; match on destination_bucket column
|
||||
:param destination_view: Optional[Union[str,List,Dict]]; match on destination_view column
|
||||
:param destination_object_key: Optional[Union[str,List,Dict]]; match on destination_object_key column
|
||||
:param destination_site: Optional[Union[str,List,Dict]]; match on destination_site column
|
||||
:param destination_stage: Optional[Union[str,List,Dict]]; match on destination_stage column
|
||||
:param destination_version_id: Optional[Union[str,List,Dict]]; match on destination_version_id column
|
||||
:param error_message: Optional[Union[str,List,Dict]]; match on error_message column
|
||||
:param error_occurred: Optional[Union[bool,List,Dict]]; match on error_error_occurred column
|
||||
:param expires: Optional[Union[str,List,Dict]]; match/filter on expires column
|
||||
:param source_bucket: Optional[Union[str,List,Dict]]; match on source_bucket column
|
||||
:param source_view: Optional[Union[str,List,Dict]]; match on source_view column
|
||||
:param source_object_key: Optional[Union[str,List,Dict]]; match on source_object_key column
|
||||
:param source_site: Optional[Union[str,List,Dict]]; match on source_site column
|
||||
:param source_stage: Optional[Union[str,List,Dict]]; match on source_stage column
|
||||
:param source_version_id: Optional[Union[str,List,Dict]]; match on source_version_id column
|
||||
:param timestamp: Optional[Union[str,List,Dict]]; match/filter on timestamp column
|
||||
(overridden by `start_time` and `end_time` args)
|
||||
:param username: Optional[Union[str,List,Dict]]; match on username column
|
||||
:param return_items_only: bool; if true, strip the `Items` from boto3 response,
|
||||
if false, return the entire response object
|
||||
:returns: List[Dict[str,Any]]; array of items that match the scan filters supplied
|
||||
"""
|
||||
l = self._logger
|
||||
# build params to send to Lambda using `locals()`. I know it's frowned upon but I'm not trying to type all that!!
|
||||
params = {k:v for k,v in locals().items() if k not in ('self', 'l', 'kwargs') and v not in (None, '')}
|
||||
# override `operation` arg for pass to `_send` method, as the value to query is already packed in `params`
|
||||
operation = 'query_audit_table'
|
||||
try:
|
||||
resp = self._send(operation, params)
|
||||
l.debug('** Complete. Successfully queried audit table using supplied query params')
|
||||
return resp
|
||||
except HTTPErrorS3Manager, e:
|
||||
return {'code': e.code, 'message': e.message}
|
||||
|
||||
def check_user_site_permissions(self, whid = None, obj_key = None):
|
||||
"""
|
||||
Check if a given username has permissions to the site folder in the flow-view S3 bucket
|
||||
|
||||
:param whid: str; warehouse id/site name to check
|
||||
:param obj_key: str; [OPTIONAL] if provided, will check user permissions to the object key, rather than the whid
|
||||
:return: Dict[str,Any]; {
|
||||
'code': int; 200 if the user has permissions, 403 if Forbidden to access
|
||||
'message': str; explanation to display, if needed. Will include necessary group memberships missing if Forbidden
|
||||
}
|
||||
"""
|
||||
l = self._logger
|
||||
operation = 'check_user_site_permissions'
|
||||
params = {'whid': whid, 'obj_key': obj_key}
|
||||
try:
|
||||
resp = self._send(operation, params)
|
||||
l.debug('** Complete. Successfully checked user site permissions on backend')
|
||||
return resp
|
||||
except HTTPErrorS3Manager, e:
|
||||
return {'code': e.code, 'message': e.message}
|
||||
|
||||
def fetch_user_site_permissions_and_area_list(self, username = None, stage_name = 'beta'):
|
||||
"""
|
||||
Fetch the sites for which the user has flow-view write permissions for the given stage.
|
||||
Also fetches the list of "area" names that flow-views can be created for
|
||||
|
||||
:param username: str; user alias/id to fetch sites for
|
||||
:param stage_name: str; stage folder of flow-view resources to check permissions on
|
||||
:return: Dict[str,Any]; response object including a list of sites and area names.
|
||||
{
|
||||
"code": int; 200 if successful call, 4** if user not found,
|
||||
"sites": List[str]; List of site names,
|
||||
"areas": List[str]; List of valid flow-view area names
|
||||
}
|
||||
"""
|
||||
l = self._logger
|
||||
operation = 'fetch_user_site_permissions_and_area_list'
|
||||
params = {'username': username, 'stage_name': stage_name}
|
||||
try:
|
||||
resp = self._send(operation, params)
|
||||
l.debug('** Complete. Successfully fetched user site permissions and area list')
|
||||
return resp
|
||||
except HTTPErrorS3Manager, e:
|
||||
return {'code': e.code, 'message': e.message}
|
||||
|
||||
def fetch_master_area_list(self):
|
||||
"""
|
||||
Download a master list of valid flow-view area names, stored in S3
|
||||
|
||||
:return: List[str]; returns list of area names
|
||||
"""
|
||||
l = self._logger
|
||||
operation = 'fetch_master_area_list'
|
||||
params = {}
|
||||
try:
|
||||
resp = self._send(operation, params)
|
||||
l.debug('** Complete. Successfully fetched master area list')
|
||||
return resp
|
||||
except HTTPErrorS3Manager, e:
|
||||
return {'code': e.code, 'message': e.message}
|
||||
|
||||
class InvalidOperationS3Manager(Exception):
|
||||
"""
|
||||
Invalid operation requested for S3Manager class
|
||||
"""
|
||||
def __init__(self, code=400, msg='Invalid operation requested for S3Manager class'):
|
||||
self.code = code
|
||||
self.message = msg
|
||||
|
||||
|
||||
class InvalidParametersS3Manager(Exception):
|
||||
"""
|
||||
Invalid parameters for S3Manager operation
|
||||
"""
|
||||
def __init__(self, code=400, msg='Invalid parameters for S3Manager operation'):
|
||||
self.code = code
|
||||
self.message = msg
|
||||
|
||||
|
||||
class HTTPErrorS3Manager(Exception):
|
||||
"""
|
||||
HTTP Error for S3Manager Request
|
||||
"""
|
||||
def __init__(self, code=500, msg='HTTP Error Encountered Sending S3Manager Request'):
|
||||
self.code = code
|
||||
self.message = msg
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
{
|
||||
"custom": {},
|
||||
"params": {
|
||||
"text": "value"
|
||||
},
|
||||
"propConfig": {
|
||||
"params.text": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 30,
|
||||
"width": 210
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "209px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{view.params.text}"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"classes": "Text/CenterAlign_with_Padding"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"alignItems": "center",
|
||||
"justify": "center",
|
||||
"style": {
|
||||
"overflow": "hidden"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 6.8 KiB |
@ -0,0 +1,7 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"marginBottom": "2px"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"backgroundColor": "#AAAAAA",
|
||||
"borderColor": "#808080",
|
||||
"borderStyle": "none",
|
||||
"color": "#555555",
|
||||
"margin": "5px",
|
||||
"fill": "#2B2B2B"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"backgroundColor": "var(--neutral-60)",
|
||||
"borderTopLeftRadius": "4px",
|
||||
"borderTopRightRadius": "4px",
|
||||
"borderBottomLeftRadius": "4px",
|
||||
"borderBottomRightRadius": "4px",
|
||||
"color": "var(--neutral-10)",
|
||||
"fontSize": "12px",
|
||||
"fontWeight": "bold",
|
||||
"lineHeight": "16px",
|
||||
"padding": "2px",
|
||||
"textAlign": "center"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,244 @@
|
||||
{
|
||||
"custom": {},
|
||||
"params": {
|
||||
"device_name": "Test",
|
||||
"driver": "value",
|
||||
"enabled": false,
|
||||
"host_name": "value",
|
||||
"status": "value"
|
||||
},
|
||||
"propConfig": {
|
||||
"params.device_name": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.driver": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.enabled": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.host_name": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.status": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 50,
|
||||
"width": 1908
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "400px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.device_name"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"textAlign": "center"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label_0"
|
||||
},
|
||||
"position": {
|
||||
"basis": "400px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.driver"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"textAlign": "center"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label_1"
|
||||
},
|
||||
"position": {
|
||||
"basis": "200px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.enabled"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"textAlign": "center"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label_2"
|
||||
},
|
||||
"position": {
|
||||
"basis": "564px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.status"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"textAlign": "center"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label_3"
|
||||
},
|
||||
"position": {
|
||||
"basis": "564px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.host_name"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"textAlign": "center"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label_0"
|
||||
},
|
||||
"position": {
|
||||
"basis": "2px",
|
||||
"grow": 1
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\timport sys\n\tfrom java.lang import Exception\n\t\n\ttry:\n\t\tif system.tag.exists(\"System/DeviceList\"):\n\t\t\tdevice_cfg \u003d system.tag.read(\"System/DeviceList\").value\n\t\t\tif device_cfg\u003d\u003d\u0027\u0027:\n\t\t\t\tdevice_cfg\u003d\u0027{}\u0027\n\t\t\tcfg \u003d system.util.jsonDecode(device_cfg)\n\t\t\tenabled \u003d self.view.params.enabled\n\t\t\tdevice \u003d self.view.params.device_name\n\t\t\tsystem.perspective.print(enabled)\n\t\t\tif enabled:\n\t\t\t\tdevice_list \u003d cfg.get(\"Devicedisable\",[])\n\t\t\t\tif device not in device_list:\n\t\t\t\t\tdevice_list.append(device)\n\t\t\t\tcfg[\"Devicedisable\"] \u003d device_list\n\t\t\tif not enabled:\n\t\t\t\tdevice_list \u003d cfg.get(\"DeviceEnable\",[])\n\t\t\t\tif device not in device_list:\n\t\t\t\t\tdevice_list.append(device)\n\t\t\t\tcfg[\"DeviceEnable\"] \u003d device_list\n\t\t\tsystem.perspective.print(cfg) \n\t\t\tencode \u003d system.util.jsonEncode(cfg)\n\t\t\tsystem.tag.write(\"System/DeviceList\",encode)\t\n\texcept:\n\t logger \u003d system.util.getLogger(\"Device_Enable\")\n\t exc_type, exc_obj, tb \u003d sys.exc_info()\n\t lineno \u003d tb.tb_lineno\n\t errorMessage\u003d str(lineno) + str(exc_type) + str(exc_obj)\n\t #system.gui.errorBox(errorMessage,\"Error\")\n\t "
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Button_0"
|
||||
},
|
||||
"position": {
|
||||
"basis": "50px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({view.params.enabled} \u003d True, \"Disable Device\", \"Enable Device\")"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"classes": "Buttons/PB_1"
|
||||
}
|
||||
},
|
||||
"type": "ia.input.button"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "2px",
|
||||
"grow": 1
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer"
|
||||
},
|
||||
"position": {
|
||||
"basis": "200px"
|
||||
},
|
||||
"props": {
|
||||
"direction": "column"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"custom": {
|
||||
"update": "value",
|
||||
"update_enable": "value"
|
||||
},
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"borderStyle": "ridge"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 5.1 KiB |
@ -0,0 +1,20 @@
|
||||
def navigate_to_additional_view(self):
|
||||
"""
|
||||
This function is used to navigate to a page from a navigation button.
|
||||
This function can be used on any button that has a property called "self.custom.page_id"
|
||||
which is the target page for the button.
|
||||
Args:
|
||||
self: Refrence to the object that is invoking this function.
|
||||
|
||||
Returns:
|
||||
This is a description of what is returned.
|
||||
|
||||
Raises:
|
||||
KeyError: Raises an exception.
|
||||
"""
|
||||
|
||||
page_id = self.custom.page_id
|
||||
plc = page_id.split("-")[0]
|
||||
url_to_navigate = "/DetailedView/%s/%s" % (page_id, plc)
|
||||
system.perspective.navigate(page = url_to_navigate)
|
||||
|
||||
@ -0,0 +1,66 @@
|
||||
#from logging import raiseExceptions
|
||||
|
||||
|
||||
class GetStatus():
|
||||
|
||||
def __init__(self, whid, alarm_data):
|
||||
self.alarm_data = alarm_data
|
||||
self.priority_dict = {}
|
||||
self.id_to_status = {}
|
||||
self.tag_provider = "[%s_SCADA_TAG_PROVIDER]" % (whid)
|
||||
self.logger = system.util.getLogger("%s-Update-Visualisation" % (whid))
|
||||
|
||||
def convert_priority(self, priority):
|
||||
#The alarm priority is converted into a status
|
||||
#This is based on the highest active alarm priority
|
||||
if str(priority) == "0":
|
||||
return 4
|
||||
elif str(priority) == "1":
|
||||
return 3
|
||||
elif str(priority) == "2":
|
||||
return 2
|
||||
elif str(priority) == "3" or priority == "4":
|
||||
return 1
|
||||
else:
|
||||
return 6
|
||||
|
||||
def check_priority(self, alarm_id, priority):
|
||||
#We check to see if the current priority is greater
|
||||
#than the current priority in the priority_dict. This is
|
||||
#because the status is based on the active alarm. With the
|
||||
#highest priority.
|
||||
controller_id = alarm_id.split("/")[0]
|
||||
if self.priority_dict.get(controller_id) is None:
|
||||
self.priority_dict[controller_id] = {}
|
||||
self.priority_dict[controller_id][alarm_id] = self.convert_priority(priority)
|
||||
|
||||
elif self.priority_dict[controller_id].get(alarm_id) is None:
|
||||
self.priority_dict[controller_id][alarm_id] = self.convert_priority(priority)
|
||||
|
||||
elif self.priority_dict[controller_id].get(alarm_id) < priority:
|
||||
self.priority_dict[controller_id][alarm_id] = (
|
||||
self.convert_priority
|
||||
(priority)
|
||||
)
|
||||
|
||||
def run_status(self):
|
||||
for i in self.alarm_data:
|
||||
alarm_id = i
|
||||
priority = self.alarm_data.get(i, {}).get("priority")
|
||||
if priority != None:
|
||||
self.check_priority(alarm_id, priority)
|
||||
|
||||
def update_tags(self):
|
||||
device_paths = []
|
||||
status_values = []
|
||||
if isinstance(self.priority_dict, dict):
|
||||
for i in self.priority_dict:
|
||||
device_path = "%sTags/%s/IdToStatus/json" % (self.tag_provider, i)
|
||||
device_paths.append(device_path)
|
||||
status_json = self.priority_dict.get(i)
|
||||
status_values.append(system.util.jsonEncode(status_json, 4))
|
||||
self.logger.info("device paths " + str(device_paths))
|
||||
else:
|
||||
raise TypeError("Not a python dictionary")
|
||||
system.tag.writeAsync(device_paths, status_values)
|
||||
|
||||
@ -0,0 +1,371 @@
|
||||
{
|
||||
"custom": {
|
||||
"activityLogger": {
|
||||
"alt_pageid": "search",
|
||||
"buttonid": "search",
|
||||
"start_time": {
|
||||
"$": [
|
||||
"ts",
|
||||
192,
|
||||
1710275608985
|
||||
],
|
||||
"$ts": 1710275608985
|
||||
}
|
||||
}
|
||||
},
|
||||
"events": {
|
||||
"system": {
|
||||
"onStartup": {
|
||||
"config": {
|
||||
"script": "\tbuttonid \u003d self.custom.activityLogger.buttonid\n\tself.custom.activityLogger.start_time \u003d system.date.now()\n\tactivityLog.productMetrics.callLogger(self, \u0027click\u0027, buttonid)\n\t"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"params": {},
|
||||
"propConfig": {
|
||||
"custom.activityLogger": {
|
||||
"persistent": true
|
||||
},
|
||||
"custom.activityLogger.pageid": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{page.props.path}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"code": "\tif value \u003d\u003d\u0027/\u0027 or value \u003d\u003d \u0027\u0027 or value \u003d\u003d None:\n\t\treturn self.custom.activityLogger.alt_pageid.lower()\n\telse:\n\t\treturn value[1:].lower()",
|
||||
"type": "script"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 294,
|
||||
"width": 500
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "77px"
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"backgroundColor": "#555555",
|
||||
"color": "#FFFFFF",
|
||||
"fontWeight": "bold",
|
||||
"textIndent": "15px"
|
||||
},
|
||||
"text": "Search"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "Icon"
|
||||
},
|
||||
"position": {
|
||||
"basis": "30px"
|
||||
},
|
||||
"props": {
|
||||
"color": "#FFFFFF",
|
||||
"path": "material/search"
|
||||
},
|
||||
"type": "ia.display.icon"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer"
|
||||
},
|
||||
"position": {
|
||||
"basis": "45px"
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"backgroundColor": "#555555"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"events": {
|
||||
"component": {
|
||||
"onRowDoubleClick": {
|
||||
"config": {
|
||||
"script": "\trow \u003d event.value\n\tsource_id \u003d row.get(\"SourceId\") \n\tconfig.project_config.source_id_lookup(self, source_id)\n\tsystem.perspective.closePopup(id \u003d \"Search\")"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Table"
|
||||
},
|
||||
"position": {
|
||||
"basis": "294px"
|
||||
},
|
||||
"props": {
|
||||
"cells": {
|
||||
"style": {
|
||||
"textIndent": "15px"
|
||||
}
|
||||
},
|
||||
"columns": [
|
||||
{
|
||||
"align": "center",
|
||||
"boolean": "checkbox",
|
||||
"dateFormat": "MM/DD/YYYY",
|
||||
"editable": false,
|
||||
"field": "SourceId",
|
||||
"footer": {
|
||||
"align": "center",
|
||||
"justify": "left",
|
||||
"style": {
|
||||
"classes": ""
|
||||
},
|
||||
"title": ""
|
||||
},
|
||||
"header": {
|
||||
"align": "center",
|
||||
"justify": "left",
|
||||
"style": {
|
||||
"classes": ""
|
||||
},
|
||||
"title": ""
|
||||
},
|
||||
"justify": "auto",
|
||||
"number": "value",
|
||||
"numberFormat": "0,0.##",
|
||||
"progressBar": {
|
||||
"bar": {
|
||||
"color": "",
|
||||
"style": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
"max": 100,
|
||||
"min": 0,
|
||||
"track": {
|
||||
"color": "",
|
||||
"style": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
"value": {
|
||||
"enabled": true,
|
||||
"format": "0,0.##",
|
||||
"justify": "center",
|
||||
"style": {
|
||||
"classes": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"render": "auto",
|
||||
"resizable": false,
|
||||
"sort": "none",
|
||||
"sortable": false,
|
||||
"strictWidth": false,
|
||||
"style": {
|
||||
"classes": ""
|
||||
},
|
||||
"toggleSwitch": {
|
||||
"color": {
|
||||
"selected": "",
|
||||
"unselected": ""
|
||||
}
|
||||
},
|
||||
"viewParams": {},
|
||||
"viewPath": "",
|
||||
"visible": true,
|
||||
"width": 200
|
||||
},
|
||||
{
|
||||
"align": "center",
|
||||
"boolean": "checkbox",
|
||||
"dateFormat": "MM/DD/YYYY",
|
||||
"editable": false,
|
||||
"field": "Page",
|
||||
"filter": {
|
||||
"boolean": {
|
||||
"condition": ""
|
||||
},
|
||||
"date": {
|
||||
"condition": "",
|
||||
"value": ""
|
||||
},
|
||||
"enabled": false,
|
||||
"number": {
|
||||
"condition": "",
|
||||
"value": ""
|
||||
},
|
||||
"string": {
|
||||
"condition": "",
|
||||
"value": ""
|
||||
},
|
||||
"visible": "on-hover"
|
||||
},
|
||||
"footer": {
|
||||
"align": "center",
|
||||
"justify": "left",
|
||||
"style": {
|
||||
"classes": ""
|
||||
},
|
||||
"title": ""
|
||||
},
|
||||
"header": {
|
||||
"align": "center",
|
||||
"justify": "left",
|
||||
"style": {
|
||||
"classes": ""
|
||||
},
|
||||
"title": ""
|
||||
},
|
||||
"justify": "auto",
|
||||
"nullFormat": {
|
||||
"includeNullStrings": false,
|
||||
"nullFormatValue": "",
|
||||
"strict": false
|
||||
},
|
||||
"number": "value",
|
||||
"numberFormat": "0,0.##",
|
||||
"progressBar": {
|
||||
"bar": {
|
||||
"color": "",
|
||||
"style": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
"max": 100,
|
||||
"min": 0,
|
||||
"track": {
|
||||
"color": "",
|
||||
"style": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
"value": {
|
||||
"enabled": true,
|
||||
"format": "0,0.##",
|
||||
"justify": "center",
|
||||
"style": {
|
||||
"classes": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"render": "auto",
|
||||
"resizable": true,
|
||||
"sort": "none",
|
||||
"sortable": true,
|
||||
"strictWidth": false,
|
||||
"style": {
|
||||
"classes": ""
|
||||
},
|
||||
"toggleSwitch": {
|
||||
"color": {
|
||||
"selected": "",
|
||||
"unselected": ""
|
||||
}
|
||||
},
|
||||
"viewParams": {},
|
||||
"viewPath": "",
|
||||
"visible": true,
|
||||
"width": ""
|
||||
}
|
||||
],
|
||||
"data": {
|
||||
"$": [
|
||||
"ds",
|
||||
192,
|
||||
1710275544545
|
||||
],
|
||||
"$columns": [
|
||||
{
|
||||
"data": [],
|
||||
"name": "SourceId",
|
||||
"type": "String"
|
||||
},
|
||||
{
|
||||
"data": [],
|
||||
"name": "Page",
|
||||
"type": "String"
|
||||
}
|
||||
]
|
||||
},
|
||||
"filter": {
|
||||
"enabled": true,
|
||||
"style": {
|
||||
"backgroundColor": "#2B2B2B",
|
||||
"color": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
"headerStyle": {
|
||||
"backgroundColor": "#2B2B2B",
|
||||
"color": "#FFFFFF",
|
||||
"textIndent": "15px"
|
||||
},
|
||||
"pager": {
|
||||
"style": {
|
||||
"backgroundColor": "#2B2B2B",
|
||||
"color": "#FFFFFF",
|
||||
"fontWeight": "bold"
|
||||
}
|
||||
},
|
||||
"rows": {
|
||||
"highlight": {
|
||||
"color": "#FFFFFF"
|
||||
},
|
||||
"style": {
|
||||
"classes": "Background-Styles/Controller"
|
||||
}
|
||||
},
|
||||
"virtualized": false
|
||||
},
|
||||
"scripts": {
|
||||
"customMethods": [],
|
||||
"extensionFunctions": null,
|
||||
"messageHandlers": [
|
||||
{
|
||||
"messageType": "search-devices",
|
||||
"pageScope": true,
|
||||
"script": "\tself.props.data \u003d payload.get(\"dataset\")",
|
||||
"sessionScope": false,
|
||||
"viewScope": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "ia.display.table"
|
||||
}
|
||||
],
|
||||
"events": {
|
||||
"system": {
|
||||
"onStartup": {
|
||||
"config": {
|
||||
"script": "\tids \u003d config.project_config.global_project_page_ids\n\tdata \u003d []\n\tfor k,v in ids.items():\n\t items \u003d [str(k),str(v)]\n\t data.append(items)\n\theader \u003d [\"SourceId\", \"Page\"]\n\tdataset \u003d system.dataset.toDataSet(header, data)\n\tself.getChild(\"Table\").props.data \u003d dataset"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"direction": "column"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 18 KiB |
@ -0,0 +1,773 @@
|
||||
{
|
||||
"custom": {
|
||||
"api_region_name": "na",
|
||||
"bucket_options": [
|
||||
{
|
||||
"label": "Image Files",
|
||||
"value": "na-ignition-image-repo"
|
||||
},
|
||||
{
|
||||
"label": "Source Files",
|
||||
"value": "na-ignition-image-source"
|
||||
}
|
||||
],
|
||||
"default_query_params": {
|
||||
"bucket": null,
|
||||
"object_key": null,
|
||||
"site": null,
|
||||
"view": null
|
||||
},
|
||||
"destination_view_suffix": null,
|
||||
"object_key": null,
|
||||
"stage_config": {
|
||||
"account_id": "925510716640",
|
||||
"endpoint": "https://scada-s3-management.narme-scada.rme.amazon.dev/",
|
||||
"lambda_name": "RMESDScadaS3ManagementFlaskLambda-prod",
|
||||
"region": "us-east-2",
|
||||
"repo_bucket": "na-ignition-image-repo",
|
||||
"s3_region": "us-east-1",
|
||||
"source_bucket": "na-ignition-image-source"
|
||||
},
|
||||
"view_options_by_site_and_bucket": [],
|
||||
"view_suffix": null,
|
||||
"whid_options": []
|
||||
},
|
||||
"params": {
|
||||
"query_params": {
|
||||
"bucket": null,
|
||||
"object_key": null,
|
||||
"site": null,
|
||||
"view": null
|
||||
}
|
||||
},
|
||||
"propConfig": {
|
||||
"custom.api_region_name": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "session.custom.aws.prefix"
|
||||
},
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.bucket_options": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.stage_config"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"code": "\treturn [{\u0027value\u0027: value.repo_bucket, \u0027label\u0027: \u0027Image Files\u0027},\n\t\t\t{\u0027value\u0027: value.source_bucket, \u0027label\u0027: \u0027Source Files\u0027}]",
|
||||
"type": "script"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.default_query_params": {
|
||||
"persistent": true
|
||||
},
|
||||
"custom.object_key": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.query_params"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"code": "\tstage_config \u003d self.custom.stage_config\n\tbucket \u003d self.params.query_params.bucket\n\tsite \u003d self.params.query_params.site\n\tview \u003d self.params.query_params.view\n\tif bucket and site and view:\n\t\tif bucket \u003d\u003d stage_config.repo_bucket:\n\t\t\tsuffix \u003d \u0027.svg\u0027\n\t\t\tsubfolder \u003d \u0027images\u0027\n\t\telse:\n\t\t\tsuffix \u003d \u0027.drawio\u0027\n\t\t\tsubfolder \u003d \u0027source\u0027\n\t\treturn \"SCADA/%s/%s/%s%s\" % (site, subfolder, view, suffix)\n\telse:\n\t\treturn None\n",
|
||||
"type": "script"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"onChange": {
|
||||
"enabled": null,
|
||||
"script": "\td \u003d self.params.query_params\n\tif getattr(currentValue, \u0027value\u0027, None):\n\t\tself.params.query_params.object_key \u003d currentValue.value\n\t"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.stage_config": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{view.custom.api_region_name}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"code": "\treturn AWS.s3.STAGE_CONFIG[\u0027prod\u0027][value]",
|
||||
"type": "script"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.view_options_by_site_and_bucket": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{view.params.query_params.site}+{view.params.query_params.bucket}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"code": "\tbucket \u003d self.params.query_params.bucket\n\tsite \u003d self.params.query_params.site\n\tif bucket and site:\n\t\tfrom AWS.s3 import S3Manager\n\t\tfrom helper.helper import sanitize_tree\n\t\tfrom pprint import pformat\n\t\t\n\t\tapi_stage \u003d \u0027prod\u0027\n\t\tusername \u003d self.session.props.auth.user.userName\n\t\tapi_region_name \u003d self.view.custom.api_region_name\n\t\t\n\t\ts3m \u003d S3Manager(api_stage, api_region_name, username)\n\t\tsuffix \u003d self.custom.view_suffix\n\t\tfiles \u003d sanitize_tree(s3m.fetch_object_list_by_site_and_bucket(site, bucket))\n\t\treturn [{\u0027value\u0027: x[\u0027Filename\u0027].replace(suffix,\u0027\u0027), \n\t\t\t\t\u0027label\u0027: x[\u0027Filename\u0027].replace(suffix,\u0027\u0027)} for x in files]\n\treturn []",
|
||||
"type": "script"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.view_suffix": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.query_params.bucket"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"code": "\tif value:\n\t\tstage_config \u003d self.custom.stage_config\n\t\tif value \u003d\u003d stage_config.get(\u0027repo_bucket\u0027, None):\n\t\t\treturn \".svg\"\n\t\tif value \u003d\u003d stage_config.get(\"source_bucket\", None):\n\t\t\treturn \".drawio\"\n\treturn value",
|
||||
"type": "script"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.whid_options": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.query_params.bucket"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"code": "\tif value:\n\t\tfrom AWS.s3 import S3Manager\n\t\t\n\t\tapi_stage \u003d \u0027prod\u0027\n\t\tusername \u003d self.session.props.auth.user.userName\n\t\tapi_region_name \u003d self.custom.api_region_name\n\t\t\n\t\ts3m \u003d S3Manager(\u0027prod\u0027, api_region_name, username)\n\t\t\n\t\treturn [{\u0027value\u0027: x, \u0027label\u0027: x} for x in s3m.fetch_site_list(value)]\n\treturn []",
|
||||
"type": "script"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"params.query_params": {
|
||||
"onChange": {
|
||||
"enabled": null,
|
||||
"script": "\tif not missedEvents and origin in (\u0027Binding\u0027, \u0027Script\u0027, \u0027BindingWriteback\u0027):\n\t\tpayload \u003d currentValue.value\n\t\tsystem.perspective.sendMessage(\u0027list_versions_query_params_changed\u0027, payload, scope\u003d\u0027session\u0027)\n\t\t"
|
||||
},
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 600
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"borderStyle": "none",
|
||||
"classes": "Framework/Card/Title_transparent"
|
||||
},
|
||||
"text": "Select Query Params"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\t# reset query params to default values \n\t# (stored in `view.custom.default_query_params`)\n\tself.view.params.query_params \u003d self.view.custom.default_query_params"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Clear Button",
|
||||
"tooltip": {
|
||||
"enabled": true,
|
||||
"location": "bottom-right",
|
||||
"text": "Clear Selections"
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"image": {
|
||||
"icon": {
|
||||
"path": "material/clear_all"
|
||||
}
|
||||
},
|
||||
"primary": false,
|
||||
"style": {
|
||||
"classes": "Input/Button/Secondary_minimal"
|
||||
},
|
||||
"text": ""
|
||||
},
|
||||
"type": "ia.input.button"
|
||||
},
|
||||
{
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\t# refresh version table query via message handler\n\tsystem.perspective.sendMessage(\u0027refresh_version_table_data\u0027, scope\u003d\u0027session\u0027)\n\t"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Refresh Button",
|
||||
"tooltip": {
|
||||
"enabled": true,
|
||||
"location": "bottom-right",
|
||||
"text": "Refresh Data"
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"propConfig": {
|
||||
"props.enabled": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "!isNull({view.params.query_params.bucket})\r\n\u0026\u0026!isNull({view.params.query_params.site})\r\n\u0026\u0026!isNull({view.params.query_params.view})\r\n\u0026\u0026!isNull({view.params.query_params.object_key})"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"image": {
|
||||
"icon": {
|
||||
"path": "material/refresh"
|
||||
}
|
||||
},
|
||||
"primary": false,
|
||||
"style": {
|
||||
"classes": "Input/Button/Secondary_minimal"
|
||||
},
|
||||
"text": ""
|
||||
},
|
||||
"type": "ia.input.button"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer"
|
||||
},
|
||||
"position": {
|
||||
"grow": 1
|
||||
},
|
||||
"props": {
|
||||
"justify": "flex-end"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer Header"
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"classes": "Framework/Card/Title_transparent",
|
||||
"marginBottom": "2px"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "125px",
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"classes": "Framework/Card/Label",
|
||||
"textAlign": "right"
|
||||
},
|
||||
"text": "Bucket"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "Dropdown"
|
||||
},
|
||||
"position": {
|
||||
"basis": "540px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.options": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.bucket_options"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.value": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"bidirectional": true,
|
||||
"path": "view.params.query_params.bucket"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"dropdownOptionStyle": {
|
||||
"overflowWrap": "break-word",
|
||||
"whiteSpace": "normal"
|
||||
},
|
||||
"showClearIcon": true
|
||||
},
|
||||
"type": "ia.input.dropdown"
|
||||
},
|
||||
{
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tself.view.params.query_params.bucket \u003d None\n\t"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Clear Button"
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"propConfig": {
|
||||
"props.enabled": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "!isNull({view.params.query_params.bucket})\r\n\u0026\u0026{view.params.query_params.bucket}!\u003d\u0027\u0027"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"image": {
|
||||
"icon": {
|
||||
"path": "material/clear"
|
||||
}
|
||||
},
|
||||
"primary": false,
|
||||
"style": {
|
||||
"classes": "Input/Button/Secondary_minimal"
|
||||
},
|
||||
"text": ""
|
||||
},
|
||||
"type": "ia.input.button"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "Bucket"
|
||||
},
|
||||
"position": {
|
||||
"basis": "100%",
|
||||
"grow": 1
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"overflow": "hidden"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer_1"
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"justify": "center"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "125px",
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"classes": "Framework/Card/Label",
|
||||
"textAlign": "right"
|
||||
},
|
||||
"text": "Site"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "Dropdown"
|
||||
},
|
||||
"position": {
|
||||
"basis": "540px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.enabled": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "!isNull({view.params.query_params.bucket})\r\n\u0026\u0026len({view.params.query_params.bucket})\u003e0"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"props.options": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.whid_options"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.value": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"bidirectional": true,
|
||||
"path": "view.params.query_params.site"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"dropdownOptionStyle": {
|
||||
"overflowWrap": "break-word",
|
||||
"whiteSpace": "normal"
|
||||
},
|
||||
"showClearIcon": true
|
||||
},
|
||||
"type": "ia.input.dropdown"
|
||||
},
|
||||
{
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tself.view.params.query_params.site \u003d None\n\t"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Clear Button"
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"propConfig": {
|
||||
"props.enabled": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "!isNull({view.params.query_params.site})\r\n\u0026\u0026{view.params.query_params.site}!\u003d\u0027\u0027"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"image": {
|
||||
"icon": {
|
||||
"path": "material/clear"
|
||||
}
|
||||
},
|
||||
"primary": false,
|
||||
"style": {
|
||||
"classes": "Input/Button/Secondary_minimal"
|
||||
},
|
||||
"text": ""
|
||||
},
|
||||
"type": "ia.input.button"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "Site"
|
||||
},
|
||||
"position": {
|
||||
"basis": "100%",
|
||||
"grow": 1
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"overflow": "hidden"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer_2"
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"justify": "center"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "125px",
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"classes": "Framework/Card/Label",
|
||||
"textAlign": "right"
|
||||
},
|
||||
"text": "View"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "Dropdown"
|
||||
},
|
||||
"position": {
|
||||
"basis": "540px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.enabled": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "!isNull({view.params.query_params.bucket})\r\n\u0026\u0026len({view.params.query_params.bucket})\u003e0\r\n\u0026\u0026!isNull({view.params.query_params.site})\r\n\u0026\u0026len({view.params.query_params.site})\u003e0"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"props.options": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.view_options_by_site_and_bucket"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.value": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"bidirectional": true,
|
||||
"path": "view.params.query_params.view"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"dropdownOptionStyle": {
|
||||
"overflowWrap": "break-word",
|
||||
"whiteSpace": "normal"
|
||||
},
|
||||
"showClearIcon": true
|
||||
},
|
||||
"type": "ia.input.dropdown"
|
||||
},
|
||||
{
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tself.view.params.query_params.view \u003d None\n\t"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Clear Button"
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"propConfig": {
|
||||
"props.enabled": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "!isNull({view.params.query_params.view})\r\n\u0026\u0026{view.params.query_params.view}!\u003d\u0027\u0027"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"image": {
|
||||
"icon": {
|
||||
"path": "material/clear"
|
||||
}
|
||||
},
|
||||
"primary": false,
|
||||
"style": {
|
||||
"classes": "Input/Button/Secondary_minimal"
|
||||
},
|
||||
"text": ""
|
||||
},
|
||||
"type": "ia.input.button"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "View"
|
||||
},
|
||||
"position": {
|
||||
"basis": "100%",
|
||||
"grow": 1
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"overflow": "hidden"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer_3"
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"justify": "center"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "125px",
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"classes": "Framework/Card/Label",
|
||||
"textAlign": "right"
|
||||
},
|
||||
"text": "Object Key"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label_0"
|
||||
},
|
||||
"position": {
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.query_params.object_key"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"classes": "Framework/Card/Value",
|
||||
"textAlign": "left"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "Object Key"
|
||||
},
|
||||
"position": {
|
||||
"basis": "100%",
|
||||
"grow": 1
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"overflow": "hidden"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer_4"
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"justify": "center"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"direction": "column"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"backgroundColor": "var(--neutral-10)",
|
||||
"borderColor": "var(--info)",
|
||||
"borderStyle": "solid",
|
||||
"borderWidth": "1px",
|
||||
"boxShadow": "none",
|
||||
"color": "var(--info)",
|
||||
"fontWeight": "normal",
|
||||
"margin": "5px",
|
||||
"textTransform": "uppercase",
|
||||
"fill": "var(--info)"
|
||||
}
|
||||
},
|
||||
"variants": [
|
||||
{
|
||||
"pseudo": "hover",
|
||||
"animation": {
|
||||
"duration": "0.2s",
|
||||
"direction": "normal",
|
||||
"iterationCount": "1",
|
||||
"timingFunction": "ease",
|
||||
"keyframes": {
|
||||
"0%": {},
|
||||
"100%": {
|
||||
"backgroundColor": "var(--neutral-20)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,384 @@
|
||||
{
|
||||
"custom": {},
|
||||
"params": {
|
||||
"Dataset": [
|
||||
{
|
||||
"path": "Symbol-Views/Device-Views/DeviceStatus"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Device-Views/DeviceStatus_old"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Device-Views/Estop"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/ARSAW"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/AUS"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/Camera"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/ControlCabinet"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/Estop"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/GoodsLift"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/JAM"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/Light_Curtain"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/Main_Panel"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/Network"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/Pointer"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/PressureSwitch"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/PullChord"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/PullChord_End"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/PullChord_Line"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/PullChord_Line_Vertical"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/RFID"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/Robot"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/SLAMs"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/SafetyGate"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/Stacker_Destacker"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/Status"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/StatusNonPowered"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/StatusNonPowered_NS"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/Status_NS"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/THEA"
|
||||
},
|
||||
{
|
||||
"path": "Symbol-Views/Equipment-Views/Test"
|
||||
}
|
||||
],
|
||||
"FilteredViews": [
|
||||
{
|
||||
"Name": "ARSAW",
|
||||
"Path": "Symbol-Views/Equipment-Views/ARSAW",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "AUS",
|
||||
"Path": "Symbol-Views/Equipment-Views/AUS",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Camera",
|
||||
"Path": "Symbol-Views/Equipment-Views/Camera",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "ControlCabinet",
|
||||
"Path": "Symbol-Views/Equipment-Views/ControlCabinet",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Estop",
|
||||
"Path": "Symbol-Views/Equipment-Views/Estop",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "GoodsLift",
|
||||
"Path": "Symbol-Views/Equipment-Views/GoodsLift",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "JAM",
|
||||
"Path": "Symbol-Views/Equipment-Views/JAM",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Light_Curtain",
|
||||
"Path": "Symbol-Views/Equipment-Views/Light_Curtain",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Main_Panel",
|
||||
"Path": "Symbol-Views/Equipment-Views/Main_Panel",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Network",
|
||||
"Path": "Symbol-Views/Equipment-Views/Network",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Pointer",
|
||||
"Path": "Symbol-Views/Equipment-Views/Pointer",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "PressureSwitch",
|
||||
"Path": "Symbol-Views/Equipment-Views/PressureSwitch",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "PullChord",
|
||||
"Path": "Symbol-Views/Equipment-Views/PullChord",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "PullChord_End",
|
||||
"Path": "Symbol-Views/Equipment-Views/PullChord_End",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "PullChord_Line",
|
||||
"Path": "Symbol-Views/Equipment-Views/PullChord_Line",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "PullChord_Line_Vertical",
|
||||
"Path": "Symbol-Views/Equipment-Views/PullChord_Line_Vertical",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "RFID",
|
||||
"Path": "Symbol-Views/Equipment-Views/RFID",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Robot",
|
||||
"Path": "Symbol-Views/Equipment-Views/Robot",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "SLAMs",
|
||||
"Path": "Symbol-Views/Equipment-Views/SLAMs",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "SafetyGate",
|
||||
"Path": "Symbol-Views/Equipment-Views/SafetyGate",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Stacker_Destacker",
|
||||
"Path": "Symbol-Views/Equipment-Views/Stacker_Destacker",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Status",
|
||||
"Path": "Symbol-Views/Equipment-Views/Status",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "StatusNonPowered",
|
||||
"Path": "Symbol-Views/Equipment-Views/StatusNonPowered",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "StatusNonPowered_NS",
|
||||
"Path": "Symbol-Views/Equipment-Views/StatusNonPowered_NS",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Status_NS",
|
||||
"Path": "Symbol-Views/Equipment-Views/Status_NS",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "THEA",
|
||||
"Path": "Symbol-Views/Equipment-Views/THEA",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"SelectedValue": "",
|
||||
"key": ""
|
||||
},
|
||||
"propConfig": {
|
||||
"params.Dataset": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.FilteredViews": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.SelectedValue": {
|
||||
"paramDirection": "inout",
|
||||
"persistent": true
|
||||
},
|
||||
"params.key": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 650,
|
||||
"width": 1165
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "ViewRepeater"
|
||||
},
|
||||
"position": {
|
||||
"basis": "1px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.instances": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"bidirectional": true,
|
||||
"path": "view.params.FilteredViews"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"alignContent": "flex-start",
|
||||
"alignItems": "flex-start",
|
||||
"elementPosition": {
|
||||
"basis": "auto"
|
||||
},
|
||||
"elementStyle": {
|
||||
"classes": "Framework/Cards/Title"
|
||||
},
|
||||
"justify": "center",
|
||||
"path": "Symbol-Views/Symbol-Library-Views/Symbol",
|
||||
"style": {
|
||||
"gap": "20px",
|
||||
"overflow": "hidden"
|
||||
},
|
||||
"wrap": "wrap"
|
||||
},
|
||||
"type": "ia.display.flex-repeater"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"alignItems": "center",
|
||||
"justify": "space-evenly",
|
||||
"wrap": "wrap"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
{
|
||||
"custom": {},
|
||||
"params": {
|
||||
"rowData": {
|
||||
"Driver": "value"
|
||||
}
|
||||
},
|
||||
"propConfig": {
|
||||
"params.rowData": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 36,
|
||||
"width": 227
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Dropdown"
|
||||
},
|
||||
"position": {
|
||||
"basis": "36px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.value": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.rowData.Driver"
|
||||
},
|
||||
"type": "property"
|
||||
},
|
||||
"onChange": {
|
||||
"enabled": null,
|
||||
"script": "\tvalue \u003d currentValue.value\n\tsystem.perspective.print(str(origin))\n\tif value is not None:\n\t\tif \u0027Binding\u0027 not in str(origin):\n\t\t\tmsg \u003d \u0027addtable-dropdown-updaterow\u0027\n\t\t\tHostname \u003d self.view.params.rowData[\u0027Hostname\u0027]\n\t\t\tpayload \u003d\t{\n\t\t\t\t\t\t\u0027value\u0027\t\t: value,\n\t\t\t\t\t\t\u0027Hostname\u0027\t: Hostname\n\t\t\t\t\t\t}\n\t\t\tsystem.perspective.sendMessage(msg, payload)"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"options": [
|
||||
{
|
||||
"label": "S7300",
|
||||
"value": "S7300"
|
||||
},
|
||||
{
|
||||
"label": "S7400",
|
||||
"value": "S7400"
|
||||
},
|
||||
{
|
||||
"label": "S71200",
|
||||
"value": "S71200"
|
||||
},
|
||||
{
|
||||
"label": "S71500",
|
||||
"value": "S71500"
|
||||
},
|
||||
{
|
||||
"label": "CompactLogix",
|
||||
"value": "CompactLogix"
|
||||
},
|
||||
{
|
||||
"label": "Legacy Allen-Bradley",
|
||||
"value": "ControlLogix"
|
||||
},
|
||||
{
|
||||
"label": "ControlLogix",
|
||||
"value": "ControlLogix"
|
||||
},
|
||||
{
|
||||
"label": "LogixDriver",
|
||||
"value": "LogixDriver"
|
||||
},
|
||||
{
|
||||
"label": "Allen Bradley MicroLogix",
|
||||
"value": "MicroLogix"
|
||||
}
|
||||
],
|
||||
"placeholder": {
|
||||
"text": "Select Driver..."
|
||||
}
|
||||
},
|
||||
"type": "ia.input.dropdown"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"direction": "column"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
{
|
||||
"custom": {},
|
||||
"params": {},
|
||||
"props": {},
|
||||
"root": {
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"direction": "column"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"backgroundColor": "var(--neutral-10)",
|
||||
"borderColor": "var(--success)",
|
||||
"borderStyle": "solid",
|
||||
"borderWidth": "1px",
|
||||
"boxShadow": "none",
|
||||
"color": "var(--success)",
|
||||
"fontWeight": "normal",
|
||||
"margin": "5px",
|
||||
"textTransform": "uppercase",
|
||||
"fill": "var(--success)"
|
||||
}
|
||||
},
|
||||
"variants": [
|
||||
{
|
||||
"pseudo": "hover",
|
||||
"animation": {
|
||||
"duration": "0.2s",
|
||||
"direction": "normal",
|
||||
"iterationCount": "1",
|
||||
"timingFunction": "ease",
|
||||
"keyframes": {
|
||||
"0%": {},
|
||||
"100%": {
|
||||
"backgroundColor": "var(--neutral-20)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
@ -0,0 +1,136 @@
|
||||
{
|
||||
"custom": {},
|
||||
"params": {
|
||||
"pageid": "value",
|
||||
"panel_id": "value",
|
||||
"text": "value"
|
||||
},
|
||||
"propConfig": {
|
||||
"params.pageid": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.panel_id": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.text": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 30,
|
||||
"width": 160
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tsystem.perspective.navigate(\"/\" + self.view.params.pageid)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Button"
|
||||
},
|
||||
"position": {
|
||||
"basis": "120px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.text"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"backgroundColor": "#FFFFFF",
|
||||
"borderBottomColor": "#555555",
|
||||
"borderBottomLeftRadius": 8,
|
||||
"borderBottomRightRadius": 8,
|
||||
"borderBottomStyle": "solid",
|
||||
"borderBottomWidth": 4,
|
||||
"borderLeftColor": "#000000",
|
||||
"borderLeftStyle": "solid",
|
||||
"borderLeftWidth": 1.5,
|
||||
"borderRightColor": "#555555",
|
||||
"borderRightStyle": "solid",
|
||||
"borderRightWidth": 3,
|
||||
"borderTopColor": "#000000",
|
||||
"borderTopLeftRadius": 8,
|
||||
"borderTopRightRadius": 8,
|
||||
"borderTopStyle": "solid",
|
||||
"borderTopWidth": 1.5,
|
||||
"cursor": "pointer",
|
||||
"outlineColor": "#000000",
|
||||
"outlineStyle": "none",
|
||||
"outlineWidth": "3"
|
||||
},
|
||||
"textStyle": {
|
||||
"color": "#000000",
|
||||
"fontFamily": "inherit",
|
||||
"fontSize": "1vmin",
|
||||
"fontWeight": "bold"
|
||||
}
|
||||
},
|
||||
"type": "ia.input.button"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "Main_Panel"
|
||||
},
|
||||
"position": {
|
||||
"basis": "35px",
|
||||
"shrink": 0
|
||||
},
|
||||
"propConfig": {
|
||||
"props.params.tagProps[0]": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.panel_id"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"params": {
|
||||
"has_state": false,
|
||||
"tagProps": [
|
||||
null,
|
||||
"",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value"
|
||||
]
|
||||
},
|
||||
"path": "Symbol-Views/Equipment-Views/Main_Panel"
|
||||
},
|
||||
"type": "ia.display.view"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"backgroundColor": "var(--error)",
|
||||
"borderTopLeftRadius": "4px",
|
||||
"borderTopRightRadius": "4px",
|
||||
"borderBottomLeftRadius": "4px",
|
||||
"borderBottomRightRadius": "4px",
|
||||
"color": "var(--neutral-10)",
|
||||
"fontSize": "12px",
|
||||
"fontWeight": "bold",
|
||||
"lineHeight": "16px",
|
||||
"padding": "2px",
|
||||
"textAlign": "center"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 847 B |
@ -0,0 +1,8 @@
|
||||
def decide_mode(session,local_url,server_url):
|
||||
link = ""
|
||||
if(session.local):
|
||||
link = local_url
|
||||
else:
|
||||
link = server_urls
|
||||
return link
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"color": "#8E8E8E",
|
||||
"fontSize": "12px",
|
||||
"fontWeight": "300",
|
||||
"lineHeight": "16px",
|
||||
"marginRight": "10px",
|
||||
"textTransform": "uppercase"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
@ -0,0 +1,710 @@
|
||||
{
|
||||
"custom": {
|
||||
"font_size": ".57vmax"
|
||||
},
|
||||
"params": {},
|
||||
"propConfig": {
|
||||
"custom.font_size": {
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 149,
|
||||
"width": 423
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "160px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.textStyle.fontSize": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.font_size"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"text": "Color Legend",
|
||||
"textStyle": {
|
||||
"paddingLeft": 5
|
||||
}
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer_4"
|
||||
},
|
||||
"position": {
|
||||
"basis": "35px",
|
||||
"grow": 1
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"backgroundColor": "#3B3B3B",
|
||||
"borderColor": "#CAC3C3",
|
||||
"borderStyle": "solid",
|
||||
"borderWidth": 1,
|
||||
"overflow": "hidden",
|
||||
"paddingLeft": 5
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "148px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.textStyle.fontSize": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.font_size"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"text": "MHE Stopped"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer",
|
||||
"tooltip": {
|
||||
"enabled": true,
|
||||
"sustain": 1500,
|
||||
"text": "MHE is stopped (State2)"
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"basis": "200px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.style.backgroundColor": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "session.custom.colours.state0"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"borderBottomLeftRadius": 4,
|
||||
"borderBottomRightRadius": 4,
|
||||
"borderTopLeftRadius": 4,
|
||||
"borderTopRightRadius": 4,
|
||||
"marginBottom": 0,
|
||||
"marginLeft": 10,
|
||||
"marginRight": 5,
|
||||
"marginTop": 1,
|
||||
"overflow": "hidden",
|
||||
"paddingLeft": 10
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "148px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.textStyle.fontSize": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.font_size"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"text": "MHE Running"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer_0",
|
||||
"tooltip": {
|
||||
"enabled": true,
|
||||
"sustain": 1500,
|
||||
"text": "MHE is running (State3)"
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"basis": "200px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.style.backgroundColor": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "session.custom.colours.state5"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"borderBottomLeftRadius": 4,
|
||||
"borderBottomRightRadius": 4,
|
||||
"borderTopLeftRadius": 4,
|
||||
"borderTopRightRadius": 4,
|
||||
"marginBottom": 0,
|
||||
"marginLeft": 5,
|
||||
"marginRight": 10,
|
||||
"marginTop": 1,
|
||||
"overflow": "hidden",
|
||||
"paddingLeft": 10
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer"
|
||||
},
|
||||
"position": {
|
||||
"basis": "45px",
|
||||
"grow": 1
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"backgroundColor": "#3B3B3B",
|
||||
"borderColor": "#CAC3C3",
|
||||
"borderStyle": "solid",
|
||||
"borderWidth": 1,
|
||||
"overflow": "hidden"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "148px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.textStyle.fontSize": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.font_size"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"text": "Healthy"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer"
|
||||
},
|
||||
"position": {
|
||||
"basis": "200px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.style.backgroundColor": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "session.custom.colours.state5"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"borderBottomLeftRadius": 4,
|
||||
"borderBottomRightRadius": 4,
|
||||
"borderTopLeftRadius": 4,
|
||||
"borderTopRightRadius": 4,
|
||||
"marginBottom": 0,
|
||||
"marginLeft": 10,
|
||||
"marginRight": 5,
|
||||
"marginTop": 1,
|
||||
"overflow": "hidden",
|
||||
"paddingLeft": 10
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "148px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.textStyle.fontSize": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.font_size"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"text": "Diagnostic"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer_0",
|
||||
"tooltip": {
|
||||
"enabled": true,
|
||||
"sustain": 1500,
|
||||
"text": "Diagnostic Information"
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"basis": "200px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.style.backgroundColor": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "session.custom.colours.state4"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"borderBottomLeftRadius": 4,
|
||||
"borderBottomRightRadius": 4,
|
||||
"borderTopLeftRadius": 4,
|
||||
"borderTopRightRadius": 4,
|
||||
"marginBottom": 0,
|
||||
"marginLeft": 5,
|
||||
"marginRight": 10,
|
||||
"marginTop": 1,
|
||||
"overflow": "hidden",
|
||||
"paddingLeft": 10
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer_0",
|
||||
"tooltip": {
|
||||
"enabled": true,
|
||||
"sustain": 1500,
|
||||
"text": "Healthy, no active alarms"
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"basis": "45px",
|
||||
"grow": 1
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"backgroundColor": "#3B3B3B",
|
||||
"borderColor": "#CAC3C3",
|
||||
"borderStyle": "solid",
|
||||
"borderWidth": 1,
|
||||
"overflow": "hidden"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "148px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.textStyle.fontSize": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.font_size"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"text": "Low",
|
||||
"textStyle": {
|
||||
"color": "#000000"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer",
|
||||
"tooltip": {
|
||||
"enabled": true,
|
||||
"sustain": 1500,
|
||||
"text": "Running at reduced capacity"
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"basis": "200px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.style.backgroundColor": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "session.custom.colours.state3"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"borderBottomLeftRadius": 4,
|
||||
"borderBottomRightRadius": 4,
|
||||
"borderTopLeftRadius": 4,
|
||||
"borderTopRightRadius": 4,
|
||||
"marginBottom": 0,
|
||||
"marginLeft": 10,
|
||||
"marginRight": 5,
|
||||
"marginTop": 1,
|
||||
"overflow": "hidden",
|
||||
"paddingLeft": 10
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "148px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.textStyle.fontSize": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.font_size"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"text": "Medium"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer_0",
|
||||
"tooltip": {
|
||||
"enabled": true,
|
||||
"sustain": 1500,
|
||||
"text": "Controlled stop"
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"basis": "200px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.style.backgroundColor": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "session.custom.colours.state2"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"borderBottomLeftRadius": 4,
|
||||
"borderBottomRightRadius": 4,
|
||||
"borderTopLeftRadius": 4,
|
||||
"borderTopRightRadius": 4,
|
||||
"marginBottom": 0,
|
||||
"marginLeft": 5,
|
||||
"marginRight": 10,
|
||||
"marginTop": 1,
|
||||
"overflow": "hidden",
|
||||
"paddingLeft": 10
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer_1"
|
||||
},
|
||||
"position": {
|
||||
"basis": "45px",
|
||||
"grow": 1
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"backgroundColor": "#3B3B3B",
|
||||
"borderBottomLeftRadius": 4,
|
||||
"borderBottomRightRadius": 4,
|
||||
"borderColor": "#CAC3C3",
|
||||
"borderStyle": "solid",
|
||||
"borderTopLeftRadius": 4,
|
||||
"borderTopRightRadius": 4,
|
||||
"borderWidth": 1,
|
||||
"overflow": "hidden",
|
||||
"paddingLeft": 1
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "148px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.textStyle.fontSize": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.font_size"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"text": "High"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer",
|
||||
"tooltip": {
|
||||
"enabled": true,
|
||||
"sustain": 1500,
|
||||
"text": "Uncontrolled stop"
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"basis": "200px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.style.backgroundColor": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "session.custom.colours.state1"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"borderBottomLeftRadius": 4,
|
||||
"borderBottomRightRadius": 4,
|
||||
"borderTopLeftRadius": 4,
|
||||
"borderTopRightRadius": 4,
|
||||
"marginBottom": 0,
|
||||
"marginLeft": 10,
|
||||
"marginRight": 5,
|
||||
"marginTop": 1,
|
||||
"overflow": "hidden",
|
||||
"paddingLeft": 10
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"draggable": true,
|
||||
"id": "K1uUHAix",
|
||||
"modal": true,
|
||||
"overlayDismiss": true,
|
||||
"resizable": true,
|
||||
"showCloseIcon": true,
|
||||
"title": "Legend",
|
||||
"type": "open",
|
||||
"viewPath": "PopUp-Views/Legend",
|
||||
"viewportBound": false
|
||||
},
|
||||
"scope": "C",
|
||||
"type": "popup"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Button"
|
||||
},
|
||||
"position": {
|
||||
"basis": "168px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.textStyle.fontSize": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.font_size"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"image": {
|
||||
"icon": {
|
||||
"path": "material/legend_toggle"
|
||||
},
|
||||
"style": {
|
||||
"backgroundColor": "#555555"
|
||||
}
|
||||
},
|
||||
"justify": "start",
|
||||
"style": {
|
||||
"backgroundColor": "#555555",
|
||||
"paddingLeft": 8
|
||||
},
|
||||
"text": "DETAILS"
|
||||
},
|
||||
"type": "ia.input.button"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer_0"
|
||||
},
|
||||
"position": {
|
||||
"basis": "200px",
|
||||
"grow": 1
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"backgroundColor": "#555555",
|
||||
"marginBottom": 0,
|
||||
"marginLeft": 5,
|
||||
"marginRight": 10,
|
||||
"marginTop": 1
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer_2"
|
||||
},
|
||||
"position": {
|
||||
"basis": "45px",
|
||||
"grow": 1
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"backgroundColor": "#3B3B3B",
|
||||
"borderColor": "#CAC3C3",
|
||||
"borderStyle": "solid",
|
||||
"borderWidth": 1,
|
||||
"overflow": "hidden"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer_6"
|
||||
},
|
||||
"position": {
|
||||
"basis": "800px",
|
||||
"grow": 1
|
||||
},
|
||||
"props": {
|
||||
"direction": "column"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"direction": "column",
|
||||
"style": {
|
||||
"classes": "Background-Styles/Controller"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,648 @@
|
||||
{
|
||||
"custom": {
|
||||
"alarm_message": null,
|
||||
"covert_mode": true,
|
||||
"disconnected": false,
|
||||
"display_icon": true,
|
||||
"error": false,
|
||||
"isMatch": 0,
|
||||
"plc": "value",
|
||||
"priority": 0,
|
||||
"priority_string": "No active alarms",
|
||||
"running_status": 0,
|
||||
"searchId": "value",
|
||||
"state": 5,
|
||||
"state_string": "Unknown"
|
||||
},
|
||||
"params": {
|
||||
"directionLeft": false,
|
||||
"forceFaultStatus": null,
|
||||
"forceRunningStatus": null,
|
||||
"tagProps": [
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value"
|
||||
]
|
||||
},
|
||||
"propConfig": {
|
||||
"custom.alarm_message": {
|
||||
"persistent": true
|
||||
},
|
||||
"custom.covert_mode": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "case(\t{value},\r\n\t\t0, {session.custom.alarm_filter.show_running},\r\n\t\t1, True,\r\n\t\t2, True,\r\n\t\t3, {session.custom.alarm_filter.show_low_alarm},\r\n\t\t4, {session.custom.alarm_filter.show_diagnostic},\r\n\t\t5, {session.custom.alarm_filter.show_running},\r\n\t\tFalse)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.disconnected": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "indirect",
|
||||
"references": {
|
||||
"fc": "{session.custom.fc}",
|
||||
"plc": "{view.custom.plc}"
|
||||
},
|
||||
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{plc}/DCN"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "if(isNull({value}), False, {value})",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.display_icon": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{this.custom.covert_mode}//||{this.custom.isMatch}\u003e0"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.error": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "0 \u003c {value} \u0026\u0026 {value} \u003c 5",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.isMatch": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({view.params.tagProps[0]}\u003d\"value\",0,\nif({this.custom.searchId}\u003d{view.params.tagProps[0]},100,0))"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.plc": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.tagProps[0]"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "split({value}, \"/\")[0]",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.priority": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": 0,
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 1,
|
||||
"output": 4
|
||||
},
|
||||
{
|
||||
"input": 2,
|
||||
"output": 3
|
||||
},
|
||||
{
|
||||
"input": 3,
|
||||
"output": 2
|
||||
},
|
||||
{
|
||||
"input": 4,
|
||||
"output": 1
|
||||
}
|
||||
],
|
||||
"outputType": "scalar",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.priority_string": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "case({view.custom.state},\r\n1, \"High\",\r\n2, \"Medium\",\r\n3, \"Low\",\r\n4, \"Diagnostic\",\r\n5, \"No active alarms\",\r\n\"Unknown\")"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.running_status": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "indirect",
|
||||
"references": {
|
||||
"0": "{view.params.tagProps[0]}",
|
||||
"fc": "{session.custom.fc}"
|
||||
},
|
||||
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/STATE"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "coalesce({value},{view.params.forceRunningStatus},0)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.searchId": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "session.custom.searchId"
|
||||
},
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.state": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "indirect",
|
||||
"references": {
|
||||
"0": "{view.params.tagProps[0]}",
|
||||
"fc": "{session.custom.fc}"
|
||||
},
|
||||
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/ALARMST"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "coalesce({value},{view.params.forceFaultStatus},0)",
|
||||
"type": "expression"
|
||||
},
|
||||
{
|
||||
"fallback": null,
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 4,
|
||||
"output": 1
|
||||
},
|
||||
{
|
||||
"input": 3,
|
||||
"output": 2
|
||||
},
|
||||
{
|
||||
"input": 2,
|
||||
"output": 3
|
||||
},
|
||||
{
|
||||
"input": 1,
|
||||
"output": 4
|
||||
},
|
||||
{
|
||||
"input": 0,
|
||||
"output": 5
|
||||
}
|
||||
],
|
||||
"outputType": "scalar",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.state_string": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "case({view.custom.running_status},\r\n1, \"Faulted\",\r\n2, \"Stopped\",\r\n3, \"Running\",\r\n\"Unknown\")"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"params.directionLeft": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.forceFaultStatus": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.forceRunningStatus": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.tagProps": {
|
||||
"paramDirection": "inout",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 25,
|
||||
"width": 25
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "PressureSwitch_2"
|
||||
},
|
||||
"position": {
|
||||
"height": 1,
|
||||
"width": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.elements[1].elements[0].fill.paint": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "case({value},\r\n0,{session.custom.colours.state0},\r\n1,{session.custom.colours.state1},\r\n2,{session.custom.colours.state2},\r\n3,{session.custom.colours.state3},\r\n4,{session.custom.colours.state4},\r\n5,{session.custom.colours.state5},\r\n6,{session.custom.colours.state6},\r\n{session.custom.colours.fallback}\r\n)",
|
||||
"type": "expression"
|
||||
},
|
||||
{
|
||||
"expression": "if({view.custom.display_icon}\u0026\u0026 {view.custom.isMatch}\u003d0,{value},{value}+\u002700\u0027)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.style.classes": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({session.custom.colours.colour_impaired} \u003d True \u0026\u0026 {view.custom.isMatch} \u003e 0,\r\n{view.custom.state} + 100 + {view.custom.isMatch},\r\n{view.custom.state} + {view.custom.isMatch})"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": "",
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 101,
|
||||
"output": "State-Styles/State101"
|
||||
},
|
||||
{
|
||||
"input": 102,
|
||||
"output": "State-Styles/State102"
|
||||
},
|
||||
{
|
||||
"input": 103,
|
||||
"output": "State-Styles/State103"
|
||||
},
|
||||
{
|
||||
"input": 104,
|
||||
"output": "State-Styles/State104"
|
||||
},
|
||||
{
|
||||
"input": 105,
|
||||
"output": "State-Styles/State105"
|
||||
},
|
||||
{
|
||||
"input": 106,
|
||||
"output": "State-Styles/State106"
|
||||
},
|
||||
{
|
||||
"input": 201,
|
||||
"output": "State-Styles/State201"
|
||||
},
|
||||
{
|
||||
"input": 202,
|
||||
"output": "State-Styles/State202"
|
||||
},
|
||||
{
|
||||
"input": 203,
|
||||
"output": "State-Styles/State203"
|
||||
},
|
||||
{
|
||||
"input": 204,
|
||||
"output": "State-Styles/State204"
|
||||
},
|
||||
{
|
||||
"input": 205,
|
||||
"output": "State-Styles/State205"
|
||||
}
|
||||
],
|
||||
"outputType": "style-list",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"elements": [
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"id": "stop1507",
|
||||
"name": "stop1507",
|
||||
"offset": "0",
|
||||
"stopColor": "#020101",
|
||||
"stopOpacity": "1",
|
||||
"style": {
|
||||
"stopColor": "#020101",
|
||||
"stopOpacity": "1"
|
||||
},
|
||||
"type": "stop"
|
||||
}
|
||||
],
|
||||
"id": "linearGradient1509",
|
||||
"name": "linearGradient1509",
|
||||
"type": "linearGradient"
|
||||
},
|
||||
{
|
||||
"gradientTransform": "matrix(1.0156665,0,0,0.98457489,-0.22712617,-0.22017344)",
|
||||
"gradientUnits": "userSpaceOnUse",
|
||||
"href": "#linearGradient1509",
|
||||
"id": "linearGradient3055",
|
||||
"name": "linearGradient3055",
|
||||
"type": "linearGradient",
|
||||
"x1": "2.4719212",
|
||||
"x2": "5.6080947",
|
||||
"y1": "4.8826461",
|
||||
"y2": "4.8826461"
|
||||
}
|
||||
],
|
||||
"id": "defs2",
|
||||
"name": "defs2",
|
||||
"type": "defs"
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"fill": {
|
||||
"opacity": 1
|
||||
},
|
||||
"height": "11.216189",
|
||||
"id": "rect5779",
|
||||
"name": "rect5779",
|
||||
"stroke": {
|
||||
"dasharray": "none",
|
||||
"linejoin": "round",
|
||||
"paint": "#000000",
|
||||
"width": 1.2
|
||||
},
|
||||
"style": {
|
||||
"paintOrder": "stroke fill markers"
|
||||
},
|
||||
"type": "rect",
|
||||
"width": "11.21619",
|
||||
"x": "7.7715612e-16",
|
||||
"y": "0"
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"fill": {
|
||||
"opacity": "1",
|
||||
"url": "url(#linearGradient3055)"
|
||||
},
|
||||
"id": "tspan1453",
|
||||
"name": "tspan1453",
|
||||
"stroke": {
|
||||
"dasharray": "none",
|
||||
"width": "0.116835"
|
||||
},
|
||||
"text": "P",
|
||||
"type": "tspan",
|
||||
"x": "0.99078566",
|
||||
"y": "9.0214157"
|
||||
}
|
||||
],
|
||||
"fill": {
|
||||
"opacity": "1",
|
||||
"url": "url(#linearGradient3055)"
|
||||
},
|
||||
"id": "text1455",
|
||||
"name": "text1455",
|
||||
"stroke": {
|
||||
"dasharray": "none",
|
||||
"linejoin": "round",
|
||||
"paint": "#000000",
|
||||
"width": "0.116835"
|
||||
},
|
||||
"style": {
|
||||
"InkscapeFontSpecification": "\u0027Arial Narrow, Normal\u0027",
|
||||
"fontFamily": "\u0027Arial Narrow\u0027",
|
||||
"fontSize": "9.7785px",
|
||||
"paintOrder": "stroke fill markers"
|
||||
},
|
||||
"text": "P",
|
||||
"transform": "scale(0.98457515,1.0156665)",
|
||||
"type": "text",
|
||||
"x": "0.99078566",
|
||||
"y": "9.0214157"
|
||||
},
|
||||
{
|
||||
"d": "M 7.1327097,2.9635882 9.9122555,5.8103519 6.9937326,8.2419488",
|
||||
"fill": {
|
||||
"opacity": "0.0131332",
|
||||
"paint": "#020101"
|
||||
},
|
||||
"id": "path3213",
|
||||
"name": "path3213",
|
||||
"stroke": {
|
||||
"dasharray": "none",
|
||||
"linejoin": "round",
|
||||
"paint": "#000000",
|
||||
"width": "0.663625"
|
||||
},
|
||||
"style": {
|
||||
"paintOrder": "stroke fill markers"
|
||||
},
|
||||
"type": "path"
|
||||
}
|
||||
],
|
||||
"id": "layer1",
|
||||
"name": "layer1",
|
||||
"transform": "translate(0.22362278,0.22362278)",
|
||||
"type": "group"
|
||||
}
|
||||
],
|
||||
"preserveAspectRatio": "none",
|
||||
"style": {},
|
||||
"viewBox": "0 0 11.663437 11.663435"
|
||||
},
|
||||
"type": "ia.shapes.svg"
|
||||
}
|
||||
],
|
||||
"events": {
|
||||
"dom": {
|
||||
"onClick": {
|
||||
"config": {
|
||||
"script": "\tsystem.perspective.openDock(\u0027Docked-East\u0027,params\u003d{\u0027tagProps\u0027:self.view.params.tagProps})"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
},
|
||||
"onDoubleClick": {
|
||||
"config": {
|
||||
"script": "\ttagProps \u003d self.view.params.tagProps\n\tsystem.perspective.openPopup(\"StatusPopUP\", \"PopUp-Views/Controller-Equipment/Information\", params \u003d{\"tagProps\":tagProps})\n\t"
|
||||
},
|
||||
"enabled": false,
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
},
|
||||
"onMouseEnter": {
|
||||
"config": {
|
||||
"script": "\tfrom time import sleep\n\t\n\talarm \u003d []\n\tmessage \u003d None\n\t\n\tsleep(0.5)\n\t\n\tif system.tag.exists(\"System/aws_data\"):\n\t\tif self.view.params.tagProps[0] !\u003d \"\":\n\t\t\ttags_to_read \u003d system.tag.readBlocking(\"System/aws_data\")\n\t\t\tdecode_alarm_data \u003d system.util.jsonDecode(tags_to_read[0].value)\n\t\t\talarm \u003d [decode_alarm_data[i] for i in decode_alarm_data\n\t\t\t\t\tif decode_alarm_data[i][\u0027sourceId\u0027].startswith(self.view.params.tagProps[0])]\n\t\tif alarm:\n\t\t\talarm \u003d sorted(alarm, key \u003d lambda t:t[\u0027timestamp\u0027], reverse\u003dTrue)\n\t\t\tmessage \u003d max(alarm, key \u003d lambda p:p[\u0027priority\u0027]).get(\u0027message\u0027)\n\t\t\tif len(alarm) \u003e 1:\n\t\t\t\tmessage +\u003d \" (+\" + str(len(alarm)-1) + \")\"\n\tself.view.custom.alarm_message \u003d message"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "root",
|
||||
"tooltip": {
|
||||
"enabled": true,
|
||||
"location": "top-left",
|
||||
"style": {}
|
||||
}
|
||||
},
|
||||
"propConfig": {
|
||||
"meta.tooltip.style.backgroundColor": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "case({value},\r\n0,{session.custom.colours.state0},\r\n1,{session.custom.colours.state1},\r\n2,{session.custom.colours.state2},\r\n3,{session.custom.colours.state3},\r\n4,{session.custom.colours.state4},\r\n5,{session.custom.colours.state5},\r\n6,{session.custom.colours.state6},\r\n{session.custom.colours.fallback}\r\n)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"meta.tooltip.style.classes": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{view.custom.priority}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": "Alarms-Styles/NoAlarm",
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 1,
|
||||
"output": "Alarms-Styles/Diagnostic"
|
||||
},
|
||||
{
|
||||
"input": 2,
|
||||
"output": "Alarms-Styles/Low"
|
||||
},
|
||||
{
|
||||
"input": 3,
|
||||
"output": "Alarms-Styles/Medium"
|
||||
},
|
||||
{
|
||||
"input": 4,
|
||||
"output": "Alarms-Styles/High"
|
||||
}
|
||||
],
|
||||
"outputType": "style-list",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"meta.tooltip.style.color": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "if({session.custom.colours.colour_impaired},\r\n\t\u0027#000000\u0027,\r\n\tcase(\t{value},\r\n\t\t\t1,\u0027#FFFFFF\u0027,\r\n\t\t\t2,\u0027#000000\u0027,\r\n\t\t\t3,\u0027#000000\u0027,\r\n\t\t\t4,\u0027#FFFFFF\u0027,\r\n\t\t\t5,\u0027#FFFFFF\u0027,\r\n\t\t\t\u0027#000000\u0027)\r\n\t)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"meta.tooltip.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({view.custom.disconnected} \u003d False,\n\tif(isNull({view.custom.alarm_message}),\n\t\"Source Id: \" + {view.params.tagProps[0]} +\n\t\", Priority: \" + {view.custom.priority_string} +\n\t\", State: \" + {view.custom.state_string},\n\t\"Source Id: \" + {view.params.tagProps[0]} +\n\t\", Alarm: \" + {view.custom.alarm_message} +\n\t\", Priority: \" + {view.custom.priority_string} +\n\t\", State: \" + {view.custom.state_string}),\n\"Source Id: \" +{view.params.tagProps[0]} + \", Priority: Unknown, State: Unknown\")"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"props.style.classes": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.disconnected"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": "Disconnects/Device-Connected",
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": true,
|
||||
"output": "Disconnects/Device-Disconnected"
|
||||
},
|
||||
{
|
||||
"input": false,
|
||||
"output": "Disconnects/Device-Connected"
|
||||
}
|
||||
],
|
||||
"outputType": "style-list",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"mode": "percent",
|
||||
"style": {
|
||||
"cursor": "pointer"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.coord"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 494 B |
@ -0,0 +1,7 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"color": "#FF0000"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
{
|
||||
"custom": {},
|
||||
"params": {
|
||||
"text": "value"
|
||||
},
|
||||
"propConfig": {
|
||||
"params.text": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 30,
|
||||
"width": 210
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "209px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{view.params.text}"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"classes": "Text/LeftAlign_with_Padding"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"alignItems": "center",
|
||||
"justify": "center",
|
||||
"style": {
|
||||
"overflow": "hidden"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
# These scripts are use to download data from the igniton project into any file type.
|
||||
|
||||
|
||||
def download_file(filename, data , converter):
|
||||
"""
|
||||
This script will download data from ignition perspective to the users computer.
|
||||
|
||||
Args:
|
||||
filename: The name of the file to be downloaded .
|
||||
data: The data to be downloaded. May be a string, a byte[], or an InputStream. Strings will be written in UTF-8 encoding.
|
||||
converter: This is a function that is used to convert the ignition data into the required format for the file.
|
||||
If not conversion is required then pass a function that just returns original data.
|
||||
|
||||
Returns:
|
||||
None.
|
||||
|
||||
Raises:
|
||||
ValueError: Raises an Value erorr if no data or converter is provided.
|
||||
"""
|
||||
if not data:
|
||||
raise ValueError("No data provided. Data is required to perform download ")
|
||||
|
||||
if not converter:
|
||||
raise ValueError("Please provide a data converter to transform the data")
|
||||
|
||||
_data = converter(data)
|
||||
system.perspective.download(filename, _data)
|
||||
|
||||
def device_data_converter(data):
|
||||
"""
|
||||
This script converts a list of dicts to a dataset, it uses the first dict to set the column headers in the dataset.
|
||||
|
||||
Args:
|
||||
|
||||
data: List of dictionaries.
|
||||
|
||||
Returns:
|
||||
Ignition Data Set
|
||||
|
||||
Raises:
|
||||
None
|
||||
"""
|
||||
dataset = []
|
||||
for index,row in enumerate(data):
|
||||
if index == 0:
|
||||
header = row.keys()
|
||||
row = []
|
||||
for i in header:
|
||||
value = data[index][i]
|
||||
row.append(value)
|
||||
dataset.append(row)
|
||||
|
||||
convert_data = system.dataset.toDataSet(header, dataset)
|
||||
return system.dataset.toCSV(convert_data)
|
||||
|
||||
def detailed_views_converter(data):
|
||||
"""
|
||||
This script converts a list of dicts to a dataset, it uses the first dict to set the column headers in the dataset.
|
||||
|
||||
Args:
|
||||
|
||||
data: List of dictionaries.
|
||||
|
||||
Returns:
|
||||
Ignition Data Set
|
||||
|
||||
Raises:
|
||||
None
|
||||
"""
|
||||
dataset = []
|
||||
for index,row in enumerate(data):
|
||||
if index == 0:
|
||||
header = row.keys()
|
||||
row = []
|
||||
for i in header:
|
||||
if i == "Devices":
|
||||
value = array_to_string(data[index][i])
|
||||
else:
|
||||
value = data[index][i]
|
||||
row.append(value)
|
||||
dataset.append(row)
|
||||
|
||||
convert_data = system.dataset.toDataSet(header, dataset)
|
||||
return system.dataset.toCSV(convert_data)
|
||||
|
||||
def array_to_string(array , deliminator="#"):
|
||||
converted = ""
|
||||
if len(array) == 1:
|
||||
return array[0]
|
||||
for i , value in enumerate(array):
|
||||
converted += value
|
||||
if not i == len(array)-1:
|
||||
converted += deliminator
|
||||
|
||||
|
||||
return converted
|
||||
@ -0,0 +1,76 @@
|
||||
{
|
||||
"custom": {},
|
||||
"params": {},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 24,
|
||||
"width": 24
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "troubleshoot_white_24dp"
|
||||
},
|
||||
"position": {
|
||||
"height": 1,
|
||||
"width": 1
|
||||
},
|
||||
"props": {
|
||||
"elements": [
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"fill": {
|
||||
"paint": "transparent"
|
||||
},
|
||||
"height": "24",
|
||||
"name": "rect",
|
||||
"type": "rect",
|
||||
"width": "24"
|
||||
}
|
||||
],
|
||||
"name": "group",
|
||||
"type": "group"
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"d": "M22,20.59l-4.69-4.69C18.37,14.55,19,12.85,19,11c0-4.42-3.58-8-8-8c-4.08,0-7.44,3.05-7.93,7h2.02C5.57,7.17,8.03,5,11,5 c3.31,0,6,2.69,6,6s-2.69,6-6,6c-2.42,0-4.5-1.44-5.45-3.5H3.4C4.45,16.69,7.46,19,11,19c1.85,0,3.55-0.63,4.9-1.69L20.59,22 L22,20.59z",
|
||||
"name": "path",
|
||||
"type": "path"
|
||||
},
|
||||
{
|
||||
"name": "polygon",
|
||||
"points": "8.43,9.69 9.65,15 11.29,15 12.55,11.22 13.5,13.5 15.5,13.5 15.5,12 14.5,12 13.25,9 11.71,9 10.59,12.37 9.35,7 7.7,7 6.45,11 1,11 1,12.5 7.55,12.5",
|
||||
"type": "polygon"
|
||||
}
|
||||
],
|
||||
"name": "group",
|
||||
"type": "group"
|
||||
}
|
||||
],
|
||||
"name": "group",
|
||||
"type": "group"
|
||||
}
|
||||
],
|
||||
"fill": {
|
||||
"paint": "#FFFFFF"
|
||||
},
|
||||
"viewBox": "0 0 24 24"
|
||||
},
|
||||
"type": "ia.shapes.svg"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"mode": "percent"
|
||||
},
|
||||
"type": "ia.container.coord"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"borderBottomColor": "var(--neutral-30)",
|
||||
"borderBottomStyle": "solid",
|
||||
"borderBottomWidth": "1px"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"paddingBottom": "5px",
|
||||
"paddingLeft": "5px",
|
||||
"paddingRight": "5px",
|
||||
"paddingTop": "5px"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 10 KiB |
@ -0,0 +1,108 @@
|
||||
{
|
||||
"custom": {
|
||||
"activityLogger": {
|
||||
"alt_pageid": "site-overview",
|
||||
"start_time": {
|
||||
"$": [
|
||||
"ts",
|
||||
192,
|
||||
1709762531101
|
||||
],
|
||||
"$ts": 1709762531101
|
||||
}
|
||||
}
|
||||
},
|
||||
"events": {
|
||||
"system": {
|
||||
"onShutdown": {
|
||||
"config": {
|
||||
"script": "\tactivityLog.productMetrics.callLogger(self, \u0027page\u0027)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
},
|
||||
"onStartup": {
|
||||
"config": {
|
||||
"script": "\tself.custom.activityLogger.start_time \u003d system.date.now()"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"params": {},
|
||||
"propConfig": {
|
||||
"custom.activityLogger": {
|
||||
"persistent": true
|
||||
},
|
||||
"custom.activityLogger.pageid": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{page.props.path}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"code": "\tif value \u003d\u003d\u0027/\u0027 or value \u003d\u003d \u0027\u0027 or value \u003d\u003d None:\n\t\treturn self.custom.activityLogger.alt_pageid.lower()\n\telse:\n\t\treturn value[1:].lower()",
|
||||
"type": "script"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 1080,
|
||||
"width": 1920
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"custom": {
|
||||
"s3URI": "SCADA/Other/MAP.svg"
|
||||
},
|
||||
"meta": {
|
||||
"name": "Image"
|
||||
},
|
||||
"position": {
|
||||
"height": 1,
|
||||
"width": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.source": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "this.custom.s3URI"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"code": "\treturn AWS.s3.getPresignedURL(self, value)",
|
||||
"type": "script"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"altText": "none",
|
||||
"fit": {
|
||||
"mode": "fill"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.image"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"mode": "percent",
|
||||
"style": {
|
||||
"backgroundColor": "#EEEEEE"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.coord"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"backgroundColor": "#B42222B3",
|
||||
"borderColor": "#000000",
|
||||
"borderStyle": "solid",
|
||||
"borderWidth": "0.5px",
|
||||
"color": "#FFFFFF",
|
||||
"fontFamily": "Arial",
|
||||
"fontSize": "14px",
|
||||
"fontWeight": "bold",
|
||||
"lineHeight": "20px",
|
||||
"textAlign": "center"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 761 B |
|
After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1,17 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"backgroundColor": "var(--warning)",
|
||||
"borderTopLeftRadius": "4px",
|
||||
"borderTopRightRadius": "4px",
|
||||
"borderBottomLeftRadius": "4px",
|
||||
"borderBottomRightRadius": "4px",
|
||||
"color": "var(--neutral-10)",
|
||||
"fontSize": "12px",
|
||||
"fontWeight": "bold",
|
||||
"lineHeight": "16px",
|
||||
"padding": "2px",
|
||||
"textAlign": "center"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
{
|
||||
"custom": {},
|
||||
"params": {
|
||||
"color": "#00FF00"
|
||||
},
|
||||
"propConfig": {
|
||||
"params.color": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 20,
|
||||
"width": 20
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"events": {
|
||||
"dom": {
|
||||
"onClick": {
|
||||
"config": {
|
||||
"script": "\tcolor \u003d self.view.params.color\n\tsystem.perspective.sendMessage(messageType\u003d\"color-clicked\", payload\u003d{\"color\":color})"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "20px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.style.backgroundColor": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.color"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"cursor": "pointer"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"direction": "column"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
import sys
|
||||
|
||||
def error_handler(whid, logger_name):
|
||||
logger_name = "%s-%s" % (whid, logger_name)
|
||||
logger = system.util.getLogger(logger_name)
|
||||
provider = "[%s_SCADA_TAG_PROVIDER]" % (whid)
|
||||
exc_type, exc_obj, tb = sys.exc_info()
|
||||
lineno = tb.tb_lineno
|
||||
logger.error("Error: %s, %s, %s" % (lineno, exc_type, exc_obj))
|
||||
system.tag.writeBlocking([provider + "System/wbsckt_running"], [0])
|
||||
|
||||
@ -0,0 +1,155 @@
|
||||
{
|
||||
"custom": {
|
||||
"activityLogger": {
|
||||
"alt_pageid": "tools",
|
||||
"start_time": {
|
||||
"$": [
|
||||
"ts",
|
||||
192,
|
||||
1716471122012
|
||||
],
|
||||
"$ts": 1716471122012
|
||||
}
|
||||
}
|
||||
},
|
||||
"events": {
|
||||
"system": {
|
||||
"onShutdown": {
|
||||
"config": {
|
||||
"script": "\tactivityLog.productMetrics.callLogger(self, \u0027page\u0027)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
},
|
||||
"onStartup": {
|
||||
"config": {
|
||||
"script": "\tself.session.custom.view_in_focus \u003d self.page.props.path\n\tself.custom.activityLogger.start_time \u003d system.date.now()"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"params": {},
|
||||
"propConfig": {
|
||||
"custom.activityLogger": {
|
||||
"persistent": true
|
||||
},
|
||||
"custom.activityLogger.pageid": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{/root.props.currentTabIndex}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"code": "\tpageid\u003d self.custom.activityLogger.alt_pageid+\u0027/\u0027+self.getChild(\"root\").props.tabs[value]\n\treturn pageid.replace(\u0027 \u0027,\u0027\u0027)",
|
||||
"type": "script"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 1080,
|
||||
"width": 1920
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "CommissioningTool"
|
||||
},
|
||||
"props": {
|
||||
"path": "Main-Views/Commissioning Tool/CT_Main"
|
||||
},
|
||||
"type": "ia.display.view"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "S3"
|
||||
},
|
||||
"position": {
|
||||
"tabIndex": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.params.selected_site": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "session.custom.fc"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"params": {
|
||||
"selected_image": null
|
||||
},
|
||||
"path": "Main-Views/S3/manage"
|
||||
},
|
||||
"type": "ia.display.view"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "NotifyTool"
|
||||
},
|
||||
"position": {
|
||||
"tabIndex": 2
|
||||
},
|
||||
"props": {
|
||||
"path": "Main-Views/Notify-Tool/Notify-Main"
|
||||
},
|
||||
"type": "ia.display.view"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "EmbeddedView"
|
||||
},
|
||||
"position": {
|
||||
"tabIndex": 3
|
||||
},
|
||||
"props": {
|
||||
"path": "Main-Views/Config-Tool/MainView"
|
||||
},
|
||||
"type": "ia.display.view"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.currentTabIndex": {
|
||||
"onChange": {
|
||||
"enabled": null,
|
||||
"script": "\ttry:\n\t\tpageid \u003d self.view.custom.activityLogger.alt_pageid + \u0027/\u0027+ self.props.tabs[previousValue.value]\n\t\tpageid \u003d pageid.replace(\u0027 \u0027,\u0027\u0027)\n\t\tpayload \u003d activityLog.productMetrics.createActivityPayload(self.view, \u0027page\u0027, pageid, pageid)\n\t\tif payload:\n\t\t\tself.view.custom.activityLogger.start_time \u003d system.date.now()\n\t\t\tsystem.perspective.sendMessage(\u0027activityLogger-TabChanged\u0027, payload \u003d payload, scope \u003d \u0027page\u0027)\n\texcept:\n\t\tpass"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"currentTabIndex": 3,
|
||||
"tabs": [
|
||||
"CT",
|
||||
"S3",
|
||||
"Notify Tool",
|
||||
"Site Config"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"customMethods": [],
|
||||
"extensionFunctions": null,
|
||||
"messageHandlers": [
|
||||
{
|
||||
"messageType": "activityLogger-TabChanged",
|
||||
"pageScope": true,
|
||||
"script": "\t# implement your handler here\n\tif payload:\n\t\tactivityLog.productMetrics.callActivityLoggerAPI(payload)\n",
|
||||
"sessionScope": false,
|
||||
"viewScope": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "ia.container.tab"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 19 KiB |
@ -0,0 +1,5 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,25 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"backgroundColor": "var(--warning)",
|
||||
"borderStyle": "none",
|
||||
"boxShadow": "none",
|
||||
"margin": "5px",
|
||||
"textTransform": "uppercase"
|
||||
}
|
||||
},
|
||||
"variants": [
|
||||
{
|
||||
"pseudo": "hover",
|
||||
"style": {
|
||||
"backgroundColor": "var(--warning)"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pseudo": "active",
|
||||
"style": {
|
||||
"color": "var(--neutral-30)"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 26 KiB |
@ -0,0 +1,21 @@
|
||||
import json
|
||||
|
||||
class SendMessage():
|
||||
|
||||
def __init__(self, whid):
|
||||
self.whid = whid
|
||||
tag_path = "[%s_SCADA_TAG_PROVIDER]System/wbsckt_messages_send" % (whid)
|
||||
tags_to_read = system.tag.readBlocking([tag_path])
|
||||
self.messages_to_send = system.util.jsonDecode(tags_to_read[0].value)
|
||||
system.tag.writeBlocking([tag_path],[system.util.jsonEncode({})])
|
||||
self.message_list = {}
|
||||
|
||||
def build_message_list(self):
|
||||
if self.messages_to_send:
|
||||
self.message_list = json.dumps(self.messages_to_send)
|
||||
else:
|
||||
self.message_list = None
|
||||
|
||||
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,34 @@
|
||||
def show_alarm_from_docked_window(self,event):
|
||||
#Get the alarm properties from the alarm object.
|
||||
"""
|
||||
Displays the currently active alarm from the south docked alarm table in the detailed view.
|
||||
If the alarm is on a different page to the current page the function will navigate the user
|
||||
to the correct page and show the alarm.
|
||||
|
||||
Args:
|
||||
self: Refrence to the object thats invoking this function.
|
||||
event: Refrence to the event that is invoking this function.
|
||||
|
||||
Returns:
|
||||
The fucntion doses not return any values.
|
||||
|
||||
Raises:
|
||||
KeyError: None
|
||||
"""
|
||||
|
||||
|
||||
alarm_id = event.value.get("AlarmId")
|
||||
tags_to_read = system.tag.readBlocking(["System/ActiveAlarms"])
|
||||
active_alarms = system.util.jsonDecode(tags_to_read[0].value)
|
||||
UDT = active_alarms.get(alarm_id,{}).get("UDT_tag")
|
||||
plc = UDT.split("_")[0]
|
||||
name = active_alarms.get(alarm_id,{}).get("Name")
|
||||
page_id = active_alarms.get(alarm_id,{}).get("PageId","None")
|
||||
display_path = active_alarms.get(alarm_id,{}).get("DisplayPath")
|
||||
|
||||
#Set the session custom variables to highlight the selected alarm.
|
||||
self.session.custom.searchId = UDT
|
||||
self.session.custom.deviceSearchId = display_path
|
||||
|
||||
url_to_navigate = "/DetailedView/%s/%s" % (page_id, plc)
|
||||
system.perspective.navigate(page = url_to_navigate)
|
||||
@ -0,0 +1,431 @@
|
||||
{
|
||||
"custom": {
|
||||
"box_shadow": "0px 2px 4px rgba(0, 0, 40, 0.15)",
|
||||
"expanded": true,
|
||||
"show_content": true
|
||||
},
|
||||
"events": {
|
||||
"system": {
|
||||
"onStartup": {
|
||||
"config": {
|
||||
"script": "\tself.custom.expanded \u003d self.params.open_expanded\n\t"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"params": {
|
||||
"anchor_position": null,
|
||||
"content_shown": true,
|
||||
"open_expanded": true,
|
||||
"params": {},
|
||||
"path": "Objects/Templates/S3/Management/file",
|
||||
"show_box_shadow_on_expanded": true,
|
||||
"title": "Card Title",
|
||||
"useDefaultHeight": false,
|
||||
"useDefaultWidth": false
|
||||
},
|
||||
"propConfig": {
|
||||
"custom.box_shadow": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if(\r\n\t{view.params.show_box_shadow_on_expanded}\u0026\u0026{view.custom.expanded},\r\n\t\u00270px 2px 4px rgba(0, 0, 40, 0.15)\u0027,\r\n\t\u0027\u0027\r\n)"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.expanded": {
|
||||
"persistent": true
|
||||
},
|
||||
"custom.show_content": {
|
||||
"persistent": true
|
||||
},
|
||||
"params.address": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.anchor_position": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.content_shown": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.show_content"
|
||||
},
|
||||
"type": "property"
|
||||
},
|
||||
"paramDirection": "output",
|
||||
"persistent": true
|
||||
},
|
||||
"params.open_expanded": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.params": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.path": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.show_box_shadow_on_expanded": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.system": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.title": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.useDefaultHeight": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.useDefaultWidth": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 600,
|
||||
"width": 500
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\t# toggle \u0027show_content\u0027 view custom prop\n\tself.view.custom.show_content \u003d not self.view.custom.show_content"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Button"
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"propConfig": {
|
||||
"props.image.icon.path": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({view.custom.show_content},\"material/chevron_left\",\"material/chevron_right\")"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"image": {
|
||||
"icon": {}
|
||||
},
|
||||
"primary": false,
|
||||
"style": {
|
||||
"borderStyle": "none",
|
||||
"classes": "Input/Button/Secondary_minimal"
|
||||
},
|
||||
"text": ""
|
||||
},
|
||||
"type": "ia.input.button"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer Anchor Left"
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"propConfig": {
|
||||
"position.display": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{view.params.anchor_position}\u003d\u0027left\u0027"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"direction": "column",
|
||||
"style": {
|
||||
"classes": "Framework/Card/Title_transparent",
|
||||
"margin": "0px",
|
||||
"padding": "0px"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.title"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"classes": "Framework/Card/Title_transparent"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tself.view.custom.expanded \u003d not self.view.custom.expanded"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Button"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.image.icon.path": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({view.custom.expanded}, \u0027material/expand_less\u0027, \u0027material/expand_more\u0027)"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"image": {
|
||||
"icon": {}
|
||||
},
|
||||
"primary": false,
|
||||
"style": {
|
||||
"classes": "Input/Button/Secondary_minimal"
|
||||
},
|
||||
"text": ""
|
||||
},
|
||||
"type": "ia.input.button"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer"
|
||||
},
|
||||
"position": {
|
||||
"basis": "24px",
|
||||
"shrink": 0
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "EmbeddedView"
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"propConfig": {
|
||||
"position.display": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.expanded"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.params": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.params"
|
||||
},
|
||||
"overlayOptOut": true,
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.path": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.path"
|
||||
},
|
||||
"overlayOptOut": true,
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.useDefaultViewHeight": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.useDefaultHeight"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.useDefaultViewWidth": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.useDefaultWidth"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"classes": "Framework/Card/Embedded_transparent"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.view"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer"
|
||||
},
|
||||
"position": {
|
||||
"basis": "100%",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"position.display": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.show_content"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"direction": "column",
|
||||
"style": {
|
||||
"overflow": "hidden"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\t# toggle \u0027show_content\u0027 view custom prop\n\tself.view.custom.show_content \u003d not self.view.custom.show_content"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Button"
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"propConfig": {
|
||||
"props.image.icon.path": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({view.custom.show_content},\"material/chevron_right\",\"material/chevron_left\")"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"image": {
|
||||
"icon": {}
|
||||
},
|
||||
"primary": false,
|
||||
"style": {
|
||||
"borderStyle": "none"
|
||||
},
|
||||
"text": ""
|
||||
},
|
||||
"type": "ia.input.button"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer Anchor Right"
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"propConfig": {
|
||||
"position.display": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{view.params.anchor_position}\u003d\u0027right\u0027"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"direction": "column",
|
||||
"style": {
|
||||
"classes": "Framework/Card/Title_transparent",
|
||||
"margin": "0px",
|
||||
"padding": "0px"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.justify": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({view.params.anchor_position}\u003d\u0027right\u0027,\u0027flex-end\u0027,\u0027flex-start\u0027)"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"props.style.boxShadow": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.box_shadow"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"classes": "Framework/Card/Card_transparent"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
{"base":{"style":{"paddingBottom":"4px","paddingLeft":"18px","paddingRight":"18px","paddingTop":"4px"}}}
|
||||
@ -0,0 +1,9 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"backgroundColor": "#FFFFFF",
|
||||
"color": "#000000",
|
||||
"fontFamily": "Arial"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
from urllib2_aws4auth import aws_urlopen, Request
|
||||
from urllib2 import HTTPError
|
||||
from urllib import urlencode
|
||||
import json
|
||||
import system
|
||||
import boto3
|
||||
from pprint import pformat
|
||||
|
||||
REGION ='us-west-2'
|
||||
|
||||
|
||||
def openSession():
|
||||
CREDS = boto3.Session().get_credentials()
|
||||
AWS_ACCESS_KEY_ID = CREDS.access_key
|
||||
AWS_SECRET_ACCESS_KEY = CREDS.secret_key
|
||||
TOKEN = CREDS.token
|
||||
CREDSRETURN = {'AccessKeyId':AWS_ACCESS_KEY_ID,
|
||||
'SecretAccessKey':AWS_SECRET_ACCESS_KEY,
|
||||
'SessionToken':TOKEN}
|
||||
# OPENER = aws_urlopen(
|
||||
# AWS_ACCESS_KEY_ID,
|
||||
# AWS_SECRET_ACCESS_KEY,
|
||||
# REGION,
|
||||
# SERVICE,
|
||||
# session_token=TOKEN,
|
||||
# verify=False)
|
||||
# return OPENER
|
||||
|
||||
return CREDSRETURN
|
||||
|
||||
|
||||
def DynamoReader():
|
||||
import json
|
||||
from pprint import pformat
|
||||
import boto3
|
||||
from datetime import datetime
|
||||
from decimal import Decimal
|
||||
import time
|
||||
|
||||
LOGGER = system.util.getLogger('notify_to_dynamodb_log')
|
||||
|
||||
# Get STAGE variable
|
||||
roleArn = 'arn:aws:iam::533266954132:role/ignition_to_aws_scada_notify'
|
||||
STAGE = 'beta'
|
||||
# Make sure STAGE is valid. no gamma stage configured
|
||||
if STAGE not in ['alpha', 'beta', 'gamma', 'prod']:
|
||||
STAGE = 'beta'
|
||||
if STAGE == 'gamma':
|
||||
STAGE = 'beta'
|
||||
|
||||
STAGE_CONFIG = {
|
||||
'alpha':{
|
||||
'region' : 'us-west-2',
|
||||
'roleArn' : roleArn,
|
||||
'tableName' : 'NotificationsEntries'
|
||||
},
|
||||
'beta': {
|
||||
'region':'us-west-2',
|
||||
'roleArn': roleArn,
|
||||
'tableName' : 'NotificationsEntries'
|
||||
|
||||
},
|
||||
'prod': {
|
||||
'region':'us-west-2',
|
||||
'roleArn': roleArn,
|
||||
'tableName' : 'NotificationsEntries'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# create sts session to get credentials from EC2
|
||||
sts_client = boto3.client('sts')
|
||||
region_name = STAGE_CONFIG.get(STAGE, 'alpha').get('region', 'us-west-2')
|
||||
|
||||
assume_role_response = sts_client.assume_role(
|
||||
RoleArn = STAGE_CONFIG.get(STAGE, 'beta').get('roleArn', roleArn),
|
||||
RoleSessionName = 'AssumeRole'
|
||||
)
|
||||
|
||||
temp_credentials = assume_role_response['Credentials']
|
||||
|
||||
# create session using the temp creds
|
||||
b3_session = boto3.Session(
|
||||
aws_access_key_id = temp_credentials['AccessKeyId'],
|
||||
aws_secret_access_key = temp_credentials['SecretAccessKey'],
|
||||
aws_session_token = temp_credentials['SessionToken'],
|
||||
region_name = 'us-west-2',
|
||||
)
|
||||
|
||||
# create a dynamodb session
|
||||
dynamodb = b3_session.resource('dynamodb')
|
||||
table = dynamodb.Table(STAGE_CONFIG.get(STAGE, 'beta').get('tableName', 'NotificationsEntries'))
|
||||
# response = client.scan(
|
||||
# TableName='string',
|
||||
# IndexName='string',
|
||||
# AttributesToGet=[
|
||||
# 'string',
|
||||
# ],
|
||||
# Limit=123,
|
||||
|
||||
# write data directly to dynamodb table
|
||||
try:
|
||||
response = table.scan()
|
||||
# response = table.scan(ProjectionExpression="PrimaryKey, publish, expire, title")
|
||||
# TableName='NotificationsEntries',
|
||||
# IndexName='publish',
|
||||
## ProjectionExpression =['publish', 'expire', 'title'],
|
||||
# Limit=123)
|
||||
# system.perspective.print(response)
|
||||
system.perspective.print('Read from NotificationsEntries DynamoDB Table Successful')
|
||||
except Exception as e:
|
||||
system.perspective.print('Read from NotificationsEntries DynamoDB Table NOT Successful')
|
||||
system.perspective.print(str(e))
|
||||
LOGGER.error(str(e))
|
||||
|
||||
|
||||
return response
|
||||
|
||||
@ -0,0 +1,151 @@
|
||||
{
|
||||
"custom": {},
|
||||
"params": {
|
||||
"address": "test",
|
||||
"params": {},
|
||||
"path": "",
|
||||
"system": {},
|
||||
"title": "Card Title",
|
||||
"useDefaultHeight": false,
|
||||
"useDefaultWidth": false
|
||||
},
|
||||
"propConfig": {
|
||||
"params.address": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.params": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.path": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.system": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.title": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.useDefaultHeight": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.useDefaultWidth": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 339,
|
||||
"width": 369
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "20px",
|
||||
"shrink": 0
|
||||
},
|
||||
"propConfig": {
|
||||
"props.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.title"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"classes": "Framework/Card/Title"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "EmbeddedView"
|
||||
},
|
||||
"position": {
|
||||
"shrink": 0
|
||||
},
|
||||
"propConfig": {
|
||||
"props.params": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.params"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.params.address": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.address"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.params.system": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.system"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.path": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.path"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.useDefaultViewHeight": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.useDefaultHeight"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.useDefaultViewWidth": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.useDefaultWidth"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"classes": "Framework/Card/Embedded"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.view"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"direction": "column",
|
||||
"style": {
|
||||
"classes": "Framework/Card/Card"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
import time
|
||||
|
||||
def close_websckt():
|
||||
"""
|
||||
This function disconnects the web socket and exits any loops.
|
||||
Should be called when a project is saved or modified to stop
|
||||
multiple threads running.
|
||||
|
||||
Args:
|
||||
None
|
||||
|
||||
Returns:
|
||||
N/A
|
||||
|
||||
Raises:
|
||||
N/A
|
||||
"""
|
||||
|
||||
fc = system.tag.readBlocking(["Configuration/FC"])
|
||||
fc_value = fc[0].value
|
||||
tag_provider = "[%s_SCADA_TAG_PROVIDER]" % (fc_value)
|
||||
system.tag.writeBlocking([tag_provider + "System/close_socket"],[0])
|
||||
running = system.util.getGlobals().get(fc_value, {}).get("wbsckt_running", 0)
|
||||
if running:
|
||||
system.util.getGlobals()[fc_value]["wbsckt_running"] = False
|
||||
system.tag.writeBlocking(tag_provider + "System/wbsckt_running", [0])
|
||||
time.sleep(2)
|
||||
system.tag.writeBlocking([tag_provider + "System/close_socket"],[1])
|
||||
logger = system.util.getLogger("%s-WebSocket-Restart" % (fc))
|
||||
logger.info("Web-Socket closed due to restart, AWS.wbsckt_abort.close_websckt()")
|
||||
|
||||
def check_web_socket():
|
||||
"""
|
||||
This function checks to see if the "System/close_socket" tag is active
|
||||
(boolean on) or inactive (boolean off). If the tag is active the web
|
||||
socket will run, if it is inactive then the web socket will stop running.
|
||||
This function is called from the main web socket gateway event.
|
||||
Used to exit the web socket gateway event.
|
||||
|
||||
Args:
|
||||
None
|
||||
|
||||
Returns:
|
||||
True or False
|
||||
|
||||
Raises:
|
||||
N/A
|
||||
"""
|
||||
request_to_close = system.tag.readBlocking(["System/close_socket"])
|
||||
request_to_close_val = request_to_close[0].value
|
||||
if not request_to_close_val:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,198 @@
|
||||
{
|
||||
"custom": {
|
||||
"activityLogger": {
|
||||
"alt_pageid": "card_view",
|
||||
"start_time": {
|
||||
"$": [
|
||||
"ts",
|
||||
192,
|
||||
1710802671820
|
||||
],
|
||||
"$ts": 1710802671820
|
||||
}
|
||||
}
|
||||
},
|
||||
"events": {
|
||||
"system": {
|
||||
"onShutdown": {
|
||||
"config": {
|
||||
"script": "\tactivityLog.logger.callLogger(self, \u0027page\u0027)\n\tactivityLog.productMetrics.callLogger(self, \u0027page\u0027)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
},
|
||||
"onStartup": {
|
||||
"config": {
|
||||
"script": "\tself.custom.activityLogger.start_time \u003d system.date.now()"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"params": {
|
||||
"page_name": "Home"
|
||||
},
|
||||
"propConfig": {
|
||||
"custom.activityLogger": {
|
||||
"persistent": true
|
||||
},
|
||||
"custom.activityLogger.pageid": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{page.props.path}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"code": "\tif value \u003d\u003d\u0027/\u0027 or value \u003d\u003d \u0027\u0027 or value \u003d\u003d None:\n\t\treturn self.custom.activityLogger.alt_pageid.lower()\n\telse:\n\t\treturn value[1:].lower()",
|
||||
"type": "script"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"params.page_name": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 1080,
|
||||
"width": 1920
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "FlexRepeater"
|
||||
},
|
||||
"position": {
|
||||
"basis": "1080px"
|
||||
},
|
||||
"props": {
|
||||
"alignContent": "flex-start",
|
||||
"alignItems": "flex-start",
|
||||
"elementPosition": {
|
||||
"grow": 0,
|
||||
"shrink": 0
|
||||
},
|
||||
"path": "Symbol-Views/Controller-Views/ControllerStatus",
|
||||
"style": {
|
||||
"overflow": "visible"
|
||||
},
|
||||
"wrap": "wrap"
|
||||
},
|
||||
"type": "ia.display.flex-repeater"
|
||||
}
|
||||
],
|
||||
"custom": {
|
||||
"Devices": [
|
||||
"ARSAW1301",
|
||||
"PLC03",
|
||||
"ARSAW1302",
|
||||
"PLC01",
|
||||
"PLC02",
|
||||
"PLC98",
|
||||
"ARSAW1305",
|
||||
"ARSAW1503",
|
||||
"PLC08",
|
||||
"PLC99",
|
||||
"ARSAW1306",
|
||||
"ARSAW1504",
|
||||
"ARSAW1501",
|
||||
"ARSAW1303",
|
||||
"PLC06",
|
||||
"PLC07",
|
||||
"ARSAW1304",
|
||||
"ARSAW1502",
|
||||
"ARSAW1309",
|
||||
"ARSAW1507",
|
||||
"ARSAW1508",
|
||||
"PLC09",
|
||||
"ARSAW1307",
|
||||
"ARSAW1505",
|
||||
"ARSAW1308",
|
||||
"ARSAW1506",
|
||||
"PLC20",
|
||||
"ARSAW1509",
|
||||
"PLC14",
|
||||
"PLC80",
|
||||
"PLC81",
|
||||
"PLC82",
|
||||
"PLC16",
|
||||
"FSC10",
|
||||
"PLC21",
|
||||
"PLC22",
|
||||
"PLC69",
|
||||
"PLC25",
|
||||
"PLC26",
|
||||
"PLC23",
|
||||
"PLC24",
|
||||
"PLC97",
|
||||
"PLC27",
|
||||
"PLC61",
|
||||
"PLC60",
|
||||
"PLC1000",
|
||||
"PLC13",
|
||||
"ARSAW1312",
|
||||
"ARSAW1510",
|
||||
"ARSAW1511",
|
||||
"ARSAW1310",
|
||||
"ARSAW1311",
|
||||
"ARSAW1512",
|
||||
"PLC70",
|
||||
"PLC71",
|
||||
"PLC32",
|
||||
"PLC30",
|
||||
"PLC31",
|
||||
"PLC15"
|
||||
],
|
||||
"count": "value",
|
||||
"delay": 2000,
|
||||
"run_update": true
|
||||
},
|
||||
"events": {
|
||||
"system": {
|
||||
"onStartup": [
|
||||
{
|
||||
"config": {
|
||||
"script": "\tVisualisation.home_page.create_home_page(self)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
},
|
||||
{
|
||||
"config": {
|
||||
"script": "\twhid \u003d self.session.custom.fc\n\tsession_id \u003d self.session.props.id\n\tpage_id \u003d self.view.params.page_name\n\tCommands.analytics.send_page_details(whid, session_id, page_id)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"propConfig": {
|
||||
"custom.update": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "now({this.custom.delay})"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"onChange": {
|
||||
"enabled": null,
|
||||
"script": "\n if (self.session.custom.fc \u003d\u003d \u0027\u0027) or (self.session.custom.fc is None):\n \tself.getChild(\"FlexRepeater\").props.instances \u003d []\n \treturn\n \n if self.custom.run_update:\n \tVisualisation.home_page.update_home_status(self)\n# system_tags \u003d system.tag.readBlocking([\"Configuration/FC\", \"System/ActiveAlarms\"])\n# tag_provider \u003d \"[%s_SCADA_TAG_PROVIDER]\" % (system_tags[0].value)\n# status_decoded \u003d system.util.jsonDecode(self.session.custom.id_to_state)\n# if status_decoded:\n#\t values \u003d []\n#\t devices \u003d self.custom.Devices\n#\t for i in devices:\n#\t \tvalue \u003d status_decoded.get(i)\n#\t \tif value \u003d\u003d None:\n#\t \t\tvalues.append(5)\n#\t \telse:\n#\t \t\tvalues.append(value)\n#\t zipped_list \u003d zip(values, devices)\n#\t devices_sorted \u003d [y for x,y in sorted(zipped_list)]\n#\t for i,j in enumerate(devices_sorted):\n#\t try:\n#\t \tself.getChild(\"FlexRepeater\").props.instances[i].tagProps[0] \u003d j\n#\t except:\n#\t \tsystem.perspective.print(i)"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"direction": "column"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,551 @@
|
||||
{
|
||||
"custom": {
|
||||
"alarm_message": null,
|
||||
"covert_mode": true,
|
||||
"disconnected": false,
|
||||
"display_icon": true,
|
||||
"error": false,
|
||||
"isMatch": 0,
|
||||
"plc": "value",
|
||||
"priority": 0,
|
||||
"priority_string": "No active alarms",
|
||||
"running_status": 0,
|
||||
"searchId": "value",
|
||||
"state": 5,
|
||||
"state_string": "Unknown"
|
||||
},
|
||||
"params": {
|
||||
"forceFaultStatus": null,
|
||||
"forceRunningStatus": null,
|
||||
"has_state": false,
|
||||
"tagProps": [
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value"
|
||||
]
|
||||
},
|
||||
"propConfig": {
|
||||
"custom.alarm_message": {
|
||||
"persistent": true
|
||||
},
|
||||
"custom.covert_mode": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "case(\t{value},\r\n\t\t0, {session.custom.alarm_filter.show_gateways},\r\n\t\t1, True,\r\n\t\t2, True,\r\n\t\t3, {session.custom.alarm_filter.show_low_alarm}||{session.custom.alarm_filter.show_gateways},\r\n\t\t4, {session.custom.alarm_filter.show_diagnostic}||{session.custom.alarm_filter.show_gateways},\r\n\t\t5, {session.custom.alarm_filter.show_gateways},\r\n\t\tFalse)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.disconnected": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "indirect",
|
||||
"references": {
|
||||
"fc": "{session.custom.fc}",
|
||||
"plc": "{view.custom.plc}"
|
||||
},
|
||||
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{plc}/DCN"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "if(isNull({value}), False, {value})",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.display_icon": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{this.custom.covert_mode}//||{this.custom.isMatch}\u003e0"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.error": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "0 \u003c {value} \u0026\u0026 {value} \u003c 5",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.isMatch": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({view.params.tagProps[0]}\u003d\"value\",0,\nif({this.custom.searchId}\u003d{view.params.tagProps[0]},100,0))"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.plc": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.tagProps[0]"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "split({value}, \"/\")[0]",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.priority": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": 0,
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 1,
|
||||
"output": 4
|
||||
},
|
||||
{
|
||||
"input": 2,
|
||||
"output": 3
|
||||
},
|
||||
{
|
||||
"input": 3,
|
||||
"output": 2
|
||||
},
|
||||
{
|
||||
"input": 4,
|
||||
"output": 1
|
||||
}
|
||||
],
|
||||
"outputType": "scalar",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.priority_string": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "case({view.custom.state},\r\n1, \"High\",\r\n2, \"Medium\",\r\n3, \"Low\",\r\n4, \"Diagnostic\",\r\n5, \"No active alarms\",\r\n\"Unknown\")"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.running_status": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "indirect",
|
||||
"references": {
|
||||
"0": "{view.params.tagProps[0]}",
|
||||
"fc": "{session.custom.fc}"
|
||||
},
|
||||
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/STATE"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "coalesce({value},{view.params.forceRunningStatus},0)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.searchId": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "session.custom.searchId"
|
||||
},
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.state": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "indirect",
|
||||
"references": {
|
||||
"0": "{view.params.tagProps[0]}",
|
||||
"fc": "{session.custom.fc}"
|
||||
},
|
||||
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/ALARMST"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "coalesce({value},{view.params.forceFaultStatus},0)",
|
||||
"type": "expression"
|
||||
},
|
||||
{
|
||||
"fallback": null,
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 4,
|
||||
"output": 1
|
||||
},
|
||||
{
|
||||
"input": 3,
|
||||
"output": 2
|
||||
},
|
||||
{
|
||||
"input": 2,
|
||||
"output": 3
|
||||
},
|
||||
{
|
||||
"input": 1,
|
||||
"output": 4
|
||||
},
|
||||
{
|
||||
"input": 0,
|
||||
"output": 5
|
||||
}
|
||||
],
|
||||
"outputType": "scalar",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.state_string": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "case({view.custom.running_status},\r\n1, \"Faulted\",\r\n2, \"Stopped\",\r\n3, \"Running\",\r\n\"Unknown\")"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"params.forceFaultStatus": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.forceRunningStatus": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.has_state": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.tagProps": {
|
||||
"paramDirection": "inout",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 47,
|
||||
"width": 68
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "ControlCabinet"
|
||||
},
|
||||
"position": {
|
||||
"height": 1,
|
||||
"width": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.elements[0].fill.paint": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "case({value},\r\n0,{session.custom.colours.state0},\r\n1,{session.custom.colours.state1},\r\n2,{session.custom.colours.state2},\r\n3,{session.custom.colours.state3},\r\n4,{session.custom.colours.state4},\r\n5,{session.custom.colours.state5},\r\n6,{session.custom.colours.state6},\r\n{session.custom.colours.fallback}\r\n)",
|
||||
"type": "expression"
|
||||
},
|
||||
{
|
||||
"expression": "if({view.custom.display_icon}\u0026\u0026 {view.custom.isMatch}\u003d0,{value},{value}+\u002700\u0027)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.style.classes": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({session.custom.colours.colour_impaired} \u003d True \u0026\u0026 {view.custom.isMatch} \u003e 0,\r\n{view.custom.state} + 100 + {view.custom.isMatch},\r\n{view.custom.state} + {view.custom.isMatch})"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": "",
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 101,
|
||||
"output": "State-Styles/State101"
|
||||
},
|
||||
{
|
||||
"input": 102,
|
||||
"output": "State-Styles/State102"
|
||||
},
|
||||
{
|
||||
"input": 103,
|
||||
"output": "State-Styles/State103"
|
||||
},
|
||||
{
|
||||
"input": 104,
|
||||
"output": "State-Styles/State104"
|
||||
},
|
||||
{
|
||||
"input": 105,
|
||||
"output": "State-Styles/State105"
|
||||
},
|
||||
{
|
||||
"input": 106,
|
||||
"output": "State-Styles/State106"
|
||||
},
|
||||
{
|
||||
"input": 201,
|
||||
"output": "State-Styles/State201"
|
||||
},
|
||||
{
|
||||
"input": 202,
|
||||
"output": "State-Styles/State202"
|
||||
},
|
||||
{
|
||||
"input": 203,
|
||||
"output": "State-Styles/State203"
|
||||
},
|
||||
{
|
||||
"input": 204,
|
||||
"output": "State-Styles/State204"
|
||||
},
|
||||
{
|
||||
"input": 205,
|
||||
"output": "State-Styles/State205"
|
||||
}
|
||||
],
|
||||
"outputType": "style-list",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"elements": [
|
||||
{
|
||||
"d": "M 0 40 L 0 0 L 61 40 Z",
|
||||
"fill": {},
|
||||
"name": "path",
|
||||
"stroke": {
|
||||
"paint": "#4c4c4c",
|
||||
"width": 4
|
||||
},
|
||||
"transform": "rotate(-180,30.5,20)",
|
||||
"type": "path"
|
||||
},
|
||||
{
|
||||
"d": "M 0 40 L 0 0 L 61 40 Z",
|
||||
"fill": {
|
||||
"paint": "#4C4C4C"
|
||||
},
|
||||
"name": "path",
|
||||
"stroke": {
|
||||
"paint": "#000000",
|
||||
"width": 4
|
||||
},
|
||||
"type": "path"
|
||||
}
|
||||
],
|
||||
"preserveAspectRatio": "none",
|
||||
"style": {},
|
||||
"viewBox": "-0.5 -0.5 62 41"
|
||||
},
|
||||
"type": "ia.shapes.svg"
|
||||
}
|
||||
],
|
||||
"events": {
|
||||
"dom": {
|
||||
"onClick": {
|
||||
"config": {
|
||||
"script": "\tsystem.perspective.openDock(\u0027Docked-East\u0027,params\u003d{\u0027tagProps\u0027:self.view.params.tagProps})"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
},
|
||||
"onDoubleClick": {
|
||||
"config": {
|
||||
"script": "\ttagProps \u003d self.view.params.tagProps\n\tsystem.perspective.openPopup(\"StatusPopUP\", \"PopUp-Views/Controller-Equipment/Information\", params \u003d{\"tagProps\":tagProps})\n\t"
|
||||
},
|
||||
"enabled": false,
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
},
|
||||
"onMouseEnter": {
|
||||
"config": {
|
||||
"script": "\tfrom time import sleep\n\t\n\talarm \u003d []\n\tmessage \u003d None\n\t\n\tsleep(0.5)\n\t\n\tif system.tag.exists(\"System/aws_data\"):\n\t\tif self.view.params.tagProps[0] !\u003d \"\":\n\t\t\ttags_to_read \u003d system.tag.readBlocking(\"System/aws_data\")\n\t\t\tdecode_alarm_data \u003d system.util.jsonDecode(tags_to_read[0].value)\n\t\t\talarm \u003d [decode_alarm_data[i] for i in decode_alarm_data\n\t\t\t\t\tif decode_alarm_data[i][\u0027sourceId\u0027].startswith(self.view.params.tagProps[0])]\n\t\tif alarm:\n\t\t\talarm \u003d sorted(alarm, key \u003d lambda t:t[\u0027timestamp\u0027], reverse\u003dTrue)\n\t\t\tmessage \u003d max(alarm, key \u003d lambda p:p[\u0027priority\u0027]).get(\u0027message\u0027)\n\t\t\tif len(alarm) \u003e 1:\n\t\t\t\tmessage +\u003d \" (+\" + str(len(alarm)-1) + \")\"\n\tself.view.custom.alarm_message \u003d message"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "root",
|
||||
"tooltip": {
|
||||
"enabled": true,
|
||||
"location": "top-left",
|
||||
"style": {}
|
||||
}
|
||||
},
|
||||
"propConfig": {
|
||||
"meta.tooltip.style.backgroundColor": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "case({value},\r\n0,{session.custom.colours.state0},\r\n1,{session.custom.colours.state1},\r\n2,{session.custom.colours.state2},\r\n3,{session.custom.colours.state3},\r\n4,{session.custom.colours.state4},\r\n5,{session.custom.colours.state5},\r\n6,{session.custom.colours.state6},\r\n{session.custom.colours.fallback}\r\n)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"meta.tooltip.style.classes": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{view.custom.priority}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": "Alarms-Styles/NoAlarm",
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 1,
|
||||
"output": "Alarms-Styles/Diagnostic"
|
||||
},
|
||||
{
|
||||
"input": 2,
|
||||
"output": "Alarms-Styles/Low"
|
||||
},
|
||||
{
|
||||
"input": 3,
|
||||
"output": "Alarms-Styles/Medium"
|
||||
},
|
||||
{
|
||||
"input": 4,
|
||||
"output": "Alarms-Styles/High"
|
||||
}
|
||||
],
|
||||
"outputType": "style-list",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"meta.tooltip.style.color": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "if({session.custom.colours.colour_impaired},\r\n\t\u0027#000000\u0027,\r\n\tcase(\t{value},\r\n\t\t\t1,\u0027#FFFFFF\u0027,\r\n\t\t\t2,\u0027#000000\u0027,\r\n\t\t\t3,\u0027#000000\u0027,\r\n\t\t\t4,\u0027#FFFFFF\u0027,\r\n\t\t\t5,\u0027#FFFFFF\u0027,\r\n\t\t\t\u0027#000000\u0027)\r\n\t)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"meta.tooltip.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({view.custom.disconnected} \u003d False,\n\tif(isNull({view.custom.alarm_message}),\n\t\"Source Id: \" + {view.params.tagProps[0]} +\n\t\", Priority: \" + {view.custom.priority_string} +\n\t\", State: \" + {view.custom.state_string},\n\t\"Source Id: \" + {view.params.tagProps[0]} +\n\t\", Alarm: \" + {view.custom.alarm_message} +\n\t\", Priority: \" + {view.custom.priority_string} +\n\t\", State: \" + {view.custom.state_string}),\n\"Source Id: \" +{view.params.tagProps[0]} + \", Priority: Unknown, State: Unknown\")"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"meta.visible": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.display_icon"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.style.classes": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.disconnected"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": "Disconnects/Device-Connected",
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": true,
|
||||
"output": "Disconnects/Device-Disconnected"
|
||||
},
|
||||
{
|
||||
"input": false,
|
||||
"output": "Disconnects/Device-Connected"
|
||||
}
|
||||
],
|
||||
"outputType": "style-list",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"aspectRatio": "68:47",
|
||||
"mode": "percent",
|
||||
"style": {
|
||||
"cursor": "pointer"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.coord"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"fontFamily": "Arial",
|
||||
"fontSize": "10px",
|
||||
"textAlign": "center"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,211 @@
|
||||
import java.net.http.WebSocketHandshakeException
|
||||
from java.net.http import HttpClient;
|
||||
from java.net.http import WebSocket;
|
||||
from java.net import URI
|
||||
from java.lang import Thread
|
||||
import uuid
|
||||
import json
|
||||
import time
|
||||
|
||||
#Check for a http client stored in the globals.
|
||||
whid = system.tag.readBlocking(["Configuration/FC"])[0].value
|
||||
client = system.util.getGlobals().get(whid, {}).get("http_client", None)
|
||||
#Store the http client as a global variable to be reused on project saves.
|
||||
if not client:
|
||||
client = HttpClient.newHttpClient()
|
||||
system.util.getGlobals()[whid]["http_client"] = client
|
||||
|
||||
class Listener(WebSocket.Listener):
|
||||
"""
|
||||
Creates a Listener for receiving web socket messages.
|
||||
The mehtods in this class are standard Java methods
|
||||
that have been overidden to include additional functionality. onOpen,
|
||||
onText, onClose and onError are called by the class whenthe web socket
|
||||
is opened, when the web socket receives data,
|
||||
when the web socket is closed, when the web socket encounters an error,
|
||||
respectively. Messages are sent from the web socket by calling the sendText
|
||||
method on the Listener object.
|
||||
|
||||
Args:
|
||||
whid: Warehouse id for the tag provider (string).
|
||||
message_handler: A message handler object which parses
|
||||
the messages received from the onText
|
||||
method (class)
|
||||
|
||||
Returns:
|
||||
Listener object.
|
||||
|
||||
Raises:
|
||||
Error handling is performed by the onError method.
|
||||
This method can be overidden with additional logic
|
||||
for handling errors detected by the Listener object.
|
||||
"""
|
||||
def __init__(self, whid, message_handler):
|
||||
self.whid = whid
|
||||
self.alarms = {}
|
||||
self.tag_provider = "[%s_SCADA_TAG_PROVIDER]" % (self.whid)
|
||||
self.logger = system.util.getLogger("%s-Web-Socket-Listener" % (self.whid))
|
||||
self.message = ""
|
||||
self.message_handler = message_handler
|
||||
|
||||
def onOpen(self, websocket):
|
||||
#Generate uuid to help track the connection in aws.
|
||||
uid = uuid.uuid4()
|
||||
on_open_subscribe = json.dumps({"action": "subscribe",
|
||||
"parameters": {"siteId": self.whid,
|
||||
"clientName": str(uid)}}
|
||||
)
|
||||
websocket.sendText(on_open_subscribe, True)
|
||||
logger = system.util.getLogger("Web-Socket-OnOpen")
|
||||
self.logger.info("message sent =" + str(on_open_subscribe))
|
||||
websocket.request(1)
|
||||
|
||||
def onText(self, websocket, data, last):
|
||||
self.message += str(data)
|
||||
if not last:
|
||||
websocket.request(1)
|
||||
else:
|
||||
json_message = json.loads(self.message)
|
||||
self.message = ""
|
||||
self.message_handler.handle_message(json_message)
|
||||
websocket.request(1)
|
||||
|
||||
def onClose(self, websocket, error):
|
||||
self.logger.info("Onclose method " + str(error))
|
||||
|
||||
def onError(self, websocket, error):
|
||||
self.logger.error("OnError method " + str(error))
|
||||
|
||||
|
||||
def web_socket_main(whid, provider, region, message_handler, secret_name):
|
||||
"""
|
||||
Main function for running a web socket. This function can
|
||||
be called in an asynchronous thread and should only exit
|
||||
when the socket has been closed or an error is encountered.
|
||||
The function will create a web socket object and run in a
|
||||
while loop to keep the socket connection open.
|
||||
It will exit if an error is encounterd, the socket is manually
|
||||
closed from the tag provider or the socket is closed.
|
||||
|
||||
Args:
|
||||
whid: Warehouse id for the tag provider (string).
|
||||
provider: Tag provider that the web socket will use to write messages to/from (string).
|
||||
region: The AWS region of the api endpoint. Usally the same region as the EC2
|
||||
running the web socket (string).
|
||||
message_handler: message handler object used for parsing of the web socket messages (class).
|
||||
secret_name : name of the secret to be passed into the web socket. This will retreive the api endpoint for AWS.
|
||||
|
||||
Returns:
|
||||
N/A.
|
||||
Raises:
|
||||
Secrets manager error
|
||||
web socket error
|
||||
"""
|
||||
thread_name = str(Thread.getId(Thread.currentThread()))
|
||||
system.tag.writeAsync([provider + "system/thread_id"],[thread_name])
|
||||
system.util.getGlobals()[whid]["wbsckt_running"] = True
|
||||
system.tag.writeAsync([provider + "System/wbsckt_running"],[1])
|
||||
logger_name = "%s-web-socket-main" % (whid)
|
||||
logger = system.util.getLogger(logger_name)
|
||||
timer_end = None
|
||||
timer_started = False
|
||||
"""The heartbeat is initalised with the current time on first connect
|
||||
Each time a new heartbeat is recieved in AWS.message_types
|
||||
the current time is written to the tag wbsckt_heartbeat_interval.
|
||||
The websocket checks that a heartbeat has been recieved at least every 120 secs.
|
||||
If a heartbeat is not recieved within the 120 sec duration the connection is closed and the loop will exit.
|
||||
"""
|
||||
AWS.heartbeat.get_heartbeat(provider)
|
||||
tags_to_read = system.tag.readBlocking([provider + "System/wbsckt_heartbeat_interval"])
|
||||
wbsckt_heartbeat_interval = tags_to_read[0].value
|
||||
#Return api endpoint from secrets manager.
|
||||
API_ID, STAGE, ACC_ID, FUNC_URL = AWS.secrets_manager.get_secret(whid, secret_name)
|
||||
|
||||
try:
|
||||
credentials = AWS.credentials.assume_role(profile_name = "default", region = region, arn = ACC_ID, api_id = API_ID, stage = STAGE)
|
||||
except:
|
||||
AWS.errors.error_handler(whid, "AWS.credentials.assume_role")
|
||||
return
|
||||
|
||||
logger.info("Building URL ....")
|
||||
url, headers = AWS.build_url.make_websocket_connection(API_ID, region, STAGE, credentials)
|
||||
listener = AWS.web_socket.Listener(whid, message_handler)
|
||||
# client = HttpClient.newHttpClient()
|
||||
#set the client as global (stored in the system global variables).
|
||||
global client
|
||||
uri = URI.create(url)
|
||||
logger.info(str(uri))
|
||||
logger.info("Building web-socket object ....")
|
||||
wsBuilder = client.newWebSocketBuilder()
|
||||
wsBuilder.header("Authorization", headers["Authorization"])
|
||||
wsBuilder.header("X-Amz-Date", headers["X-Amz-Date"])
|
||||
wsBuilder.header("X-Amz-Security-Token", headers["X-Amz-Security-Token"])
|
||||
|
||||
try:
|
||||
wsObj = wsBuilder.buildAsync(uri, listener)
|
||||
except:
|
||||
AWS.errors.error_handler(whid, "Build web socket")
|
||||
return
|
||||
|
||||
web_socket = wsObj.get()
|
||||
logger.info("Web socket object built, starting while loop ....")
|
||||
running = 1
|
||||
|
||||
while True:
|
||||
time.sleep(0.1)
|
||||
if running == 1:
|
||||
logger.info("While loop running ....")
|
||||
running = 0
|
||||
|
||||
if AWS.heartbeat.check_heartbeat(provider, 70):
|
||||
web_socket.sendClose(web_socket.NORMAL_CLOSURE, "Missing heartbeat")
|
||||
logger.warn("socket closed , missing heartbeat")
|
||||
web_socket.abort()
|
||||
text_val = web_socket.sendText(str({"action":"abort"}), True)
|
||||
break
|
||||
|
||||
check_socket_closed_in_loop = AWS.wbsckt_abort.check_web_socket()
|
||||
if check_socket_closed_in_loop:
|
||||
web_socket.sendClose(web_socket.NORMAL_CLOSURE, "")
|
||||
logger.info("socket close initiated")
|
||||
# web_socket.abort()
|
||||
text_val = web_socket.sendText(str({"action":"abort"}), True)
|
||||
break
|
||||
|
||||
if not timer_started:
|
||||
timer_start = system.date.now()
|
||||
timer_started = True
|
||||
|
||||
timer_end = system.date.now()
|
||||
time_diff = system.date.secondsBetween(timer_start, timer_end)
|
||||
if time_diff >= wbsckt_heartbeat_interval:
|
||||
send_heartbeat = True
|
||||
timer_started = False
|
||||
|
||||
if web_socket.isOutputClosed():
|
||||
logger.info("Websocket output closed")
|
||||
break
|
||||
|
||||
if web_socket.isInputClosed():
|
||||
logger.info("Websocket input closed")
|
||||
break
|
||||
|
||||
this_thread = system.tag.readBlocking(provider + "System/thread_id")[0].value
|
||||
if this_thread != thread_name:
|
||||
logger.warn("thread_id does not match current thread_id")
|
||||
break
|
||||
|
||||
tags_to_read = system.tag.readBlocking(["System/wbsckt_messages_send"])
|
||||
messages = system.util.jsonDecode(tags_to_read[0].value)
|
||||
message_list = messages.get("message_list")
|
||||
if message_list:
|
||||
for i in message_list:
|
||||
message_string = str(i)
|
||||
formatted_string = message_string.replace("u'","'")
|
||||
json_string = formatted_string.replace("'","\"")
|
||||
web_socket.sendText(str(json_string), True)
|
||||
logger.info("Message sent: " + str(json_string))
|
||||
system.tag.writeAsync(["System/wbsckt_messages_send"], "{}")
|
||||
system.util.getGlobals()[whid]["wbsckt_running"] = False
|
||||
web_socket.abort()
|
||||
system.tag.writeBlocking([provider + "System/wbsckt_running"], [0])
|
||||
@ -0,0 +1,141 @@
|
||||
{
|
||||
"custom": {},
|
||||
"params": {
|
||||
"tagProps": [
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value"
|
||||
]
|
||||
},
|
||||
"propConfig": {
|
||||
"params.tagProps": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 41,
|
||||
"width": 83
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tif self.view.params.tagProps[0] is not True:\n\t\tnavigation.additional_view.navigate_to_additional_view(self)\n\telse:\n\t\tnavigation.navigate_to_page.detailed_view(self, self.view.params.tagProps[2],self.view.params.tagProps[2], self.view.params.tagProps[3])"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Button"
|
||||
},
|
||||
"position": {
|
||||
"basis": "41px"
|
||||
},
|
||||
"propConfig": {
|
||||
"custom.page_id": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.tagProps[2]"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"custom.status": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "direct",
|
||||
"tagPath": "Configuration/DetailedViews.value"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"code": "\t\n\tjson_decode \u003d system.util.jsonDecode(value)\n\tpage_id \u003d self.custom.page_id\n\tpage_status \u003d json_decode.get(\"AdditionalPages\",{}).get(page_id,5)\n\treturn page_status",
|
||||
"type": "script"
|
||||
}
|
||||
],
|
||||
"type": "tag"
|
||||
}
|
||||
},
|
||||
"props.style.classes": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{this.custom.status}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": "",
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 1,
|
||||
"output": "State-Styles/Background-Fill/State1"
|
||||
},
|
||||
{
|
||||
"input": 2,
|
||||
"output": "State-Styles/Background-Fill/State2"
|
||||
},
|
||||
{
|
||||
"input": 3,
|
||||
"output": "State-Styles/Background-Fill/State3"
|
||||
},
|
||||
{
|
||||
"input": 4,
|
||||
"output": "State-Styles/Background-Fill/State4"
|
||||
},
|
||||
{
|
||||
"input": 5,
|
||||
"output": "Buttons/Clear-Background"
|
||||
},
|
||||
{
|
||||
"input": 6,
|
||||
"output": "State-Styles/Background-Fill/State6"
|
||||
},
|
||||
{
|
||||
"input": 0,
|
||||
"output": "State-Styles/Background-Fill/State0"
|
||||
}
|
||||
],
|
||||
"outputType": "style-list",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"image": {
|
||||
"icon": {
|
||||
"path": "material/navigation"
|
||||
}
|
||||
},
|
||||
"style": {},
|
||||
"text": ""
|
||||
},
|
||||
"type": "ia.input.button"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"direction": "column"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,894 @@
|
||||
{
|
||||
"custom": {
|
||||
"activityLogger": {
|
||||
"alt_pageid": "home"
|
||||
}
|
||||
},
|
||||
"params": {
|
||||
"viewFocus": "value"
|
||||
},
|
||||
"propConfig": {
|
||||
"custom.activityLogger": {
|
||||
"persistent": true
|
||||
},
|
||||
"custom.activityLogger.pageid": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{page.props.path}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"code": "\tif value \u003d\u003d\u0027/\u0027 or value \u003d\u003d \u0027\u0027 or value \u003d\u003d None:\n\t\treturn self.custom.activityLogger.alt_pageid.lower()\n\telse:\n\t\treturn value[1:].lower()",
|
||||
"type": "script"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"custom.activityLogger.start_time": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "now()"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"params.viewFocus": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 326,
|
||||
"width": 400
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "36px",
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"background-color": "#555555",
|
||||
"fontWeight": "bold",
|
||||
"textAlign": "center"
|
||||
},
|
||||
"text": "Status Filters"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"custom": {
|
||||
"buttonid": "status_filters/all"
|
||||
},
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": [
|
||||
{
|
||||
"config": {
|
||||
"script": "\tpayload \u003d {}\n\tif self.props.selected:\n\t\tvalue \u003d True\n\telse:\n\t\tvalue \u003d False\n\t\n\tpayload[\"data\"] \u003d value\n\t\n\tsystem.perspective.sendMessage(\"select-all-filters\", \n\t\t\t\t\t\t\t\t\tpayload \u003d payload, \n\t\t\t\t\t\t\t\t\tscope \u003d \"view\")"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
},
|
||||
{
|
||||
"config": {
|
||||
"script": "\tif not self.props.selected:\n\t\tbuttonid \u003d self.custom.buttonid\n\t\tactivityLog.logger.callLogger(self.view, \u0027click\u0027, buttonid)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Select-All",
|
||||
"tooltip": {
|
||||
"delay": 250
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"basis": "36px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.enabled": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if ({session.custom.alarm_filter.show_map}\u003dTrue \u0026\u0026 {session.custom.view_in_focus}\u003d\u0027/MAP-Home\u0027, True, False)"
|
||||
},
|
||||
"enabled": false,
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"props.selected": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({session.custom.alarm_filter.show_diagnostic} \u0026\u0026 \r\n{session.custom.alarm_filter.show_gateways} \u0026\u0026\r\n{session.custom.alarm_filter.show_low_alarm} \u0026\u0026\r\n{session.custom.alarm_filter.show_running} \u0026\u0026 \r\n{session.custom.alarm_filter.show_safety}, True, False)"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"checkedIcon": {
|
||||
"color": {
|
||||
"disabled": "#FFFFFF",
|
||||
"enabled": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
"style": {
|
||||
"color": "#FFFFFF",
|
||||
"fontFamily": "Arial",
|
||||
"fontSize": 12,
|
||||
"fontWeight": "bold",
|
||||
"marginLeft": 10,
|
||||
"marginRight": 10
|
||||
},
|
||||
"text": "Select All"
|
||||
},
|
||||
"type": "ia.input.checkbox"
|
||||
},
|
||||
{
|
||||
"custom": {
|
||||
"buttonid": "status_filters/low_alarms"
|
||||
},
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tif not self.props.selected:\n\t\tbuttonid \u003d self.custom.buttonid\n\t\tactivityLog.logger.callLogger(self.view, \u0027click\u0027, buttonid)\n\t\tactivityLog.productMetrics.callLogger(self.view, \u0027click\u0027, buttonid)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Low Alarms",
|
||||
"tooltip": {
|
||||
"delay": 250
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"basis": "36px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.enabled": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if ({session.custom.alarm_filter.show_map}\u003dTrue \u0026\u0026 {session.custom.view_in_focus}\u003d\u0027/MAP-Home\u0027, True, False)"
|
||||
},
|
||||
"enabled": false,
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"props.selected": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"bidirectional": true,
|
||||
"path": "session.custom.alarm_filter.show_low_alarm"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"checkedIcon": {
|
||||
"color": {
|
||||
"disabled": "#FFFFFF",
|
||||
"enabled": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
"style": {
|
||||
"color": "#FFFFFF",
|
||||
"fontFamily": "Arial",
|
||||
"fontSize": 12,
|
||||
"fontWeight": "bold",
|
||||
"marginLeft": 10,
|
||||
"marginRight": 10
|
||||
},
|
||||
"text": "Show Low Alarms"
|
||||
},
|
||||
"scripts": {
|
||||
"customMethods": [],
|
||||
"extensionFunctions": null,
|
||||
"messageHandlers": [
|
||||
{
|
||||
"messageType": "select-all-filters",
|
||||
"pageScope": false,
|
||||
"script": "\tdata \u003d payload[\"data\"]\n\tself.props.selected \u003d data\n\tsystem.perspective.print(data)",
|
||||
"sessionScope": false,
|
||||
"viewScope": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "ia.input.checkbox"
|
||||
},
|
||||
{
|
||||
"custom": {
|
||||
"buttonid": "status_filters/diagnostic_alarms"
|
||||
},
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tif not self.props.selected:\n\t\tbuttonid \u003d self.custom.buttonid\n\t\tactivityLog.logger.callLogger(self.view, \u0027click\u0027, buttonid)\n\t\tactivityLog.productMetrics.callLogger(self.view, \u0027click\u0027, buttonid)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Diagnostic",
|
||||
"tooltip": {
|
||||
"delay": 250
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"basis": "36px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.enabled": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if ({session.custom.alarm_filter.show_map}\u003dTrue \u0026\u0026 {session.custom.view_in_focus}\u003d\u0027/MAP-Home\u0027, True, False)"
|
||||
},
|
||||
"enabled": false,
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"props.selected": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"bidirectional": true,
|
||||
"path": "session.custom.alarm_filter.show_diagnostic"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"checkedIcon": {
|
||||
"color": {
|
||||
"disabled": "#FFFFFF",
|
||||
"enabled": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
"style": {
|
||||
"color": "#FFFFFF",
|
||||
"fontFamily": "Arial",
|
||||
"fontSize": 12,
|
||||
"fontWeight": "bold",
|
||||
"marginLeft": 10,
|
||||
"marginRight": 10
|
||||
},
|
||||
"text": "Show Diagnostic Alarms"
|
||||
},
|
||||
"scripts": {
|
||||
"customMethods": [],
|
||||
"extensionFunctions": null,
|
||||
"messageHandlers": [
|
||||
{
|
||||
"messageType": "select-all-filters",
|
||||
"pageScope": false,
|
||||
"script": "\tdata \u003d payload[\"data\"]\n\tself.props.selected \u003d data",
|
||||
"sessionScope": false,
|
||||
"viewScope": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "ia.input.checkbox"
|
||||
},
|
||||
{
|
||||
"custom": {
|
||||
"buttonid": "status_filters/running_status"
|
||||
},
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tif not self.props.selected:\n\t\tbuttonid \u003d self.custom.buttonid\n\t\tactivityLog.logger.callLogger(self.view, \u0027click\u0027, buttonid)\n\t\tactivityLog.productMetrics.callLogger(self.view, \u0027click\u0027, buttonid)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Running",
|
||||
"tooltip": {
|
||||
"delay": 250
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"basis": "36px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.enabled": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if ({session.custom.alarm_filter.show_map}\u003dTrue \u0026\u0026 {session.custom.view_in_focus}\u003d\u0027/MAP-Home\u0027, True, False)"
|
||||
},
|
||||
"enabled": false,
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"props.selected": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"bidirectional": true,
|
||||
"path": "session.custom.alarm_filter.show_running"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"checkedIcon": {
|
||||
"color": {
|
||||
"disabled": "#FFFFFF",
|
||||
"enabled": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
"style": {
|
||||
"color": "#FFFFFF",
|
||||
"fontFamily": "Arial",
|
||||
"fontSize": 12,
|
||||
"fontWeight": "bold",
|
||||
"marginLeft": 10,
|
||||
"marginRight": 10
|
||||
},
|
||||
"text": "Show Running Status"
|
||||
},
|
||||
"scripts": {
|
||||
"customMethods": [],
|
||||
"extensionFunctions": null,
|
||||
"messageHandlers": [
|
||||
{
|
||||
"messageType": "select-all-filters",
|
||||
"pageScope": false,
|
||||
"script": "\tdata \u003d payload[\"data\"]\n\tself.props.selected \u003d data",
|
||||
"sessionScope": false,
|
||||
"viewScope": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "ia.input.checkbox"
|
||||
},
|
||||
{
|
||||
"custom": {
|
||||
"buttonid": "status_filters/estops_pullChords"
|
||||
},
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tif not self.props.selected:\n\t\tbuttonid \u003d self.custom.buttonid\n\t\tactivityLog.logger.callLogger(self.view, \u0027click\u0027, buttonid)\n\t\tactivityLog.productMetrics.callLogger(self.view, \u0027click\u0027, buttonid)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "E-Stops",
|
||||
"tooltip": {
|
||||
"delay": 250
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"basis": "36px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.enabled": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if ({session.custom.alarm_filter.show_map}\u003dTrue \u0026\u0026 {session.custom.view_in_focus}\u003d\u0027/MAP-Home\u0027, True, False)"
|
||||
},
|
||||
"enabled": false,
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"props.selected": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"bidirectional": true,
|
||||
"path": "session.custom.alarm_filter.show_safety"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"checkedIcon": {
|
||||
"color": {
|
||||
"disabled": "#FFFFFF",
|
||||
"enabled": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
"style": {
|
||||
"color": "#FFFFFF",
|
||||
"fontFamily": "Arial",
|
||||
"fontSize": 12,
|
||||
"fontWeight": "bold",
|
||||
"marginLeft": 10,
|
||||
"marginRight": 10
|
||||
},
|
||||
"text": "Show E-Stops \u0026 Pull Chords"
|
||||
},
|
||||
"scripts": {
|
||||
"customMethods": [],
|
||||
"extensionFunctions": null,
|
||||
"messageHandlers": [
|
||||
{
|
||||
"messageType": "select-all-filters",
|
||||
"pageScope": false,
|
||||
"script": "\tdata \u003d payload[\"data\"]\n\tself.props.selected \u003d data",
|
||||
"sessionScope": false,
|
||||
"viewScope": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "ia.input.checkbox"
|
||||
},
|
||||
{
|
||||
"custom": {
|
||||
"buttonid": "status_filters/gateways"
|
||||
},
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tif not self.props.selected:\n\t\tbuttonid \u003d self.custom.buttonid\n\t\tactivityLog.logger.callLogger(self.view, \u0027click\u0027, buttonid)\n\t\tactivityLog.productMetrics.callLogger(self.view, \u0027click\u0027, buttonid)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Show-Gateways",
|
||||
"tooltip": {
|
||||
"delay": 250
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"basis": "36px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.enabled": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if ({session.custom.alarm_filter.show_map}\u003dTrue \u0026\u0026 {session.custom.view_in_focus}\u003d\u0027/MAP-Home\u0027, True, False)"
|
||||
},
|
||||
"enabled": false,
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"props.selected": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"bidirectional": true,
|
||||
"path": "session.custom.alarm_filter.show_gateways"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"checkedIcon": {
|
||||
"color": {
|
||||
"disabled": "#FFFFFF",
|
||||
"enabled": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
"style": {
|
||||
"color": "#FFFFFF",
|
||||
"fontFamily": "Arial",
|
||||
"fontSize": 12,
|
||||
"fontWeight": "bold",
|
||||
"marginLeft": 10,
|
||||
"marginRight": 10
|
||||
},
|
||||
"text": "Show Gateways"
|
||||
},
|
||||
"scripts": {
|
||||
"customMethods": [],
|
||||
"extensionFunctions": null,
|
||||
"messageHandlers": [
|
||||
{
|
||||
"messageType": "select-all-filters",
|
||||
"pageScope": false,
|
||||
"script": "\tdata \u003d payload[\"data\"]\n\tself.props.selected \u003d data",
|
||||
"sessionScope": false,
|
||||
"viewScope": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "ia.input.checkbox"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer"
|
||||
},
|
||||
"position": {
|
||||
"grow": 1
|
||||
},
|
||||
"props": {
|
||||
"direction": "column",
|
||||
"justify": "space-between"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tsystem.perspective.closePopup(\u0027\u0027)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Button"
|
||||
},
|
||||
"position": {
|
||||
"basis": "30px",
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"box-shadow": "5px 5px 5px",
|
||||
"style": {
|
||||
"backgroundColor": "#555555",
|
||||
"classes": "Background-Styles/Controller",
|
||||
"marginBottom": 5,
|
||||
"marginLeft": 20,
|
||||
"marginRight": 20,
|
||||
"marginTop": 5
|
||||
},
|
||||
"text": "Close"
|
||||
},
|
||||
"type": "ia.input.button"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "Status"
|
||||
},
|
||||
"position": {
|
||||
"basis": "200px",
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"direction": "column",
|
||||
"style": {
|
||||
"borderColor": "#FFFFFF",
|
||||
"borderStyle": "solid",
|
||||
"borderWidth": 1
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "36px",
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"background-color": "#555555",
|
||||
"fontWeight": "bold",
|
||||
"textAlign": "center"
|
||||
},
|
||||
"text": "Accessibility"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"custom": {
|
||||
"buttonid": "accessibility/color_blind_icons"
|
||||
},
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tif self.props.selected:\n\t\tbuttonid \u003d self.custom.buttonid\n\t\tactivityLog.logger.callLogger(self.view, \u0027click\u0027, buttonid)\n\t\tactivityLog.productMetrics.callLogger(self.view, \u0027click\u0027, buttonid)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Alt Colours"
|
||||
},
|
||||
"position": {
|
||||
"basis": "36px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.selected": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"bidirectional": true,
|
||||
"path": "session.custom.colours.colour_impaired"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"checkedIcon": {
|
||||
"color": {
|
||||
"disabled": "#FFFFFF",
|
||||
"enabled": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
"style": {
|
||||
"color": "#FFFFFF",
|
||||
"fontFamily": "Arial",
|
||||
"fontSize": 12,
|
||||
"fontWeight": "bold",
|
||||
"marginLeft": 10,
|
||||
"marginRight": 10
|
||||
},
|
||||
"text": "Colour-Blind Friendly Icons"
|
||||
},
|
||||
"type": "ia.input.checkbox"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label_0"
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"color": "#FFFFFF",
|
||||
"fontFamily": "Arial",
|
||||
"fontSize": 12,
|
||||
"fontWeight": "bold",
|
||||
"marginLeft": 10,
|
||||
"marginRight": 10
|
||||
},
|
||||
"text": "Magnification:"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"custom": {
|
||||
"buttonid": "accessibility/magnify"
|
||||
},
|
||||
"meta": {
|
||||
"name": "Dropdown"
|
||||
},
|
||||
"position": {
|
||||
"basis": "80px",
|
||||
"shrink": 0
|
||||
},
|
||||
"propConfig": {
|
||||
"props.value": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"bidirectional": true,
|
||||
"path": "session.custom.alarm_filter.magnificaiton"
|
||||
},
|
||||
"type": "property"
|
||||
},
|
||||
"onChange": {
|
||||
"enabled": null,
|
||||
"script": "\ttry:\n\t\tif previousValue.value !\u003d currentValue.value:\n\t\t\tactivityLog.productMetrics.callLogger(self.view, \u0027click\u0027, self.custom.buttonid)\n\texcept:\n\t\tpass"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"options": [
|
||||
{
|
||||
"label": "x1",
|
||||
"value": "x1"
|
||||
},
|
||||
{
|
||||
"label": "x2",
|
||||
"value": "x2"
|
||||
},
|
||||
{
|
||||
"label": "x3",
|
||||
"value": "x3"
|
||||
},
|
||||
{
|
||||
"label": "None",
|
||||
"value": "None"
|
||||
}
|
||||
],
|
||||
"placeholder": {
|
||||
"text": ""
|
||||
},
|
||||
"style": {
|
||||
"marginBottom": 3,
|
||||
"marginTop": 3
|
||||
}
|
||||
},
|
||||
"type": "ia.input.dropdown"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer"
|
||||
},
|
||||
"position": {
|
||||
"basis": "36px"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer"
|
||||
},
|
||||
"position": {
|
||||
"basis": 80
|
||||
},
|
||||
"props": {
|
||||
"direction": "column"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label_0"
|
||||
},
|
||||
"position": {
|
||||
"basis": "36px",
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"background-color": "#555555",
|
||||
"fontWeight": "bold",
|
||||
"textAlign": "center"
|
||||
},
|
||||
"text": "Home Card View"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"custom": {
|
||||
"buttonid": "status_filters/orderby"
|
||||
},
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tif self.props.selected:\n\t\tbuttonid \u003d self.custom.buttonid\n\t\tactivityLog.logger.callLogger(self.view, \u0027click\u0027, buttonid)\n\t\tactivityLog.productMetrics.callLogger(self.view, \u0027click\u0027, buttonid)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Order-By"
|
||||
},
|
||||
"position": {
|
||||
"basis": "36px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.selected": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"bidirectional": true,
|
||||
"path": "session.custom.alarm_filter.orderby"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"checkedIcon": {
|
||||
"color": {
|
||||
"disabled": "#FFFFFF",
|
||||
"enabled": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
"style": {
|
||||
"color": "#FFFFFF",
|
||||
"fontFamily": "Arial",
|
||||
"fontSize": 12,
|
||||
"fontWeight": "bold",
|
||||
"marginLeft": 10,
|
||||
"marginRight": 10
|
||||
},
|
||||
"text": "Order Cards By Area"
|
||||
},
|
||||
"type": "ia.input.checkbox"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "32px",
|
||||
"display": false
|
||||
},
|
||||
"propConfig": {
|
||||
"props.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.viewFocus"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"code": "#\tvalue \u003d value.split(\u0027/\u0027)\n#\tvalue \u003d value.pop()\n\n\treturn value",
|
||||
"type": "script"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer_0"
|
||||
},
|
||||
"position": {
|
||||
"basis": 65,
|
||||
"grow": 1
|
||||
},
|
||||
"props": {
|
||||
"direction": "column",
|
||||
"justify": "space-between"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "Accessibility"
|
||||
},
|
||||
"position": {
|
||||
"basis": "200px",
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"direction": "column",
|
||||
"style": {
|
||||
"borderColor": "#FFFFFF",
|
||||
"borderStyle": "solid",
|
||||
"borderWidth": 1
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"classes": "Background-Styles/Controller"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"backgroundColor": "#007EFCB3",
|
||||
"borderColor": "#000000",
|
||||
"borderStyle": "solid",
|
||||
"borderWidth": "0.5px",
|
||||
"color": "#000000",
|
||||
"fontFamily": "Arial",
|
||||
"fontSize": "14px",
|
||||
"fontWeight": "bold",
|
||||
"lineHeight": "20px",
|
||||
"textAlign": "center"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 423 B |
@ -0,0 +1,11 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"borderColor": "#CCCCCC",
|
||||
"borderStyle": "solid",
|
||||
"borderWidth": "1px",
|
||||
"borderRadius": "4px",
|
||||
"padding": "4px"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"base": {
|
||||
"animation": {
|
||||
"duration": "1s",
|
||||
"keyframes": {
|
||||
"0%": {
|
||||
"backgroundColor": "#007EFCB3"
|
||||
},
|
||||
"100%": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"fontWeight": "bold"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,318 @@
|
||||
{
|
||||
"custom": {
|
||||
"numberOfColumns": 6,
|
||||
"test": [
|
||||
{
|
||||
"Label": "Seq",
|
||||
"Value": 2,
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Label": "Type",
|
||||
"Value": "StateChanged",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Label": "When",
|
||||
"Value": "1670429640000",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Label": "Source",
|
||||
"Value": "PLC01/054BV55",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Label": "CurrentState",
|
||||
"Value": "",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Label": "ReasonCode",
|
||||
"Value": "",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"checkedState": "False",
|
||||
"index": "value",
|
||||
"rowData": [
|
||||
[
|
||||
"Seq",
|
||||
2
|
||||
],
|
||||
[
|
||||
"Type",
|
||||
"StateChanged"
|
||||
],
|
||||
[
|
||||
"When",
|
||||
"1670429640000"
|
||||
],
|
||||
[
|
||||
"Source",
|
||||
"PLC01/054BV55"
|
||||
],
|
||||
[
|
||||
"CurrentState",
|
||||
""
|
||||
],
|
||||
[
|
||||
"ReasonCode",
|
||||
""
|
||||
]
|
||||
]
|
||||
},
|
||||
"propConfig": {
|
||||
"custom.test": {
|
||||
"persistent": true
|
||||
},
|
||||
"params.checkedState": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.index": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.rowData": {
|
||||
"onChange": {
|
||||
"enabled": null,
|
||||
"script": "\tself.custom.numberOfColumns \u003d len(self.params.rowData)\n\t\n\tsystem.perspective.print(\"ROW SCRIPT\")\n\tsystem.perspective.print(self.params.rowData)\n\tinstances \u003d []\n\t\n\tfor col in self.params.rowData:\n\t\tsystem.perspective.print(col)\n\t\tinstance \u003d {\n\t\t\t \"instanceStyle\": {\n\t\t\t \"classes\": \"\"\n\t\t\t },\n\t\t\t \"instancePosition\": {},\n\t\t\t \"Label\": col[0],\n\t\t\t \"Value\": col[1]\n\t\t\t }\n\t\tinstances.append(instance)\n\t\t\n\tself.getChild(\"root\").getChild(\"FlexRepeater\").props.instances \u003d instances\n\t\n\tself.custom.test \u003d instances\n"
|
||||
},
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 86,
|
||||
"width": 1220
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"custom": {
|
||||
"SelectionData": "value"
|
||||
},
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tsystem.perspective.print(self.view.params.index)\n\tmsg \u003d \"update_selectionData\"\n\tpayload \u003d {\n\t\t\"index\" : self.view.params.index,\n\t\t\"state\"\t: self.props.selected\n\t}\n\tsystem.perspective.sendMessage(msg, payload)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Checkbox"
|
||||
},
|
||||
"position": {
|
||||
"basis": "40px",
|
||||
"shrink": 0
|
||||
},
|
||||
"propConfig": {
|
||||
"props.selected": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.checkedState"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"marginRight": "2px"
|
||||
},
|
||||
"text": ""
|
||||
},
|
||||
"scripts": {
|
||||
"customMethods": [],
|
||||
"extensionFunctions": null,
|
||||
"messageHandlers": [
|
||||
{
|
||||
"messageType": "tableSelectionData",
|
||||
"pageScope": true,
|
||||
"script": "\t# implement your handler here\n\tself.custom.SelectionData \u003d payload",
|
||||
"sessionScope": false,
|
||||
"viewScope": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "ia.input.checkbox"
|
||||
},
|
||||
{
|
||||
"custom": {
|
||||
"key": {
|
||||
"backgroundColor": "#F2F3F4",
|
||||
"borderStyle": "none",
|
||||
"classes": "FadeInFast, background, background-none",
|
||||
"cursor": "pointer",
|
||||
"max-height": "400px",
|
||||
"overflow": "visible"
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "FlexRepeater"
|
||||
},
|
||||
"props": {
|
||||
"elementPosition": {
|
||||
"basis": "150px"
|
||||
},
|
||||
"instances": [
|
||||
{
|
||||
"Label": "Seq",
|
||||
"Value": 2,
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Label": "Type",
|
||||
"Value": "StateChanged",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Label": "When",
|
||||
"Value": "1670429640000",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Label": "Source",
|
||||
"Value": "PLC01/054BV55",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Label": "CurrentState",
|
||||
"Value": "",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"Label": "ReasonCode",
|
||||
"Value": "",
|
||||
"instancePosition": {},
|
||||
"instanceStyle": {
|
||||
"classes": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"path": "Main-Views/Commissioning Tool/Column",
|
||||
"style": {
|
||||
"borderBottomLeftRadius": "5px",
|
||||
"borderBottomRightRadius": "5px",
|
||||
"borderStyle": "solid",
|
||||
"borderTopLeftRadius": "5px",
|
||||
"borderTopRightRadius": "5px",
|
||||
"borderWidth": "1px",
|
||||
"margin": "2px",
|
||||
"marginRight": 5,
|
||||
"overflow": "hidden",
|
||||
"radius": "4px"
|
||||
},
|
||||
"useDefaultViewHeight": false
|
||||
},
|
||||
"type": "ia.display.flex-repeater"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tsystem.perspective.print(self.view.params.index)\n\tmsg \u003d \"measurementTab_deleteRows\"\n\tpayload \u003d {\"index\" : self.view.params.index}\n\tsystem.perspective.sendMessage(msg, payload)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Button"
|
||||
},
|
||||
"position": {
|
||||
"grow": 1
|
||||
},
|
||||
"props": {
|
||||
"image": {
|
||||
"icon": {
|
||||
"path": "material/delete_forever"
|
||||
}
|
||||
},
|
||||
"primary": false,
|
||||
"style": {
|
||||
"margin": "10 px",
|
||||
"max-height": "40px"
|
||||
},
|
||||
"text": ""
|
||||
},
|
||||
"type": "ia.input.button"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer"
|
||||
},
|
||||
"position": {
|
||||
"basis": "40px",
|
||||
"shrink": 0
|
||||
},
|
||||
"props": {
|
||||
"direction": "column",
|
||||
"justify": "center"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"borderBottomLeftRadius": "5px",
|
||||
"borderBottomRightRadius": "5px",
|
||||
"borderTopLeftRadius": "5px",
|
||||
"borderTopRightRadius": "5px",
|
||||
"classes": "FadeInFast, background, background-none",
|
||||
"margin": "5px",
|
||||
"max-height": "75px"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,656 @@
|
||||
{
|
||||
"custom": {
|
||||
"FillColour": "value",
|
||||
"alarm_message": null,
|
||||
"covert_mode": true,
|
||||
"disconnected": false,
|
||||
"display_icon": true,
|
||||
"error": false,
|
||||
"isMatch": 0,
|
||||
"plc": "value",
|
||||
"priority": 0,
|
||||
"priority_string": "No active alarms",
|
||||
"running": false,
|
||||
"running_status": 0,
|
||||
"searchId": "value",
|
||||
"show_error": false,
|
||||
"show_running": true,
|
||||
"state": 5,
|
||||
"state_string": "Unknown"
|
||||
},
|
||||
"params": {
|
||||
"forceFaultStatus": null,
|
||||
"forceRunningStatus": null,
|
||||
"tagProps": [
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value"
|
||||
]
|
||||
},
|
||||
"propConfig": {
|
||||
"custom.FillColour": {
|
||||
"persistent": true
|
||||
},
|
||||
"custom.alarm_message": {
|
||||
"persistent": true
|
||||
},
|
||||
"custom.covert_mode": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "case(\t{value},\r\n\t\t0, {session.custom.alarm_filter.show_running},\r\n\t\t1, True,\r\n\t\t2, True,\r\n\t\t3, {session.custom.alarm_filter.show_low_alarm} || {session.custom.alarm_filter.show_running},\r\n\t\t4, {session.custom.alarm_filter.show_diagnostic} || {session.custom.alarm_filter.show_running},\r\n\t\t5, {session.custom.alarm_filter.show_running},\r\n\t\tFalse)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.disconnected": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "indirect",
|
||||
"references": {
|
||||
"fc": "{session.custom.fc}",
|
||||
"plc": "{view.custom.plc}"
|
||||
},
|
||||
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{plc}/DCN"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "if(isNull({value}), False, {value})",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.display_icon": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{this.custom.covert_mode}//||{this.custom.isMatch}\u003e0"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.error": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "0 \u003c {value} \u0026\u0026 {value} \u003c 5",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.isMatch": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({view.params.tagProps[0]}\u003d\"value\",0,\nif({this.custom.searchId}\u003d{view.params.tagProps[0]},100,0))"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.plc": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.tagProps[0]"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "split({value}, \"/\")[0]",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.priority": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": 0,
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 1,
|
||||
"output": 4
|
||||
},
|
||||
{
|
||||
"input": 2,
|
||||
"output": 3
|
||||
},
|
||||
{
|
||||
"input": 3,
|
||||
"output": 2
|
||||
},
|
||||
{
|
||||
"input": 4,
|
||||
"output": 1
|
||||
}
|
||||
],
|
||||
"outputType": "scalar",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.priority_string": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "case({view.custom.state},\r\n1, \"High\",\r\n2, \"Medium\",\r\n3, \"Low\",\r\n4, \"Diagnostic\",\r\n5, \"No active alarms\",\r\n\"Unknown\")"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.running": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{view.custom.running_status} \u003d 3"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.running_status": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "indirect",
|
||||
"references": {
|
||||
"0": "{view.params.tagProps[0]}",
|
||||
"fc": "{session.custom.fc}"
|
||||
},
|
||||
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/STATE"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "coalesce({value},{view.params.forceRunningStatus},0)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.searchId": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "session.custom.searchId"
|
||||
},
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.show_error": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "case(\t{value},\r\n\t\t1, True,\r\n\t\t2, True,\r\n\t\t3, {session.custom.alarm_filter.show_low_alarm},\r\n\t\t4, {session.custom.alarm_filter.show_diagnostic},\r\n\t\tFalse)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.show_running": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "case(\t{value},\r\n\t\t1, False,\r\n\t\t2, False,\r\n\t\t{session.custom.alarm_filter.show_running}\r\n\t\t)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.state": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "indirect",
|
||||
"references": {
|
||||
"0": "{view.params.tagProps[0]}",
|
||||
"fc": "{session.custom.fc}"
|
||||
},
|
||||
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/ALARMST"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "coalesce({value},{view.params.forceFaultStatus},0)",
|
||||
"type": "expression"
|
||||
},
|
||||
{
|
||||
"fallback": null,
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 4,
|
||||
"output": 1
|
||||
},
|
||||
{
|
||||
"input": 3,
|
||||
"output": 2
|
||||
},
|
||||
{
|
||||
"input": 2,
|
||||
"output": 3
|
||||
},
|
||||
{
|
||||
"input": 1,
|
||||
"output": 4
|
||||
},
|
||||
{
|
||||
"input": 0,
|
||||
"output": 5
|
||||
}
|
||||
],
|
||||
"outputType": "scalar",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.state_string": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "case({view.custom.running_status},\r\n1, \"Faulted\",\r\n2, \"Stopped\",\r\n3, \"Running\",\r\n\"Unknown\")"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"params.forceFaultStatus": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.forceRunningStatus": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.tagProps": {
|
||||
"paramDirection": "inout",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 100,
|
||||
"width": 100
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "PPI"
|
||||
},
|
||||
"position": {
|
||||
"height": 1,
|
||||
"width": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.elements[1].elements[0].fill.paint": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "case({value},\r\n0,{session.custom.colours.state0},\r\n1,{session.custom.colours.state1},\r\n2,{session.custom.colours.state2},\r\n3,{session.custom.colours.state3},\r\n4,{session.custom.colours.state4},\r\n5,{session.custom.colours.state5},\r\n6,{session.custom.colours.state6},\r\n{session.custom.colours.fallback}\r\n)",
|
||||
"type": "expression"
|
||||
},
|
||||
{
|
||||
"expression": "if({view.custom.display_icon}\u0026\u0026 {view.custom.isMatch}\u003d0,{value},{value}+\u002700\u0027)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.style.classes": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({session.custom.colours.colour_impaired} \u003d True \u0026\u0026 {view.custom.isMatch} \u003e 0,\r\n{view.custom.state} + 100 + {view.custom.isMatch},\r\n{view.custom.state} + {view.custom.isMatch})"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": "",
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 101,
|
||||
"output": "State-Styles/State101"
|
||||
},
|
||||
{
|
||||
"input": 102,
|
||||
"output": "State-Styles/State102"
|
||||
},
|
||||
{
|
||||
"input": 103,
|
||||
"output": "State-Styles/State103"
|
||||
},
|
||||
{
|
||||
"input": 104,
|
||||
"output": "State-Styles/State104"
|
||||
},
|
||||
{
|
||||
"input": 105,
|
||||
"output": "State-Styles/State105"
|
||||
},
|
||||
{
|
||||
"input": 106,
|
||||
"output": "State-Styles/State106"
|
||||
},
|
||||
{
|
||||
"input": 201,
|
||||
"output": "State-Styles/State201"
|
||||
},
|
||||
{
|
||||
"input": 202,
|
||||
"output": "State-Styles/State202"
|
||||
},
|
||||
{
|
||||
"input": 203,
|
||||
"output": "State-Styles/State203"
|
||||
},
|
||||
{
|
||||
"input": 204,
|
||||
"output": "State-Styles/State204"
|
||||
},
|
||||
{
|
||||
"input": 205,
|
||||
"output": "State-Styles/State205"
|
||||
}
|
||||
],
|
||||
"outputType": "style-list",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"elements": [
|
||||
{
|
||||
"id": "defs1",
|
||||
"name": "defs1",
|
||||
"type": "defs"
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"cx": "6.6145835",
|
||||
"cy": "6.6145835",
|
||||
"fill": {},
|
||||
"id": "path1",
|
||||
"name": "path1",
|
||||
"r": "6.019948",
|
||||
"stroke": {
|
||||
"dasharray": "none",
|
||||
"paint": "#000000",
|
||||
"width": "0.264583"
|
||||
},
|
||||
"type": "circle"
|
||||
},
|
||||
{
|
||||
"d": "m 2.1166666,8.5242134 h 3.175",
|
||||
"fill": {
|
||||
"paint": "transparent"
|
||||
},
|
||||
"id": "path2",
|
||||
"name": "path2",
|
||||
"stroke": {
|
||||
"dasharray": "none",
|
||||
"paint": "#000000",
|
||||
"width": "0.264583"
|
||||
},
|
||||
"type": "path"
|
||||
},
|
||||
{
|
||||
"d": "M 7.9374999,8.5242134 H 11.112492",
|
||||
"fill": {
|
||||
"paint": "transparent"
|
||||
},
|
||||
"id": "path3",
|
||||
"name": "path3",
|
||||
"stroke": {
|
||||
"dasharray": "none",
|
||||
"paint": "#000000",
|
||||
"width": "0.264583"
|
||||
},
|
||||
"type": "path"
|
||||
},
|
||||
{
|
||||
"d": "M 5.1593748,4.183724 V 8.4170573",
|
||||
"fill": {
|
||||
"paint": "transparent"
|
||||
},
|
||||
"id": "path5",
|
||||
"name": "path5",
|
||||
"stroke": {
|
||||
"dasharray": "none",
|
||||
"paint": "#000000",
|
||||
"width": "0.264583"
|
||||
},
|
||||
"type": "path"
|
||||
},
|
||||
{
|
||||
"d": "m 8.2020833,4.1405926 h -3.175",
|
||||
"fill": {
|
||||
"paint": "transparent"
|
||||
},
|
||||
"id": "path6",
|
||||
"name": "path6",
|
||||
"stroke": {
|
||||
"dasharray": "none",
|
||||
"paint": "#000000",
|
||||
"width": "0.264583"
|
||||
},
|
||||
"type": "path"
|
||||
},
|
||||
{
|
||||
"d": "M 8.0697914,4.183724 V 8.4170573",
|
||||
"fill": {
|
||||
"paint": "transparent"
|
||||
},
|
||||
"id": "path7",
|
||||
"name": "path7",
|
||||
"stroke": {
|
||||
"dasharray": "none",
|
||||
"paint": "#000000",
|
||||
"width": "0.264583"
|
||||
},
|
||||
"type": "path"
|
||||
}
|
||||
],
|
||||
"id": "layer1",
|
||||
"name": "layer1",
|
||||
"type": "group"
|
||||
}
|
||||
],
|
||||
"style": {},
|
||||
"viewBox": "0 0 13.229166 13.229167"
|
||||
},
|
||||
"type": "ia.shapes.svg"
|
||||
}
|
||||
],
|
||||
"events": {
|
||||
"dom": {
|
||||
"onClick": {
|
||||
"config": {
|
||||
"script": "\tsystem.perspective.openDock(\u0027Docked-East\u0027,params\u003d{\u0027tagProps\u0027:self.view.params.tagProps})"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
},
|
||||
"onDoubleClick": {
|
||||
"config": {
|
||||
"script": "\ttagProps \u003d self.view.params.tagProps\n\tsystem.perspective.openPopup(\"StatusPopUP\", \"PopUp-Views/Controller-Equipment/Information\", params \u003d{\"tagProps\":tagProps})\n\t"
|
||||
},
|
||||
"enabled": false,
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
},
|
||||
"onMouseEnter": {
|
||||
"config": {
|
||||
"script": "\tfrom time import sleep\n\t\n\talarm \u003d []\n\tmessage \u003d None\n\t\n\tsleep(0.5)\n\t\n\tif system.tag.exists(\"System/aws_data\"):\n\t\tif self.view.params.tagProps[0] !\u003d \"\":\n\t\t\ttags_to_read \u003d system.tag.readBlocking(\"System/aws_data\")\n\t\t\tdecode_alarm_data \u003d system.util.jsonDecode(tags_to_read[0].value)\n\t\t\talarm \u003d [decode_alarm_data[i] for i in decode_alarm_data\n\t\t\t\t\tif decode_alarm_data[i][\u0027sourceId\u0027].startswith(self.view.params.tagProps[0])]\n\t\tif alarm:\n\t\t\talarm \u003d sorted(alarm, key \u003d lambda t:t[\u0027timestamp\u0027], reverse\u003dTrue)\n\t\t\tmessage \u003d max(alarm, key \u003d lambda p:p[\u0027priority\u0027]).get(\u0027message\u0027)\n\t\t\tif len(alarm) \u003e 1:\n\t\t\t\tmessage +\u003d \" (+\" + str(len(alarm)-1) + \")\"\n\tself.view.custom.alarm_message \u003d message"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "root",
|
||||
"tooltip": {
|
||||
"enabled": true,
|
||||
"location": "top-left",
|
||||
"style": {}
|
||||
}
|
||||
},
|
||||
"propConfig": {
|
||||
"meta.tooltip.style.backgroundColor": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "case({value},\r\n0,{session.custom.colours.state0},\r\n1,{session.custom.colours.state1},\r\n2,{session.custom.colours.state2},\r\n3,{session.custom.colours.state3},\r\n4,{session.custom.colours.state4},\r\n5,{session.custom.colours.state5},\r\n6,{session.custom.colours.state6},\r\n{session.custom.colours.fallback}\r\n)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"meta.tooltip.style.classes": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{view.custom.priority}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": "Alarms-Styles/NoAlarm",
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 1,
|
||||
"output": "Alarms-Styles/Diagnostic"
|
||||
},
|
||||
{
|
||||
"input": 2,
|
||||
"output": "Alarms-Styles/Low"
|
||||
},
|
||||
{
|
||||
"input": 3,
|
||||
"output": "Alarms-Styles/Medium"
|
||||
},
|
||||
{
|
||||
"input": 4,
|
||||
"output": "Alarms-Styles/High"
|
||||
}
|
||||
],
|
||||
"outputType": "style-list",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"meta.tooltip.style.color": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "if({session.custom.colours.colour_impaired},\r\n\t\u0027#000000\u0027,\r\n\tcase(\t{value},\r\n\t\t\t1,\u0027#FFFFFF\u0027,\r\n\t\t\t2,\u0027#000000\u0027,\r\n\t\t\t3,\u0027#000000\u0027,\r\n\t\t\t4,\u0027#FFFFFF\u0027,\r\n\t\t\t5,\u0027#FFFFFF\u0027,\r\n\t\t\t\u0027#000000\u0027)\r\n\t)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"meta.tooltip.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({view.custom.disconnected} \u003d False,\n\tif(isNull({view.custom.alarm_message}),\n\t\"Source Id: \" + {view.params.tagProps[0]} +\n\t\", Priority: \" + {view.custom.priority_string} +\n\t\", State: \" + {view.custom.state_string},\n\t\"Source Id: \" + {view.params.tagProps[0]} +\n\t\", Alarm: \" + {view.custom.alarm_message} +\n\t\", Priority: \" + {view.custom.priority_string} +\n\t\", State: \" + {view.custom.state_string}),\n\"Source Id: \" +{view.params.tagProps[0]} + \", Priority: Unknown, State: Unknown\")"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"props.style.classes": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.disconnected"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": "Disconnects/Device-Connected",
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": true,
|
||||
"output": "Disconnects/Device-Disconnected"
|
||||
},
|
||||
{
|
||||
"input": false,
|
||||
"output": "Disconnects/Device-Connected"
|
||||
}
|
||||
],
|
||||
"outputType": "style-list",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"aspectRatio": "1:1",
|
||||
"mode": "percent",
|
||||
"style": {
|
||||
"cursor": "pointer"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.coord"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
import datetime
|
||||
import hashlib
|
||||
import hmac
|
||||
|
||||
import boto3
|
||||
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
from urllib import quote_plus
|
||||
|
||||
|
||||
def sign(key, msg):
|
||||
return hmac.new(key, msg.encode("utf-8"), hashlib.sha256).digest()
|
||||
|
||||
|
||||
def getSignatureKey(key, dateStamp, regionName, serviceName):
|
||||
kDate = sign(("AWS4" + key).encode("utf-8"), dateStamp)
|
||||
kRegion = sign(kDate, regionName)
|
||||
kService = sign(kRegion, serviceName)
|
||||
kSigning = sign(kService, "aws4_request")
|
||||
return kSigning
|
||||
|
||||
|
||||
def build_querystring(access_key, session_key, algorithm, amz_date, credential_scope):
|
||||
query_strings = {
|
||||
"X-Amz-Algorithm": algorithm,
|
||||
"X-Amz-Credential": quote_plus(access_key + "/" + credential_scope),
|
||||
"X-Amz-Date": amz_date,
|
||||
#"X-Amz-Security-Token": quote_plus(session_key),
|
||||
"X-Amz-SignedHeaders": "host",
|
||||
}
|
||||
keys = list(query_strings.keys())
|
||||
keys.sort()
|
||||
query = []
|
||||
for key in keys:
|
||||
query.append("{}={}".format(key, query_strings[key]))
|
||||
|
||||
canonical_query_string = "&".join(
|
||||
query
|
||||
#["{}={}".format(key, value) for key, value in query_strings.items()]
|
||||
)
|
||||
return canonical_query_string
|
||||
|
||||
|
||||
def make_websocket_connection(api_id, region, stage, credentials):
|
||||
method = "GET"
|
||||
service = "execute-api"
|
||||
host = "{}.{}.{}.amazonaws.com".format(api_id, service, region)
|
||||
canonical_uri = "/{}".format(stage)
|
||||
access_key = credentials["AccessKey"]
|
||||
secret_key = credentials["SecretKey"]
|
||||
session_key = credentials["SessionKey"]
|
||||
now = datetime.datetime.utcnow()
|
||||
|
||||
amz_date = now.strftime("%Y%m%dT%H%M%SZ")
|
||||
datestamp = now.strftime("%Y%m%d")
|
||||
canonical_headers = "host:" + host + "\n"
|
||||
signed_headers = "host"
|
||||
algorithm = "AWS4-HMAC-SHA256"
|
||||
credential_scope = "/".join([datestamp, region, service, "aws4_request"])
|
||||
|
||||
canonical_querystring = build_querystring(
|
||||
access_key, session_key, algorithm, amz_date, credential_scope
|
||||
)
|
||||
payload_hash = hashlib.sha256(("").encode("utf-8")).hexdigest()
|
||||
canonical_request = "\n".join(
|
||||
[
|
||||
method,
|
||||
canonical_uri,
|
||||
"",
|
||||
#canonical_querystring,
|
||||
canonical_headers,
|
||||
signed_headers,
|
||||
payload_hash,
|
||||
]
|
||||
)
|
||||
string_to_sign = "\n".join(
|
||||
[
|
||||
algorithm,
|
||||
amz_date,
|
||||
credential_scope,
|
||||
hashlib.sha256(canonical_request.encode("utf-8")).hexdigest(),
|
||||
]
|
||||
)
|
||||
signing_key = getSignatureKey(secret_key, datestamp, region, service)
|
||||
signature = hmac.new(
|
||||
signing_key, string_to_sign.encode("utf-8"), hashlib.sha256
|
||||
).hexdigest()
|
||||
canonical_querystring += "&X-Amz-Signature=" + signature
|
||||
request_url = "wss://{}/{}".format(host, stage)
|
||||
auth_header = algorithm + " Credential=" + access_key + "/" + credential_scope + ", SignedHeaders=" + signed_headers + ", Signature=" + signature
|
||||
#print('-H "Authorization":"' + auth_header +'" -H "X-Amz-Date":"' + amz_date + '" -H "X-Amz-Security-Token":"' + session_key + '" ')
|
||||
request_headers = {
|
||||
"Authorization":auth_header,
|
||||
"X-Amz-Date": amz_date,
|
||||
"X-Amz-Security-Token": session_key
|
||||
}
|
||||
return request_url, request_headers
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 64 KiB |
@ -0,0 +1,98 @@
|
||||
{
|
||||
"custom": {},
|
||||
"params": {
|
||||
"direction": {
|
||||
"downward": false,
|
||||
"left": false,
|
||||
"right": false,
|
||||
"upward": false
|
||||
},
|
||||
"pageid": ""
|
||||
},
|
||||
"propConfig": {
|
||||
"params.direction": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.pageid": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 55,
|
||||
"width": 40
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"events": {
|
||||
"component": {
|
||||
"onActionPerformed": {
|
||||
"config": {
|
||||
"script": "\tsystem.perspective.navigate(\"/\" + self.view.params.pageid)"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "Button",
|
||||
"tooltip": {
|
||||
"enabled": true
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"basis": "45px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"meta.tooltip.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.pageid"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.align": {
|
||||
"persistent": true
|
||||
},
|
||||
"props.image.icon.path": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({view.params.direction.upward},\"material/arrow_upward\",\nif({view.params.direction.downward},\"material/arrow_downward\",\nif({view.params.direction.left},\"material/arrow_back\",\nif({view.params.direction.right},\"material/arrow_forward\",0))))"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"image": {
|
||||
"height": 55,
|
||||
"icon": {
|
||||
"color": "#000000"
|
||||
},
|
||||
"position": "center",
|
||||
"width": 40
|
||||
},
|
||||
"style": {
|
||||
"backgroundColor": "#F6F6F6"
|
||||
},
|
||||
"text": ""
|
||||
},
|
||||
"type": "ia.input.button"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"direction": "column"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
@ -0,0 +1,44 @@
|
||||
def get_state_table(active_states):
|
||||
faulted = []
|
||||
stopped = []
|
||||
running = []
|
||||
style_class = {}
|
||||
state_lookup = {1:"Faulted", 2:"Stopped", 3:"Running"}
|
||||
for i in active_states:
|
||||
source_id = i
|
||||
time_stamp = active_states[i].get("timestamp","Unknown")
|
||||
time_stamp_converted = alarms.alarm_tables.get_timestamp(time_stamp)
|
||||
state = active_states[i].get("state","Unknown")
|
||||
if time_stamp !=("Unknown"):
|
||||
duration = alarms.alarm_tables.convert(int(time_stamp))
|
||||
else:
|
||||
duration = 0
|
||||
state_list = []
|
||||
if state == 3:
|
||||
state_list = running
|
||||
style_class = {"classes":"State-Styles/State5"}
|
||||
state = state_lookup.get(state, 6)
|
||||
elif state == 2:
|
||||
state_list = stopped
|
||||
style_class = {"classes":"State-Styles/State2"}
|
||||
state = state_lookup.get(state, 6)
|
||||
elif state == 1:
|
||||
state_list = faulted
|
||||
style_class = {"classes":"State-Styles/State1"}
|
||||
state = state_lookup.get(state, 6)
|
||||
else:
|
||||
pass
|
||||
|
||||
state_row = row_builder.build_row_with_view(SourceId = source_id,
|
||||
TimeStamp = time_stamp_converted,
|
||||
Duration = duration,
|
||||
State = state,
|
||||
StyleClass = style_class )
|
||||
state_list.append(state_row)
|
||||
|
||||
return faulted + stopped + running
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 35 KiB |
@ -0,0 +1,55 @@
|
||||
{
|
||||
"custom": {},
|
||||
"params": {},
|
||||
"props": {},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "32px"
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"fontFamily": "Arial",
|
||||
"fontSize": 22,
|
||||
"fontWeight": "bold",
|
||||
"textAlign": "center"
|
||||
},
|
||||
"text": "TEMPERATURE"
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "Table"
|
||||
},
|
||||
"position": {
|
||||
"basis": "400px"
|
||||
},
|
||||
"propConfig": {
|
||||
"props.data": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "direct",
|
||||
"tagPath": "[IEC_SCADA_TAG_PROVIDER]Temperature/temperature_monitoring"
|
||||
},
|
||||
"type": "tag"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "ia.display.table"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"direction": "column"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"backgroundColor": "#008000",
|
||||
"borderColor": "#000000",
|
||||
"borderStyle": "solid",
|
||||
"borderWidth": "0.5px",
|
||||
"color": "#FFFFFF",
|
||||
"fontFamily": "Arial",
|
||||
"fontSize": "14px",
|
||||
"fontWeight": "bold",
|
||||
"textAlign": "center"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,227 @@
|
||||
{
|
||||
"custom": {},
|
||||
"params": {
|
||||
"tagProps": [
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value"
|
||||
]
|
||||
},
|
||||
"propConfig": {
|
||||
"params.tagProps": {
|
||||
"paramDirection": "inout",
|
||||
"persistent": true
|
||||
},
|
||||
"params.tagProps[0]": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.tagProps[1]": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.tagProps[2]": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.tagProps[3]": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.tagProps[4]": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.tagProps[5]": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.tagProps[6]": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.tagProps[7]": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.tagProps[8]": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.tagProps[9]": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 40,
|
||||
"width": 40
|
||||
},
|
||||
"styles": "value"
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Icon"
|
||||
},
|
||||
"position": {
|
||||
"basis": "264px"
|
||||
},
|
||||
"propConfig": {
|
||||
"meta.visible": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({parent.custom.state}\u003d1||{parent.custom.covert_mode}||{parent.custom.isMatch}\u003e0,true,false)"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"props.style.classes": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{parent.custom.ref_state}"
|
||||
},
|
||||
"overlayOptOut": true,
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": "EmergencyStop-Styles/EstopDeactivated",
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 0,
|
||||
"output": "EmergencyStop-Styles/EstopDeactivated"
|
||||
},
|
||||
{
|
||||
"input": 1,
|
||||
"output": "EmergencyStop-Styles/EstopActivated"
|
||||
},
|
||||
{
|
||||
"input": 101,
|
||||
"output": "EmergencyStop-Styles/EstopActivated101"
|
||||
},
|
||||
{
|
||||
"input": 100,
|
||||
"output": "EmergencyStop-Styles/EstopDeactivated100"
|
||||
}
|
||||
],
|
||||
"outputType": "style-list",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"path": "material/lens"
|
||||
},
|
||||
"type": "ia.display.icon"
|
||||
}
|
||||
],
|
||||
"custom": {
|
||||
"status": "value"
|
||||
},
|
||||
"events": {
|
||||
"dom": {
|
||||
"onDoubleClick": {
|
||||
"config": {
|
||||
"script": "\ttagProps \u003d self.view.params.tagProps\n\tsystem.perspective.openPopup(\"DevicePopUP\", \"PopUp-Views/Device/Information-Device\", params \u003d{\"tagProps\":tagProps},resizable \u003d 1)\n\t"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"propConfig": {
|
||||
"custom.alarm_active": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "indirect",
|
||||
"references": {
|
||||
"0": "{view.params.tagProps[0]}",
|
||||
"1": "{view.params.tagProps[1]}"
|
||||
},
|
||||
"tagPath": "{0}/Alarms/{1}.IsActive"
|
||||
},
|
||||
"type": "tag"
|
||||
}
|
||||
},
|
||||
"custom.alarm_shelved": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "indirect",
|
||||
"references": {
|
||||
"0": "{view.params.tagProps[0]}",
|
||||
"1": "{view.params.tagProps[1]}"
|
||||
},
|
||||
"tagPath": "{0}/Alarms/{1}.IsShelved"
|
||||
},
|
||||
"type": "tag"
|
||||
}
|
||||
},
|
||||
"custom.covert_mode": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "session.custom.covert"
|
||||
},
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"custom.isMatch": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({session.custom.deviceSearchId} \u003d {this.custom.search_path},1,0)"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"onChange": {
|
||||
"enabled": null,
|
||||
"script": "\tif currentValue.value \u003d\u003d 1:\n\t\tself.print(self.custom.search_path)\n\t\tself.session.custom.searchId \u003d \"\""
|
||||
},
|
||||
"persistent": false
|
||||
},
|
||||
"custom.ref_state": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({this.custom.state}\u003d1 \u0026\u0026 {this.custom.isMatch}\u003d1,101,\nif({this.custom.state}\u003d1 \u0026\u0026 {this.custom.isMatch}\u003d0,1,\nif({this.custom.state}\u003d0 \u0026\u0026 {this.custom.isMatch}\u003d1,100,0)))"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"custom.search_path": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{view.params.tagProps[0]}+\"/\"+{view.params.tagProps[1]}"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"custom.state": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({this.custom.alarm_shelved}\u003dTrue,0,\nif({this.custom.alarm_active}\u003dTrue,1,0))"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"direction": "column"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,522 @@
|
||||
{
|
||||
"custom": {
|
||||
"alarm_message": null,
|
||||
"covert_mode": true,
|
||||
"disconnected": false,
|
||||
"display_icon": true,
|
||||
"error": false,
|
||||
"isMatch": 0,
|
||||
"plc": "value",
|
||||
"priority": 0,
|
||||
"priority_string": "No active alarms",
|
||||
"running_status": 0,
|
||||
"searchId": "value",
|
||||
"state": 5,
|
||||
"state_string": "Unknown"
|
||||
},
|
||||
"params": {
|
||||
"forceFaultStatus": null,
|
||||
"forceRunningStatus": null,
|
||||
"has_state": false,
|
||||
"tagProps": [
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value",
|
||||
"value"
|
||||
]
|
||||
},
|
||||
"propConfig": {
|
||||
"custom.alarm_message": {
|
||||
"persistent": true
|
||||
},
|
||||
"custom.covert_mode": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "case(\t{value},\r\n\t\t0, {session.custom.alarm_filter.show_running},\r\n\t\t1, True,\r\n\t\t2, True,\r\n\t\t3, {session.custom.alarm_filter.show_low_alarm},\r\n\t\t4, {session.custom.alarm_filter.show_diagnostic},\r\n\t\t5, {session.custom.alarm_filter.show_running},\r\n\t\tFalse)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.disconnected": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "indirect",
|
||||
"references": {
|
||||
"fc": "{session.custom.fc}",
|
||||
"plc": "{view.custom.plc}"
|
||||
},
|
||||
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{plc}/DCN"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "if(isNull({value}), False, {value})",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.display_icon": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{this.custom.covert_mode}//||{this.custom.isMatch}\u003e0"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.error": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "0 \u003c {value} \u0026\u0026 {value} \u003c 5",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.isMatch": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({view.params.tagProps[0]}\u003d\"value\",0,\nif({this.custom.searchId}\u003d{view.params.tagProps[0]},100,0))"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.plc": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.params.tagProps[0]"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "split({value}, \"/\")[0]",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.priority": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": 0,
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 1,
|
||||
"output": 4
|
||||
},
|
||||
{
|
||||
"input": 2,
|
||||
"output": 3
|
||||
},
|
||||
{
|
||||
"input": 3,
|
||||
"output": 2
|
||||
},
|
||||
{
|
||||
"input": 4,
|
||||
"output": 1
|
||||
}
|
||||
],
|
||||
"outputType": "scalar",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.priority_string": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "case({view.custom.state},\r\n1, \"High\",\r\n2, \"Medium\",\r\n3, \"Low\",\r\n4, \"Diagnostic\",\r\n5, \"No active alarms\",\r\n\"Unknown\")"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.running_status": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "indirect",
|
||||
"references": {
|
||||
"0": "{view.params.tagProps[0]}",
|
||||
"fc": "{session.custom.fc}"
|
||||
},
|
||||
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/STATE"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "coalesce({value},{view.params.forceRunningStatus},0)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.searchId": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "session.custom.searchId"
|
||||
},
|
||||
"type": "property"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.state": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "indirect",
|
||||
"references": {
|
||||
"0": "{view.params.tagProps[0]}",
|
||||
"fc": "{session.custom.fc}"
|
||||
},
|
||||
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/ALARMST"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "coalesce({value},{view.params.forceFaultStatus},0)",
|
||||
"type": "expression"
|
||||
},
|
||||
{
|
||||
"fallback": null,
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 4,
|
||||
"output": 1
|
||||
},
|
||||
{
|
||||
"input": 3,
|
||||
"output": 2
|
||||
},
|
||||
{
|
||||
"input": 2,
|
||||
"output": 3
|
||||
},
|
||||
{
|
||||
"input": 1,
|
||||
"output": 4
|
||||
},
|
||||
{
|
||||
"input": 0,
|
||||
"output": 5
|
||||
}
|
||||
],
|
||||
"outputType": "scalar",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"custom.state_string": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "case({view.custom.running_status},\r\n1, \"Faulted\",\r\n2, \"Stopped\",\r\n3, \"Running\",\r\n\"Unknown\")"
|
||||
},
|
||||
"type": "expr"
|
||||
},
|
||||
"persistent": true
|
||||
},
|
||||
"params.forceFaultStatus": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.forceRunningStatus": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.has_state": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.tagProps": {
|
||||
"paramDirection": "inout",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 40,
|
||||
"width": 30
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Icon_0"
|
||||
},
|
||||
"position": {
|
||||
"height": 1,
|
||||
"width": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.style.backgroundColor": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "if({session.custom.colours}[\"state\"+{value}] \u003d null, \r\n{session.custom.colours}[\"Fallback\"],\r\n{session.custom.colours}[\"state\"+{value}])",
|
||||
"type": "expression"
|
||||
},
|
||||
{
|
||||
"expression": "if({view.custom.display_icon}\u0026\u0026 {view.custom.isMatch}\u003d0,{value},{value}+\u002700\u0027)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"props.style.classes": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({session.custom.colours.colour_impaired} \u003d True \u0026\u0026 {view.custom.isMatch} \u003e 0,\r\n{view.custom.state} + 100 + {view.custom.isMatch},\r\n{view.custom.state} + {view.custom.isMatch})"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": "",
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 101,
|
||||
"output": "State-Styles/State101"
|
||||
},
|
||||
{
|
||||
"input": 102,
|
||||
"output": "State-Styles/State102"
|
||||
},
|
||||
{
|
||||
"input": 103,
|
||||
"output": "State-Styles/State103"
|
||||
},
|
||||
{
|
||||
"input": 104,
|
||||
"output": "State-Styles/State104"
|
||||
},
|
||||
{
|
||||
"input": 105,
|
||||
"output": "State-Styles/State105"
|
||||
},
|
||||
{
|
||||
"input": 106,
|
||||
"output": "State-Styles/State106"
|
||||
},
|
||||
{
|
||||
"input": 201,
|
||||
"output": "State-Styles/State201"
|
||||
},
|
||||
{
|
||||
"input": 202,
|
||||
"output": "State-Styles/State202"
|
||||
},
|
||||
{
|
||||
"input": 203,
|
||||
"output": "State-Styles/State203"
|
||||
},
|
||||
{
|
||||
"input": 204,
|
||||
"output": "State-Styles/State204"
|
||||
},
|
||||
{
|
||||
"input": 205,
|
||||
"output": "State-Styles/State205"
|
||||
}
|
||||
],
|
||||
"outputType": "style-list",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"color": "#000000",
|
||||
"path": "material/offline_bolt",
|
||||
"style": {
|
||||
"borderColor": "#000000",
|
||||
"borderStyle": "solid",
|
||||
"borderWidth": "2px"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.icon"
|
||||
}
|
||||
],
|
||||
"events": {
|
||||
"dom": {
|
||||
"onClick": {
|
||||
"config": {
|
||||
"script": "\tsystem.perspective.openDock(\u0027Docked-East\u0027,params\u003d{\u0027tagProps\u0027:self.view.params.tagProps})"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
},
|
||||
"onDoubleClick": {
|
||||
"config": {
|
||||
"script": "\ttagProps \u003d self.view.params.tagProps\n\tsystem.perspective.openPopup(\"StatusPopUP\", \"PopUp-Views/Controller-Equipment/Information\", params \u003d{\"tagProps\":tagProps})\n\t"
|
||||
},
|
||||
"enabled": false,
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
},
|
||||
"onMouseEnter": {
|
||||
"config": {
|
||||
"script": "\tfrom time import sleep\n\t\n\talarm \u003d []\n\tmessage \u003d None\n\t\n\tsleep(0.5)\n\t\n\tif system.tag.exists(\"System/aws_data\"):\n\t\tif self.view.params.tagProps[0] !\u003d \"\":\n\t\t\ttags_to_read \u003d system.tag.readBlocking(\"System/aws_data\")\n\t\t\tdecode_alarm_data \u003d system.util.jsonDecode(tags_to_read[0].value)\n\t\t\talarm \u003d [decode_alarm_data[i] for i in decode_alarm_data\n\t\t\t\t\tif decode_alarm_data[i][\u0027sourceId\u0027].startswith(self.view.params.tagProps[0])]\n\t\tif alarm:\n\t\t\talarm \u003d sorted(alarm, key \u003d lambda t:t[\u0027timestamp\u0027], reverse\u003dTrue)\n\t\t\tmessage \u003d max(alarm, key \u003d lambda p:p[\u0027priority\u0027]).get(\u0027message\u0027)\n\t\t\tif len(alarm) \u003e 1:\n\t\t\t\tmessage +\u003d \" (+\" + str(len(alarm)-1) + \")\"\n\tself.view.custom.alarm_message \u003d message"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "root",
|
||||
"tooltip": {
|
||||
"enabled": true,
|
||||
"location": "top-left",
|
||||
"style": {}
|
||||
}
|
||||
},
|
||||
"propConfig": {
|
||||
"meta.tooltip.style.backgroundColor": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "case({value},\r\n0,{session.custom.colours.state0},\r\n1,{session.custom.colours.state1},\r\n2,{session.custom.colours.state2},\r\n3,{session.custom.colours.state3},\r\n4,{session.custom.colours.state4},\r\n5,{session.custom.colours.state5},\r\n6,{session.custom.colours.state6},\r\n{session.custom.colours.fallback}\r\n)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"meta.tooltip.style.classes": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "{view.custom.priority}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": "Alarms-Styles/NoAlarm",
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": 1,
|
||||
"output": "Alarms-Styles/Diagnostic"
|
||||
},
|
||||
{
|
||||
"input": 2,
|
||||
"output": "Alarms-Styles/Low"
|
||||
},
|
||||
{
|
||||
"input": 3,
|
||||
"output": "Alarms-Styles/Medium"
|
||||
},
|
||||
{
|
||||
"input": 4,
|
||||
"output": "Alarms-Styles/High"
|
||||
}
|
||||
],
|
||||
"outputType": "style-list",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"meta.tooltip.style.color": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.state"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"expression": "if({session.custom.colours.colour_impaired},\r\n\t\u0027#000000\u0027,\r\n\tcase(\t{value},\r\n\t\t\t1,\u0027#FFFFFF\u0027,\r\n\t\t\t2,\u0027#000000\u0027,\r\n\t\t\t3,\u0027#000000\u0027,\r\n\t\t\t4,\u0027#FFFFFF\u0027,\r\n\t\t\t5,\u0027#FFFFFF\u0027,\r\n\t\t\t\u0027#000000\u0027)\r\n\t)",
|
||||
"type": "expression"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
},
|
||||
"meta.tooltip.text": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "if({view.custom.disconnected} \u003d False,\n\tif(isNull({view.custom.alarm_message}),\n\t\"Source Id: \" + {view.params.tagProps[0]} +\n\t\", Priority: \" + {view.custom.priority_string} +\n\t\", State: \" + {view.custom.state_string},\n\t\"Source Id: \" + {view.params.tagProps[0]} +\n\t\", Alarm: \" + {view.custom.alarm_message} +\n\t\", Priority: \" + {view.custom.priority_string} +\n\t\", State: \" + {view.custom.state_string}),\n\"Source Id: \" +{view.params.tagProps[0]} + \", Priority: Unknown, State: Unknown\")"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
},
|
||||
"props.style.classes": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"path": "view.custom.disconnected"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"fallback": "Disconnects/Device-Connected",
|
||||
"inputType": "scalar",
|
||||
"mappings": [
|
||||
{
|
||||
"input": true,
|
||||
"output": "Disconnects/Device-Disconnected"
|
||||
},
|
||||
{
|
||||
"input": false,
|
||||
"output": "Disconnects/Device-Connected"
|
||||
}
|
||||
],
|
||||
"outputType": "style-list",
|
||||
"type": "map"
|
||||
}
|
||||
],
|
||||
"type": "property"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"aspectRatio": "40:60",
|
||||
"mode": "percent",
|
||||
"style": {
|
||||
"cursor": "pointer"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.coord"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"color": "#808080"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,237 @@
|
||||
{
|
||||
"custom": {},
|
||||
"params": {},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 1080,
|
||||
"width": 400
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"custom": {
|
||||
"selected_tag": "[BRS1_SCADA_TAG_PROVIDER]System/device_count"
|
||||
},
|
||||
"events": {
|
||||
"component": {
|
||||
"onNodeClick": {
|
||||
"config": {
|
||||
"script": "\tpath \u003d event.path\n\tinfo \u003d system.tag.getConfiguration(path)\n\ttag_type \u003d str(info[0].get(\"tagType\"))\n\tif tag_type \u003d\u003d \"AtomicTag\":\n\t\tself.custom.selected_tag \u003d path\n\telse:\n\t\tself.custom.selected_tag \u003d None"
|
||||
},
|
||||
"scope": "G",
|
||||
"type": "script"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"name": "TagBrowseTree"
|
||||
},
|
||||
"position": {
|
||||
"basis": "669px"
|
||||
},
|
||||
"propConfig": {
|
||||
"custom.tag_value": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"fallbackDelay": 2.5,
|
||||
"mode": "indirect",
|
||||
"references": {
|
||||
"selected_tag": "{this.custom.selected_tag}"
|
||||
},
|
||||
"tagPath": "{selected_tag}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"code": "\timport org.python.core.PyUnicode as uni\n\tif value \u003d\u003d None:\n\t\treturn \"N/A\"\n\t\t\n\tif isinstance(value, uni) and len(value) \u003e 50:\n\t\treturn (value[:50])\n\treturn value",
|
||||
"type": "script"
|
||||
}
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
"onChange": {
|
||||
"enabled": null,
|
||||
"script": "\tpayload \u003d {}\n\ttag_value \u003d self.custom.tag_value\n\tpayload[\"data\"] \u003d tag_value \n\tsystem.perspective.sendMessage(\"update-tag-value\", payload, scope \u003d \"view\")"
|
||||
}
|
||||
},
|
||||
"props.root.path": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "concat(\"[\",{session.custom.fc},\"_SCADA_TAG_PROVIDER]\")"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"root": {},
|
||||
"selection": {
|
||||
"mode": "single",
|
||||
"values": [
|
||||
"[BRS1_SCADA_TAG_PROVIDER]System/device_count"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "ia.display.tag-browse-tree"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Icon"
|
||||
},
|
||||
"position": {
|
||||
"basis": "32px"
|
||||
},
|
||||
"props": {
|
||||
"path": "material/local_offer",
|
||||
"style": {
|
||||
"marginLeft": "10px"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.icon"
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"name": "Label"
|
||||
},
|
||||
"position": {
|
||||
"basis": "80px"
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"textIndent": "10px"
|
||||
},
|
||||
"text": "Tag Value",
|
||||
"textStyle": {
|
||||
"fontSize": "12px",
|
||||
"fontWeight": "bold"
|
||||
}
|
||||
},
|
||||
"type": "ia.display.label"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer_0"
|
||||
},
|
||||
"position": {
|
||||
"basis": "40px"
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"borderBottomLeftRadius": "5px",
|
||||
"borderBottomRightRadius": "5px",
|
||||
"borderStyle": "none",
|
||||
"borderTopLeftRadius": "5px",
|
||||
"borderTopRightRadius": "5px",
|
||||
"marginLeft": "10px",
|
||||
"marginRight": "10px",
|
||||
"marginTop": "10px"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "Markdown"
|
||||
},
|
||||
"position": {
|
||||
"basis": "301px"
|
||||
},
|
||||
"props": {
|
||||
"source": "{}",
|
||||
"style": {
|
||||
"fontFamily": "Arial",
|
||||
"textIndent": "10px"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"customMethods": [],
|
||||
"extensionFunctions": null,
|
||||
"messageHandlers": [
|
||||
{
|
||||
"messageType": "update-tag-value",
|
||||
"pageScope": false,
|
||||
"script": "\tdata \u003d payload[\"data\"]\n\tself.props.source \u003d data",
|
||||
"sessionScope": false,
|
||||
"viewScope": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "ia.display.markdown"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer"
|
||||
},
|
||||
"position": {
|
||||
"basis": "112px"
|
||||
},
|
||||
"props": {
|
||||
"style": {
|
||||
"borderBottomLeftRadius": "5px",
|
||||
"borderBottomRightRadius": "5px",
|
||||
"borderStyle": "solid",
|
||||
"borderTopLeftRadius": "5px",
|
||||
"borderTopRightRadius": "5px",
|
||||
"margin": "10px",
|
||||
"marginLeft": "10px",
|
||||
"marginRight": "10px",
|
||||
"marginTop": "10px",
|
||||
"paddingBottom": "10px",
|
||||
"paddingLeft": "10px",
|
||||
"paddingRight": "10px",
|
||||
"paddingTop": "10px"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer"
|
||||
},
|
||||
"position": {
|
||||
"basis": "1025px"
|
||||
},
|
||||
"props": {
|
||||
"direction": "column",
|
||||
"style": {
|
||||
"borderBottomLeftRadius": "5px",
|
||||
"borderBottomRightRadius": "5px",
|
||||
"borderStyle": "solid",
|
||||
"borderTopLeftRadius": "5px",
|
||||
"borderTopRightRadius": "5px",
|
||||
"margin": "10px"
|
||||
}
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "FlexContainer"
|
||||
},
|
||||
"position": {
|
||||
"basis": "361px",
|
||||
"grow": 1
|
||||
},
|
||||
"props": {
|
||||
"direction": "column"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"direction": "column"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 22 KiB |
@ -0,0 +1,13 @@
|
||||
{
|
||||
"base": {
|
||||
"style": {
|
||||
"backgroundColor": "#FAFAFA",
|
||||
"borderColor": "#D5D5D5",
|
||||
"borderStyle": "solid",
|
||||
"borderWidth": "1px",
|
||||
"borderRadius": "4px",
|
||||
"boxShadow": "0px 2px 4px rgba(0, 0, 40, 0.15)",
|
||||
"margin": "5px"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
/* Direct stylesheet authoring is an advanced feature. Knowledge of CSS required.*/
|
||||
|
||||
.psc-x1 { transition: all .2s ease-in-out; }
|
||||
.psc-x1:hover { transform: scale(1.5) !important; z-index: 5;}
|
||||
|
||||
|
||||
.psc-x2 { transition: all .2s ease-in-out; }
|
||||
.psc-x2:hover { transform: scale(2) !important; z-index: 5;}
|
||||
|
||||
.psc-x3 { transition: all .2s ease-in-out; }
|
||||
.psc-x3:hover { transform: scale(3) !important; z-index: 5;}
|
||||
|
||||
/* Set the styling for the Table component checkbox colour.*/
|
||||
.ia_tableComponent[data-component="ia.display.table"] .ia_checkbox__checkedIcon {
|
||||
color: black;
|
||||
}
|
||||
.ia_tableComponent[data-component="ia.display.table"] .ia_checkbox__uncheckedIcon {
|
||||
color: black;
|
||||
}
|
||||
|
||||
div[data-component="ia.input.fileupload"] .ia_button--primary {
|
||||
background-color: var(--neutral-30);
|
||||
border-style: None;
|
||||
color: black;
|
||||
border-radius:20px;
|
||||
}
|
||||
|
||||
|
||||
/* Help page styles */
|
||||
|
||||
.psc-background:hover {
|
||||
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
||||
transition: box-shadow 0.9s ease-in-out;
|
||||
}
|
||||
|
||||
.psc-background-none {
|
||||
box-shadow: 0 0px 0px 0 , 0 0px 0px 0;
|
||||
transition: box-shadow 0.9s ease-in-out;
|
||||
}
|
||||
|
||||
@keyframes fadeIn{
|
||||
0% { opacity: 0; }
|
||||
100% { opacity: 1; }
|
||||
}
|
||||
|
||||
.psc-FadeInFast {
|
||||
animation: fadeIn 2s;
|
||||
}
|
||||
|
||||
.psc-FadeInMedium {
|
||||
animation: fadeIn 4s;
|
||||
}
|
||||
|
||||
.psc-Disconnects\/Device-Connected.ia_container--primary.coord-aspect-ratio.aspect-horizontal.view
|
||||
.inner-container:has(svg path[d="M 0.01621377,0.01595147 H 25.93719 V 41.138171 H 0.01621377 Z"]:only-of-type) {
|
||||
flex: 0 0 12px !important;
|
||||
}
|
||||
|
||||
.psc-Disconnects\/Device-Connected.ia_container--primary.coord-aspect-ratio.aspect-horizontal.view
|
||||
.inner-container:has(
|
||||
svg[viewBox="-0.5 -0.5 27 42"]
|
||||
path[d="m 13.785537,6.4238337 -7.0747349,-3.1261989 -0.985,1.7060701 6.2447349,4.563801 z"]
|
||||
):has(
|
||||
svg[viewBox="-0.5 -0.5 27 42"]
|
||||
path[d="m 12.141737,10.447495 -5.3573679,5.578853 1.2662916,1.509108 6.4243953,-4.30722 z"]
|
||||
) {
|
||||
flex: 0 0 16px !important;
|
||||
}
|
||||
|
||||
|
||||
.psc-FadeInSlow {
|
||||
animation: fadeIn 6s;
|
||||
}
|
||||
|
||||
@keyframes rotation {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(359deg);
|
||||
}
|
||||
}
|
||||
|
||||
.psc-rotate {
|
||||
animation: rotation 2s infinite linear;
|
||||
}
|
||||
|
After Width: | Height: | Size: 9.8 KiB |
@ -0,0 +1,59 @@
|
||||
{
|
||||
"custom": {
|
||||
"show_alarms": false
|
||||
},
|
||||
"params": {
|
||||
"customView": "",
|
||||
"plcTagPath": ""
|
||||
},
|
||||
"propConfig": {
|
||||
"custom.show_alarms": {
|
||||
"persistent": true
|
||||
},
|
||||
"params.customView": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
},
|
||||
"params.plcTagPath": {
|
||||
"paramDirection": "input",
|
||||
"persistent": true
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"defaultSize": {
|
||||
"height": 1080,
|
||||
"width": 1920
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"children": [
|
||||
{
|
||||
"meta": {
|
||||
"name": "EmbeddedView"
|
||||
},
|
||||
"position": {
|
||||
"basis": "320px",
|
||||
"grow": 1
|
||||
},
|
||||
"propConfig": {
|
||||
"props.path": {
|
||||
"binding": {
|
||||
"config": {
|
||||
"expression": "\"Custom-Views/\"+ {view.params.customView}"
|
||||
},
|
||||
"type": "expr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "ia.display.view"
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"name": "root"
|
||||
},
|
||||
"props": {
|
||||
"direction": "column"
|
||||
},
|
||||
"type": "ia.container.flex"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
import csv
|
||||
from StringIO import StringIO
|
||||
|
||||
def check_csv_file(event):
|
||||
"""
|
||||
This function checks if the CSV file was saved as CSV-UF8 settings if it has removes extra data bytes from the file.
|
||||
|
||||
Args:
|
||||
event : Containes the file data to be uploaded
|
||||
|
||||
Returns:
|
||||
a string representing the file that is to be uploaded.
|
||||
|
||||
Raises:
|
||||
None
|
||||
"""
|
||||
file_bytes = event.file.getBytes()
|
||||
if bytearray.fromhex("ef bb bf") == bytearray(file_bytes[0:3]):
|
||||
# Strip first three bytes
|
||||
file_bytes = file_bytes[3:]
|
||||
return file_bytes.tostring()
|
||||
|
||||
|
||||
def add_device_btn_code(whid, event):
|
||||
|
||||
reader = csv.DictReader(StringIO(FileHandler.uploader.check_csv_file(event)))
|
||||
data ={}
|
||||
def get_child():
|
||||
return {
|
||||
"Area":"",
|
||||
"SubArea":""
|
||||
}
|
||||
|
||||
for i, v in enumerate(reader):
|
||||
child = get_child()
|
||||
child["Area"] = v["Area"]
|
||||
child["SubArea"] = v["SubArea"]
|
||||
data[v["Device"]]= child
|
||||
|
||||
|
||||
system.tag.writeBlocking(["[%s_SCADA_TAG_PROVIDER]Configuration/PLC"%whid], system.util.jsonEncode(data))
|
||||
|
||||
return "Success"
|
||||
|
||||
def add_detailed_view_btn_code(whid, event):
|
||||
|
||||
reader = csv.DictReader(StringIO(FileHandler.uploader.check_csv_file(event)))
|
||||
|
||||
data ={}
|
||||
|
||||
def convert_dict_value_to_list(string):
|
||||
device_list = []
|
||||
for i in string.replace("#", ",").split(","):
|
||||
device_list.append(i.strip())
|
||||
return device_list
|
||||
|
||||
for v in reader:
|
||||
|
||||
data[v["DetailedView"]]= convert_dict_value_to_list(v["Devices"])
|
||||
|
||||
|
||||
system.tag.writeBlocking(["[%s_SCADA_TAG_PROVIDER]Configuration/DetailedViews"%whid], system.util.jsonEncode(data))
|
||||
|
||||
return "Success"
|
||||