Skip to content

Commit

Permalink
Merge pull request #1115 from cdapio/redirect-to-nsadmin-ui
Browse files Browse the repository at this point in the history
Redirect to namespace admin UI to add service account to created namespace
  • Loading branch information
radhikav1 authored Oct 17, 2023
2 parents 3a62ebd + 8f5f9e4 commit f4e3bcc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
38 changes: 33 additions & 5 deletions app/cdap/components/CaskWizards/AddNamespace/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,49 @@ export default class AddNamespaceWizard extends Component {
namespaceId: newNamespaceId,
});
let buttonLabel = T.translate(`${PREFIX}.callToAction`, { namespaceId: newNamespaceId });
let linkLabel = T.translate('features.Wizard.GoToHomePage');
this.setState({
successInfo: {
message,
buttonLabel,
buttonUrl: window.getAbsUIUrl({
namespaceId: newNamespaceId,
}),
linkLabel,
linkUrl: `${window.getAbsUIUrl({
namespaceId: currentNamespaceId,
})}/control`,
links: this.getLinks(newNamespaceId, currentNamespaceId),
},
});
}

isNamespacedServiceAccountsEnabled() {
return (
window.CDAP_CONFIG.featureFlags['feature.namespaced.service.accounts.enabled'] === 'true'
);
}

getLinks(newNamespaceId, currentNamespaceId) {
let links = [];
if (this.isNamespacedServiceAccountsEnabled()) {
links.push({
linkLabel: T.translate(`${PREFIX}.callToActionAddServiceAccounts`, {
namespaceId: newNamespaceId,
}),
linkUrl: `${window.getAbsUIUrl({
namespaceId: newNamespaceId,
})}/details/serviceaccounts`,
});
}
links.push(this.getHomePageLinkObject(currentNamespaceId));
return links;
}

getHomePageLinkObject(currentNamespaceId) {
return {
linkLabel: T.translate('features.Wizard.GoToHomePage'),
linkUrl: `${window.getAbsUIUrl({
namespaceId: currentNamespaceId,
})}/control`,
};
}

render() {
return (
<div>
Expand Down
1 change: 1 addition & 0 deletions app/cdap/text/text-en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3321,6 +3321,7 @@ features:
title: Warning
Wizard:
Add-Namespace:
callToActionAddServiceAccounts: Add service account to '{namespaceId}'
callToAction:
primary: Switch to '{namespaceId}'
headerlabel: Add namespace
Expand Down

0 comments on commit f4e3bcc

Please sign in to comment.