Skip to content

Commit

Permalink
Updating: solve JIRA 1184
Browse files Browse the repository at this point in the history
  • Loading branch information
gallettilance committed Jan 9, 2019
1 parent 7f599f6 commit 5e6f6d6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
6 changes: 3 additions & 3 deletions frontend/public/components/operator-hub/operator-hub-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const OperatorHubList: React.SFC<OperatorHubListProps> = (props) => {
label="Resources"
EmptyMsg={() => <MsgBox
title="No Operator Hub Items Found"
detail={<span>Please check that the OperatorHub is running and that you have created a valid OperatorSource. For more information about Operator Hub, please click <a href="https://github.com/operator-framework/operator-marketplace">here</a>.</span>} />}>
detail={<span>Please check that the OperatorHub is running and that you have created a valid OperatorSource. For more information about Operator Hub, please click <a href="https://github.com/operator-framework/operator-marketplace" target="_blank" className="co-external-link" rel="noopener noreferrer">here</a>.</span>} />}>
<OperatorHubTileView items={items} catalogSourceConfig={sourceConfigs} subscriptions={props.subscription.data} />
</StatusBox>;
};
Expand All @@ -98,7 +98,7 @@ export const OperatorHubPage: React.SFC<OperatorHubPageProps> = (props) => {
<Firehose resources={[{
isList: true,
kind: referenceForModel(CatalogSourceConfigModel),
namespace: 'openshift-operators',
namespace: 'openshift-marketplace',
prop: 'catalogSourceConfig',
}, {
isList: true,
Expand All @@ -108,7 +108,7 @@ export const OperatorHubPage: React.SFC<OperatorHubPageProps> = (props) => {
}, {
isList: true,
kind: referenceForModel(PackageManifestModel),
namespace: 'openshift-operators',
namespace: 'openshift-marketplace',
prop: 'packageManifest',
selector: {matchLabels: {'openshift-marketplace': 'true'}},
}, {
Expand Down
19 changes: 11 additions & 8 deletions frontend/public/components/operator-hub/operator-hub-subscribe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ export const OperatorHubSubscribeForm = withFormState((props: OperatorHubSubscri
const {provider, channels = [], packageName} = props.packageManifest.data.status;

const submit = () => {
const catalogSourceConfig = props.catalogSourceConfig.data.find(csc => csc.metadata.name === OPERATOR_HUB_CSC_NAME);
const operatorGroupNamespace = props.operatorGroup.data.find(og => og.metadata.name === props.formState().target).metadata.namespace;
const operatorHubCscName = `${OPERATOR_HUB_CSC_NAME}-${operatorGroupNamespace}`;

const catalogSourceConfig = props.catalogSourceConfig.data.find(csc => csc.metadata.name === operatorHubCscName);
const packages = _.isEmpty(catalogSourceConfig)
? packageName
: _.uniq(catalogSourceConfig.spec.packages.split(',').concat([packageName])).join(',');
Expand All @@ -61,11 +64,11 @@ export const OperatorHubSubscribeForm = withFormState((props: OperatorHubSubscri
apiVersion: `${CatalogSourceConfigModel.apiGroup}/${CatalogSourceConfigModel.apiVersion}`,
kind: CatalogSourceConfigModel.kind,
metadata: {
name: OPERATOR_HUB_CSC_NAME,
namespace: 'openshift-operators',
name: operatorHubCscName,
namespace: 'openshift-marketplace',
},
spec: {
targetNamespace: 'openshift-operators',
targetNamespace: operatorGroupNamespace,
packages: `${packages}`,
},
};
Expand All @@ -78,8 +81,8 @@ export const OperatorHubSubscribeForm = withFormState((props: OperatorHubSubscri
namespace: props.operatorGroup.data.find(og => og.metadata.name === props.formState().target).metadata.namespace,
},
spec: {
source: OPERATOR_HUB_CSC_NAME,
sourceNamespace: 'openshift-operators',
source: operatorHubCscName,
sourceNamespace: operatorGroupNamespace,
name: packageName,
startingCSV: channels.find(ch => ch.name === props.formState().updateChannel).currentCSV,
channel: props.formState().updateChannel,
Expand All @@ -88,7 +91,7 @@ export const OperatorHubSubscribeForm = withFormState((props: OperatorHubSubscri
};

return (!_.isEmpty(catalogSourceConfig)
? k8sUpdate(CatalogSourceConfigModel, {...catalogSourceConfig, spec: {targetNamespace: 'openshift-operators', packages}}, 'openshift-operators', OPERATOR_HUB_CSC_NAME)
? k8sUpdate(CatalogSourceConfigModel, {...catalogSourceConfig, spec: {targetNamespace: operatorGroupNamespace, packages}}, 'openshift-marketplace', operatorHubCscName)
: k8sCreate(CatalogSourceConfigModel, newCatalogSourceConfig)
).then(() => k8sCreate(SubscriptionModel, subscription))
.then(() => history.push('/operatorhub'));
Expand Down Expand Up @@ -143,7 +146,7 @@ export const OperatorHubSubscribePage: React.SFC<OperatorHubSubscribePageProps>
<Firehose resources={[{
isList: true,
kind: referenceForModel(CatalogSourceConfigModel),
namespace: 'openshift-operators',
namespace: 'openshift-marketplace',
prop: 'catalogSourceConfig',
}, {
isList: true,
Expand Down

0 comments on commit 5e6f6d6

Please sign in to comment.