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
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ VUE_APP_I18N_LOCALE=zh-CN
VUE_APP_I18N_FALLBACK_LOCALE=en-US
VUE_APP_ROUTER_BASE_PATH=/
VUE_APP_PUBLIC_BASE_PATH=/
VUE_APP_API_URL=
VUE_APP_API_URL=https://10.29.26.43:6443
VUE_APP_AUTH=eyJhbGciOiJSUzI1NiIsImtpZCI6InBhOS1DUFJVTG9KTHItUTVPODhWTHBkc2lndFpsSUUyNkF2dUliRWxUNDAifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjoxNzI5MzA0NTIyLCJpYXQiOjE2OTc3Njg1MjIsImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJkYXRhdHVuZXJ4Iiwic2VydmljZWFjY291bnQiOnsibmFtZSI6Im5zYWRtaW4iLCJ1aWQiOiI2N2FmMDNjZS1iYWJiLTRiNGUtYTNlNy01NzgxMmE5Y2Y5OGEifX0sIm5iZiI6MTY5Nzc2ODUyMiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50OmRhdGF0dW5lcng6bnNhZG1pbiJ9.Q0j1YgBmFOztDPu2usYh9Sqqr8hGmwHC0yqkA4haoWblkwzb1KHZ7hbetWYmuWbyRdOKSsY7hHuMBLlhFgttF4C7OspovaI3UKGLWqnvENF9oK1_k9tm9cKt3LNnvCrSTXBxPWdyRvCMp71QtEvOt0J86iugG_JnUlW7FZswI2YUMohAAOfzxEXUztZj9doS_UTgilluhOfMaP-qe9H8okDWH5T57wDcFJir2O6bLVDkdWeDkIlINEGtJZRGOjFUPzIoXn1nnY3l32TE8kRYyci6od8RG6Z6Kz30QuwoYx04lW9Vu5ac9wznqxfN6r2jbViL_n30HUp3iHENk65bPA
155 changes: 82 additions & 73 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
const path = require('path');
const path = require("path");

const vuejsAccessibilityOff = Object.keys(
require(path.resolve(path.dirname(require.resolve('eslint-plugin-vuejs-accessibility')), '../dist/index')).rules,
require(path.resolve(
path.dirname(require.resolve("eslint-plugin-vuejs-accessibility")),
"../dist/index"
)).rules
).reduce((rules, rule) => {
rules[`vuejs-accessibility/${rule}`] = 0;

Expand All @@ -16,70 +19,69 @@ module.exports = {
jest: true,
browser: true,
},
parser: 'vue-eslint-parser',
parser: "vue-eslint-parser",
parserOptions: {
ecmaVersion: 2020,
parser: '@typescript-eslint/parser',
sourceType: 'module',
extraFileExtensions: ['.vue'],
parser: "@typescript-eslint/parser",
sourceType: "module",
extraFileExtensions: [".vue"],
},
plugins: ['vue', '@typescript-eslint'],
plugins: ["vue", "@typescript-eslint"],
extends: [
'plugin:jsonc/recommended-with-json',
'plugin:vue/vue3-recommended',
'@vue/airbnb',
'@vue/typescript/recommended',
"plugin:jsonc/recommended-with-json",
"plugin:vue/vue3-recommended",
"@vue/airbnb",
"@vue/typescript/recommended",
],
rules: {
"jsonc/indent": ["error", 2],
'@typescript-eslint/padding-line-between-statements': [
'error',
"@typescript-eslint/padding-line-between-statements": [
"error",
{
blankLine: 'always',
prev: ['interface', 'type'],
next: '*',
blankLine: "always",
prev: ["interface", "type"],
next: "*",
},
],
'padding-line-between-statements': [
'error',
"padding-line-between-statements": [
"error",
{
blankLine: 'always',
prev: ['const', 'let', 'var'],
next: '*',
blankLine: "always",
prev: ["const", "let", "var"],
next: "*",
},
{
blankLine: 'any',
prev: ['const', 'let', 'var'],
next: ['const', 'let', 'var'],
blankLine: "any",
prev: ["const", "let", "var"],
next: ["const", "let", "var"],
},
{
blankLine: 'always',
prev: '*',
next: 'return',
blankLine: "always",
prev: "*",
next: "return",
},
{
blankLine: 'always',
prev: '*',
next: 'function',
blankLine: "always",
prev: "*",
next: "function",
},
],
'brace-style': ['error', '1tbs', { allowSingleLine: false }],
'eol-last': ['error', 'always'],
'comma-spacing': [
'error',
"brace-style": ["error", "1tbs", { allowSingleLine: false }],
"eol-last": ["error", "always"],
"comma-spacing": [
"error",
{
before: false,
after: true,
},
],
quotes: ['error', 'single'],
'jsx-quotes': ['error', 'prefer-double'],
'vue/html-quotes': ['error', 'double', { avoidEscape: true }],
'max-statements-per-line': ['error', { max: 1 }],
'vue/multiline-html-element-content-newline': ['error'], // 多行html中的内容是否独占一行
'vue/singleline-html-element-content-newline': ['error'],
'vue/max-attributes-per-line': [
'error',
quotes: ["error", "single"],
"jsx-quotes": ["error", "prefer-double"],
"vue/html-quotes": ["error", "double", { avoidEscape: true }],
"max-statements-per-line": ["error", { max: 1 }],
"vue/multiline-html-element-content-newline": ["error"], // 多行html中的内容是否独占一行
"vue/singleline-html-element-content-newline": ["error"],
"vue/max-attributes-per-line": [
"error",
{
singleline: {
max: 1,
Expand All @@ -89,50 +91,57 @@ module.exports = {
},
},
],
'array-element-newline': ['error', 'consistent'],
'array-bracket-newline': ['error', 'consistent'], // []新一行
'vue/array-bracket-newline': ['error', 'consistent'],
'comma-dangle': ['error', 'always-multiline'], // 最后一个对象元素加逗号
'object-property-newline': ['error', { allowAllPropertiesOnSameLine: false }],
'vue/object-property-newline': ['error', { allowAllPropertiesOnSameLine: false }],
'vue/space-infix-ops': ['error', { int32Hint: true }],
// 'vue/space-infix-ops': 0,
// "template-curly-spacing": ["error", "never"],
'vue/object-curly-spacing': ['error', 'always'], // 对象内的间距要求
'vue/comma-spacing': ['error'], // 对象内的逗号位置
'vue/key-spacing': ['error'], // 冒号位置
"array-element-newline": ["error", "consistent"],
"array-bracket-newline": ["error", "consistent"], // []新一行
"vue/array-bracket-newline": ["error", "consistent"],
"comma-dangle": ["error", "always-multiline"], // 最后一个对象元素加逗号
"object-property-newline": ["error", { allowAllPropertiesOnSameLine: false }],
"vue/object-property-newline": ["error", { allowAllPropertiesOnSameLine: false }],
"vue/space-infix-ops": ["error", { int32Hint: true }],
"vue/multi-word-component-names": 0,

'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'import/prefer-default-export': 0,
'import/no-extraneous-dependencies': 0,
'import/no-unresolved': 0,
'import/extensions': [
'error',
'ignorePackages',
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"import/prefer-default-export": 0,
"import/no-extraneous-dependencies": 0,
"import/no-unresolved": 0,
"import/extensions": [
"error",
"ignorePackages",
{
js: 'never',
mjs: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
js: "never",
mjs: "never",
jsx: "never",
ts: "never",
tsx: "never",
},
],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
curly: 'error', // 强制if括号包裹,无效
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
curly: "error", // 强制if括号包裹,无效
"max-len": ["error", { code: 150, ignoreStrings: true }],
"jsonc/indent": ["error",
2,
{}
],
// "jsonc/auto": true,
...vuejsAccessibilityOff,
},
overrides: [
{
files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'],
files: ["**/__tests__/*.{j,t}s?(x)", "**/tests/unit/**/*.spec.{j,t}s?(x)"],
env: {
jest: true,
},
},
{
files: ["*.json", "*.json5", "*.jsonc"],
parser: "jsonc-eslint-parser",
}
},
],
globals: {
defineProps: true,
defineEmits: true,
defineExpose: true,
},
};
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ RUN apk -U upgrade

COPY dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
COPY startup.sh /usr/share

RUN chown -R nginx:nginx /var/cache/nginx && \
chown -R nginx:nginx /var/log/nginx && \
chown -R nginx:nginx /etc/nginx/conf.d
RUN touch /var/run/nginx.pid && \
chown -R nginx:nginx /var/run/nginx.pid

RUN chmod a+x /usr/share/startup.sh && chown nginx /etc/nginx

EXPOSE 8443

USER nginx

EXPOSE 8080
CMD /usr/share/startup.sh && nginx -g 'daemon off;'
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,8 @@ minor-release:
.PHONY: patch-release
patch-release:
npx esno ./scripts/patch-release.ts

.PHONY: build
build:
yarn build
docker buildx build --builder=builder --platform linux/amd64,linux/arm64 -t release.daocloud.io/max/datatunerx-ui:v0.0.4 -f Dockerfile . --push
68 changes: 68 additions & 0 deletions deploy/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: ns-admin
namespace: datatunerx
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: datatunerx-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: ns-admin
namespace: datatunerx
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: datatunerx-ui
namespace: datatunerx
labels:
app: datatunerx-ui
spec:
replicas: 1
selector:
matchLabels:
app: datatunerx-ui
template:
metadata:
name: datatunerx-ui
labels:
app: datatunerx-ui
spec:
containers:
- name: datatunerx-ui
image: release.daocloud.io/max/datatunerx-ui:v0.0.4
env:
- name: 'API_URL'
value: "https://10.29.26.43:6443"
imagePullPolicy: Always
ports:
- containerPort: 8443
resources:
limits:
cpu: 500m
memory: 0.5Gi
requests:
cpu: 500m
memory: 0.5Gi
serviceAccountName: ns-admin
---
apiVersion: v1
kind: Service
metadata:
name: datatunerx-ui
namespace: datatunerx
spec:
type: NodePort
ports:
- port: 8443
protocol: TCP
targetPort: 8443
selector:
app: datatunerx-ui
21 changes: 16 additions & 5 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ http {
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;

server {
listen 8080;
listen 8443;
server_name localhost;

location / {
Expand All @@ -56,12 +56,23 @@ http {
root /usr/share/nginx/html;
}

location = /basic_status {
stub_status;
location /api/ {
add_header 'Access-Control-Allow-Headers' 'Authorization,X-SAIC-TOKEN,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' always;
add_header 'Access-Control-Max-Age' 86400 always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, PATCH, DELETE' always;
add_header 'Access-Control-Allow-Credentials' "true" always;

proxy_ssl_trusted_certificate /var/run/secrets/kubernetes.io/serviceaccount/ca.crt;
proxy_ssl_certificate /var/run/secrets/kubernetes.io/serviceaccount/ca.crt;
proxy_ssl_verify on;
proxy_ssl_verify_depth 2;
proxy_pass KUBERNETES_API_SERVER;
proxy_set_header Authorization "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6InZ1b1pUaUxtZ2xEd0RlaTE3TFppRDNHSzBROUhMYno3blNvS2NUTlkzNDAifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjo1Mjk4ODI4NzYyLCJpYXQiOjE2OTg4MzIzNjIsImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJkYXRhdHVuZXJ4LWRldiIsInNlcnZpY2VhY2NvdW50Ijp7Im5hbWUiOiJuc2FkbWluIiwidWlkIjoiOTNlNWI3YTQtZjdkMy00YTY1LTkxMjAtYWYzYjc1ZGMzYzczIn19LCJuYmYiOjE2OTg4MzIzNjIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpkYXRhdHVuZXJ4LWRldjpuc2FkbWluIn0.j4klPVqXkAHHbwtMR-Ng6fAOA2PUMFofu7u7ttYPBHeODEm6y7ZXOHGvcaqG7aClR9Td94HO4PmiW_IFJhPv7nzHSD2nYy3He6r_VD4fZFpvN9S9RRv2d_xKQ2sp_N0b88HWEuWk1snDbsWUTgMdUKNjIW-OGFLxSMHsHXQ8__pr02pEkBCfJLoGO9zyuBSltiPhwJUW7SOpThZO80slPsO1AwoOS3yB3BjQzz7aNIh76k9Im7p8mmeq1KTQohEpQfltN5vBwLOQ0kzY0QJ5uMPr_AMYsRCxH7KXBBssZ0kpwFCCk7uL3VHGQerw4RKsic92ySNMuNFLx6dIzFwIqg";
}

location = /metrics {
proxy_pass http://127.0.0.1:9113;
location /apis {
proxy_pass KUBERNETES_API_SERVER;
proxy_set_header Authorization "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6InZ1b1pUaUxtZ2xEd0RlaTE3TFppRDNHSzBROUhMYno3blNvS2NUTlkzNDAifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjo1Mjk4ODI4NzYyLCJpYXQiOjE2OTg4MzIzNjIsImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJkYXRhdHVuZXJ4LWRldiIsInNlcnZpY2VhY2NvdW50Ijp7Im5hbWUiOiJuc2FkbWluIiwidWlkIjoiOTNlNWI3YTQtZjdkMy00YTY1LTkxMjAtYWYzYjc1ZGMzYzczIn19LCJuYmYiOjE2OTg4MzIzNjIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpkYXRhdHVuZXJ4LWRldjpuc2FkbWluIn0.j4klPVqXkAHHbwtMR-Ng6fAOA2PUMFofu7u7ttYPBHeODEm6y7ZXOHGvcaqG7aClR9Td94HO4PmiW_IFJhPv7nzHSD2nYy3He6r_VD4fZFpvN9S9RRv2d_xKQ2sp_N0b88HWEuWk1snDbsWUTgMdUKNjIW-OGFLxSMHsHXQ8__pr02pEkBCfJLoGO9zyuBSltiPhwJUW7SOpThZO80slPsO1AwoOS3yB3BjQzz7aNIh76k9Im7p8mmeq1KTQohEpQfltN5vBwLOQ0kzY0QJ5uMPr_AMYsRCxH7KXBBssZ0kpwFCCk7uL3VHGQerw4RKsic92ySNMuNFLx6dIzFwIqg";
}

location = /ping {
Expand Down
Loading