Fix plan export URL

* use getServiceUrl utility function to retrieve swift API URL
  instead of directly accessing appConfig
* clean up export plan modal dialog to use <p> instead of nesting
  <div> and <br/>

Closes-Bug: 1707055
Change-Id: I18a764d1ff5dca956880308f000bd58c1b8cce6a
This commit is contained in:
Jiri Tomasek 2017-07-27 21:42:51 +02:00
parent 24facd7a39
commit da97d3009e
3 changed files with 9 additions and 5 deletions

View File

@ -0,0 +1,5 @@
fixes:
- |
Fixes `bug 1707055 <https://launchpad.net/bugs/1707055>`__
Fixes incorrectly generated exported plan URL for specific application
configurations

View File

@ -27,8 +27,8 @@ import { planFileSchema } from '../normalizrSchemas/plans';
import StackActions from '../actions/StacksActions'; import StackActions from '../actions/StacksActions';
import SwiftApiService from '../services/SwiftApiService'; import SwiftApiService from '../services/SwiftApiService';
import MistralConstants from '../constants/MistralConstants'; import MistralConstants from '../constants/MistralConstants';
import { getAppConfig } from '../services/utils';
import { PLAN_ENVIRONMENT } from '../constants/PlansConstants'; import { PLAN_ENVIRONMENT } from '../constants/PlansConstants';
import { getServiceUrl } from '../services/utils';
const messages = defineMessages({ const messages = defineMessages({
planCreatedNotificationTitle: { planCreatedNotificationTitle: {
@ -499,7 +499,7 @@ export default {
let urlParser = document.createElement('a'); let urlParser = document.createElement('a');
urlParser.href = payload.tempurl; urlParser.href = payload.tempurl;
let url = urlParser.hostname; let url = urlParser.hostname;
urlParser.href = getAppConfig().swift; urlParser.href = getServiceUrl('swift');
let swiftUrl = urlParser.hostname; let swiftUrl = urlParser.hostname;
dispatch( dispatch(
this.exportPlanSuccess(payload.tempurl.replace(url, swiftUrl)) this.exportPlanSuccess(payload.tempurl.replace(url, swiftUrl))

View File

@ -89,10 +89,9 @@ class ExportPlan extends React.Component {
> >
{this.props.planExportUrl {this.props.planExportUrl
? <div> ? <div>
<div> <p>
<FormattedMessage {...messages.downloadPlanExportMessage} /> <FormattedMessage {...messages.downloadPlanExportMessage} />
</div> </p>
<br />
<a <a
href={this.props.planExportUrl} href={this.props.planExportUrl}
className="btn btn-success" className="btn btn-success"