Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move git tools and some components into their own package #4752

Merged
merged 8 commits into from
Nov 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,34 @@
}
}
}
},
"git": {
"root": "src/frontend/packages/git",
"sourceRoot": "src/frontend/packages/git/src",
"projectType": "library",
"prefix": "lib",
"architect": {
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/frontend/packages/git/src/test.ts",
"tsConfig": "src/frontend/packages/git/tsconfig.spec.json",
"karmaConfig": "src/frontend/packages/git/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.json"
],
"tslintConfig": "src/frontend/packages/git/tslint.json",
"files": [
"src/frontend/packages/git/src/**/*.ts"
]
}
}
}
}

},
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"test-frontend:cloud-foundry": "NG_TEST_SUITE=cloud-foundry ng test cloud-foundry --code-coverage --watch=false",
"test-frontend:cf-autoscaler": "NG_TEST_SUITE=autoscaler ng test cf-autoscaler --code-coverage --watch=false",
"test-frontend:kubernetes": "NG_TEST_SUITE=kubernetes ng test kubernetes --code-coverage --watch=false",
"test-frontend:git": "NG_TEST_SUITE=git ng test git --code-coverage --watch=false",
"posttest": "nyc report --reporter=html --reporter=lcovonly --reporter=json --tempDir=coverage/nyc",
"codecov": "codecov -f coverage/coverage-final.json -F frontend",
"lint": "ng lint --format stylish",
Expand Down

This file was deleted.

5 changes: 3 additions & 2 deletions src/frontend/packages/cloud-foundry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^6.0.0-rc.0 || ^6.0.0",
"@angular/core": "^6.0.0-rc.0 || ^6.0.0"
"@angular/core": "^6.0.0-rc.0 || ^6.0.0",
"@stratosui/git": "^0.0.1"
},
"stratos": {
"module": "CloudFoundryPackageModule",
"routingModule": "CloudFoundryRoutingModule",
"theming": "sass/_all-theme#apply-theme-stratos-cloud-foundry",
"backend": [ "cloudfoundry", "cfapppush", "cfappssh", "userinvite" ]
"backend": ["cloudfoundry", "cfapppush", "cfappssh", "userinvite"]
}
}
Original file line number Diff line number Diff line change
@@ -1,39 +1,22 @@
import { Action } from '@ngrx/store';
import { GitBranch, GitSCM } from '@stratosui/git';

import { PaginatedAction } from '../../../store/src/types/pagination.types';
import { EntityRequestAction } from '../../../store/src/types/request.types';
import { gitBranchesEntityType, gitCommitEntityType } from '../cf-entity-types';
import { CF_ENDPOINT_TYPE } from '../cf-types';
import { GitSCM } from '../shared/data-services/scm/scm';
import { DockerAppDetails, GitAppDetails, OverrideAppDetails, SourceType } from '../store/types/deploy-application.types';
import { GitBranch, GitCommit } from '../store/types/git.types';

export const SET_APP_SOURCE_DETAILS = '[Deploy App] Application Source';
export const CHECK_PROJECT_EXISTS = '[Deploy App] Check Project exists';
export const PROJECT_DOESNT_EXIST = '[Deploy App] Project Doesn\'t exist';
export const PROJECT_FETCH_FAILED = '[Deploy App] Project Fetch Failed';
export const PROJECT_EXISTS = '[Deploy App] Project exists';
export const FETCH_BRANCHES_FOR_PROJECT = '[Deploy App] Fetch branches';
export const FETCH_BRANCH_FOR_PROJECT = '[Deploy App] Fetch branch';
export const SAVE_APP_DETAILS = '[Deploy App] Save app details';
export const SAVE_APP_OVERRIDE_DETAILS = '[Deploy App] Save app override details';
export const FETCH_COMMIT = '[Deploy App] Fetch commit';
export const FETCH_COMMITS = '[Deploy App] Fetch commits';
export const SET_DEPLOY_CF_SETTINGS = '[Deploy App] Set CF Settings';
export const DELETE_DEPLOY_APP_SECTION = '[Deploy App] Delete section';
export const SET_BRANCH = '[Deploy App] Set branch';
export const SET_DEPLOY_BRANCH = '[Deploy App] Set deploy branch';
export const SET_DEPLOY_COMMIT = '[Deploy App] Set deploy commit';
export const DELETE_COMMIT = '[Deploy App] Delete commit';

export const FETCH_BRANCH_START = '[GitHub] Fetch branch start';
export const FETCH_BRANCH_SUCCESS = '[GitHub] Fetch branch succeeded';
export const FETCH_BRANCH_FAILED = '[GitHub] Fetch branch failed';

export const FETCH_BRANCHES_START = '[GitHub] Fetch branches start';
export const FETCH_BRANCHES_SUCCESS = '[GitHub] Fetch branches succeeded';
export const FETCH_BRANCHES_FAILED = '[GitHub] Fetch branches failed';

export class SetAppSourceDetails implements Action {
constructor(public sourceType: SourceType) { }
type = SET_APP_SOURCE_DETAILS;
Expand All @@ -59,38 +42,6 @@ export class ProjectExists implements Action {
type = PROJECT_EXISTS;
}

export class FetchBranchForProject implements EntityRequestAction {
constructor(public scm: GitSCM, public projectName: string, public guid: string, public branchName: string) {
this.guid = this.guid || `${scm.getType()}-${this.projectName}-${this.branchName}`;
}
actions = [
FETCH_BRANCH_START,
FETCH_BRANCH_SUCCESS,
FETCH_BRANCH_FAILED
];
public endpointType = CF_ENDPOINT_TYPE;
type = FETCH_BRANCH_FOR_PROJECT;
entityType = gitBranchesEntityType;
}

export class FetchBranchesForProject implements PaginatedAction {
constructor(public scm: GitSCM, public projectName: string) {
this.paginationKey = FetchBranchesForProject.createPaginationKey(scm, projectName);
}
actions = [
FETCH_BRANCHES_START,
FETCH_BRANCHES_SUCCESS,
FETCH_BRANCHES_FAILED
];
public endpointType = CF_ENDPOINT_TYPE;
type = FETCH_BRANCHES_FOR_PROJECT;
entityType = gitBranchesEntityType;
paginationKey: string;
flattenPagination = true;

static createPaginationKey = (scm: GitSCM, projectName: string) => scm.getType() + ':' + projectName;
}

export class SaveAppDetails implements Action {
constructor(public git: GitAppDetails, public docker: DockerAppDetails) { }
type = SAVE_APP_DETAILS;
Expand All @@ -101,39 +52,6 @@ export class SaveAppOverrides implements Action {
type = SAVE_APP_OVERRIDE_DETAILS;
}

export class FetchCommit implements EntityRequestAction {
commit: GitCommit;
public endpointType = CF_ENDPOINT_TYPE;
constructor(public scm: GitSCM, public commitSha: string, public projectName: string) { }
type = FETCH_COMMIT;
entityType = gitCommitEntityType;
}

export class FetchCommits implements PaginatedAction {

/**
* Creates an instance of FetchCommits.
* @param projectName For example `cloudfoundry-incubator/stratos`
* @param sha Branch name, tag, etc
*/
constructor(public scm: GitSCM, public projectName: string, public sha: string) {
this.paginationKey = scm.getType() + projectName + sha;
}
actions = [
'[Deploy App] Fetch commits start',
'[Deploy App] Fetch commits success',
'[Deploy App] Fetch commits failed',
];
public endpointType = CF_ENDPOINT_TYPE;
type = FETCH_COMMITS;
entityType = gitCommitEntityType;
paginationKey: string;
initialParams = {
'order-direction': 'asc',
'order-direction-field': 'date',
};
}

export class StoreCFSettings implements Action {
constructor(public cloudFoundryDetails: any) { }
type = SET_DEPLOY_CF_SETTINGS;
Expand Down
16 changes: 0 additions & 16 deletions src/frontend/packages/cloud-foundry/src/actions/github.actions.ts

This file was deleted.

26 changes: 0 additions & 26 deletions src/frontend/packages/cloud-foundry/src/cf-entity-catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ import { CfEventActionBuilders } from './entity-action-builders/cf-event.action-
import { CfInfoDefinitionActionBuilders } from './entity-action-builders/cf-info.action-builders';
import { DomainActionBuilders } from './entity-action-builders/domin.action-builder';
import { FeatureFlagActionBuilders } from './entity-action-builders/feature-flag.action-builder';
import {
GitBranchActionBuilders,
GitCommitActionBuilders,
GitCommitActionBuildersConfig,
GitRepoActionBuilders,
} from './entity-action-builders/git-action-builder';
import { OrganizationActionBuilders } from './entity-action-builders/organization.action-builders';
import { QuotaDefinitionActionBuilder } from './entity-action-builders/quota-definition.action-builders';
import { RoutesActionBuilders } from './entity-action-builders/routes.action-builder';
Expand All @@ -62,7 +56,6 @@ import { UserProvidedServiceActionBuilder } from './entity-action-builders/user-
import { UserActionBuilders } from './entity-action-builders/user.action-builders';
import { AppStat } from './store/types/app-metadata.types';
import { CfUser } from './store/types/cf-user.types';
import { GitBranch, GitCommit, GitRepo } from './store/types/git.types';

/**
* A strongly typed collection of Cloud Foundry Catalog Entities.
Expand Down Expand Up @@ -172,25 +165,6 @@ export class CfEntityCatalog {
DomainActionBuilders
>;

public gitCommit: StratosBaseCatalogEntity<
IBasicCFMetaData,
GitCommit,
GitCommitActionBuildersConfig,
GitCommitActionBuilders
>;

public gitRepo: StratosBaseCatalogEntity<
IBasicCFMetaData,
GitRepo,
GitRepoActionBuilders
>;

public gitBranch: StratosBaseCatalogEntity<
IBasicCFMetaData,
GitBranch,
GitBranchActionBuilders
>;

public event: StratosBaseCatalogEntity<
IBasicCFMetaData,
APIResource<CfEvent>,
Expand Down
14 changes: 1 addition & 13 deletions src/frontend/packages/cloud-foundry/src/cf-entity-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ import {
cfUserEntityType,
domainEntityType,
featureFlagEntityType,
gitBranchesEntityType,
gitCommitEntityType,
gitRepoEntityType,
organizationEntityType,
privateDomainsEntityType,
quotaDefinitionEntityType,
Expand All @@ -49,7 +46,7 @@ import { getAPIResourceGuid } from './store/selectors/api.selectors';
import { CfUser, CfUserRoleParams, OrgUserRoleNames, SpaceUserRoleNames } from './store/types/cf-user.types';

const entityCache: {
[key: string]: EntitySchema
[key: string]: EntitySchema;
} = {};

const AppSummarySchema = new CFEntitySchema(appSummaryEntityType, {}, { idAttribute: 'guid' });
Expand All @@ -61,15 +58,6 @@ entityCache[appStatsEntityType] = AppStatSchema;
const AppEnvVarSchema = new CFEntitySchema(appEnvVarsEntityType, {}, { idAttribute: getAPIResourceGuid });
entityCache[appEnvVarsEntityType] = AppEnvVarSchema;

const GithubBranchSchema = new CFEntitySchema(gitBranchesEntityType, {}, { idAttribute: 'entityId' });
entityCache[gitBranchesEntityType] = GithubBranchSchema;

const GithubRepoSchema = new CFEntitySchema(gitRepoEntityType);
entityCache[gitRepoEntityType] = GithubRepoSchema;

const GithubCommitSchema = new CFEntitySchema(gitCommitEntityType, {}, { idAttribute: commit => commit.guid });
entityCache[gitCommitEntityType] = GithubCommitSchema;

const CFInfoSchema = new CFEntitySchema(cfInfoEntityType);
entityCache[cfInfoEntityType] = CFInfoSchema;

Expand Down
Loading