Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CSAN
Csan
Commits
8d9b1e18
Commit
8d9b1e18
authored
Jul 20, 2020
by
AllForNothing
Browse files
Add dry run to gc page
Signed-off-by:
AllForNothing
<
sshijun@vmware.com
>
parent
ee35e1ec
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
63 additions
and
13 deletions
+63
-13
src/portal/src/i18n/lang/en-us-lang.json
src/portal/src/i18n/lang/en-us-lang.json
+2
-1
src/portal/src/i18n/lang/es-es-lang.json
src/portal/src/i18n/lang/es-es-lang.json
+2
-1
src/portal/src/i18n/lang/fr-fr-lang.json
src/portal/src/i18n/lang/fr-fr-lang.json
+2
-1
src/portal/src/i18n/lang/pt-br-lang.json
src/portal/src/i18n/lang/pt-br-lang.json
+2
-1
src/portal/src/i18n/lang/tr-tr-lang.json
src/portal/src/i18n/lang/tr-tr-lang.json
+2
-1
src/portal/src/i18n/lang/zh-cn-lang.json
src/portal/src/i18n/lang/zh-cn-lang.json
+2
-1
src/portal/src/i18n/lang/zh-tw-lang.json
src/portal/src/i18n/lang/zh-tw-lang.json
+2
-1
src/portal/src/lib/components/config/gc/gc-history/gc-history.component.html
...components/config/gc/gc-history/gc-history.component.html
+2
-0
src/portal/src/lib/components/config/gc/gc-history/gc-history.component.spec.ts
...ponents/config/gc/gc-history/gc-history.component.spec.ts
+2
-0
src/portal/src/lib/components/config/gc/gc-history/gc-history.component.ts
...b/components/config/gc/gc-history/gc-history.component.ts
+12
-0
src/portal/src/lib/components/config/gc/gc.component.html
src/portal/src/lib/components/config/gc/gc.component.html
+8
-2
src/portal/src/lib/components/config/gc/gc.component.scss
src/portal/src/lib/components/config/gc/gc.component.scss
+0
-1
src/portal/src/lib/components/config/gc/gc.component.spec.ts
src/portal/src/lib/components/config/gc/gc.component.spec.ts
+1
-0
src/portal/src/lib/components/config/gc/gc.component.ts
src/portal/src/lib/components/config/gc/gc.component.ts
+18
-1
src/portal/src/lib/components/config/gc/gc.service.ts
src/portal/src/lib/components/config/gc/gc.service.ts
+3
-2
src/portal/src/lib/components/config/gc/gc.viewmodel.factory.ts
...rtal/src/lib/components/config/gc/gc.viewmodel.factory.ts
+1
-0
src/portal/src/lib/components/config/gc/gcLog.ts
src/portal/src/lib/components/config/gc/gcLog.ts
+2
-0
No files found.
src/portal/src/i18n/lang/en-us-lang.json
View file @
8d9b1e18
...
...
@@ -1214,7 +1214,8 @@
"MSG_SCHEDULE_RESET"
:
"Garbage Collection schedule has been reset"
,
"PARAMETERS"
:
"Parameters"
,
"DELETE_UNTAGGED"
:
"Allow garbage collection on untagged artifacts"
,
"EXPLAIN"
:
"GC is a compute intensive operation that may impact registry performance"
"EXPLAIN"
:
"GC is a compute intensive operation that may impact registry performance"
,
"DRY_RUN_SUCCESS"
:
"Triggered dry run successfully"
},
"RETAG"
:
{
"MSG_SUCCESS"
:
"Copy artifact successfully"
,
...
...
src/portal/src/i18n/lang/es-es-lang.json
View file @
8d9b1e18
...
...
@@ -1208,7 +1208,8 @@
"MSG_SCHEDULE_RESET"
:
"Garbage Collection schedule has been reset"
,
"PARAMETERS"
:
"Parameters"
,
"DELETE_UNTAGGED"
:
"Allow garbage collection on untagged artifacts"
,
"EXPLAIN"
:
"GC is a compute intensive operation that may impact registry performance"
"EXPLAIN"
:
"GC is a compute intensive operation that may impact registry performance"
,
"DRY_RUN_SUCCESS"
:
"Triggered dry run successfully"
},
"RETAG"
:
{
"MSG_SUCCESS"
:
"Copy artifact successfully"
,
...
...
src/portal/src/i18n/lang/fr-fr-lang.json
View file @
8d9b1e18
...
...
@@ -1178,7 +1178,8 @@
"MSG_SCHEDULE_RESET"
:
"Garbage Collection schedule has been reset"
,
"PARAMETERS"
:
"Parameters"
,
"DELETE_UNTAGGED"
:
"Allow garbage collection on untagged artifacts"
,
"EXPLAIN"
:
"GC is a compute intensive operation that may impact registry performance"
"EXPLAIN"
:
"GC is a compute intensive operation that may impact registry performance"
,
"DRY_RUN_SUCCESS"
:
"Triggered dry run successfully"
},
"RETAG"
:
{
"MSG_SUCCESS"
:
"Copy artifact successfully"
,
...
...
src/portal/src/i18n/lang/pt-br-lang.json
View file @
8d9b1e18
...
...
@@ -1206,7 +1206,8 @@
"MSG_SCHEDULE_RESET"
:
"Agendamento de Garbage Collection foi redefinido"
,
"PARAMETERS"
:
"Parameters"
,
"DELETE_UNTAGGED"
:
"Allow garbage collection on untagged artifacts"
,
"EXPLAIN"
:
"GC is a compute intensive operation that may impact registry performance"
"EXPLAIN"
:
"GC is a compute intensive operation that may impact registry performance"
,
"DRY_RUN_SUCCESS"
:
"Triggered dry run successfully"
},
"RETAG"
:
{
"MSG_SUCCESS"
:
"Copy artifact successfully"
,
...
...
src/portal/src/i18n/lang/tr-tr-lang.json
View file @
8d9b1e18
...
...
@@ -1210,7 +1210,8 @@
"MSG_SCHEDULE_RESET"
:
"Çöp Toplama programı sıfırlandı"
,
"PARAMETERS"
:
"Parameters"
,
"DELETE_UNTAGGED"
:
"Allow garbage collection on untagged artifacts"
,
"EXPLAIN"
:
"GC is a compute intensive operation that may impact registry performance"
"EXPLAIN"
:
"GC is a compute intensive operation that may impact registry performance"
,
"DRY_RUN_SUCCESS"
:
"Triggered dry run successfully"
},
"RETAG"
:
{
"MSG_SUCCESS"
:
"Copy artifact successfully"
,
...
...
src/portal/src/i18n/lang/zh-cn-lang.json
View file @
8d9b1e18
...
...
@@ -1207,7 +1207,8 @@
"MSG_SCHEDULE_RESET"
:
"垃圾回收定时任务已被重置"
,
"PARAMETERS"
:
"参数"
,
"DELETE_UNTAGGED"
:
"允许回收无 tag 的 artifacts"
,
"EXPLAIN"
:
"垃圾回收是一个计算密集型操作,可能会影响仓库性能"
"EXPLAIN"
:
"垃圾回收是一个计算密集型操作,可能会影响仓库性能"
,
"DRY_RUN_SUCCESS"
:
"触发模拟运行成功"
},
"RETAG"
:
{
"MSG_SUCCESS"
:
"Artifact 拷贝成功"
,
...
...
src/portal/src/i18n/lang/zh-tw-lang.json
View file @
8d9b1e18
...
...
@@ -1194,7 +1194,8 @@
"MSG_SCHEDULE_RESET"
:
"垃圾回收定時任務已被重置"
,
"PARAMETERS"
:
"參數"
,
"DELETE_UNTAGGED"
:
"Allow garbage collection on untagged artifacts"
,
"EXPLAIN"
:
"GC is a compute intensive operation that may impact registry performance"
"EXPLAIN"
:
"GC is a compute intensive operation that may impact registry performance"
,
"DRY_RUN_SUCCESS"
:
"Triggered dry run successfully"
},
"RETAG"
:{
"MSG_SUCCESS"
:
"Artifact 拷貝成功"
,
...
...
src/portal/src/lib/components/config/gc/gc-history/gc-history.component.html
View file @
8d9b1e18
...
...
@@ -5,6 +5,7 @@
<clr-datagrid
[clrDgLoading]=
"loading"
>
<clr-dg-column>
{{'GC.JOB_ID' | translate}}
</clr-dg-column>
<clr-dg-column>
{{'GC.TRIGGER_TYPE' | translate}}
</clr-dg-column>
<clr-dg-column>
{{'TAG_RETENTION.DRY_RUN' | translate}}
</clr-dg-column>
<clr-dg-column>
{{'STATUS' | translate}}
</clr-dg-column>
<clr-dg-column>
{{'CREATION_TIME' | translate}}
</clr-dg-column>
<clr-dg-column>
{{'UPDATE_TIME' | translate}}
</clr-dg-column>
...
...
@@ -12,6 +13,7 @@
<clr-dg-row
*ngFor=
"let job of jobs"
[clrDgItem]=
'job'
>
<clr-dg-cell>
{{job.id }}
</clr-dg-cell>
<clr-dg-cell>
{{(job.type ? 'SCHEDULE.'+ job.type.toUpperCase() : '') | translate }}
</clr-dg-cell>
<clr-dg-cell>
{{isDryRun(job?.parameters)}}
</clr-dg-cell>
<clr-dg-cell>
{{job.status.toUpperCase() | translate}}
</clr-dg-cell>
<clr-dg-cell>
{{job.createTime | date:'medium'}}
</clr-dg-cell>
<clr-dg-cell>
{{job.updateTime | date:'medium'}}
</clr-dg-cell>
...
...
src/portal/src/lib/components/config/gc/gc-history/gc-history.component.spec.ts
View file @
8d9b1e18
...
...
@@ -18,6 +18,7 @@ describe('GcHistoryComponent', () => {
job_kind
:
'
manual
'
,
schedule
:
null
,
job_status
:
'
pending
'
,
job_parameters
:
'
{"dry_run":true}
'
,
job_uuid
:
'
abc
'
,
creation_time
:
null
,
update_time
:
null
,
...
...
@@ -29,6 +30,7 @@ describe('GcHistoryComponent', () => {
job_kind
:
'
manual
'
,
schedule
:
null
,
job_status
:
'
finished
'
,
job_parameters
:
'
{"dry_run":true}
'
,
job_uuid
:
'
bcd
'
,
creation_time
:
null
,
update_time
:
null
,
...
...
src/portal/src/lib/components/config/gc/gc-history/gc-history.component.ts
View file @
8d9b1e18
...
...
@@ -9,6 +9,8 @@ const JOB_STATUS = {
PENDING
:
"
pending
"
,
RUNNING
:
"
running
"
};
const
YES
:
string
=
'
Yes
'
;
const
NO
:
string
=
'
No
'
;
@
Component
({
selector
:
'
gc-history
'
,
templateUrl
:
'
./gc-history.component.html
'
,
...
...
@@ -59,6 +61,16 @@ export class GcHistoryComponent implements OnInit, OnDestroy {
});
}
isDryRun
(
param
:
string
):
string
{
if
(
param
)
{
const
paramObj
:
any
=
JSON
.
parse
(
param
);
if
(
paramObj
&&
paramObj
.
dry_run
)
{
return
YES
;
}
}
return
NO
;
}
ngOnDestroy
()
{
if
(
this
.
timerDelay
)
{
this
.
timerDelay
.
unsubscribe
();
...
...
src/portal/src/lib/components/config/gc/gc.component.html
View file @
8d9b1e18
...
...
@@ -21,7 +21,13 @@
</div>
</div>
<div
class=
"clr-row"
>
<button
class=
"btn btn-primary gc-start-btn"
(click)=
"gcNow()"
[disabled]=
"disableGC"
>
{{'GC.GC_NOW' | translate}}
</button>
<div
class=
"clr-col-2 flex-200"
>
<button
class=
"btn btn-primary gc-start-btn"
(click)=
"gcNow()"
[disabled]=
"disableGC"
>
{{'GC.GC_NOW' | translate}}
</button>
</div>
<div
class=
"clr-col"
>
<button
class=
"btn btn-outline gc-start-btn"
(click)=
"dryRun()"
[disabled]=
"dryRunOnGoing"
>
{{'TAG_RETENTION.WHAT_IF_RUN' | translate}}
</button>
</div>
</div>
src/portal/src/lib/components/config/gc/gc.component.scss
View file @
8d9b1e18
...
...
@@ -6,7 +6,6 @@
.gc-start-btn
{
width
:
150px
;
margin-left
:
0
.5rem
;
margin-top
:
35px
;
}
...
...
src/portal/src/lib/components/config/gc/gc.component.spec.ts
View file @
8d9b1e18
...
...
@@ -25,6 +25,7 @@ describe('GcComponent', () => {
id
:
22222
,
schedule
:
null
,
job_status
:
'
string
'
,
job_parameters
:
'
{"dry_run":true}
'
,
creation_time
:
new
Date
().
toDateString
(),
update_time
:
new
Date
().
toDateString
(),
job_name
:
'
string
'
,
...
...
src/portal/src/lib/components/config/gc/gc.component.ts
View file @
8d9b1e18
...
...
@@ -34,6 +34,7 @@ export class GcComponent implements OnInit {
@
ViewChild
(
CronScheduleComponent
,
{
static
:
false
})
CronScheduleComponent
:
CronScheduleComponent
;
shouldDeleteUntagged
:
boolean
;
dryRunOnGoing
:
boolean
=
false
;
constructor
(
private
gcRepoService
:
GcRepoService
,
private
gcViewModelFactory
:
GcViewModelFactory
,
...
...
@@ -90,7 +91,7 @@ export class GcComponent implements OnInit {
this
.
enableGc
();
},
ONE_MINITUE
);
this
.
gcRepoService
.
manualGc
(
this
.
shouldDeleteUntagged
).
subscribe
(
this
.
gcRepoService
.
manualGc
(
this
.
shouldDeleteUntagged
,
false
).
subscribe
(
response
=>
{
this
.
translate
.
get
(
"
GC.MSG_SUCCESS
"
).
subscribe
((
res
:
string
)
=>
{
this
.
errorHandler
.
info
(
res
);
...
...
@@ -102,6 +103,22 @@ export class GcComponent implements OnInit {
);
}
dryRun
()
{
this
.
dryRunOnGoing
=
true
;
this
.
gcRepoService
.
manualGc
(
this
.
shouldDeleteUntagged
,
true
)
.
pipe
(
finalize
(()
=>
this
.
dryRunOnGoing
=
false
))
.
subscribe
(
response
=>
{
this
.
translate
.
get
(
"
GC.DRY_RUN_SUCCESS
"
).
subscribe
((
res
:
string
)
=>
{
this
.
errorHandler
.
info
(
res
);
});
},
error
=>
{
this
.
errorHandler
.
error
(
error
);
}
);
}
private
enableGc
()
{
this
.
disableGC
=
false
;
}
...
...
src/portal/src/lib/components/config/gc/gc.service.ts
View file @
8d9b1e18
...
...
@@ -14,13 +14,14 @@ export class GcRepoService {
private
errorHandler
:
ErrorHandler
)
{
}
public
manualGc
(
shouldDeleteUntagged
:
boolean
):
Observable
<
any
>
{
public
manualGc
(
shouldDeleteUntagged
:
boolean
,
isDryRun
:
boolean
):
Observable
<
any
>
{
const
param
=
{
"
schedule
"
:
{
"
type
"
:
"
Manual
"
},
parameters
:
{
delete_untagged
:
shouldDeleteUntagged
delete_untagged
:
shouldDeleteUntagged
,
dry_run
:
isDryRun
}
};
return
this
.
gcApiRepository
.
postSchedule
(
param
);
...
...
src/portal/src/lib/components/config/gc/gc.viewmodel.factory.ts
View file @
8d9b1e18
...
...
@@ -13,6 +13,7 @@ export class GcViewModelFactory {
id
:
job
.
id
,
type
:
job
.
schedule
?
job
.
schedule
.
type
:
null
,
status
:
job
.
job_status
,
parameters
:
job
.
job_parameters
,
createTime
:
createTime
,
updateTime
:
updateTime
,
details
:
null
...
...
src/portal/src/lib/components/config/gc/gcLog.ts
View file @
8d9b1e18
...
...
@@ -4,6 +4,7 @@ export class GcJobData {
job_kind
:
string
;
schedule
:
Schedule
;
job_status
:
string
;
job_parameters
:
string
;
job_uuid
:
string
;
creation_time
:
string
;
update_time
:
string
;
...
...
@@ -18,6 +19,7 @@ export class GcJobViewModel {
id
:
number
;
type
:
string
;
status
:
string
;
parameters
:
string
;
createTime
:
Date
;
updateTime
:
Date
;
details
:
string
;
...
...
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