asab_webui_shell 28.1.0-alpha.0 → 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,27 +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
34
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ApplicationManifestsCard, {
35
- 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
+ })
36
37
  })]
37
38
  })
38
39
  })
@@ -54,7 +55,7 @@ var _default = exports.default = AboutScreen;
54
55
  }
55
56
 
56
57
  */
57
- function AboutCard(props) {
58
+ function AboutCard() {
58
59
  const {
59
60
  t
60
61
  } = (0, _reactI18next.useTranslation)();
@@ -121,40 +122,84 @@ function ApplicationManifestsCard({
121
122
  const {
122
123
  t
123
124
  } = (0, _reactI18next.useTranslation)();
124
- const manifests = app?.Services?.ManifestService?.getAll?.() ?? [];
125
- if (manifests.length === 0) {
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()) {
126
197
  return null;
127
198
  }
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
- })]
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
159
204
  });
160
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.0",
3
+ "version": "28.1.0-alpha.2",
4
4
  "license": "BSD-3-Clause",
5
5
  "description": "TeskaLabs ASAB WebUI Shell Application",
6
6
  "contributors": [