diff --git a/.eslintignore b/.eslintignore index 55a3784b..e54de5ff 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,5 @@ node_modules/ dist/ index.html -.vscode \ No newline at end of file +.vscode +docker \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..ebc7fd6d --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +always-auth=true +registry=http://47.108.170.157:9013/ \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..05f6736b --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,6 @@ +FROM nginx +ADD nginx.conf /etc/nginx/conf.d/default.conf +ADD docker-entrypoint.sh /docker-entrypoint.sh +COPY dist /usr/share/nginx/html +CMD ["sh","/docker-entrypoint.sh"] +#ADD oauth2 /usr/share/nginx/html/oauth2 diff --git a/docker/build.sh b/docker/build.sh new file mode 100644 index 00000000..8849f58c --- /dev/null +++ b/docker/build.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +docker build -t registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-ui-vue:1.0.0 . +docker push registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-ui-vue:1.0.0 diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh new file mode 100644 index 00000000..c57efdd4 --- /dev/null +++ b/docker/docker-entrypoint.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +API_BASE_PATH=$API_BASE_PATH; +NAMESERVERS=$(cat /etc/resolv.conf | grep "nameserver" | awk '{print $2}' | tr '\n' ' ') +if [ -z "$API_BASE_PATH" ]; then + API_BASE_PATH="http://jetlinks:8844/"; +fi + +apiUrl="proxy_pass $API_BASE_PATH\$1;" +resolver="resolver $NAMESERVERS ipv6=off;" + +sed -i '11c '"$resolver"'' /etc/nginx/conf.d/default.conf +sed -i '20c '"$apiUrl"'' /etc/nginx/conf.d/default.conf + +nginx -g "daemon off;" diff --git a/docker/nginx.conf b/docker/nginx.conf new file mode 100644 index 00000000..92401367 --- /dev/null +++ b/docker/nginx.conf @@ -0,0 +1,38 @@ +server { + listen 80; + listen [::]:80; + # gzip config + gzip on; + gzip_min_length 1k; + gzip_comp_level 9; + gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml; + gzip_vary on; + gzip_disable "MSIE [1-6]\."; + resolver $NAMESERVERS ipv6=off; + root /usr/share/nginx/html; + include /etc/nginx/mime.types; + location / { + index index.html; + } + + location ^~/api/ { + if ($request_uri ~* ^/api/(.*)$) { + proxy_pass http://host.docker.internal:8840/$1; + } + #proxy_pass http://host.docker.internal:8840/; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_connect_timeout 1; + proxy_buffering off; + chunked_transfer_encoding off; + proxy_cache off; + proxy_send_timeout 30m; + proxy_read_timeout 30m; + client_max_body_size 500m; + } +} diff --git a/package.json b/package.json index e6cfab33..7174015a 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,9 @@ "name": "jetlinks-vue", "private": true, "version": "0.0.0", - "type": "module", "scripts": { "dev": "vite --mode develop", - "build": "vite build --mode production", + "build": "node --max_old_space_size=1024000 ./node_modules/vite/bin/vite.js build", "preview": "vite preview", "eslint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src", "lint": "eslint src --fix --ext .ts,.tsx,.vue,.js,.jsx", @@ -22,6 +21,7 @@ "driver.js": "^0.9.8", "echarts": "^5.4.1", "event-source-polyfill": "^1.0.31", + "global": "^4.4.0", "jetlinks-store": "^0.0.3", "js-cookie": "^3.0.1", "less": "^4.1.3", @@ -31,9 +31,11 @@ "mavon-editor": "^2.10.4", "moment": "^2.29.4", "monaco-editor": "^0.24.0", + "nrm": "^1.2.5", "pinia": "^2.0.28", "unplugin-auto-import": "^0.12.1", "unplugin-vue-components": "^0.22.12", + "vite-plugin-monaco-editor": "^1.1.0", "vue": "^3.2.45", "vue-router": "^4.1.6", "vue3-markdown-it": "^1.0.10", diff --git a/src/api/device/firmware.ts b/src/api/device/firmware.ts new file mode 100644 index 00000000..f0108f98 --- /dev/null +++ b/src/api/device/firmware.ts @@ -0,0 +1,53 @@ +import server from '@/utils/request'; +import { BASE_API_PATH } from '@/utils/variable'; + +export const FIRMWARE_UPLOAD = `${BASE_API_PATH}/file/upload`; + +export const save = (data: object) => server.post(`/firmware`, data); + +export const update = (data: object) => server.patch(`/firmware`, data); + +export const remove = (id: string) => server.remove(`/firmware/${id}`); + +export const query = (data: object) => server.post(`/firmware/_query/`, data); + +export const querySystemApi = (data?: object) => + server.post(`/system/config/scopes`, data); + +export const task = (data: Record) => + server.post(`/firmware/upgrade/task/detail/_query`, data); + +export const taskById = (id: string) => + server.get(`/firmware/upgrade/task/${id}`); + +export const saveTask = (data: Record) => + server.post(`/firmware/upgrade/task`, data); + +export const deleteTask = (id: string) => + server.remove(`/firmware/upgrade/task/${id}`); + +export const history = (data: Record) => + server.post(`/firmware/upgrade/history/_query`, data); + +export const historyCount = (data: Record) => + server.post(`/firmware/upgrade/history/_count`, data); + +export const startTask = (id: string, data: string[]) => + server.post(`/firmware/upgrade/task/${id}/_start`, data); + +export const stopTask = (id: string) => + server.post(`/firmware/upgrade/task/${id}/_stop`); + +export const startOneTask = (data: string[]) => + server.post(`/firmware/upgrade/task/_start`, data); + +// export const queryProduct = (data?: any) => +// server.post(`/device-product/_query/no-paging`, data); +export const queryProduct = (data?: any) => + server.post(`/device-product/detail/_query/no-paging`, data); + +export const queryDevice = () => + server.get(`/device/instance/_query/no-paging?paging=false`); + +export const validateVersion = (productId: string, versionOrder: number) => + server.get(`/firmware/${productId}/${versionOrder}/exists`); diff --git a/src/api/device/instance.ts b/src/api/device/instance.ts index cac9e9c2..35907a23 100644 --- a/src/api/device/instance.ts +++ b/src/api/device/instance.ts @@ -83,22 +83,22 @@ export const batchDeleteDevice = (data: string[]) => server.put(`/device-instanc * @param type 文件类型 * @returns */ - export const deviceTemplateDownload = (productId: string, type: string) => `${BASE_API_PATH}/device-instance/${productId}/template.${type}` +export const deviceTemplateDownload = (productId: string, type: string) => `${BASE_API_PATH}/device-instance/${productId}/template.${type}` - /** - * 设备导入 - * @param productId 产品id - * @param type 文件类型 - * @returns - */ - export const deviceImport = (productId: string, fileUrl: string, autoDeploy: boolean) => `${BASE_API_PATH}/device-instance/${productId}/import?fileUrl=${fileUrl}&autoDeploy=${autoDeploy}&:X_Access_Token=${LocalStore.get(TOKEN_KEY)}` - - /** - * 设备导出 - * @param productId 产品id - * @param type 文件类型 - * @returns - */ +/** + * 设备导入 + * @param productId 产品id + * @param type 文件类型 + * @returns + */ +export const deviceImport = (productId: string, fileUrl: string, autoDeploy: boolean) => `${BASE_API_PATH}/device-instance/${productId}/import?fileUrl=${fileUrl}&autoDeploy=${autoDeploy}&:X_Access_Token=${LocalStore.get(TOKEN_KEY)}` + +/** + * 设备导出 + * @param productId 产品id + * @param type 文件类型 + * @returns + */ export const deviceExport = (productId: string, type: string) => `${BASE_API_PATH}/device-instance${!!productId ? '/' + productId : ''}/export.${type}` /** @@ -143,7 +143,7 @@ export const _disconnect = (id: string) => server.post(`/device-instance/${id}/d */ export const queryUserListNoPaging = () => server.post(`/user/_query/no-paging`, { paging: false, - sorts: [{name: 'name', order: "asc"}] + sorts: [{ name: 'name', order: "asc" }] }) /** @@ -347,4 +347,59 @@ export const settingProperties = (deviceId: string, data: any) => server.put(`/d * @param data * @returns */ - export const execute = (id: string, action: string, data: any) => server.post(`/device/invoked/${id}/function/${action}`, data) +export const execute = (id: string, action: string, data: any) => server.post(`/device/invoked/${id}/function/${action}`, data) + +/** + * 查询通道列表不分页 + * @param data + * @returns + */ +export const queryChannelNoPaging = (data: any) => server.post(`data-collect/channel/_query/no-paging`, data) + +/** + * 查询采集器列表不分页 + * @param data + * @returns + */ +export const queryCollectorNoPaging = (data: any) => server.post(`/data-collect/collector/_query/no-paging`, data) + +/** + * 查询点位列表不分页 + * @param data + * @returns + */ +export const queryPointNoPaging = (data: any) => server.post(`/data-collect/point/_query/no-paging`, data) + +/** + * 查询映射列表 + * @param thingType + * @param thingId + * @param params + * @returns + */ +export const queryMapping = (thingType: string, thingId: any, params?: any) => server.get(`/things/collector/${thingType}/${thingId}/_query`, params) + +/** + * 删除映射 + * @param thingType + * @param thingId + * @param data + * @returns + */ +export const removeMapping = (thingType: string, thingId: any, data?: any) => server.post(`/things/collector/${thingType}/${thingId}/_delete`, data) + +/** + * 映射树 + * @param data + * @returns + */ +export const treeMapping = (data?: any) => server.post(`/data-collect/channel/_all/tree`, data) + +/** + * 保存映射 + * @param thingId + * @param provider + * @param data + * @returns + */ +export const saveMapping = (thingId: any, provider: string, data?: any) => server.patch(`/things/collector/device/${thingId}/${provider}`, data) \ No newline at end of file diff --git a/src/components/AIcon/index.tsx b/src/components/AIcon/index.tsx index 4ebea3b2..35221782 100644 --- a/src/components/AIcon/index.tsx +++ b/src/components/AIcon/index.tsx @@ -49,6 +49,9 @@ const iconKeys = [ 'PartitionOutlined', 'ShareAltOutlined', 'playCircleOutlined', + 'RightOutlined', + 'FileTextOutlined', + 'UploadOutlined' ] const Icon = (props: {type: string}) => { diff --git a/src/components/MonacoEditor/index.vue b/src/components/MonacoEditor/index.vue index 7a22d6b7..094f23e8 100644 --- a/src/components/MonacoEditor/index.vue +++ b/src/components/MonacoEditor/index.vue @@ -6,29 +6,29 @@ diff --git a/src/components/Search/Search.vue b/src/components/Search/Search.vue index 4abeb789..47a75a26 100644 --- a/src/components/Search/Search.vue +++ b/src/components/Search/Search.vue @@ -4,9 +4,9 @@
- - - + + +
- - - + + +
@@ -40,7 +40,7 @@
- +