adding admin users loading screen, renaming tests

This commit is contained in:
Andy Pack 2022-12-10 14:55:15 +00:00
parent afee0ecea4
commit 32af8e8432
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
3 changed files with 35 additions and 26 deletions

View File

@ -15,8 +15,17 @@ struct UsersList: View {
@EnvironmentObject var liveUser: LiveUser @EnvironmentObject var liveUser: LiveUser
@State private var users: [User] = [] @State private var users: [User] = []
@State var isLoading = true
var body: some View { var body: some View {
if isLoading {
LoadingScreen()
.onAppear {
self.get_users()
}
}
else {
List{ List{
Section { // Weird? added empty header as list renders with space for header then jumps up, not nice Section { // Weird? added empty header as list renders with space for header then jumps up, not nice
if self.users.count > 0 { if self.users.count > 0 {
@ -37,8 +46,6 @@ struct UsersList: View {
} }
// .id(UUID()) // .id(UUID())
.navigationBarTitle("Users") .navigationBarTitle("Users")
.onAppear {
self.get_users()
} }
} }
@ -64,6 +71,8 @@ struct UsersList: View {
return user1.username < user2.username return user1.username < user2.username
}) })
self.isLoading = false
} else { } else {
Logger.net.error("failed to get users from view") Logger.net.error("failed to get users from view")
} }
@ -73,7 +82,7 @@ struct UsersList: View {
struct UsersList_Previews: PreviewProvider { struct UsersList_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
UsersList() UsersList(isLoading: false)
.environmentObject(LiveUser.get_preview_user()) .environmentObject(LiveUser.get_preview_user())
} }
} }

View File

@ -1,15 +1,15 @@
// //
// Music_ToolsTests.swift // MixonomerTests.swift
// Music ToolsTests // MixonomerTests
// //
// Created by Andy Pack on 16/02/2020. // Created by Andy Pack on 16/02/2020.
// Copyright © 2020 Sarsoo. All rights reserved. // Copyright © 2020 Sarsoo. All rights reserved.
// //
import XCTest import XCTest
@testable import Music_Tools @testable import Mixonomer
class Music_ToolsTests: XCTestCase { class MixonomerTests: XCTestCase {
override func setUp() { override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class. // Put setup code here. This method is called before the invocation of each test method in the class.

View File

@ -1,6 +1,6 @@
// //
// Music_ToolsUITests.swift // MixonomerUITests.swift
// Music ToolsUITests // MixonomerUITests
// //
// Created by Andy Pack on 16/02/2020. // Created by Andy Pack on 16/02/2020.
// Copyright © 2020 Sarsoo. All rights reserved. // Copyright © 2020 Sarsoo. All rights reserved.
@ -8,7 +8,7 @@
import XCTest import XCTest
class Music_ToolsUITests: XCTestCase { class MixonomerUITests: XCTestCase {
override func setUp() { override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class. // Put setup code here. This method is called before the invocation of each test method in the class.