forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto-update the system status in admin dashboard (go-gitea#29163)
- Refactor the system status list into its own template - Change the backend to return only the system status if htmx initiated the request - `hx-get="{{$.Link}}/system_status`: reuse the backend handler - `hx-swap="innerHTML"`: replace the `<div>`'s innerHTML (essentially the new template) - `hx-trigger="every 5s"`: call every 5 seconds - `hx-indicator=".divider"`: the `is-loading` class shouldn't be added to the div during the request, so set it on an element it has no effect on - Render "Since Last GC Time" with `<relative-time>`, so we send a timestamp # Auto-update in action GIF ![action](https://github.com/go-gitea/gitea/assets/20454870/c6e1f220-f0fb-4460-ac3b-59f315e30e29) --------- Signed-off-by: Yarden Shoham <[email protected]> Co-authored-by: silverwind <[email protected]>
- Loading branch information
1 parent
e9a1ffb
commit c70f65e
Showing
9 changed files
with
97 additions
and
74 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<dl class="admin-dl-horizontal"> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.server_uptime"}}</dt> | ||
<dd><relative-time format="duration" datetime="{{.SysStatus.StartTime}}">{{.SysStatus.StartTime}}</relative-time></dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.current_goroutine"}}</dt> | ||
<dd>{{.SysStatus.NumGoroutine}}</dd> | ||
<div class="divider"></div> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.current_memory_usage"}}</dt> | ||
<dd>{{.SysStatus.MemAllocated}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.total_memory_allocated"}}</dt> | ||
<dd>{{.SysStatus.MemTotal}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.memory_obtained"}}</dt> | ||
<dd>{{.SysStatus.MemSys}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.pointer_lookup_times"}}</dt> | ||
<dd>{{.SysStatus.Lookups}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.memory_allocate_times"}}</dt> | ||
<dd>{{.SysStatus.MemMallocs}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.memory_free_times"}}</dt> | ||
<dd>{{.SysStatus.MemFrees}}</dd> | ||
<div class="divider"></div> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.current_heap_usage"}}</dt> | ||
<dd>{{.SysStatus.HeapAlloc}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.heap_memory_obtained"}}</dt> | ||
<dd>{{.SysStatus.HeapSys}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.heap_memory_idle"}}</dt> | ||
<dd>{{.SysStatus.HeapIdle}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.heap_memory_in_use"}}</dt> | ||
<dd>{{.SysStatus.HeapInuse}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.heap_memory_released"}}</dt> | ||
<dd>{{.SysStatus.HeapReleased}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.heap_objects"}}</dt> | ||
<dd>{{.SysStatus.HeapObjects}}</dd> | ||
<div class="divider"></div> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.bootstrap_stack_usage"}}</dt> | ||
<dd>{{.SysStatus.StackInuse}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.stack_memory_obtained"}}</dt> | ||
<dd>{{.SysStatus.StackSys}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.mspan_structures_usage"}}</dt> | ||
<dd>{{.SysStatus.MSpanInuse}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.mspan_structures_obtained"}}</dt> | ||
<dd>{{.SysStatus.MSpanSys}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.mcache_structures_usage"}}</dt> | ||
<dd>{{.SysStatus.MCacheInuse}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.mcache_structures_obtained"}}</dt> | ||
<dd>{{.SysStatus.MCacheSys}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.profiling_bucket_hash_table_obtained"}}</dt> | ||
<dd>{{.SysStatus.BuckHashSys}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.gc_metadata_obtained"}}</dt> | ||
<dd>{{.SysStatus.GCSys}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.other_system_allocation_obtained"}}</dt> | ||
<dd>{{.SysStatus.OtherSys}}</dd> | ||
<div class="divider"></div> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.next_gc_recycle"}}</dt> | ||
<dd>{{.SysStatus.NextGC}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.last_gc_time"}}</dt> | ||
<dd><relative-time format="duration" datetime="{{.SysStatus.LastGCTime}}">{{.SysStatus.LastGCTime}}</relative-time></dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.total_gc_pause"}}</dt> | ||
<dd>{{.SysStatus.PauseTotalNs}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.last_gc_pause"}}</dt> | ||
<dd>{{.SysStatus.PauseNs}}</dd> | ||
<dt>{{ctx.Locale.Tr "admin.dashboard.gc_times"}}</dt> | ||
<dd>{{.SysStatus.NumGC}}</dd> | ||
</dl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,6 +169,9 @@ export default { | |
], | ||
}, | ||
plugins: [ | ||
new webpack.ProvidePlugin({ // for htmx extensions | ||
htmx: 'htmx.org', | ||
}), | ||
new DefinePlugin({ | ||
__VUE_OPTIONS_API__: true, // at the moment, many Vue components still use the Vue Options API | ||
__VUE_PROD_DEVTOOLS__: false, // do not enable devtools support in production | ||
|
@@ -207,6 +210,7 @@ export default { | |
override: { | ||
'khroma@*': {licenseName: 'MIT'}, // https://github.com/fabiospampinato/khroma/pull/33 | ||
'[email protected]': {licenseName: 'BSD-2-Clause'}, // "BSD 2-Clause" -> "BSD-2-Clause" | ||
'[email protected]': {licenseName: 'BSD-2-Clause'}, // "BSD 2-Clause" -> "BSD-2-Clause" | ||
}, | ||
emitError: true, | ||
allow: '(Apache-2.0 OR BSD-2-Clause OR BSD-3-Clause OR MIT OR ISC OR CPAL-1.0 OR Unlicense OR EPL-1.0 OR EPL-2.0)', | ||
|