Skip to content

Commit 1c3a884

Browse files
committed
SiliconLabsGH-43: Updated User Credential implementation
Forwarded: SiliconLabs#43 Bug-SiliconLabs: UIC-3222 Bug-Github: SiliconLabs#43 Integration of commits until : 5664a2147a2c94bdf223ea89076e4ea036d92cca Add following commits : 4a515ed86efd401d1212ab7974327ed82e973321 e0ea8149a0bf3ef5c69bf9dd2aa9206352d7eea5 d0049b2c28c0b98050ea0201e800a904a9c66df6
1 parent cf9a4fc commit 1c3a884

33 files changed

+10508
-4393
lines changed

applications/dev_ui/dev_gui/src/App.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,23 @@ class App extends Component<{}, AppState> {
149149
this.setState({ CommissionableDevices: list });
150150
}
151151

152+
handleEvents(data: any) {
153+
var toastType = toast.TYPE.DEFAULT;
154+
switch (data.level) {
155+
case 1:
156+
toastType = toast.TYPE.INFO;
157+
break;
158+
case 2:
159+
toastType = toast.TYPE.WARNING;
160+
break;
161+
case 3:
162+
case 4:
163+
toastType = toast.TYPE.ERROR;
164+
break;
165+
}
166+
toast(data.message, { type: toastType })
167+
}
168+
152169
handleUPTIChange(list: any[]) {
153170
let upti = this.state.UPTI;
154171
upti.List = list;
@@ -414,6 +431,9 @@ class App extends Component<{}, AppState> {
414431
case "commissionable-device":
415432
this.handleCommissionableDevices(mes.data);
416433
break;
434+
case "event":
435+
this.handleEvents(mes.data);
436+
break;
417437
}
418438
}
419439

applications/dev_ui/dev_gui/src/dev-gui-api/handler.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,20 @@ exports.processSmartStart = (topic, message) => {
4040
}
4141
}
4242

43+
exports.processEvent = (topic, message) => {
44+
console.log(`Received Event : '${message}'`);
45+
if (message.toString() == "")
46+
return;
47+
try {
48+
return {
49+
type: "event",
50+
data: JSON.parse(message)
51+
};
52+
} catch (error) {
53+
return getErrorResponse(topic, message, error);
54+
}
55+
}
56+
4357
exports.processCluster = (topic, message) => {
4458
let index = -1;
4559
let match = topic.match(/ucl\/by-unid\/(.*)\/(ep\d+)\/(.*)/)

applications/dev_ui/dev_gui/src/dev-gui-api/main.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ let topics = ["ucl/SmartStart/List",
3333
"ucl/UPTICap/#",
3434
"ucl/by-machine-id/+/SystemMetrics/SupportedCommands",
3535
"ucl/by-machine-id/+/SystemMetrics/Attributes/#",
36-
"ucl/by-mqtt-client/+/ApplicationMonitoring/Attributes/#"
36+
"ucl/by-mqtt-client/+/ApplicationMonitoring/Attributes/#",
37+
"ucl/Event"
3738
];
3839
Object.keys(supportedClusters).forEach((i) => {
3940
topics.push(`ucl/by-unid/+/+/${i}/SupportedCommands`);
@@ -282,6 +283,8 @@ function onMqttMessage(topic, message) {
282283
response = handler.processAppMonitoringList(topic, message);
283284
} else if (topic.match(/ucl\/SmartStart\/CommissionableDevice\/(.*)/)) {
284285
response = handler.processCommissionableDevices(topic, message);
286+
} else if (topic === "ucl/Event") {
287+
response = handler.processEvent(topic, message);
285288
}
286289
if (response && Object.keys(response).length > 0)
287290
handler.addToQueue(response.type, response.data);

applications/dev_ui/dev_gui/src/pages/user-credential/user-credential.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ export class UserCredential extends React.Component<UserCredentialProps, UserCre
224224
<th>Supported User Types</th>
225225
<th>Supported Credential Types</th>
226226
<th>Supported Credential Rules</th>
227+
<th>Admin PIN Code</th>
227228
<th>Supported Commands</th>
228229
</tr>
229230
</thead>
@@ -251,6 +252,13 @@ export class UserCredential extends React.Component<UserCredentialProps, UserCre
251252
<td>{this.getBadges(item.UserCredential?.SupportedUserTypes?.Reported)}</td>
252253
<td>{this.getSupportedCredentialType(item.UserCredential?.SupportedCredentialTypes?.Reported, item.UserCredential?.Credentials)}</td>
253254
<td>{this.getBadges(item.UserCredential?.SupportedCredentialRules?.Reported)}</td>
255+
<td>{(item.UserCredential?.SupportAdminPinCode?.Reported) ?
256+
<Tooltip key={index} title={"Deactivation supported : " + item.UserCredential?.SupportAdminPinCodeDeactivation?.Reported}>
257+
<span>{item.UserCredential?.AdminPinCode?.Reported}</span>
258+
</Tooltip>
259+
: <RiIcons.RiCloseCircleFill color="red"/>
260+
}
261+
</td>
254262
<td className="float-left">
255263
{commands && commands.length
256264
? <DropdownButton menuAlign={'right'} variant="outline-primary" title="Commands" className="float-right" disabled={isOffline} size="sm">

0 commit comments

Comments
 (0)