Skip to content

Commit

Permalink
chore: Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
nas-tabchiche committed Dec 31, 2024
1 parent 1bafaec commit ab97e07
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 114 deletions.
31 changes: 2 additions & 29 deletions frontend/src/lib/components/DetailView/DetailView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,13 @@
import { toCamelCase } from '$lib/utils/locales.js';
import * as m from '$paraglide/messages.js';
import { languageTag } from '$paraglide/runtime.js';
import type {
ModalComponent,
ModalSettings,
ModalStore,
ToastStore
} from '@skeletonlabs/skeleton';
import { Tab, TabGroup, getModalStore, getToastStore } from '@skeletonlabs/skeleton';
import type { ModalComponent, ModalSettings, ModalStore } from '@skeletonlabs/skeleton';
import { Tab, TabGroup, getModalStore } from '@skeletonlabs/skeleton';
import { onMount } from 'svelte';
import { goto } from '$app/navigation';
const modalStore: ModalStore = getModalStore();
const toastStore: ToastStore = getToastStore();
const defaultExcludes = ['id', 'is_published', 'localization_dict'];
Expand All @@ -50,27 +44,6 @@
let tabSet = 0;
function handleFormUpdated({
form,
pageStatus,
closeModal
}: {
form: any;
pageStatus: number;
closeModal: boolean;
}) {
if (closeModal && form.valid) {
$modalStore[0] ? modalStore.close() : null;
}
if (form.message) {
const toast: { message: string; background: string } = {
message: form.message,
background: pageStatus === 200 ? 'variant-filled-success' : 'variant-filled-error'
};
toastStore.trigger(toast);
}
}
function handleKeydown(event: KeyboardEvent) {
if (event.metaKey || event.ctrlKey) return;
if (document.activeElement?.tagName !== 'BODY') return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,26 @@
ModalComponent,
ModalSettings,
ModalStore,
PopupSettings,
ToastStore
PopupSettings
} from '@skeletonlabs/skeleton';
import { getModalStore, getToastStore, popup } from '@skeletonlabs/skeleton';
import { superForm } from 'sveltekit-superforms';
import { getModalStore, popup } from '@skeletonlabs/skeleton';
import Anchor from '$lib/components/Anchor/Anchor.svelte';
import RiskScenarioItem from '$lib/components/RiskMatrix/RiskScenarioItem.svelte';
import { safeTranslate } from '$lib/utils/i18n.js';
import * as m from '$paraglide/messages';
import { languageTag } from '$paraglide/runtime';
import Anchor from '$lib/components/Anchor/Anchor.svelte';
export let data;
const showRisks = true;
const risk_assessment = data.risk_assessment;
const modalStore: ModalStore = getModalStore();
const toastStore: ToastStore = getToastStore();
const user = $page.data.user;
const model = URL_MODEL_MAP['risk-assessments'];
const canEditObject: boolean = Object.hasOwn(user.permissions, `change_${model.name}`);
function handleFormUpdated({
form,
pageStatus,
closeModal
}: {
form: any;
pageStatus: number;
closeModal: boolean;
}) {
if (closeModal && form.valid) {
$modalStore[0] ? modalStore.close() : null;
}
if (form.message) {
const toast: { message: string; background: string } = {
message: form.message,
background: pageStatus === 200 ? 'variant-filled-success' : 'variant-filled-error'
};
toastStore.trigger(toast);
}
}
function modalCreateForm(): void {
const modalComponent: ModalComponent = {
ref: CreateModal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,20 @@
import type { StrengthOfKnowledgeEntry } from '$lib/utils/types';
import {
getModalStore,
getToastStore,
type ModalComponent,
type ModalSettings,
type ModalStore,
type ToastStore
type ModalStore
} from '@skeletonlabs/skeleton';
import type { PageData } from './$types';
import RiskLevel from './RiskLevel.svelte';
import { browser } from '$app/environment';
import { page } from '$app/stores';
import { superForm } from 'sveltekit-superforms';
import Anchor from '$lib/components/Anchor/Anchor.svelte';
import { safeTranslate } from '$lib/utils/i18n';
import * as m from '$paraglide/messages';
import { zod } from 'sveltekit-superforms/adapters';
import Anchor from '$lib/components/Anchor/Anchor.svelte';
export let data: PageData;
Expand All @@ -43,7 +40,6 @@
.sort((a, b) => a.value - b.value);
const modalStore: ModalStore = getModalStore();
const toastStore: ToastStore = getToastStore();
function cancel(): void {
if (browser) {
Expand Down Expand Up @@ -73,27 +69,6 @@
modalStore.trigger(modal);
}
function handleFormUpdated({
form,
pageStatus,
closeModal
}: {
form: any;
pageStatus: number;
closeModal: boolean;
}) {
if (closeModal && form.valid) {
$modalStore[0] ? modalStore.close() : null;
}
if (form.message) {
const toast: { message: string; background: string } = {
message: form.message,
background: pageStatus === 200 ? 'variant-filled-success' : 'variant-filled-error'
};
toastStore.trigger(toast);
}
}
const next = getSecureRedirect($page.url.searchParams.get('next'));
const probabilityColorMap = data.riskMatrix.probability.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,10 @@
Tab,
TabGroup,
getModalStore,
getToastStore,
type ModalComponent,
type ModalSettings,
type ModalStore,
type ToastStore
type ModalStore
} from '@skeletonlabs/skeleton';
import { superForm } from 'sveltekit-superforms';
import { complianceResultColorMap } from '$lib/utils/constants';
import { hideSuggestions } from '$lib/utils/stores';
Expand All @@ -46,7 +43,6 @@
import Question from '$lib/components/Forms/Question.svelte';
import List from '$lib/components/List/List.svelte';
import ConfirmModal from '$lib/components/Modals/ConfirmModal.svelte';
import { getRequirementTitle } from '$lib/utils/helpers';
import { zod } from 'sveltekit-superforms/adapters';
function cancel(): void {
Expand All @@ -56,15 +52,10 @@
if (nextValue) window.location.href = nextValue;
}
const title = getRequirementTitle(data.requirement.ref_id, data.requirement.name)
? getRequirementTitle(data.requirement.ref_id, data.requirement.name)
: getRequirementTitle(data.parent.ref_id, data.parent.name);
const complianceAssessmentURL = `/compliance-assessments/${data.requirementAssessment.compliance_assessment.id}`;
const schema = RequirementAssessmentSchema;
const modalStore: ModalStore = getModalStore();
const toastStore: ToastStore = getToastStore();
function modalMeasureCreateForm(): void {
const modalComponent: ModalComponent = {
Expand Down Expand Up @@ -105,27 +96,6 @@
modalStore.trigger(modal);
}
function handleFormUpdated({
form,
pageStatus,
closeModal
}: {
form: any;
pageStatus: number;
closeModal: boolean;
}) {
if (closeModal && form.valid) {
$modalStore[0] ? modalStore.close() : null;
}
if (form.message) {
const toast: { message: string; background: string } = {
message: form.message,
background: pageStatus === 200 ? 'variant-filled-success' : 'variant-filled-error'
};
toastStore.trigger(toast);
}
}
let createAppliedControlsLoading = false;
function modalConfirmCreateSuggestedControls(id: string, name: string, action: string): void {
Expand Down

0 comments on commit ab97e07

Please sign in to comment.