Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert link existing but better 🪦 #20830

Merged
merged 10 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}
}

This file was deleted.

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.

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
Loading