Skip to content

Commit

Permalink
Revert link existing but better 🪦 (#20830)
Browse files Browse the repository at this point in the history
* Revert "feat: add alert to link to hcp modal to ask a user refresh a page; up… (#20682)"

This reverts commit dd833d9.

* Revert "chor: change cluster name param to have datacenter.name as default value (#20644)"

This reverts commit 8425cd0.

* Revert "chor: adds informative error message when acls disabled and read-only… (#20600)"

This reverts commit 9d712cc.

* Revert "Cc 7147 link to hcp modal (#20474)"

This reverts commit 8c05e57.

* Revert "Add nav bar item to show HCP link status and encourage folks to link (#20370)"

This reverts commit 22e6ce0.

* Revert "Cc 7145 hcp link status api (#20330)"

This reverts commit 049ca10.

* Revert "💜 Cc 7187/purple banner for linking existing clusters (#20275)"

This reverts commit 5119667.
  • Loading branch information
chris-hut authored Mar 13, 2024
1 parent cff9161 commit bfbc0ee
Show file tree
Hide file tree
Showing 31 changed files with 92 additions and 1,339 deletions.
3 changes: 0 additions & 3 deletions .changelog/20275.txt

This file was deleted.

10 changes: 0 additions & 10 deletions ui/packages/consul-ui/app/abilities/operator.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@
class='hds-side-nav-hide-when-minimized consul-side-nav__selector-group'
as |SNL|
>
<DataSource @src={{uri '/${partition}/*/${dc}/hcp-link' (hash dc=@dc partition=@partition name=@dc)}} as |hcpLink|>
<HcpNavItem @list={{SNL}} @linkData={{hcpLink.data}} />
</DataSource>
<HcpNavItem @list={{SNL}}/>
<Consul::Datacenter::Selector
@list={{SNL}}
@dc={{@dc}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class HashiCorpConsul extends Component {
@service('env') env;

get consulVersion() {
const suffix = this.env.isEnterprise ? '+ent' : '';
const suffix = !['', 'oss'].includes(this.env.var('CONSUL_BINARY_TYPE')) ? '+ent' : '';
return `${this.env.var('CONSUL_VERSION')}${suffix}`;
}
}
19 changes: 0 additions & 19 deletions ui/packages/consul-ui/app/components/hcp-nav-item/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,5 @@
@isHrefExternal={{true}}
data-test-back-to-hcp
/>
{{else}}
{{#if this.shouldDisplayNavLinkItem}}
{{#if this.alreadyLinked}}
<SNL.Link
@text="HCP Consul Central"
@href={{hcp-resource-id-to-link @linkData.resourceId}}
@isHrefExternal={{true}}
@badge="Linked"
data-test-linked-cluster-hcp-link
/>
{{else}}
<SNL.Item data-test-link-to-hcp>
<button type="button" class="hds-side-nav__list-item-link hcp-nav-item" {{on "click" this.onLinkToConsulCentral}}>
<Hds::Text::Body @size='200'>Link to HCP Consul Central</Hds::Text::Body>
<FlightIcon class='w-4 h-4' @size='24' @name='arrow-right'/>
</button>
</SNL.Item>
{{/if}}
{{/if}}
{{/if}}
{{/let}}
37 changes: 0 additions & 37 deletions ui/packages/consul-ui/app/components/hcp-nav-item/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,54 +5,17 @@

import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';

/**
* If the user has accessed consul from HCP managed consul, we do NOT want to display the
* "HCP Consul Central↗️" link in the nav bar. As we're already displaying a BackLink to HCP.
*/
export default class HcpLinkItemComponent extends Component {
@service env;
@service('hcp-link-status') hcpLinkStatus;
@service('hcp-link-modal') hcpLinkModal;

get alreadyLinked() {
return this.args.linkData?.isLinked;
}

get shouldDisplayNavLinkItem() {
const alreadyLinked = this.alreadyLinked;
const undefinedResourceId = !this.args.linkData?.resourceId;
const unauthorizedToLink = !this.hcpLinkStatus.hasPermissionToLink;
const undefinedLinkStatus = this.args.linkData?.isLinked === undefined;

// We need permission to link to display the link nav item
if (unauthorizedToLink) {
return false;
}

// If the link status is undefined, we don't want to display the link nav item
if (undefinedLinkStatus) {
return false;
}

// If the user has already linked, but we don't have the resourceId to link them to HCP, we don't want to display the link nav item
if (alreadyLinked && undefinedResourceId) {
return false;
}

// With the death of Consul Central, we don't want to display the link nav item
return false;
}

get shouldShowBackToHcpItem() {
const isConsulHcpUrlDefined = !!this.env.var('CONSUL_HCP_URL');
const isConsulHcpEnabled = !!this.env.var('CONSUL_HCP_ENABLED');
return isConsulHcpEnabled && isConsulHcpUrlDefined;
}

@action
onLinkToConsulCentral() {
this.hcpLinkModal.show();
}
}
24 changes: 0 additions & 24 deletions ui/packages/consul-ui/app/components/link-to-hcp-banner/index.hbs

This file was deleted.

27 changes: 0 additions & 27 deletions ui/packages/consul-ui/app/components/link-to-hcp-banner/index.js

This file was deleted.

112 changes: 0 additions & 112 deletions ui/packages/consul-ui/app/components/link-to-hcp-modal/index.hbs

This file was deleted.

66 changes: 0 additions & 66 deletions ui/packages/consul-ui/app/components/link-to-hcp-modal/index.js

This file was deleted.

33 changes: 0 additions & 33 deletions ui/packages/consul-ui/app/components/link-to-hcp-modal/index.scss

This file was deleted.

1 change: 0 additions & 1 deletion ui/packages/consul-ui/app/controllers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export default class ApplicationController extends Controller {
@service('router') router;
@service('store') store;
@service('feedback') feedback;
@service('hcp-link-modal') hcpLinkModal;

// TODO: We currently do this in the controller instead of the router
// as the nspace and dc variables aren't available directly on the Route
Expand Down
Loading

0 comments on commit bfbc0ee

Please sign in to comment.