Skip to content

Commit

Permalink
fixes around sharing support bundles with vendors (#2262)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgalsaleh committed Oct 20, 2021
1 parent 7c04974 commit 728cab6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
6 changes: 6 additions & 0 deletions pkg/handlers/troubleshoot.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,12 @@ func (h *Handler) ShareSupportBundle(w http.ResponseWriter, r *http.Request) {
return
}

if app.IsAirgap {
logger.Error(errors.New("Support bundle sharing is not supported for airgapped installations."))
JSON(w, http.StatusBadRequest, nil)
return
}

license, err := store.GetStore().GetLatestLicenseForApp(app.ID)
if err != nil {
logger.Error(err)
Expand Down
6 changes: 0 additions & 6 deletions web/src/Root.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,6 @@ class Root extends Component {
return !!find(apps, app => app.isGitOpsSupported);
}

isSupportBundleUploadSupported = () => {
const apps = this.state.appsList;
return !!find(apps, app => app.isSupportBundleUploadSupported);
}

isIdentityServiceSupported = () => {
const apps = this.state.appsList;
return !!find(apps, app => app.isIdentityServiceSupported);
Expand Down Expand Up @@ -401,7 +396,6 @@ class Root extends Component {
{...props}
rootDidInitialAppFetch={rootDidInitialWatchFetch}
appsList={appsList}
isSupportBundleUploadSupported={this.isSupportBundleUploadSupported()}
refetchAppsList={this.getAppsList}
onActiveInitSession={this.handleActiveInitSession}
appNameSpace={this.state.appNameSpace}
Expand Down
1 change: 0 additions & 1 deletion web/src/components/apps/AppDetailPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ class AppDetailPage extends Component {
<TroubleshootContainer
app={app}
appName={appName}
isSupportBundleUploadSupported={this.props.isSupportBundleUploadSupported}
/>
} />
<Route exact path="/app/:slug/license" render={() =>
Expand Down
23 changes: 14 additions & 9 deletions web/src/components/troubleshoot/SupportBundleAnalysis.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class SupportBundleAnalysis extends React.Component {
}

sendBundleToVendor = async () => {
this.setState({ sendingBundle: true, sendingBundleErrMsg: "" });
this.setState({ sendingBundle: true, sendingBundleErrMsg: "", downloadBundleErrMsg: "" });
fetch(`${window.env.API_ENDPOINT}/troubleshoot/app/${this.props.match.params.slug}/supportbundle/${this.props.match.params.bundleSlug}/share`, {
method: "POST",
headers: {
Expand All @@ -55,7 +55,7 @@ export class SupportBundleAnalysis extends React.Component {
}

downloadBundle = async (bundle) => {
this.setState({ downloadingBundle: true, downloadBundleErrMsg: "" });
this.setState({ downloadingBundle: true, downloadBundleErrMsg: "", sendingBundleErrMsg: "" });
fetch(`${window.env.API_ENDPOINT}/troubleshoot/supportbundle/${bundle.id}/download`, {
method: "GET",
headers: {
Expand Down Expand Up @@ -164,6 +164,8 @@ export class SupportBundleAnalysis extends React.Component {
const fileTreeUrl = `/app/:slug/troubleshoot/analyze/:bundleSlug/contents/*`;
const redactorUrl = `/app/:slug/troubleshoot/analyze/:bundleSlug/redactor/report`;

const showSendSupportBundleBtn = watch.isSupportBundleUploadSupported && !watch.isAirgap;

return (
<div className="container u-marginTop--20 u-paddingBottom--30 flex1 flex-column">
<div className="flex1 flex-column">
Expand All @@ -187,15 +189,18 @@ export class SupportBundleAnalysis extends React.Component {
</div>
</div>
<div className="flex flex-auto alignItems--center justifyContent--flexEnd">
{this.state.downloadBundleErrMsg &&
<p className="u-textColor--error u-fontSize--normal u-fontWeight--medium u-lineHeight--normal u-marginRight--10">{this.state.downloadBundleErrMsg}</p>}
{this.props.isSupportBundleUploadSupported &&
this.state.sendingBundle ? <Loader className="u-marginRight--10" size="30" /> : this.state.bundleSentToVendor ? <p className="u-fontSize--small u-fontWeight--medium u-textColor--success u-lineHeight--normal u-marginRight--10">Bundle sent to vendor</p> :
<button className="btn primary lightBlue u-marginRight--10" onClick={this.sendBundleToVendor}>Send bundle to vendor</button>
}
{this.state.downloadBundleErrMsg && <p className="u-textColor--error u-fontSize--normal u-fontWeight--medium u-lineHeight--normal u-marginRight--10">{this.state.downloadBundleErrMsg}</p>}
{this.state.sendingBundleErrMsg && <p className="u-textColor--error u-fontSize--normal u-fontWeight--medium u-lineHeight--normal u-marginRight--10">{this.state.sendingBundleErrMsg}</p>}
{showSendSupportBundleBtn && (
this.state.sendingBundle
? <Loader className="u-marginRight--10" size="30" />
: this.state.bundleSentToVendor
? <p className="u-fontSize--small u-fontWeight--medium u-textColor--success u-lineHeight--normal u-marginRight--10">Bundle sent to vendor</p>
: <button className="btn primary lightBlue u-marginRight--10" onClick={this.sendBundleToVendor}>Send bundle to vendor</button>
)}
{this.state.downloadingBundle ?
<Loader size="30" /> :
<button className={`btn ${this.props.isSupportBundleUploadSupported ? "secondary blue" : "primary lightBlue"}`} onClick={() => this.downloadBundle(bundle)}> Download bundle </button>
<button className={`btn ${showSendSupportBundleBtn ? "secondary blue" : "primary lightBlue"}`} onClick={() => this.downloadBundle(bundle)}> Download bundle </button>
}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/troubleshoot/TroubleshootContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TroubleshootContainer extends Component {
<GenerateSupportBundle watch={app} />
} />
<Route path="/app/:slug/troubleshoot/analyze/:bundleSlug" render={() =>
<SupportBundleAnalysis watch={app} isSupportBundleUploadSupported={this.props.isSupportBundleUploadSupported} />
<SupportBundleAnalysis watch={app} />
} />
<Route exact path="/app/:slug/troubleshoot/redactors" render={(props) =>
<Redactors {...props} appSlug={app.slug} appName={appName} />}
Expand Down

0 comments on commit 728cab6

Please sign in to comment.