mirror of
https://github.com/status-im/consul.git
synced 2025-03-03 14:50:50 +00:00
* Adding banner on services page * Simplified version of setting/unsetting banner * Translating the text based off of enterprise or not * Add an integration test * Adding an acceptance test * Enable config dismissal as well * Adding changelog * Adding some copyrights to the other files * Revert "Enable config dismissal as well" This reverts commit e6784c4335bdff99d9183d28571aa6ab4b852cbd. We'll be doing this in CC-7347
35 lines
811 B
JavaScript
35 lines
811 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Service from '@ember/service';
|
|
import { tracked } from '@glimmer/tracking';
|
|
|
|
const LOCAL_STORAGE_KEY = 'consul:hideHcpLinkBanner';
|
|
|
|
export default class HcpLinkStatus extends Service {
|
|
@tracked
|
|
alreadyLinked = false;
|
|
@tracked
|
|
userDismissedBanner = false;
|
|
|
|
get shouldDisplayBanner() {
|
|
return !this.alreadyLinked && !this.userDismissedBanner;
|
|
}
|
|
|
|
constructor() {
|
|
super(...arguments);
|
|
this.userDismissedBanner = !!localStorage.getItem(LOCAL_STORAGE_KEY);
|
|
}
|
|
|
|
userHasLinked() {
|
|
// TODO: CC-7145 - once can fetch the link status from the backend, fetch it and set it here
|
|
}
|
|
|
|
dismissHcpLinkBanner() {
|
|
localStorage.setItem(LOCAL_STORAGE_KEY, true);
|
|
this.userDismissedBanner = true;
|
|
}
|
|
}
|