Skip to content

Commit

Permalink
feat: Rename folder and handle the Upper/Lowercase ++ add more doc on…
Browse files Browse the repository at this point in the history
… the data folder
  • Loading branch information
batleforc committed Sep 6, 2024
1 parent 038827b commit 2c10e79
Show file tree
Hide file tree
Showing 41 changed files with 182 additions and 71 deletions.
2 changes: 1 addition & 1 deletion apps/back/src/api/page/get_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub async fn get_page(
if info.path.is_empty() {
return HttpResponse::NotFound().finish();
}
if let Some(page) = db_folder.get_page_in_sub_folder_by_path(info.path.clone()) {
if let Some(page) = db_folder.get_page_in_sub_folder_by_path(info.path.clone().to_lowercase()) {
return HttpResponse::Ok().json(page);
} else {
return HttpResponse::NotFound().finish();
Expand Down
112 changes: 56 additions & 56 deletions apps/front/src/component/Doc/DocSidebarItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,108 +4,108 @@ import { computed, ref } from 'vue';
import IcoMoonSVG from '../helper/IcoMoonSVG.vue';
const props = defineProps<{
docContent: DocCategory;
path: Array<string>;
docContent: DocCategory;
path: Array<string>;
}>();
const pageFiltered = computed(() => {
return props.docContent.pages.filter(page => page.name !== 'index');
return props.docContent.pages.filter(page => page.name !== 'index');
});
const hasContent = computed(() => {
return pageFiltered.value.length > 0 || props.docContent.sub_categories.length > 0;
return pageFiltered.value.length > 0 || props.docContent.sub_categories.length > 0;
});
const fromOpen = computed(() => {
return props.path.length > 0 && props.docContent.name === props.path[0];
return props.path.length > 0 && props.docContent.name === props.path[0];
});
const pathToChild = computed(() => {
if (fromOpen.value) {
return props.path.slice(1);
}
return [];
if (fromOpen.value) {
return props.path.slice(1);
}
return [];
});
const pathIndex = computed(() => {
if (!props.docContent.has_index) {
return [];
}
return props.docContent.pages.find(page => page.name === 'index').path.split('/').filter(path => path !== 'index');
if (!props.docContent.has_index) {
return [];
}
return props.docContent.pages.find(page => page.name === 'index').path.split('/').filter(path => path !== 'index');
});
const sidebarOpen = ref(fromOpen.value);
</script>

<template>
<div class="docSidebarItem">
<p @click="sidebarOpen = !sidebarOpen" class="docSidebarTitle docSidebarContentItem">
<template v-if="!props.docContent.has_index">
{{ props.docContent.name }}
</template>
<RouterLink v-else :to="{ name: 'doccontent', params: { page: pathIndex } }">
{{ props.docContent.name }}
</RouterLink>

<IcoMoonSVG v-if="hasContent" :class="sidebarOpen ? 'docSidebarOpen' : ''" class="docSidebarTitleChevron"
icon="chevron-down" />
</p>
<div :class="sidebarOpen ? 'docSidebarOpen' : ''" class="docSidebarContent">
<RouterLink class="docSidebarContentItem" v-for="page in pageFiltered" :key="page.name"
:to="{ name: 'doccontent', params: { page: page.path.split('/') } }">
{{ page.name }}
</RouterLink>
<div v-if="props.docContent.sub_categories.length > 0" class="docSidebarSubItem">
<DocSidebarItem :path="pathToChild" v-for="categorie in props.docContent.sub_categories"
v-bind:key="categorie.name" :docContent="categorie" />
</div>
</div>

<div class="docSidebarItem">
<p @click="sidebarOpen = !sidebarOpen" class="docSidebarTitle docSidebarContentItem">
<template v-if="!props.docContent.has_index">
{{ props.docContent.name }}
</template>
<RouterLink v-else :to="{ name: 'doccontent', params: { page: pathIndex } }">
{{ props.docContent.name }}
</RouterLink>

<IcoMoonSVG v-if="hasContent" :class="sidebarOpen ? 'docSidebarOpen' : ''" class="docSidebarTitleChevron"
icon="chevron-down" />
</p>
<div :class="sidebarOpen ? 'docSidebarOpen' : ''" class="docSidebarContent">
<RouterLink class="docSidebarContentItem" v-for="page in pageFiltered" :key="page.name"
:to="{ name: 'doccontent', params: { page: page.path.split('/') } }">
{{ page.metadata.title }}
</RouterLink>
<div v-if="props.docContent.sub_categories.length > 0" class="docSidebarSubItem">
<DocSidebarItem :path="pathToChild" v-for="categorie in props.docContent.sub_categories"
v-bind:key="categorie.name" :docContent="categorie" />
</div>
</div>

</div>
</template>

<style lang="scss">
@import "../../var.scss";
.docSidebarTitle {
@apply cursor-pointer flex justify-between;
@apply cursor-pointer flex justify-between;
}
.docSidebarContentItem {
@apply cursor-pointer p-1;
@apply cursor-pointer p-1;
&:hover {
background-color: $color-bgCoverLighter;
}
&:hover {
background-color: $color-bgCoverLighter;
}
}
.docSidebarOpen.docSidebarTitleChevron {
transform: rotate(0deg);
transform: rotate(0deg);
}
.docSidebarTitleChevron {
transform: rotate(-90deg);
transition: .3s ease;
transform: rotate(-90deg);
transition: .3s ease;
}
.docSidebarContent {
@apply overflow-hidden opacity-0 h-0 pl-2;
display: none;
animation: dropdown 200ms linear forwards;
@apply overflow-hidden opacity-0 h-0 pl-2;
display: none;
animation: dropdown 200ms linear forwards;
&.docSidebarOpen {
@apply flex flex-col opacity-100 h-fit;
}
&.docSidebarOpen {
@apply flex flex-col opacity-100 h-fit;
}
}
@keyframes dropdown {
0% {
transform: scaleY(0);
}
0% {
transform: scaleY(0);
}
100% {
transform: scaleY(1)
}
100% {
transform: scaleY(1)
}
}
</style>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions folio_content/content/Techno/Data/Bucket/MinIO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
date: 2024-07-16T22:51:00Z
title: "MinIO"
description: "MinIO - The S3 compatible object storage"
spec:
blog: false
project: false
doc: true
links:
- name: "MinIO"
url: "https://min.io/"
techno:
- "Storage"
- "Object"
tags:
- "Storage"
- "Object"
---

## MinIO

MinIO is an object storage server, it's compatible with Amazon S3 cloud storage service. It's a good alternative to Amazon S3.

MinIO is my go to object storage server, it's easy to use and to self-host.
24 changes: 24 additions & 0 deletions folio_content/content/Techno/Data/DataBase/MariaDB.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
date: 2024-07-16T22:51:00Z
title: "MariaDB"
description: "MariaDB - The SQL database"
spec:
blog: false
project: false
doc: true
links:
- name: "MariaDB"
url: "https://mariadb.org/"
techno:
- "SQL"
- "DataBase"
tags:
- "SQL"
- "DataBase"
---

## MariaDB

MariaDB is a SQL database, it was a fork of MySQL. Well with enough new feature and evolution over time we can say that it's now a different database with layer of compatbiility with MySQL.

I've used MariaDB for a long time, it's a pretty good database, it's easy to use and to maintain. It's a good database for small to medium project, for big project i would recommend to use PostgreSQL.
24 changes: 24 additions & 0 deletions folio_content/content/Techno/Data/DataBase/MongoDB.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
date: 2024-07-16T22:51:00Z
title: "MongoDB"
description: "MongoDB - The NoSQL database"
spec:
blog: false
project: false
doc: true
links:
- name: "MongoDB"
url: "https://www.mongodb.com/"
techno:
- "NoSQL"
- "DataBase"
tags:
- "NoSQL"
- "DataBase"
---

## MongoDB

MongoDB is a NoSQL database, a document-oriented database.

I've used MongoDB for a long time, it's a pretty good database in the NoSQL world, it's easy to use and to maintain.
24 changes: 24 additions & 0 deletions folio_content/content/Techno/Data/DataBase/PostgreSQL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
date: 2024-07-16T22:51:00Z
title: "PostgreSQL"
description: "PostgreSQL - The SQL database"
spec:
blog: false
project: false
doc: true
links:
- name: "PostgreSQL"
url: "https://www.postgresql.org/"
techno:
- "SQL"
- "DataBase"
tags:
- "SQL"
- "DataBase"
---

## PostgreSQL

PostgreSQL is a SQL database, it's a powerful database, it's a good database for small to big project. It's easy to use and to maintain.

For my own project, even small one. I tend to choose PostgreSQL when i need a SQL database.
22 changes: 22 additions & 0 deletions folio_content/content/Techno/Data/Event/Kafka.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
date: 2024-07-16T22:51:00Z
title: "Kafka"
description: "Kafka - The event streaming platform"
spec:
blog: false
project: false
doc: true
links:
- name: "Kafka"
url: "https://kafka.apache.org/"
techno:
- "Event"
- "Streaming"
tags:
- "Event"
- "Streaming"
---

## Kafka

Kafka is an event streaming platform, it's a distributed streaming platform. It's a good platform for building real-time data pipelines and streaming applications.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
date: 2024-07-16T22:51:00Z
title: "argocd"
title: "ArgoCD"
description: "ArgoCD - Declarative GitOps CD for Kubernetes"
spec:
blog: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
date: 2024-07-16T22:51:00Z
title: "microk8s"
title: "Microk8s"
description: "MicroK8S - Canonical Kubernetes"
spec:
blog: false
Expand Down
File renamed without changes.
10 changes: 0 additions & 10 deletions folio_content/content/techno/data/index.md

This file was deleted.

7 changes: 5 additions & 2 deletions libs/back/markdown_struct/src/page_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ impl DbFolder {
}

pub fn add_sub_folder(&mut self, folder: DbFolder) {
self.sub_folders.insert(folder.name.clone(), folder);
self.sub_folders
.insert(folder.name.clone().to_lowercase(), folder);
}

pub fn get_page(&self, name: &str) -> Option<&Page> {
self.pages.iter().find(|p| p.name == name)
self.pages
.iter()
.find(|p| p.name.to_lowercase() == name.to_lowercase())
}

pub fn get_page_in_sub_folder_by_path(&self, path: String) -> Option<&Page> {
Expand Down

0 comments on commit 2c10e79

Please sign in to comment.