refac
This commit is contained in:
@@ -128,7 +128,8 @@
|
||||
});
|
||||
models = models;
|
||||
// Sync with server
|
||||
await Promise.all(modelsToShow.map((model) => upsertModelHandler(model)));
|
||||
await Promise.all(modelsToShow.map((model) => upsertModelHandler(model, false)));
|
||||
toast.success($i18n.t('All models are now visible'));
|
||||
};
|
||||
|
||||
const hideAllHandler = async () => {
|
||||
@@ -139,7 +140,8 @@
|
||||
});
|
||||
models = models;
|
||||
// Sync with server
|
||||
await Promise.all(modelsToHide.map((model) => upsertModelHandler(model)));
|
||||
await Promise.all(modelsToHide.map((model) => upsertModelHandler(model, false)));
|
||||
toast.success($i18n.t('All models are now hidden'));
|
||||
};
|
||||
|
||||
const downloadModels = async (models) => {
|
||||
@@ -175,7 +177,7 @@
|
||||
});
|
||||
};
|
||||
|
||||
const upsertModelHandler = async (model) => {
|
||||
const upsertModelHandler = async (model, showToast = true) => {
|
||||
model.base_model_id = null;
|
||||
|
||||
if (workspaceModels.find((m) => m.id === model.id)) {
|
||||
@@ -183,7 +185,7 @@
|
||||
return null;
|
||||
});
|
||||
|
||||
if (res) {
|
||||
if (res && showToast) {
|
||||
toast.success($i18n.t('Model updated successfully'));
|
||||
}
|
||||
} else {
|
||||
@@ -199,7 +201,7 @@
|
||||
return null;
|
||||
});
|
||||
|
||||
if (res) {
|
||||
if (res && !silent) {
|
||||
toast.success($i18n.t('Model updated successfully'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user