changed upload datetime formater of knowledgefile and offlinemeterfile from timestamp to strftime;
parent
a2f5af089d
commit
d678ac4149
|
@ -22,7 +22,7 @@
|
||||||
<td class="text-center">{{ knowledgefile.id }}</td>
|
<td class="text-center">{{ knowledgefile.id }}</td>
|
||||||
<td class="text-center"><a href="./upload/{{knowledgefile.uuid}}" download="{{knowledgefile.file_name}}">{{ knowledgefile.file_name }}</a></td>
|
<td class="text-center"><a href="./upload/{{knowledgefile.uuid}}" download="{{knowledgefile.file_name}}">{{ knowledgefile.file_name }}</a></td>
|
||||||
<td class="text-center">{{ knowledgefile.user_display_name }}</td>
|
<td class="text-center">{{ knowledgefile.user_display_name }}</td>
|
||||||
<td class="text-center">{{ knowledgefile.upload_datetime | date:'yyyy-MM-dd HH:mm'}}</td>
|
<td class="text-center">{{ knowledgefile.upload_datetime }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<a ng-click="restoreKnowledgeFile(knowledgefile)"
|
<a ng-click="restoreKnowledgeFile(knowledgefile)"
|
||||||
class="btn btn-danger btn-rounded btn-xs">{{'SETTING.RESTORE' | translate}}</a>
|
class="btn btn-danger btn-rounded btn-xs">{{'SETTING.RESTORE' | translate}}</a>
|
||||||
|
|
|
@ -310,7 +310,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td class="text-center">{{ offlinemeterfile.status }}</td>
|
<td class="text-center">{{ offlinemeterfile.status }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
{{ offlinemeterfile.upload_datetime | date:'yyyy-MM-dd HH:mm'}}</td>
|
{{ offlinemeterfile.upload_datetime }}</td>
|
||||||
|
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<a ng-click="restoreOfflineMeterFile(offlinemeterfile)"
|
<a ng-click="restoreOfflineMeterFile(offlinemeterfile)"
|
||||||
|
|
|
@ -935,7 +935,7 @@ Result
|
||||||
| id | integer | Knowledge File ID |
|
| id | integer | Knowledge File ID |
|
||||||
| file_name | string | Knowledge File name |
|
| file_name | string | Knowledge File name |
|
||||||
| uuid | string | Knowledge File UUID |
|
| uuid | string | Knowledge File UUID |
|
||||||
| upload_datetime | float | the number of milliseconds since January 1, 1970, 00:00:00, universal time |
|
| upload_datetime | string | Upload Datetime in Local Timezone |
|
||||||
| user_display_name | string| Upload user's display name |
|
| user_display_name | string| Upload user's display name |
|
||||||
| file_object | BLOB | Knowledge File Object |
|
| file_object | BLOB | Knowledge File Object |
|
||||||
|
|
||||||
|
@ -1131,7 +1131,7 @@ Result
|
||||||
| id | integer | Offline Meter File ID |
|
| id | integer | Offline Meter File ID |
|
||||||
| file_name | string | Offline Meter File name |
|
| file_name | string | Offline Meter File name |
|
||||||
| uuid | string | Offline Meter File UUID |
|
| uuid | string | Offline Meter File UUID |
|
||||||
| upload_datetime | float | the number of milliseconds since January 1, 1970, 00:00:00, universal time |
|
| upload_datetime | string | Upload Datetime in Local Timezone |
|
||||||
| status | string | Offline Meter File processing status (new, done, error) |
|
| status | string | Offline Meter File processing status (new, done, error) |
|
||||||
| file_object | BLOB | Offline Meter File Object |
|
| file_object | BLOB | Offline Meter File Object |
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,7 @@ class CostFileItem:
|
||||||
if row is None:
|
if row is None:
|
||||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||||
description='API.COST_FILE_NOT_FOUND')
|
description='API.COST_FILE_NOT_FOUND')
|
||||||
|
|
||||||
timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6])
|
timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6])
|
||||||
if config.utc_offset[0] == '-':
|
if config.utc_offset[0] == '-':
|
||||||
timezone_offset = -timezone_offset
|
timezone_offset = -timezone_offset
|
||||||
|
|
|
@ -60,13 +60,10 @@ class KnowledgeFileCollection:
|
||||||
base64_message = base64_encoded_data.decode('utf-8')
|
base64_message = base64_encoded_data.decode('utf-8')
|
||||||
upload_datetime_local = row['upload_datetime_utc'].replace(tzinfo=None) + \
|
upload_datetime_local = row['upload_datetime_utc'].replace(tzinfo=None) + \
|
||||||
timedelta(minutes=timezone_offset)
|
timedelta(minutes=timezone_offset)
|
||||||
upload_datetime = row['upload_datetime_utc']
|
|
||||||
upload_datetime = upload_datetime.replace(tzinfo=timezone.utc)
|
|
||||||
meta_result = {"id": row['id'],
|
meta_result = {"id": row['id'],
|
||||||
"file_name": row['file_name'],
|
"file_name": row['file_name'],
|
||||||
"uuid": row['uuid'],
|
"uuid": row['uuid'],
|
||||||
"upload_datetime": upload_datetime.timestamp() * 1000,
|
"upload_datetime": upload_datetime_local.strftime('%Y-%m-%dT%H:%M:%S'),
|
||||||
"upload_datetime_local": upload_datetime_local.isoformat(),
|
|
||||||
"user_display_name": user_dict.get(row['upload_user_uuid'], None),
|
"user_display_name": user_dict.get(row['upload_user_uuid'], None),
|
||||||
"file_size_bytes": sys.getsizeof(row['file_object']),
|
"file_size_bytes": sys.getsizeof(row['file_object']),
|
||||||
"file_bytes_base64": base64_message
|
"file_bytes_base64": base64_message
|
||||||
|
@ -221,13 +218,16 @@ class KnowledgeFileItem:
|
||||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||||
description='API.KNOWLEDGE_FILE_NOT_FOUND')
|
description='API.KNOWLEDGE_FILE_NOT_FOUND')
|
||||||
|
|
||||||
upload_datetime = row[3]
|
timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6])
|
||||||
upload_datetime = upload_datetime.replace(tzinfo=timezone.utc)
|
if config.utc_offset[0] == '-':
|
||||||
|
timezone_offset = -timezone_offset
|
||||||
|
|
||||||
|
upload_datetime_local = row[3].replace(tzinfo=timezone.utc) + timedelta(minutes=timezone_offset)
|
||||||
|
|
||||||
result = {"id": row[0],
|
result = {"id": row[0],
|
||||||
"file_name": row[1],
|
"file_name": row[1],
|
||||||
"uuid": row[2],
|
"uuid": row[2],
|
||||||
"upload_datetime": upload_datetime.timestamp() * 1000,
|
"upload_datetime": upload_datetime_local.strftime('%Y-%m-%dT%H:%M:%S'),
|
||||||
"user_display_name": user_dict.get(row[4], None)}
|
"user_display_name": user_dict.get(row[4], None)}
|
||||||
resp.body = json.dumps(result)
|
resp.body = json.dumps(result)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import json
|
||||||
import mysql.connector
|
import mysql.connector
|
||||||
import config
|
import config
|
||||||
import uuid
|
import uuid
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone, timedelta
|
||||||
import os
|
import os
|
||||||
from core.userlogger import user_logger
|
from core.userlogger import user_logger
|
||||||
|
|
||||||
|
@ -31,15 +31,18 @@ class OfflineMeterFileCollection:
|
||||||
cursor.close()
|
cursor.close()
|
||||||
cnx.disconnect()
|
cnx.disconnect()
|
||||||
|
|
||||||
|
timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6])
|
||||||
|
if config.utc_offset[0] == '-':
|
||||||
|
timezone_offset = -timezone_offset
|
||||||
|
|
||||||
result = list()
|
result = list()
|
||||||
if rows is not None and len(rows) > 0:
|
if rows is not None and len(rows) > 0:
|
||||||
for row in rows:
|
for row in rows:
|
||||||
upload_datetime = row[3]
|
upload_datetime_local = row[3].replace(tzinfo=timezone.utc) + timedelta(minutes=timezone_offset)
|
||||||
upload_datetime = upload_datetime.replace(tzinfo=timezone.utc)
|
|
||||||
meta_result = {"id": row[0],
|
meta_result = {"id": row[0],
|
||||||
"file_name": row[1],
|
"file_name": row[1],
|
||||||
"uuid": row[2],
|
"uuid": row[2],
|
||||||
"upload_datetime": upload_datetime.timestamp() * 1000,
|
"upload_datetime": upload_datetime_local.strftime('%Y-%m-%dT%H:%M:%S'),
|
||||||
"status": row[4]}
|
"status": row[4]}
|
||||||
result.append(meta_result)
|
result.append(meta_result)
|
||||||
|
|
||||||
|
@ -175,13 +178,16 @@ class OfflineMeterFileItem:
|
||||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||||
description='API.OFFLINE_METER_FILE_NOT_FOUND')
|
description='API.OFFLINE_METER_FILE_NOT_FOUND')
|
||||||
|
|
||||||
upload_datetime = row[3]
|
timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6])
|
||||||
upload_datetime = upload_datetime.replace(tzinfo=timezone.utc)
|
if config.utc_offset[0] == '-':
|
||||||
|
timezone_offset = -timezone_offset
|
||||||
|
|
||||||
|
upload_datetime_local = row[3].replace(tzinfo=timezone.utc) + timedelta(minutes=timezone_offset)
|
||||||
|
|
||||||
result = {"id": row[0],
|
result = {"id": row[0],
|
||||||
"file_name": row[1],
|
"file_name": row[1],
|
||||||
"uuid": row[2],
|
"uuid": row[2],
|
||||||
"upload_datetime": upload_datetime.timestamp() * 1000,
|
"upload_datetime": upload_datetime_local.strftime('%Y-%m-%dT%H:%M:%S'),
|
||||||
"status": row[4]}
|
"status": row[4]}
|
||||||
resp.body = json.dumps(result)
|
resp.body = json.dumps(result)
|
||||||
|
|
||||||
|
|
|
@ -64,10 +64,10 @@ const KnowledgeBase = ({ setRedirect, setRedirectUrl, t }) => {
|
||||||
json.forEach((currentValue, index) => {
|
json.forEach((currentValue, index) => {
|
||||||
let report = {}
|
let report = {}
|
||||||
report['id'] = json[index]['id'];
|
report['id'] = json[index]['id'];
|
||||||
report['calendar'] = { month: json[index]['upload_datetime_local'].substring(5, 7),
|
report['calendar'] = { month: json[index]['upload_datetime'].substring(5, 7),
|
||||||
day: json[index]['upload_datetime_local'].substring(8, 10) };
|
day: json[index]['upload_datetime'].substring(8, 10) };
|
||||||
report['title'] = json[index]['file_name'];
|
report['title'] = json[index]['file_name'];
|
||||||
report['additional'] = t('Created Datetime') + ': ' + json[index]['upload_datetime_local'] + '<br/>' +
|
report['additional'] = t('Created Datetime') + ': ' + json[index]['upload_datetime'] + '<br/>' +
|
||||||
t('File Size') + ': ' + (json[index]['file_size_bytes']/(1024*1024)).toFixed(2) + ' MB';
|
t('File Size') + ': ' + (json[index]['file_size_bytes']/(1024*1024)).toFixed(2) + ' MB';
|
||||||
report['to'] = '#';
|
report['to'] = '#';
|
||||||
report['file_bytes_base64'] = json[index]['file_bytes_base64'];
|
report['file_bytes_base64'] = json[index]['file_bytes_base64'];
|
||||||
|
|
Loading…
Reference in New Issue