@@ -13,6 +13,54 @@ const loadingFromSettings = ref(false)
13
13
const loadingReload = ref (false )
14
14
const loadingRestart = ref (false )
15
15
16
+ // Auto refresh logic
17
+ const isAutoRefresh = ref (true )
18
+ const autoRefreshInterval = ref (5 ) // seconds
19
+ const autoRefreshTimer = ref <NodeJS .Timeout | null >(null )
20
+
21
+ function startAutoRefresh() {
22
+ if (autoRefreshTimer .value ) {
23
+ clearInterval (autoRefreshTimer .value )
24
+ }
25
+
26
+ autoRefreshTimer .value = setInterval (() => {
27
+ if (curd .value ) {
28
+ curd .value .refresh ()
29
+ }
30
+ }, autoRefreshInterval .value * 1000 )
31
+ }
32
+
33
+ function stopAutoRefresh() {
34
+ if (autoRefreshTimer .value ) {
35
+ clearInterval (autoRefreshTimer .value )
36
+ autoRefreshTimer .value = null
37
+ }
38
+ }
39
+
40
+ // Watch for auto refresh state changes
41
+ watch (isAutoRefresh , newValue => {
42
+ if (newValue ) {
43
+ startAutoRefresh ()
44
+ message .success ($gettext (' Auto refresh enabled' ))
45
+ }
46
+ else {
47
+ stopAutoRefresh ()
48
+ message .success ($gettext (' Auto refresh disabled' ))
49
+ }
50
+ })
51
+
52
+ // Initialize auto refresh on mount if enabled
53
+ onMounted (() => {
54
+ if (isAutoRefresh .value ) {
55
+ startAutoRefresh ()
56
+ }
57
+ })
58
+
59
+ // Clean up timer on component unmount
60
+ onBeforeUnmount (() => {
61
+ stopAutoRefresh ()
62
+ })
63
+
16
64
function loadFromSettings() {
17
65
loadingFromSettings .value = true
18
66
environment .load_from_settings ().then (() => {
@@ -78,6 +126,7 @@ const inTrash = computed(() => {
78
126
disabled: !record.status,
79
127
}),
80
128
},
129
+ pagination: false,
81
130
}"
82
131
:title =" $gettext('Environments')"
83
132
:api =" environment"
@@ -89,6 +138,37 @@ const inTrash = computed(() => {
89
138
{{ $gettext('Load from settings') }}
90
139
</AButton >
91
140
</template >
141
+
142
+ <template #afterListActions >
143
+ <div class =" flex items-center gap-2" >
144
+ <ASelect
145
+ v-model:value =" autoRefreshInterval"
146
+ size =" small"
147
+ class =" w-16"
148
+ :disabled =" isAutoRefresh"
149
+ @change =" isAutoRefresh && startAutoRefresh()"
150
+ >
151
+ <ASelectOption :value =" 5" >
152
+ 5s
153
+ </ASelectOption >
154
+ <ASelectOption :value =" 10" >
155
+ 10s
156
+ </ASelectOption >
157
+ <ASelectOption :value =" 30" >
158
+ 30s
159
+ </ASelectOption >
160
+ <ASelectOption :value =" 60" >
161
+ 60s
162
+ </ASelectOption >
163
+ </ASelect >
164
+
165
+ <span >{{ $gettext('Auto Refresh') }}</span >
166
+ <ASwitch
167
+ v-model:checked =" isAutoRefresh"
168
+ size =" small"
169
+ />
170
+ </div >
171
+ </template >
92
172
</StdCurd >
93
173
94
174
<BatchUpgrader ref =" refUpgrader" @success =" curd.refresh()" />
0 commit comments