Skip to content

Commit

Permalink
NMS-16535: Reorganize date time and notification in main navigation
Browse files Browse the repository at this point in the history
Clarify date and time in separate lines, to a) save some space and b) make it easier to read.
Group notification components for user and team notification and the indicator if the system has notifications enabled
together.
  • Loading branch information
indigo423 committed Sep 23, 2024
1 parent db57b0a commit b52dc5a
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class CentralizedDateTimeFormat {

public final static String SYSTEM_PROPERTY_DATE_FORMAT = "org.opennms.ui.datettimeformat";
public final static String SESSION_PROPERTY_TIMEZONE_ID = "org.opennms.ui.timezoneid";
public final static String DEFAULT_FORMAT_PATTERN = "yyyy-MM-dd'T'HH:mm:ssxxx";
public final static String DEFAULT_FORMAT_PATTERN = "yyyy-MM-dd HH:mm:ssxxx";

public static final Logger LOG = LoggerFactory.getLogger(CentralizedDateTimeFormat.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class CentralizedDateTimeFormatTest {

@Test
public void shouldOutputeDateTimeIncludingTimeZone() throws IOException {
test("yyyy-MM-dd'T'HH:mm:ssxxx", Instant.now());
test("yyyy-MM-dd HH:mm:ssxxx", Instant.now());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function OnmsDateFormatter() {

OnmsDateFormatter.prototype.init = function init(readyCallback) {
var self = this;
var defaultFormat = "yyyy-MM-dd'T'HH:mm:ssxxx"; // eslint-disable-line quotes
var defaultFormat = "yyyy-MM-dd HH:mm:ssxxx"; // eslint-disable-line quotes
window._onmsZoneId = undefined;

var xhr = new XMLHttpRequest();
Expand Down
18 changes: 8 additions & 10 deletions core/web-assets/src/main/assets/style/opennms-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,7 @@ div.NLnode:hover span.NLdbid, div.NLnode:hover span.NLfs, div.NLnode:hover span.
}
/* Resource Graph sidebar classes inspired by Bootstrap Docs: End */

#navbar {
margin-top: auto;
}
#navbar {}

#footer {
text-align: center;
Expand Down Expand Up @@ -390,7 +388,7 @@ iframe.vaadin-fullscreen {
}

.opennms-bg-chromatic-black {
background-color: $opennms-dark-blue;
background-color: $opennms-dark-blue;
}

.navbar-brand {
Expand Down Expand Up @@ -423,16 +421,16 @@ iframe.vaadin-fullscreen {
font-size:14px;
color:rgba(255, 255, 255, 0.8);
letter-spacing: 0.12px;
margin-right:1rem;
padding-top:13px;
width: 100px;
text-align: right;
}
.navbar-bell {
margin-right:60px;
padding-top:13px;
}
.form-control {
border-radius:0px;
background-color:transparent;
border-radius:0px;
background-color:transparent;
}
.input-group {
.form-control:not(:last-child) {
Expand All @@ -449,7 +447,7 @@ iframe.vaadin-fullscreen {
background-color:white;
}
}
.search-bar .input-group-text {
.search-bar .input-group-text {
border-radius:4px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
Expand Down Expand Up @@ -514,7 +512,7 @@ iframe.vaadin-fullscreen {
height:23px;
color: #000;
}

.nav-item.dropdown a.dropdown-toggle:after {
vertical-align: 2px;
margin-left: 6px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function createController() {
}

beforeEach(function() {
window._onmsDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx";
window._onmsDateTimeFormat = "yyyy-MM-dd HH:mm:ssxxx";
window._onmsZoneId = 'America/New_York';
window._onmsFormatter = new OnmsDateFormatter();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function createController() {
}

beforeEach(function() {
window._onmsDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx";
window._onmsDateTimeFormat = "yyyy-MM-dd HH:mm:ssxxx";
window._onmsZoneId = 'America/New_York';
window._onmsFormatter = new OnmsDateFormatter();
});
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/development/pages/rest/info.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Service that provides information about the {page-component-title} instance.
},
"datetimeformatConfig": {
"zoneId": "UTC",
"datetimeformat": "yyyy-MM-dd'T'HH:mm:ssxxx"
"datetimeformat": "yyyy-MM-dd HH:mm:ssxxx"
},
"services": {
"Eventd": "running",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ org.eclipse.jetty.server.Request.maxFormKeys=2000

# Choose the format how the date is displayed in the UI. It needs to follow the pattern in DateTimeFormatter:
# see https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html
# org.opennms.ui.datettimeformat=yyyy-MM-dd'T'HH:mm:ssxxx
# org.opennms.ui.datettimeformat=yyyy-MM-dd HH:mm:ssxxx

# Enable displaying stack traces in the ui:
# org.opennms.ui.show_stacktrace=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void tearDown() {

@Test
public void shouldOutputeDateTimeIncludingTimeZone() throws IOException {
test("yyyy-MM-dd'T'HH:mm:ssxxx");
test("yyyy-MM-dd HH:mm:ssxxx");
}

@Test
Expand All @@ -85,7 +85,7 @@ public void shouldHonorUserTimezone() throws IOException {
// Martinique has no daylight savings => offset to UTC should be always the same
final ZoneId martinique = ZoneId.of("America/Martinique");
attributes.put(CentralizedDateTimeFormat.SESSION_PROPERTY_TIMEZONE_ID, martinique);
String result = test("yyyy-MM-dd'T'HH:mm:ssxxx", martinique, Instant.now(), attributes);
String result = test("yyyy-MM-dd HH:mm:ssxxx", martinique, Instant.now(), attributes);
assertEquals("-04:00", result.substring(result.length()-6));
}

Expand Down
89 changes: 45 additions & 44 deletions opennms-webapp/src/main/webapp/WEB-INF/templates/navbar.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,6 @@
</button>

<div id="navbar" class="navbar-collapse collapse">
<#if request.remoteUser?has_content >
<ul class="navbar-nav ml-1">
<li class="nav-item">
<span class="navbar-text navbar-formatted-time">${formattedTime}</span>
</li>
<li class="nav-item">
<span class="navbar-text navbar-bell ml-1">
<#if noticeStatus = 'Unknown'>
<!-- Gray circle with bell inside -->
<i class="fa fa-bell text-secondary"></i>
</#if>
<#if noticeStatus = 'Off'>
<i class="fa fa-bell-slash text-danger" title="Notices: Off"></i>
</#if>
<#if noticeStatus = 'On'>
<i class="fa fa-bell text-horizon" title="Notices: On"></i>
</#if>
</span>
</li>
</ul>
</#if>

<div ng-app="onms.default.apps">
<onms-central-search></onms-central-search>
</div>
Expand Down Expand Up @@ -142,6 +120,33 @@
</a>
</div>
</li>
</ul>
<ul class="navbar-nav">
<#if isAdmin || isProvision >
<li class="nav-item">
<a class="nav-link" style="font-size: 1.25rem" name="nav-admin-quick-add"
href="${baseHref}admin/ng-requisitions/quick-add-node.jsp#/" title="Quick-Add Node">
<i class="fa fa-plus-circle"></i>
</a>
</li>
</#if>
<#if isFlow >
<li class="nav-item">
<a class="nav-link" style="font-size: 1.25rem" name="nav-admin-flow"
href="${baseHref}admin/classification/index.jsp" title="Flow Management">
<i class="fa fa-minus-circle"></i>
</a>
</li>
</#if>
<#if isAdmin >
<li class="nav-item">
<a class="nav-link" style="font-size: 1.25rem" title="Configure OpenNMS"
href="${baseHref}admin/index.jsp"><i class="fa fa-cogs"></i></a>
</li>
</#if>
</#if>
</ul>
<ul class="navbar-nav">
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle badge-wrapper" data-toggle="dropdown" role="button"
aria-expanded="false">
Expand All @@ -159,7 +164,8 @@

<div class="dropdown-divider"></div>
<a class="dropdown-item" href="${baseHref}notification/browse?acktype=unack">
<i class="fa fa-fw fa-users"></i>&nbsp; <span class="teamNotificationCount">0</span> of <span
<i class="fa fa-fw fa-users"></i>&nbsp; <span class="teamNotificationCount">0</span> of
<span
class="totalNotificationCount"></span> assigned to anyone but you
</a>
<a class="dropdown-item" href="${baseHref}roles">
Expand All @@ -168,31 +174,25 @@
</div>
</li>
</ul>
<ul class="navbar-nav">
<#if isAdmin || isProvision >
<li class="nav-item">
<a class="nav-link" style="font-size: 1.25rem" name="nav-admin-quick-add"
href="${baseHref}admin/ng-requisitions/quick-add-node.jsp#/" title="Quick-Add Node">
<i class="fa fa-plus-circle"></i>
</a>
</li>
<div>
<#if noticeStatus = 'Unknown'>
<!-- Gray circle with bell inside -->
<i class="fa fa-bell text-secondary"></i>
</#if>
<#if isFlow >
<li class="nav-item">
<a class="nav-link" style="font-size: 1.25rem" name="nav-admin-flow"
href="${baseHref}admin/classification/index.jsp" title="Flow Management">
<i class="fa fa-minus-circle"></i>
</a>
</li>
<#if noticeStatus = 'Off'>
<i class="fa fa-bell-slash text-danger" title="Notices: Off"></i>
</#if>
<#if isAdmin >
<#if noticeStatus = 'On'>
<i class="fa fa-bell text-horizon" title="Notices: On"></i>
</#if>
</div>
<#if request.remoteUser?has_content >
<ul class="navbar-nav ml-1">
<li class="nav-item">
<a class="nav-link" style="font-size: 1.25rem" title="Configure OpenNMS"
href="${baseHref}admin/index.jsp"><i class="fa fa-cogs"></i></a>
<span class="navbar-text navbar-formatted-time">${formattedTime}</span>
</li>
</#if>
</#if>
</ul>
</ul>
</#if>
</div>
</nav>

Expand Down Expand Up @@ -339,3 +339,4 @@
</script>
</#if>

2 changes: 1 addition & 1 deletion ui/src/directives/v-date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const timeZone = computed<string>(

const formatString = computed<string>(
// eslint-disable-next-line quotes
() => appInfo.value.datetimeformatConfig?.datetimeformat || "yyyy-MM-dd'T'HH:mm:ssxxx"
() => appInfo.value.datetimeformatConfig?.datetimeformat || "yyyy-MM-dd HH:mm:ssxxx"
)

const dateFormatDirective = {
Expand Down

0 comments on commit b52dc5a

Please sign in to comment.