@ntlab/sipd-tu-bridge-ui 1.6.1 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/controller/ui.js CHANGED
@@ -115,6 +115,17 @@ class UiController extends Controller {
115
115
  result.pages = req.app.locals.pager(result.count, result.size, result.page);
116
116
  res.json(result);
117
117
  });
118
+ this.addRoute('capture', 'get', '/capture/:filename', async (req, res, next) => {
119
+ /** @type {import('..').SipdApi} */
120
+ const api = req.app.api;
121
+ const result = await api.getCapture(req.params.filename);
122
+ if (result.data) {
123
+ res.type('png');
124
+ res.send(result.data);
125
+ } else {
126
+ res.sendStatus(404);
127
+ }
128
+ });
118
129
  this.addRoute('task', 'post', '/task/:op', async (req, res, next) => {
119
130
  const result = {
120
131
  success: false
package/index.js CHANGED
@@ -35,7 +35,10 @@ const { Assets, CDN } = require('@ntlab/ntjs-assets');
35
35
  // register script repository
36
36
  require('@ntlab/ntjs-repo')();
37
37
 
38
- /* --- BEGIN API V1 --- */
38
+ /* --- BEGIN API V2 --- */
39
+
40
+ /* V1: 2026-03-05 */
41
+ /* V2: 2026-06-23 */
39
42
 
40
43
  /**
41
44
  * SIPD Penatausahaan Bridge main application.
@@ -52,6 +55,7 @@ require('@ntlab/ntjs-repo')();
52
55
  * @property {ActivityFunction} getActivity Get activity logs
53
56
  * @property {ObjectFunction} getCount Get activity count
54
57
  * @property {PagedObjectsFunction} getErrors Get captured errors
58
+ * @property {CaptureFileFunction} getCapture Get captured PNG file
55
59
  * @property {QueryFunction} query Perform API query
56
60
  */
57
61
 
@@ -127,6 +131,14 @@ require('@ntlab/ntjs-repo')();
127
131
  * @returns {Promise<[{name: string, seq: string, time: number}]>}
128
132
  */
129
133
 
134
+ /**
135
+ * Get captured PNG file.
136
+ *
137
+ * @callback CaptureFileFunction
138
+ * @param {string} filename Filename
139
+ * @returns {Promise<{data: Buffer}>}
140
+ */
141
+
130
142
  /* --- END API --- */
131
143
 
132
144
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ntlab/sipd-tu-bridge-ui",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "description": "SIPD Penatausahaan Bridge Web Interface",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -34,15 +34,15 @@
34
34
  "@ntlab/express-controller": "^1.3.0",
35
35
  "@ntlab/express-middleware": "^2.6.0",
36
36
  "@ntlab/ntjs": "^3.1.0",
37
- "@ntlab/ntjs-assets": "^2.144.0",
37
+ "@ntlab/ntjs-assets": "^3.28.0",
38
38
  "@ntlab/ntjs-repo": "^3.1.0",
39
39
  "@ntlab/ntlib": "^2.9.1",
40
40
  "ejs": "^3.1.10",
41
41
  "express": "^5.2.1",
42
42
  "express-session": "^1.19.0",
43
43
  "http-errors": "^2.0.1",
44
- "morgan": "^1.10.1",
44
+ "morgan": "^1.11.0",
45
45
  "session-file-store": "^1.5.0",
46
- "terser": "^5.46.0"
46
+ "terser": "^5.48.0"
47
47
  }
48
48
  }
@@ -40,7 +40,7 @@ $.error = $.loader($('div[data-tab="error"] table'), {
40
40
  $.error.toRow = function(data) {
41
41
  return $(\`
42
42
  <tr><td>\${data.nr}</td>
43
- <td>\${this.toImg($.toStr(data.image), data.filename)}</td>
43
+ <td>\${this.toImg($.toStr(data.filename), data.filename)}</td>
44
44
  <td>\${this.toPayload(data.error, '${_('Error Message')}')}</td>
45
45
  <td>\${this.toPayload(data.data, '${_('Error Data')}')}</td>
46
46
  <td>
@@ -52,7 +52,7 @@ $.error.toImg = function(data, alt) {
52
52
  if (data) {
53
53
  return \`
54
54
  <a href="#" class="err-clicker" data-op="view" data-title="\${alt}" data-tooltip="\${alt}" data-position="right center">
55
- <img class="ui medium rounded bordered image" src="\${data}" alt="\${alt}">
55
+ <img class="ui medium rounded bordered image" src="\${'${route('Ui', {name: 'capture', filename: 'FILENAME'})}'.replace(/FILENAME/, data)}" alt="\${alt}">
56
56
  </a>\`;
57
57
  }
58
58
  }