Compare commits
209 Commits
v4.0.0
...
pr@dev@per
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
150795ebac | ||
|
|
a636bb2037 | ||
|
|
9b6f54c1ed | ||
|
|
611341307b | ||
|
|
f8479c53ff | ||
|
|
e25bf46659 | ||
|
|
6d07307e56 | ||
|
|
6fb7fe8fa1 | ||
|
|
19cd497095 | ||
|
|
d858489367 | ||
|
|
341a30ba06 | ||
|
|
8390fb7429 | ||
|
|
5389f1d011 | ||
|
|
bde642570f | ||
|
|
3e7b970fe7 | ||
|
|
2421e822b4 | ||
|
|
b2e474e3f6 | ||
|
|
541836390a | ||
|
|
bb92e3f22b | ||
|
|
c9ad797b40 | ||
|
|
2a08310efc | ||
|
|
3b2803b9a1 | ||
|
|
1b8ac9112e | ||
|
|
9cc3dd4de9 | ||
|
|
120ef70eb1 | ||
|
|
541f4ebc62 | ||
|
|
a47636abc7 | ||
|
|
78f6f4b36a | ||
|
|
5abc0b77cf | ||
|
|
464638e782 | ||
|
|
37cfeb2077 | ||
|
|
44e297f01a | ||
|
|
febc283e36 | ||
|
|
dae33f55e8 | ||
|
|
c62cd27690 | ||
|
|
83443f8187 | ||
|
|
cb46f393e0 | ||
|
|
ddf5ac2151 | ||
|
|
88173f852a | ||
|
|
d5f16e90e2 | ||
|
|
d1c0aca4ff | ||
|
|
a42edf17ec | ||
|
|
dac5dfcd1c | ||
|
|
8e6ca146e1 | ||
|
|
9c06d36eab | ||
|
|
ab7bd574f8 | ||
|
|
6007dc8621 | ||
|
|
a0e7c48dc9 | ||
|
|
71dea791bf | ||
|
|
e1b9184f41 | ||
|
|
730d47f02a | ||
|
|
e82ec68935 | ||
|
|
e8e5975d7f | ||
|
|
3cb9dec978 | ||
|
|
c025441075 | ||
|
|
050b50fa74 | ||
|
|
e26befabc3 | ||
|
|
8545fc6136 | ||
|
|
e343e0df9d | ||
|
|
74519e6f3c | ||
|
|
1305f90372 | ||
|
|
bbc3f53c0a | ||
|
|
aa605adbc7 | ||
|
|
49ea7d0969 | ||
|
|
4221bdb2ab | ||
|
|
af4010e299 | ||
|
|
9b7c4ed353 | ||
|
|
879df90503 | ||
|
|
41f841532f | ||
|
|
0b9f47dd84 | ||
|
|
d32a376e8c | ||
|
|
0f8a8845df | ||
|
|
8bb2c66b99 | ||
|
|
b3d0be2f60 | ||
|
|
5a94ddd976 | ||
|
|
7b9627a80b | ||
|
|
5fcfecc060 | ||
|
|
f4d7a2283c | ||
|
|
40bb8410d3 | ||
|
|
45344ac620 | ||
|
|
5b894c9667 | ||
|
|
d89bd15b6d | ||
|
|
5e640dd45c | ||
|
|
09aa750794 | ||
|
|
744b215800 | ||
|
|
f4e11da053 | ||
|
|
2e6b5706d5 | ||
|
|
440a5b27ef | ||
|
|
932e16844e | ||
|
|
aff2e439dd | ||
|
|
a618794c14 | ||
|
|
8dd66c400a | ||
|
|
ac3ce464b7 | ||
|
|
4d01c6dabe | ||
|
|
47eeac23eb | ||
|
|
592f783245 | ||
|
|
c34ac6a56f | ||
|
|
9a7162cc9e | ||
|
|
5edf2f34dd | ||
|
|
859d824195 | ||
|
|
c382cc633e | ||
|
|
653e24773f | ||
|
|
ae489610ee | ||
|
|
b5e85c66e4 | ||
|
|
4060fa4c4a | ||
|
|
9630b79daa | ||
|
|
ad93917387 | ||
|
|
691590da7b | ||
|
|
71828fd78b | ||
|
|
5a45f31ac4 | ||
|
|
44901eee23 | ||
|
|
2d91fa107d | ||
|
|
7a6ade4bd9 | ||
|
|
951778668f | ||
|
|
0aca23bf38 | ||
|
|
9b97dc9a74 | ||
|
|
32cd030479 | ||
|
|
607bb476db | ||
|
|
1d676ec9b7 | ||
|
|
614ebb4121 | ||
|
|
8c2719a95d | ||
|
|
c6b0a958a6 | ||
|
|
3edebf3f4f | ||
|
|
f63405978e | ||
|
|
c582c8de98 | ||
|
|
c44e79ed3b | ||
|
|
fc7d5b9c29 | ||
|
|
335febd4a5 | ||
|
|
5ea2918fe7 | ||
|
|
7668d10ba5 | ||
|
|
df15d141da | ||
|
|
e2f4bbde79 | ||
|
|
3ca7de42af | ||
|
|
e6a577ba9b | ||
|
|
6290179460 | ||
|
|
4f3c9e9353 | ||
|
|
aa28a8f765 | ||
|
|
98d0a52fa2 | ||
|
|
8d9e1ffadb | ||
|
|
b3be312a4d | ||
|
|
7c41d148aa | ||
|
|
6dee911642 | ||
|
|
6dd35e5173 | ||
|
|
fdaa33f68d | ||
|
|
0b813bb719 | ||
|
|
7ba6b8d4e4 | ||
|
|
ef99e25fde | ||
|
|
d1e7b907e3 | ||
|
|
83f7dda5e7 | ||
|
|
80f929fdea | ||
|
|
1ec3d02933 | ||
|
|
fdf148cc2b | ||
|
|
c9e6ef89dc | ||
|
|
59f9f88f8b | ||
|
|
16417ae843 | ||
|
|
58bd0a17c8 | ||
|
|
c4a1eb6938 | ||
|
|
b7d9031889 | ||
|
|
96b29a9dc2 | ||
|
|
336e176639 | ||
|
|
2df4a9d66d | ||
|
|
45a102cff1 | ||
|
|
57ebfa0812 | ||
|
|
4e9dd57efe | ||
|
|
3fcc4ca160 | ||
|
|
958760811c | ||
|
|
b60e0251c2 | ||
|
|
3db0ed756e | ||
|
|
453c4b1e4e | ||
|
|
bf4d8ce7a6 | ||
|
|
34effdbe15 | ||
|
|
274db466f2 | ||
|
|
cbe697f9dc | ||
|
|
fb7acb100e | ||
|
|
ebb36847df | ||
|
|
beba4f1994 | ||
|
|
452796e3f5 | ||
|
|
02a7969d90 | ||
|
|
798dbec151 | ||
|
|
0e11a56e37 | ||
|
|
be5344344c | ||
|
|
e75d711e0a | ||
|
|
46ee116f3e | ||
|
|
f4b304338f | ||
|
|
e93e78307c | ||
|
|
d22079446f | ||
|
|
d57b99b00c | ||
|
|
e7321356af | ||
|
|
a0edc2c527 | ||
|
|
10ebcfd64d | ||
|
|
a3fedb9697 | ||
|
|
1eb8a18c66 | ||
|
|
f491c57c34 | ||
|
|
50b7f54652 | ||
|
|
5bf298a5bf | ||
|
|
124ff9a8c2 | ||
|
|
387ab4f1b3 | ||
|
|
d6fbdfa7ea | ||
|
|
cd4260fd8d | ||
|
|
baeece62d3 | ||
|
|
576c8f5891 | ||
|
|
5e97600807 | ||
|
|
4e2eb3a37d | ||
|
|
e92173f8e8 | ||
|
|
412d9c804e | ||
|
|
b84a725d4a | ||
|
|
58b39743e0 | ||
|
|
7651443c25 | ||
|
|
8d64e331d1 |
72
.github/workflows/build-base-image.yml
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
name: Build and Push Base Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'pr*'
|
||||
paths:
|
||||
- 'package.json'
|
||||
- 'package-lock.json'
|
||||
- 'yarn.lock'
|
||||
- 'Dockerfile-base'
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Lock Pull Request
|
||||
run: |
|
||||
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-d '{"state":"pending", "description":"Action running, merge disabled", "context":"Lock PR"}' \
|
||||
"https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }}"
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Extract date
|
||||
id: vars
|
||||
run: echo "IMAGE_TAG=$(date +'%Y%m%d_%H%M%S')" >> $GITHUB_ENV
|
||||
|
||||
- name: Extract repository name
|
||||
id: repo
|
||||
run: echo "REPO=$(basename ${{ github.repository }})" >> $GITHUB_ENV
|
||||
|
||||
- name: Build and push multi-arch image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
file: Dockerfile-base
|
||||
tags: jumpserver/${{ env.REPO }}-base:${{ env.IMAGE_TAG }}
|
||||
|
||||
- name: Update Dockerfile
|
||||
run: |
|
||||
sed -i 's|-base:.* AS stage-build|-base:${{ env.IMAGE_TAG }} AS stage-build|' Dockerfile
|
||||
|
||||
- name: Commit changes
|
||||
run: |
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
||||
git add Dockerfile
|
||||
git commit -m "perf: Update Dockerfile with new base image tag"
|
||||
git push
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Unlock Pull Request
|
||||
run: |
|
||||
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-d '{"state":"success", "description":"Action running, merge disabled", "context":"Lock PR"}' \
|
||||
"https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }}"
|
||||
46
.github/workflows/jms-build-test.yml
vendored
@@ -1,46 +0,0 @@
|
||||
name: "Run Build Test"
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'Dockerfile'
|
||||
- 'Dockerfile*'
|
||||
- 'package.json'
|
||||
- 'yarn.lock'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
component: [lina]
|
||||
version: [v4]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Prepare Build
|
||||
run: |
|
||||
sed -i 's@registry.npmmirror.com@registry.yarnpkg.com@g' yarn.lock
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build Image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
file: Dockerfile
|
||||
tags: ghcr.io/jumpserver/${{ matrix.component }}:${{ matrix.version }}
|
||||
platforms: linux/amd64
|
||||
build-args: |
|
||||
VERSION=${{ matrix.version }}
|
||||
APT_MIRROR=http://deb.debian.org
|
||||
NPM_REGISTRY=https://registry.yarnpkg.com
|
||||
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
46
.github/workflows/jms-build-test.yml.disabled
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
name: "Run Build Test"
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'Dockerfile'
|
||||
- 'Dockerfile*'
|
||||
- 'package.json'
|
||||
- 'yarn.lock'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
component: [ lina ]
|
||||
version: [ v4 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Prepare Build
|
||||
run: |
|
||||
sed -i 's@registry.npmmirror.com@registry.yarnpkg.com@g' yarn.lock
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build Image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
file: Dockerfile
|
||||
tags: ghcr.io/jumpserver/${{ matrix.component }}:${{ matrix.version }}
|
||||
platforms: linux/amd64
|
||||
build-args: |
|
||||
VERSION=${{ matrix.version }}
|
||||
APT_MIRROR=http://deb.debian.org
|
||||
NPM_REGISTRY=https://registry.yarnpkg.com
|
||||
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
2
.github/workflows/release-drafter.yml
vendored
@@ -31,7 +31,7 @@ jobs:
|
||||
tag: ${{ steps.get_version.outputs.TAG }}
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16.20'
|
||||
node-version: '20.15'
|
||||
- name: Install dependencies
|
||||
run: yarn install
|
||||
- name: Build web
|
||||
|
||||
32
Dockerfile
@@ -1,34 +1,4 @@
|
||||
FROM node:16.20-bullseye-slim as stage-build
|
||||
ARG TARGETARCH
|
||||
|
||||
ARG DEPENDENCIES=" \
|
||||
g++ \
|
||||
make \
|
||||
python3"
|
||||
|
||||
ARG APT_MIRROR=http://mirrors.ustc.edu.cn
|
||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||
set -ex \
|
||||
&& rm -f /etc/apt/apt.conf.d/docker-clean \
|
||||
&& echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache \
|
||||
&& sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
|
||||
&& apt-get update \
|
||||
&& apt-get -y install --no-install-recommends ${DEPENDENCIES} \
|
||||
&& echo "no" | dpkg-reconfigure dash
|
||||
|
||||
ARG NPM_REGISTRY="https://registry.npmmirror.com"
|
||||
|
||||
RUN set -ex \
|
||||
&& npm config set registry ${NPM_REGISTRY} \
|
||||
&& yarn config set registry ${NPM_REGISTRY}
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,sharing=locked \
|
||||
--mount=type=bind,source=package.json,target=package.json \
|
||||
--mount=type=bind,source=yarn.lock,target=yarn.lock \
|
||||
yarn install
|
||||
FROM jumpserver/lina-base:20240723_084702 AS stage-build
|
||||
|
||||
ARG VERSION
|
||||
ENV VERSION=$VERSION
|
||||
|
||||
22
Dockerfile-base
Normal file
@@ -0,0 +1,22 @@
|
||||
FROM node:20.15-bullseye-slim
|
||||
|
||||
ARG DEPENDENCIES=" \
|
||||
g++ \
|
||||
make \
|
||||
python3"
|
||||
|
||||
RUN set -ex \
|
||||
&& rm -f /etc/apt/apt.conf.d/docker-clean \
|
||||
&& echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache \
|
||||
&& apt-get update \
|
||||
&& apt-get -y install --no-install-recommends ${DEPENDENCIES} \
|
||||
&& echo "no" | dpkg-reconfigure dash
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
COPY package.json yarn.lock ./
|
||||
|
||||
ARG NPM_MIRROR="https://registry.npmjs.org"
|
||||
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,sharing=locked,id=yarn-cache \
|
||||
sed -i "s|https://registry.npmmirror.com|${NPM_MIRROR}|g" yarn.lock \
|
||||
&& yarn install
|
||||
14
package.json
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "Lina",
|
||||
"name": "lina",
|
||||
"version": "v4.0.0",
|
||||
"description": "JumpServer Web UI",
|
||||
"author": "JumpServer Team <support@fit2cloud.com>",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"scripts": {
|
||||
"dev": "vue-cli-service serve",
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"dev": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve",
|
||||
"serve": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve",
|
||||
"build": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build",
|
||||
"build:prod": "vue-cli-service build",
|
||||
"build:stage": "vue-cli-service build --mode staging",
|
||||
"preview": "node build/index.js --preview",
|
||||
@@ -30,11 +30,13 @@
|
||||
"@ztree/ztree_v3": "3.5.44",
|
||||
"axios": "0.28.0",
|
||||
"axios-retry": "^3.1.9",
|
||||
"caniuse-lite": "^1.0.30001642",
|
||||
"cron-parser": "^4.0.0",
|
||||
"crypto-js": "^4.1.1",
|
||||
"css-color-function": "^1.3.3",
|
||||
"decimal.js": "^10.4.3",
|
||||
"deepmerge": "^4.2.2",
|
||||
"dompurify": "^3.1.6",
|
||||
"echarts": "4.7.0",
|
||||
"element-ui": "2.15.14",
|
||||
"eslint-plugin-html": "^6.0.0",
|
||||
@@ -64,7 +66,7 @@
|
||||
"normalize.css": "7.0.0",
|
||||
"npm": "^7.8.0",
|
||||
"nprogress": "0.2.0",
|
||||
"path-to-regexp": "2.4.0",
|
||||
"path-to-regexp": "3.3.0",
|
||||
"v-sanitize": "^0.0.13",
|
||||
"vue": "2.6.10",
|
||||
"vue-codemirror": "4.0.6",
|
||||
@@ -115,7 +117,7 @@
|
||||
"sass-loader": "^7.1.0",
|
||||
"script-ext-html-webpack-plugin": "2.1.3",
|
||||
"script-loader": "0.7.2",
|
||||
"serve-static": "^1.13.2",
|
||||
"serve-static": "^1.16.0",
|
||||
"strip-ansi": "^7.1.0",
|
||||
"svg-sprite-loader": "4.1.3",
|
||||
"svgo": "1.2.2",
|
||||
|
||||
@@ -15,6 +15,7 @@ export function testEmailSetting(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function importLicense(formData) {
|
||||
return request({
|
||||
url: '/api/v1/xpack/license/import',
|
||||
@@ -25,6 +26,7 @@ export function importLicense(formData) {
|
||||
data: formData
|
||||
})
|
||||
}
|
||||
|
||||
export function testLdapSetting(data, refresh = true) {
|
||||
let url = '/api/v1/settings/ldap/testing/config/'
|
||||
if (refresh) {
|
||||
@@ -96,9 +98,17 @@ export function getPublicSettings(isOpen) {
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getLogo() {
|
||||
return request({
|
||||
url: '/api/v1/xpack/interface/setting/',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getPreference() {
|
||||
return request({
|
||||
url: '/api/v1/users/preference/?category=luna',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -65,10 +65,6 @@ export function logout() {
|
||||
})
|
||||
}
|
||||
|
||||
export function refreshSessionIdAge() {
|
||||
return getProfile()
|
||||
}
|
||||
|
||||
export default {
|
||||
getProfile,
|
||||
getUserList
|
||||
|
||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 466 B After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 961 B After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 916 B After Width: | Height: | Size: 2.4 KiB |
BIN
src/assets/img/icons/h3c.png
Normal file
|
After Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 278 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 940 B |
|
Before Width: | Height: | Size: 462 B After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 2.1 KiB |
@@ -2,6 +2,7 @@
|
||||
<Dialog
|
||||
:close-on-click-modal="false"
|
||||
:title="$tc('Assets')"
|
||||
:disabled-status="!isLoaded"
|
||||
custom-class="asset-select-dialog"
|
||||
top="2vh"
|
||||
v-bind="$attrs"
|
||||
@@ -22,6 +23,8 @@
|
||||
:url="baseUrl"
|
||||
class="tree-table"
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
@loaded="handleTableLoaded"
|
||||
/>
|
||||
</Dialog>
|
||||
</template>
|
||||
@@ -64,6 +67,7 @@ export default {
|
||||
data() {
|
||||
const vm = this
|
||||
return {
|
||||
isLoaded: false,
|
||||
dialogVisible: false,
|
||||
rowSelected: _.cloneDeep(this.value) || [],
|
||||
rowsAdd: [],
|
||||
@@ -124,6 +128,9 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleTableLoaded() {
|
||||
this.isLoaded = true
|
||||
},
|
||||
handleClose() {
|
||||
this.$refs.ListPage.$refs.TreeList.componentKey += 1
|
||||
},
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
<script>
|
||||
import Select2 from '@/components/Form/FormFields/Select2.vue'
|
||||
import AssetSelectDialog from './dialog.vue'
|
||||
import { b } from 'css-color-function/lib/adjusters'
|
||||
|
||||
export default {
|
||||
componentName: 'AssetSelect',
|
||||
@@ -38,6 +37,10 @@ export default {
|
||||
type: String,
|
||||
default: '/api/v1/assets/assets/'
|
||||
},
|
||||
defaultPageSize: {
|
||||
type: Number,
|
||||
default: 10
|
||||
},
|
||||
baseNodeUrl: {
|
||||
type: String,
|
||||
default: '/api/v1/assets/nodes/'
|
||||
@@ -71,6 +74,7 @@ export default {
|
||||
value: iValue,
|
||||
multiple: true,
|
||||
clearable: true,
|
||||
defaultPageSize: this.defaultPageSize,
|
||||
ajax: {
|
||||
url: this.baseUrl,
|
||||
transformOption: (item) => {
|
||||
@@ -81,7 +85,6 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
b,
|
||||
handleFocus() {
|
||||
this.$refs.select2.selectRef.blur()
|
||||
this.dialogVisible = true
|
||||
|
||||
@@ -32,6 +32,10 @@ export default {
|
||||
type: String,
|
||||
default: '/api/v1/assets/assets/'
|
||||
},
|
||||
typeUrl: {
|
||||
type: String,
|
||||
default: '/api/v1/assets/nodes/category/tree/'
|
||||
},
|
||||
nodeUrl: {
|
||||
type: String,
|
||||
default: '/api/v1/assets/nodes/'
|
||||
@@ -105,9 +109,9 @@ export default {
|
||||
showAssets: false,
|
||||
showSearch: false,
|
||||
customTreeHeaderName: this.$t('TypeTree'),
|
||||
url: '/api/v1/assets/nodes/category/tree/',
|
||||
url: this.typeUrl,
|
||||
nodeUrl: this.treeSetting?.nodeUrl || this.nodeUrl,
|
||||
treeUrl: `/api/v1/assets/nodes/category/tree/?assets=${showAssets ? '1' : '0'}&count_resource=${this.treeSetting.countResource || 'asset'}`,
|
||||
treeUrl: `${this.typeUrl}?assets=${showAssets ? '1' : '0'}&count_resource=${this.treeSetting.countResource || 'asset'}`,
|
||||
callback: {
|
||||
onSelected: (event, treeNode) => this.getAssetsUrl(treeNode)
|
||||
}
|
||||
@@ -157,30 +161,37 @@ export default {
|
||||
$('#m_show_asset_only_current_node').css('color', '#606266')
|
||||
}
|
||||
},
|
||||
|
||||
getAssetsUrl(treeNode) {
|
||||
let url = this.treeSetting?.url || this.url
|
||||
|
||||
const setParam = (param, value, delay) => {
|
||||
setTimeout(() => {
|
||||
url = setUrlParam(url, param, value)
|
||||
})
|
||||
}
|
||||
|
||||
if (treeNode.meta.type === 'node') {
|
||||
const nodeId = treeNode.meta.data.id
|
||||
url = setUrlParam(url, 'node_id', nodeId)
|
||||
url = setUrlParam(url, 'asset_id', '')
|
||||
setParam('node_id', nodeId)
|
||||
setParam('asset_id', '')
|
||||
} else if (treeNode.meta.type === 'asset') {
|
||||
const assetId = treeNode.meta.data?.id || treeNode.id
|
||||
url = setUrlParam(url, 'node_id', '')
|
||||
url = setUrlParam(url, 'asset_id', assetId)
|
||||
setParam('node_id', '')
|
||||
setParam('asset_id', assetId)
|
||||
} else if (treeNode.meta.type === 'category') {
|
||||
url = setUrlParam(url, 'category', treeNode.meta.category)
|
||||
setParam('category', treeNode.meta.category)
|
||||
} else if (treeNode.meta.type === 'type') {
|
||||
url = setUrlParam(url, 'category', treeNode.meta.category)
|
||||
url = setUrlParam(url, 'type', treeNode.meta._type)
|
||||
setParam('category', treeNode.meta.category)
|
||||
setParam('type', treeNode.meta._type)
|
||||
} else if (treeNode.meta.type === 'platform') {
|
||||
url = setUrlParam(url, 'platform', treeNode.id)
|
||||
setParam('platform', treeNode.id)
|
||||
}
|
||||
const query = this.setTreeUrlQuery()
|
||||
url = query ? `${url}&${query}` : url
|
||||
|
||||
setTimeout(() => {
|
||||
const query = this.setTreeUrlQuery()
|
||||
url = query ? `${url}&${query}` : url
|
||||
this.$set(this.tableConfig, 'url', url)
|
||||
}, 300)
|
||||
})
|
||||
|
||||
if (this.treeSetting.selectSyncToRoute !== false) {
|
||||
setRouterQuery(this, url)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<AssetTreeTable
|
||||
ref="AssetTreeTable"
|
||||
:header-actions="headerActions"
|
||||
:table-config="tableConfig"
|
||||
:tree-setting="treeSetting"
|
||||
@@ -47,9 +48,19 @@ export default {
|
||||
return this.tableUrl.replace('/assets/', `/assets/${row.id}/accounts/`)
|
||||
}
|
||||
},
|
||||
nameDisabled: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
name: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
formatter: DetailFormatter,
|
||||
formatterArgs: {
|
||||
route: 'AssetDetail',
|
||||
can: true
|
||||
}
|
||||
})
|
||||
},
|
||||
comment: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -80,11 +91,7 @@ export default {
|
||||
},
|
||||
columnsMeta: {
|
||||
name: {
|
||||
formatter: DetailFormatter,
|
||||
formatterArgs: {
|
||||
route: 'AssetDetail',
|
||||
can: !this.nameDisabled
|
||||
}
|
||||
...this.name
|
||||
},
|
||||
labels: {
|
||||
formatterArgs: {
|
||||
@@ -99,7 +106,8 @@ export default {
|
||||
formatter: AccountInfoFormatter,
|
||||
width: '100px'
|
||||
},
|
||||
connectivity: connectivityMeta
|
||||
connectivity: connectivityMeta,
|
||||
comment: { ...this.comment }
|
||||
},
|
||||
tableAttrs: {
|
||||
rowClassName({ row }) {
|
||||
|
||||
@@ -78,7 +78,7 @@ export default {
|
||||
formatterData = data
|
||||
}
|
||||
return (
|
||||
<span>{formatterData}</span>
|
||||
<span style={{ whiteSpace: 'pre-wrap', lineHeight: '1.2' }}>{formatterData}</span>
|
||||
)
|
||||
}
|
||||
if (this.value instanceof Array) {
|
||||
|
||||
@@ -10,13 +10,16 @@
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<slot />
|
||||
<div v-loading="disabledStatus">
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
<div v-if="showButtons" slot="footer" class="dialog-footer">
|
||||
<slot name="footer">
|
||||
<el-button v-if="showCancel && showButtons" size="small" @click="onCancel">{{ cancelTitle }}</el-button>
|
||||
<el-button
|
||||
v-if="showConfirm && showButtons"
|
||||
:loading="loadingStatus"
|
||||
:disabled="disabledStatus"
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="onConfirm"
|
||||
@@ -69,7 +72,7 @@ export default {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
loadingStatus: {
|
||||
disabledStatus: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
@@ -79,7 +82,8 @@ export default {
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
return {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
iWidth() {
|
||||
@@ -119,6 +123,7 @@ export default {
|
||||
|
||||
&__body {
|
||||
padding: 20px 30px;
|
||||
font-size: 13px;
|
||||
|
||||
&:has(.el-table) {
|
||||
background: #f3f3f4;
|
||||
|
||||
@@ -85,6 +85,7 @@ export default {
|
||||
// 如果不想等,证明是 value 自己变化导致的, 需要重新渲染
|
||||
if (valJson !== this.formJson) {
|
||||
this.iValue = val
|
||||
this.$log.debug('Sub form value changed, rerender form: ', this.formJson, valJson)
|
||||
this.loading = true
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
@@ -95,11 +96,12 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
outputValue: _.debounce(function(val) {
|
||||
this.$emit('input', val)
|
||||
}),
|
||||
updateValue(val) {
|
||||
this.iValue = val
|
||||
setTimeout(() => {
|
||||
this.$emit('input', val)
|
||||
}, 100)
|
||||
this.outputValue(val)
|
||||
},
|
||||
objectToString(obj) {
|
||||
let data = ''
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<span
|
||||
<div
|
||||
v-for="(group, i) in groups"
|
||||
:key="'group-'+group.name"
|
||||
:slot="'id:'+group.name"
|
||||
@@ -18,7 +18,7 @@
|
||||
:index="i"
|
||||
:line="i !== 0 && !groupHidden(groups[i - 1], i - 1)"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</DataForm>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import BasicTree from '@/components/Form/FormFields/BasicTree.vue'
|
||||
import JsonEditor from '@/components/Form/FormFields/JsonEditor.vue'
|
||||
import { assignIfNot, toSentenceCase } from '@/utils/common'
|
||||
import TagInput from '@/components/Form/FormFields/TagInput.vue'
|
||||
import TransferSelect from '@/components/Form/FormFields/TransferSelect.vue'
|
||||
import i18n from '@/i18n/i18n'
|
||||
|
||||
export class FormFieldGenerator {
|
||||
@@ -135,9 +134,6 @@ export class FormFieldGenerator {
|
||||
case 'comment':
|
||||
field.el.type = 'textarea'
|
||||
break
|
||||
case 'users':
|
||||
field.component = TransferSelect
|
||||
field.el.label = field.label
|
||||
}
|
||||
return field
|
||||
}
|
||||
@@ -197,6 +193,24 @@ export class FormFieldGenerator {
|
||||
return field
|
||||
}
|
||||
|
||||
setChoicesTips(field, fieldMeta, fieldRemoteMeta) {
|
||||
// 设置 checkbox 的 tips
|
||||
if (['checkbox-group', 'radio-group'].indexOf(field.type) !== -1) {
|
||||
field.options.map(option => {
|
||||
if (!option.tip && field.tips) {
|
||||
option.tip = field.tips[option.value]
|
||||
}
|
||||
if (!option.tip) {
|
||||
const match = option.label.match(/^(.+?)\s*\((.*?)\)$/)
|
||||
if (match) {
|
||||
option.label = match[1]
|
||||
option.tip = match[2]
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
afterGenerateField(field) {
|
||||
field.label = toSentenceCase(field.label)
|
||||
|
||||
@@ -204,15 +218,7 @@ export class FormFieldGenerator {
|
||||
field.el.placeholder = field.placeholder
|
||||
}
|
||||
|
||||
// 设置 checkbox 的 tips
|
||||
if (field.tips && ['checkbox-group', 'radio-group'].indexOf(field.type) !== -1) {
|
||||
field.options.map(option => {
|
||||
if (!option.tip && field.tips[option.value]) {
|
||||
option.tip = field.tips[option.value]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.setChoicesTips(field)
|
||||
return field
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
placement="right"
|
||||
popper-class="help-tips"
|
||||
>
|
||||
<div slot="content" v-sanitize="data.helpTip" /> <!-- Noncompliant -->
|
||||
<div slot="content" v-sanitize="data.helpTip" class="help-tip-content" /> <!-- Noncompliant -->
|
||||
<i class="fa fa-question-circle-o help-tip-icon" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
@@ -322,4 +322,9 @@ export default {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.help-tip-content {
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
>
|
||||
{{ iSubmitBtnText }}
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
v-if="defaultButton && hasSaveContinue"
|
||||
size="small"
|
||||
@@ -40,6 +41,7 @@
|
||||
>
|
||||
{{ $t("SaveAndAddAnother") }}
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
v-if="defaultButton && hasReset"
|
||||
size="small"
|
||||
@@ -47,6 +49,7 @@
|
||||
>
|
||||
{{ $t("Reset") }}
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
v-for="button in moreButtons"
|
||||
v-show="!button.hidden"
|
||||
@@ -217,7 +220,7 @@ export default {
|
||||
|
||||
.el-form-item__label {
|
||||
padding: 0 30px 0 0;
|
||||
line-height: 32px;
|
||||
line-height: 30px;
|
||||
color: var(--color-text-primary);
|
||||
|
||||
i {
|
||||
|
||||
@@ -8,99 +8,118 @@
|
||||
:label="item.name"
|
||||
:prop="item.name"
|
||||
>
|
||||
|
||||
<template v-if="item.type === 'button' && !item.isVisible">
|
||||
<el-button
|
||||
:type="item.el && item.el.type"
|
||||
class="start-stop-btn"
|
||||
size="mini"
|
||||
@click="item.callback()"
|
||||
>
|
||||
<i :class="item.icon" />{{ item.name }}
|
||||
</el-button>
|
||||
<el-tooltip :disabled="!item.tip" :content="item.tip">
|
||||
<el-button
|
||||
:type="item.el && item.el.type"
|
||||
class="start-stop-btn"
|
||||
size="mini"
|
||||
@click="item.callback()"
|
||||
>
|
||||
<i :class="item.icon" />
|
||||
|
||||
{{ item.name }}
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
||||
<template v-if="item.type === 'input' && item.el && item.el.autoComplete">
|
||||
<el-autocomplete
|
||||
v-model="formModel[item.name]"
|
||||
:fetch-suggestions="item.el.query"
|
||||
:placeholder="item.placeholder"
|
||||
class="inline-input"
|
||||
size="mini"
|
||||
@change="handleInputChange(item)"
|
||||
@select="handleInputChange(item)"
|
||||
/>
|
||||
<el-tooltip :disabled="!item.tip" :content="item.tip">
|
||||
<el-autocomplete
|
||||
v-model="formModel[item.name]"
|
||||
:fetch-suggestions="item.el.query"
|
||||
:placeholder="item.placeholder"
|
||||
class="inline-input"
|
||||
size="mini"
|
||||
clearable
|
||||
@change="handleInputChange(item)"
|
||||
@select="handleInputChange(item)"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
||||
<template v-else-if="item.type === 'input'">
|
||||
<el-input
|
||||
v-model="formModel[item.name]"
|
||||
:class="!isFold ? 'special-style' : ''"
|
||||
:placeholder="item.placeholder"
|
||||
class="inline-input"
|
||||
size="mini"
|
||||
@change="item.callback(formModel[item.name])"
|
||||
/>
|
||||
<el-tooltip :disabled="!item.tip" :content="item.tip">
|
||||
<el-input
|
||||
v-model="formModel[item.name]"
|
||||
:class="!isFold ? 'special-style' : ''"
|
||||
:placeholder="item.placeholder"
|
||||
class="inline-input"
|
||||
size="mini"
|
||||
@change="item.callback(formModel[item.name])"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
||||
<template v-if="item.type === 'select' && item.el && item.el.create">
|
||||
<span class="filter-label">{{ item.name }}:</span>
|
||||
<el-select
|
||||
v-if="item.type === 'select' && item.el && item.el.create"
|
||||
:key="index"
|
||||
v-model="formModel[item.name]"
|
||||
:allow-create="item.el.create || false"
|
||||
:filterable="item.el.create || false"
|
||||
:multiple="item.el.multiple"
|
||||
:placeholder="item.name"
|
||||
class="autoWidth-select"
|
||||
default-first-option
|
||||
size="mini"
|
||||
@change="item.callback(item.value)"
|
||||
>
|
||||
<template slot="prefix">{{ item.label + ':' + item.value }}</template>
|
||||
<el-option
|
||||
v-for="(option, id) in item.options"
|
||||
:key="id"
|
||||
:label="option.label"
|
||||
:title="option.value"
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-tooltip :disabled="!item.tip" :content="item.tip">
|
||||
<span class="filter-label">{{ item.name }}:</span>
|
||||
<el-select
|
||||
v-if="item.type === 'select' && item.el && item.el.create"
|
||||
:key="index"
|
||||
v-model="formModel[item.name]"
|
||||
:allow-create="item.el.create || false"
|
||||
:filterable="item.el.create || false"
|
||||
:multiple="item.el.multiple"
|
||||
:placeholder="item.name"
|
||||
class="autoWidth-select"
|
||||
default-first-option
|
||||
size="mini"
|
||||
@change="item.callback(item.value)"
|
||||
>
|
||||
<template slot="prefix">{{ item.label + ':' + item.value }}</template>
|
||||
<el-option
|
||||
v-for="(option, id) in item.options"
|
||||
:key="id"
|
||||
:label="option.label"
|
||||
:title="option.value"
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
||||
<template v-if="item.type === 'select' && (!item.el || !item.el.create)">
|
||||
<el-dropdown
|
||||
class="select-dropdown"
|
||||
trigger="click"
|
||||
@command="(command) => {
|
||||
item.value = command
|
||||
item.callback(command)
|
||||
}"
|
||||
>
|
||||
<el-button size="mini" type="primary">
|
||||
<div class="text-content">
|
||||
<span class="content">
|
||||
{{ getLabel(item.value, item.options) }}
|
||||
<i class="el-icon-arrow-down el-icon--right" />
|
||||
</span>
|
||||
</div>
|
||||
</el-button>
|
||||
<el-dropdown-menu v-slot="dropdown">
|
||||
<el-dropdown-item
|
||||
v-for="(option, i) in item.options"
|
||||
:key="i"
|
||||
:command="option.value"
|
||||
>
|
||||
{{ option.label }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<el-tooltip :disabled="!item.tip" :content="item.tip">
|
||||
<el-dropdown
|
||||
class="select-dropdown"
|
||||
trigger="click"
|
||||
@command="(command) => {
|
||||
item.value = command
|
||||
item.callback(command)
|
||||
}"
|
||||
>
|
||||
<el-button size="mini" type="primary">
|
||||
<div class="text-content">
|
||||
<span class="content">
|
||||
{{ getLabel(item.value, item.options) }}
|
||||
<i class="el-icon-arrow-down el-icon--right" />
|
||||
</span>
|
||||
</div>
|
||||
</el-button>
|
||||
<el-dropdown-menu v-slot="dropdown">
|
||||
<el-dropdown-item
|
||||
v-for="(option, i) in item.options"
|
||||
:key="i"
|
||||
:command="option.value"
|
||||
>
|
||||
{{ option.label }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
||||
<template v-if="item.type === 'switch'">
|
||||
<el-switch
|
||||
v-model="formModel[item.name]"
|
||||
:active-text="item.name"
|
||||
:disabled="item.disabled"
|
||||
@change="item.callback(formModel[item.name])"
|
||||
/>
|
||||
<el-tooltip :disabled="!item.tip" :content="item.tip">
|
||||
<el-switch
|
||||
v-model="formModel[item.name]"
|
||||
:active-text="item.name"
|
||||
:disabled="item.disabled"
|
||||
@change="item.callback(formModel[item.name])"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-form-item>
|
||||
<div
|
||||
@@ -134,7 +153,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
<codemirror ref="myCm" v-model="iValue" :options="iOptions" class="editor" />
|
||||
<codemirror
|
||||
ref="myCm"
|
||||
v-model="iValue"
|
||||
:options="iOptions"
|
||||
class="editor"
|
||||
:style="iActions.length > 0 ? { marginLeft: '30px' } : {}"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -208,7 +233,7 @@ export default {
|
||||
|
||||
Object.values(actionsObj).forEach(action => {
|
||||
if (action.name === this.$t('RunAs') && action.type === 'input') {
|
||||
rules[action.name] = [{ required: true, message: '请输入运行用户', trigger: 'blur' }]
|
||||
rules[action.name] = [{ required: true, message: this.$t('RequiredRunas'), trigger: 'blur' }]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -373,7 +398,6 @@ $input-border-color: #C0C4CC;
|
||||
}
|
||||
|
||||
.editor {
|
||||
margin-left: 30px;
|
||||
border: 1px solid var(--color-border);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
defaultValue: 24,
|
||||
displayMapper: {
|
||||
'second': this.$t('Second'), // 'sec' is the default value of 'unit
|
||||
'min': this.$t('Minute'), // 'min' is the default value of 'unit
|
||||
|
||||
@@ -48,7 +48,8 @@ export default {
|
||||
type: 'input-number',
|
||||
el: {
|
||||
min: 8,
|
||||
max: 30
|
||||
max: 36,
|
||||
size: 'mini'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-input v-model="rawValue.phone" required :placeholder="$tc('InputPhone')" @input="OnInputChange">
|
||||
<el-input v-model="rawValue.phone" :placeholder="$tc('InputPhone')" required @input="onInputChange">
|
||||
<el-select
|
||||
slot="prepend"
|
||||
:placeholder="$tc('Select')"
|
||||
:value="rawValue.code"
|
||||
style="width: 75px;"
|
||||
@change="OnChange"
|
||||
style="width: 105px;"
|
||||
@change="onChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="country in countries"
|
||||
:key="country.value"
|
||||
:key="country.name"
|
||||
:label="country.value"
|
||||
:value="country.value"
|
||||
style="width: 200px;"
|
||||
>
|
||||
<span style="float: left">{{ country.name }}</span>
|
||||
<span class="country-name">{{ country.name }}</span>
|
||||
<span style="float: right; font-size: 13px">{{ country.value }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
@@ -24,19 +23,19 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'PhoneInput',
|
||||
props: {
|
||||
value: {
|
||||
type: [Object, String],
|
||||
default: () => ({ 'code': '+86', 'phone': '' })
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
rawValue: {}
|
||||
rawValue: {},
|
||||
countries: [{ 'name': 'China', 'value': '+86' }]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -45,26 +44,38 @@ export default {
|
||||
return ''
|
||||
}
|
||||
return `${this.rawValue.code}${this.rawValue.phone}`
|
||||
},
|
||||
countries: {
|
||||
get() {
|
||||
return this.publicSettings.COUNTRY_CALLING_CODES
|
||||
}
|
||||
},
|
||||
...mapGetters(['publicSettings'])
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.rawValue = this.value || { code: '+86', phone: '' }
|
||||
const defaults = { code: localStorage.getItem('prePhoneCode') || '+86', phone: '' }
|
||||
this.rawValue = this.value || defaults
|
||||
this.$axios.get('/api/v1/common/countries/').then(res => {
|
||||
this.countries = res.map(item => {
|
||||
return { name: `${item.flag} ${item.name}`, value: item.phone_code }
|
||||
})
|
||||
})
|
||||
this.$emit('input', this.fullPhone)
|
||||
},
|
||||
methods: {
|
||||
OnChange(countryCode) {
|
||||
onChange(countryCode) {
|
||||
this.rawValue.code = countryCode
|
||||
this.OnInputChange()
|
||||
this.onInputChange()
|
||||
localStorage.setItem('prePhoneCode', countryCode)
|
||||
},
|
||||
OnInputChange() {
|
||||
onInputChange() {
|
||||
this.$emit('input', this.fullPhone)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.country-name {
|
||||
display: inline-block;
|
||||
width: 150px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
padding-right: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -144,9 +144,6 @@ export default {
|
||||
watch: {
|
||||
choices: {
|
||||
handler(value, oldValue) {
|
||||
if (value?.length === oldValue?.length) {
|
||||
return
|
||||
}
|
||||
this.loading = true
|
||||
setTimeout(() => {
|
||||
this.setDefaultItems(value)
|
||||
@@ -345,6 +342,10 @@ export default {
|
||||
.protocol-item {
|
||||
display: flex;
|
||||
margin: 5px 0;
|
||||
|
||||
&:first-of-type {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.input-button {
|
||||
|
||||
@@ -125,16 +125,19 @@ export default {
|
||||
allowCreate: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
defaultPageSize: {
|
||||
type: Number,
|
||||
default: 10
|
||||
}
|
||||
},
|
||||
data() {
|
||||
const vm = this
|
||||
const defaultPageSize = 10
|
||||
const defaultParams = {
|
||||
search: '',
|
||||
page: 1,
|
||||
hasMore: true,
|
||||
pageSize: defaultPageSize
|
||||
pageSize: vm.defaultPageSize
|
||||
}
|
||||
// 设置axios全局报错提示不显示
|
||||
const validateStatus = (status) => {
|
||||
@@ -194,7 +197,6 @@ export default {
|
||||
}
|
||||
},
|
||||
iAjax() {
|
||||
const defaultPageSize = 10
|
||||
const defaultMakeParams = (params) => {
|
||||
const page = params.page || 1
|
||||
const offset = (page - 1) * params.pageSize
|
||||
@@ -237,7 +239,7 @@ export default {
|
||||
}
|
||||
const defaultAjax = {
|
||||
url: '',
|
||||
pageSize: defaultPageSize,
|
||||
pageSize: this.defaultPageSize,
|
||||
makeParams: defaultMakeParams,
|
||||
transformOption: defaultTransformOption,
|
||||
processResults: defaultProcessResults,
|
||||
|
||||
@@ -14,10 +14,12 @@
|
||||
:close-on-click-modal="false"
|
||||
:title="label"
|
||||
:visible.sync="showTransfer"
|
||||
:disabled-status="!isLoaded"
|
||||
class="the-dialog"
|
||||
width="730px"
|
||||
@cancel="handleTransCancel"
|
||||
@confirm="handleTransConfirm"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<krryPaging v-if="selectInitialized" ref="pageTransfer" class="transfer" v-bind="pagingTransfer" />
|
||||
</Dialog>
|
||||
@@ -77,13 +79,16 @@ export default {
|
||||
if (keyword) {
|
||||
params['search'] = keyword
|
||||
}
|
||||
this.isLoaded = false
|
||||
const data = await this.$axios.get(url, { params })
|
||||
this.isLoaded = true
|
||||
return data['results'].map(item => {
|
||||
const n = transformOption(item)
|
||||
return { id: n.value, label: n.label }
|
||||
})
|
||||
}
|
||||
return {
|
||||
isLoaded: false,
|
||||
showTransfer: false,
|
||||
selectInitialized: false,
|
||||
select2: {
|
||||
@@ -167,7 +172,3 @@ export default {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
@@ -42,7 +42,7 @@ export default {
|
||||
patterns.push([/\d/, i18n.t('NUMBER_REQUIRED')])
|
||||
}
|
||||
if (passwordRule['SECURITY_PASSWORD_SPECIAL_CHAR']) {
|
||||
const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
|
||||
const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?_+-]")
|
||||
patterns.push([pattern, i18n.t('SPECIAL_CHAR_REQUIRED')])
|
||||
}
|
||||
for (const [pattern, msg] of patterns) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
v-if="showColumnSettingPopover"
|
||||
:cancel-title="$tc('RestoreDefault')"
|
||||
:destroy-on-close="true"
|
||||
:title="$tc('TableSetting')"
|
||||
:title="$tc('ListPreference')"
|
||||
:visible.sync="showColumnSettingPopover"
|
||||
top="10%"
|
||||
width="50%"
|
||||
@@ -90,8 +90,14 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBus.$off('showColumnSettingPopover', this.showColumnSettingPopoverHandler)
|
||||
},
|
||||
mounted() {
|
||||
this.$eventBus.$on('showColumnSettingPopover', ({ url }) => {
|
||||
this.$eventBus.$on('showColumnSettingPopover', this.showColumnSettingPopoverHandler)
|
||||
},
|
||||
methods: {
|
||||
showColumnSettingPopoverHandler({ url }) {
|
||||
if (url === this.url) {
|
||||
this.checkAll = false
|
||||
this.showColumnSettingPopover = true
|
||||
@@ -105,9 +111,7 @@ export default {
|
||||
this.checkAll = false
|
||||
this.isIndeterminate = true
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
handleColumnConfirm() {
|
||||
this.showColumnSettingPopover = false
|
||||
this.$emit('columnsUpdate', { columns: this.iCurrentColumns, url: this.url })
|
||||
|
||||
@@ -153,6 +153,8 @@ export default {
|
||||
this.toggleRowSelection(row, true)
|
||||
}
|
||||
}
|
||||
|
||||
this.$emit('loaded')
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
localStorage.setItem('paginationSize', val)
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
import Dialog from '@/components/Dialog/index.vue'
|
||||
import { createSourceIdCache } from '@/api/common'
|
||||
import * as queryUtil from '@/components/Table/DataTable/compenents/el-data-table/utils/query'
|
||||
import { download } from '@/utils/common'
|
||||
|
||||
export default {
|
||||
name: 'ExportDialog',
|
||||
@@ -170,14 +171,18 @@ export default {
|
||||
]
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBus.$off('showExportDialog', this.showExportDialogHandler)
|
||||
},
|
||||
mounted() {
|
||||
this.$eventBus.$on('showExportDialog', ({ selectedRows, url, name }) => {
|
||||
this.$eventBus.$on('showExportDialog', this.showExportDialogHandler)
|
||||
},
|
||||
methods: {
|
||||
showExportDialogHandler({ selectedRows, url, name }) {
|
||||
if (url === this.url || url.indexOf(this.url) > -1) {
|
||||
this.showExportDialog()
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
showExportDialog() {
|
||||
if (!this.mfaVerifyRequired) {
|
||||
this.exportDialogShow = true
|
||||
@@ -197,10 +202,7 @@ export default {
|
||||
})
|
||||
},
|
||||
downloadCsv(url) {
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.click()
|
||||
window.URL.revokeObjectURL(url)
|
||||
download(url)
|
||||
},
|
||||
async defaultPerformExport(selectRows, exportOption, q, exportTypeOption) {
|
||||
const url = (process.env.VUE_APP_ENV === 'production') ? (`${this.url}`) : (`${process.env.VUE_APP_BASE_API}${this.url}`)
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
<script>
|
||||
import Dialog from '@/components/Dialog/index.vue'
|
||||
import ImportTable from '@/components/Table/ListTable/TableAction/ImportTable.vue'
|
||||
import { getErrorResponseMsg } from '@/utils/common'
|
||||
import { download, getErrorResponseMsg } from '@/utils/common'
|
||||
import { createSourceIdCache } from '@/api/common'
|
||||
|
||||
export default {
|
||||
@@ -142,14 +142,18 @@ export default {
|
||||
this.showTable = false
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBus.$off('showImportDialog', this.showImportEventHandler)
|
||||
},
|
||||
mounted() {
|
||||
this.$eventBus.$on('showImportDialog', ({ url }) => {
|
||||
this.$eventBus.$on('showImportDialog', this.showImportEventHandler)
|
||||
},
|
||||
methods: {
|
||||
showImportEventHandler({ url }) {
|
||||
if (url === this.url) {
|
||||
this.showImportDialog = true
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
closeDialog() {
|
||||
this.showImportDialog = false
|
||||
this.$emit('importDialogClose')
|
||||
@@ -226,10 +230,7 @@ export default {
|
||||
this.$message.success(msg)
|
||||
},
|
||||
downloadCsv(url) {
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.click()
|
||||
window.URL.revokeObjectURL(url)
|
||||
download(url)
|
||||
},
|
||||
async handleImportConfirm() {
|
||||
await this.$refs['importTable'].performUpload()
|
||||
|
||||
@@ -44,8 +44,9 @@
|
||||
import DataTable from '@/components/Table/DataTable/index.vue'
|
||||
import { getUpdateObjURL } from '@/utils/common'
|
||||
import { sleep } from '@/utils/time'
|
||||
import { EditableInputFormatter, StatusFormatter } from '@/components/Table/TableFormatters'
|
||||
import { EditableInputFormatter } from '@/components/Table/TableFormatters'
|
||||
import { encryptPassword } from '@/utils/crypto'
|
||||
import getStatusColumnMeta from '@/components/Table/ListTable/TableAction/const'
|
||||
|
||||
export default {
|
||||
name: 'ImportTable',
|
||||
@@ -223,38 +224,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
generateTableColumns(tableTitles, tableData) {
|
||||
const vm = this
|
||||
const columns = [{
|
||||
prop: '@status',
|
||||
label: vm.$t('Status'),
|
||||
width: '80px',
|
||||
align: 'center',
|
||||
formatter: StatusFormatter,
|
||||
formatterArgs: {
|
||||
faChoices: {
|
||||
ok: 'fa-check text-primary',
|
||||
error: 'fa-times text-danger',
|
||||
pending: 'fa-clock-o'
|
||||
},
|
||||
getChoicesKey(val) {
|
||||
if (val === 'ok' || val === 'pending') {
|
||||
return val
|
||||
}
|
||||
return 'error'
|
||||
},
|
||||
getTip(val) {
|
||||
if (val === 'ok') {
|
||||
return vm.$t('Success')
|
||||
} else if (val === 'pending') {
|
||||
return vm.$t('Pending')
|
||||
} else if (val && val.name === 'error') {
|
||||
return val.error
|
||||
}
|
||||
return ''
|
||||
},
|
||||
hasTips: true
|
||||
}
|
||||
}]
|
||||
const columns = [{ ...getStatusColumnMeta.bind(this)().status }]
|
||||
for (const item of tableTitles) {
|
||||
const dataItemLens = tableData.map(d => {
|
||||
if (!d) {
|
||||
|
||||
@@ -71,7 +71,16 @@ export default {
|
||||
this.listenViewPort()
|
||||
},
|
||||
mounted() {
|
||||
this.$eventBus.$on('labelSearch', label => {
|
||||
this.$eventBus.$on('labelSearch', this.labelSearchHandler)
|
||||
},
|
||||
beforeDestroy(label) {
|
||||
this.$eventBus.$off('labelSearch', this.labelSearchHandler)
|
||||
},
|
||||
methods: {
|
||||
handleCascaderFocus() {
|
||||
this.setSearchFocus()
|
||||
},
|
||||
labelSearchHandler(label) {
|
||||
if (!label) {
|
||||
this.labelValue = []
|
||||
this.showLabelSearch = true
|
||||
@@ -82,14 +91,6 @@ export default {
|
||||
setTimeout(() => {
|
||||
this.showLabelSearch = true
|
||||
}, 500)
|
||||
})
|
||||
},
|
||||
destroyed() {
|
||||
this.$eventBus.$off('labelSearch')
|
||||
},
|
||||
methods: {
|
||||
handleCascaderFocus() {
|
||||
this.setSearchFocus()
|
||||
},
|
||||
handleCascaderVisibleChange(visible) {
|
||||
const input = this.$refs.labelCascader.$el
|
||||
|
||||
@@ -106,7 +106,7 @@ export default {
|
||||
{
|
||||
name: 'actionSetting',
|
||||
icon: 'system-setting',
|
||||
tip: this.$t('TableSetting'),
|
||||
tip: this.$t('ListPreference'),
|
||||
has: this.hasColumnSetting,
|
||||
callback: this.handleTableSettingClick.bind(this)
|
||||
},
|
||||
|
||||
40
src/components/Table/ListTable/TableAction/const.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import { StatusFormatter } from '@/components/Table/TableFormatters'
|
||||
import i18n from '@/i18n/i18n'
|
||||
|
||||
export const getStatusColumnMeta = (prop = '@status') => {
|
||||
return {
|
||||
status: {
|
||||
prop: prop,
|
||||
label: i18n.t('Status'),
|
||||
width: '80px',
|
||||
align: 'center',
|
||||
formatter: StatusFormatter,
|
||||
formatterArgs: {
|
||||
faChoices: {
|
||||
ok: 'fa-check text-primary',
|
||||
error: 'fa-times text-danger',
|
||||
pending: 'fa-clock-o'
|
||||
},
|
||||
getChoicesKey: (val) => {
|
||||
if (val === 'ok' || val === 'pending') {
|
||||
return val
|
||||
}
|
||||
return 'error'
|
||||
},
|
||||
getTip: (val) => {
|
||||
if (val === 'ok') {
|
||||
return i18n.t('Success')
|
||||
} else if (val === 'pending') {
|
||||
return i18n.t('Pending')
|
||||
} else if ((val && val.name === 'error') || val.error !== undefined) {
|
||||
return val.error
|
||||
}
|
||||
return ''
|
||||
},
|
||||
hasTips: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default getStatusColumnMeta
|
||||
@@ -124,6 +124,9 @@ export default {
|
||||
return this.iHasLeftActions ? 'right' : 'left'
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$emit('done')
|
||||
},
|
||||
methods: {
|
||||
handleTagSearch(val) {
|
||||
this.searchTable(val)
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
:selected-rows="selectedRows"
|
||||
:table-url="tableUrl"
|
||||
v-bind="iHeaderActions"
|
||||
@done="handleActionInitialDone"
|
||||
/>
|
||||
<IBox class="table-content">
|
||||
<AutoDataTable
|
||||
v-if="actionInit"
|
||||
ref="dataTable"
|
||||
:config="iTableConfig"
|
||||
:filter-table="filter"
|
||||
@@ -73,9 +75,11 @@ export default {
|
||||
return {
|
||||
selectedRows: [],
|
||||
init: false,
|
||||
extraQuery: extraQuery,
|
||||
urlUpdated: {},
|
||||
isDeactivated: false
|
||||
isDeactivated: false,
|
||||
extraQuery: extraQuery,
|
||||
actionInit: this.headerActions.has === false,
|
||||
initQuery: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -185,31 +189,54 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.urlUpdated[this.tableUrl] = location.href
|
||||
this.$set(this.urlUpdated, this.tableUrl, location.href)
|
||||
},
|
||||
deactivated() {
|
||||
this.isDeactivated = true
|
||||
},
|
||||
activated() {
|
||||
this.isDeactivated = false
|
||||
const preURL = this.urlUpdated[this.tableUrl]
|
||||
if (!preURL || preURL === location.href) {
|
||||
return
|
||||
}
|
||||
this.urlUpdated[this.tableUrl] = location.href
|
||||
this.$log.debug('Reload the table get latest data: pre ', preURL, ' current: ', location.href)
|
||||
setTimeout(() => {
|
||||
this.$nextTick(() => {
|
||||
this.isDeactivated = false
|
||||
const cleanUrl = this.tableUrl.split('?')[0]
|
||||
const preURL = this.urlUpdated[cleanUrl]
|
||||
|
||||
if (!preURL || preURL === location.href) return
|
||||
|
||||
this.$set(this.urlUpdated, this.tableUrl, location.href)
|
||||
this.$log.debug('Reload the table get latest data: pre ', preURL, ' current: ', location.href)
|
||||
this.reloadTable()
|
||||
}, 500)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
handleActionInitialDone() {
|
||||
setTimeout(() => {
|
||||
this.actionInit = true
|
||||
}, 100)
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.selectedRows = val
|
||||
},
|
||||
reloadTable() {
|
||||
this.dataTable?.getList()
|
||||
},
|
||||
updateInitQuery(attrs) {
|
||||
if (!this.actionInit) {
|
||||
this.initQuery = attrs
|
||||
for (const key in attrs) {
|
||||
this.$set(this.extraQuery, key, attrs[key])
|
||||
}
|
||||
return true
|
||||
}
|
||||
const removeKeys = Object.keys(this.initQuery).filter(key => !attrs[key])
|
||||
for (const key of removeKeys) {
|
||||
this.$delete(this.extraQuery, key)
|
||||
}
|
||||
},
|
||||
search(attrs) {
|
||||
const init = this.updateInitQuery(attrs)
|
||||
if (init) {
|
||||
return
|
||||
}
|
||||
this.$log.debug('ListTable: search table', attrs)
|
||||
this.$emit('TagSearch', attrs)
|
||||
this.$refs.dataTable?.$refs.dataTable?.search(attrs, true)
|
||||
|
||||
@@ -51,7 +51,7 @@ export default {
|
||||
const formatterArgs = Object.assign(this.formatterArgsDefault, this.col.formatterArgs || {})
|
||||
return {
|
||||
formatterArgs: formatterArgs,
|
||||
data: formatterArgs.async ? [] : (this.cellValue || []),
|
||||
listData: formatterArgs.async ? [] : (this.cellValue || []),
|
||||
amount: '',
|
||||
asyncGetDone: false
|
||||
}
|
||||
@@ -68,17 +68,18 @@ export default {
|
||||
return [this.$t('Loading') + '...']
|
||||
}
|
||||
const getItem = this.formatterArgs.getItem || (item => item.name)
|
||||
|
||||
let data = []
|
||||
if (Array.isArray(this.data)) {
|
||||
data = this.data.map(item => getItem(item)) || []
|
||||
} else {
|
||||
// object {key: [value]}
|
||||
data = Object.entries(this.data).map(([key, value]) => {
|
||||
|
||||
if (Array.isArray(this.listData)) {
|
||||
data = this.listData.map(item => getItem(item)).filter(Boolean)
|
||||
} else if (this.listData && typeof this.listData === 'object') {
|
||||
data = Object.entries(this.listData).map(([key, value]) => {
|
||||
const item = { key: key, value: value }
|
||||
return getItem(item)
|
||||
}) || []
|
||||
}).filter(Boolean)
|
||||
}
|
||||
data = data.filter(Boolean)
|
||||
|
||||
return data
|
||||
},
|
||||
showItems() {
|
||||
@@ -86,8 +87,12 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
cellValue() {
|
||||
this.computeAmount()
|
||||
cellValue: {
|
||||
handler(newValue) {
|
||||
// listData 需要重新赋值一遍 items 重新计算
|
||||
this.listData = newValue
|
||||
this.computeAmount()
|
||||
}
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
@@ -105,6 +110,7 @@ export default {
|
||||
// object {key: [value]}
|
||||
cellValue = Object.keys(this.cellValue)
|
||||
}
|
||||
|
||||
this.amount = (cellValue?.filter(value => !this.cellValueToRemove.includes(value)) || []).length
|
||||
}
|
||||
},
|
||||
@@ -127,7 +133,7 @@ export default {
|
||||
const params = this.formatterArgs.ajax.params || {}
|
||||
const transform = this.formatterArgs.ajax.transform || (resp => resp[this.col.prop.replace('_amount', '')])
|
||||
const response = await this.$axios.get(url, { params: params })
|
||||
this.data = transform(response)
|
||||
this.listData = transform(response)
|
||||
this.asyncGetDone = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<span>{{ value }}</span>
|
||||
<span class="date">{{ dateValue }}</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -10,24 +10,31 @@ export default {
|
||||
name: 'DateFormatter',
|
||||
extends: BaseFormatter,
|
||||
data() {
|
||||
let value
|
||||
if (this.cellValue) {
|
||||
value = toSafeLocalDateStr(this.cellValue)
|
||||
} else {
|
||||
value = '-'
|
||||
}
|
||||
// let value
|
||||
// if (this.cellValue) {
|
||||
// value = toSafeLocalDateStr(this.cellValue)
|
||||
// } else {
|
||||
// value = '-'
|
||||
// }
|
||||
// const locale = this.$i18n.locale
|
||||
// const value = dt.toLocaleString(locale, { hourCycle: 'h23' })
|
||||
// debug(this.$i18n.locale)
|
||||
return {
|
||||
value: value
|
||||
}
|
||||
// return {
|
||||
// value: value
|
||||
// }
|
||||
// return {
|
||||
// value: `${year}-${month}-${date} ${hour}:${minutes}:${seconds}`
|
||||
// }
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
dateValue() {
|
||||
if (this.cellValue) {
|
||||
return toSafeLocalDateStr(this.cellValue)
|
||||
} else {
|
||||
return '-'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<template>
|
||||
<div style="width: 100%;min-height: 20px" @click.stop="editCell">
|
||||
<div class="edit-container" style="min-height: 20px" @click.stop="editCell">
|
||||
<el-input
|
||||
v-if="inEditMode"
|
||||
ref="inputRef"
|
||||
v-model="value"
|
||||
class="editInput"
|
||||
size="mini"
|
||||
@@ -9,8 +10,17 @@
|
||||
@keyup.enter.native="onInputEnter"
|
||||
/>
|
||||
<template v-else>
|
||||
<span>{{ iCellValue }}</span>
|
||||
<span class="cellValue">{{ iCellValue }}</span>
|
||||
<a
|
||||
v-if="formatterArgs.showEditBtn"
|
||||
:class="[{ 'disabled-link': this.$store.getters.currentOrgIsRoot },'edit-btn']"
|
||||
style="padding-left: 5px"
|
||||
@click="editCell"
|
||||
>
|
||||
<i class="fa fa-edit" />
|
||||
</a>
|
||||
</template>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -61,6 +71,9 @@ export default {
|
||||
editCell() {
|
||||
if (this.formatterArgs.canEdit) {
|
||||
this.inEditMode = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.inputRef.focus()
|
||||
})
|
||||
}
|
||||
},
|
||||
getCellValue(val) {
|
||||
@@ -88,7 +101,7 @@ export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style lang="scss" scoped>
|
||||
.editInput ::v-deep .el-input__inner {
|
||||
padding: 2px;
|
||||
line-height: 12px;
|
||||
@@ -97,4 +110,35 @@ export default {
|
||||
.editInput {
|
||||
padding: -6px;
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
visibility: hidden;
|
||||
position: relative;
|
||||
transition: all 1s;
|
||||
|
||||
& > i {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.edit-container {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
|
||||
&:hover {
|
||||
.edit-btn {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
|
||||
.cellValue {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<span v-if="!iLabels || iLabels.length === 0" style="vertical-align: top;">
|
||||
-
|
||||
</span>
|
||||
<div v-else>
|
||||
<div
|
||||
<span v-else class="label-wrapper">
|
||||
<span
|
||||
v-for="label of iLabels"
|
||||
:key="label.id"
|
||||
>
|
||||
@@ -15,8 +15,9 @@
|
||||
class="tag-formatter"
|
||||
@click="handleLabelSearch(label)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<span />
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
<a
|
||||
v-if="formatterArgs.showEditBtn"
|
||||
@@ -30,15 +31,16 @@
|
||||
v-if="showDialog"
|
||||
:title="$tc('BindLabel')"
|
||||
:visible.sync="showDialog"
|
||||
class="tag-dialog"
|
||||
width="600px"
|
||||
@cancel="handleCancel"
|
||||
@confirm="handleConfirm"
|
||||
>
|
||||
<el-row :gutter="1" class="tag-select">
|
||||
<el-row class="tag-select">
|
||||
<el-col :span="12">
|
||||
<Select2 v-model="keySelect2.value" v-bind="keySelect2" @change="handleKeyChanged" />
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-col :span="12" style="padding-left: 5px">
|
||||
<Select2
|
||||
v-model="valueSelect2.value"
|
||||
:disabled="!keySelect2.value"
|
||||
@@ -129,6 +131,16 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
watch: {
|
||||
cellValue: {
|
||||
handler(newValue) {
|
||||
if (newValue) {
|
||||
this.initial = this.formatterArgs.getLabels(this.cellValue)
|
||||
this.iLabels = [...this.initial]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initial = this.formatterArgs.getLabels(this.cellValue)
|
||||
this.iLabels = [...this.initial]
|
||||
@@ -207,18 +219,11 @@ export default {
|
||||
flex-wrap: wrap;
|
||||
|
||||
& > span {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
|
||||
.tag-select {
|
||||
::v-deep .el-input__inner::placeholder {
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
visibility: hidden;
|
||||
position: relative;
|
||||
@@ -233,9 +238,14 @@ export default {
|
||||
|
||||
.label-container {
|
||||
display: flex;
|
||||
height: 28px;
|
||||
|
||||
.label-formatter-col {
|
||||
overflow: hidden;
|
||||
|
||||
&:hover {
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
@@ -249,15 +259,23 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
.tag-zone {
|
||||
margin: 20px 0 0 0;
|
||||
border: solid 1px #ebeef5;
|
||||
padding: 10px;
|
||||
background: #f2f2f5;
|
||||
.tag-dialog {
|
||||
.tag-zone {
|
||||
margin: 20px 0 0 0;
|
||||
border: solid 1px #ebeef5;
|
||||
padding: 10px;
|
||||
background: #f2f2f5;
|
||||
|
||||
.tag-formatter {
|
||||
margin: 1px 3px;
|
||||
display: inline-block;
|
||||
.tag-formatter {
|
||||
margin: 1px 3px;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.tag-select {
|
||||
::v-deep .el-input__inner::placeholder {
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +288,6 @@ export default {
|
||||
|
||||
.tag-formatter {
|
||||
margin: 2px 0;
|
||||
|
||||
}
|
||||
|
||||
.tag-tip {
|
||||
|
||||
@@ -55,8 +55,9 @@ export default {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tag {
|
||||
display: flex;
|
||||
display: inline-block;
|
||||
flex-wrap: wrap;
|
||||
|
||||
& > span {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
|
||||
@@ -167,7 +167,7 @@ $origin-color: #ffffff;
|
||||
justify-content: space-between;
|
||||
|
||||
.left {
|
||||
height: 100%;
|
||||
//height: 100%;
|
||||
background: $origin-color;
|
||||
color: var(--color-border);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ export default {
|
||||
showRenameBtn: false,
|
||||
drag: {
|
||||
isCopy: false,
|
||||
isMove: true
|
||||
isMove: !this.$store.getters.currentOrgIsRoot
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
|
||||
@@ -35,13 +35,29 @@ export default {
|
||||
]),
|
||||
announcement() {
|
||||
const ann = this.publicSettings.ANNOUNCEMENT
|
||||
return { id: ann['ID'], subject: ann['SUBJECT'], content: ann['CONTENT'], link: ann['LINK'] }
|
||||
return {
|
||||
id: ann['ID'],
|
||||
subject: ann['SUBJECT'],
|
||||
content: ann['CONTENT'],
|
||||
link: ann['LINK'],
|
||||
date_start: ann['DATE_START'],
|
||||
date_end: ann['DATE_END']
|
||||
}
|
||||
},
|
||||
enabled() {
|
||||
return this.publicSettings.ANNOUNCEMENT_ENABLED && (this.announcement.content || this.announcement.subject)
|
||||
return this.publicSettings.ANNOUNCEMENT_ENABLED && (this.announcement.content || this.announcement.subject) && this.isDateValid
|
||||
},
|
||||
title() {
|
||||
return this.$t('Announcement') + ': ' + this.announcement.subject
|
||||
},
|
||||
isDateValid() {
|
||||
if (this.announcement.date_start === undefined || this.announcement.date_end === undefined) {
|
||||
return true
|
||||
}
|
||||
const now = new Date()
|
||||
const start = new Date(this.announcement.date_start)
|
||||
const end = new Date(this.announcement.date_end)
|
||||
return now >= start && now <= end
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -4,28 +4,29 @@
|
||||
<div class="action-bar">
|
||||
<div class="action">
|
||||
<span>
|
||||
<i :class="[!isShow ? 'fa-eye' : 'fa-eye-slash']" class="fa" @click="onView" />
|
||||
<i class="fa" :class="[!isShow ? 'fa-eye' : 'fa-eye-slash']" @click="onView" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-col :span="span" :style="{'height': height + 'px' }">
|
||||
<el-input
|
||||
v-model="iValue"
|
||||
:rows="rows"
|
||||
autosize
|
||||
:rows="rows"
|
||||
type="textarea"
|
||||
@change="onChange"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col v-show="isShow" :span="span">
|
||||
<VueMarkdown :html="false" :show="true" :source="iValue" class="result-html" />
|
||||
<VueMarkdown class="result-html" :source="sanitizedValue" :html="false" :show="true" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<VueMarkdown v-else :html="false" :source="iValue" class="source" />
|
||||
<VueMarkdown v-else class="source" :html="false" :source="sanitizedValue" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DOMPurify from 'dompurify'
|
||||
import VueMarkdown from 'vue-markdown'
|
||||
|
||||
export default {
|
||||
@@ -55,6 +56,17 @@ export default {
|
||||
iValue: this.value
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
sanitizedValue() {
|
||||
// 转义特殊字符
|
||||
let content = this.iValue.replace(/\\/g, '\\\\').replace(/\$/g, '\\$')
|
||||
|
||||
// 使用 DOMPurify 进行 XSS 过滤
|
||||
content = DOMPurify.sanitize(content)
|
||||
|
||||
return content
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.resizeObserver = new ResizeObserver(entries => {
|
||||
|
||||
@@ -23,11 +23,23 @@ export default {
|
||||
'publicSettings'
|
||||
]),
|
||||
key() {
|
||||
if (this.$route.name.toLowerCase().includes('list')) {
|
||||
return _.trimEnd(this.$route.path, '/')
|
||||
} else {
|
||||
return new Date().getTime()
|
||||
// 想让创建后回来 List 页面不刷新,但是完全不刷新 table 会不对,所以创建完成后,会更新 order 和 updated
|
||||
// query 去掉这两个,如果变了再刷新
|
||||
const query = {}
|
||||
for (const [k, v] of Object.entries(this.$route.query)) {
|
||||
if (k.includes('updated') || k.includes('order')) {
|
||||
continue
|
||||
}
|
||||
query[k] = v
|
||||
}
|
||||
|
||||
let key
|
||||
if (this.$route.name.toLowerCase().includes('list')) {
|
||||
key = _.trimEnd(this.$route.path, '/') + '?' + new URLSearchParams(query).toString()
|
||||
} else {
|
||||
key = new Date().getTime()
|
||||
}
|
||||
return key
|
||||
},
|
||||
chatAiEnabled() {
|
||||
return this.publicSettings?.CHAT_AI_ENABLED
|
||||
|
||||
@@ -59,18 +59,22 @@ export default {
|
||||
this.$router.push({ name: 'Profile' })
|
||||
break
|
||||
case 'PasswordAndSSHKey':
|
||||
this.$router.push({ name: 'PasswordAndSSHKey' })
|
||||
this.$router.push({ name: 'SSHKeyList' })
|
||||
break
|
||||
case 'Preferences':
|
||||
this.$router.push({ name: 'Preferences' })
|
||||
break
|
||||
case 'logout':
|
||||
this.logout()
|
||||
window.location.href = `${process.env.VUE_APP_LOGOUT_PATH}?next=${this.$route.fullPath}`
|
||||
break
|
||||
}
|
||||
},
|
||||
logout() {
|
||||
async logout() {
|
||||
const currentOrg = this.$store.getters.currentOrg
|
||||
if (currentOrg.autoEnter) {
|
||||
await this.$store.dispatch('users/setCurrentOrg', this.$store.getters.preOrg)
|
||||
}
|
||||
window.location.href = `${process.env.VUE_APP_LOGOUT_PATH}?next=${this.$route.fullPath}`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<span class="msg-detail-time">{{ formatDate(currentMsg.date_created) }}</span>
|
||||
</div>
|
||||
<div class="msg-detail-txt">
|
||||
<span v-sanitize="currentMsg.content.message" />
|
||||
<MarkDown :value="currentMsg.content.message" />
|
||||
</div>
|
||||
</div>
|
||||
</Dialog>
|
||||
@@ -80,10 +80,14 @@
|
||||
<script>
|
||||
import { toSafeLocalDateStr } from '@/utils/time'
|
||||
import Dialog from '@/components/Dialog'
|
||||
import MarkDown from '@/components/Widgets/MarkDown'
|
||||
|
||||
export default {
|
||||
name: 'SiteMessages',
|
||||
components: { Dialog },
|
||||
components: {
|
||||
Dialog,
|
||||
MarkDown
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
|
||||
@@ -108,7 +108,7 @@ export default {
|
||||
methods: {
|
||||
async handleSelectView(key, keyPath) {
|
||||
const routeName = this.viewsMapper[key] || '/'
|
||||
localStorage.setItem('PreView', key)
|
||||
localStorage.setItem('preView', key)
|
||||
// Next 之前要重置 init 状态,否则这些路由守卫就不走了
|
||||
await store.dispatch('app/reset')
|
||||
if (!this.tipHasRead) {
|
||||
|
||||
@@ -176,7 +176,7 @@ export default {
|
||||
|
||||
// 未找到与之对应的
|
||||
& ::v-deep .el-submenu__title {
|
||||
font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
padding: 0 8px;
|
||||
line-height: $headerHeight;
|
||||
height: $headerHeight;
|
||||
|
||||
@@ -42,7 +42,7 @@ export default {
|
||||
return this.$t('LicenseExpired')
|
||||
}
|
||||
if (intervalDays < 7) {
|
||||
return this.$t('LicenseWillBe') + this.licenseData.date_expired + this.$t('Expire')
|
||||
return this.$t('LicenseWillBe') + ' ' + this.licenseData.date_expired + ' ' + this.$t('Expire')
|
||||
}
|
||||
return false
|
||||
},
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<el-alert v-if="helpMessage" type="success">
|
||||
<span v-sanitize="helpMessage" class="announcement-main" />
|
||||
</el-alert>
|
||||
<transition v-if="!loading" appear mode="out-in" name="fade-transform">
|
||||
<transition appear mode="out-in" name="fade-transform">
|
||||
<slot>
|
||||
<keep-alive>
|
||||
<component :is="computeActiveComponent" />
|
||||
@@ -83,16 +83,18 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
toSentenceCase: toSentenceCase
|
||||
loading: false,
|
||||
toSentenceCase: toSentenceCase,
|
||||
activeTab: this.activeMenu
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
iActiveMenu: {
|
||||
get() {
|
||||
return this.activeMenu
|
||||
return this.activeTab
|
||||
},
|
||||
set(item) {
|
||||
this.activeTab = item
|
||||
this.$emit('update:activeMenu', item)
|
||||
}
|
||||
},
|
||||
@@ -119,16 +121,13 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
$route(to, from) {
|
||||
const activeTab = to.query?.tab
|
||||
if (activeTab && this.iActiveMenu !== activeTab) {
|
||||
this.iActiveMenu = activeTab
|
||||
}
|
||||
// 好像没必要
|
||||
// const activeTab = to.query?.tab
|
||||
// if (activeTab && this.iActiveMenu !== activeTab) {
|
||||
// this.iActiveMenu = activeTab
|
||||
// }
|
||||
}
|
||||
},
|
||||
activated() {
|
||||
this.iActiveMenu = this.getPropActiveTab()
|
||||
this.loading = false
|
||||
},
|
||||
created() {
|
||||
this.iActiveMenu = this.getPropActiveTab()
|
||||
this.loading = false
|
||||
@@ -136,15 +135,8 @@ export default {
|
||||
methods: {
|
||||
handleTabClick(tab) {
|
||||
this.$emit('tab-click', tab)
|
||||
this.$emit('update:activeMenu', tab.name)
|
||||
|
||||
this.iActiveMenu = tab.name
|
||||
this.$cookie.set(this.$route.path, tab.name, 1)
|
||||
|
||||
if (this.$router.currentRoute.query[this.$route.path]) {
|
||||
this.$router.push({
|
||||
query: { ...this.$route.query, [this.$route.path]: '' }
|
||||
})
|
||||
}
|
||||
},
|
||||
getPropActiveTab() {
|
||||
let activeTab = ''
|
||||
|
||||
@@ -201,7 +201,7 @@ export default [
|
||||
hidden: true,
|
||||
meta: {
|
||||
title: i18n.t('CommandGroupDetail'),
|
||||
activeMenu: ''
|
||||
activeMenu: '/console/perms/acls/cmd-acls'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -28,13 +28,39 @@ export default {
|
||||
},
|
||||
{
|
||||
path: '/profile/password-and-ssh-key',
|
||||
name: 'PasswordAndSSHKey',
|
||||
component: () => import('@/views/profile/PasswordAndSSHKey/index'),
|
||||
component: empty,
|
||||
meta: {
|
||||
title: i18n.t('PasswordAndSSHKey'),
|
||||
icon: 'personal',
|
||||
permissions: []
|
||||
}
|
||||
icon: 'personal'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: () => import('@/views/profile/PasswordAndSSHKey/index'),
|
||||
name: 'SSHKeyList',
|
||||
icon: 'key',
|
||||
meta: { title: i18n.t('PasswordAndSSHKey'), permissions: ['authentication.view_sshkey'] }
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
component: () => import('@/views/profile/PasswordAndSSHKey/SSHKey/SSHKeyCreateUpdate.vue'),
|
||||
name: 'SSHKeyCreate',
|
||||
hidden: true,
|
||||
meta: {
|
||||
title: i18n.t('SSHKey'),
|
||||
permissions: ['authentication.add_sshkey']
|
||||
}
|
||||
},
|
||||
{
|
||||
path: ':id/update',
|
||||
component: () => import('@/views/profile/PasswordAndSSHKey/SSHKey/SSHKeyCreateUpdate.vue'),
|
||||
name: 'SSHKeyUpdate',
|
||||
hidden: true,
|
||||
meta: {
|
||||
title: i18n.t('SSHKey'),
|
||||
permissions: ['authentication.change_sshkey']
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/profile/passkeys',
|
||||
|
||||
@@ -205,7 +205,7 @@ export default {
|
||||
hidden: true,
|
||||
component: () => import('@/views/ops/Template/Adhoc/AdhocUpdateCreate'),
|
||||
meta: {
|
||||
title: i18n.t('createAdhoc'),
|
||||
title: i18n.t('AdhocUpdate'),
|
||||
permissions: ['ops.add_adhoc'],
|
||||
activeMenu: '/workbench/ops/templates'
|
||||
}
|
||||
|
||||
BIN
src/styles/icons/cloud.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
@@ -38,7 +38,7 @@ body {
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-font-smoothing: auto;
|
||||
color: var(--color-text-primary);
|
||||
font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 1.428;
|
||||
}
|
||||
@@ -586,3 +586,16 @@ li.rmenu i.fa {
|
||||
color: var(--color-link);
|
||||
}
|
||||
}
|
||||
|
||||
.el-table__row {
|
||||
::-webkit-scrollbar {
|
||||
width: 6px; /* 设置垂直滚动条的宽度 */
|
||||
height: 6px; /* 设置水平滚动条的高度 */
|
||||
}
|
||||
}
|
||||
|
||||
.black-theme-popover {
|
||||
width: 300px;
|
||||
max-height: 700px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ $single-menu-height: 38px;
|
||||
}
|
||||
}
|
||||
|
||||
.el-menu--vertical {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.el-menu {
|
||||
border-right: none !important;
|
||||
background-color: inherit !important;
|
||||
@@ -139,6 +143,10 @@ $single-menu-height: 38px;
|
||||
.nest-menu .level2-menu {
|
||||
line-height: $single-menu-height;
|
||||
}
|
||||
|
||||
.el-tooltip {
|
||||
width: 55px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,6 +116,11 @@
|
||||
background: url('./icons/clickhouse.png') no-repeat center left transparent;
|
||||
}
|
||||
|
||||
&.WebCloud_ico_docu {
|
||||
background: url('./icons/cloud.png') no-repeat center left transparent;
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
&.ico_loading {
|
||||
background: url(./icons/loading.gif) no-repeat scroll 0 0 transparent;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import VueCookie from 'vue-cookie'
|
||||
|
||||
const CURRENT_ORG_KEY = 'jms_current_org'
|
||||
const CURRENT_ROLE_KEY = 'jms_current_role'
|
||||
const CURRENT_ORG_KEY = 'currentOrg'
|
||||
const CURRENT_ROLE_KEY = 'currentRole'
|
||||
let cookieNamePrefix = VueCookie.get('SESSION_COOKIE_NAME_PREFIX')
|
||||
if (!cookieNamePrefix || ['""', "''"].indexOf(cookieNamePrefix) > -1) {
|
||||
cookieNamePrefix = ''
|
||||
@@ -17,7 +17,7 @@ export function setTokenToCookie(value, expires) {
|
||||
}
|
||||
|
||||
export function getCurrentRoleLocal(username) {
|
||||
const key = CURRENT_ROLE_KEY + '_' + username
|
||||
const key = CURRENT_ROLE_KEY + ':' + username
|
||||
const role = localStorage.getItem(key)
|
||||
if (role) {
|
||||
return parseInt(role) || null
|
||||
@@ -26,12 +26,12 @@ export function getCurrentRoleLocal(username) {
|
||||
}
|
||||
|
||||
export function saveCurrentRoleLocal(username, role) {
|
||||
const key = CURRENT_ROLE_KEY + '_' + username
|
||||
const key = CURRENT_ROLE_KEY + ':' + username
|
||||
return localStorage.setItem(key, role)
|
||||
}
|
||||
|
||||
export function getCurrentOrgLocal(username) {
|
||||
const key = CURRENT_ORG_KEY + '_' + username
|
||||
const key = CURRENT_ORG_KEY + ':' + username
|
||||
const value = localStorage.getItem(key)
|
||||
try {
|
||||
return JSON.parse(value)
|
||||
@@ -41,18 +41,18 @@ export function getCurrentOrgLocal(username) {
|
||||
}
|
||||
|
||||
export function saveCurrentOrgLocal(username, org) {
|
||||
const key = CURRENT_ORG_KEY + '_' + username
|
||||
const key = CURRENT_ORG_KEY + ':' + username
|
||||
localStorage.setItem(key, JSON.stringify(org))
|
||||
VueCookie.set('X-JMS-ORG', org.id)
|
||||
}
|
||||
|
||||
export function setPreOrgLocal(username, org) {
|
||||
const key = 'PRE_ORG_' + username
|
||||
const key = 'preOrg' + ':' + username
|
||||
localStorage.setItem(key, JSON.stringify(org))
|
||||
}
|
||||
|
||||
export function getPreOrgLocal(username) {
|
||||
const key = 'PRE_ORG_' + username
|
||||
const key = 'preOrg' + ':' + username
|
||||
const value = localStorage.getItem(key)
|
||||
try {
|
||||
return JSON.parse(value)
|
||||
|
||||
@@ -128,6 +128,8 @@ export function getErrorResponseMsg(error) {
|
||||
}).filter(i => i).join('; ')
|
||||
} else if (typeof data === 'string') {
|
||||
return data
|
||||
} else {
|
||||
msg = error.toString()
|
||||
}
|
||||
return msg
|
||||
}
|
||||
@@ -217,13 +219,19 @@ export function downloadText(content, filename) {
|
||||
}
|
||||
|
||||
export function download(downloadUrl, filename) {
|
||||
const iframe = document.createElement('iframe')
|
||||
iframe.style.display = 'none'
|
||||
document.body.appendChild(iframe)
|
||||
const a = document.createElement('a')
|
||||
a.href = downloadUrl
|
||||
if (filename) {
|
||||
a.download = filename
|
||||
}
|
||||
iframe.contentWindow.document.body.appendChild(a)
|
||||
a.click()
|
||||
window.URL.revokeObjectURL(downloadUrl)
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(iframe)
|
||||
}, 1000 * 60 * 30) // If you can't download it in half an hour, don't download it.
|
||||
}
|
||||
|
||||
export function diffObject(object, base) {
|
||||
@@ -304,4 +312,26 @@ export function toSentenceCase(string) {
|
||||
}).join(' ')
|
||||
return s[0].toUpperCase() + s.slice(1)
|
||||
}
|
||||
|
||||
export { BASE_URL }
|
||||
|
||||
export function openNewWindow(url) {
|
||||
let count
|
||||
let top = 50
|
||||
count = parseInt(window.sessionStorage.getItem('newWindowCount'), 10)
|
||||
if (isNaN(count)) {
|
||||
count = 0
|
||||
}
|
||||
let left = 100 + count * 100
|
||||
top = 50 + count * 50
|
||||
if (left + screen.width / 3 > screen.width) {
|
||||
// 支持两排足以
|
||||
top = screen.height / 3
|
||||
count = 1
|
||||
left = 100
|
||||
}
|
||||
let params = 'toolbar=yes,scrollbars=yes,resizable=yes'
|
||||
params = params + `,top=${top},left=${left},width=${screen.width / 3},height=${screen.height / 3}`
|
||||
window.sessionStorage.setItem('newWindowCount', `${count + 1}`)
|
||||
window.open(url, '_blank', params)
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ Object.assign(Table.components.TableBody.methods, {
|
||||
const range = document.createRange()
|
||||
range.setStart(cellChild, 0)
|
||||
range.setEnd(cellChild, cellChild.childNodes.length)
|
||||
const rangeWidth = range.getBoundingClientRect().width
|
||||
// rangeWidth 有可能是小数,因此就会导致原本 rangeWidth + padding = cellChild.offsetWidth 的大于了 cellChild.offsetWidth
|
||||
const rangeWidth = Math.floor(range.getBoundingClientRect().width)
|
||||
const padding = (parseInt(getStyle(cellChild, 'paddingLeft'), 10) || 0) +
|
||||
(parseInt(getStyle(cellChild, 'paddingRight'), 10) || 0)
|
||||
if (
|
||||
|
||||
@@ -109,7 +109,7 @@ export function isSameView(to, from) {
|
||||
|
||||
export function getPropView() {
|
||||
const hasPermedViews = getPermedViews()
|
||||
const preView = localStorage.getItem('PreView')
|
||||
const preView = localStorage.getItem('preView')
|
||||
const hasPerm = hasPermedViews.indexOf(preView) > -1
|
||||
if (hasPerm) {
|
||||
return preView
|
||||
|
||||
@@ -3,7 +3,6 @@ import i18n from '@/i18n/i18n'
|
||||
import { eventBus } from '@/utils/const'
|
||||
import { getTokenFromCookie } from '@/utils/auth'
|
||||
import { getErrorResponseMsg } from '@/utils/common'
|
||||
import { refreshSessionIdAge } from '@/api/users'
|
||||
import { MessageBox } from 'element-ui'
|
||||
import { message } from '@/utils/message'
|
||||
import store from '@/store'
|
||||
@@ -102,20 +101,6 @@ export function flashErrorMsg({ response, error }) {
|
||||
}
|
||||
}
|
||||
|
||||
let timer = null
|
||||
|
||||
function refreshSessionAgeDelay(response) {
|
||||
if (response.request.responseURL.indexOf('/users/profile/') !== -1) {
|
||||
return
|
||||
}
|
||||
if (timer) {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
timer = setTimeout(function() {
|
||||
refreshSessionIdAge()
|
||||
}, 30 * 1000)
|
||||
}
|
||||
|
||||
function ifConfirmRequired({ response, error }) {
|
||||
if (response.status !== 412) {
|
||||
return null
|
||||
@@ -142,7 +127,6 @@ service.interceptors.response.use(
|
||||
*/
|
||||
response => {
|
||||
// NProgress.done()
|
||||
refreshSessionAgeDelay(response)
|
||||
const res = response.data
|
||||
store.dispatch('common/digestSQLQuery', response).then()
|
||||
|
||||
|
||||
@@ -24,6 +24,9 @@ async function checkLogin({ to, from, next }) {
|
||||
} catch (e) {
|
||||
Vue.$log.error(e)
|
||||
const status = e.response.status
|
||||
if (store.getters.currentOrg.autoEnter) {
|
||||
await store.dispatch('users/setCurrentOrg', store.getters.preOrg)
|
||||
}
|
||||
if (status === 401 || status === 403) {
|
||||
setTimeout(() => {
|
||||
window.location = process.env.VUE_APP_LOGIN_PATH
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
const moment = require('moment')
|
||||
|
||||
function getUserLang() {
|
||||
const userLangEN = document.cookie.indexOf('django_language=en')
|
||||
if (userLangEN === -1) {
|
||||
return 'zh-CN'
|
||||
} else {
|
||||
return 'en-US'
|
||||
}
|
||||
}
|
||||
import { getLangCode } from '@/i18n/utils'
|
||||
|
||||
function getTimeUnits(u) {
|
||||
const units = {
|
||||
@@ -16,10 +8,11 @@ function getTimeUnits(u) {
|
||||
'm': '分',
|
||||
's': '秒'
|
||||
}
|
||||
if (getUserLang() === 'zh-CN') {
|
||||
if (getLangCode() === 'zh') {
|
||||
return units[u]
|
||||
} else {
|
||||
return u
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
export function timeOffset(a, b) {
|
||||
|
||||
@@ -19,7 +19,7 @@ export default {
|
||||
initial: {
|
||||
is_periodic: false,
|
||||
password_rules: {
|
||||
length: 16
|
||||
length: 36
|
||||
},
|
||||
interval: 24,
|
||||
accounts: [],
|
||||
|
||||
@@ -164,8 +164,8 @@ export default {
|
||||
},
|
||||
extraMoreActions: [
|
||||
{
|
||||
name: 'BatchRetry',
|
||||
title: this.$t('BatchRetry'),
|
||||
name: 'RetrySelected',
|
||||
title: this.$t('RetrySelected'),
|
||||
type: 'primary',
|
||||
fa: 'fa-retweet',
|
||||
can: ({ selectedRows }) => {
|
||||
|
||||
@@ -21,7 +21,7 @@ export default {
|
||||
initial: {
|
||||
is_periodic: false,
|
||||
password_rules: {
|
||||
length: 30
|
||||
length: 36
|
||||
},
|
||||
interval: 24,
|
||||
secret_type: 'password',
|
||||
|
||||
@@ -164,8 +164,8 @@ export default {
|
||||
},
|
||||
extraMoreActions: [
|
||||
{
|
||||
name: 'BatchRetry',
|
||||
title: this.$t('BatchRetry'),
|
||||
name: 'RetrySelected',
|
||||
title: this.$t('RetrySelected'),
|
||||
type: 'primary',
|
||||
fa: 'fa-retweet',
|
||||
can: ({ selectedRows }) => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import InputWithUnit from '@/components/Form/FormFields/InputWithUnit.vue'
|
||||
import store from '@/store'
|
||||
|
||||
const validatorInterval = (rule, value, callback) => {
|
||||
if (parseInt(value) < 1) {
|
||||
if (isNaN(parseInt(value, 10)) || parseInt(value) < 1) {
|
||||
return callback(new Error(i18n.t('EnsureThisValueIsGreaterThanOrEqualTo1')))
|
||||
}
|
||||
callback()
|
||||
|
||||
@@ -60,7 +60,7 @@ export default {
|
||||
}
|
||||
},
|
||||
reviewers: {
|
||||
hidden: (item) => !['review', 'warning'].includes(item.action),
|
||||
hidden: (item) => !['review', 'warning', 'notify_and_warn'].includes(item.action),
|
||||
rules: [rules.RequiredChange],
|
||||
el: {
|
||||
value: [],
|
||||
|
||||
@@ -68,11 +68,6 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
activated() {
|
||||
setTimeout(() => {
|
||||
this.$refs.listTable.reloadTable()
|
||||
}, 300)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -32,15 +32,9 @@ export default {
|
||||
title: this.$t('Basic'),
|
||||
name: 'Detail'
|
||||
}
|
||||
],
|
||||
actions: {
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
@@ -53,11 +53,6 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<TabPage
|
||||
:active-menu.sync="config.activeMenu"
|
||||
:submenu="config.submenu"
|
||||
@tab-click="handleTabClick"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -35,20 +34,6 @@ export default {
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
handleTabClick(tab) {
|
||||
const query = _.cloneDeep(this.$route.query)
|
||||
const newQuery = {
|
||||
...query,
|
||||
tab: tab.name
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$router.replace({ query: newQuery })
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -47,6 +47,7 @@ export default {
|
||||
return {
|
||||
loading: true,
|
||||
platform: {},
|
||||
changePlatformID: '',
|
||||
defaultConfig: {
|
||||
initial: {},
|
||||
platform: {},
|
||||
@@ -131,7 +132,7 @@ export default {
|
||||
const { defaultConfig } = this
|
||||
const { node, platform } = this.$route?.query || {}
|
||||
const nodesInitial = node ? [node] : []
|
||||
const platformId = platform || 'Linux'
|
||||
const platformId = this.changePlatformID ? this.changePlatformID : (platform || 'Linux')
|
||||
const url = `/api/v1/assets/platforms/${platformId}/`
|
||||
this.platform = await this.$axios.get(url)
|
||||
const initial = {
|
||||
|
||||
@@ -25,17 +25,17 @@ export default {
|
||||
const platform = this.$route.query.type
|
||||
const baseFields = [[this.$t('Basic'), ['db_name']]]
|
||||
let tlsFields = ['use_ssl', 'ca_cert']
|
||||
switch (platform) {
|
||||
case 'redis':
|
||||
tlsFields = tlsFields.concat(['client_cert', 'client_key'])
|
||||
break
|
||||
case 'mysql':
|
||||
tlsFields = tlsFields.concat(['client_cert', 'client_key', 'allow_invalid_cert'])
|
||||
break
|
||||
case 'mongodb':
|
||||
tlsFields = tlsFields.concat(['client_key', 'allow_invalid_cert'])
|
||||
break
|
||||
const platformFieldsMap = {
|
||||
redis: ['client_cert', 'client_key'],
|
||||
postgresql: ['client_cert', 'client_key', 'pg_ssl_mode'],
|
||||
mysql: ['client_cert', 'client_key', 'allow_invalid_cert'],
|
||||
mongodb: ['client_key', 'allow_invalid_cert']
|
||||
}
|
||||
|
||||
if (platformFieldsMap[platform]) {
|
||||
tlsFields = tlsFields.concat(platformFieldsMap[platform])
|
||||
}
|
||||
|
||||
if (tlsFields.length > 2) {
|
||||
const secureField = [
|
||||
this.$t('Secure'), tlsFields, 2
|
||||
@@ -52,7 +52,14 @@ export default {
|
||||
},
|
||||
use_ssl: {
|
||||
label: this.$t('UseSSL'),
|
||||
component: 'el-switch'
|
||||
component: 'el-switch',
|
||||
on: {
|
||||
change: ([event], updateForm) => {
|
||||
updateForm({
|
||||
pg_ssl_mode: event ? 'require' : 'prefer'
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
allow_invalid_cert: {
|
||||
label: this.$t('AllowInvalidCert'),
|
||||
|
||||
@@ -60,7 +60,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: this.$t('QuickTest'),
|
||||
title: this.$t('Test'),
|
||||
templateDialogVisible: false,
|
||||
columnsDefault: ['name', 'username', 'asset'],
|
||||
headerExtraActions: [
|
||||
|
||||
@@ -48,7 +48,8 @@ export default {
|
||||
},
|
||||
tableConfig: {
|
||||
url: tableUrl,
|
||||
category: 'all'
|
||||
category: 'all',
|
||||
extraQuery: { 'order': '-date_updated' }
|
||||
},
|
||||
headerActions: {
|
||||
handleImportClick: ({ selectedRows }) => {
|
||||
|
||||
@@ -61,7 +61,7 @@ export default {
|
||||
row['auto_config'].ansible_enabled &&
|
||||
row['auto_config'].ping_enabled,
|
||||
callback: ({ row }) => {
|
||||
if (row.platform.name === 'Gateway') {
|
||||
if (row.platform.name.startsWith('Gateway')) {
|
||||
this.GatewayVisible = true
|
||||
const port = row.protocols.find(item => item.name === 'ssh').port
|
||||
if (!port) {
|
||||
|
||||
@@ -191,7 +191,7 @@ export default {
|
||||
row?.auto_config?.ansible_enabled &&
|
||||
row?.auto_config?.ping_enabled,
|
||||
callback: ({ row }) => {
|
||||
if (row.platform.name === 'Gateway') {
|
||||
if (row.platform.name.startsWith('Gateway')) {
|
||||
this.GatewayVisible = true
|
||||
const port = row.protocols.find(item => item.name === 'ssh').port
|
||||
if (!port) {
|
||||
|
||||
@@ -22,15 +22,17 @@
|
||||
:key="platform.id"
|
||||
:span="6"
|
||||
>
|
||||
<el-card
|
||||
:style="{ borderLeftColor: randomBorderColor(index) }"
|
||||
class="platform-item"
|
||||
shadow="hover"
|
||||
@click.native="createAsset(platform)"
|
||||
>
|
||||
<img :src="loadImage(platform)" alt="icon" class="asset-icon">
|
||||
<span class="platform-name">{{ platform.name }}</span>
|
||||
</el-card>
|
||||
<el-tooltip :content="platform.name" :open-delay="1000">
|
||||
<el-card
|
||||
:style="{ borderLeftColor: randomBorderColor(index) }"
|
||||
class="platform-item"
|
||||
shadow="hover"
|
||||
@click.native="createAsset(platform)"
|
||||
>
|
||||
<img :src="loadImage(platform)" alt="icon" class="asset-icon">
|
||||
<span class="platform-name">{{ platform.name }}</span>
|
||||
</el-card>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
@@ -195,7 +197,11 @@ export default {
|
||||
margin: 5px 0;
|
||||
|
||||
& ::v-deep .el-card__body {
|
||||
padding: 10px
|
||||
padding: 10px;
|
||||
flex-wrap: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
border-left: solid 4px;
|
||||
@@ -230,14 +236,16 @@ export default {
|
||||
}
|
||||
|
||||
.asset-icon {
|
||||
width: 1.5em;
|
||||
height: 1.5em;
|
||||
width: 2em;
|
||||
height: 2em;
|
||||
vertical-align: -0.2em;
|
||||
fill: currentColor;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.platform-name {
|
||||
margin-left: 10px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
|
||||