always load the full record on record view

This commit is contained in:
Gani Georgiev
2024-11-13 19:35:07 +02:00
parent 9f606bdeca
commit 396aa0f97c
33 changed files with 96 additions and 94 deletions
@@ -84,14 +84,14 @@
</div>
</h4>
<div class="accordions m-b-35">
<OTPAccordion bind:collection />
<PasswordAuthAccordion bind:collection />
{#if !isSuperusers}
<OAuth2Accordion bind:collection />
{/if}
<OTPAccordion bind:collection />
<MFAAccordion bind:collection />
</div>
+3 -3
View File
@@ -1,4 +1,7 @@
<script>
import { tick } from "svelte";
import { querystring } from "svelte-spa-router";
import CommonHelper from "@/utils/CommonHelper";
import tooltip from "@/actions/tooltip";
import PageWrapper from "@/components/base/PageWrapper.svelte";
import RefreshButton from "@/components/base/RefreshButton.svelte";
@@ -18,9 +21,6 @@
isCollectionsLoading,
loadCollections,
} from "@/stores/collections";
import CommonHelper from "@/utils/CommonHelper";
import { tick } from "svelte";
import { querystring } from "svelte-spa-router";
const initialQueryParams = new URLSearchParams($querystring);
@@ -126,22 +126,24 @@
}
async function resolveModel(model) {
if (model && typeof model === "string") {
// load from id
try {
return await ApiClient.collection(collection.id).getOne(model);
} catch (err) {
if (!err.isAbort) {
forceHide();
console.warn("resolveModel:", err);
addErrorToast(`Unable to load record with id "${model}"`);
}
}
if (!model) {
return null;
}
return model;
let id = typeof model === "string" ? model : model?.id;
// load the full record
try {
return await ApiClient.collection(collection.id).getOne(id);
} catch (err) {
if (!err.isAbort) {
forceHide();
console.warn("resolveModel:", err);
addErrorToast(`Unable to load record with id "${id}"`);
}
}
return null;
}
async function load(model) {
+7 -7
View File
@@ -1,16 +1,16 @@
<script>
import { createEventDispatcher } from "svelte";
import { fly } from "svelte/transition";
import ApiClient from "@/utils/ApiClient";
import CommonHelper from "@/utils/CommonHelper";
import { collections, isCollectionsLoading } from "@/stores/collections";
import { confirm } from "@/stores/confirmation";
import { addSuccessToast } from "@/stores/toasts";
import Field from "@/components/base/Field.svelte";
import Scroller from "@/components/base/Scroller.svelte";
import SortHeader from "@/components/base/SortHeader.svelte";
import Toggler from "@/components/base/Toggler.svelte";
import RecordFieldValue from "@/components/records/RecordFieldValue.svelte";
import { collections, isCollectionsLoading } from "@/stores/collections";
import { confirm } from "@/stores/confirmation";
import { addSuccessToast } from "@/stores/toasts";
import ApiClient from "@/utils/ApiClient";
import CommonHelper from "@/utils/CommonHelper";
import { createEventDispatcher } from "svelte";
import { fly } from "svelte/transition";
const dispatch = createEventDispatcher();
const sortRegex = /^([\+\-])?(\w+)$/;