Skip to content

Commit 79fec85

Browse files
committed
feat: added endpoint status
1 parent af725a5 commit 79fec85

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

src/main/default/lwc/apiEndpoint/apiEndpoint.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="slds-text-heading_medium slds-m-bottom_medium">{name}</div>
2+
<div class="slds-text-heading_medium slds-m-bottom_medium">{nameWithStatus}</div>
33

44
<c-formatted-error if:true={error} error={error}></c-formatted-error>
55

src/main/default/lwc/apiEndpoint/apiEndpoint.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { LightningElement, api } from 'lwc';
22

33
export default class ApiEndpoint extends LightningElement {
44
@api name;
5+
@api status;
56
@api description;
67
@api docUrlKey;
78

@@ -37,6 +38,10 @@ export default class ApiEndpoint extends LightningElement {
3738
}
3839
}
3940

41+
get nameWithStatus() {
42+
return this.status ? `${this.name} (${this.status})` : this.name;
43+
}
44+
4045
get docUrl() {
4146
return `https://developer.salesforce.com/docs/component-library/documentation/lwc/${this.docUrlKey}`;
4247
}

src/main/default/lwc/uiApiPlayground/api-definitions.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const API_DEFINITIONS = [
44
endpoints: [
55
{
66
name: 'getNavItems',
7+
status: 'Beta',
78
description:
89
'[BETA] Retrieves the items in the navigation menu.',
910
docUrlKey: 'lwc.reference_wire_adapters_get_nav_items'
@@ -32,6 +33,7 @@ const API_DEFINITIONS = [
3233
endpoints: [
3334
{
3435
name: 'getListUi',
36+
status: 'Deprecated',
3537
description:
3638
"[DEPRECATED] Use this wire adapter to get the records and metadata for a list view. Leave the 'List View API Name' field empty to retrieve all list views.",
3739
docUrlKey: 'lwc.reference_get_list_ui'
@@ -135,8 +137,9 @@ const API_DEFINITIONS = [
135137
},
136138
{
137139
name: 'getRecordUi',
140+
status: 'Deprecated',
138141
description:
139-
'Use this wire adapter to get layout information, metadata, and data to build UI for one or more records.',
142+
'[DEPRECATED] Use this wire adapter to get layout information, metadata, and data to build UI for one or more records.',
140143
docUrlKey: 'lwc.reference_wire_adapters_record'
141144
},
142145
{

src/main/default/lwc/uiApiPlayground/uiApiPlayground.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<lightning-menu-item
1717
key={endpoint.name}
1818
value={endpoint.name}
19-
label={endpoint.name}
19+
label={endpoint.label}
2020
onclick={handleMenuClick}
2121
></lightning-menu-item>
2222
</template>
@@ -28,6 +28,7 @@
2828
<template if:true={selectedEndpoint}>
2929
<c-api-endpoint
3030
name={selectedEndpoint.fullname}
31+
status={selectedEndpoint.status}
3132
description={selectedEndpoint.description}
3233
doc-url-key={selectedEndpoint.docUrlKey}
3334
>

src/main/default/lwc/uiApiPlayground/uiApiPlayground.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { LightningElement } from 'lwc';
1+
import { api, LightningElement } from 'lwc';
22
import API_DEFINITIONS from './api-definitions.js';
33

44
export default class UiApiPlayground extends LightningElement {
@@ -17,7 +17,15 @@ export default class UiApiPlayground extends LightningElement {
1717
}
1818

1919
get apiDefinitions() {
20-
return API_DEFINITIONS;
20+
return API_DEFINITIONS.map(apiCategory => {
21+
const cat = apiCategory;
22+
cat.endpoints = cat.endpoints.map(apiEndpoint => {
23+
const e = apiEndpoint;
24+
e.label = e.status ? `${e.name} (${e.status})` : e.name;
25+
return e;
26+
});
27+
return cat;
28+
});
2129
}
2230
get isGetListUi() {
2331
return this.selectedEndpoint.name === 'getListUi';

0 commit comments

Comments
 (0)