asab_webui_shell 28.0.0 → 28.1.0-alpha.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.
@@ -32,6 +32,7 @@ var _HeaderService = _interopRequireDefault(require("../services/HeaderService")
32
32
  var _ThemeService = _interopRequireDefault(require("../theme/ThemeService"));
33
33
  var _BrandingService = _interopRequireDefault(require("../services/BrandingService"));
34
34
  var _TitleService = _interopRequireDefault(require("../services/TitleService"));
35
+ var _ManifestService = _interopRequireDefault(require("../services/ManifestService"));
35
36
  var _HelpService = _interopRequireDefault(require("./Header/Help/HelpService"));
36
37
  var _AccessDeniedCard = _interopRequireDefault(require("../modules/tenant/access/AccessDeniedCard"));
37
38
  var _LoginLoopCard = require("../modules/auth/components/LoginLoopCard");
@@ -70,6 +71,7 @@ class Application extends _react.Component {
70
71
  this.ThemeService = new _ThemeService.default(this, "ThemeService");
71
72
  this.BrandingService = new _BrandingService.default(this, "BrandingService");
72
73
  this.TitleService = new _TitleService.default(this, "TitleService");
74
+ this.ManifestService = new _ManifestService.default(this, "ManifestService");
73
75
  this.HelpService = new _HelpService.default(this, "HelpService");
74
76
 
75
77
  // The application can provide a list of keys that should be automatically parsed as BigInt, when received from the server in Axios call
@@ -508,6 +510,9 @@ class Application extends _react.Component {
508
510
  }
509
511
  this.Services[service.Name] = service;
510
512
  }
513
+ registerManifest(entry) {
514
+ this.Services.ManifestService?.register(entry);
515
+ }
511
516
  locateService(name) {
512
517
  if (!name in this.Services) {
513
518
  console.warn(`Service ${name} doesn't exist.`);
@@ -31,6 +31,8 @@ function AboutScreen(props) {
31
31
  }) : null
32
32
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(AboutCard, {
33
33
  app: props.app
34
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ApplicationManifestsCard, {
35
+ app: props.app
34
36
  })]
35
37
  })
36
38
  })
@@ -52,7 +54,6 @@ var _default = exports.default = AboutScreen;
52
54
  }
53
55
 
54
56
  */
55
- // TODO: add info about version release and date of the release
56
57
  function AboutCard(props) {
57
58
  const {
58
59
  t
@@ -113,4 +114,47 @@ function AboutCard(props) {
113
114
  })]
114
115
  })]
115
116
  });
117
+ }
118
+ function ApplicationManifestsCard({
119
+ app
120
+ }) {
121
+ const {
122
+ t
123
+ } = (0, _reactI18next.useTranslation)();
124
+ const manifests = app?.Services?.ManifestService?.getAll?.() ?? [];
125
+ if (manifests.length === 0) {
126
+ return null;
127
+ }
128
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.Card, {
129
+ className: "mt-4",
130
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.CardHeader, {
131
+ className: "card-header-flex",
132
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
133
+ className: "flex-fill",
134
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
135
+ children: t('AboutCard|Application versions')
136
+ })
137
+ })
138
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
139
+ className: "list-group list-group-flush",
140
+ children: manifests.map(entry => /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
141
+ className: "list-group-item",
142
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.Row, {
143
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Col, {
144
+ className: "fw-semibold",
145
+ children: entry.displayName ?? entry.id
146
+ }), entry.version && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Col, {
147
+ children: entry.version
148
+ })]
149
+ }), entry.created_at && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.Row, {
150
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Col, {
151
+ className: "col-6",
152
+ children: t('AboutCard|Built at')
153
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Col, {
154
+ children: entry.created_at
155
+ })]
156
+ })]
157
+ }, entry.id))
158
+ })]
159
+ });
116
160
  }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _asab_webui_components = require("asab_webui_components");
8
+ /*
9
+ Registry of build-time manifests from the host and loaded microfrontends.
10
+ Each federated app registers in its Module constructor via app.registerManifest(...).
11
+ */
12
+ class ManifestService extends _asab_webui_components.Service {
13
+ constructor(app, serviceName = 'ManifestService') {
14
+ super(app, serviceName);
15
+ this._manifests = new Map();
16
+ }
17
+
18
+ /**
19
+ * @param {Object} entry
20
+ * @param {string} entry.id - Stable id (e.g. Module Federation name)
21
+ * @param {string} [entry.displayName] - Human-readable name; defaults to id
22
+ * @param {string} [entry.version] - Version / git describe tag
23
+ * @param {string} [entry.created_at] - Build time (UTC ISO)
24
+ */
25
+ register(entry) {
26
+ if (entry == null || typeof entry !== 'object') {
27
+ console.warn('ManifestService: manifest entry must be an object');
28
+ return;
29
+ }
30
+ const id = entry.id;
31
+ if (id == null || String(id).trim() === '') {
32
+ console.warn('ManifestService: manifest entry requires a non-empty id');
33
+ return;
34
+ }
35
+ const key = String(id);
36
+ const existing = this._manifests.get(key);
37
+ const displayName = entry.displayName ?? entry.name ?? existing?.displayName ?? key;
38
+ this._manifests.set(key, {
39
+ ...existing,
40
+ ...entry,
41
+ id: key,
42
+ displayName
43
+ });
44
+ }
45
+ get(id) {
46
+ if (id == null) {
47
+ return undefined;
48
+ }
49
+ return this._manifests.get(String(id));
50
+ }
51
+
52
+ /** All registered manifests, sorted by displayName then id. */
53
+ getAll() {
54
+ return [...this._manifests.values()].sort((a, b) => {
55
+ const nameCmp = String(a.displayName).localeCompare(String(b.displayName));
56
+ if (nameCmp !== 0) {
57
+ return nameCmp;
58
+ }
59
+ return String(a.id).localeCompare(String(b.id));
60
+ });
61
+ }
62
+ }
63
+ exports.default = ManifestService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asab_webui_shell",
3
- "version": "28.0.0",
3
+ "version": "28.1.0-alpha.0",
4
4
  "license": "BSD-3-Clause",
5
5
  "description": "TeskaLabs ASAB WebUI Shell Application",
6
6
  "contributors": [