@pb33f/cowboy-components 0.5.8 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/kv-view/kv-view.css.js +6 -0
- package/dist/components/kv-view/kv-view.d.ts +3 -0
- package/dist/components/kv-view/kv-view.js +23 -9
- package/dist/components/rodeo/rodeo.css.js +1 -0
- package/dist/components/rodeo/rodeo.d.ts +20 -0
- package/dist/components/rodeo/rodeo.js +124 -4
- package/dist/components/rodeo/roundup.css.d.ts +2 -0
- package/dist/components/rodeo/roundup.css.js +16 -0
- package/dist/components/rodeo/roundup.d.ts +17 -1
- package/dist/components/rodeo/roundup.js +83 -5
- package/dist/components/rodeo/statistic.css.d.ts +2 -0
- package/dist/components/rodeo/statistic.css.js +69 -0
- package/dist/components/rodeo/statistic.d.ts +10 -0
- package/dist/components/rodeo/statistic.js +59 -0
- package/dist/components/terminal-emulator/terminal-emulator.css.d.ts +2 -0
- package/dist/components/terminal-emulator/terminal-emulator.css.js +197 -0
- package/dist/components/terminal-emulator/terminal-emulator.d.ts +21 -0
- package/dist/components/terminal-emulator/terminal-emulator.js +95 -0
- package/dist/components/the-doctor/the-doctor.d.ts +1 -2
- package/dist/components/the-doctor/the-doctor.js +99 -94
- package/dist/controllers/auth.d.ts +8 -2
- package/dist/controllers/auth.js +55 -4
- package/dist/cowboy-components.umd.cjs +280 -274
- package/dist/model/channels.d.ts +3 -0
- package/dist/model/channels.js +4 -0
- package/dist/model/platform-events.d.ts +13 -0
- package/dist/model/platform-events.js +7 -0
- package/dist/model/roundup-stats.d.ts +10 -0
- package/dist/model/roundup-stats.js +1 -0
- package/dist/services/linting-service.js +1 -0
- package/dist/services/rodeo-service.d.ts +5 -0
- package/dist/services/rodeo-service.js +29 -0
- package/package.json +1 -1
|
@@ -4,7 +4,10 @@ export declare class KVViewComponent extends LitElement {
|
|
|
4
4
|
static styles: import("lit").CSSResult[];
|
|
5
5
|
keyLabel: string;
|
|
6
6
|
valueLabel: string;
|
|
7
|
+
showHeader: boolean;
|
|
8
|
+
tiny: boolean;
|
|
7
9
|
private _data;
|
|
10
|
+
renderStream: HTMLDivElement;
|
|
8
11
|
constructor();
|
|
9
12
|
set data(value: Map<string, any>);
|
|
10
13
|
render(): TemplateResult<1>;
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { customElement, state, property } from "lit/decorators.js";
|
|
7
|
+
import { customElement, state, property, query } from "lit/decorators.js";
|
|
8
8
|
import { map } from "lit/directives/map.js";
|
|
9
9
|
import { LitElement } from "lit";
|
|
10
10
|
import { html } from "lit";
|
|
@@ -24,6 +24,8 @@ let KVViewComponent = class KVViewComponent extends LitElement {
|
|
|
24
24
|
this._data = new Map();
|
|
25
25
|
this.keyLabel = 'Key';
|
|
26
26
|
this.valueLabel = 'Value';
|
|
27
|
+
this.showHeader = true;
|
|
28
|
+
this.tiny = false;
|
|
27
29
|
}
|
|
28
30
|
set data(value) {
|
|
29
31
|
if (value && value.size > 0) {
|
|
@@ -35,11 +37,14 @@ let KVViewComponent = class KVViewComponent extends LitElement {
|
|
|
35
37
|
if (this._data) {
|
|
36
38
|
headerData = html `
|
|
37
39
|
${map(this._data, (i) => {
|
|
40
|
+
if (!i[1] || i[1] == '') {
|
|
41
|
+
return html ``;
|
|
42
|
+
}
|
|
38
43
|
if (typeof i[1] === 'object') {
|
|
39
44
|
return html `
|
|
40
45
|
<tr>
|
|
41
|
-
<td><code>${i[0]}</code></td>
|
|
42
|
-
<td>
|
|
46
|
+
<td class="${this.tiny ? 'tiny' : null}"><code>${i[0]}</code></td>
|
|
47
|
+
<td class="${this.tiny ? 'tiny' : null}">
|
|
43
48
|
<pre style=""><code class="no-box" style="white-space: pre-wrap; word-wrap: break-word;">${unsafeHTML(Prism.highlight(JSON.stringify(i[1], null, 2), Prism.languages['json'], 'json'))}</pre></code>
|
|
44
49
|
</td>
|
|
45
50
|
</tr>`;
|
|
@@ -47,14 +52,14 @@ let KVViewComponent = class KVViewComponent extends LitElement {
|
|
|
47
52
|
if (typeof i[1] === 'number') {
|
|
48
53
|
return html `
|
|
49
54
|
<tr>
|
|
50
|
-
<td><code>${i[0]}</code></td>
|
|
51
|
-
<td>${i[1]}</td>
|
|
55
|
+
<td class="${this.tiny ? 'tiny' : null}"><code>${i[0]}</code></td>
|
|
56
|
+
<td class="${this.tiny ? 'tiny' : null}">${i[1]}</td>
|
|
52
57
|
</tr>`;
|
|
53
58
|
}
|
|
54
59
|
return html `
|
|
55
60
|
<tr>
|
|
56
|
-
<td><code>${i[0]}</code></td>
|
|
57
|
-
<td>${unsafeHTML(i[1].toString())}</td>
|
|
61
|
+
<td class="${this.tiny ? 'tiny' : null}"><code>${i[0]}</code></td>
|
|
62
|
+
<td class="${this.tiny ? 'tiny' : null}">${unsafeHTML(i[1].toString())}</td>
|
|
58
63
|
</tr>`;
|
|
59
64
|
})}
|
|
60
65
|
`;
|
|
@@ -77,9 +82,9 @@ let KVViewComponent = class KVViewComponent extends LitElement {
|
|
|
77
82
|
}
|
|
78
83
|
const table = html `
|
|
79
84
|
|
|
80
|
-
<div class="kv-table">
|
|
85
|
+
<div class="kv-table ${this.tiny ? 'tiny' : null}">
|
|
81
86
|
<table>
|
|
82
|
-
${header}
|
|
87
|
+
${this.showHeader ? header : null}
|
|
83
88
|
<tbody>
|
|
84
89
|
${headerData}
|
|
85
90
|
</tbody>
|
|
@@ -97,9 +102,18 @@ __decorate([
|
|
|
97
102
|
__decorate([
|
|
98
103
|
property()
|
|
99
104
|
], KVViewComponent.prototype, "valueLabel", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
property({ type: Boolean })
|
|
107
|
+
], KVViewComponent.prototype, "showHeader", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
property({ type: Boolean })
|
|
110
|
+
], KVViewComponent.prototype, "tiny", void 0);
|
|
100
111
|
__decorate([
|
|
101
112
|
state()
|
|
102
113
|
], KVViewComponent.prototype, "_data", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
query('.render-stream')
|
|
116
|
+
], KVViewComponent.prototype, "renderStream", void 0);
|
|
103
117
|
KVViewComponent = __decorate([
|
|
104
118
|
customElement('pb33f-kv-view')
|
|
105
119
|
], KVViewComponent);
|
|
@@ -2,9 +2,29 @@ import { LitElement } from "lit";
|
|
|
2
2
|
import './rodeo-nav.js';
|
|
3
3
|
import './roundup.ts';
|
|
4
4
|
import './users.ts';
|
|
5
|
+
import { BusCallback, CommandResponse } from "@pb33f/ranch";
|
|
6
|
+
import { PlatformEvent } from "../../model/platform-events";
|
|
5
7
|
export declare class Rodeo extends LitElement {
|
|
6
8
|
static styles: import("lit").CSSResult[];
|
|
9
|
+
private readonly bus;
|
|
10
|
+
private readonly doctorServiceChannel;
|
|
11
|
+
private readonly rodeoServiceChannel;
|
|
12
|
+
private rodeoChannelSubscription;
|
|
13
|
+
private doctorChannelSubscription;
|
|
14
|
+
private brokerConnectionId;
|
|
15
|
+
private readonly busPort;
|
|
16
|
+
private readonly busHost;
|
|
17
|
+
private readonly busVersion;
|
|
18
|
+
private readonly useTLS;
|
|
19
|
+
private readonly endpoint;
|
|
20
|
+
private authController;
|
|
21
|
+
private roundupComponent;
|
|
7
22
|
constructor();
|
|
23
|
+
protected connectToBroker(): void;
|
|
24
|
+
whoAmI(): void;
|
|
8
25
|
firstUpdated(): void;
|
|
9
26
|
render(): import("lit-html").TemplateResult<1>;
|
|
27
|
+
handlePlatformEvent(evt: PlatformEvent): void;
|
|
28
|
+
rodeoServiceStream(): BusCallback<CommandResponse>;
|
|
29
|
+
doctorServiceHandler(): BusCallback<CommandResponse>;
|
|
10
30
|
}
|
|
@@ -12,27 +12,147 @@ import { Router } from '@vaadin/router';
|
|
|
12
12
|
import './rodeo-nav.js';
|
|
13
13
|
import './roundup.ts';
|
|
14
14
|
import './users.ts';
|
|
15
|
+
import { CreateBus } from "@pb33f/ranch";
|
|
16
|
+
import { Command, DoctorServiceChannel, isBrokerResponse, QueuePrefix, TopicPrefix, RodeoServiceChannel, isPlatformEvent } from "../../model/channels";
|
|
17
|
+
import { LintingService } from "../../services/linting-service";
|
|
18
|
+
import { AuthController } from "../../controllers/auth";
|
|
19
|
+
import { RodeoService } from "../../services/rodeo-service";
|
|
20
|
+
import { RodeoRoundup } from "./roundup";
|
|
21
|
+
import { PlatformEventType } from "../../model/platform-events";
|
|
15
22
|
let Rodeo = class Rodeo extends LitElement {
|
|
16
23
|
constructor() {
|
|
17
24
|
super();
|
|
25
|
+
this.useTLS = false;
|
|
26
|
+
this.bus = CreateBus();
|
|
27
|
+
this.doctorServiceChannel = this.bus.createChannel(DoctorServiceChannel);
|
|
28
|
+
this.rodeoServiceChannel = this.bus.createChannel(RodeoServiceChannel);
|
|
29
|
+
this.bus.mapChannelToBrokerDestination(QueuePrefix + DoctorServiceChannel, DoctorServiceChannel);
|
|
30
|
+
this.doctorChannelSubscription = this.doctorServiceChannel.subscribe(this.doctorServiceHandler());
|
|
31
|
+
this.roundupComponent = new RodeoRoundup();
|
|
32
|
+
// extract port from session storage.
|
|
33
|
+
this.busPort = sessionStorage.getItem("pb33f-doctor-port");
|
|
34
|
+
this.busHost = sessionStorage.getItem("pb33f-doctor-host");
|
|
35
|
+
this.endpoint = sessionStorage.getItem("doctor-endpoint");
|
|
36
|
+
LintingService.doctorEndpoint = this.endpoint;
|
|
37
|
+
RodeoService.doctorEndpoint = this.endpoint;
|
|
38
|
+
if (!this.busPort) {
|
|
39
|
+
this.busPort = "443"; // default port
|
|
40
|
+
}
|
|
41
|
+
if (!this.busHost) {
|
|
42
|
+
this.busHost = "doctor.pb33f.io"; // default host
|
|
43
|
+
}
|
|
44
|
+
const useTLS = sessionStorage.getItem("pb33f-doctor-tls");
|
|
45
|
+
if (useTLS && useTLS == 'true') {
|
|
46
|
+
this.useTLS = true;
|
|
47
|
+
}
|
|
48
|
+
this.authController = new AuthController(this, this.connectToBroker, true);
|
|
49
|
+
}
|
|
50
|
+
connectToBroker() {
|
|
51
|
+
let protocol = "ws://";
|
|
52
|
+
if (this.useTLS) {
|
|
53
|
+
protocol = "wss://";
|
|
54
|
+
}
|
|
55
|
+
// configure wiretap broker.
|
|
56
|
+
const config = {
|
|
57
|
+
brokerURL: protocol + this.busHost + ':' + this.busPort + '/ranch',
|
|
58
|
+
heartbeatIncoming: 0,
|
|
59
|
+
heartbeatOutgoing: 0,
|
|
60
|
+
mapChannelsOnConnect: true,
|
|
61
|
+
onConnect: () => {
|
|
62
|
+
this.whoAmI();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
this.bus.connectToBroker(config);
|
|
66
|
+
}
|
|
67
|
+
whoAmI() {
|
|
68
|
+
this.bus.publish({
|
|
69
|
+
destination: "/p/q/" + DoctorServiceChannel,
|
|
70
|
+
body: JSON.stringify({ request: Command.WhoAmI }),
|
|
71
|
+
});
|
|
18
72
|
}
|
|
19
73
|
firstUpdated() {
|
|
20
74
|
const router = new Router(this.shadowRoot?.getElementById('outlet'));
|
|
21
|
-
console.log('router', router);
|
|
22
75
|
router?.setRoutes([
|
|
23
|
-
{
|
|
24
|
-
|
|
76
|
+
{
|
|
77
|
+
path: '/rodeo.html', action: () => {
|
|
78
|
+
return this.roundupComponent;
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
path: '/', action: () => {
|
|
83
|
+
return this.roundupComponent;
|
|
84
|
+
}
|
|
85
|
+
},
|
|
25
86
|
{ path: '/users', component: 'pb33f-rodeo-users' }
|
|
26
87
|
]);
|
|
88
|
+
this.connectToBroker();
|
|
27
89
|
}
|
|
28
90
|
render() {
|
|
29
91
|
return html `
|
|
30
92
|
<main>
|
|
31
93
|
<pb33f-rodeo-nav></pb33f-rodeo-nav>
|
|
32
|
-
<div id="outlet"></div>
|
|
94
|
+
<div style="position: relative"><div id="outlet"></div></div>
|
|
33
95
|
</main>
|
|
34
96
|
`;
|
|
35
97
|
}
|
|
98
|
+
handlePlatformEvent(evt) {
|
|
99
|
+
this.roundupComponent.pushConsoleEventInfoMessage(evt);
|
|
100
|
+
switch (evt.event) {
|
|
101
|
+
case PlatformEventType.AssociateBroker:
|
|
102
|
+
this.roundupComponent.numBrokerAssociations++;
|
|
103
|
+
break;
|
|
104
|
+
case PlatformEventType.UserAuthenticated:
|
|
105
|
+
this.roundupComponent.numAuthenticatedSessions++;
|
|
106
|
+
break;
|
|
107
|
+
case PlatformEventType.SessionStarted:
|
|
108
|
+
this.roundupComponent.numSessionsActive++;
|
|
109
|
+
break;
|
|
110
|
+
case PlatformEventType.UserCreated:
|
|
111
|
+
this.roundupComponent.numUsers++;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
rodeoServiceStream() {
|
|
116
|
+
return (msg) => {
|
|
117
|
+
if (msg.payload?.payload != null) {
|
|
118
|
+
if (isPlatformEvent(msg.payload.payload)) {
|
|
119
|
+
// if there is no id, then the event is a socket event.
|
|
120
|
+
if ('id' in msg.payload.payload) {
|
|
121
|
+
this.handlePlatformEvent(msg.payload.payload);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
const se = msg.payload.payload;
|
|
125
|
+
if (se.type) {
|
|
126
|
+
switch (se.type) {
|
|
127
|
+
case "open":
|
|
128
|
+
this.roundupComponent.numActiveSockets++;
|
|
129
|
+
this.roundupComponent.numSocketsOpened++;
|
|
130
|
+
break;
|
|
131
|
+
case "close":
|
|
132
|
+
this.roundupComponent.numActiveSockets--;
|
|
133
|
+
this.roundupComponent.numSocketsClosed--;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
doctorServiceHandler() {
|
|
143
|
+
return (msg) => {
|
|
144
|
+
if (msg.payload?.payload != null) {
|
|
145
|
+
if (isBrokerResponse(msg.payload.payload)) {
|
|
146
|
+
this.brokerConnectionId = msg.payload.payload.broker;
|
|
147
|
+
this.authController.associateBroker(this.brokerConnectionId).then(() => {
|
|
148
|
+
console.log("🤠 welcome to the %crodeo %ccowboy.", 'color: #62C4FFFF; font-weight: bold', 'color: default');
|
|
149
|
+
this.bus.mapChannelToBrokerDestination(TopicPrefix + RodeoServiceChannel, RodeoServiceChannel);
|
|
150
|
+
this.rodeoChannelSubscription = this.rodeoServiceChannel.subscribe(this.rodeoServiceStream());
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
36
156
|
};
|
|
37
157
|
Rodeo.styles = [rodeoCss, listsCss];
|
|
38
158
|
Rodeo = __decorate([
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
-
|
|
2
|
+
import './statistic.js';
|
|
3
|
+
import '../terminal-emulator/terminal-emulator.js';
|
|
4
|
+
import { PlatformEvent } from "../../model/platform-events";
|
|
5
|
+
export declare class RodeoRoundup extends LitElement {
|
|
6
|
+
static styles: import("lit").CSSResult[];
|
|
7
|
+
numSocketsOpened: number;
|
|
8
|
+
numSocketsClosed: number;
|
|
9
|
+
numActiveSockets: number;
|
|
10
|
+
numSessionsCreated: number;
|
|
11
|
+
numSessionsActive: number;
|
|
12
|
+
numAuthenticatedSessions: number;
|
|
13
|
+
numUsers: number;
|
|
14
|
+
numBrokerAssociations: number;
|
|
15
|
+
private terminalEmulator;
|
|
16
|
+
constructor();
|
|
17
|
+
firstUpdated(): void;
|
|
18
|
+
pushConsoleEventInfoMessage(evt: PlatformEvent): void;
|
|
3
19
|
render(): import("lit-html").TemplateResult<1>;
|
|
4
20
|
}
|
|
@@ -5,14 +5,92 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { html, LitElement } from "lit";
|
|
8
|
-
import { customElement } from "lit/decorators.js";
|
|
9
|
-
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { RodeoService } from "../../services/rodeo-service.js";
|
|
10
|
+
import './statistic.js';
|
|
11
|
+
import '../terminal-emulator/terminal-emulator.js';
|
|
12
|
+
import roundupCss from "./roundup.css.js";
|
|
13
|
+
import { TerminalEmulator } from "../terminal-emulator/terminal-emulator";
|
|
14
|
+
let RodeoRoundup = class RodeoRoundup extends LitElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
this.terminalEmulator = new TerminalEmulator();
|
|
18
|
+
this.terminalEmulator.label = 'event stream';
|
|
19
|
+
}
|
|
20
|
+
firstUpdated() {
|
|
21
|
+
// fetch the roundup from the rodeo service.
|
|
22
|
+
RodeoService.getRoundup().then((stats) => {
|
|
23
|
+
this.numActiveSockets = stats.activeSockets;
|
|
24
|
+
this.numSocketsClosed = stats.socketsClosed;
|
|
25
|
+
this.numSocketsOpened = stats.socketsOpened;
|
|
26
|
+
this.numSessionsActive = stats.sessionsOpen;
|
|
27
|
+
this.numSessionsCreated = stats.sessionCreated;
|
|
28
|
+
this.numAuthenticatedSessions = stats.sessionsAuthenticated;
|
|
29
|
+
this.numUsers = stats.users;
|
|
30
|
+
this.numBrokerAssociations = stats.brokerAssociations;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
pushConsoleEventInfoMessage(evt) {
|
|
34
|
+
const terminalMessage = {
|
|
35
|
+
type: 'info',
|
|
36
|
+
message: `event: ${evt.event}`,
|
|
37
|
+
metadata: evt.metadata,
|
|
38
|
+
timestamp: new Date().toString()
|
|
39
|
+
};
|
|
40
|
+
this.terminalEmulator.addMessage(terminalMessage);
|
|
41
|
+
this.terminalEmulator.requestUpdate();
|
|
42
|
+
}
|
|
10
43
|
render() {
|
|
11
44
|
return html `
|
|
45
|
+
<div class="roundup">
|
|
46
|
+
<pb33f-rodeo-statistic title="Sockets Opened" value="${this.numSocketsOpened}"></pb33f-rodeo-statistic>
|
|
47
|
+
<pb33f-rodeo-statistic title="Sockets Closed" value="${this.numSocketsClosed}"></pb33f-rodeo-statistic>
|
|
48
|
+
<pb33f-rodeo-statistic title="Active Sockets" value="${this.numActiveSockets}"></pb33f-rodeo-statistic>
|
|
49
|
+
<pb33f-rodeo-statistic title="Active Sessions"
|
|
50
|
+
value="${this.numSessionsActive}"></pb33f-rodeo-statistic>
|
|
51
|
+
<pb33f-rodeo-statistic title="Sessions Created"
|
|
52
|
+
value="${this.numSessionsCreated}"></pb33f-rodeo-statistic>
|
|
53
|
+
<pb33f-rodeo-statistic title="Authenticated Sessions"
|
|
54
|
+
value="${this.numAuthenticatedSessions}"></pb33f-rodeo-statistic>
|
|
55
|
+
<pb33f-rodeo-statistic title="Broker Associations"
|
|
56
|
+
value="${this.numBrokerAssociations}"></pb33f-rodeo-statistic>
|
|
57
|
+
<pb33f-rodeo-statistic title="Users"
|
|
58
|
+
value="${this.numUsers}"></pb33f-rodeo-statistic>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
<div class="emulator">
|
|
62
|
+
${this.terminalEmulator}
|
|
63
|
+
</div>
|
|
64
|
+
|
|
12
65
|
`;
|
|
13
66
|
}
|
|
14
67
|
};
|
|
15
|
-
|
|
68
|
+
RodeoRoundup.styles = [roundupCss];
|
|
69
|
+
__decorate([
|
|
70
|
+
property({ type: Number })
|
|
71
|
+
], RodeoRoundup.prototype, "numSocketsOpened", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
property({ type: Number })
|
|
74
|
+
], RodeoRoundup.prototype, "numSocketsClosed", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
property({ type: Number })
|
|
77
|
+
], RodeoRoundup.prototype, "numActiveSockets", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
property({ type: Number })
|
|
80
|
+
], RodeoRoundup.prototype, "numSessionsCreated", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
property({ type: Number })
|
|
83
|
+
], RodeoRoundup.prototype, "numSessionsActive", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
property({ type: Number })
|
|
86
|
+
], RodeoRoundup.prototype, "numAuthenticatedSessions", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
property({ type: Number })
|
|
89
|
+
], RodeoRoundup.prototype, "numUsers", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
property({ type: Number })
|
|
92
|
+
], RodeoRoundup.prototype, "numBrokerAssociations", void 0);
|
|
93
|
+
RodeoRoundup = __decorate([
|
|
16
94
|
customElement('pb33f-rodeo-home')
|
|
17
|
-
],
|
|
18
|
-
export {
|
|
95
|
+
], RodeoRoundup);
|
|
96
|
+
export { RodeoRoundup };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
export default css `
|
|
3
|
+
:host{
|
|
4
|
+
color: var(--font-color)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.statistic {
|
|
8
|
+
width: 270px;
|
|
9
|
+
height: 80px;
|
|
10
|
+
border: 1px solid var(--secondary-color);
|
|
11
|
+
padding: 10px;
|
|
12
|
+
margin: 10px;
|
|
13
|
+
}
|
|
14
|
+
.title {
|
|
15
|
+
height: 30px;
|
|
16
|
+
font-size: 1.2rem;
|
|
17
|
+
font-family: var(--font-stack-bold), serif;
|
|
18
|
+
color: var(--secondary-color)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.details {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-wrap: wrap;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.value {
|
|
27
|
+
display: inline-block;
|
|
28
|
+
font-size: 2.5rem;
|
|
29
|
+
color: var(--primary-color);
|
|
30
|
+
text-shadow: 0 0 20px var(--primary-color-lowalpha);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@keyframes pulse {
|
|
34
|
+
0% {
|
|
35
|
+
text-shadow: 0 0 10px var(--primary-color);
|
|
36
|
+
transform: scale(1);
|
|
37
|
+
}
|
|
38
|
+
50% {
|
|
39
|
+
text-shadow: 0 0 30px var(--font-color);
|
|
40
|
+
transform: scale(1.1);
|
|
41
|
+
}
|
|
42
|
+
100% {
|
|
43
|
+
text-shadow: 0 0 10px var(--primary-color);
|
|
44
|
+
transform: scale(1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/* The class that triggers the animation */
|
|
48
|
+
.pulse {
|
|
49
|
+
animation: pulse 200ms ease-out;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* New keyframes for the border flash */
|
|
53
|
+
@keyframes borderFlash {
|
|
54
|
+
0% {
|
|
55
|
+
border-color: var(--secondary-color);
|
|
56
|
+
}
|
|
57
|
+
50% {
|
|
58
|
+
border-color: var(--primary-color); /* You can define --flash-color in your CSS variables */
|
|
59
|
+
}
|
|
60
|
+
100% {
|
|
61
|
+
border-color: var(--secondary-color);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/* The class that triggers the border flash */
|
|
65
|
+
.border-flash {
|
|
66
|
+
animation: borderFlash 400ms ease-out;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import '@shoelace-style/shoelace/dist/components/format-number/format-number.js';
|
|
3
|
+
export declare class Statistic extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
title: string;
|
|
6
|
+
value: number;
|
|
7
|
+
constructor();
|
|
8
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9
|
+
updated(changedProperties: Map<string, unknown>): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, LitElement } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import statisticCss from "./statistic.css";
|
|
10
|
+
import '@shoelace-style/shoelace/dist/components/format-number/format-number.js';
|
|
11
|
+
let Statistic = class Statistic extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.title = 'statistic';
|
|
15
|
+
}
|
|
16
|
+
render() {
|
|
17
|
+
return html `
|
|
18
|
+
<div class="statistic">
|
|
19
|
+
<div class="title">
|
|
20
|
+
${this.title}
|
|
21
|
+
</div>
|
|
22
|
+
<div class="details">
|
|
23
|
+
<span class="value">
|
|
24
|
+
<sl-format-number value="${this.value}"></sl-format-number></span>
|
|
25
|
+
</div>
|
|
26
|
+
</div>`;
|
|
27
|
+
}
|
|
28
|
+
updated(changedProperties) {
|
|
29
|
+
if (changedProperties.has('value')) {
|
|
30
|
+
// Animate the value text
|
|
31
|
+
const valueElement = this.shadowRoot?.querySelector('.value');
|
|
32
|
+
if (valueElement) {
|
|
33
|
+
valueElement.classList.remove('pulse');
|
|
34
|
+
//@ts-ignore
|
|
35
|
+
void valueElement.offsetWidth;
|
|
36
|
+
valueElement.classList.add('pulse');
|
|
37
|
+
}
|
|
38
|
+
// Animate the container border
|
|
39
|
+
const statisticElement = this.shadowRoot?.querySelector('.statistic');
|
|
40
|
+
if (statisticElement) {
|
|
41
|
+
statisticElement.classList.remove('border-flash');
|
|
42
|
+
//@ts-ignore
|
|
43
|
+
void statisticElement.offsetWidth;
|
|
44
|
+
statisticElement.classList.add('border-flash');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Statistic.styles = [statisticCss];
|
|
50
|
+
__decorate([
|
|
51
|
+
property()
|
|
52
|
+
], Statistic.prototype, "title", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
property({ type: Number })
|
|
55
|
+
], Statistic.prototype, "value", void 0);
|
|
56
|
+
Statistic = __decorate([
|
|
57
|
+
customElement('pb33f-rodeo-statistic')
|
|
58
|
+
], Statistic);
|
|
59
|
+
export { Statistic };
|