Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"scripts": {
"build": "node --max_old_space_size=8192 ./node_modules/vuepress/bin/vuepress.js build src",
"check-links": "node --max_old_space_size=8192 ./node_modules/vuepress/bin/vuepress.js build src -c ./src/.vuepress/config_check_links.ts",
"check-links": "node --max_old_space_size=8192 ./node_modules/vuepress/bin/vuepress.js build src",
"clean-dev": "vuepress dev src --clean-cache",
"dev": "vuepress dev src",
"update-package": "npx vp-update",
Expand All @@ -23,14 +23,14 @@
"dependencies": {
"@vuepress/bundler-vite": "2.0.0-rc.19",
"@vuepress/helper": "2.0.0-rc.66",
"@vuepress/plugin-docsearch": "2.0.0-rc.67",
"@vuepress/plugin-links-check": "2.0.0-rc.68",
"@vuepress/plugin-docsearch": "2.0.0-rc.76",
"@vuepress/plugin-links-check": "2.0.0-rc.74",
"mathjax-full": "3.2.2",
"sass-embedded": "1.83.0",
"vue": "3.5.13",
"vue": "^3.5.13",
"vue3-carousel": "0.9.0",
"vuepress": "2.0.0-rc.19",
"vuepress-theme-hope": "2.0.0-rc.66"
"vuepress-theme-hope": "2.0.0-rc.71"
},
"devDependencies": {
"@eslint/js": "9.17.0",
Expand Down
2,173 changes: 1,079 additions & 1,094 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

91 changes: 91 additions & 0 deletions src/.vuepress/components/Sidevar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<template>
<Sidebar>
<template #top>
<div class="sidebar-top-wrapper">
<ul class="switch-list" v-if="currentDialect">
<li
:class="['switch-type', { 'switch-active': currentDialect === 'Tree' }]"
@click="handleChangeDialect('Tree')">Tree
</li>
<li
:class="['switch-type', { 'switch-active': currentDialect === 'Table' }]"
@click="handleChangeDialect('Table')">Table
</li>
</ul>
</div>
</template>
</Sidebar>
</template>

<script setup lang="ts">
import Sidebar from 'vuepress-theme-hope/modules/sidebar/components/Sidebar.js';
import { ref, watch } from 'vue';
import { useRoute } from 'vuepress/client';
import { getDialect, getDocVersion } from '../utils/index.js';

const route = useRoute();
const currentLang = ref('zh');
const currentVersion = ref('');
const currentDialect = ref('');

function handleChangeDialect(val: string) {
const oldPath = 'latest';
const newPath = 'latest-Table';
if(currentDialect.value ==='Table'){
window.location.href = window.location.href.replace(newPath, oldPath);
} else {
window.location.href = window.location.href.replace(oldPath, newPath);
}
// window.location.href = `${window.location.origin}/docs${currentLang.value === 'zh' ? currentVersion.value.link : currentVersion.value.enLink}`.replace(currentDialect.value, val);
}


watch(
() => route.path,
(newVal) => {
const allPath: string[] = newVal?.split('/');
if (allPath && allPath.length > 2) {
if (allPath[1] === 'zh') {
currentLang.value = 'zh';
} else {
currentLang.value = 'en';
}
currentVersion.value = getDocVersion(newVal,'latest');
currentDialect.value = getDialect(newVal,'');
}
},
{ immediate: true },
);
</script>

<style lang="scss">
.vp-sidebar > .vp-sidebar-links {
padding: 1rem 0;
}
.switch-list {
display: flex;
width: 100px;
margin-right: 12px;
border-radius: 14px;
background-color: #f0f1fa;
list-style-type: none;
padding: 4px;
margin: 0;
margin-top: 1rem;

.switch-type {
padding: 3px 9px;
cursor: pointer;
border-radius: 14px;
background-color: transparent;
font-size: 14px;
line-height: 18px;
color: #656a85;
}

.switch-active {
background-color: #495ad4;
color: #fff;
}
}
</style>
4 changes: 4 additions & 0 deletions src/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ _paq.push(['enableLinkTracking']);
dirname,
'./components/PageFooter.vue',
),
'@theme-hope/modules/sidebar/components/Sidebar': path.resolve(
dirname,
'./components/Sidevar.vue',
),
},
bundler: viteBundler({
vuePluginOptions: {
Expand Down
2 changes: 1 addition & 1 deletion src/.vuepress/navbar/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const enNavbar = navbar([
{
text: 'Documentation',
children: [
// { text: 'latest', link: '/UserGuide/Master/QuickStart/QuickStart_apache' },
{ text: 'v2.0.1', link: '/UserGuide/latest/QuickStart/QuickStart_apache' },
{
text: 'v1.3.3',
link: '/UserGuide/V1.3.3/QuickStart/QuickStart_apache',
Expand Down
2 changes: 1 addition & 1 deletion src/.vuepress/navbar/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const zhNavbar = navbar([
// { text: 'latest', link: '/zh/UserGuide/Master/QuickStart/QuickStart_apache' },
{
text: 'v2.0.1',
link: 'src/zh/UserGuide/latest/QuickStart/QuickStart_apache',
link: '/zh/UserGuide/latest/QuickStart/QuickStart_apache',
},
{
text: 'v1.3.3',
Expand Down
4 changes: 2 additions & 2 deletions src/.vuepress/sidebar/V2.0.1/zh-Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
*/

export const zhSidebar = {
'/zh/UserGuide/V2.0.1-Table/': [
'/zh/UserGuide/latest-Table/': [
{
text: 'IoTDB用户手册',
text: 'IoTDB用户手册(V2.0.1)',
children: [],
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/.vuepress/sidebar/V2.0.1/zh-Tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
export const zhSidebar = {
'/zh/UserGuide/latest/': [
{
text: 'IoTDB用户手册',
text: 'IoTDB用户手册(V2.0.1)',
children: [],
},
{
Expand Down
2 changes: 2 additions & 0 deletions src/.vuepress/sidebar/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
*/

import { sidebar } from 'vuepress-theme-hope';
import { enSidebar as V201xSidebar } from './V2.0.1/en.js';
import { enSidebar as V103xSidebar } from './V1.3.3/en.js';
import { enSidebar as V1030Sidebar } from './V1.3.0-2/en.js';
import { enSidebar as V102xSidebar } from './V1.2.x/en.js';
import { enSidebar as V013xSidebar } from './V0.13.x/en.js';

export const enSidebar = sidebar({
...V201xSidebar,
...V103xSidebar,
...V1030Sidebar,
...V102xSidebar,
Expand Down
2 changes: 1 addition & 1 deletion src/.vuepress/sidebar_timecho/V2.0.1/zh-Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

export const zhSidebar = {
'/zh/UserGuide/V2.0.1-Table/': [
'/zh/UserGuide/latest-Table/': [
{
text: 'IoTDB用户手册',
children: [],
Expand Down
4 changes: 4 additions & 0 deletions src/.vuepress/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import { hopeTheme } from 'vuepress-theme-hope';
import { enNavbar, zhNavbar } from './navbar/index.js';
import { enSidebar, zhSidebar } from './sidebar/index.js';
import { error } from 'vuepress/utils';

export default hopeTheme(
{
Expand Down Expand Up @@ -86,6 +87,9 @@ export default hopeTheme(
gfm: true,
imgLazyload: true,
math: true,
linksCheck: {
build: 'error',
},
highlighter: {
type: 'shiki',
theme: 'one-dark-pro',
Expand Down
23 changes: 23 additions & 0 deletions src/.vuepress/utils/getDocVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

const VERSION_REG = /UserGuide\/([^/]+)/;
const URL_REG = /UserGuide\/([^/]+)\/([^/]+)/;

export const getDocVersion = (path = '', defaultValue = 'latest') => {
if (path.includes('UserGuide/Master') || !path.includes('UserGuide')) {
Expand All @@ -32,3 +33,25 @@ export const getDocVersion = (path = '', defaultValue = 'latest') => {

return VERSION_REG.exec(path)?.[1] ?? defaultValue;
};

export const getDialect = (path = '', defaultValue = '') => {
if (path.includes('UserGuide/Master') || !path.includes('UserGuide')) {
return defaultValue;
}
/**
* 路径 /zh/UserGuide/V1.3.0-2/QuickStart/QuickStart_apache.html, 匹配 QuickStart
* 路径 /zh/UserGuide/V1.2.x/QuickStart/QuickStart_apache.html, 匹配 QuickStart
* 路径 /zh/UserGuide/latest-Table/QuickStart/QuickStart_apache.html, 匹配 Table
* 路径 /zh/UserGuide/latest/QuickStart/QuickStart_apache.html, 匹配 Tree
*
* 匹配路径中的版本号,UserGuide 后面的版本号为当前文档的版本号, 版本号不一定为数字,可能为 latest或其它,因此只用 / 作为分隔符
*/
const docVersion = getDocVersion(path);
if (docVersion === 'latest' || docVersion.includes('-Tree')) {
return 'Tree';
}
if (docVersion.includes('-Table')) {
return 'Table';
}
return defaultValue;
};
22 changes: 22 additions & 0 deletions src/UserGuide/latest-Table/QuickStart/QuickStart_timecho.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.

-->

# Comming Soon