mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-10-02 05:07:50 +00:00
Check if category exists on update
This commit is contained in:
@@ -158,6 +158,15 @@ public class StoreEntryWrapper {
|
||||
return;
|
||||
}
|
||||
|
||||
// We received an update after moving/deleting a category
|
||||
var newCat = StoreViewState.get().getCategories().getList().stream()
|
||||
.filter(storeCategoryWrapper ->
|
||||
storeCategoryWrapper.getCategory().getUuid().equals(entry.getCategoryUuid()))
|
||||
.findFirst();
|
||||
if (newCat.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Avoid reupdating name when changed from the name property!
|
||||
if (!entry.getName().equals(name.getValue())) {
|
||||
name.setValue(entry.getName());
|
||||
@@ -196,12 +205,7 @@ public class StoreEntryWrapper {
|
||||
sessionActive.setValue(entry.getStore() instanceof SingletonSessionStore<?> ss
|
||||
&& entry.getStore() instanceof ShellStore
|
||||
&& ss.isSessionRunning());
|
||||
var newCat = StoreViewState.get().getCategories().getList().stream()
|
||||
.filter(storeCategoryWrapper ->
|
||||
storeCategoryWrapper.getCategory().getUuid().equals(entry.getCategoryUuid()))
|
||||
.findFirst()
|
||||
.orElse(StoreViewState.get().getAllConnectionsCategory());
|
||||
category.setValue(newCat);
|
||||
category.setValue(newCat.get());
|
||||
accessScopeRestricted.setValue(DataStorageAccessHandler.getInstance().getType() == DataStorageAccessType.ROLE
|
||||
&& entry.getAccessScope().isAccessSubRestricted());
|
||||
pinToTop.setValue(entry.isPinToTop());
|
||||
|
||||
@@ -1301,13 +1301,17 @@ public abstract class DataStorage {
|
||||
}
|
||||
|
||||
public DataStoreColor getEffectiveColor(DataStoreEntry entry) {
|
||||
var cat = getStoreCategoryIfPresent(entry.getCategoryUuid()).orElseThrow();
|
||||
var root = getRootForEntry(entry, cat);
|
||||
var cat = getStoreCategoryIfPresent(entry.getCategoryUuid());
|
||||
if (cat.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var root = getRootForEntry(entry, cat.get());
|
||||
if (root.getColor() != null) {
|
||||
return root.getColor();
|
||||
}
|
||||
|
||||
var catConfig = getEffectiveCategoryConfig(cat);
|
||||
var catConfig = getEffectiveCategoryConfig(cat.get());
|
||||
return catConfig.getColor();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user