<!-- Copyright (C) 2005-2024 Splunk Inc. All Rights Reserved. -->
<%!
import sys
from splunk.clilib.bundle_paths import make_splunkhome_path
sys.path.append(make_splunkhome_path(['etc', 'apps', 'SA-ITOA', 'lib']))
sys.path.append(make_splunkhome_path(['etc', 'apps', 'SA-ITOA', 'lib', 'itsi']))
sys.path = list(set(sys.path))
from feature_flagging.license_retriever import LicenseRetriever
from feature_flagging.suite_content import SuiteContent
%>\

<%
lic_retriever = LicenseRetriever(cherrypy.session.get('sessionKey'))

suite = None
try:
	suite = lic_retriever.get_suite()
except:
	# in case any error occurs with reading suite information, treat it as the standard suite
	suite = SuiteContent.least_permissible_suite()
%>
<script>
    const appLabelBySuite = '${suite}' === 'standard' ? 'IT Essentials Work' : 'IT Service Intelligence';
    for (let [key, value] of Object.entries(localStorage)) {
        if (key.includes('splunk-appnav:itsi')) {
            value = JSON.parse(value);
            value.label = appLabelBySuite;
            localStorage.setItem(key,  JSON.stringify(value));
            break;
        }
    }
</script>