-
Notifications
You must be signed in to change notification settings - Fork 8
/
FlexRealtimeStatsDashboardPlugin.js
47 lines (42 loc) · 1.32 KB
/
FlexRealtimeStatsDashboardPlugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React from "react";
import { FlexPlugin } from "flex-plugin";
import { SideLink, Actions } from "@twilio/flex-ui";
import RealTimeStatsView from "./components/realtimeStats/RealTimeStatsView";
import "./notifications/CustomNotifications";
const PLUGIN_NAME = "FlexRealtimeStatsDashboardPlugin";
export default class FlexRealtimeStatsDashboardPlugin extends FlexPlugin {
constructor() {
super(PLUGIN_NAME);
this.backendHostname = "twilio-flex-sample-backend.herokuapp.com";
}
/**
* This code is run when your plugin is being started
* Use this to modify any UI components or attach to the actions framework
*
* @param flex { typeof import('@twilio/flex-ui') }
* @param manager { import('@twilio/flex-ui').Manager }
*/
init(flex, manager) {
flex.ViewCollection.Content.add(
<flex.View name="RealTimeStatsView" key="realTimeStatsView">
<RealTimeStatsView
key="realTimeStatsViewComponent"
backendHostname={this.backendHostname}
/>
</flex.View>
);
flex.SideNav.Content.add(
<SideLink
key="RealTimeQueueStats"
icon="Data"
onClick={() =>
Actions.invokeAction("NavigateToView", {
viewName: "RealTimeStatsView"
})
}
>
Real Time Queue Stats
</SideLink>
);
}
}