Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alfa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OZG-Cloud
app
alfa
Commits
e485b696
Commit
e485b696
authored
3 years ago
by
OZGCloud
Browse files
Options
Downloads
Patches
Plain Diff
move retry-in-time-dialog to own file
parent
71365233
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
goofy-client/libs/ui/src/lib/ui/dialog/dialog.service.ts
+6
-45
6 additions, 45 deletions
goofy-client/libs/ui/src/lib/ui/dialog/dialog.service.ts
goofy-client/libs/ui/src/lib/ui/dialog/retry-in-time.dialog.ts
+44
-0
44 additions, 0 deletions
...-client/libs/ui/src/lib/ui/dialog/retry-in-time.dialog.ts
with
50 additions
and
45 deletions
goofy-client/libs/ui/src/lib/ui/dialog/dialog.service.ts
+
6
−
45
View file @
e485b696
import
{
NoopScrollStrategy
}
from
'
@angular/cdk/overlay
'
;
import
{
ComponentType
}
from
"
@angular/cdk/portal
"
;
import
{
ComponentType
}
from
"
@angular/cdk/portal
"
;
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
MatDialog
,
MatDialogConfig
,
MatDialogRef
}
from
'
@angular/material/dialog
'
;
import
{
MatDialog
,
MatDialogConfig
,
MatDialogRef
}
from
'
@angular/material/dialog
'
;
import
{
ApiError
}
from
"
@goofy-client/tech-shared
"
;
import
{
ApiError
}
from
"
@goofy-client/tech-shared
"
;
import
{
FixedDialogComponent
}
from
"
@goofy-client/ui
"
;
import
{
FixedDialogComponent
}
from
"
@goofy-client/ui
"
;
import
{
ConnectionTimeoutRetryDialogComponent
}
from
"
../http-error-dialog/connection-timeout-retry-dialog/connection-timeout-retry-dialog.component
"
;
import
{
ConnectionTimeoutRetryFailDialogComponent
}
from
"
../http-error-dialog/connection-timeout-retry-fail-dialog/connection-timeout-retry-fail-dialog.component
"
;
import
{
InternalServerErrorDialogComponent
}
from
"
../notification/internal-server-error-dialog/internal-server-error-dialog.component
"
;
import
{
InternalServerErrorDialogComponent
}
from
"
../notification/internal-server-error-dialog/internal-server-error-dialog.component
"
;
import
{
NoopScrollStrategy
}
from
'
@angular/cdk/overlay
'
;
import
{
RetryInTimeDialog
}
from
'
./retry-in-time.dialog
'
;
@
Injectable
({
providedIn
:
'
root
'
})
@
Injectable
({
providedIn
:
'
root
'
})
export
class
DialogService
{
export
class
DialogService
{
...
@@ -42,52 +41,14 @@ export class DialogService {
...
@@ -42,52 +41,14 @@ export class DialogService {
}
}
public
getRetryDialog
():
RetryInTimeDialog
{
public
getRetryDialog
():
RetryInTimeDialog
{
return
new
RetryInTimeDialog
(
this
,
this
.
dialog
);
return
new
RetryInTimeDialog
(
this
);
}
}
public
closeAll
():
void
{
public
closeAll
():
void
{
this
.
dialog
.
closeAll
();
this
.
dialog
.
closeAll
();
}
}
}
export
class
RetryInTimeDialog
{
readonly
RETRY_DIALOG_CONFIG
=
{
disableClose
:
true
};
private
readonly
retryTime
=
300000
;
private
startTime
:
number
;
constructor
(
private
dialogService
:
DialogService
,
private
dialog
:
MatDialog
)
{
}
public
show
():
void
{
this
.
startTimer
();
this
.
open
();
}
private
startTimer
():
void
{
public
closeById
(
dialogId
:
string
):
void
{
this
.
startTime
=
new
Date
().
getTime
();
this
.
dialog
.
getDialogById
(
dialogId
).
close
();
}
private
open
():
void
{
this
.
dialogService
.
open
(
ConnectionTimeoutRetryDialogComponent
,
this
.
RETRY_DIALOG_CONFIG
);
}
public
shouldRetry
():
boolean
{
if
(
this
.
isTimeOver
())
{
this
.
finish
();
return
false
;
}
return
true
;
}
private
isTimeOver
():
boolean
{
return
new
Date
().
getTime
()
>
(
this
.
startTime
+
this
.
retryTime
);
}
private
finish
():
void
{
this
.
dialog
.
closeAll
();
this
.
dialogService
.
open
(
ConnectionTimeoutRetryFailDialogComponent
);
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
goofy-client/libs/ui/src/lib/ui/dialog/retry-in-time.dialog.ts
0 → 100644
+
44
−
0
View file @
e485b696
import
{
DialogService
}
from
"
@goofy-client/ui
"
;
import
{
ConnectionTimeoutRetryDialogComponent
}
from
"
../http-error-dialog/connection-timeout-retry-dialog/connection-timeout-retry-dialog.component
"
;
import
{
ConnectionTimeoutRetryFailDialogComponent
}
from
"
../http-error-dialog/connection-timeout-retry-fail-dialog/connection-timeout-retry-fail-dialog.component
"
;
export
class
RetryInTimeDialog
{
public
static
ID
=
'
RETRY_DIALOG_ID
'
;
readonly
RETRY_DIALOG_CONFIG
=
{
disableClose
:
true
,
id
:
RetryInTimeDialog
.
ID
};
private
readonly
retryTime
=
60000
;
// = 1min
private
startTime
:
number
;
constructor
(
private
dialogService
:
DialogService
)
{
}
public
show
():
void
{
this
.
startTimer
();
this
.
open
();
}
private
startTimer
():
void
{
this
.
startTime
=
new
Date
().
getTime
();
}
private
open
():
void
{
this
.
dialogService
.
open
(
ConnectionTimeoutRetryDialogComponent
,
this
.
RETRY_DIALOG_CONFIG
);
}
public
shouldRetry
():
boolean
{
return
!
this
.
isTimeOver
();
}
private
isTimeOver
():
boolean
{
return
new
Date
().
getTime
()
>
(
this
.
startTime
+
this
.
retryTime
);
}
public
finish
():
void
{
this
.
dialogService
.
closeById
(
RetryInTimeDialog
.
ID
);
this
.
dialogService
.
open
(
ConnectionTimeoutRetryFailDialogComponent
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment