-
Notifications
You must be signed in to change notification settings - Fork 900
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core): Extract server group name previewer into its own comp…
…onent (#8842) refactor(core/serverGroup): Replace server group name preview in angular
- Loading branch information
1 parent
625ba6f
commit a35e8bf
Showing
4 changed files
with
76 additions
and
76 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
55 changes: 55 additions & 0 deletions
55
app/scripts/modules/core/src/serverGroup/configure/common/ServerGroupNamePreview.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,55 @@ | ||
import * as React from 'react'; | ||
|
||
export interface IServerGroupNamePreviewProps { | ||
createsNewCluster: boolean; | ||
latestServerGroupName: string; | ||
mode: string; | ||
namePreview: string; | ||
navigateToLatestServerGroup: () => void; | ||
} | ||
|
||
export const ServerGroupNamePreview = ({ | ||
createsNewCluster, | ||
latestServerGroupName, | ||
mode, | ||
namePreview, | ||
navigateToLatestServerGroup, | ||
}: IServerGroupNamePreviewProps) => { | ||
const showPreviewAsWarning = (mode === 'create' && !createsNewCluster) || (mode !== 'create' && createsNewCluster); | ||
|
||
return ( | ||
<div className="form-group"> | ||
<div className="col-md-12"> | ||
<div className={`well-compact ${showPreviewAsWarning ? 'alert alert-warning' : 'well'}`}> | ||
<h5 className="text-center"> | ||
<p>Your server group will be in the cluster:</p> | ||
<p> | ||
<strong> | ||
{namePreview} | ||
{createsNewCluster && <span> (new cluster)</span>} | ||
</strong> | ||
</p> | ||
{!createsNewCluster && mode === 'create' && latestServerGroupName && ( | ||
<div className="text-left"> | ||
<p>There is already a server group in this cluster. Do you want to clone it?</p> | ||
<p> | ||
Cloning copies the entire configuration from the selected server group, allowing you to modify | ||
whichever fields (e.g. image) you need to change in the new server group. | ||
</p> | ||
<p> | ||
To clone a server group, select "Clone" from the "Server Group Actions" menu in the details view of | ||
the server group. | ||
</p> | ||
<p> | ||
<a className="clickable" onClick={navigateToLatestServerGroup}> | ||
Go to details for {latestServerGroupName} | ||
</a> | ||
</p> | ||
</div> | ||
)} | ||
</h5> | ||
</div> | ||
</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
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