Fix popups not reloaded on provider change
This commit is contained in:
parent
51373a36f2
commit
34de924c4a
|
@ -160,22 +160,28 @@ class ProviderServiceView: NSView {
|
||||||
popupCategory.addItem(withTitle: categoryTitle)
|
popupCategory.addItem(withTitle: categoryTitle)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let (a, b, c) = selectPopupsFromCurrentProfile() {
|
let (a, b, c) = selectPopupsFromCurrentProfile()
|
||||||
|
if popupCategory.numberOfItems > 0 {
|
||||||
popupCategory.selectItem(at: a)
|
popupCategory.selectItem(at: a)
|
||||||
loadLocations(withCategory: a)
|
loadLocations(withCategory: a)
|
||||||
popupLocation.selectItem(at: b)
|
if popupLocation.numberOfItems > 0 {
|
||||||
loadAreas(withLocation: b)
|
popupLocation.selectItem(at: b)
|
||||||
popupArea.selectItem(at: c)
|
loadAreas(withLocation: b)
|
||||||
|
if popupArea.numberOfItems > 0 {
|
||||||
currentCategoryIndex = a
|
popupArea.selectItem(at: c)
|
||||||
currentLocationIndex = b
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentCategoryIndex = a
|
||||||
|
currentLocationIndex = b
|
||||||
|
|
||||||
if let lastInfrastructureUpdate = InfrastructureFactory.shared.modificationDate(forName: profile.name) {
|
if let lastInfrastructureUpdate = InfrastructureFactory.shared.modificationDate(forName: profile.name) {
|
||||||
labelLastInfrastructureUpdate.stringValue = L10n.Core.Service.Sections.ProviderInfrastructure.footer(lastInfrastructureUpdate.timestamp)
|
labelLastInfrastructureUpdate.stringValue = L10n.Core.Service.Sections.ProviderInfrastructure.footer(lastInfrastructureUpdate.timestamp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func selectPopupsFromCurrentProfile() -> (Int, Int, Int)? {
|
private func selectPopupsFromCurrentProfile() -> (Int, Int, Int) {
|
||||||
for (a, category) in categories.enumerated() {
|
for (a, category) in categories.enumerated() {
|
||||||
guard let groups = sortedGroupsByCategory[category.name] else {
|
guard let groups = sortedGroupsByCategory[category.name] else {
|
||||||
continue
|
continue
|
||||||
|
@ -190,7 +196,7 @@ class ProviderServiceView: NSView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return (0, 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func loadLocations(withCategory index: Int) {
|
private func loadLocations(withCategory index: Int) {
|
||||||
|
|
Loading…
Reference in New Issue