asab_webui_shell 28.1.0-alpha.1 → 28.1.0-alpha.2

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.
@@ -12,25 +12,28 @@ var _BrandImage = require("../../components/branding/BrandImage");
12
12
  var _reactstrap = require("reactstrap");
13
13
  var _jsxRuntime = require("react/jsx-runtime");
14
14
  function AboutScreen(props) {
15
- const [brandImage, setBrandImage] = (0, _react.useState)(undefined);
16
15
  const theme = (0, _asab_webui_components.useAppSelector)(state => state.theme);
17
- (0, _react.useEffect)(() => {
18
- setBrandImage((0, _BrandImage.getBrandImage)(props, theme));
19
- }, [theme]);
16
+ const brandImage = (0, _react.useMemo)(() => (0, _BrandImage.getBrandImage)(props, theme), [theme]);
20
17
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Container, {
21
- className: "pt-5",
18
+ className: "h-100",
22
19
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Row, {
23
- className: "justify-content-center",
20
+ className: "justify-content-center h-100 pt-4",
24
21
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.Col, {
25
22
  md: "6",
26
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
27
- className: "my-4",
28
- children: brandImage ? /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
29
- src: brandImage?.full,
23
+ className: "d-flex flex-column gap-4 h-100 min-vh-0",
24
+ children: [brandImage && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
25
+ style: {
26
+ height: '8rem'
27
+ },
28
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
29
+ src: brandImage.full,
30
30
  alt: "TeskaLabs logo"
31
- }) : null
32
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(AboutCard, {
33
- app: props.app
31
+ })
32
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(AboutCard, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
33
+ className: "flex-grow-1",
34
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ApplicationManifestsCard, {
35
+ app: props.app
36
+ })
34
37
  })]
35
38
  })
36
39
  })
@@ -52,9 +55,7 @@ var _default = exports.default = AboutScreen;
52
55
  }
53
56
 
54
57
  */
55
- function AboutCard({
56
- app
57
- }) {
58
+ function AboutCard() {
58
59
  const {
59
60
  t
60
61
  } = (0, _reactI18next.useTranslation)();
@@ -62,7 +63,6 @@ function AboutCard({
62
63
  const vendor = (0, _asab_webui_components.useAppSelector)(state => state.config?.vendor);
63
64
  const website = (0, _asab_webui_components.useAppSelector)(state => state.config?.website);
64
65
  const email = (0, _asab_webui_components.useAppSelector)(state => state.config?.email);
65
- const manifests = app?.Services?.ManifestService?.getAll?.() ?? [];
66
66
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.Card, {
67
67
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.CardHeader, {
68
68
  className: "card-header-flex",
@@ -112,30 +112,94 @@ function AboutCard({
112
112
  })
113
113
  })]
114
114
  })
115
- }), manifests.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
116
- className: "list-group-item",
117
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h5", {
118
- className: "py-2 mb-0",
119
- children: t('AboutCard|Application versions')
120
- })
121
- }), manifests.map(entry => /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
122
- className: "list-group-item",
123
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.Row, {
124
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Col, {
125
- className: "fw-semibold",
126
- children: entry.displayName ?? entry.id
127
- }), entry.version && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Col, {
128
- children: entry.version
129
- })]
130
- }), entry.created_at && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.Row, {
131
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Col, {
132
- className: "col-6",
133
- children: t('AboutCard|Built at')
134
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Col, {
135
- children: entry.created_at
136
- })]
137
- })]
138
- }, entry.id))]
115
+ })]
139
116
  })]
140
117
  });
118
+ }
119
+ function ApplicationManifestsCard({
120
+ app
121
+ }) {
122
+ const {
123
+ t
124
+ } = (0, _reactI18next.useTranslation)();
125
+ const manifestService = app?.Services?.ManifestService;
126
+ const loader = async ({
127
+ params
128
+ }) => {
129
+ const {
130
+ count,
131
+ data
132
+ } = manifestService?.list?.(params) ?? {
133
+ count: 0,
134
+ data: []
135
+ };
136
+ return {
137
+ count,
138
+ rows: data
139
+ };
140
+ };
141
+ const columns = [{
142
+ title: t('General|Name'),
143
+ tdStyle: {
144
+ width: '8rem',
145
+ maxWidth: '12rem'
146
+ },
147
+ render: ({
148
+ row
149
+ }) => {
150
+ const label = row.displayName ?? row.id;
151
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
152
+ className: "fw-semibold d-block text-truncate",
153
+ title: label,
154
+ children: label
155
+ });
156
+ }
157
+ }, {
158
+ title: t('AboutCard|Tag'),
159
+ tdStyle: {
160
+ width: '8rem',
161
+ maxWidth: '12rem'
162
+ },
163
+ render: ({
164
+ row
165
+ }) => {
166
+ const tag = row.version ?? '';
167
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
168
+ className: "d-block text-truncate",
169
+ title: tag,
170
+ children: tag
171
+ });
172
+ }
173
+ }, {
174
+ title: t('AboutCard|Built at'),
175
+ tdStyle: {
176
+ width: '8rem',
177
+ maxWidth: '12rem'
178
+ },
179
+ render: ({
180
+ row
181
+ }) => {
182
+ const builtAt = row.created_at ?? '';
183
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
184
+ className: "d-block text-truncate",
185
+ title: builtAt,
186
+ children: builtAt
187
+ });
188
+ }
189
+ }];
190
+ const Header = () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
191
+ className: "flex-fill",
192
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
193
+ children: t('AboutCard|Application versions')
194
+ })
195
+ });
196
+ if (!manifestService || manifestService.isEmpty()) {
197
+ return null;
198
+ }
199
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_asab_webui_components.DataTableCard2, {
200
+ columns: columns,
201
+ loader: loader,
202
+ header: /*#__PURE__*/(0, _jsxRuntime.jsx)(Header, {}),
203
+ disableParams: true
204
+ });
141
205
  }
@@ -14,43 +14,38 @@ class ManifestService extends _asab_webui_components.Service {
14
14
  super(app, serviceName);
15
15
  this._manifests = new Map();
16
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
17
  register(entry) {
26
18
  if (entry == null || typeof entry !== 'object') {
27
19
  console.warn('ManifestService: manifest entry must be an object');
28
20
  return;
29
21
  }
30
- const id = entry.id;
31
- if (id == null || String(id).trim() === '') {
22
+ const manifestId = String(entry.id ?? '').trim();
23
+ if (!manifestId) {
32
24
  console.warn('ManifestService: manifest entry requires a non-empty id');
33
25
  return;
34
26
  }
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,
27
+ this._manifests.set(manifestId, {
40
28
  ...entry,
41
- id: key,
42
- displayName
29
+ id: manifestId,
30
+ displayName: entry.displayName ?? manifestId
43
31
  });
44
32
  }
45
- get(id) {
46
- if (id == null) {
47
- return undefined;
48
- }
49
- return this._manifests.get(String(id));
33
+ isEmpty() {
34
+ return this._manifests.size === 0;
50
35
  }
51
36
 
52
- /** All registered manifests, sorted by displayName then id. */
53
- getAll() {
37
+ /** Paginated list for DataTable loaders (`p` = page, `i` = limit per page). */
38
+ list(params = {}) {
39
+ const all = this._getSortedManifests();
40
+ const page = Math.max(1, parseInt(params.p, 10) || 1);
41
+ const limit = Math.max(1, parseInt(params.i, 10) || 10);
42
+ const start = (page - 1) * limit;
43
+ return {
44
+ count: all.length,
45
+ data: all.slice(start, start + limit)
46
+ };
47
+ }
48
+ _getSortedManifests() {
54
49
  return [...this._manifests.values()].sort((a, b) => {
55
50
  const nameCmp = String(a.displayName).localeCompare(String(b.displayName));
56
51
  if (nameCmp !== 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asab_webui_shell",
3
- "version": "28.1.0-alpha.1",
3
+ "version": "28.1.0-alpha.2",
4
4
  "license": "BSD-3-Clause",
5
5
  "description": "TeskaLabs ASAB WebUI Shell Application",
6
6
  "contributors": [