Compare commits
1 Commits
pr@pam@sty
...
repr@dev_v
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
200b83c105 |
72
.github/workflows/build-base-image.yml
vendored
@@ -1,72 +0,0 @@
|
||||
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
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
|
||||
46
.github/workflows/jms-build-test.yml.disabled
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
|
||||
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: '20.15'
|
||||
node-version: '16.20'
|
||||
- name: Install dependencies
|
||||
run: yarn install
|
||||
- name: Build web
|
||||
|
||||
32
Dockerfile
@@ -1,4 +1,34 @@
|
||||
FROM jumpserver/lina-base:20240723_084702 AS stage-build
|
||||
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
|
||||
|
||||
ARG VERSION
|
||||
ENV VERSION=$VERSION
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
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
|
||||
12
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": "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",
|
||||
"dev": "vue-cli-service serve",
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "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,13 +30,11 @@
|
||||
"@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",
|
||||
@@ -120,7 +118,7 @@
|
||||
"serve-static": "^1.13.2",
|
||||
"strip-ansi": "^7.1.0",
|
||||
"svg-sprite-loader": "4.1.3",
|
||||
"svgo": "1.2.4",
|
||||
"svgo": "1.2.2",
|
||||
"vue-i18n-extract": "^1.1.1",
|
||||
"vue-template-compiler": "2.6.10"
|
||||
},
|
||||
|
||||
@@ -2,50 +2,21 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||
<meta content="0" http-equiv="Expires">
|
||||
<meta content="no-cache" http-equiv="Pragma">
|
||||
<meta content="no-cache" http-equiv="Cache-control">
|
||||
<meta content="no-cache" http-equiv="Cache">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta http-equiv="Expires" content="0">
|
||||
<meta http-equiv="Pragma" content="no-cache">
|
||||
<meta http-equiv="Cache-control" content="no-cache">
|
||||
<meta http-equiv="Cache" content="no-cache">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<title><%= webpackConfig.name %></title>
|
||||
<link href="<%= BASE_URL %>theme/element-ui.css" rel="stylesheet">
|
||||
<style>
|
||||
#loading {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: white;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border: 5px solid rgba(0, 0, 0, 0.1);
|
||||
border-radius: 50%;
|
||||
border-top-color: #3498db;
|
||||
animation: spin 1s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="<%= BASE_URL %>theme/element-ui.css">
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= webpackConfig.name %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
window.onload = function() {
|
||||
if (location.pathname === '/') {
|
||||
location.pathname = '/ui/'
|
||||
}
|
||||
@@ -53,7 +24,7 @@
|
||||
if (pathname.startsWith('/core')) {
|
||||
return
|
||||
}
|
||||
if (pathname.indexOf('/ui') === -1) {
|
||||
if(pathname.indexOf('/ui') === -1) {
|
||||
window.location.href = window.location.origin + '/ui/#' + pathname
|
||||
}
|
||||
if (pathname.startsWith('/ui/#/chat')) {
|
||||
@@ -61,11 +32,7 @@
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div id="app">
|
||||
</div>
|
||||
<div id="loading">
|
||||
<div class="spinner"></div>
|
||||
</div>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -65,6 +65,10 @@ export function logout() {
|
||||
})
|
||||
}
|
||||
|
||||
export function refreshSessionIdAge() {
|
||||
return getProfile()
|
||||
}
|
||||
|
||||
export default {
|
||||
getProfile,
|
||||
getUserList
|
||||
|
||||
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 466 B |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 961 B |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 673 B |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 916 B |
|
Before Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 278 B |
|
Before Width: | Height: | Size: 940 B After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 462 B |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -163,8 +163,7 @@ export const accountFieldsMeta = (vm) => {
|
||||
!automation.ansible_enabled ||
|
||||
!vm.$hasPerm('accounts.push_account') ||
|
||||
(formValue.secret_type === 'ssh_key' && vm.iPlatform.type.value === 'windows') ||
|
||||
vm.addTemplate ||
|
||||
!formValue.secret_reset
|
||||
vm.addTemplate
|
||||
}
|
||||
},
|
||||
params: {
|
||||
|
||||
@@ -65,8 +65,7 @@ export default {
|
||||
[this.$t('Basic'), ['assets', 'name', 'username', 'privileged', 'su_from', 'su_from_username']],
|
||||
[this.$t('Secret'), [
|
||||
'secret_type', 'password', 'ssh_key', 'token',
|
||||
'access_key', 'passphrase', 'api_key',
|
||||
'secret_reset'
|
||||
'access_key', 'passphrase', 'api_key'
|
||||
]],
|
||||
[this.$t('Other'), ['push_now', 'params', 'on_invalid', 'is_active', 'comment']]
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template v-if="iVisible">
|
||||
<template>
|
||||
<Dialog
|
||||
v-if="origin !== 'pam'"
|
||||
v-if="iVisible"
|
||||
:close-on-click-modal="false"
|
||||
:destroy-on-close="true"
|
||||
:show-cancel="false"
|
||||
@@ -21,33 +21,15 @@
|
||||
@edit="editAccount"
|
||||
/>
|
||||
</Dialog>
|
||||
|
||||
<Drawer
|
||||
v-else
|
||||
:title="title"
|
||||
@close-drawer="iVisible = false"
|
||||
>
|
||||
<AccountCreateUpdateForm
|
||||
v-if="!loading"
|
||||
ref="form"
|
||||
:account="account"
|
||||
:add-template="addTemplate"
|
||||
:asset="asset"
|
||||
@add="addAccount"
|
||||
@edit="editAccount"
|
||||
/>
|
||||
</Drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Drawer from '@/components/Drawer/index.vue'
|
||||
import Dialog from '@/components/Dialog/index.vue'
|
||||
import AccountCreateUpdateForm from '@/components/Apps/AccountCreateUpdateForm/index.vue'
|
||||
|
||||
export default {
|
||||
name: 'CreateAccountDialog',
|
||||
components: {
|
||||
Drawer,
|
||||
Dialog,
|
||||
AccountCreateUpdateForm
|
||||
},
|
||||
@@ -73,10 +55,6 @@ export default {
|
||||
default: function() {
|
||||
return this.$t('AddAccount')
|
||||
}
|
||||
},
|
||||
origin: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -128,8 +106,6 @@ export default {
|
||||
}
|
||||
}).catch(error => {
|
||||
this.iVisible = true
|
||||
console.log(this.iVisible)
|
||||
console.log(this.origin)
|
||||
this.handleResult(null, error)
|
||||
})
|
||||
},
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<ListTable
|
||||
ref="ListTable"
|
||||
:header-actions="headerActions"
|
||||
:quick-filters="quickFilters"
|
||||
:table-config="tableConfig"
|
||||
/>
|
||||
<ListTable ref="ListTable" :header-actions="headerActions" :table-config="tableConfig" />
|
||||
<ViewSecret
|
||||
v-if="showViewSecretDialog"
|
||||
:account="account"
|
||||
@@ -21,7 +16,6 @@
|
||||
<AccountCreateUpdate
|
||||
v-if="showAddDialog"
|
||||
:account="account"
|
||||
:origin="origin"
|
||||
:asset="iAsset"
|
||||
:title="accountCreateUpdateTitle"
|
||||
:visible.sync="showAddDialog"
|
||||
@@ -31,7 +25,6 @@
|
||||
<AccountCreateUpdate
|
||||
v-if="showAddTemplateDialog"
|
||||
:account="account"
|
||||
:origin="origin"
|
||||
:add-template="true"
|
||||
:asset="iAsset"
|
||||
:title="accountCreateByTemplateTitle"
|
||||
@@ -56,9 +49,7 @@
|
||||
|
||||
<script>
|
||||
import ListTable from '@/components/Table/ListTable/index.vue'
|
||||
import {
|
||||
ActionsFormatter, PlatformFormatter, SecretViewerFormatter
|
||||
} from '@/components/Table/TableFormatters'
|
||||
import { ActionsFormatter } from '@/components/Table/TableFormatters'
|
||||
import ViewSecret from './ViewSecret.vue'
|
||||
import UpdateSecretInfo from './UpdateSecretInfo.vue'
|
||||
import AccountCreateUpdate from './AccountCreateUpdate.vue'
|
||||
@@ -98,7 +89,7 @@ export default {
|
||||
},
|
||||
hasClone: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: false
|
||||
},
|
||||
asset: {
|
||||
type: Object,
|
||||
@@ -128,7 +119,7 @@ export default {
|
||||
columnsDefault: {
|
||||
type: Array,
|
||||
default: () => ([
|
||||
'name', 'username', 'secret', 'asset', 'platform', 'date_updated', 'connect'
|
||||
'name', 'username', 'asset', 'date_updated'
|
||||
])
|
||||
},
|
||||
headerExtraActions: {
|
||||
@@ -138,10 +129,6 @@ export default {
|
||||
extraQuery: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
origin: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -158,131 +145,6 @@ export default {
|
||||
iAsset: this.asset,
|
||||
account: {},
|
||||
secretUrl: '',
|
||||
quickFilters: [
|
||||
{
|
||||
label: '最近(7天)',
|
||||
options: [
|
||||
{
|
||||
label: '最近发现',
|
||||
filter: {
|
||||
latest_discovery: '1'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '最近被登录',
|
||||
filter: {
|
||||
latest_accessed: '1'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '最近修改',
|
||||
filter: {
|
||||
latest_updated: '1'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '最近改密',
|
||||
filter: {
|
||||
latest_secret_changed: '1'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '最近改密失败',
|
||||
filter: {
|
||||
latest_secret_changed_failed: '1'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '风险账号',
|
||||
options: [
|
||||
{
|
||||
label: '僵尸账号',
|
||||
filter: {
|
||||
risk: 'zombie'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '幽灵账号',
|
||||
filter: {
|
||||
risk: 'ghost'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '弱密码',
|
||||
filter: {
|
||||
risk: 'week_password'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '空密码',
|
||||
filter: {
|
||||
has_secret: 'false'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '长时间未改密',
|
||||
filter: {
|
||||
long_time_no_change_secret: 'true'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '长时间未验证',
|
||||
filter: {
|
||||
long_time_no_verify: 'true'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '账号类型',
|
||||
options: [
|
||||
{
|
||||
label: '全部',
|
||||
filter: {
|
||||
category: ''
|
||||
}
|
||||
},
|
||||
{
|
||||
label: ' 主机',
|
||||
filter: {
|
||||
category: 'host'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '数据库',
|
||||
filter: {
|
||||
category: 'database'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '云',
|
||||
filter: {
|
||||
category: 'cloud'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '网络设备',
|
||||
filter: {
|
||||
category: 'device'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Web',
|
||||
filter: {
|
||||
category: 'website'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '其他',
|
||||
filter: {
|
||||
category: 'custom'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
tableConfig: {
|
||||
url: this.url,
|
||||
permissions: {
|
||||
@@ -291,7 +153,6 @@ export default {
|
||||
},
|
||||
extraQuery: this.extraQuery,
|
||||
columnsExclude: ['spec_info'],
|
||||
columnsAdd: ['secret', 'platform', 'connect'],
|
||||
columnsShow: {
|
||||
min: ['name', 'username', 'actions'],
|
||||
default: this.columnsDefault
|
||||
@@ -311,27 +172,6 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
secret: {
|
||||
formatter: SecretViewerFormatter,
|
||||
formatterArgs: {
|
||||
secretFrom: 'api',
|
||||
hasDownload: false,
|
||||
actionLeft: true
|
||||
}
|
||||
},
|
||||
connect: {
|
||||
label: this.$t('Connect'),
|
||||
width: '80px',
|
||||
formatter: () => {
|
||||
return (
|
||||
<span className='connect'>
|
||||
<el-button type='primary' size='mini' plain>
|
||||
<i className='fa fa-desktop'/>
|
||||
</el-button>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
},
|
||||
asset: {
|
||||
formatter: function(row) {
|
||||
const to = {
|
||||
@@ -345,13 +185,6 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
platform: {
|
||||
label: this.$t('Platform'),
|
||||
formatter: PlatformFormatter,
|
||||
formatterArgs: {
|
||||
platformAttr: 'asset.platform'
|
||||
}
|
||||
},
|
||||
username: {
|
||||
width: '120px'
|
||||
},
|
||||
@@ -384,8 +217,7 @@ export default {
|
||||
formatterArgs: {
|
||||
hasUpdate: false, // can set function(row, value)
|
||||
hasDelete: false, // can set function(row, value)
|
||||
hasClone: false,
|
||||
canClone: true,
|
||||
hasClone: this.hasClone,
|
||||
moreActionsTitle: this.$t('More'),
|
||||
extraActions: [
|
||||
{
|
||||
@@ -423,7 +255,7 @@ export default {
|
||||
},
|
||||
{
|
||||
name: 'Test',
|
||||
title: this.$t('验证密文'),
|
||||
title: this.$t('Test'),
|
||||
can: ({ row }) =>
|
||||
!this.$store.getters.currentOrgIsRoot &&
|
||||
this.$hasPerm('accounts.verify_account') &&
|
||||
@@ -451,26 +283,6 @@ export default {
|
||||
this.$message.success(this.$tc('ClearSuccessMsg'))
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'SecretHistory',
|
||||
title: '密文历史'
|
||||
},
|
||||
{
|
||||
name: 'CopyToOther',
|
||||
title: '复制到其他资产',
|
||||
type: 'primary',
|
||||
divided: true
|
||||
},
|
||||
{
|
||||
name: 'MoveToOther',
|
||||
title: '移动到其他资产',
|
||||
type: 'primary'
|
||||
},
|
||||
{
|
||||
name: 'Clone',
|
||||
title: this.$t('Duplicate'),
|
||||
divided: true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -699,5 +511,4 @@ export default {
|
||||
.cell a {
|
||||
color: var(--color-info);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<script>
|
||||
import { GenericListTableDialog } from '@/layout/components'
|
||||
import { SecretViewerFormatter } from '@/components/Table/TableFormatters'
|
||||
import { ShowKeyCopyFormatter } from '@/components/Table/TableFormatters'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -33,7 +33,7 @@ export default {
|
||||
columnsMeta: {
|
||||
secret: {
|
||||
label: this.$t('Password'),
|
||||
formatter: SecretViewerFormatter,
|
||||
formatter: ShowKeyCopyFormatter,
|
||||
formatterArgs: {
|
||||
hasDownload: false,
|
||||
name: this.account.name
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<span>{{ account['username'] }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="secretTypeLabel">
|
||||
<SecretViewerFormatter
|
||||
<ShowKeyCopyFormatter
|
||||
:cell-value="secretInfo.secret"
|
||||
:col="{ formatterArgs: {
|
||||
name: account['name'],
|
||||
@@ -60,7 +60,7 @@
|
||||
<script>
|
||||
import Dialog from '@/components/Dialog/index.vue'
|
||||
import PasswordHistoryDialog from './PasswordHistoryDialog.vue'
|
||||
import { SecretViewerFormatter } from '@/components/Table/TableFormatters'
|
||||
import { ShowKeyCopyFormatter } from '@/components/Table/TableFormatters'
|
||||
import { encryptPassword } from '@/utils/crypto'
|
||||
|
||||
export default {
|
||||
@@ -68,7 +68,7 @@ export default {
|
||||
components: {
|
||||
Dialog,
|
||||
PasswordHistoryDialog,
|
||||
SecretViewerFormatter
|
||||
ShowKeyCopyFormatter
|
||||
},
|
||||
props: {
|
||||
account: {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<Dialog
|
||||
:close-on-click-modal="false"
|
||||
:title="$tc('Assets')"
|
||||
:disabled-status="!isLoaded"
|
||||
custom-class="asset-select-dialog"
|
||||
top="2vh"
|
||||
v-bind="$attrs"
|
||||
@@ -23,8 +22,6 @@
|
||||
:url="baseUrl"
|
||||
class="tree-table"
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
@loaded="handleTableLoaded"
|
||||
/>
|
||||
</Dialog>
|
||||
</template>
|
||||
@@ -67,7 +64,6 @@ export default {
|
||||
data() {
|
||||
const vm = this
|
||||
return {
|
||||
isLoaded: false,
|
||||
dialogVisible: false,
|
||||
rowSelected: _.cloneDeep(this.value) || [],
|
||||
rowsAdd: [],
|
||||
@@ -128,9 +124,6 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleTableLoaded() {
|
||||
this.isLoaded = true
|
||||
},
|
||||
handleClose() {
|
||||
this.$refs.ListPage.$refs.TreeList.componentKey += 1
|
||||
},
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
<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',
|
||||
@@ -37,10 +38,6 @@ export default {
|
||||
type: String,
|
||||
default: '/api/v1/assets/assets/'
|
||||
},
|
||||
defaultPageSize: {
|
||||
type: Number,
|
||||
default: 10
|
||||
},
|
||||
baseNodeUrl: {
|
||||
type: String,
|
||||
default: '/api/v1/assets/nodes/'
|
||||
@@ -74,7 +71,6 @@ export default {
|
||||
value: iValue,
|
||||
multiple: true,
|
||||
clearable: true,
|
||||
defaultPageSize: this.defaultPageSize,
|
||||
ajax: {
|
||||
url: this.baseUrl,
|
||||
transformOption: (item) => {
|
||||
@@ -85,6 +81,7 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
b,
|
||||
handleFocus() {
|
||||
this.$refs.select2.selectRef.blur()
|
||||
this.dialogVisible = true
|
||||
|
||||
@@ -157,37 +157,30 @@ 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
|
||||
setParam('node_id', nodeId)
|
||||
setParam('asset_id', '')
|
||||
url = setUrlParam(url, 'node_id', nodeId)
|
||||
url = setUrlParam(url, 'asset_id', '')
|
||||
} else if (treeNode.meta.type === 'asset') {
|
||||
const assetId = treeNode.meta.data?.id || treeNode.id
|
||||
setParam('node_id', '')
|
||||
setParam('asset_id', assetId)
|
||||
url = setUrlParam(url, 'node_id', '')
|
||||
url = setUrlParam(url, 'asset_id', assetId)
|
||||
} else if (treeNode.meta.type === 'category') {
|
||||
setParam('category', treeNode.meta.category)
|
||||
url = setUrlParam(url, 'category', treeNode.meta.category)
|
||||
} else if (treeNode.meta.type === 'type') {
|
||||
setParam('category', treeNode.meta.category)
|
||||
setParam('type', treeNode.meta._type)
|
||||
url = setUrlParam(url, 'category', treeNode.meta.category)
|
||||
url = setUrlParam(url, 'type', treeNode.meta._type)
|
||||
} else if (treeNode.meta.type === 'platform') {
|
||||
setParam('platform', treeNode.id)
|
||||
url = setUrlParam(url, 'platform', treeNode.id)
|
||||
}
|
||||
setTimeout(() => {
|
||||
const query = this.setTreeUrlQuery()
|
||||
url = query ? `${url}&${query}` : url
|
||||
|
||||
setTimeout(() => {
|
||||
this.$set(this.tableConfig, 'url', url)
|
||||
})
|
||||
}, 300)
|
||||
|
||||
if (this.treeSetting.selectSyncToRoute !== false) {
|
||||
setRouterQuery(this, url)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
>
|
||||
<el-form :model="secretInfo" class="password-form" label-position="right" label-width="100px">
|
||||
<el-form-item :label="$tc('OldSecret')">
|
||||
<SecretViewerFormatter
|
||||
<ShowKeyCopyFormatter
|
||||
:cell-value="secretInfo.old_secret"
|
||||
:col="{ formatterArgs: {
|
||||
name: 'old_secret'
|
||||
@@ -20,7 +20,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$tc('NewSecret')">
|
||||
<SecretViewerFormatter
|
||||
<ShowKeyCopyFormatter
|
||||
:cell-value="secretInfo.new_secret"
|
||||
:col="{ formatterArgs: {
|
||||
name: 'new_secret'
|
||||
@@ -34,13 +34,13 @@
|
||||
|
||||
<script>
|
||||
import Dialog from '@/components/Dialog/index.vue'
|
||||
import { SecretViewerFormatter } from '@/components/Table/TableFormatters'
|
||||
import { ShowKeyCopyFormatter } from '@/components/Table/TableFormatters'
|
||||
|
||||
export default {
|
||||
name: 'RecordViewSecret',
|
||||
components: {
|
||||
Dialog,
|
||||
SecretViewerFormatter
|
||||
ShowKeyCopyFormatter
|
||||
},
|
||||
props: {
|
||||
visible: {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<AssetTreeTable
|
||||
ref="AssetTreeTable"
|
||||
:header-actions="headerActions"
|
||||
:table-config="tableConfig"
|
||||
:tree-setting="treeSetting"
|
||||
@@ -48,19 +47,9 @@ export default {
|
||||
return this.tableUrl.replace('/assets/', `/assets/${row.id}/accounts/`)
|
||||
}
|
||||
},
|
||||
name: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
formatter: DetailFormatter,
|
||||
formatterArgs: {
|
||||
route: 'AssetDetail',
|
||||
can: true
|
||||
}
|
||||
})
|
||||
},
|
||||
comment: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
nameDisabled: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -91,7 +80,11 @@ export default {
|
||||
},
|
||||
columnsMeta: {
|
||||
name: {
|
||||
...this.name
|
||||
formatter: DetailFormatter,
|
||||
formatterArgs: {
|
||||
route: 'AssetDetail',
|
||||
can: !this.nameDisabled
|
||||
}
|
||||
},
|
||||
labels: {
|
||||
formatterArgs: {
|
||||
@@ -106,8 +99,7 @@ export default {
|
||||
formatter: AccountInfoFormatter,
|
||||
width: '100px'
|
||||
},
|
||||
connectivity: connectivityMeta,
|
||||
comment: { ...this.comment }
|
||||
connectivity: connectivityMeta
|
||||
},
|
||||
tableAttrs: {
|
||||
rowClassName({ row }) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-row :gutter="20">
|
||||
<el-col :md="16" :sm="24" class="resource-activity">
|
||||
<el-col :md="16" :sm="24">
|
||||
<IBox :title="title" class="block" v-bind="$attrs">
|
||||
<el-timeline>
|
||||
<el-timeline-item
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="summary-header">
|
||||
<span class="title">{{ title }}</span>
|
||||
<el-card shadow="never">
|
||||
<div slot="header" class="summary-header">
|
||||
<span class="header-title">{{ title }}</span>
|
||||
</div>
|
||||
<slot>
|
||||
<h3 class="no-margins ">
|
||||
<span class="num" @click="handleClick">
|
||||
{{ iCount }}
|
||||
</span>
|
||||
</h3>
|
||||
<h1 class="no-margins">
|
||||
<span v-if="body.disabled" class="disabled-link">{{ body.count }}</span>
|
||||
<router-link v-else :to="body.route">
|
||||
<span>{{ body.count }}</span>
|
||||
</router-link>
|
||||
</h1>
|
||||
<small>{{ body.comment }}</small>
|
||||
</slot>
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'SummaryCard',
|
||||
props: {
|
||||
@@ -22,85 +23,56 @@ export default {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
body: {
|
||||
rightSideLabel: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
count: {
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
},
|
||||
route: {
|
||||
type: [String, Object],
|
||||
default: ''
|
||||
},
|
||||
callback: {
|
||||
type: Function,
|
||||
default: () => {
|
||||
}
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
iCount() {
|
||||
return this.body.count || this.count
|
||||
},
|
||||
iRoute() {
|
||||
return this.body.route || this.route
|
||||
},
|
||||
iDisabled() {
|
||||
return this.body.disabled === undefined ? this.disabled : this.body.disabled
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClick() {
|
||||
if (this.iDisabled) {
|
||||
return
|
||||
}
|
||||
if (this.iRoute) {
|
||||
this.$router.push(this.iRoute)
|
||||
return
|
||||
}
|
||||
this.callback.bind(this)()
|
||||
this.$emit('click')
|
||||
body: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.summary-header {
|
||||
//color: var(--color-icon-primary);
|
||||
.pull-right {
|
||||
float: right !important;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-style: normal;
|
||||
.header-title {
|
||||
font-size: 14px;
|
||||
margin: 0 0 7px;
|
||||
font-weight: 600;
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
line-height: 1.2;
|
||||
}
|
||||
}
|
||||
|
||||
.no-margins {
|
||||
.right-side ::v-deep .el-tag {
|
||||
font-weight: 600;
|
||||
padding: 3px 8px;
|
||||
text-shadow: none;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 30px;
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
.el-card__body {
|
||||
background-color: #ffffff;
|
||||
color: inherit;
|
||||
padding: 15px 20px 20px 20px !important;
|
||||
border-color: #e7eaec;
|
||||
border-image: none;
|
||||
border-style: solid solid none;
|
||||
border-width: 1px 0;
|
||||
}
|
||||
|
||||
.no-margins {
|
||||
margin: 0 !important;
|
||||
|
||||
.num {
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
font-size: 24px;
|
||||
line-height: 40px;
|
||||
color: var(--color-text-primary);
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.disabled-link {
|
||||
color: #428bca;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -29,13 +29,7 @@
|
||||
>
|
||||
{{ option.group }}
|
||||
</div>
|
||||
<el-tooltip
|
||||
:key="option.name"
|
||||
:content="option.tip"
|
||||
:disabled="!option.tip"
|
||||
:open-delay="500"
|
||||
placement="top"
|
||||
>
|
||||
<el-tooltip :key="option.name" :content="option.tip" :disabled="!option.tip" :open-delay="500" placement="top">
|
||||
<el-dropdown-item
|
||||
:key="option.name"
|
||||
:command="[option, action]"
|
||||
@@ -258,10 +252,7 @@ $color-drop-menu-border: #e4e7ed;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 2px 6px;
|
||||
|
||||
&:not(.is-plain) {
|
||||
color: $btn-text-color;
|
||||
}
|
||||
|
||||
* {
|
||||
vertical-align: baseline !important;
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
<template>
|
||||
<Dialog
|
||||
:visible="iVisible"
|
||||
height="300"
|
||||
title="Processing"
|
||||
width="300"
|
||||
>
|
||||
<div id="load">
|
||||
<div class="spinner" />
|
||||
</div>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Dialog from './index.vue'
|
||||
|
||||
export default {
|
||||
name: 'ProcessingDialog',
|
||||
components: { Dialog },
|
||||
props: {
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
iVisible: {
|
||||
get() {
|
||||
return this.visible
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('update:visible', val)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.spinner {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border: 5px solid rgba(0, 0, 0, 0.1);
|
||||
border-radius: 50%;
|
||||
border-top-color: #3498db;
|
||||
animation: spin 1s infinite linear;
|
||||
}
|
||||
|
||||
#load {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,96 +0,0 @@
|
||||
<template>
|
||||
<Dialog
|
||||
:show-cancel="false"
|
||||
:title="title"
|
||||
:visible.sync="visible"
|
||||
:close-on-click-modal="false"
|
||||
width="700px"
|
||||
@close="onClose"
|
||||
@confirm="visible = false"
|
||||
>
|
||||
<el-alert type="warning" :closable="false">
|
||||
{{ warningText }}
|
||||
<div class="secret">
|
||||
<div class="row">
|
||||
<span class="col">ID:</span>
|
||||
<span class="value">{{ keyInfo.id }}</span>
|
||||
<i class="el-icon-copy-document copy-icon" @click="handleCopy(keyInfo.id)" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="col">Secret:</span>
|
||||
<span class="value">{{ keyInfo.secret }}</span>
|
||||
<i class="el-icon-copy-document copy-icon" @click="handleCopy(keyInfo.secret)" />
|
||||
</div>
|
||||
</div>
|
||||
</el-alert>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import i18n from '@/i18n/i18n'
|
||||
import { copy } from '@/utils/common'
|
||||
import Dialog from '@/components/Dialog/index'
|
||||
|
||||
export default {
|
||||
name: 'Secret',
|
||||
components: {
|
||||
Dialog
|
||||
},
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: () => i18n.t('CreateAccessKey')
|
||||
},
|
||||
warningText: {
|
||||
type: String,
|
||||
default: () => i18n.t('ApiKeyWarning')
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyInfo: { id: '', secret: '' },
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
show(data) {
|
||||
this.keyInfo = data
|
||||
this.visible = true
|
||||
},
|
||||
onClose() {
|
||||
this.$emit('close')
|
||||
},
|
||||
handleCopy(value) {
|
||||
copy(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
.secret {
|
||||
color: #2b2f3a;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.row {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.col {
|
||||
width: 100px;
|
||||
text-align: left;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.copy-icon {
|
||||
margin-left: 5px;
|
||||
cursor: pointer;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
@@ -10,16 +10,13 @@
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<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"
|
||||
:disabled="disabledStatus"
|
||||
:loading="loadingStatus"
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="onConfirm"
|
||||
@@ -72,7 +69,7 @@ export default {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
disabledStatus: {
|
||||
loadingStatus: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
@@ -82,8 +79,7 @@ export default {
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
iWidth() {
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
<template>
|
||||
<el-drawer
|
||||
ref="drawer"
|
||||
size="61.8%"
|
||||
direction="rtl"
|
||||
custom-class="drawer"
|
||||
:title="title"
|
||||
:before-close="handleClose"
|
||||
:visible.sync="dialog"
|
||||
:wrapper-closable="true"
|
||||
>
|
||||
<div class="drawer__content">
|
||||
<slot name="default" />
|
||||
</div>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: function() {
|
||||
return this.$t('AddAccount')
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialog: true,
|
||||
loading: false,
|
||||
formLabelWidth: '80px'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClose(done) {
|
||||
this.$emit('close-drawer')
|
||||
done()
|
||||
},
|
||||
cancelForm() {
|
||||
this.loading = false
|
||||
this.dialog = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
::v-deep .drawer {
|
||||
min-width: 565px;
|
||||
|
||||
.el-drawer__header {
|
||||
margin-bottom: 20px;
|
||||
|
||||
span {
|
||||
font-size: 16px;
|
||||
font-weight: 800;
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.el-drawer__body {
|
||||
|
||||
.drawer__content {
|
||||
height: 100%;
|
||||
|
||||
.el-form {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
margin: unset !important;
|
||||
padding-right: 50px;
|
||||
height: 100%;
|
||||
|
||||
.el-form-item {
|
||||
margin: 5px 0 5px 0;
|
||||
}
|
||||
|
||||
.form-buttons {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
padding: 0 10px 0 10px;
|
||||
|
||||
.el-form-item__content {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
margin: unset !important;
|
||||
justify-content: center;
|
||||
|
||||
.el-button {
|
||||
width: 50%;
|
||||
border-radius: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -85,7 +85,6 @@ 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
|
||||
@@ -96,12 +95,11 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
outputValue: _.debounce(function(val) {
|
||||
this.$emit('input', val)
|
||||
}),
|
||||
updateValue(val) {
|
||||
this.iValue = val
|
||||
this.outputValue(val)
|
||||
setTimeout(() => {
|
||||
this.$emit('input', val)
|
||||
}, 100)
|
||||
},
|
||||
objectToString(obj) {
|
||||
let data = ''
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import Vue from 'vue'
|
||||
import ObjectSelect2 from '@/components/Form/FormFields/NestedObjectSelect2.vue'
|
||||
import NestedField from '@/components/Form/AutoDataForm/components/NestedField.vue'
|
||||
import Switcher from '@/components/Form/FormFields/Switcher.vue'
|
||||
import rules from '@/components/Form/DataForm/rules'
|
||||
import BasicTree from '@/components/Form/FormFields/BasicTree.vue'
|
||||
import JsonEditor from '@/components/Form/FormFields/JsonEditor.vue'
|
||||
@@ -64,9 +65,8 @@ export class FormFieldGenerator {
|
||||
}
|
||||
break
|
||||
case 'boolean':
|
||||
type = 'checkbox'
|
||||
// field.component = Switcher
|
||||
// field.type = 'checkbox'
|
||||
type = ''
|
||||
field.component = Switcher
|
||||
break
|
||||
case 'list':
|
||||
type = 'input'
|
||||
@@ -197,24 +197,6 @@ 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)
|
||||
|
||||
@@ -222,7 +204,15 @@ export class FormFieldGenerator {
|
||||
field.el.placeholder = field.placeholder
|
||||
}
|
||||
|
||||
this.setChoicesTips(field)
|
||||
// 设置 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]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return field
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,6 @@
|
||||
<el-tooltip v-if="opt.tip" :content="opt.tip" :open-delay="500" placement="top">
|
||||
<i class="el-icon-warning-outline" />
|
||||
</el-tooltip>
|
||||
<span v-if="data.helpText">{{ data.helpText }}</span>
|
||||
</el-checkbox>
|
||||
<!-- WARNING: radio 用 label 属性来表示 value 的含义 -->
|
||||
<!-- FYI: radio 的 value 属性可以在没有 radio-group 时用来关联到同一个 v-model -->
|
||||
@@ -88,7 +87,7 @@
|
||||
</el-radio>
|
||||
</template>
|
||||
</custom-component>
|
||||
<div v-if="data.helpText" :class="data.type" class="help-block">
|
||||
<div v-if="data.helpText" class="help-block">
|
||||
<el-alert
|
||||
v-if="data.helpText.startsWith('!')"
|
||||
:closable="false"
|
||||
@@ -316,10 +315,6 @@ export default {
|
||||
::v-deep .el-alert__icon {
|
||||
font-size: 16px
|
||||
}
|
||||
|
||||
&.checkbox {
|
||||
//display: inline;
|
||||
}
|
||||
}
|
||||
|
||||
.help-tip-icon {
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
>
|
||||
{{ iSubmitBtnText }}
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
v-if="defaultButton && hasSaveContinue"
|
||||
size="small"
|
||||
@@ -41,7 +40,6 @@
|
||||
>
|
||||
{{ $t("SaveAndAddAnother") }}
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
v-if="defaultButton && hasReset"
|
||||
size="small"
|
||||
@@ -49,7 +47,6 @@
|
||||
>
|
||||
{{ $t("Reset") }}
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
v-for="button in moreButtons"
|
||||
v-show="!button.hidden"
|
||||
|
||||
@@ -8,39 +8,28 @@
|
||||
:label="item.name"
|
||||
:prop="item.name"
|
||||
>
|
||||
|
||||
<template v-if="item.type === 'button' && !item.isVisible">
|
||||
<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 }}
|
||||
<i :class="item.icon" />{{ item.name }}
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
||||
<template v-if="item.type === 'input' && item.el && item.el.autoComplete">
|
||||
<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-tooltip :disabled="!item.tip" :content="item.tip">
|
||||
<el-input
|
||||
v-model="formModel[item.name]"
|
||||
:class="!isFold ? 'special-style' : ''"
|
||||
@@ -49,11 +38,9 @@
|
||||
size="mini"
|
||||
@change="item.callback(formModel[item.name])"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
||||
<template v-if="item.type === 'select' && item.el && item.el.create">
|
||||
<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"
|
||||
@@ -77,11 +64,9 @@
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
||||
<template v-if="item.type === 'select' && (!item.el || !item.el.create)">
|
||||
<el-tooltip :disabled="!item.tip" :content="item.tip">
|
||||
<el-dropdown
|
||||
class="select-dropdown"
|
||||
trigger="click"
|
||||
@@ -108,18 +93,14 @@
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
||||
<template v-if="item.type === 'switch'">
|
||||
<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
|
||||
@@ -153,13 +134,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
<codemirror
|
||||
ref="myCm"
|
||||
v-model="iValue"
|
||||
:options="iOptions"
|
||||
class="editor"
|
||||
:style="iActions.length > 0 ? { marginLeft: '30px' } : {}"
|
||||
/>
|
||||
<codemirror ref="myCm" v-model="iValue" :options="iOptions" class="editor" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -233,7 +208,7 @@ export default {
|
||||
|
||||
Object.values(actionsObj).forEach(action => {
|
||||
if (action.name === this.$t('RunAs') && action.type === 'input') {
|
||||
rules[action.name] = [{ required: true, message: this.$t('RequiredRunas'), trigger: 'blur' }]
|
||||
rules[action.name] = [{ required: true, message: '请输入运行用户', trigger: 'blur' }]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -398,6 +373,7 @@ $input-border-color: #C0C4CC;
|
||||
}
|
||||
|
||||
.editor {
|
||||
margin-left: 30px;
|
||||
border: 1px solid var(--color-border);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
v-bind="iAttrs"
|
||||
@input="handleInput"
|
||||
v-on="$listeners"
|
||||
>
|
||||
hello
|
||||
</Password>
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
@@ -54,22 +54,22 @@ export default {
|
||||
{
|
||||
id: 'uppercase',
|
||||
label: this.$t('Uppercase'),
|
||||
type: 'checkbox'
|
||||
type: 'switch'
|
||||
},
|
||||
{
|
||||
id: 'lowercase',
|
||||
label: this.$t('Lowercase'),
|
||||
type: 'checkbox'
|
||||
type: 'switch'
|
||||
},
|
||||
{
|
||||
id: 'digit',
|
||||
label: this.$t('Digit'),
|
||||
type: 'checkbox'
|
||||
type: 'switch'
|
||||
},
|
||||
{
|
||||
id: 'symbol',
|
||||
label: this.$t('SpecialSymbol'),
|
||||
type: 'checkbox'
|
||||
type: 'switch'
|
||||
},
|
||||
{
|
||||
id: 'exclude_symbols',
|
||||
|
||||
@@ -125,19 +125,16 @@ 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: vm.defaultPageSize
|
||||
pageSize: defaultPageSize
|
||||
}
|
||||
// 设置axios全局报错提示不显示
|
||||
const validateStatus = (status) => {
|
||||
@@ -197,6 +194,7 @@ export default {
|
||||
}
|
||||
},
|
||||
iAjax() {
|
||||
const defaultPageSize = 10
|
||||
const defaultMakeParams = (params) => {
|
||||
const page = params.page || 1
|
||||
const offset = (page - 1) * params.pageSize
|
||||
@@ -239,7 +237,7 @@ export default {
|
||||
}
|
||||
const defaultAjax = {
|
||||
url: '',
|
||||
pageSize: this.defaultPageSize,
|
||||
pageSize: defaultPageSize,
|
||||
makeParams: defaultMakeParams,
|
||||
transformOption: defaultTransformOption,
|
||||
processResults: defaultProcessResults,
|
||||
|
||||
@@ -14,12 +14,10 @@
|
||||
: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>
|
||||
@@ -79,16 +77,13 @@ 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: {
|
||||
@@ -172,3 +167,7 @@ export default {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="update-token">
|
||||
<div>
|
||||
<el-button v-show="!isShow" icon="el-icon-edit" type="text" @click="isShow=true">
|
||||
{{ text }}
|
||||
</el-button>
|
||||
@@ -8,19 +8,14 @@
|
||||
v-model.trim="curValue"
|
||||
:placeholder="placeholder"
|
||||
:type="type"
|
||||
class="password-input"
|
||||
autocomplete="new-password"
|
||||
show-password
|
||||
@change="onChange"
|
||||
/>
|
||||
<el-button size="small" type="text" @click="randomPassword">
|
||||
<i class="fa fa-retweet" />
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { randomString } from '@/utils/string'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
value: {
|
||||
@@ -60,24 +55,7 @@ export default {
|
||||
methods: {
|
||||
onChange(e) {
|
||||
this.$emit('input', this.curValue)
|
||||
},
|
||||
randomPassword() {
|
||||
this.curValue = randomString(24, true)
|
||||
this.$emit('input', this.curValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang='scss' scoped>
|
||||
.password-input {
|
||||
width: calc(100% - 50px);
|
||||
}
|
||||
|
||||
.update-token {
|
||||
i {
|
||||
color: var(--color-text-secondary);
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div v-if="tip !== ''" class="help-block">{{ tip }}</div>
|
||||
<input v-model="value" hidden type="text" v-on="$listeners">
|
||||
<div>
|
||||
<img v-if="preview" :class="showBG ? 'show-bg' : ''" :src="preview" v-bind="$attrs" alt="">
|
||||
<img :class="showBG ? 'show-bg' : ''" :src="preview" v-bind="$attrs">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -90,14 +90,8 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBus.$off('showColumnSettingPopover', this.showColumnSettingPopoverHandler)
|
||||
},
|
||||
mounted() {
|
||||
this.$eventBus.$on('showColumnSettingPopover', this.showColumnSettingPopoverHandler)
|
||||
},
|
||||
methods: {
|
||||
showColumnSettingPopoverHandler({ url }) {
|
||||
this.$eventBus.$on('showColumnSettingPopover', ({ url }) => {
|
||||
if (url === this.url) {
|
||||
this.checkAll = false
|
||||
this.showColumnSettingPopover = true
|
||||
@@ -111,7 +105,9 @@ export default {
|
||||
this.checkAll = false
|
||||
this.isIndeterminate = true
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
handleColumnConfirm() {
|
||||
this.showColumnSettingPopover = false
|
||||
this.$emit('columnsUpdate', { columns: this.iCurrentColumns, url: this.url })
|
||||
|
||||
@@ -348,8 +348,6 @@ export default {
|
||||
|
||||
let configColumns = config.columns || allColumnNames
|
||||
const columnsExclude = config.columnsExclude || []
|
||||
const columnsAdd = config.columnsAdd || []
|
||||
configColumns = configColumns.concat(columnsAdd)
|
||||
configColumns = configColumns.filter(item => !columnsExclude.includes(item))
|
||||
|
||||
// 解决后端 API 返回字段中包含 actions 的问题;
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<CardTable
|
||||
ref="table"
|
||||
:columns="3"
|
||||
:sub-component="subComponent"
|
||||
v-bind="$attrs"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script type="text/jsx">
|
||||
import CardTable from '@/components/Table/CardTable'
|
||||
import CardPanel from './components/CardPanel.vue'
|
||||
|
||||
export default {
|
||||
name: 'SmallCard',
|
||||
components: {
|
||||
CardTable
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
subComponent: CardPanel
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
reloadTable() {
|
||||
this.$refs.table.reloadTable()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,176 +0,0 @@
|
||||
<template>
|
||||
<div class="account-panel">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="21">
|
||||
<div class="title">
|
||||
<span>{{ object.name }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col v-if="iActions.length !== 0" :span="3" @click.native="handleClick($event)">
|
||||
<el-dropdown>
|
||||
<el-link :underline="false" type="primary">
|
||||
<i class="el-icon-more el-icon--right" style="color: var(--color-text-primary)" />
|
||||
</el-link>
|
||||
<el-dropdown-menu default="dropdown">
|
||||
<el-dropdown-item
|
||||
v-for="action in iActions"
|
||||
:key="action.name"
|
||||
:disabled="action.disabled"
|
||||
@click.native="action.callback(object)"
|
||||
>
|
||||
<i v-if="action.icon" :class="action.icon" /> {{ action.name }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-divider />
|
||||
<el-row :gutter="20" class="panel-content">
|
||||
<el-col :span="6" class="panel-image">
|
||||
<el-image :src="imageUrl" fit="contain" />
|
||||
</el-col>
|
||||
<el-col :span="18" class="panel-info">
|
||||
<InfoPanel
|
||||
v-for="(obj, index) in getInfos(object)"
|
||||
:key="index"
|
||||
:content="obj.content"
|
||||
:title="obj.title"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import InfoPanel from './InfoPanel'
|
||||
|
||||
export default {
|
||||
name: 'CardPanel',
|
||||
components: {
|
||||
InfoPanel
|
||||
},
|
||||
props: {
|
||||
tableConfig: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
object: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
actions: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
infos: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
getImage: {
|
||||
type: Function,
|
||||
default: (obj) => ''
|
||||
},
|
||||
getInfos: {
|
||||
type: Function,
|
||||
default: (obj) => []
|
||||
},
|
||||
handleUpdate: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
defaultActions: [
|
||||
{
|
||||
id: 'update',
|
||||
name: this.$tc('Update'),
|
||||
icon: 'el-icon-edit',
|
||||
callback: this.handleUpdate,
|
||||
disabled: this.isDisabled('change')
|
||||
},
|
||||
{
|
||||
id: 'delete',
|
||||
name: this.$tc('Delete'),
|
||||
icon: 'el-icon-delete',
|
||||
callback: this.handleDelete,
|
||||
disabled: this.isDisabled('delete')
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
imageUrl() {
|
||||
return this.getImage(this.object)
|
||||
},
|
||||
iActions() {
|
||||
const mergedActions = new Map()
|
||||
this.defaultActions.forEach(a => {
|
||||
mergedActions.set(a.id, { ...a })
|
||||
})
|
||||
this.actions.forEach(a => {
|
||||
mergedActions.set(a.id, { ...a })
|
||||
})
|
||||
return Array.from(mergedActions.values())
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isDisabled(action) {
|
||||
const app = this.tableConfig.permissions?.app
|
||||
const resource = this.tableConfig.permissions?.resource
|
||||
return !this.$hasPerm(`${app}.${action}_${resource}`)
|
||||
},
|
||||
handleClick(event) {
|
||||
event.stopPropagation()
|
||||
},
|
||||
handleDelete() {
|
||||
const url = this.tableConfig.url
|
||||
this.$confirm(this.$tc('DeleteConfirmMessage'), this.$tc('Delete'), {
|
||||
confirmButtonText: this.$tc('Confirm'),
|
||||
cancelButtonText: this.$tc('Cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$axios.delete(`${url}${this.object.id}/`).then(() => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$tc('DeleteSuccess')
|
||||
})
|
||||
this.$emit('refresh')
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.account-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
//height: 100%;
|
||||
cursor: pointer;
|
||||
|
||||
.title {
|
||||
text-align: left;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.panel-content {
|
||||
display: flex;
|
||||
height: 100px;
|
||||
padding: 10px 0;
|
||||
|
||||
.panel-image {
|
||||
margin: auto 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.el-divider--horizontal {
|
||||
margin: 5px 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -10,7 +10,7 @@
|
||||
<IBox v-if="totalData.length === 0">
|
||||
<el-empty :description="$t('NoData')" :image-size="200" class="no-data" style="padding: 20px" />
|
||||
</IBox>
|
||||
<el-col v-for="(d, index) in totalData" :key="index" :lg="24 / columns" :md="12" :sm="24" style="min-width: 335px;">
|
||||
<el-col v-for="(d, index) in totalData" :key="index" :lg="8" :md="12" :sm="24" style="min-width: 335px;">
|
||||
<el-card
|
||||
:body-style="{ 'text-align': 'center', 'padding': '15px' }"
|
||||
:class="{'is-disabled': isDisabled(d)}"
|
||||
@@ -19,14 +19,7 @@
|
||||
@click.native="onView(d)"
|
||||
>
|
||||
<keep-alive>
|
||||
<component
|
||||
:is="subComponent"
|
||||
v-if="subComponent"
|
||||
:object="d"
|
||||
:table-config="tableConfig"
|
||||
v-bind="subComponentProps"
|
||||
@refresh="getList"
|
||||
/>
|
||||
<component :is="subComponent" v-if="subComponent" :object="d" @refresh="getList" />
|
||||
<slot v-else :index="index" :item="d">
|
||||
<span v-if="d.edition === 'enterprise'" class="enterprise">
|
||||
{{ $t('Enterprise') }}
|
||||
@@ -92,10 +85,6 @@ export default {
|
||||
},
|
||||
props: {
|
||||
// 定义 table 的配置
|
||||
columns: {
|
||||
type: Number,
|
||||
default: 3
|
||||
},
|
||||
tableConfig: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
@@ -111,10 +100,6 @@ export default {
|
||||
subComponent: {
|
||||
type: Object,
|
||||
default: () => null
|
||||
},
|
||||
subComponentProps: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -153,8 +153,6 @@ export default {
|
||||
this.toggleRowSelection(row, true)
|
||||
}
|
||||
}
|
||||
|
||||
this.$emit('loaded')
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
localStorage.setItem('paginationSize', val)
|
||||
|
||||
@@ -1,263 +0,0 @@
|
||||
<template>
|
||||
<div v-if="filters || summary" :class="isExpand ? 'expand': 'shrink' " class="quick-filter">
|
||||
<div v-show="isExpand" class="quick-filter-wrap">
|
||||
<div v-if="filters" class="quick-filter-zone">
|
||||
<div v-for="category in iFilters" :key="category.label" class="item-zone">
|
||||
<div>
|
||||
<h5>{{ category.label }}</h5>
|
||||
<div class="filter-options">
|
||||
<span
|
||||
v-for="option in category.options"
|
||||
:key="option.label"
|
||||
:class="option.active ? 'active' : ''"
|
||||
class="item"
|
||||
@click="handleFilterClick(option)"
|
||||
>
|
||||
{{ option.label }}
|
||||
<i class="el-icon-circle-check" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="summary" class="summary-zone">
|
||||
<span v-for="item of iSummary" :key="item.title" class="summary-block">
|
||||
<SummaryCard
|
||||
:class="item.active ? 'active' : ''"
|
||||
:count="item.count"
|
||||
:title="item.title"
|
||||
@click="handleFilterClick(item)"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="expand-bar-wrap">
|
||||
<div class="expand-bar" @click="toggle">
|
||||
<i :class="isExpand ? 'expand': 'shrink' " class="fa fa-angle-double-up" />
|
||||
<span v-show="!isExpand"> 展开过滤器 </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SummaryCard from '@/components/Cards/SummaryCard'
|
||||
|
||||
export default {
|
||||
name: 'QuickFilter',
|
||||
components: { SummaryCard },
|
||||
props: {
|
||||
filters: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
summary: {
|
||||
type: Array,
|
||||
default: null
|
||||
},
|
||||
expand: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isExpand: this.expand,
|
||||
iFilters: this.cleanFilters(),
|
||||
iSummary: this.cleanSummary(),
|
||||
filtered: {},
|
||||
activeFilters: []
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
watch: {
|
||||
isExpand(val) {
|
||||
this.$emit('expand', val)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
cleanSummary() {
|
||||
if (!this.summary) {
|
||||
return []
|
||||
}
|
||||
return this.summary.map(item => {
|
||||
return {
|
||||
category: 'summary',
|
||||
label: item.title,
|
||||
...item,
|
||||
filter: item.filter || {},
|
||||
active: false
|
||||
}
|
||||
})
|
||||
},
|
||||
cleanFilters() {
|
||||
if (!this.filters) {
|
||||
return []
|
||||
}
|
||||
return this.filters.map(category => {
|
||||
return {
|
||||
...category,
|
||||
options: category.options.map(option => {
|
||||
return {
|
||||
category: category.label,
|
||||
...option,
|
||||
active: false,
|
||||
filter: option.filter || {}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
toggle() {
|
||||
this.isExpand = !this.isExpand
|
||||
},
|
||||
handleFilterClick(option) {
|
||||
if (!option.active) {
|
||||
this.activeFilters = this.activeFilters.filter(item => {
|
||||
const conflict = Object.keys(item.filter).some(key => {
|
||||
return Object.keys(option.filter).includes(key)
|
||||
})
|
||||
if (conflict) {
|
||||
item.active = false
|
||||
}
|
||||
return !conflict
|
||||
})
|
||||
this.activeFilters.push(option)
|
||||
} else {
|
||||
this.activeFilters = this.activeFilters.filter(item => {
|
||||
return item.label !== option.label && item.category !== option.category
|
||||
})
|
||||
}
|
||||
option.active = !option.active
|
||||
this.activeFilters.forEach(item => {
|
||||
this.filtered = { ...item.filter }
|
||||
})
|
||||
this.$emit('filter', this.filtered)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang='scss' scoped>
|
||||
.quick-filter {
|
||||
background: white;
|
||||
padding: 10px 10px 10px 20px;
|
||||
margin-bottom: 10px;
|
||||
display: flex;
|
||||
place-content: stretch flex-end;
|
||||
justify-content: center;
|
||||
align-content: stretch;
|
||||
box-shadow: 0 1px 1px 0 rgba(54, 58, 80, .32);
|
||||
|
||||
&.shrink {
|
||||
background: inherit;
|
||||
padding: 0;
|
||||
margin-bottom: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.quick-filter-wrap {
|
||||
display: inline-block;
|
||||
width: calc(100% - 70px);
|
||||
|
||||
.summary-zone {
|
||||
padding-top: 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.summary-block {
|
||||
.active {
|
||||
::v-deep .no-margins .num {
|
||||
color: var(--color-primary);
|
||||
|
||||
&::after {
|
||||
content: "\e720";
|
||||
font-family: element-icons !important;
|
||||
font-size: 13px;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.quick-filter-zone {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
flex-wrap: wrap; /* 允许 item-zone 换行 */
|
||||
gap: 10px;
|
||||
|
||||
h5 {
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
font-size: 12px;
|
||||
margin-bottom: .5rem;
|
||||
line-height: 1.2;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.item-zone {
|
||||
margin-right: 30px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.item {
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
color: #303133;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
|
||||
i {
|
||||
visibility: hidden;
|
||||
margin-left: -3px;
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: var(--color-primary);
|
||||
font-weight: 500;
|
||||
|
||||
i {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none outside none;
|
||||
margin-block-start: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.filter-options {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.expand-bar-wrap {
|
||||
margin: auto 0;
|
||||
min-width: 60px;
|
||||
|
||||
.expand-bar {
|
||||
float: right;
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
|
||||
i {
|
||||
padding: 5px;
|
||||
|
||||
&.shrink {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -49,7 +49,6 @@
|
||||
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',
|
||||
@@ -171,18 +170,14 @@ export default {
|
||||
]
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBus.$off('showExportDialog', this.showExportDialogHandler)
|
||||
},
|
||||
mounted() {
|
||||
this.$eventBus.$on('showExportDialog', this.showExportDialogHandler)
|
||||
},
|
||||
methods: {
|
||||
showExportDialogHandler({ selectedRows, url, name }) {
|
||||
this.$eventBus.$on('showExportDialog', ({ selectedRows, url, name }) => {
|
||||
if (url === this.url || url.indexOf(this.url) > -1) {
|
||||
this.showExportDialog()
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
showExportDialog() {
|
||||
if (!this.mfaVerifyRequired) {
|
||||
this.exportDialogShow = true
|
||||
@@ -202,7 +197,10 @@ export default {
|
||||
})
|
||||
},
|
||||
downloadCsv(url) {
|
||||
download(url)
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.click()
|
||||
window.URL.revokeObjectURL(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 { download, getErrorResponseMsg } from '@/utils/common'
|
||||
import { getErrorResponseMsg } from '@/utils/common'
|
||||
import { createSourceIdCache } from '@/api/common'
|
||||
|
||||
export default {
|
||||
@@ -142,18 +142,14 @@ export default {
|
||||
this.showTable = false
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBus.$off('showImportDialog', this.showImportEventHandler)
|
||||
},
|
||||
mounted() {
|
||||
this.$eventBus.$on('showImportDialog', this.showImportEventHandler)
|
||||
},
|
||||
methods: {
|
||||
showImportEventHandler({ url }) {
|
||||
this.$eventBus.$on('showImportDialog', ({ url }) => {
|
||||
if (url === this.url) {
|
||||
this.showImportDialog = true
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
closeDialog() {
|
||||
this.showImportDialog = false
|
||||
this.$emit('importDialogClose')
|
||||
@@ -230,7 +226,10 @@ export default {
|
||||
this.$message.success(msg)
|
||||
},
|
||||
downloadCsv(url) {
|
||||
download(url)
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.click()
|
||||
window.URL.revokeObjectURL(url)
|
||||
},
|
||||
async handleImportConfirm() {
|
||||
await this.$refs['importTable'].performUpload()
|
||||
|
||||
@@ -44,9 +44,8 @@
|
||||
import DataTable from '@/components/Table/DataTable/index.vue'
|
||||
import { getUpdateObjURL } from '@/utils/common'
|
||||
import { sleep } from '@/utils/time'
|
||||
import { EditableInputFormatter } from '@/components/Table/TableFormatters'
|
||||
import { EditableInputFormatter, StatusFormatter } from '@/components/Table/TableFormatters'
|
||||
import { encryptPassword } from '@/utils/crypto'
|
||||
import getStatusColumnMeta from '@/components/Table/ListTable/TableAction/const'
|
||||
|
||||
export default {
|
||||
name: 'ImportTable',
|
||||
@@ -224,7 +223,38 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
generateTableColumns(tableTitles, tableData) {
|
||||
const columns = [{ ...getStatusColumnMeta.bind(this)().status }]
|
||||
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
|
||||
}
|
||||
}]
|
||||
for (const item of tableTitles) {
|
||||
const dataItemLens = tableData.map(d => {
|
||||
if (!d) {
|
||||
|
||||
@@ -71,16 +71,7 @@ export default {
|
||||
this.listenViewPort()
|
||||
},
|
||||
mounted() {
|
||||
this.$eventBus.$on('labelSearch', this.labelSearchHandler)
|
||||
},
|
||||
beforeDestroy(label) {
|
||||
this.$eventBus.$off('labelSearch', this.labelSearchHandler)
|
||||
},
|
||||
methods: {
|
||||
handleCascaderFocus() {
|
||||
this.setSearchFocus()
|
||||
},
|
||||
labelSearchHandler(label) {
|
||||
this.$eventBus.$on('labelSearch', label => {
|
||||
if (!label) {
|
||||
this.labelValue = []
|
||||
this.showLabelSearch = true
|
||||
@@ -91,6 +82,14 @@ export default {
|
||||
setTimeout(() => {
|
||||
this.showLabelSearch = true
|
||||
}, 500)
|
||||
})
|
||||
},
|
||||
destroyed() {
|
||||
this.$eventBus.$off('labelSearch')
|
||||
},
|
||||
methods: {
|
||||
handleCascaderFocus() {
|
||||
this.setSearchFocus()
|
||||
},
|
||||
handleCascaderVisibleChange(visible) {
|
||||
const input = this.$refs.labelCascader.$el
|
||||
|
||||
@@ -1,37 +1,25 @@
|
||||
<template>
|
||||
<div>
|
||||
<DataActions
|
||||
v-if="hasLeftActions && iActions.length > 0"
|
||||
:actions="iActions"
|
||||
class="header-action"
|
||||
v-bind="$attrs"
|
||||
/>
|
||||
|
||||
<Drawer v-if="showDrawer" @close-drawer="handleCloseDrawer">
|
||||
<component :is="dynamicTemplateComponent" />
|
||||
</Drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { cleanActions } from './utils'
|
||||
import { createSourceIdCache } from '@/api/common'
|
||||
import { getErrorResponseMsg } from '@/utils/common'
|
||||
|
||||
import i18n from '@/i18n/i18n'
|
||||
import Drawer from '@/components/Drawer/index.vue'
|
||||
import DataActions from '@/components/DataActions/index.vue'
|
||||
import AccountTemplateCreate from '@/views/accounts/AccountTemplate/AccountTemplateCreateUpdate.vue'
|
||||
import { createSourceIdCache } from '@/api/common'
|
||||
import { cleanActions } from './utils'
|
||||
import { getErrorResponseMsg } from '@/utils/common'
|
||||
|
||||
const defaultTrue = { type: [Boolean, Function, String], default: true }
|
||||
const defaultFalse = { type: [Boolean, Function, String], default: false }
|
||||
|
||||
export default {
|
||||
name: 'LeftSide',
|
||||
components: {
|
||||
Drawer,
|
||||
DataActions,
|
||||
AccountTemplateCreate
|
||||
DataActions
|
||||
},
|
||||
props: {
|
||||
hasLeftActions: defaultTrue,
|
||||
@@ -102,8 +90,6 @@ export default {
|
||||
data() {
|
||||
const vm = this
|
||||
return {
|
||||
showDrawer: false,
|
||||
dynamicTemplateComponent: null,
|
||||
defaultMoreActions: [
|
||||
{
|
||||
title: this.$t('DeleteSelected'),
|
||||
@@ -208,7 +194,6 @@ export default {
|
||||
methods: {
|
||||
handleCreate() {
|
||||
let route
|
||||
|
||||
if (typeof this.createRoute === 'string') {
|
||||
route = { name: this.createRoute }
|
||||
route.name = this.createRoute
|
||||
@@ -217,27 +202,14 @@ export default {
|
||||
} else if (typeof this.createRoute === 'object') {
|
||||
route = this.createRoute
|
||||
}
|
||||
|
||||
this.$log.debug('handle create')
|
||||
|
||||
if (this.createInNewPage) {
|
||||
const { href } = this.$router.resolve(route)
|
||||
window.open(href, '_blank')
|
||||
} else {
|
||||
if (route.isPam) {
|
||||
this.showDrawer = true
|
||||
this.dynamicTemplateComponent = route.name
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
this.$router.push(route)
|
||||
}
|
||||
},
|
||||
handleCloseDrawer() {
|
||||
this.showDrawer = false
|
||||
this.dynamicTemplateComponent = null
|
||||
},
|
||||
defaultBulkDeleteCallback({ selectedRows, reloadTable }) {
|
||||
const msg = this.$t('DeleteWarningMsg') + ' ' + selectedRows.length + ' ' + this.$t('Rows') + ' ?'
|
||||
const title = this.$tc('Info')
|
||||
@@ -276,17 +248,3 @@ export default {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
::v-deep .ibox {
|
||||
height: 100% !important;
|
||||
margin: unset !important;
|
||||
border: unset !important;
|
||||
|
||||
.el-card__body {
|
||||
padding-top: unset !important;
|
||||
padding-bottom: unset !important;
|
||||
height: 100% !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -185,6 +185,7 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding-left: 10px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
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
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div :class="device" class="table-header clearfix container">
|
||||
<div :class="device" class="table-header clearfix">
|
||||
<slot name="header">
|
||||
<LeftSide
|
||||
v-if="hasLeftActions"
|
||||
@@ -10,7 +10,6 @@
|
||||
v-on="$listeners"
|
||||
@init-actions-done="handleActionsDone"
|
||||
/>
|
||||
|
||||
<RightSide
|
||||
v-if="hasRightActions"
|
||||
:selected-rows="selectedRows"
|
||||
@@ -19,7 +18,6 @@
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
/>
|
||||
|
||||
<div :class="searchClass" class="search">
|
||||
<LabelSearch
|
||||
v-if="hasLabelSearch"
|
||||
@@ -160,7 +158,7 @@ $headerHeight: 30px;
|
||||
.table-header {
|
||||
.left-side {
|
||||
display: block;
|
||||
//float: left;
|
||||
float: left;
|
||||
|
||||
::v-deep .action-item.el-dropdown > .el-button {
|
||||
height: 100%;
|
||||
@@ -168,14 +166,13 @@ $headerHeight: 30px;
|
||||
}
|
||||
|
||||
.right-side {
|
||||
//float: right;
|
||||
float: right;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.search {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
|
||||
.right-side-item.action-search {
|
||||
border: 1px solid var(--color-border);
|
||||
@@ -184,60 +181,65 @@ $headerHeight: 30px;
|
||||
}
|
||||
|
||||
.search.left {
|
||||
float: left;
|
||||
padding: 0 !important;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.search.right {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding-right: 10px;
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px 0;
|
||||
|
||||
&.mobile {
|
||||
justify-content: flex-start;
|
||||
|
||||
.left-side {
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.search {
|
||||
justify-content: flex-start;
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.left-side {
|
||||
order: 1;
|
||||
}
|
||||
|
||||
.search {
|
||||
order: 2;
|
||||
flex-grow: 1; /* This allows it to grow and fill available space */
|
||||
}
|
||||
|
||||
.right-side {
|
||||
order: 3;
|
||||
}
|
||||
|
||||
/* When .left-side is not present, adjust the layout */
|
||||
.container:not(:has(.left-side)) .search {
|
||||
margin-right: auto; /* Pushes .search to the left */
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.export-item {
|
||||
display: block;
|
||||
padding: 5px 20px;
|
||||
}
|
||||
|
||||
.mobile .search {
|
||||
display: inherit;
|
||||
}
|
||||
|
||||
.mobile .search .datepicker {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.mobile .search.right {
|
||||
clear: both;
|
||||
float: none;
|
||||
padding-top: 10px;
|
||||
|
||||
.label-search {
|
||||
margin-right: 0;
|
||||
|
||||
::v-deep .el-button.label-button {
|
||||
border: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
::v-deep .label-cascader {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mobile .search.right .action-search {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.mobile .right-side {
|
||||
padding-top: 3px;
|
||||
}
|
||||
|
||||
@media (max-width: 481px) {
|
||||
.mobile .right-side {
|
||||
float: left;
|
||||
margin-left: -15px;
|
||||
}
|
||||
|
||||
.mobile .left-side {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
<QuickFilter :filters="quickFilters" :summary="quickSummary" @filter="filter" />
|
||||
<TableAction
|
||||
v-if="hasActions"
|
||||
:date-pick="handleDateChange"
|
||||
@@ -32,13 +31,11 @@ import IBox from '../../IBox/index.vue'
|
||||
import TableAction from './TableAction/index.vue'
|
||||
import Emitter from '@/mixins/emitter'
|
||||
import AutoDataTable from '../AutoDataTable/index.vue'
|
||||
import QuickFilter from './QuickFilter.vue'
|
||||
import { getDayEnd, getDaysAgo } from '@/utils/time'
|
||||
|
||||
export default {
|
||||
name: 'ListTable',
|
||||
components: {
|
||||
QuickFilter,
|
||||
AutoDataTable,
|
||||
TableAction,
|
||||
IBox
|
||||
@@ -54,14 +51,6 @@ export default {
|
||||
headerActions: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
quickFilters: {
|
||||
type: Array,
|
||||
default: () => null
|
||||
},
|
||||
quickSummary: {
|
||||
type: Array,
|
||||
default: () => null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -200,44 +189,24 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$set(this.urlUpdated, this.tableUrl, location.href)
|
||||
this.urlUpdated[this.tableUrl] = location.href
|
||||
},
|
||||
deactivated() {
|
||||
this.isDeactivated = true
|
||||
},
|
||||
activated() {
|
||||
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)
|
||||
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.reloadTable()
|
||||
})
|
||||
}, 500)
|
||||
},
|
||||
methods: {
|
||||
handleQuickFilter(option) {
|
||||
if (option.route) {
|
||||
this.$router.push(option.route)
|
||||
return
|
||||
}
|
||||
if (option.filter) {
|
||||
const filter = { ...option.filter }
|
||||
if (option.active) {
|
||||
for (const key in filter) {
|
||||
filter[key] = ''
|
||||
}
|
||||
}
|
||||
this.filter(option.filter)
|
||||
return
|
||||
}
|
||||
if (option.callback) {
|
||||
option.callback(option.active)
|
||||
}
|
||||
},
|
||||
handleActionInitialDone() {
|
||||
setTimeout(() => {
|
||||
this.actionInit = true
|
||||
|
||||
@@ -135,7 +135,7 @@ export default {
|
||||
{
|
||||
name: 'clone',
|
||||
title: this.$t('Duplicate'),
|
||||
type: 'primary',
|
||||
type: 'info',
|
||||
has: colActions.hasClone,
|
||||
can: colActions.canClone,
|
||||
callback: colActions.onClone,
|
||||
|
||||
@@ -51,7 +51,7 @@ export default {
|
||||
const formatterArgs = Object.assign(this.formatterArgsDefault, this.col.formatterArgs || {})
|
||||
return {
|
||||
formatterArgs: formatterArgs,
|
||||
listData: formatterArgs.async ? [] : (this.cellValue || []),
|
||||
data: formatterArgs.async ? [] : (this.cellValue || []),
|
||||
amount: '',
|
||||
asyncGetDone: false
|
||||
}
|
||||
@@ -68,18 +68,17 @@ export default {
|
||||
return [this.$t('Loading') + '...']
|
||||
}
|
||||
const getItem = this.formatterArgs.getItem || (item => item.name)
|
||||
|
||||
let data = []
|
||||
|
||||
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]) => {
|
||||
if (Array.isArray(this.data)) {
|
||||
data = this.data.map(item => getItem(item)) || []
|
||||
} else {
|
||||
// object {key: [value]}
|
||||
data = Object.entries(this.data).map(([key, value]) => {
|
||||
const item = { key: key, value: value }
|
||||
return getItem(item)
|
||||
}).filter(Boolean)
|
||||
}) || []
|
||||
}
|
||||
|
||||
data = data.filter(Boolean)
|
||||
return data
|
||||
},
|
||||
showItems() {
|
||||
@@ -87,13 +86,9 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
cellValue: {
|
||||
handler(newValue) {
|
||||
// listData 需要重新赋值一遍 items 重新计算
|
||||
this.listData = newValue
|
||||
cellValue() {
|
||||
this.computeAmount()
|
||||
}
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
this.computeAmount()
|
||||
@@ -110,7 +105,6 @@ export default {
|
||||
// object {key: [value]}
|
||||
cellValue = Object.keys(this.cellValue)
|
||||
}
|
||||
|
||||
this.amount = (cellValue?.filter(value => !this.cellValueToRemove.includes(value)) || []).length
|
||||
}
|
||||
},
|
||||
@@ -133,7 +127,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.listData = transform(response)
|
||||
this.data = transform(response)
|
||||
this.asyncGetDone = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<span class="date">{{ dateValue }}</span>
|
||||
<span>{{ value }}</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -10,31 +10,24 @@ 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,158 +0,0 @@
|
||||
<template>
|
||||
<span class="conform-td">
|
||||
<span v-if="iValue === '0'">
|
||||
<el-dropdown trigger="click" @command="handleRisk">
|
||||
<el-button class="confirm action" size="mini">
|
||||
<i class="fa fa-check" />
|
||||
</el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item v-for="item of iActions" :key="item.name" :command="item.name">
|
||||
{{ item.label }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<el-tooltip :content="$tc('Ignore')" :open-delay="400">
|
||||
<el-button class="ignore action" size="mini">
|
||||
<svg-icon icon-class="ignore" />
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<el-tooltip v-else :content="iLabel" :open-delay="400" class="platform-status">
|
||||
<span v-if="iValue === '1' ">
|
||||
<i class="fa fa-check color-primary" />
|
||||
</span>
|
||||
<span v-else>
|
||||
<svg-icon icon-class="ignore" />
|
||||
</span>
|
||||
</el-tooltip>
|
||||
<ProcessingDialog :visible="processing" />
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseFormatter from './base.vue'
|
||||
import ProcessingDialog from '@/components/Dialog/ProcessingDialog.vue'
|
||||
|
||||
export default {
|
||||
name: 'ConfirmOrIgnoreFormatter',
|
||||
components: { ProcessingDialog },
|
||||
extends: BaseFormatter,
|
||||
props: {
|
||||
formatterArgsDefault: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
confirm: ({ row, cellValue }) => {
|
||||
},
|
||||
ignore: ({ row, cellValue }) => {
|
||||
},
|
||||
remove: ({ row, cellValue }) => {
|
||||
},
|
||||
confirmIcon: 'fa fa-check'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formatterArgs: Object.assign(this.formatterArgsDefault, this.col.formatterArgs),
|
||||
processing: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
iValue() {
|
||||
if (this.cellValueIsLabelChoice()) {
|
||||
return this.cellValue.value
|
||||
} else {
|
||||
return this.cellValue
|
||||
}
|
||||
},
|
||||
iLabel() {
|
||||
if (this.cellValueIsLabelChoice()) {
|
||||
return this.cellValue.label
|
||||
} else {
|
||||
return this.cellValue
|
||||
}
|
||||
},
|
||||
iActions() {
|
||||
return this.getActions()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleRemove() {
|
||||
this.formatterArgs.remove({ row: this.row, cellValue: this.cellValue })
|
||||
},
|
||||
handleRisk(cmd) {
|
||||
const data = {
|
||||
asset: this.row.asset.id,
|
||||
username: this.row.username,
|
||||
action: cmd,
|
||||
risk: ''
|
||||
}
|
||||
this.processing = true
|
||||
this.$axios.post(`/api/v1/accounts/account-risks/handle/`, data).then(() => {
|
||||
if (cmd === 'add_account') {
|
||||
this.row.present = true
|
||||
}
|
||||
this.row.status = { 'value': '1' }
|
||||
}).finally(() => {
|
||||
setTimeout(() => {
|
||||
this.processing = false
|
||||
}, 500)
|
||||
})
|
||||
},
|
||||
getActions() {
|
||||
const actions = [
|
||||
// {
|
||||
// name: 'disable_account',
|
||||
// label: this.$t('Disable remote account'),
|
||||
// has: this.row.remote_present
|
||||
// },
|
||||
{
|
||||
name: 'delete_remote',
|
||||
label: this.$t('Delete remote account'),
|
||||
has: this.row.remote_present
|
||||
},
|
||||
{
|
||||
name: 'add_account',
|
||||
label: this.$t('Add account'),
|
||||
has: !this.row.present
|
||||
}
|
||||
]
|
||||
return actions.filter(action => {
|
||||
return action.has
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
||||
.action.el-button--mini {
|
||||
cursor: pointer;
|
||||
padding: 1px 4px;
|
||||
|
||||
&.confirm {
|
||||
::v-deep i {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
&.remove {
|
||||
::v-deep i {
|
||||
color: var(--color-danger);
|
||||
}
|
||||
}
|
||||
|
||||
&.ignore {
|
||||
::v-deep svg.svg-icon {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.action.ignore {
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,8 +1,7 @@
|
||||
<template>
|
||||
<div class="edit-container" style="min-height: 20px" @click.stop="editCell">
|
||||
<div style="width: 100%;min-height: 20px" @click.stop="editCell">
|
||||
<el-input
|
||||
v-if="inEditMode"
|
||||
ref="inputRef"
|
||||
v-model="value"
|
||||
class="editInput"
|
||||
size="mini"
|
||||
@@ -10,17 +9,8 @@
|
||||
@keyup.enter.native="onInputEnter"
|
||||
/>
|
||||
<template v-else>
|
||||
<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>
|
||||
<span>{{ iCellValue }}</span>
|
||||
</template>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -71,9 +61,6 @@ export default {
|
||||
editCell() {
|
||||
if (this.formatterArgs.canEdit) {
|
||||
this.inEditMode = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.inputRef.focus()
|
||||
})
|
||||
}
|
||||
},
|
||||
getCellValue(val) {
|
||||
@@ -101,7 +88,7 @@ export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped>
|
||||
.editInput ::v-deep .el-input__inner {
|
||||
padding: 2px;
|
||||
line-height: 12px;
|
||||
@@ -110,35 +97,4 @@ 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>
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
<template>
|
||||
<span class="platform-td">
|
||||
<span class="icon-zone">
|
||||
<img :src="icon" alt="icon" class="asset-icon">
|
||||
</span>
|
||||
<span class="platform-name">{{ value.name }}</span>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseFormatter from './base.vue'
|
||||
import { loadPlatformIcon } from '@/utils/jms'
|
||||
|
||||
export default {
|
||||
name: 'PlatformFormatter',
|
||||
extends: BaseFormatter,
|
||||
props: {
|
||||
formatterArgsDefault: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
platformAttr: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formatterArgs: Object.assign(this.formatterArgsDefault, this.col.formatterArgs)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
icon() {
|
||||
return loadPlatformIcon(this.value.name, this.value.type)
|
||||
},
|
||||
value() {
|
||||
if (!this.formatterArgs.platformAttr) {
|
||||
return this.cellValue
|
||||
} else {
|
||||
return _.get(this.row, this.formatterArgs.platformAttr)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.icon-zone {
|
||||
display: inline-block;
|
||||
width: 1.5em;
|
||||
}
|
||||
|
||||
.asset-icon {
|
||||
height: 1.5em;
|
||||
vertical-align: -0.2em;
|
||||
fill: currentColor;
|
||||
}
|
||||
</style>
|
||||
@@ -1,24 +1,8 @@
|
||||
<template>
|
||||
<div class="content">
|
||||
<span v-if="realValue" :class="formatterArgs.actionLeft ? 'left' : 'right'" class="action">
|
||||
<template v-for="(item, index) in iActions">
|
||||
<el-tooltip
|
||||
v-if="item.has"
|
||||
:key="index"
|
||||
:content="item.tooltip"
|
||||
:open-delay="500"
|
||||
effect="dark"
|
||||
placement="top"
|
||||
>
|
||||
<i :class="[item.class, item.icon]" class="fa" @click="item.action()" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</span>
|
||||
<el-tooltip
|
||||
v-if="!isEdit"
|
||||
:content="currentValue"
|
||||
:disabled="!isShow"
|
||||
:open-delay="500"
|
||||
placement="top"
|
||||
>
|
||||
<pre class="text" style="cursor: pointer">{{ currentValue }}</pre>
|
||||
@@ -32,6 +16,21 @@
|
||||
size="small"
|
||||
@blur="onEditBlur"
|
||||
/>
|
||||
|
||||
<span v-if="realValue" class="action">
|
||||
<template v-for="(item, index) in iActions">
|
||||
<el-tooltip
|
||||
v-if="item.has"
|
||||
:key="index"
|
||||
:content="item.tooltip"
|
||||
effect="dark"
|
||||
open-delay="500"
|
||||
placement="top"
|
||||
>
|
||||
<i :class="[item.class, item.icon]" class="fa" @click="item.action()" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -40,7 +39,7 @@ import { copy, downloadText } from '@/utils/common'
|
||||
import BaseFormatter from '@/components/Table/TableFormatters/base.vue'
|
||||
|
||||
export default {
|
||||
name: 'SecretViewerFormatter',
|
||||
name: 'ShowKeyCopyFormatter',
|
||||
extends: BaseFormatter,
|
||||
props: {
|
||||
formatterArgsDefault: {
|
||||
@@ -52,9 +51,7 @@ export default {
|
||||
hasDownload: true,
|
||||
hasCopy: true,
|
||||
hasEdit: true,
|
||||
defaultShow: false,
|
||||
secretFrom: 'cellValue', // fromCellValue or api,
|
||||
actionLeft: false
|
||||
defaultShow: false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,8 +61,7 @@ export default {
|
||||
isEdit: false,
|
||||
realValue: this.cellValue,
|
||||
formatterArgs: Object.assign(this.formatterArgsDefault, this.col.formatterArgs || {}),
|
||||
isShow: false,
|
||||
getIt: false
|
||||
isShow: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -111,9 +107,6 @@ export default {
|
||||
tooltip: this.$t('Copy')
|
||||
}
|
||||
]
|
||||
if (this.formatterArgs.actionLeft) {
|
||||
actions.reverse()
|
||||
}
|
||||
return actions
|
||||
},
|
||||
currentValue() {
|
||||
@@ -124,45 +117,20 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
cellValue: {
|
||||
handler: function(val) {
|
||||
this.realValue = val
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.isShow = this.formatterArgs.defaultShow
|
||||
if (this.formatterArgs.secretFrom !== 'cellValue') {
|
||||
this.realValue = '--'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getAccountSecret() {
|
||||
if (this.formatterArgs.secretFrom === 'cellValue' || this.getIt) {
|
||||
return
|
||||
}
|
||||
const res = await this.$axios.get(`/api/v1/accounts/account-secrets/${this.row.id}/`)
|
||||
this.realValue = res.secret
|
||||
},
|
||||
async onShow() {
|
||||
await this.getAccountSecret()
|
||||
onShow() {
|
||||
this.isShow = !this.isShow
|
||||
setTimeout(() => {
|
||||
this.isShow = false
|
||||
}, 10000)
|
||||
},
|
||||
async onCopy() {
|
||||
await this.getAccountSecret()
|
||||
onCopy() {
|
||||
copy(this.realValue)
|
||||
},
|
||||
async onDownload() {
|
||||
await this.getAccountSecret()
|
||||
onDownload() {
|
||||
downloadText(this.realValue, this.name + '.txt')
|
||||
},
|
||||
async onEdit() {
|
||||
await this.getAccountSecret()
|
||||
onEdit() {
|
||||
this.isEdit = !this.isEdit
|
||||
if (this.isEdit) {
|
||||
this.$nextTick(() => {
|
||||
@@ -178,7 +146,7 @@ export default {
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
display: inline-block;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
//white-space: nowrap;
|
||||
@@ -187,7 +155,6 @@ export default {
|
||||
|
||||
.text {
|
||||
flex: 1;
|
||||
display: inline;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
@@ -196,17 +163,13 @@ export default {
|
||||
}
|
||||
|
||||
.action {
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
margin-left: 1px;
|
||||
display: inline;
|
||||
|
||||
&.right {
|
||||
float: right;
|
||||
}
|
||||
font-size: 15px;
|
||||
cursor: pointer;
|
||||
margin-left: 5px;
|
||||
|
||||
.fa {
|
||||
margin-right: 5px;
|
||||
margin-right: 10px;
|
||||
|
||||
&:hover {
|
||||
color: var(--color-primary);
|
||||
@@ -47,11 +47,6 @@ export default {
|
||||
return {
|
||||
formatterArgs: Object.assign(this.formatterArgsDefault, this.col.formatterArgs)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cellValueIsLabelChoice() {
|
||||
return typeof this.cellValue === 'object' && this.cellValue['value'] !== undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -6,7 +6,7 @@ import ActionsFormatter from './ActionsFormatter.vue'
|
||||
import DeleteActionFormatter from './DeleteActionFormatter.vue'
|
||||
import DateFormatter from './DateFormatter.vue'
|
||||
import AccountShowFormatter from './GrantedAccountShowFormatter.vue'
|
||||
import SecretViewerFormatter from './SecretViewerFormatter.vue'
|
||||
import ShowKeyCopyFormatter from './ShowKeyCopyFormatter.vue'
|
||||
import DialogDetailFormatter from './DialogDetailFormatter.vue'
|
||||
import EditableInputFormatter from './EditableInputFormatter.vue'
|
||||
import StatusFormatter from './StatusFormatter.vue'
|
||||
@@ -18,8 +18,6 @@ import ProtocolsFormatter from './ProtocolsFormatter.vue'
|
||||
import TagChoicesFormatter from './TagChoicesFormatter.vue'
|
||||
import SwitchFormatter from './SwitchFormatter.vue'
|
||||
import AccountInfoFormatter from './AccountInfoFormatter.vue'
|
||||
import PlatformFormatter from './PlatformFormatter.vue'
|
||||
import DiscoverConfirmFormatter from './DiscoverConfirmFormatter.vue'
|
||||
|
||||
export default {
|
||||
DetailFormatter,
|
||||
@@ -29,7 +27,7 @@ export default {
|
||||
DeleteActionFormatter,
|
||||
DateFormatter,
|
||||
AccountShowFormatter,
|
||||
SecretViewerFormatter,
|
||||
ShowKeyCopyFormatter,
|
||||
DialogDetailFormatter,
|
||||
ArrayFormatter,
|
||||
EditableInputFormatter,
|
||||
@@ -41,9 +39,7 @@ export default {
|
||||
TagChoicesFormatter,
|
||||
LabelsFormatter,
|
||||
SwitchFormatter,
|
||||
PlatformFormatter,
|
||||
AccountInfoFormatter,
|
||||
DiscoverConfirmFormatter
|
||||
AccountInfoFormatter
|
||||
}
|
||||
|
||||
export {
|
||||
@@ -54,7 +50,7 @@ export {
|
||||
DeleteActionFormatter,
|
||||
DateFormatter,
|
||||
AccountShowFormatter,
|
||||
SecretViewerFormatter,
|
||||
ShowKeyCopyFormatter,
|
||||
DialogDetailFormatter,
|
||||
ArrayFormatter,
|
||||
EditableInputFormatter,
|
||||
@@ -66,7 +62,5 @@ export {
|
||||
TagChoicesFormatter,
|
||||
LabelsFormatter,
|
||||
SwitchFormatter,
|
||||
PlatformFormatter,
|
||||
DiscoverConfirmFormatter,
|
||||
AccountInfoFormatter
|
||||
}
|
||||
|
||||
@@ -43,8 +43,6 @@
|
||||
:key="componentKey"
|
||||
ref="ListTable"
|
||||
:header-actions="headerActions"
|
||||
:quick-filters="quickFilters"
|
||||
:quick-summary="quickSummary"
|
||||
:table-config="iTableConfig"
|
||||
v-on="$listeners"
|
||||
/>
|
||||
@@ -169,7 +167,7 @@ $origin-color: #ffffff;
|
||||
justify-content: space-between;
|
||||
|
||||
.left {
|
||||
//height: 100%;
|
||||
height: 100%;
|
||||
background: $origin-color;
|
||||
color: var(--color-border);
|
||||
|
||||
@@ -245,7 +243,7 @@ $origin-color: #ffffff;
|
||||
text-align: center;
|
||||
padding: 5px 0;
|
||||
border: 1px solid #DCDFE6;
|
||||
background-color: #f3f3f3;
|
||||
background-color: #fff;
|
||||
border-radius: 2px;
|
||||
cursor: pointer;
|
||||
height: 30px;
|
||||
|
||||
@@ -1,22 +1,15 @@
|
||||
<template>
|
||||
<DataZTree ref="dataztree" :setting="treeSetting" class="data-z-tree" v-on="$listeners">
|
||||
<slot slot="rMenu">
|
||||
<div v-if="menu && menu.length > 0">
|
||||
<span v-for="item in menu" :key="item.id">
|
||||
<li
|
||||
v-if="hasMenuItem(item)"
|
||||
:id="item.id"
|
||||
:key="item.id"
|
||||
:class="{ 'disabled': checkDisabled(item) }"
|
||||
class="rmenu"
|
||||
tabindex="-1"
|
||||
@click="onMenuItemClick(item)"
|
||||
>
|
||||
<Icon :icon="item.icon" class="icon" /> {{ item.name }}
|
||||
<slot v-if="treeSetting.hasRightMenu" slot="rMenu">
|
||||
<li v-if="treeSetting.showCreate" id="m_create" class="rmenu" tabindex="-1" @click="createTreeNode">
|
||||
<i class="fa fa-plus-square-o" /> {{ this.$t('CreateNode') }}
|
||||
</li>
|
||||
<li v-if="treeSetting.showUpdate" id="m_edit" class="rmenu" tabindex="-1" @click="editTreeNode">
|
||||
<i class="fa fa-pencil-square-o" /> {{ this.$t('RenameNode') }}
|
||||
</li>
|
||||
<li v-if="treeSetting.showDelete" id="m_del" class="rmenu" tabindex="-1" @click="removeTreeNode">
|
||||
<i class="fa fa-minus-square" /> {{ this.$t('DeleteNode') }}
|
||||
</li>
|
||||
<li v-if="item.divided" class="divider" />
|
||||
</span>
|
||||
</div>
|
||||
<slot name="rMenu" />
|
||||
</slot>
|
||||
</DataZTree>
|
||||
@@ -24,15 +17,13 @@
|
||||
|
||||
<script>
|
||||
import DataZTree from '../DataZTree/index.vue'
|
||||
import Icon from '@/components/Widgets/Icon'
|
||||
import $ from '@/utils/jquery-vendor'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'AutoDataZTree',
|
||||
components: {
|
||||
DataZTree,
|
||||
Icon
|
||||
DataZTree
|
||||
},
|
||||
props: {
|
||||
setting: {
|
||||
@@ -43,32 +34,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
defaultMenu: [
|
||||
{
|
||||
id: 'm_create',
|
||||
name: this.$t('CreateNode'),
|
||||
icon: 'fa-plus-square-o',
|
||||
callback: this.createTreeNode,
|
||||
has: () => this.setting.showCreate
|
||||
},
|
||||
{
|
||||
id: 'm_edit',
|
||||
name: this.$t('RenameNode'),
|
||||
icon: 'fa-pencil-square-o',
|
||||
callback: this.editTreeNode,
|
||||
has: () => this.setting.showUpdate
|
||||
},
|
||||
{
|
||||
id: 'm_del',
|
||||
name: this.$t('DeleteNode'),
|
||||
icon: 'fa-minus-square',
|
||||
callback: this.removeTreeNode,
|
||||
has: () => this.setting.showDelete
|
||||
}
|
||||
],
|
||||
defaultSetting: {
|
||||
showDefaultMenu: true,
|
||||
showMenu: false,
|
||||
showCreate: true,
|
||||
showDelete: true,
|
||||
showUpdate: true,
|
||||
@@ -114,49 +80,12 @@ export default {
|
||||
},
|
||||
rMenu() {
|
||||
return this.$refs.dataztree.rMenu
|
||||
},
|
||||
menu() {
|
||||
let menu = []
|
||||
if (this.setting.showDefaultMenu) {
|
||||
menu = menu.concat(this.defaultMenu)
|
||||
}
|
||||
if (this.setting.menu && this.setting.menu.length > 0) {
|
||||
menu = menu.concat(this.setting.menu)
|
||||
}
|
||||
return menu
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
$('body').unbind('mousedown')
|
||||
},
|
||||
methods: {
|
||||
checkDisabled(item) {
|
||||
let disabled = item.disabled
|
||||
if (typeof disabled === 'function') {
|
||||
disabled = disabled(this.currentNode)
|
||||
}
|
||||
if (typeof disabled === 'undefined') {
|
||||
disabled = false
|
||||
}
|
||||
return disabled
|
||||
},
|
||||
hasMenu(node) {
|
||||
return false
|
||||
},
|
||||
hasMenuItem(item) {
|
||||
let has = item.has
|
||||
if (typeof has === 'function') {
|
||||
has = has(this.currentNode)
|
||||
}
|
||||
if (typeof has === 'undefined') {
|
||||
has = true
|
||||
}
|
||||
return has
|
||||
},
|
||||
onMenuItemClick(item) {
|
||||
item.callback(this.currentNode)
|
||||
this.hideRMenu()
|
||||
},
|
||||
onAsyncSuccess(event, treeId, treeNode, msg) {
|
||||
const nodes = JSON.parse(msg)
|
||||
nodes.forEach((node) => {
|
||||
@@ -186,7 +115,7 @@ export default {
|
||||
if (this.rMenu) this.rMenu.css({ 'visibility': 'hidden' })
|
||||
$('body').unbind('mousedown', this.onBodyMouseDown)
|
||||
},
|
||||
// Request URL: http://localhost/api/v1/assets/assets/?node_id=ID&show_current_asset=null&draw=2&limit=15&offset=0&_=1587022917769
|
||||
// Request URL: http://localhost/api/v1/assets/assets/?node_id=d8212328-538d-41a6-bcfd-1e8cc7e3aed4&show_current_asset=null&draw=2&limit=15&offset=0&_=1587022917769
|
||||
onSelected: function(event, treeNode) {
|
||||
const show_current_asset = this.$cookie.get('show_current_asset') || '0'
|
||||
if (!this.setting.url) {
|
||||
@@ -262,8 +191,6 @@ export default {
|
||||
const offset = $(`#${zTreeID}`).offset()
|
||||
const scrollTop = document.querySelector('.treebox')?.scrollTop
|
||||
x -= offset.left
|
||||
x = x < 0 ? 0 : x
|
||||
|
||||
// Tmp
|
||||
y -= (offset.top + scrollTop) / 3 - 10
|
||||
x += document.body.scrollLeft
|
||||
@@ -272,22 +199,15 @@ export default {
|
||||
if (y + $(`#${rMenuID} ul`).height() >= window.innerHeight) {
|
||||
y -= $(`#${rMenuID} ul`).height()
|
||||
}
|
||||
y = y < 0 ? 0 : y
|
||||
|
||||
this.rMenu.css({ 'top': y + 'px', 'left': x + 'px', 'visibility': 'visible' })
|
||||
$(`#${rMenuID} ul`).show()
|
||||
$('body').bind('mousedown', this.onBodyMouseDown)
|
||||
},
|
||||
onRightClick: function(event, treeId, treeNode) {
|
||||
let showMenu = this.setting.showMenu
|
||||
if (typeof showMenu === 'function') {
|
||||
showMenu = showMenu(treeNode)
|
||||
}
|
||||
if (!showMenu) {
|
||||
if (!this.setting.showMenu) {
|
||||
return
|
||||
}
|
||||
this.currentNode = treeNode
|
||||
this.currentNodeId = treeNode.meta.data.id
|
||||
// 屏蔽收藏资产
|
||||
if (treeNode?.id === '-12') {
|
||||
return
|
||||
@@ -401,14 +321,9 @@ export default {
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 15px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.data-z-tree {
|
||||
::v-deep {
|
||||
.icon {
|
||||
.fa {
|
||||
width: 10px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
<a id="tree-refresh"><i class="fa fa-refresh" /></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div :id="iRMenuID" class="rMenu">
|
||||
<ul class="dropdown-menu menu-actions">
|
||||
<slot name="rMenu" />
|
||||
@@ -50,7 +49,8 @@ import axiosRetry from 'axios-retry'
|
||||
|
||||
const defaultObject = {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
default: () => {
|
||||
}
|
||||
}
|
||||
export default {
|
||||
name: 'ZTree',
|
||||
@@ -90,12 +90,6 @@ export default {
|
||||
window.removeEventListener('resize', this.updateTreeHeight)
|
||||
},
|
||||
methods: {
|
||||
onMenuClick(menu) {
|
||||
if (menu.disabled) {
|
||||
return
|
||||
}
|
||||
menu.callback()
|
||||
},
|
||||
updateTreeHeight: _.debounce(function() {
|
||||
const tree = document.getElementById(this.iZTreeID)
|
||||
if (!tree) {
|
||||
@@ -112,8 +106,8 @@ export default {
|
||||
}
|
||||
}
|
||||
// 使用 table 的高度
|
||||
const zTreeRect = tree.getBoundingClientRect()
|
||||
tree.style.height = `calc(100vh - ${zTreeRect.top}px - 30px - 25px)`
|
||||
const ztreeRect = tree.getBoundingClientRect()
|
||||
tree.style.height = `calc(100vh - ${ztreeRect.top}px - 30px - 25px)`
|
||||
}, 100),
|
||||
async initTree(refresh = false) {
|
||||
const vm = this
|
||||
@@ -162,6 +156,9 @@ export default {
|
||||
if (this.treeSetting.showMenu) {
|
||||
this.rMenu = $(`#${this.iRMenuID}`)
|
||||
}
|
||||
if (this.treeSetting?.otherMenu) {
|
||||
$('.menu-actions').append(this.otherMenu)
|
||||
}
|
||||
},
|
||||
onSearch() {
|
||||
this.showTreeSearch = !this.showTreeSearch
|
||||
@@ -438,24 +435,6 @@ div.rMenu li {
|
||||
list-style: none outside none;
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
font-size: 12px;
|
||||
padding: 0 16px;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: #606266;
|
||||
height: 24px;
|
||||
line-height: 24px;
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
|
||||
i {
|
||||
width: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
border: medium none;
|
||||
min-width: 160px;
|
||||
@@ -472,8 +451,7 @@ div.rMenu li {
|
||||
text-shadow: none;
|
||||
top: 100%;
|
||||
z-index: 1000;
|
||||
max-height: 320px;
|
||||
min-height: 150px;
|
||||
height: 300px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ export default {
|
||||
showRenameBtn: false,
|
||||
drag: {
|
||||
isCopy: false,
|
||||
isMove: !this.$store.getters.currentOrgIsRoot
|
||||
isMove: true
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
|
||||
@@ -35,29 +35,13 @@ export default {
|
||||
]),
|
||||
announcement() {
|
||||
const ann = this.publicSettings.ANNOUNCEMENT
|
||||
return {
|
||||
id: ann['ID'],
|
||||
subject: ann['SUBJECT'],
|
||||
content: ann['CONTENT'],
|
||||
link: ann['LINK'],
|
||||
date_start: ann['DATE_START'],
|
||||
date_end: ann['DATE_END']
|
||||
}
|
||||
return { id: ann['ID'], subject: ann['SUBJECT'], content: ann['CONTENT'], link: ann['LINK'] }
|
||||
},
|
||||
enabled() {
|
||||
return this.publicSettings.ANNOUNCEMENT_ENABLED && (this.announcement.content || this.announcement.subject) && this.isDateValid
|
||||
return this.publicSettings.ANNOUNCEMENT_ENABLED && (this.announcement.content || this.announcement.subject)
|
||||
},
|
||||
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,29 +4,28 @@
|
||||
<div class="action-bar">
|
||||
<div class="action">
|
||||
<span>
|
||||
<i class="fa" :class="[!isShow ? 'fa-eye' : 'fa-eye-slash']" @click="onView" />
|
||||
<i :class="[!isShow ? 'fa-eye' : 'fa-eye-slash']" class="fa" @click="onView" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-col :span="span" :style="{'height': height + 'px' }">
|
||||
<el-input
|
||||
v-model="iValue"
|
||||
autosize
|
||||
:rows="rows"
|
||||
autosize
|
||||
type="textarea"
|
||||
@change="onChange"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col v-show="isShow" :span="span">
|
||||
<VueMarkdown class="result-html" :source="sanitizedValue" :html="false" :show="true" />
|
||||
<VueMarkdown :html="false" :show="true" :source="iValue" class="result-html" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<VueMarkdown v-else class="source" :html="false" :source="sanitizedValue" />
|
||||
<VueMarkdown v-else :html="false" :source="iValue" class="source" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DOMPurify from 'dompurify'
|
||||
import VueMarkdown from 'vue-markdown'
|
||||
|
||||
export default {
|
||||
@@ -56,17 +55,6 @@ 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 => {
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import i18n from '@/i18n/i18n'
|
||||
import CronTab from '@/components/Form/FormFields/CronTab/index.vue'
|
||||
import InputWithUnit from '@/components/Form/FormFields/InputWithUnit.vue'
|
||||
import store from '@/store'
|
||||
|
||||
export const strMatchValues = ['exact', 'not', 'in', 'contains', 'startswith', 'endswith', 'regex']
|
||||
export const typeMatchMapper = {
|
||||
@@ -29,49 +26,3 @@ export const attrMatchOptions = [
|
||||
{ label: i18n.t('GreatEqualThan'), value: 'gte' },
|
||||
{ label: i18n.t('LessEqualThan'), value: 'lte' }
|
||||
]
|
||||
|
||||
export const crontab = {
|
||||
type: 'cronTab',
|
||||
component: CronTab,
|
||||
label: i18n.t('Crontab'),
|
||||
hidden: (formValue) => {
|
||||
return formValue.is_periodic === false
|
||||
},
|
||||
helpText: i18n.t('CrontabHelpText'),
|
||||
helpTip: i18n.t('CrontabHelpTip')
|
||||
}
|
||||
|
||||
const validatorInterval = (rule, value, callback) => {
|
||||
if (parseInt(value) < 1) {
|
||||
return callback(new Error(i18n.t('EnsureThisValueIsGreaterThanOrEqualTo1')))
|
||||
}
|
||||
callback()
|
||||
}
|
||||
|
||||
export const interval = {
|
||||
label: i18n.t('Interval'),
|
||||
hidden: (formValue) => {
|
||||
return formValue.is_periodic === false
|
||||
},
|
||||
component: InputWithUnit,
|
||||
el: {
|
||||
unit: 'hour'
|
||||
},
|
||||
rules: [
|
||||
{ validator: validatorInterval }
|
||||
]
|
||||
}
|
||||
|
||||
export const is_periodic = {
|
||||
type: 'checkbox',
|
||||
hidden: (formValue) => {
|
||||
return !store.getters.hasValidLicense
|
||||
}
|
||||
}
|
||||
|
||||
export const periodicMeta = {
|
||||
is_periodic,
|
||||
interval,
|
||||
crontab
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ export { default as AccountListTable } from './Apps/AccountListTable/AccountList
|
||||
export { default as AssetRelationCard } from './Apps/AssetRelationCard'
|
||||
export { default as UserConfirmDialog } from './Apps/UserConfirmDialog'
|
||||
export { default as Announcement } from './Widgets/Announcement'
|
||||
export { default as CronTab } from './Form/FormFields/CronTab'
|
||||
export { default as CronTab } from './Form/CronTab'
|
||||
export { default as Pagination } from './Table/Pagination'
|
||||
export { default as Tooltip } from './Widgets/Tooltip'
|
||||
export { default as ResourceActivity } from './Apps/ResourceActivity'
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="138px" height="134px" viewBox="0 0 138 134" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>activity</title>
|
||||
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="activity" fill="#3E3A39" fill-rule="nonzero">
|
||||
<path d="M125.454545,123.012 C125.454545,123.30102 125.310273,123.469176 125.435727,123.484941 L12.7900909,123.553255 C12.7399091,123.521725 12.5454545,123.332549 12.5454545,123.012 L12.5454545,44.6614118 L125.454545,44.6614118 L125.454545,123.012 Z M12.5454545,18.865098 C12.5454545,18.5813333 12.6709091,18.4131765 12.5642727,18.386902 L37.6363636,18.386902 L37.6363636,21.0196078 C37.6363636,23.9218101 40.4447593,26.2745098 43.9090909,26.2745098 C47.3734225,26.2745098 50.1818182,23.9218101 50.1818182,21.0196078 L50.1818182,18.3921569 L87.8181818,18.3921569 L87.8181818,21.0196078 C87.8181818,23.9218101 90.6265775,26.2745098 94.0909091,26.2745098 C97.5552407,26.2745098 100.363636,23.9218101 100.363636,21.0196078 L100.363636,18.3921569 L125.260091,18.3921569 C125.385308,18.5275639 125.454545,18.6938135 125.454545,18.865098 L125.454545,34.1568627 L12.5454545,34.1568627 L12.5454545,18.865098 Z M125.423182,7.88235294 L100.363636,7.88235294 L100.363636,5.25490196 C100.363636,2.35269975 97.5552407,0 94.0909091,0 C90.6265775,0 87.8181818,2.35269975 87.8181818,5.25490196 L87.8181818,7.88235294 L50.1818182,7.88235294 L50.1818182,5.25490196 C50.1818182,2.35269975 47.3734225,0 43.9090909,0 C40.4447593,0 37.6363636,2.35269975 37.6363636,5.25490196 L37.6363636,7.88235294 L12.489,7.88235294 C5.60154545,7.88235294 0,12.811451 0,18.865098 L0,123.017255 C0,129.076157 5.60781818,134 12.4952727,134 L125.504727,134 C132.392182,134 138,129.076157 138,123.017255 L138,18.865098 C138,12.8061961 132.360818,7.87709804 125.423182,7.87709804 L125.423182,7.88235294 Z" id="形状"></path>
|
||||
<path d="M44.3,76.5714286 L94.7,76.5714286 C98.1793939,76.5714286 101,74.2049337 101,71.2857143 C101,68.3664949 98.1793939,66 94.7,66 L44.3,66 C40.8206061,66 38,68.3664949 38,71.2857143 C38,74.2049337 40.8206061,76.5714286 44.3,76.5714286 M44.3,103 L94.7,103 C98.1793939,103 101,100.633505 101,97.7142857 C101,94.7950663 98.1793939,92.4285714 94.7,92.4285714 L44.3,92.4285714 C40.8206061,92.4285714 38,94.7950663 38,97.7142857 C38,100.633505 40.8206061,103 44.3,103" id="形状"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.4 KiB |
@@ -1,7 +0,0 @@
|
||||
<svg t="1730795663037" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
p-id="53312" width="200" height="200">
|
||||
<path d="M81.4592 150.4768c-44.544 0-80.6912 35.0208-80.6912 78.2848v712.704c0 43.2128 36.1472 78.2848 80.6912 78.2848h686.6432c44.5952 0 80.7424-35.072 80.7424-78.336v-71.8848h90.3168c44.544 0 80.6912-35.0208 80.6912-78.2848V78.5408c0-43.2128-36.1472-78.2848-80.6912-78.2848H252.416c-44.544 0-80.6912 35.072-80.6912 78.336v71.8848H81.4592zM848.896 800.3584V228.7616c0-43.264-36.1472-78.336-80.7424-78.336H243.0976V69.2736h710.144v731.136h-104.448zM72.0896 941.4656V219.648h705.4336v731.136H72.0896v-9.3184z"
|
||||
fill="#333333" p-id="53313"></path>
|
||||
<path d="M215.1936 716.8a35.1232 35.1232 0 0 0-35.6352 34.6112c0 19.1488 15.9232 34.6112 35.6352 34.6112h203.3664a35.1232 35.1232 0 0 0 35.6864-34.6112 35.1232 35.1232 0 0 0-35.6864-34.56H215.1936z m0-186.9824a35.1232 35.1232 0 0 0-35.6352 34.56c0 19.0976 15.9232 34.6112 35.6352 34.6112h389.4272a35.1232 35.1232 0 0 0 35.6352-34.6112 35.1232 35.1232 0 0 0-35.6352-34.56H215.1936z m0-180.224a35.1232 35.1232 0 0 0-35.6352 34.56c0 19.1488 15.9232 34.6112 35.6352 34.6112h389.4272a35.1232 35.1232 0 0 0 35.6352-34.6112 35.1232 35.1232 0 0 0-35.6352-34.56H215.1936z"
|
||||
fill="#333333" p-id="53314"></path>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1,10 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="162px" height="176px" viewBox="0 0 162 176" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>编组</title>
|
||||
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="编组" fill="#2C2C2C" fill-rule="nonzero">
|
||||
<path d="M145.273438,109.375 C142.304688,109.375 139.882812,111.796875 139.882812,114.765625 L139.882812,164.316406 L10.78125,164.316406 L10.78125,87.3046875 L91.1132813,87.3046875 C94.0820313,87.3046875 96.5039063,84.8828125 96.5039063,81.9140625 C96.5039063,78.9453125 94.0820313,76.5234375 91.1132813,76.5234375 L31.25,76.5234375 L31.25,50.4296875 C31.25,28.5742188 49.0234375,10.8007813 70.8984375,10.8007813 L78.90625,10.8007813 C100.761719,10.8007813 118.535156,28.5742188 118.535156,50.4296875 L118.535156,54.609375 L118.554688,54.609375 C118.730469,57.421875 121.074219,59.6484375 123.925781,59.6484375 C126.894531,59.6484375 129.316406,57.2460938 129.316406,54.2578125 C129.316406,54.1210938 129.316406,53.984375 129.296875,53.8476563 L129.296875,50.4101563 C129.296875,22.6757813 106.621094,0 78.8867188,0 L70.8789063,0 C43.1445313,0 20.46875,22.6757813 20.46875,50.4101563 L20.46875,76.5039063 L5.390625,76.5039063 C2.421875,76.5039063 0,78.9257812 0,81.8945313 L0,170 C0,172.96875 2.421875,175.390625 5.390625,175.390625 C6.03515625,175.390625 6.66015625,175.273438 7.24609375,175.058594 L143.417969,175.058594 C144.003906,175.273438 144.609375,175.390625 145.273438,175.390625 C148.242188,175.390625 150.664063,172.96875 150.664063,170 L150.664063,114.746094 C150.644531,111.796875 148.222656,109.375 145.273438,109.375 Z" id="路径"></path>
|
||||
<path d="M159.648438,56.9335938 C157.558594,54.84375 154.121094,54.84375 152.03125,56.9335938 L76.8945312,132.050781 C74.8046875,134.140625 74.8046875,137.578125 76.8945312,139.667969 C78.984375,141.757813 82.421875,141.757813 84.5117188,139.667969 L159.628906,64.5507813 C161.738281,62.4414063 161.738281,59.0234375 159.648438,56.9335938 Z" id="路径"></path>
|
||||
</g>
|
||||
</g>
|
||||
<svg width="40px" height="44px" viewBox="0 0 40 44" version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path d="M30.2706254,38.229976 C30.2706254,39.3606857 29.7535516,39.817019 28.4764414,39.817019 L5.16450885,39.817019 C3.87961144,39.817019 3.36253758,39.3606857 3.36253758,38.229976 L3.36253758,25.2564058 C3.36253758,24.1256961 3.88116889,23.6678054 5.16450885,23.6678054 L26.9080879,23.6678054 L26.9080879,20.3052678 L3.6179596,20.3052678 C1.39859136,20.3052678 0,21.7038592 0,23.9232274 L0,39.5600395 C0,41.7794077 1.39859136,43.1779991 3.6179596,43.1779991 L30.0229907,43.1779991 C32.2330142,43.1779991 33.6316056,41.7794077 33.6316056,39.5600395 L33.6316056,29.0488 L30.269068,29.0488 L30.269068,38.229976 L30.2706254,38.229976 Z"
|
||||
id="路径"></path>
|
||||
<path d="M15.4763873,27.703162 C15.4755615,27.5244652 15.54618,27.3528466 15.6725391,27.2264875 C15.7988982,27.1001284 15.9705168,27.0295099 16.1492136,27.0303357 L17.4948516,27.0303357 C17.8639676,27.0303357 18.1676706,27.3324885 18.1676706,27.703162 L18.1676706,35.7816624 C18.1668142,36.1528948 17.866084,36.453625 17.4948516,36.4544887 L16.1492136,36.4544887 C15.9705168,36.4553145 15.7988982,36.384696 15.6725391,36.2583369 C15.54618,36.1319778 15.4755615,35.9603592 15.4763873,35.7816624 L15.4763873,27.703162 L15.4763873,27.703162 Z M39.5047548,15.4429045 C39.1907428,15.1267586 38.7635683,14.9489692 38.3179768,14.9489692 C37.8723853,14.9489692 37.4452109,15.1267586 37.1311989,15.4429045 L22.3821341,30.1919693 C21.9578609,30.6170771 21.7926087,31.2362399 21.9486262,31.8162251 C22.1046438,32.3962103 22.5582284,32.8489044 23.1385191,33.0037818 C23.7188098,33.1586592 24.3376467,32.9921905 24.7619198,32.5670827 L39.5047548,17.8242477 C39.8217544,17.5091076 40,17.0805683 40,16.6335761 C40,16.1865839 39.8217544,15.7580447 39.5047548,15.4429045 L39.5047548,15.4429045 Z M10.0876127,20.3068253 L10.0876127,10.6973501 C10.0876127,6.72273414 13.107511,3.48790758 16.8204751,3.48790758 C20.5334393,3.48790758 23.5455503,6.72273414 23.5455503,10.6973501 L23.5455503,16.2730261 L26.9080879,16.2730261 L26.9080879,10.2176551 C26.9532494,6.58243177 25.0397574,3.20385387 21.8988728,1.37308023 C18.7579882,-0.45769341 14.8751748,-0.45769341 11.7342902,1.37308023 C8.59340562,3.20385387 6.67991361,6.58243177 6.72507515,10.2176551 L6.72507515,23.6678054 L26.9080879,23.6678054 L26.9080879,20.3052678 L10.0876127,20.3052678 L10.0876127,20.3068253 Z"
|
||||
id="形状"></path>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.4 KiB |
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="175px" height="172px" viewBox="0 0 175 172" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>编组</title>
|
||||
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="编组" fill="#000000" fill-rule="nonzero">
|
||||
<path d="M173.785375,165.454861 L123.361962,115.009064 C137.448412,98.2738101 143.521494,75.2018529 137.651474,52.4540759 C128.018006,15.1217873 89.8109099,-7.40014283 52.4770224,2.22233315 C34.3936829,6.89116772 19.2091781,18.3220175 9.72181048,34.4071119 C0.234442898,50.4958037 -2.41955769,69.3134455 2.24727825,87.3967849 C6.91431399,105.480124 18.3433652,120.666428 34.432057,130.153995 C45.3350648,136.583636 57.4928218,139.875204 69.8298572,139.875204 C75.6914829,139.875204 81.5950804,139.12991 87.4219298,137.628528 C99.4151984,134.532427 109.877505,128.483928 118.240035,120.466763 L168.495562,170.744875 C169.224268,171.475579 170.183418,171.840932 171.140568,171.840932 C172.097719,171.840932 173.054871,171.475579 173.785575,170.744875 C175.246584,169.283466 175.246584,166.916271 173.785375,165.454861 Z M85.551198,130.380442 C69.402147,134.552413 52.5955419,132.177823 38.2312808,123.705967 C23.865021,115.234111 13.6597404,101.677103 9.49156634,85.5262533 C5.32319251,69.3790011 7.69418489,52.5743947 16.1660409,38.2099337 C24.6396958,23.8418753 38.1985029,13.6347956 54.3475538,9.47021928 C59.5606195,8.12213334 64.7902738,7.47916928 69.9393825,7.47916928 C97.7275421,7.47916928 123.148307,26.2018753 130.407185,54.3242083 C135.890068,75.5734013 129.699865,97.1395794 115.85805,112.213559 C115.752321,112.298502 115.649591,112.388841 115.551457,112.486774 C115.398161,112.64007 115.264852,112.804958 115.143734,112.976043 C107.36301,121.170886 97.2760486,127.355893 85.551198,130.380442 Z" id="形状"></path>
|
||||
<path d="M91.6046937,27.1300456 C86.1485929,23.9152253 79.7609238,23.0164347 73.6272824,24.5947646 C71.6270386,25.1136128 70.4234546,27.1520308 70.940304,29.1538736 C71.4553548,31.1559162 73.492174,32.3505062 75.4976142,31.8426505 C84.1721329,29.6031689 93.0403202,34.8382195 95.2798019,43.5073419 C95.7145072,45.1951976 97.2342767,46.3130396 98.9001472,46.3130396 C99.2089378,46.3130396 99.5229249,46.2764644 99.8371118,46.1925212 C101.837156,45.6774705 103.04094,43.6388527 102.52409,41.6370099 C100.940364,35.5031687 97.0625933,30.3484636 91.6046937,27.1300456 Z" id="路径"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.5 KiB |
@@ -1,5 +0,0 @@
|
||||
<svg t="1730113499097" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1649"
|
||||
width="200" height="200">
|
||||
<path d="M512 0C229.234286 0 0 229.234286 0 512s229.234286 512 512 512 512-229.234286 512-512S794.765714 0 512 0zM109.714286 512a400.514286 400.514286 0 0 1 81.68-243.017143l563.622857 563.622857A400.514286 400.514286 0 0 1 512 914.285714C289.828571 914.285714 109.714286 734.171429 109.714286 512z m722.891428 243.017143L268.982857 191.394286A400.514286 400.514286 0 0 1 512 109.714286c222.171429 0 402.285714 180.114286 402.285714 402.285714a400.514286 400.514286 0 0 1-81.68 243.017143z"
|
||||
p-id="1650"></path>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 684 B |
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="40px" height="48px" viewBox="0 0 40 48" version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path d="M36.0001406,20.0002344 L36.0001406,16.000375 C36.0001406,7.17752804 28.8226126,0 20.0002344,0 C11.1778562,0 4.00032813,7.17752804 4.00032813,15.9999062 L4.00032813,19.9997656 L0,19.9997656 L0,48.0001875 L40,48.0001875 L40,20.0002344 L36.0001406,20.0002344 Z M8.0001875,15.9999062 C8.0001875,9.3830054 13.3833335,3.99985937 20.0002344,3.99985937 C26.6171352,3.99985937 32.0002813,9.3830054 32.0002813,15.9999062 L32.0002813,19.9997656 L8.0001875,19.9997656 L8.0001875,15.9999062 Z M36.0006094,44.0003281 L4.00032813,44.0003281 L4.00032813,24.0000938 L36.0006094,24.0000938 L36.0006094,44.0003281 Z"
|
||||
id="形状"></path>
|
||||
<path d="M20.0002344,40 C22.2094618,40 24.0000938,38.2088993 24.0000938,36.0001406 C24.0000938,34.5231036 23.1905593,33.2476299 21.9999297,32.5548147 L21.9999297,27.9999531 L18.0000703,27.9999531 L18.0000703,32.5548147 C16.8094407,33.2476299 15.9999062,34.5231036 15.9999062,36.0001406 C16.000375,38.209368 17.791007,40 20.0002344,40 L20.0002344,40 Z"
|
||||
id="路径"></path>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |