Skip to content

Commit 923cf69

Browse files
Add VisualQnA UI (#572)
* update VisualQnA front_end Signed-off-by: Yue, Wenjiao <wenjiao.yue@intel.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update ViualQnA into the ui folder Signed-off-by: Yue, Wenjiao <wenjiao.yue@intel.com> * Add dockerFile Signed-off-by: Yue, Wenjiao <wenjiao.yue@intel.com> --------- Signed-off-by: Yue, Wenjiao <wenjiao.yue@intel.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 7a67298 commit 923cf69

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1971
-0
lines changed

VisualQnA/docker/ui/docker/Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Use node 20.11.1 as the base image
5+
FROM node:20.11.1
6+
7+
# Update package manager and install Git
8+
RUN apt-get update -y && apt-get install -y git
9+
10+
# Copy the front-end code repository
11+
COPY svelte /home/user/svelte
12+
13+
# Set the working directory
14+
WORKDIR /home/user/svelte
15+
16+
# Install front-end dependencies
17+
RUN npm install
18+
19+
# Build the front-end application
20+
RUN npm run build
21+
22+
# Expose the port of the front-end application
23+
EXPOSE 5173
24+
25+
# Run the front-end application in preview mode
26+
CMD ["npm", "run", "preview", "--", "--port", "5173", "--host", "0.0.0.0"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[*]
2+
indent_style = tab
3+
4+
[package.json]
5+
indent_style = space
6+
indent_size = 2
7+
8+
[*.md]
9+
indent_style = space
10+
indent_size = 2

VisualQnA/docker/ui/svelte/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BACKEND_BASE_URL = 'http://backend_address:8888/v1/visualqna'
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.DS_Store
2+
node_modules
3+
/build
4+
/.svelte-kit
5+
/package
6+
.env
7+
.env.*
8+
!.env.example
9+
10+
# Ignore files for PNPM, NPM and YARN
11+
pnpm-lock.yaml
12+
package-lock.json
13+
yarn.lock
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright (c) 2024 Intel Corporation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
module.exports = {
16+
root: true,
17+
parser: "@typescript-eslint/parser",
18+
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
19+
plugins: ["svelte3", "@typescript-eslint", "neverthrow"],
20+
ignorePatterns: ["*.cjs"],
21+
overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }],
22+
settings: {
23+
"svelte3/typescript": () => require("typescript"),
24+
},
25+
parserOptions: {
26+
sourceType: "module",
27+
ecmaVersion: 2020,
28+
},
29+
env: {
30+
browser: true,
31+
es2017: true,
32+
node: true,
33+
},
34+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.DS_Store
2+
node_modules
3+
/build
4+
/.svelte-kit
5+
/package
6+
.env
7+
.env.*
8+
!.env.example
9+
10+
# Ignore files for PNPM, NPM and YARN
11+
pnpm-lock.yaml
12+
package-lock.json
13+
yarn.lock
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"pluginSearchDirs": ["."], "overrides": [{"files": "*.svelte", "options": {"parser": "svelte"}}]}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"name": "sveltekit-auth-example",
3+
"version": "0.0.1",
4+
"private": true,
5+
"scripts": {
6+
"dev": "vite dev",
7+
"build": "vite build",
8+
"preview": "vite preview",
9+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
10+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
11+
"lint": "prettier --check . && eslint .",
12+
"format": "prettier --write ."
13+
},
14+
"devDependencies": {
15+
"@fortawesome/free-solid-svg-icons": "6.2.0",
16+
"@playwright/test": "^1.45.2",
17+
"@sveltejs/adapter-auto": "1.0.0-next.75",
18+
"@sveltejs/kit": "^1.30.4",
19+
"@tailwindcss/typography": "0.5.7",
20+
"@types/debug": "4.1.7",
21+
"@typescript-eslint/eslint-plugin": "^5.27.0",
22+
"@typescript-eslint/parser": "^5.27.0",
23+
"autoprefixer": "^10.4.7",
24+
"daisyui": "3.5.1",
25+
"date-picker-svelte": "^2.6.0",
26+
"debug": "4.3.4",
27+
"eslint": "^8.16.0",
28+
"eslint-config-prettier": "^8.3.0",
29+
"eslint-plugin-neverthrow": "1.1.4",
30+
"eslint-plugin-svelte3": "^4.0.0",
31+
"postcss": "^8.4.31",
32+
"postcss-load-config": "^4.0.1",
33+
"postcss-preset-env": "^8.3.2",
34+
"prettier": "^2.8.8",
35+
"prettier-plugin-svelte": "^2.7.0",
36+
"prettier-plugin-tailwindcss": "^0.3.0",
37+
"svelte": "^3.59.1",
38+
"svelte-check": "^2.7.1",
39+
"svelte-fa": "3.0.3",
40+
"svelte-preprocess": "^4.10.7",
41+
"tailwindcss": "^3.1.5",
42+
"tslib": "^2.3.1",
43+
"typescript": "^4.7.4",
44+
"vite": "^4.5.2"
45+
},
46+
"type": "module",
47+
"dependencies": {
48+
"date-fns": "^2.30.0",
49+
"driver.js": "^1.3.0",
50+
"flowbite-svelte": "^0.38.5",
51+
"flowbite-svelte-icons": "^1.4.0",
52+
"fuse.js": "^6.6.2",
53+
"lodash": "^4.17.21",
54+
"ramda": "^0.29.0",
55+
"sse.js": "^0.6.1",
56+
"svelte-notifications": "^0.9.98",
57+
"svrollbar": "^0.12.0"
58+
}
59+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright (C) 2024 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
import { defineConfig, devices } from "@playwright/test";
5+
6+
/**
7+
* Read environment variables from file.
8+
* https://github.com/motdotla/dotenv
9+
*/
10+
// require('dotenv').config();
11+
12+
/**
13+
* See https://playwright.dev/docs/test-configuration.
14+
*/
15+
export default defineConfig({
16+
testDir: "./tests",
17+
/* Maximum time one test can run for. */
18+
timeout: 30 * 1000,
19+
expect: {
20+
/**
21+
* Maximum time expect() should wait for the condition to be met.
22+
* For example in `await expect(locator).toHaveText();`
23+
*/
24+
timeout: 5000,
25+
},
26+
/* Run tests in files in parallel */
27+
fullyParallel: true,
28+
/* Fail the build on CI if you accidentally left test.only in the source code. */
29+
forbidOnly: !!process.env.CI,
30+
/* Retry on CI only */
31+
retries: process.env.CI ? 2 : 0,
32+
/* Opt out of parallel tests on CI. */
33+
workers: process.env.CI ? 1 : undefined,
34+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
35+
reporter: [["html", { open: "never" }]],
36+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
37+
use: {
38+
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
39+
actionTimeout: 0,
40+
/* Base URL to use in actions like `await page.goto('/')`. */
41+
baseURL: "http://localhost:5173",
42+
43+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
44+
trace: "on-first-retry",
45+
},
46+
47+
/* Configure projects for major browsers */
48+
projects: [
49+
{
50+
name: "webkit",
51+
use: { ...devices["Desktop Safari"] },
52+
},
53+
],
54+
});
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright (c) 2024 Intel Corporation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
const tailwindcss = require("tailwindcss");
16+
const autoprefixer = require("autoprefixer");
17+
18+
const config = {
19+
plugins: [
20+
//Some plugins, like tailwindcss/nesting, need to run before Tailwind,
21+
tailwindcss(),
22+
//But others, like autoprefixer, need to run after,
23+
autoprefixer,
24+
],
25+
};
26+
27+
module.exports = config;

0 commit comments

Comments
 (0)