Skip to content

Commit

Permalink
Merge pull request #535 from Tharanidk/unlimited-tier
Browse files Browse the repository at this point in the history
Fix UI based unlimited tier disabling issue
  • Loading branch information
Tharanidk authored Feb 4, 2024
2 parents eeb3e06 + f80b82f commit f5e8ec8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ const useStyles = makeStyles((theme) => ({
actionPanel: {
justifyContent: 'flex-start',
},
disabledTier: {
color: '#999999',
fontWeight: '400',
},
Paper: {
marginTop: theme.spacing(2),
padding: theme.spacing(2),
Expand Down Expand Up @@ -139,6 +143,7 @@ function Overview(props) {
const [notFound, setNotFound] = useState(false);
const { match: { params: { applicationId } } } = props;
const [environment, setEnvironment] = useState(null);
const [tierDisabled, setTierDisabled] = useState(false);
const [selectedProtocol, setSelectedProtocol] = useState(null);
const [selectedEndpoint, setSelectedEndpoint] = useState(null);
const [topics, setTopics] = useState(null);
Expand All @@ -148,11 +153,11 @@ function Overview(props) {
const promisedApplication = client.getApplication(applicationId);
promisedApplication
.then((response) => {
const promisedTier = client.getTierByName(response.obj.throttlingPolicy, 'application');
const appInner = response.obj;
setApplication(appInner);
const promisedTier = client.getTierByName(response.obj.throttlingPolicy, 'application');
promisedTier.then((tierResponse) => {
setTierDescription(tierResponse.obj.description);
setApplication(appInner);
if (appInner.solaceDeployedEnvironments) {
setEnvironment(appInner.solaceDeployedEnvironments[0]);
setSelectedProtocol(appInner.solaceDeployedEnvironments[0].solaceURLs[0].protocol);
Expand All @@ -163,6 +168,10 @@ function Overview(props) {
setTopics(appInner.solaceDeployedEnvironments[0].SolaceTopicsObject.defaultSyntax);
}
}
}).catch((error) => {
setTierDisabled(true);
setTierDescription('Tier is disabled.');
console.log(error);
});
}).catch((error) => {
if (process.env.NODE_ENV !== 'production') {
Expand Down Expand Up @@ -251,7 +260,7 @@ function Overview(props) {
<TableCell>
{application.throttlingPolicy}
{' '}
{`(${tierDescription})`}
<span className={tierDisabled ? classes.disabledTier : ''}>{`(${tierDescription})`}</span>
</TableCell>
)}
</TableRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ class Details extends Component {
promisedApplication
.then((response) => {
this.setState({ application: response.obj });
const promisedPolicy = client.getTierByName(response.obj.throttlingPolicy, 'application');
return Promise.all([response, promisedPolicy]);
return Promise.all([response]);
})
.catch((error) => {
if (process.env.NODE_ENV !== 'production') {
Expand Down

0 comments on commit f5e8ec8

Please sign in to comment.