demf-kpim-editor-control-panel 2.0.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/README.md ADDED
@@ -0,0 +1,352 @@
1
+ # Digital Enabler KPIM Editor Control Panel
2
+
3
+ The KPIM Editor Control Panel microfrontend manages all the steps of creating a KPI and manages the KPI itself when it is being updated or simply displayed. The KPIM Editor Control Panel works within the KPIM tool in which it is mounted, and is a the main dashboard inside the KPI Editor microfrontends.
4
+
5
+ Built with **Vue 3**, **Vuetify 3**, and **Vite**. Designed for **Single-SPA** integration.
6
+
7
+ > 📌 **See also:**
8
+ > - [Root Config integration guide](https://github.com/digital-enabler/root-config-microfrontend-vite-template)
9
+ > - [Microfrontend template documentation](https://github.com/digital-enabler/vuejs3-microfrontend-vite-template)
10
+
11
+ ---
12
+
13
+ ## 📦 Installation
14
+
15
+
16
+ ### Via CDN
17
+
18
+ This project is available from the following CDN:
19
+
20
+ ```
21
+ https://cdn.jsdelivr.net/npm/demf-kpim-editor-control-panel@latest/mf-app.js
22
+ ```
23
+
24
+ Add it to your root-config import map:
25
+
26
+ ```json
27
+ {
28
+ "imports": {
29
+ "demf-kpim-editor-control-panel": "https://cdn.jsdelivr.net/npm/demf-kpim-editor-control-panel@latest/mf-app.js"
30
+ }
31
+ }
32
+ ```
33
+
34
+ ---
35
+
36
+ ## 🚀 Quick Start
37
+
38
+ ### Prerequisites
39
+
40
+ Before you continue you need to have:
41
+
42
+ - A Digital Enabler **root-config** application running
43
+ - **Single-SPA** layout engine configured
44
+ - A configuration file for the KPIM Editor Control Panel (see below)
45
+
46
+ ### Integration Steps
47
+
48
+ **1. Add to Import Map**
49
+
50
+ In your root-config `importmap.json`:
51
+
52
+ ```json
53
+ {
54
+ "imports": {
55
+ "demf-kpim-editor-control-panel": "https://cdn.jsdelivr.net/npm/demf-kpim-editor-control-panel@latest/mf-app.js"
56
+ }
57
+ }
58
+ ```
59
+
60
+ For local development:
61
+ ```json
62
+ {
63
+ "imports": {
64
+ "demf-kpim-editor-control-panel": "http://localhost:9010/mf-app.js"
65
+ }
66
+ }
67
+ ```
68
+
69
+ **2. Register in Layout**
70
+
71
+ In your root-config layout HTML:
72
+
73
+ ```html
74
+ <application
75
+ name="demf-kpim-editor-control-panel"
76
+ props="realm, palette, kpim-editor-control-panel-config">
77
+ </application>
78
+ ```
79
+
80
+ **3. Create Configuration File**
81
+
82
+ Create a `kpim-editor-control-panel-config.json` file with these settings:
83
+
84
+ ```json
85
+ {
86
+ "name": "kpim-editor-control-panel",
87
+ "mf": "demf-kpim-editor-control-panel",
88
+ "api": "https://[generic_api_location]/api"
89
+ }
90
+ ```
91
+
92
+ This JSON file must be:
93
+ - Stored in a location accessible to the root-config
94
+ - Included in the root-config's remote configuration
95
+ - Passed as the `kpim-editor-control-panel-config` prop to the microfrontend
96
+
97
+ > 📖 For details on configuration management, see:
98
+ > - [Microfrontend Template Guide](https://github.com/digital-enabler/vuejs3-microfrontend-vite-template)
99
+ > - [Root Config Documentation](https://github.com/digital-enabler/root-config-microfrontend-vite-template)
100
+
101
+ ---
102
+
103
+ ## ⚙️ Configuration
104
+
105
+ The KPIM Editor Control Panel microfrontend receives a configuration object via the `kpim-editor-control-panel-config` prop:
106
+
107
+ ```json
108
+ {
109
+ "name": "kpim-editor-control-panel",
110
+ "mf": "demf-kpim-editor-control-panel",
111
+ "api": "https://your-api-endpoint.com/api"
112
+ }
113
+ ```
114
+
115
+ ### Configuration Fields
116
+
117
+ | Field | Type | Required | Description |
118
+ |-------|------|----------|-------------|
119
+ | `mf` | string | Yes | Microfrontend identifier (use "demf-kpim-editor-control-panel") |
120
+ | `api` | string | Yes | Base URL for API calls |
121
+
122
+ ### Additional Props from Root-Config
123
+
124
+ The microfrontend also receives these props automatically from the root-config:
125
+
126
+ - **`realm`**: Current tenant/realm identifier
127
+ - **`palette`**: Dynamic theme colors (primary, secondary, etc.)
128
+
129
+ These props are used to:
130
+ - Apply consistent theming across the platform
131
+ - Configure tenant-specific behavior
132
+ - Adapt the KPIM Editor Control Panel appearance to the current application theme
133
+
134
+ ---
135
+
136
+ ## 🛠️ Development
137
+
138
+ ### Prerequisites
139
+
140
+ Before you continue you need to have:
141
+
142
+ - [NPM](https://www.npmjs.com/) installed
143
+ - [Node.js](https://nodejs.org/) (v22+ or v24.8+) installed
144
+ - [Vue.js](https://v3.vuejs.org/) and [Vite](https://vitejs.dev/) knowledge
145
+ - A [GitHub](https://github.com/) account
146
+ - Visual Studio Code or IntelliJ IDEA as your development IDE
147
+
148
+ ### Project Management
149
+
150
+ #### Installation
151
+
152
+ Open a **Terminal** window in the project folder and go inside the `app` folder, then launch:
153
+
154
+ ```bash
155
+ npm install
156
+ ```
157
+
158
+ > **NOTE:** When install finishes, do not worry about warnings on versions and vulnerability problems reported. **DO NOT** launch `npm audit fix` or `npm audit fix --force` commands.
159
+
160
+ #### Development Server (with hot-reload)
161
+
162
+ ```bash
163
+ npm run dev
164
+ ```
165
+
166
+ This command:
167
+ 1. Generates Vuetify locales automatically (via `predev` script)
168
+ 2. Builds the microfrontend in watch mode
169
+ 3. Starts a preview server at `http://localhost:9010`
170
+
171
+ The microfrontend will be available at: `http://localhost:9010/mf-app.js`
172
+
173
+ #### Build for Production
174
+
175
+ ```bash
176
+ npm run build
177
+ ```
178
+
179
+ This command:
180
+ 1. Generates Vuetify locales automatically (via `prebuild` script)
181
+ 2. Creates an optimized production build in the `dist/` folder
182
+ 3. Outputs a SystemJS bundle ready for deployment
183
+
184
+ #### Code Quality
185
+
186
+ ```bash
187
+ npm run lint # Lint and fix files with ESLint
188
+ npm run format # Format code with Prettier
189
+ ```
190
+
191
+ > **NOTE:** Alternatively to the commands indicated above you can use the Vue UI browser interface.
192
+
193
+ ---
194
+
195
+ ## 🌐 Internationalization
196
+
197
+ The KPIM Editor Control Panel microfrontend supports multiple languages through **vue-i18n** with automatic **Vuetify locale integration**.
198
+
199
+ ### How It Works
200
+
201
+ - Locale files are stored in `src/locales/*.json` (e.g., `en.json`, `it.json`)
202
+ - The script `scripts/generate-vuetify-locales.mjs` automatically scans these files
203
+ - Matching Vuetify translations are imported and merged
204
+ - The active language is read from `localStorage.getItem('lang')` (defaults to `en`)
205
+
206
+ ### Supported Languages
207
+
208
+ The KPIM Editor Control Panel includes translations for the languages defined in `src/locales/`:
209
+ - English (`en`)
210
+ - Italian (`it`)
211
+ - [Add other languages as needed]
212
+
213
+ ### Adding a New Language
214
+
215
+ 1. Create a new file: `src/locales/<code>.json` (e.g., `es.json`)
216
+ 2. Add your translations following the existing structure
217
+ 3. Run `npm run dev` or `npm run build`
218
+ 4. The generator will automatically include Vuetify translations for that language
219
+
220
+ ---
221
+
222
+ ## 🎨 Features
223
+
224
+ - **Dynamic theming**: Automatically adapts to the palette passed from root-config
225
+ - **Multi-language support**: Full internationalization with vue-i18n
226
+ - **Responsive design**: Works seamlessly on mobile, tablet, and desktop
227
+ - **Material Design**: Built with Vuetify 3 components and Material Design Icons
228
+ - **Consistent branding**: Shows uniform KPIM Editor Control Panel across all Digital Enabler services
229
+ - **Platform information**: Displays version, copyright, and relevant links
230
+
231
+ ---
232
+
233
+ ## 📁 Project Structure
234
+
235
+ ```
236
+ demf-kpim-editor-control-panel/
237
+ ├── app/
238
+ │ ├── src/
239
+ │ │ ├── App.vue # Main component
240
+ │ │ ├── main.js # Entry point
241
+ │ │ ├── components/ # KPIM Editor Control Panel components
242
+ │ │ ├── locales/
243
+ │ │ │ ├── i18n.js # i18n configuration
244
+ │ │ │ ├── en.json # English translations
245
+ │ │ │ ├── it.json # Italian translations
246
+ │ │ │ └── vuetify-generated.js # Auto-generated Vuetify locales
247
+ │ │ ├── plugins/
248
+ │ │ │ └── vuetify.js # Vuetify configuration
249
+ │ │ ├── router/
250
+ │ │ └── store/
251
+ │ ├── scripts/
252
+ │ │ └── generate-vuetify-locales.mjs
253
+ │ ├── public/
254
+ │ ├── dist/ # Build output
255
+ │ ├── package.json
256
+ │ ├── vite.config.js
257
+ │ └── eslint.config.js
258
+ ├── docker/
259
+ └── README.md
260
+ ```
261
+
262
+ ---
263
+
264
+ ## 🔍 Troubleshooting
265
+
266
+ ### KPIM Editor Control Panel not visible
267
+
268
+ - Verify the import map includes `demf-kpim-editor-control-panel`
269
+ - Check the layout HTML has the `<application>` tag with correct name
270
+ - Ensure the bundle is accessible at the configured URL
271
+ - Look for console errors in the browser developer tools
272
+
273
+ ### Configuration not working
274
+
275
+ - Check that `kpim-editor-control-panel-config` prop is passed in the layout
276
+ - Verify the configuration JSON structure matches the expected format
277
+ - Ensure the root-config is loading the remote configuration correctly
278
+ - Check console for warnings about missing configuration
279
+
280
+ ### Styling issues
281
+
282
+ - Ensure the `palette` prop is being passed from root-config
283
+ - Verify Material Design Icons fonts are loaded
284
+ - Check that Vuetify theme configuration is correct
285
+ - Clear browser cache and reload
286
+
287
+ ### API connection errors
288
+
289
+ - Verify the `api` field in `kpim-editor-control-panel-config.json` is correct
290
+ - Check network tab for failed API requests
291
+ - Ensure CORS is properly configured on the backend
292
+ - Verify the API endpoint is accessible from the browser
293
+
294
+ ### Development server not starting
295
+
296
+ - Check that port 9001 is not already in use
297
+ - Verify Node.js version is compatible (v22+ or v24.8+)
298
+ - Try removing `node_modules` and running `npm install` again
299
+ - Ensure all dependencies are correctly installed
300
+
301
+ ---
302
+
303
+ ## 📚 Tech Stack
304
+
305
+ ### Runtime Dependencies
306
+
307
+ - **Vue 3** (^3.5.22) - Progressive JavaScript framework
308
+ - **Vuetify 3** (^3.10.7) - Material Design component library
309
+ - **Single-SPA Vue** (^3.0.1) - Single-SPA integration for Vue
310
+ - **Vue Router** (^4.6.3) - Official router for Vue.js
311
+ - **Vue i18n** (^9.14.5) - Internationalization plugin
312
+ - **Vuex** (^4.1.0) - State management
313
+ - **Axios** (^1.13.0) - HTTP client
314
+ - **Material Design Icons** (^7.4.47) - Icon library
315
+
316
+ ### Development Dependencies
317
+
318
+ - **Vite** (^7.1.12) - Next generation frontend tooling
319
+ - **ESLint** (^9.38.0) - Code linting
320
+ - **Prettier** (^3.6.2) - Code formatting
321
+ - **Vite Plugin Vue DevTools** (^8.0.3) - Vue DevTools integration
322
+ - **Concurrently** (^9.2.1) - Run multiple commands
323
+
324
+ For complete dependencies, see [`package.json`](./app/package.json).
325
+
326
+ ---
327
+
328
+ ## 📖 Related Documentation
329
+
330
+ - [Digital Enabler Root Config Template](https://github.com/digital-enabler/root-config-microfrontend-vite-template)
331
+ - [Digital Enabler Microfrontend Template](https://github.com/digital-enabler/vuejs3-microfrontend-vite-template)
332
+ - [Single-SPA Documentation](https://single-spa.js.org/)
333
+ - [Vue 3 Documentation](https://vuejs.org/)
334
+ - [Vuetify 3 Documentation](https://vuetifyjs.com/)
335
+ - [Vite Documentation](https://vitejs.dev/)
336
+
337
+ ---
338
+
339
+ ## 📄 License
340
+
341
+ This project is part of Digital Enabler Ecosystem.
342
+
343
+ © 2025 Engineering Ingegneria Informatica S.p.A.
344
+
345
+ ---
346
+
347
+ ## 🆘 Support
348
+
349
+ For support, questions, or issues:
350
+ - Open an issue on [GitHub](https://github.com/digital-enabler/demf-kpim-editor-control-panel/issues)
351
+ - Contact the Digital Enabler development team
352
+ - Check the [Digital Enabler documentation](https://github.com/digital-enabler)