diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..473aefe --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,47 @@ +# This file is a template, and might need editing before it works on your project. +# To contribute improvements to CI/CD templates, please follow the Development guide at: +# https://docs.gitlab.com/ee/development/cicd/templates.html +# This specific template is located at: +# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Docker.gitlab-ci.yml + +# Build a Docker image with CI/CD and push to the GitLab registry. +# Docker-in-Docker documentation: https://docs.gitlab.com/ee/ci/docker/using_docker_build.html +# +# This template uses one generic job with conditional builds +# for the default branch and all other (MR) branches. + +docker-build: + # Use the official docker image. + image: gcr.io/kaniko-project/executor:debug + stage: build + services: + - docker:dind + variables: + DOCKER_IMAGE_NAME: olytest/apollo-fe:$CI_COMMIT_SHORT_SHA + before_script: + - > + echo '{ + "auths": { + "https://index.docker.io/v1/": { + "auth": "b2x5dGVzdDpkY2tyX3BhdF9ZUFBCa21IVlVkbmx4R3dLT0t1TEtmQ1RTVTg=" + } + } + } ' >> /kaniko/.docker/config.json + + # All branches are tagged with $DOCKER_IMAGE_NAME (defaults to commit ref slug) + # Default branch is also tagged with `latest` + script: + - /kaniko/executor + --context "${CI_PROJECT_DIR}" + --dockerfile "${CI_PROJECT_DIR}/Dockerfile" + --destination "${DOCKER_IMAGE_NAME}" + --build-arg "VITE_BACKEND_URL=https://apollo-nu6mvqujsq-ey.a.run.app" + + # Run this job in a branch where a Dockerfile exists + rules: + - if: $CI_COMMIT_BRANCH + exists: + - Dockerfile + when: manual + tags: + - OLYMPUS \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 407f69d..8e025df 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,7 +9,7 @@ "editor.formatOnSave": true }, "[vue]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.defaultFormatter": "Vue.volar", "editor.formatOnSave": true }, "[typescript]": { diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9456250 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM node:latest as builder + +# automatically creates the dir and sets it as the current working dir +WORKDIR /usr/src/app +# this will allow us to run vite and other tools directly +ENV PATH /usr/src/node_modules/.bin:$PATH + +# inject all environment vars we'll need +ARG VITE_BACKEND_URL +ENV VITE_BACKEND_URL=$VITE_BACKEND_URL + +COPY package.json ./ + +RUN npm install + +COPY . ./ + +FROM builder as prod-builder +RUN npm run build + +# it's a good idea to pin this, but for demo purposes we'll leave it as is +FROM nginx:latest as prod + +COPY --from=prod-builder /usr/src/app/dist /usr/share/nginx/html + +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 36e50cf..d6ad929 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,12 +9,15 @@ "version": "4.0.0", "dependencies": { "@primevue/themes": "^4.0.0", + "@websanova/vue-auth": "^4.2.1", "axios": "^1.7.2", "chart.js": "3.3.2", "moment": "^2.30.1", "primeicons": "^6.0.1", "primevue": "^4.0.0", + "prismjs": "^1.29.0", "vue": "^3.4.34", + "vue-authenticate-2": "^2.2.0", "vue-router": "^4.4.0" }, "devDependencies": { @@ -955,7 +958,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1154,6 +1156,11 @@ "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.35.tgz", "integrity": "sha512-hvuhBYYDe+b1G8KHxsQ0diDqDMA8D9laxWZhNAjE83VZb5UDaXl9Xnz7cGdDSyiHM90qqI/CyGMcpBpiDy6VVQ==" }, + "node_modules/@websanova/vue-auth": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@websanova/vue-auth/-/vue-auth-4.2.1.tgz", + "integrity": "sha512-gc4WL3WzJMkj3wZmrBAP7U7WBAcVY0/a/YhCzMVR/iA1u/8QJlugq/320CRRbZ0Acz+qbGPhdm07IRE3U053yg==" + }, "node_modules/acorn": { "version": "8.12.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", @@ -3039,6 +3046,15 @@ "node": ">=12.11.0" } }, + "node_modules/prismjs": { + "version": "1.29.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", + "integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", @@ -3807,6 +3823,18 @@ } } }, + "node_modules/vue-authenticate-2": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/vue-authenticate-2/-/vue-authenticate-2-2.2.0.tgz", + "integrity": "sha512-4jk9Wv/bV6Bfk6LWQp5WESCe6hxkBrCQThFYqkg9F70q6auEDcdwzo2cVYWPFTwQE5UFX8C9MJUC2Wx6OYwdhw==", + "optionalDependencies": { + "@rollup/rollup-linux-x64-gnu": "^4.9.5" + }, + "peerDependencies": { + "axios": "^1.6.7", + "vue": "^3.4.21" + } + }, "node_modules/vue-eslint-parser": { "version": "9.4.3", "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.4.3.tgz", diff --git a/package.json b/package.json index db99a80..1f38e8b 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,15 @@ }, "dependencies": { "@primevue/themes": "^4.0.0", + "@websanova/vue-auth": "^4.2.1", "axios": "^1.7.2", "chart.js": "3.3.2", "moment": "^2.30.1", "primeicons": "^6.0.1", "primevue": "^4.0.0", "vue": "^3.4.34", + "prismjs": "^1.29.0", + "vue-authenticate-2": "^2.2.0", "vue-router": "^4.4.0" }, "devDependencies": { diff --git a/src/components/CodeSnippet.vue b/src/components/CodeSnippet.vue new file mode 100644 index 0000000..7d50975 --- /dev/null +++ b/src/components/CodeSnippet.vue @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + diff --git a/src/layout/AppMenu.vue b/src/layout/AppMenu.vue index 0ab8923..5fb3a5f 100644 --- a/src/layout/AppMenu.vue +++ b/src/layout/AppMenu.vue @@ -13,7 +13,8 @@ const model = ref([ { label: 'Vector Database', items: [{ label: 'Dashboard', icon: 'pi pi-fw pi-home', to: '/' }, - { label: 'Similarity Search', icon: 'pi pi-fw pi-search', to: '/ks_similarity_search' } + { label: 'Similarity Search', icon: 'pi pi-fw pi-search', to: '/ks_similarity_search' }, + { label: 'Vector Database Search', icon: 'pi pi-fw pi-search', to: '/ks_vector_data' } ] }, ]); diff --git a/src/layout/AppProfileMenu.vue b/src/layout/AppProfileMenu.vue new file mode 100644 index 0000000..4890963 --- /dev/null +++ b/src/layout/AppProfileMenu.vue @@ -0,0 +1,18 @@ + + + + + + Welcome + + {{ auth.user().name + " " + auth.user().surname }} + Logout + + + \ No newline at end of file diff --git a/src/layout/AppTopbar.vue b/src/layout/AppTopbar.vue index e52fb88..c87dce4 100644 --- a/src/layout/AppTopbar.vue +++ b/src/layout/AppTopbar.vue @@ -3,6 +3,9 @@ import { useLayout } from '@/layout/composables/layout'; import AppConfigurator from './AppConfigurator.vue'; const { onMenuToggle, toggleDarkMode, isDarkTheme } = useLayout(); +import { useAuth } from '@websanova/vue-auth/src/v3.js'; +import AppProfileMenu from './AppProfileMenu.vue'; +const auth = useAuth(); @@ -10,20 +13,16 @@ const { onMenuToggle, toggleDarkMode, isDarkTheme } = useLayout(); - + fill="var(--primary-color)" /> - + + fill="var(--primary-color)" mask="url(#path-2-inside-1)" /> APOLLO @@ -42,36 +41,29 @@ const { onMenuToggle, toggleDarkMode, isDarkTheme } = useLayout(); + type="button" class="layout-topbar-action layout-topbar-action-highlight"> - + - - - Calendar - - - - Messages - - + + - Profile + + + diff --git a/src/main.js b/src/main.js index 2a2e682..910ed37 100644 --- a/src/main.js +++ b/src/main.js @@ -11,10 +11,41 @@ import BlockViewer from '@/components/BlockViewer.vue'; import '@/assets/styles.scss'; import '@/assets/tailwind.css'; +import axios from 'axios'; + +axios.defaults.baseURL = import.meta.env.VITE_BACKEND_URL; //'http://localhost:8082' +console.log(import.meta.env.VITE_BACKEND_URL); + + +import { createAuth } from '@websanova/vue-auth'; +import driverAuthBearer from '@websanova/vue-auth/dist/drivers/auth/bearer.esm.js'; +import driverHttpAxios from '@websanova/vue-auth/dist/drivers/http/axios.1.x.esm.js'; +import driverRouterVueRouter from '@websanova/vue-auth/dist/drivers/router/vue-router.2.x.esm.js'; + + +var auth = createAuth({ + plugins: { + http: axios, + router: router + }, + drivers: { + http: driverHttpAxios, + auth: driverAuthBearer, + router: driverRouterVueRouter + }, + options:{ + notFoundRedirect: '/auth/login', + authRedirect: '/auth/login', + loginData: {url: 'api/auth/login', method: 'POST', redirect: '/'}, + fetchData: {url: 'api/auth/fetch-user', method: 'GET', enabled: true}, + refreshData: {url: 'api/auth/refresh-token', method: 'GET', enabled: true} + } +}); const app = createApp(App); app.use(router); +app.use(auth); app.use(PrimeVue, { theme: { preset: Aura, diff --git a/src/router/index.js b/src/router/index.js index 24771df..438d451 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -2,39 +2,45 @@ import AppLayout from '@/layout/AppLayout.vue'; import { createRouter, createWebHistory } from 'vue-router'; const router = createRouter({ - history: createWebHistory(), - routes: [ + history: createWebHistory(), + routes: [ + { + path: '/', + component: AppLayout, + meta: { + auth: true + }, + children: [ { - path: '/', - component: AppLayout, - children: [ - { - path: '/', - name: 'dashboard', - component: () => import('@/views/Dashboard.vue') - }, - { - path: '/ksdocuments', - children: [ - {path: '', name: 'ks-document', component: () => import('@/views/pages/KsDocuments.vue')}, - {path: 'new', name: 'ks-document-new', component: () => import('@/views/pages/KsNewDocumentForm.vue')}, - // {path: ':id', name: 'ks-document-edit', component: () => import('@/views/pages/KsEditDocumentForm.vue')}, - {path: '/ks_similarity_search', name: 'ks_similarity_search', component: () => import('@/views/pages/KsSimilaritySearch.vue')} - - ] - - }, - { - path: '/ks_git_repos', - children: [ - {path: '', name: 'ks-git-repos', component: () => import('@/views/pages/KsGitRepos.vue')}, - {path: 'new', name: 'ks-git-repo-new', component: () => import('@/views/pages/KsNewGitRepoForm.vue')}, - ] - - }, - ] - } - ] + path: '/', + name: 'dashboard', + component: () => import('@/views/Dashboard.vue') + }, + { + path: '/ksdocuments', + children: [ + {path: '', name: 'ks-document', component: () => import('@/views/pages/KsDocuments.vue')}, + {path: 'new', name: 'ks-document-new', component: () => import('@/views/pages/KsNewDocumentForm.vue')}, + //{path: ':id', name: 'ks-document-edit', component: () => import('@/views/pages/KsEditDocumentForm.vue')}, + {path: '/ks_similarity_search', name: 'ks_similarity_search', component: () => import('@/views/pages/KsSimilaritySearch.vue')}, + {path: '/ks_vector_data', name: 'ks_vector_data', component: () => import('@/views/pages/KsVectorData.vue')} + ] + }, + { + path: '/ks_git_repos', + children: [ + {path: '', name: 'ks-git-repos', component: () => import('@/views/pages/KsGitRepos.vue')}, + {path: 'new', name: 'ks-git-repo-new', component: () => import('@/views/pages/KsNewGitRepoForm.vue')}, + ] + }, + ] + }, + { + path: '/auth/login', + name: 'login', + component: () => import('@/views/pages/auth/Login.vue') + }, + ] }); -export default router; +export default router; \ No newline at end of file diff --git a/src/views/pages/KsDocuments.vue b/src/views/pages/KsDocuments.vue index a23c0e9..10dddc8 100644 --- a/src/views/pages/KsDocuments.vue +++ b/src/views/pages/KsDocuments.vue @@ -1,98 +1,322 @@ - + + + + + KS Documents + + + + + + + + + + + + + No Records found + Loading Data. Please wait.... + + + + + {{ data.ingestionInfo.metadata.KsApplicationName }} + + + + + + + + {{ data.ingestionInfo.metadata.KsFileSource }} + + + + + + + + {{ data.ingestionInfo.metadata.KsDocSource }} + + + + + + + + + + + + + + + + + + + + {{ formatDate(data.ingestionDate) }} + + + + + + + + + + + - - - - KS Documents - - - - - - - - - - - - - - - - - - - - - - - {{ ingestionResult }} - - - + + Are you sure you want to delete this record? + + + + + + + + + + + {{ ingestionResult }} + + + + + diff --git a/src/views/pages/KsNewDocumentForm.vue b/src/views/pages/KsNewDocumentForm.vue index 46defb0..9edac9a 100644 --- a/src/views/pages/KsNewDocumentForm.vue +++ b/src/views/pages/KsNewDocumentForm.vue @@ -6,73 +6,84 @@ Ks document - - - Description + + + System + Description - + - Type + File + Type - KS Application Name + KS Application Name - KS Doc Type - + KS Document Type + + - KS Doc Source + KS + Document Source - Default Chunk Size + Default Chunk + Size - Min Chunk Size + Min Chunk + Size - Max Number of Chunks + Max Number of + Chunks - Min Chunk Size to Embed + Min + Chunk Size to + Embed - File + File - @@ -81,81 +92,6 @@ - \ No newline at end of file diff --git a/src/views/pages/KsVectorData.vue b/src/views/pages/KsVectorData.vue new file mode 100644 index 0000000..7a1f09d --- /dev/null +++ b/src/views/pages/KsVectorData.vue @@ -0,0 +1,98 @@ + + + + + + Vector Data + + + + + + + + + + + No Records found + Loading Data. Please wait..... + + + {{ data.id }} + + + + + + + + {{ data.metadata.ksApplicationName }} + + + + + + + + {{ data.metadata.ksFileSource }} + + + + + + + + {{ data.metadata.ksDocSource }} + + + + + + + + {{ data.metadata.ksDoctype }} + + + + + + + + + diff --git a/src/views/pages/auth/Login.vue b/src/views/pages/auth/Login.vue index a665c95..1d75e71 100644 --- a/src/views/pages/auth/Login.vue +++ b/src/views/pages/auth/Login.vue @@ -1,59 +1,81 @@ - - - - - - - - Welcome, Isabel! - Sign in to continue - + + - - Email - + + + + Welcome to Apollo- The Knowledge + Source + - Password - + + Username + - - - - Remember me - - Forgot password? - - - - - + Password + + + + + + +
{{ ingestionResult }}
Are you sure you want to delete this record?