Skip to content

Commit 7a47e66

Browse files
authored
Merge pull request #7040 from sarah-nic/main
Fixed some minor errors in the custom dashboard tutorials
2 parents bc71971 + ea71ec4 commit 7a47e66

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed

15/umbraco-cms/customizing/development-flow/vite-package-setup.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ For this tutorial, it is recommended to use the names given below. However, feel
3131

3232
3. When prompted:
3333
* Enter **client** as the **Project Name**.
34-
* Enter **client** as the **Package name**.
3534
* Select **Lit** as the framework.
3635
* Select **TypeScript** as the variant.
3736

@@ -46,6 +45,17 @@ npm create vite@latest client -- --template lit-ts
4645

4746
{% endhint %}
4847

48+
{% hint style="info" %}
49+
For Windows environments the command should be slightly different::
50+
51+
```typescript
52+
npm create vite@latest client --- --template lit-ts
53+
```
54+
55+
or you will still see the interactive prompts, especially when using PowerShell.
56+
57+
{% endhint %}
58+
4959
4. Navigate into the new **client** folder and install the packages:
5060

5161
```bash
@@ -146,7 +156,7 @@ Run `npm run watch` in the terminal.
146156

147157
## Umbraco Package declaration
148158

149-
Declare your package to Umbraco via a file called `umbraco-package.json`. This should be added at the root of your package. The `umbraco-package.json` file should be located at `/App_Plugins/` or `/App_Plugins/{YourPackageName}` for Umbraco to detect it.
159+
Declare your package to Umbraco via a file called `umbraco-package.json`. This should be added in the `public` folder under the root of your package. Once built the `umbraco-package.json` file should be located at `/App_Plugins/` or `/App_Plugins/{YourPackageName}` for Umbraco to detect it.
150160

151161
This example declares a Dashboard as part of your Package, using the Vite example element.
152162

15/umbraco-cms/tutorials/creating-a-custom-dashboard/README.md

+20-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ At each step, you will find a dropdown for `welcome-dashboard.element.ts`, `and
5151
## Setting up a package
5252

5353
1. Follow the [Vite Package Setup](../../customizing/development-flow/vite-package-setup.md) by creating a new project folder called "`welcome-dashboard`" in `App_Plugins`.
54-
2. Create a manifest file named `umbraco-package.json` at the root of the `welcome-dashboard` folder. Here we define and configure our dashboard.
54+
2. Create a manifest file named `umbraco-package.json` within the `public` folder, located at the root of the `welcome-dashboard` folder. Here we define and configure our dashboard.
5555
3. Add the following code to `umbraco-package.json`:
5656

5757
{% code title="umbraco-package.json" lineNumbers="true" %}
@@ -65,7 +65,7 @@ At each step, you will find a dropdown for `welcome-dashboard.element.ts`, `and
6565
"type": "dashboard",
6666
"alias": "my.welcome.dashboard",
6767
"name": "My Welcome Dashboard",
68-
"element": "/App_Plugins/welcome-dashboard/dist/welcome-dashboard.js",
68+
"element": "/App_Plugins/welcome-dashboard/welcome-dashboard.js",
6969
"elementName": "my-welcome-dashboard",
7070
"weight": 30,
7171
"meta": {
@@ -140,10 +140,26 @@ declare global {
140140
```
141141
{% endcode %}
142142

143-
3. In the `vite.config.ts` file replace the `entry` to our newly created `.ts` file:
143+
3. In the `vite.config.ts` file update the `entry` to point to our newly created `.ts` file, and also ensure that the `outDir` and `base` attributes are pointing to the `welcome-dashboard` folder:
144144

145145
```typescript
146-
entry: "src/welcome-dashboard.element.ts"
146+
import { defineConfig } from "vite";
147+
148+
export default defineConfig({
149+
build: {
150+
lib: {
151+
entry: "src/welcome-dashboard.element.ts", // your web component source file
152+
formats: ["es"],
153+
},
154+
outDir: "../App_Plugins/welcome-dashboard", // all compiled files will be placed here
155+
emptyOutDir: true,
156+
sourcemap: true,
157+
rollupOptions: {
158+
external: [/^@umbraco/], // ignore the Umbraco Backoffice package in the build
159+
},
160+
},
161+
base: "/App_Plugins/welcome-dashboard/", // the base path of the app in the browser (used for assets)
162+
});
147163
```
148164

149165
4. In the `welcome-dashboard` folder run `npm run build` and then run the project. Then in the content section of the Backoffice you will see our new dashboard:

15/umbraco-cms/tutorials/creating-a-custom-dashboard/extending-the-dashboard-using-umbraco-ui-library.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ import { UUIInterfaceColor, UUIInterfaceLook } from '@umbraco-cms/backoffice/ext
411411

412412
private _renderUser(user: UmbUserDetailModel) {
413413
if (!user) return;
414-
const state = this.getLookAndColorFromUserState(user.state);
414+
const state = this.getLookAndColorFromUserState(user.state!);
415415
return html`<uui-table-row class="user">
416416
<uui-table-cell>${user.name}</uui-table-cell>
417417
<uui-table-cell>${user.email}</uui-table-cell>

0 commit comments

Comments
 (0)