statusLabel function

String statusLabel(
  1. BucketResource storage
)

The user-facing label for the state of a storage.

Revoked access takes precedence over the provisioning status.

Implementation

String statusLabel(BucketResource storage) {
  if (storage.accessRevokedAt != null) {
    final reason = storage.accessRevokedReason;
    if (reason == null) {
      return 'Access revoked';
    }
    return 'Access revoked (${_revocationReasonLabel(reason)})';
  }

  return switch (storage.status) {
    BucketStatus.created => 'Creating',
    BucketStatus.provisioned => 'Ready',
    BucketStatus.deletionRequested => 'Deleting',
    BucketStatus.deleted => 'Deleted',
  };
}