Skip to content

Commit a29ae11

Browse files
Zakaria-Kofirozkofiro
and
zkofiro
authored
Add configurable banner setting to landing page (#304)
* adds auth token banner to main page * store in session on log in * much better banner - links to guide * converted to permanent banner feature that pulls banner text from config file * update all other files to reflect single banner on projects page * remove spacing between banner * unneeded imports * move to TankConfig, simplify default value * formatting --------- Co-authored-by: zkofiro <[email protected]>
1 parent f4c9a82 commit a29ae11

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

api/src/main/java/com/intuit/tank/vm/settings/TankConfig.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ public class TankConfig extends BaseCommonsXmlConfig {
5858
private static final String KEY_REPORTING_NODE = "reporting";
5959
private static final String KEY_OIDC_SSO_NODE = "oidc-sso";
6060

61+
private static final String KEY_BANNER_TEXT = "banner-text";
62+
6163
private static String configName = CONFIG_NAME;
6264

6365
static {
@@ -118,6 +120,14 @@ public String getDataFileStorageDir() {
118120
public boolean isRestSecurityEnabled() {
119121
return config.getBoolean(KEY_REST_SECURITY_ENABLED, false);
120122
}
123+
124+
/**
125+
* @return banner text
126+
*/
127+
public String getTextBanner() {
128+
return config.getString(KEY_BANNER_TEXT, "");
129+
}
130+
121131
/**
122132
* @return true if rest security is enabled
123133
*/

tools/agent_debugger/src/main/java/com/intuit/tank/tools/debugger/ActionProducer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@ public void actionPerformed(ActionEvent event) {
380380
baseURLPanel.setBorder(BorderFactory.createTitledBorder("Intuit/Tank Base URL"));
381381
JPanel tokenPanel = new JPanel();
382382
comboBox.setPreferredSize(new Dimension(375,25));
383-
tokenPanel.setBorder(BorderFactory.createTitledBorder("Intuit/Tank Token"));
383+
tokenPanel.setBorder(BorderFactory.createTitledBorder("Intuit/Tank Token*"));
384+
tokenPanel.setToolTipText("Generate a Tank API token by logging into Tank and going to 'Account Settings' on the upper right to create a token for this specific host. ");
384385
final JTextField tokenField = new JTextField();
385386
tokenField.setPreferredSize(new Dimension(375,25));
386387
baseURLPanel.add(comboBox);

web/web_support/src/main/java/com/intuit/tank/ProjectDescriptionBean.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.io.Serializable;
1717
import java.util.List;
1818

19+
import com.intuit.tank.vm.settings.TankConfig;
1920
import jakarta.annotation.PostConstruct;
2021
import jakarta.enterprise.event.Event;
2122
import jakarta.faces.model.SelectItem;
@@ -44,6 +45,9 @@ public class ProjectDescriptionBean extends SelectableBean<Project> implements S
4445

4546
private static final long serialVersionUID = 1L;
4647

48+
@Inject
49+
private TankConfig tankConfig;
50+
4751
@Inject
4852
private ProjectLoader projectLoader;
4953

@@ -70,6 +74,14 @@ public void init() {
7074
tablePrefs.registerListener(userPrefs);
7175
}
7276

77+
public String getBannerMessage() {
78+
return tankConfig.getTextBanner();
79+
}
80+
81+
public boolean isBannerVisible() {
82+
return !tankConfig.getTextBanner().isEmpty();
83+
}
84+
7385
public void deleteSelectedProject() {
7486
if (selectedProject != null) {
7587
delete(selectedProject.getEntity());

web/web_ui/src/main/webapp/projects/index.xhtml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@
3535
</ts:toolbar>
3636

3737
<div class="vertical-spacer" />
38+
39+
<!-- Section for Banners on project page - configurable via settings file -->
40+
41+
<p:panel id="banner-text"
42+
styleClass="d-flex align-items-center justify-content-between p-3 flex-wrap"
43+
style="background-color: #dfeffc; color: #000; font-size: 0.8rem; font-weight: bold; border-radius: 10px;"
44+
visible="#{projectDescriptionBean.bannerVisible}">
45+
<h:outputText styleClass="mr-8" value="#{projectDescriptionBean.getBannerMessage()}" />
46+
<br/>
47+
<br/>
48+
</p:panel>
49+
3850
<p:growl globalOnly="true" id="messages" autoUpdate="true" />
3951

4052
<pe:remoteCommand id="resizeListener" name="resizeFinished" update="projectTableId" />

0 commit comments

Comments
 (0)