Skip to content

Commit 5e06992

Browse files
committed
refined sidenav
1 parent ad710b4 commit 5e06992

File tree

4 files changed

+223
-175
lines changed

4 files changed

+223
-175
lines changed

ref.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@
55

66
## storybook
77

8-
- https://storybook.js.org/recipes/next
8+
- https://storybook.js.org/recipes/next
9+
10+
## mui
11+
12+
### breakpoints
13+
- https://mui.com/material-ui/customization/breakpoints/

script/simulation_time_auto_generate.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
# Define the mapping for the index
1111
mapping = {
12+
1213
"mappings": {
1314
"properties": {
1415
"deviceId": {"type": "text"},
@@ -19,11 +20,7 @@
1920
"store": True
2021
},
2122
"message": {"type": "text"}
22-
}
23-
},
24-
"settings": {
25-
"index.mapping.total_fields.limit": 2000,
26-
"date_detection": True,
23+
},
2724
"dynamic_templates": [
2825
{
2926
"timestamps": {
@@ -35,16 +32,21 @@
3532
}
3633
}
3734
}
38-
]
35+
],
36+
"date_detection": True
37+
},
38+
"settings": {
39+
"index.mapping.total_fields.limit": 2000
3940
}
4041
}
4142

43+
4244
# Delete index if it exists
43-
if es.indices.exists(index="test_time"):
44-
es.indices.delete(index="test_time")
45+
if es.indices.exists(index="tes_time"):
46+
es.indices.delete(index="tes_time")
4547

4648
# Create the index with the defined mapping
47-
es.indices.create(index="test_time", body=mapping)
49+
es.indices.create(index="tes_time", body=mapping)
4850

4951
# Define the STB devices and user profiles
5052
deviceIds = [f'ZX98763{i:02d}' for i in range(1, 10)]
@@ -55,7 +57,7 @@
5557
channel_suffixes = ["Network", "Channel", "Central", "World", "Planet", "Hub"]
5658

5759
channels = {}
58-
for i in range(100):
60+
for i in range(80):
5961
channel_name = f"{random.choice(channel_prefixes)} {random.choice(channel_suffixes)} {i + 1}"
6062
channels[i + 1] = {'lcn': f'LCN{i + 1:03d}', 'channel_name': channel_name}
6163

@@ -127,7 +129,7 @@ def simulate_device(device_id):
127129
current_user_age = random.choice(user_profiles[device_id])
128130

129131
# STB is powered on
130-
es.index(index="test_time",
132+
es.index(index="tes_time",
131133
id=f'{device_id}_powered_on_{session_id}',
132134
document=generate_log(device_id, current_user_age, "Powered On", channel=device_channels[device_id],
133135
volume=device_volumes[device_id]))
@@ -136,7 +138,7 @@ def simulate_device(device_id):
136138
# Generate heartbeat events for 1-2 hours
137139
end_time = time.time() + 60 * 60 * random.randint(1, 2)
138140
while time.time() < end_time:
139-
es.index(index="test_time",
141+
es.index(index="tes_time",
140142
id=f'{device_id}_heartbeat_{session_id}',
141143
document=generate_log(device_id, current_user_age, "Heartbeat", channel=device_channels[device_id],
142144
volume=device_volumes[device_id]))
@@ -148,20 +150,20 @@ def simulate_device(device_id):
148150
if event_type == "Channel Zap":
149151
channel = select_channel_based_on_age(current_user_age)
150152
device_channels[device_id] = channel
151-
es.index(index="test_time",
153+
es.index(index="tes_time",
152154
id=str(uuid.uuid4()), # Random Elasticsearch ID
153155
document=generate_log(device_id, current_user_age, event_type, channel=channel))
154156
elif event_type == "Volume change":
155157
old_volume = device_volumes[device_id]
156158
new_volume = random.randint(0, 100) # Assuming STB volume range is 0-100
157159
device_volumes[device_id] = new_volume
158-
es.index(index="test_time",
160+
es.index(index="tes_time",
159161
id=str(uuid.uuid4()), # Random Elasticsearch ID
160162
document=generate_log(device_id, current_user_age, event_type, volume=new_volume,
161163
old_volume=old_volume))
162164
elif event_type == "Profile Change":
163165
current_user_age = random.choice(user_profiles[device_id])
164-
es.index(index="test_time",
166+
es.index(index="tes_time",
165167
id=str(uuid.uuid4()), # Random Elasticsearch ID
166168
document=generate_log(device_id, current_user_age, event_type))
167169

0 commit comments

Comments
 (0)