Skip to content

Commit

Permalink
Fix some code style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pablosnt committed Nov 5, 2024
1 parent 92644c1 commit 7c8458d
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 36 deletions.
1 change: 0 additions & 1 deletion src/backend/stats/framework/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from django.db.models import Count, QuerySet
from django.db.models.functions import TruncDate
from executions.models import Execution
from findings.models import Credential
from framework.models import BaseModel
from projects.models import Project
from rest_framework.serializers import PrimaryKeyRelatedField, Serializer
Expand Down
4 changes: 3 additions & 1 deletion src/frontend/components/dataset/shared-tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ function buildFiltering() {
fieldValue: "id",
fieldTitle: "name",
key: "ordering",
defaultValue: props.tabs[tab.value].defaultOrdering ? props.tabs[tab.value].defaultOrdering : '-id',
defaultValue: props.tabs[tab.value].defaultOrdering
? props.tabs[tab.value].defaultOrdering
: "-id",
},
])
.then((orderFilters) => {
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/components/finding/page/findings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const tabs = ref({
"cwe",
"osvdb",
],
defaultOrdering: '-severity'
defaultOrdering: "-severity",
},
});
</script>
73 changes: 45 additions & 28 deletions src/frontend/components/user/show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,36 @@
ref="dataset"
:api="api"
:filtering="filtering"
:add="handleMember ? ProjectMemberDialog : (smtp && smtp.is_available ? UserInvitationDialog : undefined )"
:add="
handleMember
? ProjectMemberDialog
: smtp && smtp.is_available
? UserInvitationDialog
: undefined
"
:default-parameters="project ? { project: project } : null"
@load-data="(data) => (users = data)"
>
<template #data>
<v-container v-if="smtp && !smtp.is_available" class="mb-3" fluid>
<v-row >
<v-alert

color="warning"
icon="$warning"
variant="tonal"
closable
>
<template #text>
<p>
SMTP server is not configured yet, so new users can't be invited to Rekono. You can do it in the
<v-btn
class="pa-0 text-none font-weight-bold"
density="compact"
text="Notifications page"
variant="plain"
to="/administration/notifications"
/>
</p>
</template>
</v-alert>
</v-row>
</v-container>
<v-row>
<v-alert color="warning" icon="$warning" variant="tonal" closable>
<template #text>
<p>
SMTP server is not configured yet, so new users can't be invited
to Rekono. You can do it in the
<v-btn
class="pa-0 text-none font-weight-bold"
density="compact"
text="Notifications page"
variant="plain"
to="/administration/notifications"
/>
</p>
</template>
</v-alert>
</v-row>
</v-container>
<v-row dense>
<v-col v-for="user in users" :key="user.id" cols="4">
<v-card
Expand Down Expand Up @@ -136,12 +137,26 @@
@click.stop="enableOrDisable(user)"
/>
<v-btn
v-if="enableDisable && !user.username && smtp && smtp.is_available"
v-if="
enableDisable &&
!user.username &&
smtp &&
smtp.is_available
"
color="green"
text="Resend Invitation"
variant="tonal"
block
@click.stop="api.create({}, user.id, 'resend/').then(() => alert('Invitation has been sent again', 'success'))"
@click.stop="
api
.create({}, user.id, 'resend/')
.then(() =>
alert(
'Invitation has been sent again',
'success',
),
)
"
/>
<v-dialog
v-if="handleMember"
Expand Down Expand Up @@ -252,8 +267,10 @@ const alert = useAlert();
const UserInvitationDialog = resolveComponent("UserInvitationDialog");
const ProjectMemberDialog = resolveComponent("ProjectMemberDialog");
const smtp = ref(null)
useApi("/api/smtp/", true).get(1).then((response) => smtp.value = response)
const smtp = ref(null);
useApi("/api/smtp/", true)
.get(1)
.then((response) => (smtp.value = response));
function enableOrDisable(user) {
let request = null;
Expand Down
16 changes: 13 additions & 3 deletions src/frontend/composables/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,21 +184,31 @@ export function useEnums() {
"Won't Fix": { icon: "mdi-cancel", color: "orange", dashboard: "#FF9800" },
};
const severity = {
Critical: { id: 5, color: "red", icon: "mdi-alert-circle", dashboard: "#F44336" },
Critical: {
id: 5,
color: "red",
icon: "mdi-alert-circle",
dashboard: "#F44336",
},
High: {
id: 5,
color: "orange",
icon: "mdi-arrow-up-circle",
dashboard: "#FF9800",
},
Medium: { id: 5, color: "amber", icon: "mdi-minus-circle", dashboard: "#FFC107" },
Medium: {
id: 5,
color: "amber",
icon: "mdi-minus-circle",
dashboard: "#FFC107",
},
Low: {
id: 2,
color: "indigo",
icon: "mdi-arrow-down-circle",
dashboard: "#3F51B5",
},
Info: { id: 1,color: "grey", icon: "$info", dashboard: "#9E9E9E" },
Info: { id: 1, color: "grey", icon: "$info", dashboard: "#9E9E9E" },
};

return {
Expand Down
3 changes: 1 addition & 2 deletions src/frontend/pages/projects/[project_id]/scans/[task_id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@
<div
v-intersect="
(isIntersecting, entries, observer) =>
isIntersecting &&
executions[stage].length % 24 === 0
isIntersecting && executions[stage].length % 24 === 0
? loadExecutions(
true,
stage,
Expand Down

0 comments on commit 7c8458d

Please sign in to comment.