Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Dud committed Jan 17, 2024
1 parent 8e6293f commit 0fb45e5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,15 @@
<script setup lang="ts">
import { computed, ref } from "vue";
import { useI18n } from "vue-i18n";
import ContextureAccordionItem from "~/components/primitives/accordion/ContextureAccordionItem.vue";
import ContexturePrimaryButton from "~/components/primitives/button/ContexturePrimaryButton.vue";
import ContextureTextLinkButton from "~/components/primitives/button/ContextureTextLinkButton.vue";
import ContextureWhiteButton from "~/components/primitives/button/ContextureWhiteButton.vue";
import ContextureInputText from "~/components/primitives/input/ContextureInputText.vue";
import ContextureListItem from "~/components/primitives/list/ContextureListItem.vue";
import { useAuthStore } from "~/stores/auth";
import { CreateNamespaceLabel, Namespace, NamespaceLabel } from "~/types/namespace";
import NamespaceValueAutocomplete from "~/components/bounded-context/namespace/NamespaceValueAutocomplete.vue";
import NamespaceLabelAutocomplete from "~/components/bounded-context/namespace/NamespaceLabelAutocomplete.vue";
import { useAuthStore } from "~/stores/auth";
import { CreateNamespaceLabel, Namespace, NamespaceLabel } from "~/types/namespace";
interface Props {
namespace: Namespace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const fuseOptions: IFuseOptions<string> = {
keys: ["name"],
};
const { labelNames } = storeToRefs(useNamespaces());
const { labelNames } = storeToRefs(useNamespaces());
const { t } = useI18n();
const suggestions = ref(labelNames.value);
const fuse = new Fuse(labelNames.value, fuseOptions);
Expand All @@ -45,7 +45,7 @@ const inputText = ref("");
const searchKeySuggestions = (query: string) => {
if (!query) {
suggestions.value = labelNames.value
suggestions.value = labelNames.value;
model.value = undefined;
return;
}
Expand All @@ -57,6 +57,5 @@ const searchKeySuggestions = (query: string) => {
suggestions.value = results.map((result: { item: string }) => {
return result.item;
});
};
</script>
2 changes: 1 addition & 1 deletion frontend-vue/src/stores/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const useAuthStore = defineStore("auth", () => {
async function fetchUserInfo() {
const user = await userManager.getUser();

const { data, error } = await useFetch<UserInfo>("/meta/userInfo", {
const { data } = await useFetch<UserInfo>("/meta/userInfo", {
headers: {
Authorization: `Bearer ${user?.access_token}`,
},
Expand Down
31 changes: 18 additions & 13 deletions frontend-vue/src/stores/namespaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,10 @@ export const useNamespaces = defineStore("namespaces", () => {
if (!error.value) {
activeBoundedContext.value!.namespaces = data.value || [];

const namespace = data.value?.find(n=> n.id === namespaceId);
if(namespace)
{
const idx = namespaces.value.findIndex(n=> n.id == namespace.id);
const updatedNamespaces = [... namespaces.value];
const namespace = data.value?.find((n) => n.id === namespaceId);
if (namespace) {
const idx = namespaces.value.findIndex((n) => n.id == namespace.id);
const updatedNamespaces = [...namespaces.value];
updatedNamespaces[idx] = namespace;
namespaces.value = updatedNamespaces;
}
Expand All @@ -106,11 +105,10 @@ export const useNamespaces = defineStore("namespaces", () => {
if (!error.value) {
activeBoundedContext.value!.namespaces = data.value || [];

const namespace = data.value?.find(n=> n.id === namespaceId);
if(namespace)
{
const idx = namespaces.value.findIndex(n=> n.id == namespace.id);
const updatedNamespaces = [... namespaces.value];
const namespace = data.value?.find((n) => n.id === namespaceId);
if (namespace) {
const idx = namespaces.value.findIndex((n) => n.id == namespace.id);
const updatedNamespaces = [...namespaces.value];
updatedNamespaces[idx] = namespace;
namespaces.value = updatedNamespaces;
}
Expand All @@ -136,9 +134,16 @@ export const useNamespaces = defineStore("namespaces", () => {
}, {});
});

const labelNames = computed<string[]>(()=>{
return [... new Set(namespaces.value.map(n=> n.labels).flat().map(l=> l.name))];
})
const labelNames = computed<string[]>(() => {
return [
...new Set(
namespaces.value
.map((n) => n.labels)
.flat()
.map((l) => l.name)
),
];
});

const namespaceLabelValuesByLabelName = computed<{
[name: string]: string[];
Expand Down

0 comments on commit 0fb45e5

Please sign in to comment.