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

Feat: support independent env management #294

Merged
merged 3 commits into from
Dec 25, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion src/pages/TargetList/components/Namespace/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type Props = {
value?: any;
loadNamespaces: (cluster: string) => void;
disableNew?: boolean;
disabled?: boolean;
};

export interface NamespaceItem {
Expand Down Expand Up @@ -71,7 +72,7 @@ class Namespace extends React.Component<Props, State> {
};

render() {
const { disableNew, onChange, namespaces, value } = this.props;
const { disableNew, onChange, namespaces, value, disabled } = this.props;
const { showNameSpaceInput, loading } = this.state;
return (
<div>
Expand All @@ -81,6 +82,7 @@ class Namespace extends React.Component<Props, State> {
locale={locale.Select}
className="cluster-params-input"
mode="single"
disabled={disabled}
dataSource={namespaces}
onChange={onChange}
placeholder={''}
Expand All @@ -90,6 +92,7 @@ class Namespace extends React.Component<Props, State> {
<Button
className="cluster-option-btn"
type="secondary"
disabled={disabled}
onClick={this.openNamespaceInput}
>
<Translation>New</Translation>
Expand Down
13 changes: 11 additions & 2 deletions src/pages/TargetList/components/TargetDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,15 @@ class DeliveryDialog extends React.Component<Props, State> {
if (cluster) {
listNamespaces({ cluster: cluster }).then((re) => {
if (re && re.list) {
const namespaces = re.list.map((item: any) => {
return { label: item.metadata.name, value: item.metadata.name };
const namespaces: NamespaceItem[] = [];
re.list.map((item: any) => {
if (
item.metadata.annotations &&
barnettZQG marked this conversation as resolved.
Show resolved Hide resolved
item.metadata.annotations['namespace.oam.dev/target']
) {
return;
}
namespaces.push({ label: item.metadata.name, value: item.metadata.name });
});
this.setState({ namespaces: namespaces });
}
Expand Down Expand Up @@ -279,6 +286,7 @@ class DeliveryDialog extends React.Component<Props, State> {
<Select
locale={locale.Select}
className="select"
disabled={isEdit}
placeholder={t('Please select').toString()}
{...init(`clusterName`, {
rules: [
Expand All @@ -303,6 +311,7 @@ class DeliveryDialog extends React.Component<Props, State> {
},
],
})}
disabled={isEdit}
namespaces={namespaces}
loadNamespaces={this.loadNamespaces}
cluster={cluster}
Expand Down