Unified Ungrouped group
This commit is contained in:
1 parent
ac823a454f
commit
e267fa657f
5 files changed
+71
-2
No files matched your search
@@ -26104,7 +26104,6 @@
|
||||
}
|
||||
},
|
||||
"The saved password is no longer available." : {
|
||||
"extractionState" : "stale",
|
||||
"localizations" : {
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
|
||||
@@ -238,6 +238,19 @@ struct MobileSnippetsView: View {
|
||||
.frame(width: 44, height: 44)
|
||||
}
|
||||
.accessibilityLabel("More")
|
||||
} else if case .ungrouped = section.id {
|
||||
Menu {
|
||||
Button("New Snippet", systemImage: "curlybraces") {
|
||||
editorRequest = SnippetEditorRequest(snippetID: nil, packageID: nil)
|
||||
}
|
||||
Button("New Package", systemImage: "folder.badge.plus") {
|
||||
packageEditorRequest = PackageEditorRequest(packageID: nil, parentID: nil)
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: "ellipsis")
|
||||
.frame(width: 44, height: 44)
|
||||
}
|
||||
.accessibilityLabel("More")
|
||||
}
|
||||
}
|
||||
.accessibilityElement(children: .contain)
|
||||
|
||||
@@ -483,6 +483,19 @@ struct MobileVaultView: View {
|
||||
.frame(width: 44, height: 44)
|
||||
}
|
||||
.accessibilityLabel("More")
|
||||
} else if case .ungrouped = section.id {
|
||||
Menu {
|
||||
Button("New Host", systemImage: "server.rack") {
|
||||
editingHost = Host(name: "", host: "")
|
||||
}
|
||||
Button("New Group", systemImage: "folder.badge.plus") {
|
||||
groupEditorRequest = GroupEditorRequest(groupID: nil, parentID: nil)
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: "ellipsis")
|
||||
.frame(width: 44, height: 44)
|
||||
}
|
||||
.accessibilityLabel("More")
|
||||
}
|
||||
}
|
||||
.accessibilityElement(children: .contain)
|
||||
|
||||
@@ -19,6 +19,7 @@ final class HostsPageState {
|
||||
|
||||
var query = ""
|
||||
var selectedGroupID: HostGroup.ID?
|
||||
var isUngroupedSelected = false
|
||||
/// Which tags the grid is narrowed to, ticked in the titlebar search
|
||||
/// field's magnifier menu. Several at once means "carries all of these".
|
||||
var selectedTags: Set<String> = []
|
||||
@@ -145,7 +146,7 @@ struct HostsPageView: ManagedCardPage {
|
||||
Divider()
|
||||
DestructiveMenuButton("Delete Group") { requestDelete(group) }
|
||||
}
|
||||
} else {
|
||||
} else if case .ungrouped = section.id {
|
||||
CardSectionHeader(
|
||||
title: section.title,
|
||||
count: section.items.count,
|
||||
@@ -153,6 +154,22 @@ struct HostsPageView: ManagedCardPage {
|
||||
{ app.hostLibrary.setUngroupedExpanded(!expanded) }
|
||||
},
|
||||
isCollapsed: !(section.isExpanded ?? true),
|
||||
select: selectUngrouped,
|
||||
isSelected: state.isUngroupedSelected,
|
||||
isDropTarget: isDropTarget
|
||||
)
|
||||
.contextMenu {
|
||||
Button("New Host", systemImage: MenuSymbol.newHost) {
|
||||
openHostEditor(nil)
|
||||
}
|
||||
Button("New Group", systemImage: MenuSymbol.newGroup) {
|
||||
openWork(.hostGroupEditor(groupID: nil, parentID: nil))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CardSectionHeader(
|
||||
title: section.title,
|
||||
count: section.items.count,
|
||||
isDropTarget: isDropTarget
|
||||
)
|
||||
}
|
||||
@@ -279,15 +296,23 @@ struct HostsPageView: ManagedCardPage {
|
||||
private func setHostSelection(_ ids: Set<Host.ID>) {
|
||||
let valid = ids.intersection(Set(app.hostLibrary.hosts.map(\.id)))
|
||||
state.selectedGroupID = nil
|
||||
state.isUngroupedSelected = false
|
||||
let ordered = visibleHosts.filter { valid.contains($0.id) }.map { VaultSelectionID.host($0.id) }
|
||||
window.setVaultSelection(ordered, for: .hosts)
|
||||
}
|
||||
|
||||
private func selectGroup(_ id: HostGroup.ID) {
|
||||
window.clearVaultSelection(for: .hosts)
|
||||
state.isUngroupedSelected = false
|
||||
state.selectedGroupID = id
|
||||
}
|
||||
|
||||
private func selectUngrouped() {
|
||||
window.clearVaultSelection(for: .hosts)
|
||||
state.selectedGroupID = nil
|
||||
state.isUngroupedSelected = true
|
||||
}
|
||||
|
||||
private func pruneHostSelection() {
|
||||
setHostSelection(hostSelection)
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ final class SnippetsPageState {
|
||||
|
||||
var query = ""
|
||||
var selectedPackageID: SnippetPackage.ID?
|
||||
var isUngroupedSelected = false
|
||||
var confirmation: ConfirmationRoute?
|
||||
}
|
||||
|
||||
@@ -145,8 +146,18 @@ struct SnippetsPageView: ManagedCardPage {
|
||||
)
|
||||
},
|
||||
isCollapsed: !app.snippets.isSnippetsUngroupedExpanded,
|
||||
select: selectUngrouped,
|
||||
isSelected: state.isUngroupedSelected,
|
||||
isDropTarget: isDropTarget
|
||||
)
|
||||
.contextMenu {
|
||||
Button("New Snippet", systemImage: MenuSymbol.newSnippet) {
|
||||
openSnippetEditor(snippetID: nil, packageID: nil)
|
||||
}
|
||||
Button("New Package", systemImage: MenuSymbol.newPackage) {
|
||||
openPackageEditor(packageID: nil, parentID: nil)
|
||||
}
|
||||
}
|
||||
case .results:
|
||||
CardSectionHeader(title: section.title, count: section.items.count)
|
||||
}
|
||||
@@ -237,6 +248,7 @@ struct SnippetsPageView: ManagedCardPage {
|
||||
private func setSelection(_ ids: Set<Snippet.ID>) {
|
||||
let valid = ids.intersection(Set(app.snippets.snippets.map(\.id)))
|
||||
state.selectedPackageID = nil
|
||||
state.isUngroupedSelected = false
|
||||
let ordered = visibleSnippets.filter { valid.contains($0.id) }
|
||||
.map { VaultSelectionID.snippet($0.id) }
|
||||
window.setVaultSelection(ordered, for: .snippets)
|
||||
@@ -244,9 +256,16 @@ struct SnippetsPageView: ManagedCardPage {
|
||||
|
||||
private func selectPackage(_ id: SnippetPackage.ID) {
|
||||
window.clearVaultSelection(for: .snippets)
|
||||
state.isUngroupedSelected = false
|
||||
state.selectedPackageID = id
|
||||
}
|
||||
|
||||
private func selectUngrouped() {
|
||||
window.clearVaultSelection(for: .snippets)
|
||||
state.selectedPackageID = nil
|
||||
state.isUngroupedSelected = true
|
||||
}
|
||||
|
||||
private func saveSnippet(_ snippet: Snippet) {
|
||||
app.snippets.upsert(snippet)
|
||||
window.selectVaultItem(.snippet(snippet.id), on: .snippets)
|
||||
|
||||
Reference in new issue
Block a user