Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
truenas-rk3588
webui
Commits
f327ecf7
Unverified
Commit
f327ecf7
authored
2 years ago
by
RehanY147
Committed by
GitHub
2 years ago
Browse files
Options
Download
Email Patches
Plain Diff
NAS-118857 / 22.12 / Using job instead of call (#7292)
parent
e7366152
Changes
91
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
src/app/core/testing/utils/mock-entity-job-component-ref.utils.ts
+1
-0
...core/testing/utils/mock-entity-job-component-ref.utils.ts
src/app/pages/datasets/modules/encryption/components/encyption-options-dialog/encryption-options-dialog.component.spec.ts
+10
-5
...ptions-dialog/encryption-options-dialog.component.spec.ts
src/app/pages/datasets/modules/encryption/components/encyption-options-dialog/encryption-options-dialog.component.ts
+25
-15
...ion-options-dialog/encryption-options-dialog.component.ts
src/assets/i18n/af.json
+1
-0
src/assets/i18n/af.json
src/assets/i18n/ar.json
+1
-0
src/assets/i18n/ar.json
src/assets/i18n/ast.json
+1
-0
src/assets/i18n/ast.json
src/assets/i18n/az.json
+1
-0
src/assets/i18n/az.json
src/assets/i18n/be.json
+1
-0
src/assets/i18n/be.json
src/assets/i18n/bg.json
+1
-0
src/assets/i18n/bg.json
src/assets/i18n/bn.json
+1
-0
src/assets/i18n/bn.json
src/assets/i18n/br.json
+1
-0
src/assets/i18n/br.json
src/assets/i18n/bs.json
+1
-0
src/assets/i18n/bs.json
src/assets/i18n/ca.json
+1
-0
src/assets/i18n/ca.json
src/assets/i18n/cs.json
+1
-0
src/assets/i18n/cs.json
src/assets/i18n/cy.json
+1
-0
src/assets/i18n/cy.json
src/assets/i18n/da.json
+1
-0
src/assets/i18n/da.json
src/assets/i18n/de.json
+1
-0
src/assets/i18n/de.json
src/assets/i18n/dsb.json
+1
-0
src/assets/i18n/dsb.json
src/assets/i18n/el.json
+1
-0
src/assets/i18n/el.json
src/assets/i18n/en-au.json
+1
-0
src/assets/i18n/en-au.json
with
53 additions
and
20 deletions
+53
-20
src/app/core/testing/utils/mock-entity-job-component-ref.utils.ts
View file @
f327ecf7
...
...
@@ -19,6 +19,7 @@ export const mockEntityJobComponentRef = {
failure
:
new
EventEmitter
(),
wsshow
:
jest
.
fn
(),
wspost
:
jest
.
fn
(),
updateSize
:
jest
.
fn
(),
},
close
:
jest
.
fn
(),
}
as
unknown
as
MatDialogRef
<
EntityJobComponent
>
;
This diff is collapsed.
Click to expand it.
src/app/pages/datasets/modules/encryption/components/encyption-options-dialog/encryption-options-dialog.component.spec.ts
View file @
f327ecf7
...
...
@@ -2,8 +2,9 @@ import { HarnessLoader } from '@angular/cdk/testing';
import
{
TestbedHarnessEnvironment
}
from
'
@angular/cdk/testing/testbed
'
;
import
{
ReactiveFormsModule
}
from
'
@angular/forms
'
;
import
{
MatButtonHarness
}
from
'
@angular/material/button/testing
'
;
import
{
MAT_DIALOG_DATA
,
MatDialogRef
}
from
'
@angular/material/dialog
'
;
import
{
MAT_DIALOG_DATA
,
MatDialogRef
,
MatDialog
}
from
'
@angular/material/dialog
'
;
import
{
createComponentFactory
,
mockProvider
,
Spectator
}
from
'
@ngneat/spectator/jest
'
;
import
{
mockEntityJobComponentRef
}
from
'
app/core/testing/utils/mock-entity-job-component-ref.utils
'
;
import
{
mockCall
,
mockWebsocket
}
from
'
app/core/testing/utils/mock-websocket.utils
'
;
import
{
EncryptionKeyFormat
}
from
'
app/enums/encryption-key-format.enum
'
;
import
{
Dataset
}
from
'
app/interfaces/dataset.interface
'
;
...
...
@@ -13,7 +14,7 @@ import { IxFormHarness } from 'app/modules/ix-forms/testing/ix-form.harness';
import
{
AppLoaderModule
}
from
'
app/modules/loader/app-loader.module
'
;
import
{
SnackbarModule
}
from
'
app/modules/snackbar/snackbar.module
'
;
import
{
EncryptionOptionsDialogComponent
}
from
'
app/pages/datasets/modules/encryption/components/encyption-options-dialog/encryption-options-dialog.component
'
;
import
{
DialogService
,
WebSocketService
}
from
'
app/services
'
;
import
{
AppLoaderService
,
DialogService
,
WebSocketService
}
from
'
app/services
'
;
import
{
EncryptionOptionsDialogData
}
from
'
./encryption-options-dialog-data.interface
'
;
describe
(
'
EncryptionOptionsDialogComponent
'
,
()
=>
{
...
...
@@ -34,6 +35,10 @@ describe('EncryptionOptionsDialogComponent', () => {
{
provide
:
MAT_DIALOG_DATA
,
useValue
:
{}
},
mockProvider
(
MatDialogRef
),
mockProvider
(
DialogService
),
mockProvider
(
MatDialog
,
{
open
:
jest
.
fn
(()
=>
mockEntityJobComponentRef
),
}),
mockProvider
(
AppLoaderService
),
mockWebsocket
([
mockCall
(
'
pool.dataset.change_key
'
),
mockCall
(
'
pool.dataset.inherit_parent_encryption_properties
'
),
...
...
@@ -148,7 +153,7 @@ describe('EncryptionOptionsDialogComponent', () => {
const
saveButton
=
await
loader
.
getHarness
(
MatButtonHarness
.
with
({
text
:
'
Save
'
}));
await
saveButton
.
click
();
expect
(
websocket
.
c
all
).
toHaveBeenCalledWith
(
expect
(
mockEntityJobComponentRef
.
componentInstance
.
setC
all
).
toHaveBeenCalledWith
(
'
pool.dataset.change_key
'
,
[
'
pool/parent/child
'
,
{
key
,
generate_key
:
false
}],
);
...
...
@@ -169,7 +174,7 @@ describe('EncryptionOptionsDialogComponent', () => {
const
saveButton
=
await
loader
.
getHarness
(
MatButtonHarness
.
with
({
text
:
'
Save
'
}));
await
saveButton
.
click
();
expect
(
websocket
.
c
all
).
toHaveBeenCalledWith
(
expect
(
mockEntityJobComponentRef
.
componentInstance
.
setC
all
).
toHaveBeenCalledWith
(
'
pool.dataset.change_key
'
,
[
'
pool/parent/child
'
,
{
generate_key
:
true
}],
);
...
...
@@ -192,7 +197,7 @@ describe('EncryptionOptionsDialogComponent', () => {
const
saveButton
=
await
loader
.
getHarness
(
MatButtonHarness
.
with
({
text
:
'
Save
'
}));
await
saveButton
.
click
();
expect
(
websocket
.
c
all
).
toHaveBeenCalledWith
(
expect
(
mockEntityJobComponentRef
.
componentInstance
.
setC
all
).
toHaveBeenCalledWith
(
'
pool.dataset.change_key
'
,
[
'
pool/parent/child
'
,
{
passphrase
:
'
12345678
'
,
pbkdf2iters
:
350001
}],
);
...
...
This diff is collapsed.
Click to expand it.
src/app/pages/datasets/modules/encryption/components/encyption-options-dialog/encryption-options-dialog.component.ts
View file @
f327ecf7
...
...
@@ -2,7 +2,7 @@ import {
ChangeDetectionStrategy
,
Component
,
Inject
,
OnInit
,
}
from
'
@angular/core
'
;
import
{
Validators
}
from
'
@angular/forms
'
;
import
{
MAT_DIALOG_DATA
,
MatDialogRef
}
from
'
@angular/material/dialog
'
;
import
{
MAT_DIALOG_DATA
,
MatDialogRef
,
MatDialog
}
from
'
@angular/material/dialog
'
;
import
{
FormBuilder
}
from
'
@ngneat/reactive-forms
'
;
import
{
UntilDestroy
,
untilDestroyed
}
from
'
@ngneat/until-destroy
'
;
import
{
TranslateService
}
from
'
@ngx-translate/core
'
;
...
...
@@ -15,6 +15,7 @@ import { DatasetChangeKeyParams } from 'app/interfaces/dataset-change-key.interf
import
{
Dataset
}
from
'
app/interfaces/dataset.interface
'
;
import
{
WebsocketError
}
from
'
app/interfaces/websocket-error.interface
'
;
import
{
matchOtherValidator
}
from
'
app/modules/entity/entity-form/validators/password-validation/password-validation
'
;
import
{
EntityJobComponent
}
from
'
app/modules/entity/entity-job/entity-job.component
'
;
import
{
FormErrorHandlerService
}
from
'
app/modules/ix-forms/services/form-error-handler.service
'
;
import
{
IxValidatorsService
}
from
'
app/modules/ix-forms/services/ix-validators.service
'
;
import
{
findInTree
}
from
'
app/modules/ix-tree/utils/find-in-tree.utils
'
;
...
...
@@ -78,6 +79,7 @@ export class EncryptionOptionsDialogComponent implements OnInit {
private
validatorsService
:
IxValidatorsService
,
private
errorHandler
:
FormErrorHandlerService
,
private
snackbar
:
SnackbarService
,
private
mdDialog
:
MatDialog
,
@
Inject
(
MAT_DIALOG_DATA
)
public
data
:
EncryptionOptionsDialogData
,
)
{}
...
...
@@ -149,20 +151,28 @@ export class EncryptionOptionsDialogComponent implements OnInit {
body
.
pbkdf2iters
=
Number
(
values
.
pbkdf2iters
);
}
this
.
loader
.
open
();
this
.
ws
.
call
(
'
pool.dataset.change_key
'
,
[
this
.
data
.
dataset
.
id
,
body
])
.
pipe
(
untilDestroyed
(
this
))
.
subscribe
({
next
:
()
=>
{
this
.
loader
.
close
();
this
.
showSuccessDialog
();
this
.
dialogRef
.
close
(
true
);
},
error
:
(
error
:
WebsocketError
)
=>
{
this
.
loader
.
close
();
this
.
errorHandler
.
handleWsFormError
(
error
,
this
.
form
);
},
});
const
jobDialogRef
=
this
.
mdDialog
.
open
(
EntityJobComponent
,
{
data
:
{
title
:
this
.
translate
.
instant
(
'
Updating key type
'
),
},
});
jobDialogRef
.
componentInstance
.
setCall
(
'
pool.dataset.change_key
'
,
[
this
.
data
.
dataset
.
id
,
body
]);
jobDialogRef
.
componentInstance
.
success
.
pipe
(
untilDestroyed
(
this
)).
subscribe
({
next
:
()
=>
{
jobDialogRef
.
close
();
this
.
showSuccessDialog
();
this
.
dialogRef
.
close
(
true
);
},
error
:
(
error
:
WebsocketError
)
=>
{
this
.
errorHandler
.
handleWsFormError
(
error
,
this
.
form
);
},
});
jobDialogRef
.
componentInstance
.
failure
.
pipe
(
untilDestroyed
(
this
)).
subscribe
({
next
:
(
error
)
=>
{
this
.
errorHandler
.
handleWsFormError
(
error
,
this
.
form
);
},
});
jobDialogRef
.
componentInstance
.
submit
();
}
private
showSuccessDialog
():
void
{
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/af.json
View file @
f327ecf7
...
...
@@ -3775,6 +3775,7 @@
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating group members"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Pool"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/ar.json
View file @
f327ecf7
...
...
@@ -3775,6 +3775,7 @@
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating group members"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Pool"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/ast.json
View file @
f327ecf7
...
...
@@ -3775,6 +3775,7 @@
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating group members"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Pool"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/az.json
View file @
f327ecf7
...
...
@@ -3775,6 +3775,7 @@
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating group members"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Pool"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/be.json
View file @
f327ecf7
...
...
@@ -3775,6 +3775,7 @@
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating group members"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Pool"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/bg.json
View file @
f327ecf7
...
...
@@ -3775,6 +3775,7 @@
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating group members"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Pool"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/bn.json
View file @
f327ecf7
...
...
@@ -3775,6 +3775,7 @@
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating group members"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Pool"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/br.json
View file @
f327ecf7
...
...
@@ -3775,6 +3775,7 @@
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating group members"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Pool"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/bs.json
View file @
f327ecf7
...
...
@@ -3775,6 +3775,7 @@
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating group members"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Pool"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/ca.json
View file @
f327ecf7
...
...
@@ -3775,6 +3775,7 @@
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating group members"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Pool"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/cs.json
View file @
f327ecf7
...
...
@@ -3277,6 +3277,7 @@
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating group members"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Waiting to Finish"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/cy.json
View file @
f327ecf7
...
...
@@ -3775,6 +3775,7 @@
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating group members"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Pool"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/da.json
View file @
f327ecf7
...
...
@@ -3775,6 +3775,7 @@
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating group members"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Pool"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/de.json
View file @
f327ecf7
...
...
@@ -2430,6 +2430,7 @@
"Updates Available"
:
""
,
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Waiting to Finish"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/dsb.json
View file @
f327ecf7
...
...
@@ -3775,6 +3775,7 @@
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating group members"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Pool"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/el.json
View file @
f327ecf7
...
...
@@ -3775,6 +3775,7 @@
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating group members"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Pool"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
src/assets/i18n/en-au.json
View file @
f327ecf7
...
...
@@ -3775,6 +3775,7 @@
"Updating"
:
""
,
"Updating Dataset ACL"
:
""
,
"Updating group members"
:
""
,
"Updating key type"
:
""
,
"Updating production status..."
:
""
,
"Upgrade"
:
""
,
"Upgrade Pool"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
5
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment