-
Notifications
You must be signed in to change notification settings - Fork 906
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
refactor(clusterMatch): tweak cluster match component args, export mo… #4191
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,12 +14,12 @@ export interface ITemplateDescriptionProps { | |
|
||
export class TemplateDescription extends React.Component<ITemplateDescriptionProps> { | ||
public render() { | ||
const { Spinner } = NgReact; | ||
const { LegacySpinner } = NgReact; | ||
return ( | ||
<div className="col-md-12 template-description"> | ||
{this.props.loading && ( | ||
<div className="spinner"> | ||
<Spinner radius={5} width={3} length={8} /> | ||
<LegacySpinner radius={5} width={3} length={8} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potential for new spinner. It is available in react too React: |
||
</div> | ||
)} | ||
{this.props.template && ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,7 +129,7 @@ export class LoadBalancers extends React.Component<ILoadBalancersProps, ILoadBal | |
} | ||
|
||
public render(): React.ReactElement<LoadBalancers> { | ||
const { Spinner, HelpField } = NgReact; | ||
const { LegacySpinner, HelpField } = NgReact; | ||
const groupings = this.state.initialized ? ( | ||
<div> | ||
{ this.state.groups.map((group) => ( | ||
|
@@ -150,7 +150,7 @@ export class LoadBalancers extends React.Component<ILoadBalancersProps, ILoadBal | |
</div> | ||
) : ( | ||
<div> | ||
<h3><Spinner radius={30} width={8} length={16}/></h3> | ||
<h3><LegacySpinner radius={30} width={8} length={16}/></h3> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same. |
||
</div> | ||
); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,7 @@ html { | |
} | ||
color: var(--color-accent); | ||
&:active, &:hover, &:focus, &.active { | ||
color: var(--color-alto); | ||
color: var(--color-primary); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry :( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No worries - we knew there would be some little ones like this. |
||
} | ||
} | ||
.btn-primary { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as React from 'react'; | ||
import { IClusterMatch } from './clusterMatches.component'; | ||
import { NgReact } from 'core/reactShims/ngReact'; | ||
|
||
export interface IClusterMatchesProps { | ||
matches: IClusterMatch[] | ||
} | ||
|
||
export class ClusterMatches extends React.Component<IClusterMatchesProps> { | ||
|
||
public render() { | ||
const { matches } = this.props; | ||
const { AccountTag } = NgReact; | ||
if (!matches || !matches.length) { | ||
return (<div>(no matches)</div>); | ||
} | ||
return ( | ||
<ul className="nostyle"> | ||
{matches.map((match: IClusterMatch, index: number) => ( | ||
<li key={index}> | ||
<AccountTag account={match.account}/> | ||
<span className="break-word">{match.name}</span> | ||
{match.regions && match.regions.length && <i> in {match.regions.join(', ')}</i>} | ||
</li> | ||
))} | ||
</ul> | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,14 @@ | ||
import {module, IComponentOptions} from 'angular'; | ||
import { module } from 'angular'; | ||
import { react2angular } from 'react2angular'; | ||
|
||
import { ClusterMatches } from './ClusterMatches'; | ||
|
||
export interface IClusterMatch { | ||
name: string; | ||
account: string; | ||
regions: string[]; | ||
} | ||
|
||
class ClusterMatchesComponent implements IComponentOptions { | ||
|
||
public bindings: any = { | ||
matches: '=', | ||
index: '=' | ||
}; | ||
public template = ` | ||
<div ng-repeat="match in $ctrl.matches[$ctrl.index]"> | ||
<account-tag account="match.account"></account-tag> | ||
<span class="break-word">{{match.name}}</span> | ||
<i ng-if="match.regions">in {{match.regions.join(', ')}}</i> | ||
</div> | ||
<div ng-if="$ctrl.matches[$ctrl.index].length === 0">(no matches)</div> | ||
`; | ||
} | ||
|
||
export const CLUSTER_MATCHES_COMPONENT = 'spinnaker.core.widget.cluster.clusterMatches.component'; | ||
module(CLUSTER_MATCHES_COMPONENT, []) | ||
.component('clusterMatches', new ClusterMatchesComponent()); | ||
.component('clusterMatches', react2angular(ClusterMatches, ['matches'])); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
export * from './cluster/clusterMatches.component'; | ||
export * from './cluster/ClusterMatches'; | ||
export * from './CustomDropdown'; | ||
export * from './Keys'; | ||
export * from './notifier/notifier.service'; | ||
export * from './Spinner'; | ||
export * from './spinners/Spinner'; | ||
export * from './tags'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to use the new spinners:
React:
Angular:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@archana-s I will leave it for you to convert these to the new spinners. I really just wanted to get the new React Spinner available in the core library build and make it more clear that these are the old spinners and we shouldn't use them.