Skip to content

Commit 68030d9

Browse files
authored
Merge pull request #4890 from jumpserver/dev
v4.8.0
2 parents a861f77 + 9cbdfac commit 68030d9

File tree

507 files changed

+16601
-6457
lines changed

Some content is hidden

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

507 files changed

+16601
-6457
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ tests/**/coverage/
1717
*.sln
1818
.env.development
1919
.python-version
20+
21+
helper.json

jsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"@/*": ["src/*"]
66
}
77
},
8+
"include": ["src"],
89
"exclude": ["node_modules", "dist"]
910
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
"@vue/cli-plugin-unit-jest": "3.6.3",
9595
"@vue/cli-service": "3.6.0",
9696
"@vue/test-utils": "1.0.0-beta.29",
97+
"@vue/runtime-dom": "3.5.13",
9798
"autoprefixer": "^9.5.1",
9899
"babel-core": "7.0.0-bridge.0",
99100
"babel-eslint": "10.0.1",
@@ -120,7 +121,7 @@
120121
"serve-static": "^1.16.0",
121122
"strip-ansi": "^7.1.0",
122123
"svg-sprite-loader": "4.1.3",
123-
"svgo": "1.2.2",
124+
"svgo": "1.2.4",
124125
"vue-i18n-extract": "^1.1.1",
125126
"vue-template-compiler": "2.6.10"
126127
},

public/index.html

Lines changed: 76 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,90 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
3+
<head>
44
<meta charset="utf-8">
5-
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6-
<meta http-equiv="Expires" content="0">
7-
<meta http-equiv="Pragma" content="no-cache">
8-
<meta http-equiv="Cache-control" content="no-cache">
9-
<meta http-equiv="Cache" content="no-cache">
10-
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
5+
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
6+
<meta content="0" http-equiv="Expires">
7+
<meta content="no-cache" http-equiv="Pragma">
8+
<meta content="no-cache" http-equiv="Cache-control">
9+
<meta content="no-cache" http-equiv="Cache">
10+
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
1111
<title><%= webpackConfig.name %></title>
12-
<link rel="stylesheet" href="<%= BASE_URL %>theme/element-ui.css">
13-
</head>
14-
<body>
15-
<noscript>
16-
<strong>We're sorry but <%= webpackConfig.name %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
17-
</noscript>
18-
<script>
19-
window.onload = function() {
12+
<link href="<%= BASE_URL %>theme/element-ui.css" rel="stylesheet">
13+
<style>
14+
#loading {
15+
position: fixed;
16+
top: 0;
17+
left: 0;
18+
width: 100vw;
19+
height: 100vh;
20+
display: flex;
21+
justify-content: center;
22+
align-items: center;
23+
background-color: rgba(255, 255, 255, 0.98);
24+
z-index: 9999;
25+
}
26+
27+
#loading .spinner {
28+
width: 40px;
29+
height: 40px;
30+
border: 3px solid transparent;
31+
border-top-color: var(--color-primary);
32+
border-radius: 50%;
33+
animation: spin 1s linear infinite;
34+
}
35+
36+
#loading .spinner::after {
37+
content: '';
38+
position: absolute;
39+
top: -3px;
40+
left: -3px;
41+
width: 40px;
42+
height: 40px;
43+
border: 3px solid transparent;
44+
border-top-color: rgba(64, 158, 255, 0.2);
45+
border-radius: 50%;
46+
animation: spin 2s linear infinite;
47+
}
48+
49+
@keyframes spin {
50+
0% {
51+
transform: rotate(0deg);
52+
}
53+
100% {
54+
transform: rotate(360deg);
55+
}
56+
}
57+
</style>
58+
</head>
59+
<body>
60+
<noscript>
61+
<strong>
62+
We're sorry but <%= webpackConfig.name %> doesn't work properly without JavaScript enabled.
63+
Please enable it to continue.
64+
</strong>
65+
</noscript>
66+
<script>
67+
window.onload = function () {
2068
if (location.pathname === '/') {
21-
location.pathname = '/ui/'
69+
location.pathname = '/ui/'
2270
}
2371
const pathname = window.location.pathname
2472
if (pathname.startsWith('/core')) {
2573
return
2674
}
27-
if(pathname.indexOf('/ui') === -1) {
28-
window.location.href = window.location.origin + '/ui/#' + pathname
75+
if (pathname.indexOf('/ui') === -1) {
76+
window.location.href = window.location.origin + '/ui/#' + pathname
2977
}
3078
if (pathname.startsWith('/ui/#/chat')) {
31-
window.location.href = window.location.origin + pathname
79+
window.location.href = window.location.origin + pathname
3280
}
33-
}
34-
</script>
35-
<div id="app"></div>
36-
<!-- built files will be auto injected -->
37-
</body>
81+
}
82+
</script>
83+
<div id="app">
84+
</div>
85+
<div id="loading">
86+
<div class="spinner"></div>
87+
</div>
88+
<!-- built files will be auto injected -->
89+
</body>
3890
</html>

src/components/Apps/AccountCreateUpdateForm/const.js

Lines changed: 85 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import AutomationParamsForm from '@/views/assets/Platform/AutomationParamsSettin
55

66
export const accountFieldsMeta = (vm) => {
77
const defaultPrivilegedAccounts = ['root', 'administrator']
8+
89
return {
910
assets: {
1011
component: Select2,
@@ -27,6 +28,9 @@ export const accountFieldsMeta = (vm) => {
2728
component: Select2,
2829
rules: [Required],
2930
el: {
31+
get disabled() {
32+
return vm.isDisabled
33+
},
3034
multiple: false,
3135
ajax: {
3236
url: '/api/v1/accounts/account-templates/',
@@ -43,13 +47,23 @@ export const accountFieldsMeta = (vm) => {
4347
rules: [Required],
4448
label: vm.$t('AccountPolicy'),
4549
helpTip: vm.$t('AccountPolicyHelpText'),
50+
el: {
51+
get disabled() {
52+
return vm.isDisabled
53+
}
54+
},
4655
hidden: () => {
4756
return vm.platform || vm.asset
4857
}
4958
},
5059
name: {
5160
label: vm.$t('Name'),
5261
rules: [RequiredChange],
62+
el: {
63+
get disabled() {
64+
return vm.isDisabled
65+
}
66+
},
5367
on: {
5468
input: ([value], updateForm) => {
5569
if (!vm.usernameChanged) {
@@ -69,7 +83,9 @@ export const accountFieldsMeta = (vm) => {
6983
},
7084
username: {
7185
el: {
72-
disabled: !!vm.account?.name
86+
get disabled() {
87+
return !!vm.account?.name || vm.isDisabled
88+
}
7389
},
7490
on: {
7591
input: ([value], updateForm) => {
@@ -88,6 +104,11 @@ export const accountFieldsMeta = (vm) => {
88104
},
89105
privileged: {
90106
label: vm.$t('Privileged'),
107+
el: {
108+
get disabled() {
109+
return vm.isDisabled
110+
}
111+
},
91112
hidden: () => {
92113
return vm.addTemplate
93114
}
@@ -110,47 +131,87 @@ export const accountFieldsMeta = (vm) => {
110131
},
111132
su_from_username: {
112133
label: vm.$t('UserSwitchFrom'),
134+
el: {
135+
get disabled() {
136+
return vm.isDisabled
137+
}
138+
},
113139
hidden: (formValue) => {
114140
return vm.platform || vm.asset || vm.addTemplate
115141
}
116142
},
117143
password: {
118144
label: vm.$t('Password'),
119145
component: UpdateToken,
146+
el: {
147+
get disabled() {
148+
return vm.isDisabled
149+
}
150+
},
120151
hidden: (formValue) => {
121152
return formValue.secret_type !== 'password' || vm.addTemplate
122153
}
123154
},
124155
ssh_key: {
125156
label: vm.$t('PrivateKey'),
126157
component: UploadSecret,
158+
el: {
159+
get disabled() {
160+
return vm.isDisabled
161+
}
162+
},
127163
hidden: (formValue) => formValue.secret_type !== 'ssh_key' || vm.addTemplate
128164
},
129165
passphrase: {
130166
label: vm.$t('Passphrase'),
131167
component: UpdateToken,
168+
el: {
169+
get disabled() {
170+
return vm.isDisabled
171+
}
172+
},
132173
hidden: (formValue) => formValue.secret_type !== 'ssh_key' || vm.addTemplate
133174
},
134175
token: {
135176
label: vm.$t('Token'),
136177
component: UploadSecret,
178+
el: {
179+
get disabled() {
180+
return vm.isDisabled
181+
}
182+
},
137183
hidden: (formValue) => formValue.secret_type !== 'token' || vm.addTemplate
138184
},
139185
access_key: {
140186
id: 'access_key',
141187
label: vm.$t('AccessKey'),
142188
component: UploadSecret,
189+
el: {
190+
get disabled() {
191+
return vm.isDisabled
192+
}
193+
},
143194
hidden: (formValue) => formValue.secret_type !== 'access_key' || vm.addTemplate
144195
},
145196
api_key: {
146197
id: 'api_key',
147198
label: vm.$t('ApiKey'),
148199
component: UploadSecret,
200+
el: {
201+
get disabled() {
202+
return vm.isDisabled
203+
}
204+
},
149205
hidden: (formValue) => formValue.secret_type !== 'api_key' || vm.addTemplate
150206
},
151207
secret_type: {
152208
type: 'radio-group',
153209
options: [],
210+
el: {
211+
get disabled() {
212+
return vm.isDisabled
213+
}
214+
},
154215
hidden: () => {
155216
return vm.addTemplate
156217
}
@@ -163,7 +224,8 @@ export const accountFieldsMeta = (vm) => {
163224
!automation.ansible_enabled ||
164225
!vm.$hasPerm('accounts.push_account') ||
165226
(formValue.secret_type === 'ssh_key' && vm.iPlatform.type.value === 'windows') ||
166-
vm.addTemplate
227+
vm.addTemplate ||
228+
!formValue.secret_reset
167229
}
168230
},
169231
params: {
@@ -172,6 +234,9 @@ export const accountFieldsMeta = (vm) => {
172234
el: {},
173235
hidden: (formValue) => {
174236
const automation = vm.iPlatform.automation || {}
237+
if (!vm.iPlatform.automation) {
238+
return true
239+
}
175240
vm.fieldsMeta.params.el.method = vm.iPlatform.automation.push_account_method
176241
vm.fieldsMeta.params.el.pushAccountParams = vm.iPlatform.automation.push_account_params
177242
return !formValue.push_now ||
@@ -184,12 +249,27 @@ export const accountFieldsMeta = (vm) => {
184249
}
185250
},
186251
is_active: {
187-
label: vm.$t('IsActive')
252+
label: vm.$t('IsActive'),
253+
el: {
254+
get disabled() {
255+
return vm.isDisabled
256+
}
257+
}
188258
},
189259
comment: {
190260
label: vm.$t('Comment'),
191-
hidden: () => {
192-
return vm.addTemplate
261+
el: {
262+
get disabled() {
263+
return vm.isDisabled
264+
}
265+
}
266+
},
267+
secret_reset: {
268+
label: vm.$t('SecretReset'),
269+
el: {
270+
get disabled() {
271+
return vm.isDisabled
272+
}
193273
}
194274
}
195275
}

0 commit comments

Comments
 (0)