Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
e7e0aabc
Commit
e7e0aabc
authored
3 years ago
by
Evgeny Stepanovych
Browse files
Options
Download
Email Patches
Plain Diff
NAS-111347 - Improving type safety
parent
0f0e53fa
Changes
34
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
src/app/components/common/breadcrumb/breadcrumb.component.ts
+2
-2
src/app/components/common/breadcrumb/breadcrumb.component.ts
src/app/components/common/layouts/admin-layout/admin-layout.component.html
+1
-1
...s/common/layouts/admin-layout/admin-layout.component.html
src/app/components/common/layouts/admin-layout/admin-layout.component.ts
+3
-10
...nts/common/layouts/admin-layout/admin-layout.component.ts
src/app/components/common/navigation/navigation.component.ts
+5
-5
src/app/components/common/navigation/navigation.component.ts
src/app/enums/service-name.enum.ts
+1
-0
src/app/enums/service-name.enum.ts
src/app/interfaces/api-directory.interface.ts
+2
-2
src/app/interfaces/api-directory.interface.ts
src/app/interfaces/menu-item.interface.ts
+15
-0
src/app/interfaces/menu-item.interface.ts
src/app/pages/api-keys/api-keys-row.interface.ts
+3
-0
src/app/pages/api-keys/api-keys-row.interface.ts
src/app/pages/api-keys/api-keys.component.ts
+9
-8
src/app/pages/api-keys/api-keys.component.ts
src/app/pages/applications/applications.service.ts
+3
-2
src/app/pages/applications/applications.service.ts
src/app/pages/common/entity/entity-table/entity-table.component.ts
+2
-2
...ages/common/entity/entity-table/entity-table.component.ts
src/app/pages/common/entity/entity-table/entity-table.interface.ts
+2
-2
...ages/common/entity/entity-table/entity-table.interface.ts
src/app/pages/common/entity/table/expandable-table/expandable-table.component.ts
+2
-2
...tity/table/expandable-table/expandable-table.component.ts
src/app/pages/common/entity/table/table.component.ts
+6
-7
src/app/pages/common/entity/table/table.component.ts
src/app/pages/credentials/backup-credentials/backup-credentials.component.ts
+10
-11
...ntials/backup-credentials/backup-credentials.component.ts
src/app/pages/credentials/certificates-dash/certificates-dash.component.ts
+17
-15
...dentials/certificates-dash/certificates-dash.component.ts
src/app/pages/data-protection/cloudsync/cloudsync-form/cloudsync-form.component.ts
+6
-5
...tion/cloudsync/cloudsync-form/cloudsync-form.component.ts
src/app/pages/data-protection/components/data-protection-dashboard/data-protection-dashboard.component.ts
+2
-2
...otection-dashboard/data-protection-dashboard.component.ts
src/app/pages/directory-service/active-directory/active-directory.component.ts
+1
-1
...ry-service/active-directory/active-directory.component.ts
src/app/pages/directory-service/directory-services.component.ts
+4
-4
...p/pages/directory-service/directory-services.component.ts
with
96 additions
and
81 deletions
+96
-81
src/app/components/common/breadcrumb/breadcrumb.component.ts
View file @
e7e0aabc
...
...
@@ -8,7 +8,7 @@ import { CoreService } from 'app/core/services/core-service/core.service';
import
{
ProductType
}
from
'
app/enums/product-type.enum
'
;
import
{
CoreEvent
}
from
'
app/interfaces/events
'
;
import
{
LocaleService
}
from
'
app/services/locale.service
'
;
import
{
RoutePartsService
}
from
'
app/services/route-parts/route-parts.service
'
;
import
{
RoutePartsService
,
RoutePart
}
from
'
app/services/route-parts/route-parts.service
'
;
@
UntilDestroy
()
@
Component
({
...
...
@@ -20,7 +20,7 @@ export class BreadcrumbComponent implements OnInit {
@
Input
()
product_type
:
ProductType
;
copyrightYear
=
this
.
localeService
.
getCopyrightYearFromBuildTime
();
routeParts
:
any
[];
routeParts
:
(
RoutePart
&
{
disabled
?:
boolean
})
[];
isEnabled
=
true
;
constructor
(
private
router
:
Router
,
private
routePartsService
:
RoutePartsService
,
...
...
This diff is collapsed.
Click to expand it.
src/app/components/common/layouts/admin-layout/admin-layout.component.html
View file @
e7e0aabc
...
...
@@ -40,7 +40,7 @@
</div>
<navigation
(stateChange)=
"changeState($event)"
(menuToggled)=
"toggleMenu($event)"
(menuClosed)=
"toggleMenu()"
></navigation>
<navigation
(menuToggled)=
"toggleMenu($event)"
(menuClosed)=
"toggleMenu()"
></navigation>
<div
class=
"sidenav-copyright-txt"
*ngIf=
"!isSidenavCollapsed"
>
<div
class=
"hostname-label"
*ngIf=
"hostname"
matTooltip=
"Hostname: {{hostname}}"
>
{{hostname}}
</div>
<div>
TrueNAS {{product_type}}®
</div>
...
...
This diff is collapsed.
Click to expand it.
src/app/components/common/layouts/admin-layout/admin-layout.component.ts
View file @
e7e0aabc
...
...
@@ -12,6 +12,7 @@ import { LayoutService } from 'app/core/services/layout.service';
import
{
ProductType
}
from
'
app/enums/product-type.enum
'
;
import
{
CoreEvent
}
from
'
app/interfaces/events
'
;
import
{
SysInfoEvent
}
from
'
app/interfaces/events/sys-info-event.interface
'
;
import
{
SubMenuItem
}
from
'
app/interfaces/menu-item.interface
'
;
import
{
WebSocketService
,
SystemGeneralService
}
from
'
app/services
'
;
import
{
LanguageService
}
from
'
app/services/language.service
'
;
import
{
LocaleService
}
from
'
app/services/locale.service
'
;
...
...
@@ -42,7 +43,7 @@ export class AdminLayoutComponent implements OnInit, AfterViewChecked {
isOpen
=
false
;
notificPanelClosed
=
false
;
menuName
:
string
;
subs
:
any
[];
subs
:
SubMenuItem
[];
copyrightYear
=
this
.
localeService
.
getCopyrightYearFromBuildTime
();
readonly
ProductType
=
ProductType
;
...
...
@@ -248,14 +249,6 @@ export class AdminLayoutComponent implements OnInit, AfterViewChecked {
this
.
isSidenotOpen
=
false
;
}
changeState
(
$event
:
any
):
void
{
if
(
$event
.
transfer
)
{
if
(
this
.
media
.
isActive
(
'
xs
'
)
||
this
.
media
.
isActive
(
'
sm
'
))
{
this
.
sideNave
.
close
();
}
}
}
openModal
(
id
:
string
):
void
{
this
.
modalService
.
open
(
id
,
{});
}
...
...
@@ -265,7 +258,7 @@ export class AdminLayoutComponent implements OnInit, AfterViewChecked {
}
// For the slide-in menu
toggleMenu
(
menuInfo
?:
any
):
void
{
toggleMenu
(
menuInfo
?:
[
string
,
SubMenuItem
[]]
):
void
{
if
(
this
.
isOpen
&&
!
menuInfo
||
this
.
isOpen
&&
menuInfo
[
0
]
===
this
.
menuName
)
{
this
.
isOpen
=
false
;
}
else
if
(
menuInfo
)
{
...
...
This diff is collapsed.
Click to expand it.
src/app/components/common/navigation/navigation.component.ts
View file @
e7e0aabc
...
...
@@ -8,6 +8,7 @@ import { filter } from 'rxjs/operators';
import
{
ViewControllerComponent
}
from
'
app/core/components/view-controller/view-controller.component
'
;
import
{
ProductType
}
from
'
app/enums/product-type.enum
'
;
import
{
SysInfoEvent
}
from
'
app/interfaces/events/sys-info-event.interface
'
;
import
{
MenuItem
,
SubMenuItem
}
from
'
app/interfaces/menu-item.interface
'
;
import
{
WebSocketService
}
from
'
app/services
'
;
import
{
NavigationService
}
from
'
app/services/navigation/navigation.service
'
;
...
...
@@ -19,13 +20,12 @@ import { NavigationService } from 'app/services/navigation/navigation.service';
export
class
NavigationComponent
extends
ViewControllerComponent
implements
OnInit
{
hasIconTypeMenuItem
:
boolean
;
iconTypeMenuTitle
:
string
;
menuItems
:
any
[];
menuItems
:
MenuItem
[];
menuList
=
document
.
getElementsByClassName
(
'
top-level
'
);
isHighlighted
:
string
;
@
Output
()
stateChange
:
EventEmitter
<
any
>
=
new
EventEmitter
();
@
Output
()
menuToggled
:
EventEmitter
<
any
>
=
new
EventEmitter
();
@
Output
()
menuClosed
:
EventEmitter
<
any
>
=
new
EventEmitter
();
@
Output
()
menuToggled
:
EventEmitter
<
[
string
,
SubMenuItem
[]]
>
=
new
EventEmitter
();
@
Output
()
menuClosed
:
EventEmitter
<
void
>
=
new
EventEmitter
();
constructor
(
private
navService
:
NavigationService
,
private
router
:
Router
,
private
ws
:
WebSocketService
,
...
...
@@ -78,7 +78,7 @@ export class NavigationComponent extends ViewControllerComponent implements OnIn
});
}
toggleMenu
(
state
:
any
,
sub
:
any
):
void
{
toggleMenu
(
state
:
string
,
sub
:
SubMenuItem
[]
):
void
{
this
.
menuToggled
.
emit
([
state
,
sub
]);
}
...
...
This diff is collapsed.
Click to expand it.
src/app/enums/service-name.enum.ts
View file @
e7e0aabc
...
...
@@ -18,6 +18,7 @@ export enum ServiceName {
Ups
=
'
ups
'
,
WebDav
=
'
webdav
'
,
Http
=
'
http
'
,
Kubernetes
=
'
kubernetes
'
,
}
export
const
serviceNames
=
new
Map
<
ServiceName
,
string
>
([
...
...
This diff is collapsed.
Click to expand it.
src/app/interfaces/api-directory.interface.ts
View file @
e7e0aabc
...
...
@@ -403,7 +403,7 @@ export type ApiDirectory = {
'
iscsi.initiator.delete
'
:
{
params
:
any
;
response
:
any
};
'
iscsi.target.query
'
:
{
params
:
any
;
response
:
IscsiTarget
[]
};
'
iscsi.extent.disk_choices
'
:
{
params
:
void
;
response
:
Choices
};
'
iscsi.extent.query
'
:
{
params
:
any
;
response
:
IscsiExtent
[]
};
'
iscsi.extent.query
'
:
{
params
:
QueryParams
<
IscsiExtent
>
;
response
:
IscsiExtent
[]
};
'
iscsi.extent.create
'
:
{
params
:
any
;
response
:
any
};
'
iscsi.extent.update
'
:
{
params
:
any
;
response
:
any
};
'
iscsi.extent.delete
'
:
{
params
:
any
;
response
:
any
};
...
...
@@ -671,7 +671,7 @@ export type ApiDirectory = {
'
systemdataset.update
'
:
{
params
:
[{
[
poolName
:
string
]:
string
}];
response
:
any
};
// Service
'
service.started
'
:
{
params
:
any
;
response
:
an
y
};
'
service.started
'
:
{
params
:
[
ServiceName
]
;
response
:
boole
an
};
'
service.query
'
:
{
params
:
QueryParams
<
Service
>
;
response
:
Service
[]
};
'
service.update
'
:
{
params
:
[
number
,
Partial
<
Service
>
];
response
:
number
};
'
service.start
'
:
{
params
:
[
ServiceName
];
response
:
boolean
};
...
...
This diff is collapsed.
Click to expand it.
src/app/interfaces/menu-item.interface.ts
0 → 100644
View file @
e7e0aabc
export
interface
MenuItem
{
type
:
string
;
// Possible values: link/slideOut/icon/separator/extLink
name
?:
string
;
// Used as display text for item and title for separator type
state
?:
string
;
// Router state
icon
?:
string
;
// Item icon name
tooltip
?:
string
;
// Tooltip text
disabled
?:
boolean
;
// If true, item will not be appeared in sidenav.
sub
?:
SubMenuItem
[];
// Dropdown items
}
export
interface
SubMenuItem
{
name
:
string
;
// Display text
state
:
string
;
// Router state
disabled
?:
boolean
;
// If true, item will not be appeared in sidenav.
}
This diff is collapsed.
Click to expand it.
src/app/pages/api-keys/api-keys-row.interface.ts
0 → 100644
View file @
e7e0aabc
import
{
ApiKey
}
from
'
app/interfaces/api-key.interface
'
;
export
type
ApiKeysRow
=
ApiKey
&
{
created_time
:
string
};
This diff is collapsed.
Click to expand it.
src/app/pages/api-keys/api-keys.component.ts
View file @
e7e0aabc
...
...
@@ -12,6 +12,7 @@ import { LocaleService } from 'app/services/locale.service';
import
{
ConfirmDialog
}
from
'
../common/confirm-dialog/confirm-dialog.component
'
;
import
{
DialogFormConfiguration
}
from
'
../common/entity/entity-dialog/dialog-form-configuration.interface
'
;
import
{
EntityUtils
}
from
'
../common/entity/utils
'
;
import
{
ApiKeysRow
}
from
'
./api-keys-row.interface
'
;
@
UntilDestroy
()
@
Component
({
...
...
@@ -27,7 +28,7 @@ export class ApiKeysComponent implements EntityTableConfig {
addCall
:
'
api_key.create
'
=
'
api_key.create
'
;
editCall
:
'
api_key.update
'
=
'
api_key.update
'
;
currItem
:
any
;
currItem
:
ApiKeysRow
;
entityList
:
EntityTableComponent
;
columns
=
[
...
...
@@ -106,11 +107,11 @@ export class ApiKeysComponent implements EntityTableConfig {
afterInit
(
entityList
:
EntityTableComponent
):
void
{
this
.
entityList
=
entityList
;
}
resourceTransformIncomingRestData
(
data
:
ApiKey
[]):
any
[]
{
resourceTransformIncomingRestData
(
data
:
ApiKey
[]):
ApiKeysRow
[]
{
return
data
.
map
((
item
)
=>
{
return
{
...
item
,
created_time
:
this
.
localeService
.
formatDateTime
(
item
.
created_at
.
$date
as
any
),
created_time
:
this
.
localeService
.
formatDateTime
(
item
.
created_at
.
$date
),
};
});
}
...
...
@@ -119,7 +120,7 @@ export class ApiKeysComponent implements EntityTableConfig {
const
that
=
entityDialogForm
.
parent
;
if
(
that
.
currItem
)
{
that
.
ws
.
call
(
that
.
editCall
,
[
that
.
currItem
.
id
,
entityDialogForm
.
formValue
]).
pipe
(
untilDestroyed
(
this
)).
subscribe
(
(
res
:
any
)
=>
{
(
res
)
=>
{
entityDialogForm
.
dialogRef
.
close
(
true
);
if
(
res
.
key
)
{
that
.
displayKey
(
res
.
key
);
...
...
@@ -132,7 +133,7 @@ export class ApiKeysComponent implements EntityTableConfig {
);
}
else
{
that
.
ws
.
call
(
that
.
addCall
,
[
entityDialogForm
.
formValue
]).
pipe
(
untilDestroyed
(
this
)).
subscribe
(
(
res
:
any
)
=>
{
(
res
)
=>
{
entityDialogForm
.
dialogRef
.
close
(
true
);
that
.
displayKey
(
res
.
key
);
that
.
entityList
.
getData
();
...
...
@@ -160,13 +161,13 @@ export class ApiKeysComponent implements EntityTableConfig {
};
}
getActions
():
EntityTableAction
[]
{
getActions
():
EntityTableAction
<
ApiKeysRow
>
[]
{
return
[{
name
:
helptext
.
action_edit
,
id
:
'
edit
'
,
icon
:
'
edit
'
,
label
:
'
Edit
'
,
onClick
:
(
rowinner
:
any
)
=>
{
onClick
:
(
rowinner
:
ApiKeysRow
)
=>
{
this
.
apikeysFormConf
.
title
=
helptext
.
formDialog
.
edit_title
;
this
.
apikeysFormConf
.
saveButtonText
=
helptext
.
formDialog
.
edit_button
;
this
.
apikeysFormConf
.
method_ws
=
this
.
editCall
;
...
...
@@ -178,7 +179,7 @@ export class ApiKeysComponent implements EntityTableConfig {
id
:
'
delete
'
,
icon
:
'
delete
'
,
label
:
'
Delete
'
,
onClick
:
(
rowinner
:
any
)
=>
{
onClick
:
(
rowinner
:
ApiKeysRow
)
=>
{
this
.
entityList
.
doDelete
(
rowinner
);
},
}]
as
EntityTableAction
[];
...
...
This diff is collapsed.
Click to expand it.
src/app/pages/applications/applications.service.ts
View file @
e7e0aabc
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
Observable
}
from
'
rxjs
'
;
import
{
ServiceName
}
from
'
app/enums/service-name.enum
'
;
import
{
UpgradeSummary
}
from
'
app/interfaces/application.interface
'
;
import
{
Catalog
,
CatalogApp
}
from
'
app/interfaces/catalog.interface
'
;
import
{
ChartReleaseEvent
}
from
'
app/interfaces/chart-release-event.interface
'
;
...
...
@@ -23,8 +24,8 @@ export class ApplicationsService {
return
this
.
ws
.
call
(
'
kubernetes.config
'
);
}
getKubernetesServiceStarted
():
Observable
<
an
y
>
{
return
this
.
ws
.
call
(
'
service.started
'
,
[
'
k
ubernetes
'
]);
getKubernetesServiceStarted
():
Observable
<
boole
an
>
{
return
this
.
ws
.
call
(
'
service.started
'
,
[
ServiceName
.
K
ubernetes
]);
}
getAllCatalogItems
():
Observable
<
Catalog
[]
>
{
...
...
This diff is collapsed.
Click to expand it.
src/app/pages/common/entity/entity-table/entity-table.component.ts
View file @
e7e0aabc
...
...
@@ -797,12 +797,12 @@ export class EntityTableComponent<Row = any> implements OnInit, AfterViewInit, O
// this.modalService.open('slide-in-form', this.conf.addComponent);
}
doEdit
(
id
:
string
):
void
{
doEdit
(
id
:
string
|
number
):
void
{
if
(
this
.
conf
.
doEdit
)
{
this
.
conf
.
doEdit
(
id
,
this
);
}
else
{
this
.
router
.
navigate
(
new
Array
(
'
/
'
).
concat
(
this
.
conf
.
route_edit
).
concat
(
id
),
new
Array
(
'
/
'
).
concat
(
this
.
conf
.
route_edit
).
concat
(
id
as
any
),
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/app/pages/common/entity/entity-table/entity-table.interface.ts
View file @
e7e0aabc
...
...
@@ -55,8 +55,8 @@ export interface EntityTableConfig<Row = any> {
getActions
?:
(
row
:
Row
)
=>
EntityTableAction
<
Row
>
[];
getAddActions
?:
()
=>
any
[];
rowValue
?:
(
row
:
unknown
,
attr
:
string
)
=>
unknown
;
wsMultiDeleteParams
?:
(
selected
:
any
)
=>
any
;
updateMultiAction
?:
(
selected
:
any
)
=>
any
;
wsMultiDeleteParams
?:
(
selected
:
Row
[]
)
=>
any
;
updateMultiAction
?:
(
selected
:
Row
[]
)
=>
any
;
doAdd
?:
(
id
?:
string
|
number
,
tableComponent
?:
EntityTableComponent
)
=>
void
;
doEdit
?:
(
id
?:
string
|
number
,
tableComponent
?:
EntityTableComponent
)
=>
void
;
onCheckboxChange
?:
(
row
:
Row
)
=>
void
;
...
...
This diff is collapsed.
Click to expand it.
src/app/pages/common/entity/table/expandable-table/expandable-table.component.ts
View file @
e7e0aabc
...
...
@@ -3,9 +3,9 @@ import {
Component
,
ElementRef
,
Input
,
OnInit
,
ViewChild
,
}
from
'
@angular/core
'
;
import
{
ServiceStatus
}
from
'
app/enums/service-status.enum
'
;
import
{
Input
TableConf
}
from
'
app/pages/common/entity/table/table.component
'
;
import
{
App
TableConf
ig
}
from
'
app/pages/common/entity/table/table.component
'
;
export
interface
InputExpandableTableConf
extends
Input
TableConf
{
export
interface
InputExpandableTableConf
extends
App
TableConf
ig
{
detailsHref
?:
string
;
expandableTableComponent
?:
ExpandableTableComponent
;
limitRows
?:
number
;
...
...
This diff is collapsed.
Click to expand it.
src/app/pages/common/entity/table/table.component.ts
View file @
e7e0aabc
...
...
@@ -2,17 +2,16 @@ import {
Component
,
OnInit
,
Input
,
ViewChild
,
AfterViewInit
,
AfterViewChecked
,
}
from
'
@angular/core
'
;
import
{
MatDialog
}
from
'
@angular/material/dialog
'
;
import
{
MatCellDef
}
from
'
@angular/material/table/cell
'
;
import
{
JobState
}
from
'
app/enums/job-state.enum
'
;
import
{
WebSocketService
}
from
'
app/services
'
;
import
{
EmptyConfig
,
EmptyType
}
from
'
../entity-empty/entity-empty.component
'
;
import
{
TableService
}
from
'
./table.service
'
;
export
interface
AppTableAction
{
export
interface
AppTableAction
<
Row
=
any
>
{
name
:
string
;
icon
:
string
;
matTooltip
?:
string
;
onClick
:
(
element
:
MatCellDef
)
=>
void
;
onClick
:
(
row
:
Row
)
=>
void
;
}
export
interface
AppTableHeaderAction
{
...
...
@@ -22,7 +21,7 @@ export interface AppTableHeaderAction {
export
interface
AppTableHeaderExtraAction
extends
AppTableHeaderAction
{}
export
interface
Input
TableConf
{
export
interface
App
TableConf
ig
{
title
?:
string
;
titleHref
?:
string
;
columns
:
any
[];
...
...
@@ -71,7 +70,7 @@ export interface InputTableConf {
export
class
TableComponent
implements
OnInit
,
AfterViewInit
,
AfterViewChecked
{
@
ViewChild
(
'
table
'
)
table
:
any
;
_tableConf
:
Input
TableConf
;
_tableConf
:
App
TableConf
ig
;
title
=
''
;
titleHref
:
string
;
dataSource
:
any
[];
...
...
@@ -94,11 +93,11 @@ export class TableComponent implements OnInit, AfterViewInit, AfterViewChecked {
private
entityEmptyLarge
=
false
;
private
enableViewMore
=
false
;
get
tableConf
():
Input
TableConf
{
get
tableConf
():
App
TableConf
ig
{
return
this
.
_tableConf
;
}
@
Input
(
'
conf
'
)
set
tableConf
(
conf
:
Input
TableConf
)
{
@
Input
(
'
conf
'
)
set
tableConf
(
conf
:
App
TableConf
ig
)
{
if
(
!
this
.
_tableConf
)
{
this
.
_tableConf
=
conf
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/app/pages/credentials/backup-credentials/backup-credentials.component.ts
View file @
e7e0aabc
...
...
@@ -2,8 +2,10 @@ import { Component, OnInit } from '@angular/core';
import
{
ActivatedRoute
,
Router
}
from
'
@angular/router
'
;
import
{
UntilDestroy
,
untilDestroyed
}
from
'
@ngneat/until-destroy
'
;
import
{
KeychainCredentialType
}
from
'
app/enums/keychain-credential-type.enum
'
;
import
{
CloudsyncCredential
}
from
'
app/interfaces/cloudsync-credential.interface
'
;
import
{
CloudsyncProvider
}
from
'
app/interfaces/cloudsync-provider.interface
'
;
import
{
AppTableAction
}
from
'
app/pages/common/entity/table/table.component
'
;
import
{
KeychainCredential
}
from
'
app/interfaces/keychain-credential.interface
'
;
import
{
AppTableAction
,
AppTableConfig
}
from
'
app/pages/common/entity/table/table.component
'
;
import
{
WebSocketService
,
KeychainCredentialService
,
AppLoaderService
,
DialogService
,
ReplicationService
,
StorageService
,
CloudCredentialService
,
...
...
@@ -21,7 +23,7 @@ import { SshKeypairsFormComponent } from './forms/ssh-keypairs-form.component';
providers
:
[
KeychainCredentialService
,
ReplicationService
,
CloudCredentialService
],
})
export
class
BackupCredentialsComponent
implements
OnInit
{
cards
:
any
;
cards
:
{
name
:
string
;
tableConf
:
AppTableConfig
}[]
;
// Components included in this dashboard
protected
sshConnections
:
SshConnectionsFormComponent
;
...
...
@@ -56,7 +58,6 @@ export class BackupCredentialsComponent implements OnInit {
this
.
cards
=
[
{
name
:
'
cloudCredentials
'
,
flex
:
40
,
tableConf
:
{
title
:
'
Cloud Credentials
'
,
queryCall
:
'
cloudsync.credentials.query
'
,
...
...
@@ -71,14 +72,13 @@ export class BackupCredentialsComponent implements OnInit {
add
()
{
this
.
parent
.
modalService
.
open
(
'
slide-in-form
'
,
this
.
parent
.
cloudCredentials
);
},
edit
(
row
:
any
)
{
edit
(
row
:
CloudsyncCredential
)
{
this
.
parent
.
modalService
.
open
(
'
slide-in-form
'
,
this
.
parent
.
cloudCredentials
,
row
.
id
);
},
dataSourceHelper
:
this
.
cloudCredentialsDataSourceHelper
.
bind
(
this
),
},
},
{
name
:
'
sshConnections
'
,
flex
:
30
,
tableConf
:
{
title
:
'
SSH Connections
'
,
queryCall
:
'
keychaincredential.query
'
,
...
...
@@ -93,13 +93,12 @@ export class BackupCredentialsComponent implements OnInit {
add
()
{
this
.
parent
.
modalService
.
open
(
'
slide-in-form
'
,
this
.
parent
.
sshConnections
);
},
edit
(
row
:
any
)
{
edit
(
row
:
KeychainCredential
)
{
this
.
parent
.
modalService
.
open
(
'
slide-in-form
'
,
this
.
parent
.
sshConnections
,
row
.
id
);
},
},
},
{
name
:
'
sshKeypairs
'
,
flex
:
30
,
tableConf
:
{
title
:
'
SSH Keypairs
'
,
queryCall
:
'
keychaincredential.query
'
,
...
...
@@ -115,7 +114,7 @@ export class BackupCredentialsComponent implements OnInit {
add
()
{
this
.
parent
.
modalService
.
open
(
'
slide-in-form
'
,
this
.
parent
.
sshKeypairs
);
},
edit
(
row
:
any
)
{
edit
(
row
:
KeychainCredential
)
{
this
.
parent
.
modalService
.
open
(
'
slide-in-form
'
,
this
.
parent
.
sshKeypairs
,
row
.
id
);
},
},
...
...
@@ -123,7 +122,7 @@ export class BackupCredentialsComponent implements OnInit {
];
}
cloudCredentialsDataSourceHelper
(
res
:
any
[]):
any
[]
{
cloudCredentialsDataSourceHelper
(
res
:
CloudsyncCredential
[]):
CloudsyncCredential
[]
{
return
res
.
map
((
item
)
=>
{
if
(
this
.
providers
)
{
const
credentialProvider
=
this
.
providers
.
find
((
provider
)
=>
provider
.
name
==
item
.
provider
);
...
...
@@ -135,11 +134,11 @@ export class BackupCredentialsComponent implements OnInit {
});
}
sshConnectionsDataSourceHelper
(
res
:
any
[]):
any
[]
{
sshConnectionsDataSourceHelper
(
res
:
KeychainCredential
[]):
KeychainCredential
[]
{
return
res
.
filter
((
item
)
=>
item
.
type
===
KeychainCredentialType
.
SshCredentials
);
}
sshKeyPairsDataSourceHelper
(
res
:
any
[]):
any
[]
{
sshKeyPairsDataSourceHelper
(
res
:
KeychainCredential
[]):
KeychainCredential
[]
{
return
res
.
filter
((
item
)
=>
item
.
type
===
KeychainCredentialType
.
SshKeyPair
);
}
...
...
This diff is collapsed.
Click to expand it.
src/app/pages/credentials/certificates-dash/certificates-dash.component.ts
View file @
e7e0aabc
...
...
@@ -5,19 +5,21 @@ import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import
*
as
_
from
'
lodash
'
;
import
{
helptext_system_ca
}
from
'
app/helptext/system/ca
'
;
import
{
helptext_system_certificates
}
from
'
app/helptext/system/certificates
'
;
import
{
CertificateAuthority
}
from
'
app/interfaces/certificate-authority.interface
'
;
import
{
Certificate
}
from
'
app/interfaces/certificate.interface
'
;
import
{
Option
}
from
'
app/interfaces/option.interface
'
;
import
{
DialogFormConfiguration
}
from
'
app/pages/common/entity/entity-dialog/dialog-form-configuration.interface
'
;
import
{
EntityDialogComponent
}
from
'
app/pages/common/entity/entity-dialog/entity-dialog.component
'
;
import
{
FieldConfig
}
from
'
app/pages/common/entity/entity-form/models/field-config.interface
'
;
import
{
EntityFormService
}
from
'
app/pages/common/entity/entity-form/services/entity-form.service
'
;
import
{
AppTableAction
}
from
'
app/pages/common/entity/table/table.component
'
;
import
{
AppTableAction
,
AppTableConfig
}
from
'
app/pages/common/entity/table/table.component
'
;
import
{
EntityUtils
}
from
'
app/pages/common/entity/utils
'
;
import
{
AcmednsFormComponent
}
from
'
app/pages/credentials/certificates-dash/forms/acmedns-form.component
'
;
import
{
SystemGeneralService
,
WebSocketService
,
AppLoaderService
,
DialogService
,
StorageService
,
}
from
'
app/services
'
;
import
{
ModalService
}
from
'
app/services/modal.service
'
;
import
{
T
}
from
'
app/translate-marker
'
;
import
{
AcmednsFormComponent
}
from
'
./forms/acmedns-form.component
'
;
import
{
CertificateAuthorityAddComponent
}
from
'
./forms/ca-add.component
'
;
import
{
CertificateAuthorityEditComponent
}
from
'
./forms/ca-edit.component
'
;
import
{
CertificateAcmeAddComponent
}
from
'
./forms/certificate-acme-add.component
'
;
...
...
@@ -31,7 +33,7 @@ import { CertificateEditComponent } from './forms/certificate-edit.component';
providers
:
[
EntityFormService
],
})
export
class
CertificatesDashComponent
implements
OnInit
{
cards
:
any
;
cards
:
{
name
:
string
;
tableConf
:
AppTableConfig
}[]
;
protected
certificateAddComponent
:
CertificateAddComponent
;
protected
certificateEditComponent
:
CertificateEditComponent
;
...
...
@@ -105,7 +107,7 @@ export class CertificatesDashComponent implements OnInit {
add
()
{
this
.
parent
.
modalService
.
open
(
'
slide-in-form
'
,
this
.
parent
.
certificateAddComponent
);
},
edit
(
row
:
any
)
{
edit
(
row
:
Certificate
)
{
this
.
parent
.
modalService
.
open
(
'
slide-in-form
'
,
this
.
parent
.
certificateEditComponent
,
row
.
id
);
},
},
...
...
@@ -132,7 +134,7 @@ export class CertificatesDashComponent implements OnInit {
add
()
{
this
.
parent
.
modalService
.
open
(
'
slide-in-form
'
,
this
.
parent
.
certificateAddComponent
,
'
csr
'
);
},
edit
(
row
:
any
)
{
edit
(
row
:
Certificate
)
{
this
.
parent
.
modalService
.
open
(
'
slide-in-form
'
,
this
.
parent
.
certificateEditComponent
,
row
.
id
);
},
},
...
...
@@ -161,10 +163,10 @@ export class CertificatesDashComponent implements OnInit {
add
()
{
this
.
parent
.
modalService
.
open
(
'
slide-in-form
'
,
this
.
parent
.
certificateAuthorityAddComponent
);
},
edit
(
row
:
an
y
)
{
edit
(
row
:
CertificateAuthorit
y
)
{
this
.
parent
.
modalService
.
open
(
'
slide-in-form
'
,
this
.
parent
.
certificateAuthorityEditComponent
,
row
.
id
);
},
delete
(
row
:
an
y
,
table
:
any
)
{
delete
(
row
:
CertificateAuthorit
y
,
table
:
any
)
{
if
(
row
.
signed_certificates
>
0
)
{
(
this
.
parent
.
dialogService
as
DialogService
).
confirm
({
title
:
helptext_system_ca
.
delete_error
.
title
,
...
...
@@ -194,7 +196,7 @@ export class CertificatesDashComponent implements OnInit {
add
()
{
this
.
parent
.
modalService
.
open
(
'
slide-in-form
'
,
this
.
parent
.
acmeDNSComponent
);
},
edit
(
row
:
an
y
)
{
edit
(
row
:
CertificateAuthorit
y
)
{
this
.
parent
.
modalService
.
open
(
'
slide-in-form
'
,
this
.
parent
.
acmeDNSComponent
,
row
.
id
);
},
},
...
...
@@ -211,7 +213,7 @@ export class CertificatesDashComponent implements OnInit {
return
res
.
filter
((
item
)
=>
item
.
certificate
!==
null
);
}
csrDataSourceHelper
(
res
:
any
[]):
any
[]
{
csrDataSourceHelper
(
res
:
Certificate
[]):
Certificate
[]
{
return
res
.
filter
((
item
)
=>
item
.
CSR
!==
null
);
}
...
...
@@ -250,7 +252,7 @@ export class CertificatesDashComponent implements OnInit {
icon
:
'
save_alt
'
,
name
:
'
download
'
,
onClick
:
(
rowinner
:
any
)
=>
{
onClick
:
(
rowinner
:
Certificate
)
=>
{
const
path
=
rowinner
.
CSR
?
rowinner
.
csr_path
:
rowinner
.
certificate_path
;
const
fileName
=
rowinner
.
name
+
'
.crt
'
;
// what about for a csr?
this
.
ws
.
call
(
'
core.download
'
,
[
'
filesystem.get
'
,
[
path
],
fileName
]).
pipe
(
untilDestroyed
(
this
)).
subscribe
(
...
...
@@ -294,13 +296,13 @@ export class CertificatesDashComponent implements OnInit {
return
this
.
downloadActions
;
}
csrActions
():
AppTableAction
[]
{
csrActions
():
AppTableAction
<
Certificate
>
[]
{
const
csrRowActions
=
[...
this
.
downloadActions
];
const
acmeAction
=
{
icon
:
'
build
'
,
name
:
'
create_ACME
'
,
matTooltip
:
T
(
'
Create ACME Certificate
'
),
onClick
:
(
rowinner
:
any
)
=>
{
onClick
:
(
rowinner
:
Certificate
)
=>
{
this
.
modalService
.
open
(
'
slide-in-form
'
,
this
.
acmeAddComponent
,
rowinner
.
id
);
event
.
stopPropagation
();
},
...
...
@@ -309,13 +311,13 @@ export class CertificatesDashComponent implements OnInit {
return
csrRowActions
;
}
caActions
():
AppTableAction
[]
{
caActions
():
AppTableAction
<
CertificateAuthority
>
[]
{
const
caRowActions
=
[...
this
.
downloadActions
];
const
acmeAction
=
{
icon
:
'
beenhere
'
,
name
:
'
sign_CSR
'
,
matTooltip
:
helptext_system_ca
.
list
.
action_sign
,
onClick
:
(
rowinner
:
an
y
)
=>
{
onClick
:
(
rowinner
:
CertificateAuthorit
y
)
=>
{
this
.
dialogService
.
dialogForm
(
this
.
signCSRFormConf
);
this
.
caId
=
rowinner
.
id
;
event
.
stopPropagation
();
...
...
@@ -325,7 +327,7 @@ export class CertificatesDashComponent implements OnInit {
return
caRowActions
;
}
openForm
(
component
:
any
,
id
:
any
):
void
{
openForm
(
component
:
CertificateAcmeAddComponent
,
id
:
any
):
void
{
setTimeout
(()
=>
{
this
.
modalService
.
open
(
'
slide-in-form
'
,
component
,
id
);
},
200
);
...
...
This diff is collapsed.
Click to expand it.
src/app/pages/data-protection/cloudsync/cloudsync-form/cloudsync-form.component.ts
View file @
e7e0aabc
...
...
@@ -3,6 +3,7 @@ import { FormGroup, Validators } from '@angular/forms';
import
{
MatDialog
}
from
'
@angular/material/dialog
'
;
import
{
Router
,
ActivatedRoute
}
from
'
@angular/router
'
;
import
{
UntilDestroy
,
untilDestroyed
}
from
'
@ngneat/until-destroy
'
;
import
{
TreeNode
}
from
'
angular-tree-component
'
;
import
*
as
filesize
from
'
filesize
'
;
import
*
as
_
from
'
lodash
'
;
import
{
Observable
}
from
'
rxjs
'
;
...
...
@@ -465,7 +466,7 @@ export class CloudsyncFormComponent implements FormConfiguration {
return
this
.
ws
.
call
(
'
cloudsync.list_buckets
'
,
[
credential
.
id
]);
}
getChildren
(
node
:
any
):
Promise
<
Promise
<
any
>>
{
getChildren
(
node
:
TreeNode
):
Promise
<
Promise
<
any
>>
{
const
credential
=
this
.
formGroup
.
controls
[
'
credentials
'
].
value
;
let
bucket
=
this
.
formGroup
.
controls
[
'
bucket
'
].
value
;
if
(
this
.
bucket_field
.
disabled
)
{
...
...
@@ -490,7 +491,7 @@ export class CloudsyncFormComponent implements FormConfiguration {
}
}
getBucketFolders
(
credential
:
string
,
bucket
:
string
,
node
:
any
):
Promise
<
any
>
{
getBucketFolders
(
credential
:
string
,
bucket
:
string
,
node
:
TreeNode
):
Promise
<
any
>
{
const
formValue
=
this
.
entityForm
.
formGroup
.
value
;
const
children
:
any
[]
=
[];
const
data
=
{
...
...
@@ -606,8 +607,8 @@ export class CloudsyncFormComponent implements FormConfiguration {
this
.
bucket_input_field
=
this
.
fieldSets
.
config
(
'
bucket_input
'
);
this
.
setDisabled
(
'
bucket
'
,
true
,
true
);
this
.
setDisabled
(
'
bucket_input
'
,
true
,
true
);
this
.
cloudcredentialService
.
getCloudsyncCredentials
().
then
((
credentials
:
any
)
=>
{
credentials
.
forEach
((
item
:
any
)
=>
{
this
.
cloudcredentialService
.
getCloudsyncCredentials
().
then
((
credentials
)
=>
{
credentials
.
forEach
((
item
)
=>
{
this
.
credentials
.
options
.
push
({
label
:
item
.
name
+
'
(
'
+
item
.
provider
+
'
)
'
,
value
:
item
.
id
});
this
.
credentials_list
.
push
(
item
);
});
...
...
@@ -654,7 +655,7 @@ export class CloudsyncFormComponent implements FormConfiguration {
}
});
this
.
formGroup
.
get
(
'
path_source
'
).
valueChanges
.
pipe
(
untilDestroyed
(
this
)).
subscribe
((
values
:
any
)
=>
{
this
.
formGroup
.
get
(
'
path_source
'
).
valueChanges
.
pipe
(
untilDestroyed
(
this
)).
subscribe
((
values
:
string
|
string
[]
)
=>
{
if
(
!
values
)
{
return
;
}
...
...
This diff is collapsed.
Click to expand it.
src/app/pages/data-protection/components/data-protection-dashboard/data-protection-dashboard.component.ts
View file @
e7e0aabc
...
...
@@ -29,7 +29,7 @@ import { DialogFormConfiguration } from 'app/pages/common/entity/entity-dialog/d
import
{
EntityDialogComponent
}
from
'
app/pages/common/entity/entity-dialog/entity-dialog.component
'
;
import
{
EntityFormService
}
from
'
app/pages/common/entity/entity-form/services/entity-form.service
'
;
import
{
EntityJobComponent
}
from
'
app/pages/common/entity/entity-job/entity-job.component
'
;
import
{
AppTableAction
,
Input
TableConf
}
from
'
app/pages/common/entity/table/table.component
'
;
import
{
AppTableAction
,
App
TableConf
ig
}
from
'
app/pages/common/entity/table/table.component
'
;
import
{
EntityUtils
}
from
'
app/pages/common/entity/utils
'
;
import
{
CloudsyncFormComponent
}
from
'
app/pages/data-protection/cloudsync/cloudsync-form/cloudsync-form.component
'
;
import
{
ReplicationFormComponent
}
from
'
app/pages/data-protection/replication/replication-form/replication-form.component
'
;
...
...
@@ -55,7 +55,7 @@ import { T } from 'app/translate-marker';
export
interface
TaskCard
{
name
:
string
;
tableConf
:
Input
TableConf
;
tableConf
:
App
TableConf
ig
;
}
enum
TaskCardId
{
...
...
This diff is collapsed.
Click to expand it.
src/app/pages/directory-service/active-directory/active-directory.component.ts
View file @
e7e0aabc
...
...
@@ -368,7 +368,7 @@ export class ActiveDirectoryComponent implements FormConfiguration {
_
.
find
(
this
.
fieldConfig
,
{
name
:
'
bindpw
'
})[
'
required
'
]
=
res
;
});
entityEdit
.
formGroup
.
controls
[
'
kerberos_principal
'
].
valueChanges
.
pipe
(
untilDestroyed
(
this
)).
subscribe
((
res
:
any
)
=>
{
entityEdit
.
formGroup
.
controls
[
'
kerberos_principal
'
].
valueChanges
.
pipe
(
untilDestroyed
(
this
)).
subscribe
((
res
:
string
)
=>
{
if
(
res
)
{
entityEdit
.
setDisabled
(
'
bindname
'
,
true
);
entityEdit
.
setDisabled
(
'
bindpw
'
,
true
);
...
...
This diff is collapsed.
Click to expand it.
src/app/pages/directory-service/directory-services.component.ts
View file @
e7e0aabc
...
...
@@ -6,7 +6,7 @@ import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import
helptext
from
'
app/helptext/directory-service/dashboard
'
;
import
idmapHelptext
from
'
app/helptext/directory-service/idmap
'
;
import
{
EmptyType
}
from
'
app/pages/common/entity/entity-empty/entity-empty.component
'
;
import
{
Input
TableConf
}
from
'
app/pages/common/entity/table/table.component
'
;
import
{
App
TableConf
ig
}
from
'
app/pages/common/entity/table/table.component
'
;
import
{
ActiveDirectoryComponent
}
from
'
app/pages/directory-service/active-directory/active-directory.component
'
;
import
{
KerberosKeytabsFormComponent
}
from
'
app/pages/directory-service/kerberos-keytabs/kerberos-keytabs-form.component
'
;
import
{
KerberosRealmsFormComponent
}
from
'
app/pages/directory-service/kerberos-realms/kerberos-realms-form.component
'
;
...
...
@@ -51,7 +51,7 @@ export class DirectoryServicesComponent implements OnInit {
message
:
T
(
'
To configure sysctls, click the "Add" button.
'
),
};
idmapTableConf
:
Input
TableConf
=
{
idmapTableConf
:
App
TableConf
ig
=
{
title
:
helptext
.
idmap
.
title
,
titleHref
:
'
/directoryservice/idmap
'
,
queryCall
:
'
idmap.query
'
,
...
...
@@ -80,7 +80,7 @@ export class DirectoryServicesComponent implements OnInit {
},
};
kerberosRealmsTableConf
:
Input
TableConf
=
{
kerberosRealmsTableConf
:
App
TableConf
ig
=
{
title
:
helptext
.
kerberosRealms
.
title
,
titleHref
:
'
/directoryservice/kerberosrealms
'
,
queryCall
:
'
kerberos.realm.query
'
,
...
...
@@ -105,7 +105,7 @@ export class DirectoryServicesComponent implements OnInit {
},
};
kerberosKeytabTableConf
:
Input
TableConf
=
{
kerberosKeytabTableConf
:
App
TableConf
ig
=
{
title
:
helptext
.
kerberosKeytab
.
title
,
titleHref
:
'
/directoryservice/kerberoskeytabs
'
,
queryCall
:
'
kerberos.keytab.query
'
,
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
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
Menu
Projects
Groups
Snippets
Help