Skip to content

Commit fe86243

Browse files
committed
convert backoffice contribution guidelines
1 parent d18f157 commit fe86243

File tree

4 files changed

+41
-50
lines changed

4 files changed

+41
-50
lines changed

src/Umbraco.Web.UI.Client/.github/CONTRIBUTING.md .github/contributing-backoffice.md

+41-50
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,14 @@ In the high probability that you are porting something from angular JS then here
66

77
Here is the LIT documentation and playground: [https://lit.dev](https://lit.dev)
88

9-
### How best to find what needs converting from the old backoffice?
10-
11-
1. Navigate to [https://github.com/umbraco/Umbraco-CMS](https://github.com/umbraco/Umbraco-CMS)
12-
2. Make sure you are on the `v14/dev` branch
13-
149
### What is the process of contribution?
1510

16-
- Read the [README](README.md) to learn how to get the project up and running
17-
- Find an issue marked as [community/up-for-grabs](https://github.com/umbraco/Umbraco.CMS.Backoffice/issues?q=is%3Aissue+is%3Aopen+label%3Acommunity%2Fup-for-grabs) - note that some are also marked [good first issue](https://github.com/umbraco/Umbraco.CMS.Backoffice/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) which indicates they are simple to get started on
18-
- Umbraco HQ owns the Management API on the backend, so features can be worked on in the frontend only when there is an API, or otherwise if no API is required
19-
- A contribution should be made in a fork of the repository
20-
- Once a contribution is ready, a pull request should be made to this repository and HQ will assign a reviewer
21-
- A pull request should always indicate what part of a feature it tries to solve, i.e. does it close the targeted issue (if any) or does the developer expect Umbraco HQ to take over
11+
- Read the [README](README.md) to learn how to get the project up and running
12+
- Find an issue marked as [community/up-for-grabs](https://github.com/umbraco/Umbraco.CMS.Backoffice/issues?q=is%3Aissue+is%3Aopen+label%3Acommunity%2Fup-for-grabs) - note that some are also marked [good first issue](https://github.com/umbraco/Umbraco.CMS.Backoffice/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) which indicates they are simple to get started on
13+
- Umbraco HQ owns the Management API on the backend, so features can be worked on in the frontend only when there is an API, or otherwise if no API is required
14+
- A contribution should be made in a fork of the repository
15+
- Once a contribution is ready, a pull request should be made to this repository and HQ will assign a reviewer
16+
- A pull request should always indicate what part of a feature it tries to solve, i.e. does it close the targeted issue (if any) or does the developer expect Umbraco HQ to take over
2217

2318
## Contributing in general terms
2419

@@ -32,31 +27,27 @@ The management API is the colloquial term used to describe the new backoffice AP
3227

3328
The frontend has an API formatter that takes the OpenAPI schema file and converts it into a set of TypeScript classes and interfaces.
3429

35-
### Caveats
36-
37-
1. The backoffice can be run and tested against a real Umbraco instance by cloning down the `v14/dev` branch, but there are no guarantees about how well it works yet.
38-
3930
**Current schema for API:**
4031

41-
[https://raw.githubusercontent.com/umbraco/Umbraco-CMS/v13/dev/src/Umbraco.Cms.Api.Management/OpenApi.json](https://raw.githubusercontent.com/umbraco/Umbraco-CMS/v14/dev/src/Umbraco.Cms.Api.Management/OpenApi.json)
32+
[https://raw.githubusercontent.com/umbraco/Umbraco-CMS/v13/dev/src/Umbraco.Cms.Api.Management/OpenApi.json](https://raw.githubusercontent.com/umbraco/Umbraco-CMS/v15/dev/src/Umbraco.Cms.Api.Management/OpenApi.json)
4233

4334
**How to convert it:**
4435

45-
- Run `npm run generate:api`
36+
- Run `npm run generate:server-api`
4637

4738
## A contribution example
4839

4940
### Example: Published Cache Status Dashboard
5041

51-
![Published Status Dashboard](/.github/images/contributing/published-cache-status-dashboard.png)
42+
![Published Status Dashboard](/.github/img/contributing/published-cache-status-dashboard.png)
5243

5344
### Boilerplate (example using Lit)
5445

5546
Links for Lit examples and documentation:
5647

57-
- [https://lit.dev](https://lit.dev)
58-
- [https://lit.dev/docs/](https://lit.dev/docs/)
59-
- [https://lit.dev/playground/](https://lit.dev/playground/)
48+
- [https://lit.dev](https://lit.dev)
49+
- [https://lit.dev/docs/](https://lit.dev/docs/)
50+
- [https://lit.dev/playground/](https://lit.dev/playground/)
6051

6152
### Functionality
6253

@@ -132,58 +123,58 @@ To declare the Published Cache Status Dashboard as a new manifest, we need to ad
132123

133124
Let’s go through each of these properties…
134125

135-
- Type: can be one of the following:
126+
- Type: can be one of the following:
136127

137-
- section - examples include: `Content`, `Media`
138-
- dashboard - a view within a section. Examples include: the welcome dashboard
139-
- propertyEditorUi
140-
- editorView
141-
- propertyAction
142-
- tree
143-
- editor
144-
- treeItemAction
128+
- section - examples include: `Content`, `Media`
129+
- dashboard - a view within a section. Examples include: the welcome dashboard
130+
- propertyEditorUi
131+
- editorView
132+
- propertyAction
133+
- tree
134+
- editor
135+
- treeItemAction
145136

146-
- Alias: is the unique key used to identify this item.
147-
- Name: is the human-readable name for this item.
137+
- Alias: is the unique key used to identify this item.
138+
- Name: is the human-readable name for this item.
148139

149-
- ElementName: this is the customElementName declared on the element at the top of the file i.e
140+
- ElementName: this is the customElementName declared on the element at the top of the file i.e
150141

151142
```typescript
152143
@customElement('umb-dashboard-published-status')
153144
```
154145

155-
- Js: references a function call to import the file that the element is declared within
146+
- Js: references a function call to import the file that the element is declared within
156147

157-
- Weight: allows us to specify the order in which the dashboard will be displayed within the tabs bar
148+
- Weight: allows us to specify the order in which the dashboard will be displayed within the tabs bar
158149

159-
- Meta: allows us to reference additional data - in our case, we can specify the label that is shown in the tabs bar and the pathname that will be displayed in the URL
150+
- Meta: allows us to reference additional data - in our case, we can specify the label that is shown in the tabs bar and the pathname that will be displayed in the URL
160151

161-
- Conditions: allows us to specify the conditions that must be met for the dashboard to be displayed. In our case, we are specifying that the dashboard will only be displayed within the Settings section
152+
- Conditions: allows us to specify the conditions that must be met for the dashboard to be displayed. In our case, we are specifying that the dashboard will only be displayed within the Settings section
162153

163154
## API mock handlers
164155

165156
Running the app with `npm run dev`, you will quickly notice the API requests turn into 404 errors. To hit the API, we need to add a mock handler to define the endpoints that our dashboard will call. In the case of the Published Cache Status section, we have several calls to work through. Let’s start by looking at the call to retrieve the current status of the cache:
166157

167-
![Published Status Dashboard](/.github/images/contributing/status-of-cache.png)
158+
![Published Status Dashboard](/.github/img/contributing/status-of-cache.png)
168159

169160
From the existing functionality, we can see that this is a string message that is received as part of a `GET` request from the server.
170161

171162
So to define this, we must first add a handler for the Published Status called `published-status.handlers.ts` within the mocks/domains folder. In this file we will have code that looks like the following:
172163

173164
```typescript
174165
const { rest } = window.MockServiceWorker;
175-
import { umbracoPath } from '@umbraco-cms/backoffice/utils';
166+
import { umbracoPath } from "@umbraco-cms/backoffice/utils";
176167

177168
export const handlers = [
178-
rest.get(umbracoPath('/published-cache/status'), (_req, res, ctx) => {
179-
return res(
180-
// Respond with a 200 status code
181-
ctx.status(200),
182-
ctx.json<string>(
183-
'Database cache is ok. ContentStore contains 1 item and has 1 generation and 0 snapshot. MediaStore contains 5 items and has 1 generation and 0 snapshot.',
184-
),
185-
);
186-
}),
169+
rest.get(umbracoPath("/published-cache/status"), (_req, res, ctx) => {
170+
return res(
171+
// Respond with a 200 status code
172+
ctx.status(200),
173+
ctx.json<string>(
174+
"Database cache is ok. ContentStore contains 1 item and has 1 generation and 0 snapshot. MediaStore contains 5 items and has 1 generation and 0 snapshot."
175+
)
176+
);
177+
}),
187178
];
188179
```
189180

@@ -193,7 +184,7 @@ It returns a `200 OK` response and a string value with the current “status”
193184

194185
An example `POST` is similar. Let’s take the “Refresh status” button as an example:
195186

196-
![Published Status Dashboard](/.github/images/contributing/refresh-status.png)
187+
![Published Status Dashboard](/.github/img/contributing/refresh-status.png)
197188

198189
From our existing functionality, we can see that this makes a `POST` call to the server to prompt a reload of the published cache. So we would add a new endpoint to the mock handler that would look like:
199190

@@ -220,7 +211,7 @@ In-depth: [https://storybook.js.org/docs/web-components/get-started/introduction
220211

221212
Reference: [https://ambitious-stone-0033b3603.1.azurestaticapps.net/](https://ambitious-stone-0033b3603.1.azurestaticapps.net/)
222213

223-
- Locally: `npm run storybook`
214+
- Locally: `npm run storybook`
224215

225216
For Umbraco UI stories, please navigate to [https://uui.umbraco.com/](https://uui.umbraco.com/)
226217

0 commit comments

Comments
 (0)