Skip to content

Commit

Permalink
Tweaks to account for DFIQ objects
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchop committed Jan 22, 2024
1 parent ad2e66e commit 3f14706
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
9 changes: 7 additions & 2 deletions src/components/EditObject.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import axios from "axios";
import { ENTITY_TYPES } from "@/definitions/entityDefinitions.js";
import { INDICATOR_TYPES } from "@/definitions/indicatorDefinitions.js";
import { OBSERVABLE_TYPES } from "@/definitions/observableDefinitions.js";
import { DFIQ_TYPES } from "@/definitions/dfiqDefinitions.js";
import ObjectFields from "@/components/ObjectFields.vue";
import { objectTypeAnnotation } from "@babel/types";
</script>
Expand All @@ -55,7 +56,8 @@ export default {
typeToEndpointMapping: {
entity: "entities",
observable: "observables",
indicator: "indicators"
indicator: "indicators",
dfiq: "dfiq"
}
};
},
Expand All @@ -69,6 +71,8 @@ export default {
patchRequest[field.field] = this.localObject[field.field];
});
console.log(this.object);
axios
.patch(`/api/v2/${this.typeToEndpointMapping[this.object.root_type]}/${this.object.id}`, {
[this.object.root_type]: patchRequest
Expand Down Expand Up @@ -101,7 +105,8 @@ export default {
return (
ENTITY_TYPES.find(t => t.type === this.object.type) ||
INDICATOR_TYPES.find(t => t.type === this.object.type) ||
OBSERVABLE_TYPES.find(t => t.type === this.object.type)
OBSERVABLE_TYPES.find(t => t.type === this.object.type) ||
DFIQ_TYPES.find(t => t.type === this.object.type)
);
},
editableFields() {
Expand Down
14 changes: 7 additions & 7 deletions src/components/ObjectList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@
<template v-slot:item.name="{ item }">
<span class="short-links">
<v-tooltip activator="parent" location="top" :open-delay="200">{{ item.name }}</v-tooltip>
<router-link
:to="{
name: searchType === 'entities' ? 'EntityDetails' : 'IndicatorDetails',
params: { id: item.id }
}"
>{{ item.name }}</router-link
>
<router-link :to="`${searchType}/${item.id}`">{{ item.name }}</router-link>
</span>
</template>
<template v-slot:item.tags="{ item }">
Expand All @@ -37,6 +31,9 @@
<template v-slot:item.relevant_tags="{ item }">
<v-chip v-for="name in item.relevant_tags" :text="name" class="mr-1" size="small"></v-chip>
</template>
<template v-slot:item.dfiq_tags="{ item }">
<v-chip v-for="name in item.dfiq_tags" :text="name" class="mr-1" size="small"></v-chip>
</template>
<template v-slot:item.aliases="{ item }">
<v-chip v-for="value in item.aliases" :text="value" class="mr-1" size="small"></v-chip>
</template>
Expand All @@ -54,6 +51,9 @@
<template v-slot:item.created="{ item }">
{{ moment(item.created).format("YYYY-MM-DD HH:mm:ss") }}
</template>
<template v-slot:item.modified="{ item }">
{{ moment(item.modified).format("YYYY-MM-DD HH:mm:ss") }}
</template>
<template v-slot:item.last_seen="{ item }">
{{ moment(item.last_seen).format("YYYY-MM-DD HH:mm:ss") }}
</template>
Expand Down

0 comments on commit 3f14706

Please sign in to comment.