forked from spinnaker/deck
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider/aws): Functions (listing and searching) (spinnaker#7568)
* . * feat(provider/aws): Function listing and searching functionality This change adds a new tab for functions and facilitates listing existing functions and searching functions listed. Corresponding provider specific changes are included in this change for AWS. Authors: @sidmuls and @nabebe * feat(provider/aws): Function listing and searching functionality This change adds a new tab for functions and facilitates listing existing functions and searching functions listed. Corresponding provider specific changes are included in this change for AWS. Authors: @sidmuls and @nabebe * refactor(provider/aws): Converting Function class component into function component. This is a refactoring change as requested by reviewer @caseyhebebrand Author: @sidmuls * refactor(provider/aws): Refactoring groupings into a separate component. This change is for refactoring requested by reviewer @caseyhebebrand. Author: @sidmuls * refactor(provider/aws): Removing unnecessary state from FunctionGroupings. This change is a refactoring requested by @caseyhebebrand Author: @sidmuls * refactor(provider/aws): removing extra line. Tthis is actually for retrying tests on TravisCI * refactor(provider/aws): Adding tests for FunctionFilterService and changes as requested by @christopherthielen Author: @sidmuls * refactor(provider/aws): removing unnecessary field from IFunction * refactor(provider/aws): adding flag to turn off functions feature
- Loading branch information
1 parent
e49ffaf
commit ca176fc
Showing
31 changed files
with
1,204 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { IFunction } from '@spinnaker/core'; | ||
|
||
export interface IAmazonFunction extends IFunction { | ||
credentials?: string; | ||
role?: string; | ||
runtime: string; | ||
s3bucket: string; | ||
s3key: string; | ||
handler: string; | ||
functionName: string; | ||
publish: boolean; | ||
description: string; | ||
tags: [{}]; | ||
memorySize: number; | ||
timeout: number; | ||
envVariables: {}; | ||
tracingConfig: { | ||
mode: string; | ||
}; | ||
deadLetterConfig: { | ||
targetArn: string; | ||
}; | ||
KMSKeyArn: string; | ||
vpcConfig: { | ||
securityGroupIds: []; | ||
subnetIds: []; | ||
vpcId: string; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { module } from 'angular'; | ||
|
||
export const AWS_FUNCTION_MODULE = 'spinnaker.amazon.function'; | ||
|
||
module(AWS_FUNCTION_MODULE, []); |
7 changes: 7 additions & 0 deletions
7
app/scripts/modules/amazon/src/function/function.transformer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { IAmazonFunction } from 'amazon/domain'; | ||
|
||
export class AwsFunctionTransformer { | ||
public normalizeFunction(functionDef: IAmazonFunction): IAmazonFunction { | ||
return functionDef; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './function.transformer'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { ITaggedEntity } from './ITaggedEntity'; | ||
|
||
export interface IFunctionSourceData { | ||
cloudProvider?: string; | ||
name?: string; | ||
provider?: string; | ||
type?: string; | ||
} | ||
|
||
export interface IFunction extends ITaggedEntity { | ||
account?: string; | ||
cloudProvider?: string; | ||
description?: string; | ||
functionName?: string; | ||
region?: string; | ||
searchField?: string; | ||
type?: string; | ||
vpcId?: string; | ||
vpcName?: string; | ||
} | ||
|
||
export interface IFunctionGroup { | ||
heading: string; | ||
functionDef?: IFunction; | ||
subgroups?: IFunctionGroup[]; | ||
searchField?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import * as React from 'react'; | ||
import { UISref, UISrefActive } from '@uirouter/react'; | ||
import { Application } from 'core/application/application.model'; | ||
import { IFunction } from 'core/domain'; | ||
import { EntityNotifications } from 'core/entityTag/notifications/EntityNotifications'; | ||
|
||
interface IFunctionProps { | ||
application: Application; | ||
functionDef: IFunction; | ||
} | ||
|
||
const Function = (props: IFunctionProps) => { | ||
const { application, functionDef } = props; | ||
const params = { | ||
application: application.name, | ||
region: functionDef.region, | ||
account: functionDef.account, | ||
name: functionDef.functionName, | ||
provider: functionDef.cloudProvider, | ||
}; | ||
return ( | ||
<div className="pod-subgroup function"> | ||
<div className="function-header sticky-header-2"> | ||
<UISrefActive class="active"> | ||
<UISref to=".functionDetails" params={params}> | ||
<h6 className="clickable clickable-row horizontal middle"> | ||
<i className="fas fa-angle-up" /> | ||
{(functionDef.region || '').toUpperCase()} | ||
<div className="flex-1"> | ||
<EntityNotifications | ||
entity={functionDef} | ||
application={application} | ||
placement="bottom" | ||
entityType="function" | ||
pageLocation="pod" | ||
onUpdate={() => application.functions.refresh()} | ||
/> | ||
</div> | ||
</h6> | ||
</UISref> | ||
</UISrefActive> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
export default Function; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import * as React from 'react'; | ||
import { Overridable, IOverridableProps } from 'core/overrideRegistry'; | ||
|
||
export interface IFunctionDetailsProps extends IOverridableProps {} | ||
|
||
@Overridable('function.details') | ||
export class FunctionDetails extends React.Component<IFunctionDetailsProps> { | ||
public render() { | ||
return <h3>Function Details</h3>; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
app/scripts/modules/core/src/function/FunctionGroupings.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import * as React from 'react'; | ||
import { Application } from '@spinnaker/core'; | ||
import { IFunctionGroup } from 'core/domain'; | ||
import { FunctionPod } from './FunctionPod'; | ||
|
||
export interface IFunctionGroupingsProps { | ||
app: Application; | ||
groups: IFunctionGroup[]; | ||
} | ||
export class FunctionGroupings extends React.Component<IFunctionGroupingsProps> { | ||
constructor(props: IFunctionGroupingsProps) { | ||
super(props); | ||
} | ||
public render() { | ||
return ( | ||
<div> | ||
{this.props.groups.map(group => ( | ||
<div key={group.heading} className="rollup"> | ||
{group.subgroups && | ||
group.subgroups.map(subgroup => ( | ||
<FunctionPod | ||
key={subgroup.heading} | ||
grouping={subgroup} | ||
application={this.props.app} | ||
parentHeading={group.heading} | ||
/> | ||
))} | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import * as React from 'react'; | ||
|
||
import { AccountTag } from 'core/account'; | ||
import { Application } from 'core/application/application.model'; | ||
import { IFunctionGroup } from 'core/domain'; | ||
import Function from './Function'; | ||
|
||
import './functionPod.less'; | ||
|
||
export interface IFunctionPodProps { | ||
grouping: IFunctionGroup; | ||
application: Application; | ||
parentHeading: string; | ||
} | ||
|
||
export class FunctionPod extends React.Component<IFunctionPodProps> { | ||
public render(): React.ReactElement<FunctionPod> { | ||
const { grouping, application, parentHeading } = this.props; | ||
const subgroups = grouping.subgroups.map(subgroup => ( | ||
<Function key={subgroup.functionDef.functionName} application={application} functionDef={subgroup.functionDef} /> | ||
)); | ||
|
||
return ( | ||
<div className="load-balancer-pod row rollup-entry sub-group"> | ||
<div className="rollup-summary sticky-header"> | ||
<div className="rollup-title-cell"> | ||
<div className="heading-tag"> | ||
<AccountTag account={parentHeading} /> | ||
</div> | ||
<div className="pod-center horizontal space-between center flex-1"> | ||
<div>{grouping.heading}</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="rollup-details">{subgroups}</div> | ||
</div> | ||
); | ||
} | ||
} |
Oops, something went wrong.