Skip to content

Commit

Permalink
Use FutureBuilder to Fetch Namespaces (#432)
Browse files Browse the repository at this point in the history
Instead of our custom logic to fetch the list of all available
namespaces in a cluster we are now using a FutureBuilder in the
AppNamespacesWidget. This is more aligned with the way of fetching data
in other widgets where we are also using a FutureBuilder.
  • Loading branch information
ricoberger committed Jan 5, 2023
1 parent 78174a7 commit 6ef1d00
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 178 deletions.
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:io' show Platform;
import 'package:flutter/material.dart';

import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:kubenav/utils/storage.dart';
import 'package:provider/provider.dart';
import 'package:window_size/window_size.dart';

Expand All @@ -15,6 +14,7 @@ import 'package:kubenav/repositories/terminal_repository.dart';
import 'package:kubenav/services/kubenav_desktop.dart';
import 'package:kubenav/utils/constants.dart';
import 'package:kubenav/utils/showmodal.dart';
import 'package:kubenav/utils/storage.dart';
import 'package:kubenav/widgets/home/home.dart';

void main() async {
Expand Down
2 changes: 1 addition & 1 deletion lib/repositories/app_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import 'dart:convert';
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:kubenav/utils/storage.dart';

import 'package:local_auth/local_auth.dart';

import 'package:kubenav/utils/constants.dart';
import 'package:kubenav/utils/logger.dart';
import 'package:kubenav/utils/storage.dart';

/// The [AppRepository] is responsible for managing the users app settings and
/// some global values for the current user session, like the active tab for the
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/resources/general.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'package:json_path/json_path.dart';

import 'package:kubenav/models/kubernetes/io_k8s_api_rbac_v1_policy_rule.dart';
import 'package:kubenav/models/kubernetes/io_k8s_apimachinery_pkg_apis_meta_v1_label_selector.dart';
import 'package:kubenav/models/resource.dart';
import 'package:json_path/json_path.dart';

/// [getAge] returns the age of a Kubernetes resources in a human readable format. This is mostly used to dertermine the
/// age of a resource via the `metadata.creationTimestamp` field. If the given [timestamp] is `null` we return a dash as
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:kubenav/models/resource.dart';

import 'package:kubenav/models/resource.dart';
import 'package:kubenav/utils/resources/general.dart';
import 'package:kubenav/utils/showmodal.dart';
import 'package:kubenav/widgets/resources/details/details_item.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/resources/resource_details.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:kubenav/widgets/resources/details/details_item_additional_printer_columns.dart';

import 'package:provider/provider.dart';

Expand All @@ -15,6 +14,7 @@ import 'package:kubenav/widgets/resources/details/details_create_job.dart';
import 'package:kubenav/widgets/resources/details/details_delete_resource.dart';
import 'package:kubenav/widgets/resources/details/details_edit_resource.dart';
import 'package:kubenav/widgets/resources/details/details_get_logs.dart';
import 'package:kubenav/widgets/resources/details/details_item_additional_printer_columns.dart';
import 'package:kubenav/widgets/resources/details/details_item_conditions.dart';
import 'package:kubenav/widgets/resources/details/details_item_metadata.dart';
import 'package:kubenav/widgets/resources/details/details_live_metrics_containers.dart';
Expand Down
Loading

0 comments on commit 6ef1d00

Please sign in to comment.