Skip to content

Commit b6c22b1

Browse files
committed
feat: add loading progress bar for background data loading
- Introduced a new LoadingProgressBar component to display loading status. - Integrated loading progress bar into App.vue, MainContent.vue, and ResourceList.vue. - Added isLoadingInBackground state to resource store to track background loading status. - Implemented event listeners for background loading progress and completion. - Updated resource store to handle background data loading and refresh logic.
1 parent 362769b commit b6c22b1

File tree

9 files changed

+886
-99
lines changed

9 files changed

+886
-99
lines changed

src-tauri/src/commands/command_wrapper.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ macro_rules! k8s_command {
9191
}
9292

9393
/// Specific command implementations for common operations.
94-
9594
/// Command to get Kubernetes namespaces.
9695
pub struct GetNamespacesCommand;
9796

src-tauri/src/commands/k8s_commands.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ pub async fn subscribe_to_resources(
224224
state: State<'_, AppState>,
225225
resource_type: String,
226226
namespace: Option<String>,
227+
immediate_fetch: Option<bool>,
227228
) -> Result<Vec<crate::k8s::K8sListItem>, String> {
228229
use crate::k8s::{WatchScope, K8sClient};
229230

@@ -237,7 +238,8 @@ pub async fn subscribe_to_resources(
237238
let scope = WatchScope::new(cluster_context)
238239
.with_namespace(namespace);
239240

240-
cache.subscribe(app_handle, resource_type, scope)
241+
let immediate = immediate_fetch.unwrap_or(false);
242+
cache.subscribe(app_handle, resource_type, scope, immediate)
241243
.await
242244
.map_err(|e| e.to_string())
243245
} else {

src-tauri/src/k8s/resources.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,25 +189,29 @@ pub struct K8sListItem {
189189
/// These events represent the different types of changes that can occur to
190190
/// Kubernetes objects, allowing clients to maintain up-to-date views of cluster state.
191191
#[derive(Debug, Clone, Serialize, Deserialize)]
192-
#[serde(rename_all = "camelCase")]
192+
#[serde(rename_all = "PascalCase")]
193193
pub enum WatchEvent {
194194
/// A new resource was created or discovered
195-
Added {
195+
Added {
196196
item: K8sListItem,
197+
#[serde(rename = "clusterContext")]
197198
cluster_context: String,
198199
},
199200
/// An existing resource was updated
200-
Modified {
201+
Modified {
201202
item: K8sListItem,
203+
#[serde(rename = "clusterContext")]
202204
cluster_context: String,
203205
},
204206
/// A resource was deleted
205-
Deleted {
207+
Deleted {
206208
item: K8sListItem,
209+
#[serde(rename = "clusterContext")]
207210
cluster_context: String,
208211
},
209212
/// Initial watch synchronization is complete (no more items)
210213
InitialSyncComplete {
214+
#[serde(rename = "clusterContext")]
211215
cluster_context: String,
212216
},
213217
}

0 commit comments

Comments
 (0)