1
1
import { Action } from '@ngrx/store' ;
2
+ import { GitBranch , GitSCM } from '@stratosui/git' ;
2
3
3
- import { PaginatedAction } from '../../../store/src/types/pagination.types' ;
4
- import { EntityRequestAction } from '../../../store/src/types/request.types' ;
5
- import { gitBranchesEntityType , gitCommitEntityType } from '../cf-entity-types' ;
6
- import { CF_ENDPOINT_TYPE } from '../cf-types' ;
7
- import { GitSCM } from '../shared/data-services/scm/scm' ;
8
4
import { DockerAppDetails , GitAppDetails , OverrideAppDetails , SourceType } from '../store/types/deploy-application.types' ;
9
- import { GitBranch , GitCommit } from '../store/types/git.types' ;
10
5
11
6
export const SET_APP_SOURCE_DETAILS = '[Deploy App] Application Source' ;
12
7
export const CHECK_PROJECT_EXISTS = '[Deploy App] Check Project exists' ;
13
8
export const PROJECT_DOESNT_EXIST = '[Deploy App] Project Doesn\'t exist' ;
14
9
export const PROJECT_FETCH_FAILED = '[Deploy App] Project Fetch Failed' ;
15
10
export const PROJECT_EXISTS = '[Deploy App] Project exists' ;
16
- export const FETCH_BRANCHES_FOR_PROJECT = '[Deploy App] Fetch branches' ;
17
- export const FETCH_BRANCH_FOR_PROJECT = '[Deploy App] Fetch branch' ;
18
11
export const SAVE_APP_DETAILS = '[Deploy App] Save app details' ;
19
12
export const SAVE_APP_OVERRIDE_DETAILS = '[Deploy App] Save app override details' ;
20
- export const FETCH_COMMIT = '[Deploy App] Fetch commit' ;
21
- export const FETCH_COMMITS = '[Deploy App] Fetch commits' ;
22
13
export const SET_DEPLOY_CF_SETTINGS = '[Deploy App] Set CF Settings' ;
23
14
export const DELETE_DEPLOY_APP_SECTION = '[Deploy App] Delete section' ;
24
15
export const SET_BRANCH = '[Deploy App] Set branch' ;
25
16
export const SET_DEPLOY_BRANCH = '[Deploy App] Set deploy branch' ;
26
17
export const SET_DEPLOY_COMMIT = '[Deploy App] Set deploy commit' ;
27
18
export const DELETE_COMMIT = '[Deploy App] Delete commit' ;
28
19
29
- export const FETCH_BRANCH_START = '[GitHub] Fetch branch start' ;
30
- export const FETCH_BRANCH_SUCCESS = '[GitHub] Fetch branch succeeded' ;
31
- export const FETCH_BRANCH_FAILED = '[GitHub] Fetch branch failed' ;
32
-
33
- export const FETCH_BRANCHES_START = '[GitHub] Fetch branches start' ;
34
- export const FETCH_BRANCHES_SUCCESS = '[GitHub] Fetch branches succeeded' ;
35
- export const FETCH_BRANCHES_FAILED = '[GitHub] Fetch branches failed' ;
36
-
37
20
export class SetAppSourceDetails implements Action {
38
21
constructor ( public sourceType : SourceType ) { }
39
22
type = SET_APP_SOURCE_DETAILS ;
@@ -59,38 +42,6 @@ export class ProjectExists implements Action {
59
42
type = PROJECT_EXISTS ;
60
43
}
61
44
62
- export class FetchBranchForProject implements EntityRequestAction {
63
- constructor ( public scm : GitSCM , public projectName : string , public guid : string , public branchName : string ) {
64
- this . guid = this . guid || `${ scm . getType ( ) } -${ this . projectName } -${ this . branchName } ` ;
65
- }
66
- actions = [
67
- FETCH_BRANCH_START ,
68
- FETCH_BRANCH_SUCCESS ,
69
- FETCH_BRANCH_FAILED
70
- ] ;
71
- public endpointType = CF_ENDPOINT_TYPE ;
72
- type = FETCH_BRANCH_FOR_PROJECT ;
73
- entityType = gitBranchesEntityType ;
74
- }
75
-
76
- export class FetchBranchesForProject implements PaginatedAction {
77
- constructor ( public scm : GitSCM , public projectName : string ) {
78
- this . paginationKey = FetchBranchesForProject . createPaginationKey ( scm , projectName ) ;
79
- }
80
- actions = [
81
- FETCH_BRANCHES_START ,
82
- FETCH_BRANCHES_SUCCESS ,
83
- FETCH_BRANCHES_FAILED
84
- ] ;
85
- public endpointType = CF_ENDPOINT_TYPE ;
86
- type = FETCH_BRANCHES_FOR_PROJECT ;
87
- entityType = gitBranchesEntityType ;
88
- paginationKey : string ;
89
- flattenPagination = true ;
90
-
91
- static createPaginationKey = ( scm : GitSCM , projectName : string ) => scm . getType ( ) + ':' + projectName ;
92
- }
93
-
94
45
export class SaveAppDetails implements Action {
95
46
constructor ( public git : GitAppDetails , public docker : DockerAppDetails ) { }
96
47
type = SAVE_APP_DETAILS ;
@@ -101,39 +52,6 @@ export class SaveAppOverrides implements Action {
101
52
type = SAVE_APP_OVERRIDE_DETAILS ;
102
53
}
103
54
104
- export class FetchCommit implements EntityRequestAction {
105
- commit : GitCommit ;
106
- public endpointType = CF_ENDPOINT_TYPE ;
107
- constructor ( public scm : GitSCM , public commitSha : string , public projectName : string ) { }
108
- type = FETCH_COMMIT ;
109
- entityType = gitCommitEntityType ;
110
- }
111
-
112
- export class FetchCommits implements PaginatedAction {
113
-
114
- /**
115
- * Creates an instance of FetchCommits.
116
- * @param projectName For example `cloudfoundry-incubator/stratos`
117
- * @param sha Branch name, tag, etc
118
- */
119
- constructor ( public scm : GitSCM , public projectName : string , public sha : string ) {
120
- this . paginationKey = scm . getType ( ) + projectName + sha ;
121
- }
122
- actions = [
123
- '[Deploy App] Fetch commits start' ,
124
- '[Deploy App] Fetch commits success' ,
125
- '[Deploy App] Fetch commits failed' ,
126
- ] ;
127
- public endpointType = CF_ENDPOINT_TYPE ;
128
- type = FETCH_COMMITS ;
129
- entityType = gitCommitEntityType ;
130
- paginationKey : string ;
131
- initialParams = {
132
- 'order-direction' : 'asc' ,
133
- 'order-direction-field' : 'date' ,
134
- } ;
135
- }
136
-
137
55
export class StoreCFSettings implements Action {
138
56
constructor ( public cloudFoundryDetails : any ) { }
139
57
type = SET_DEPLOY_CF_SETTINGS ;
0 commit comments