Skip to content

messaging addition #1195

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

Merged
merged 3 commits into from
Oct 9, 2016
Merged

messaging addition #1195

merged 3 commits into from
Oct 9, 2016

Conversation

tulinkry
Copy link
Contributor

@tulinkry tulinkry commented Sep 27, 2016

The configuration listener seems unemployed most of the time so I added a messaging feature which listens on the same socket.

As a first shot it is capable of two things:

  1. send "normal" and "abort" messages to the web application
  2. display some useful information about projects

The information are displayed:

  1. On the main page just above the project list - for general messages (tag 'main')
  2. In the directory listing just above the listing - for project specific messages (tag $projectName)
  3. In the xref/history/... page just above the content - for project specific messages (tag $projectName)
  4. After the search there is a (!) mark indicating that there are messages in this project

Currently supported messages:

  1. normal
    • can display information on the page
    • can be general (with tag 'main' - default) or project specific (tag with project name)
    • the color can be controlled with the css class
  2. abort
    • can erase some messages from the system
    • basically it erases all messages with at least one tag from the tags of this abort message

The messages can't enforce any kind of restrictions, they just display/delete some user content - they are useful to notify the clients that index/reindex or anything else is in progress and so some inconsistencies can occur.

All messages disappear with webapp deploy. They are current state of the runtime environment of the OpenGrok

Related to #1187. This is now possible with just implementing Message subclass with desired effect.

It comes with a java main file to automatically send the message to the application and also with a shell wrapper to make it even more easier. The shell wrapper is located under tools.

This shell wrapper only needs to find your opengrok.jar java file so it can run the Messages.java main class in it. This is possible by setting OPENGROK_DISTRIBUTION_BASE environment variable which points to the OpenGrok distribution directory (which contains dist/opengrok.jar). Other options are available through set of switches.

Usage from the command line is simple:

$ tools/Messages --help # see usage and defaults
$ tools/Messages "Hello" # send a message with text "Hello"
$ tools/Messages -e "+1 min" "Hello" # set expiration to 30 minutes from now
$ tools/Messages -e "+30 min" "Hello" # set expiration to 30 minutes from now
$ tools/Messages -c "error" -e "+30 min" "Hello" # display the message as error
$ tools/Messages -c "warning" -e "+30 min" "Hello"  # display the message as warning
$ tools/Messages -c "warning" -e "+30 min" --type abort "Hello" # send abort message

Here come some screenshots:

  1. General message
    screenshot from 2016-10-06 16-45-56
  2. Warning in project picker
    screenshot from 2016-10-06 16-46-09
  3. All warnings (!) has mouseover table with the messages
    screenshot from 2016-10-06 16-46-44
  4. Searching
    screenshot from 2016-10-06 16-46-54
  5. In project context, the warning is on the top
    screenshot from 2016-10-06 16-47-05
  6. With the mouseover as well
    Uploading Screenshot from 2016-10-06 16-47-12.png…

@tulinkry tulinkry self-assigned this Sep 27, 2016
@tulinkry
Copy link
Contributor Author

tulinkry commented Sep 27, 2016

I currently can't decide which is better. I also experimented with the message view for particular project in form of a window:

screenshot from 2016-09-27 14-59-00

private static final String MESSAGES_MAIN_PAGE_TAG = "main";
/*
initial capacity - default 16
initial load factor - default 0.75f
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if they are public constants, then take them from there (just in case JDK will change defaults ... )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Impossible, they're private

Message m = ((Message) obj);
if (canAcceptMessage(m)) {
m.apply(RuntimeEnvironment.getInstance());
LOGGER.log(Level.INFO, "Message received: {0}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not INFO, too high, please lower to debug/fine/finer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in the updated commit

LOGGER.log(Level.INFO, "Messages in the system: {0}",
RuntimeEnvironment.getInstance().getMessagesInTheSystem());
} else {
LOGGER.log(Level.INFO, "Message dropped: {0} - too many messages in the system",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.WARNING ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in the updated commit

m.apply(RuntimeEnvironment.getInstance());
LOGGER.log(Level.INFO, "Message received: {0}",
m.getTags());
LOGGER.log(Level.INFO, "Messages in the system: {0}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FINE/FINER ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in the updated commit

@@ -0,0 +1,317 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we usually use sh or ksh to be portable to other OSes ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to ksh

@vladak
Copy link
Member

vladak commented Sep 30, 2016

Some mention of the tool in top-level README would be nice.

@vladak
Copy link
Member

vladak commented Sep 30, 2016

It would be nice if mouse over the exclamation mark displayed the message.

@tarzanek
Copy link
Contributor

@tulinkry can you resolve conflicts please ?

@vladak
Copy link
Member

vladak commented Sep 30, 2016

Also, it would be nice if the pending messages were reflected in the project list on home page (plus maybe in project picker).

@vladak
Copy link
Member

vladak commented Sep 30, 2016

Lastly, I'd remove the blue band altogether and replace it with colored background under the path with mouse over displaying all messages. I like that OpenGrok is still looking quite minimalistic; adding more elements would make it cluttered I think (as opposed to increasing density).

@vladak
Copy link
Member

vladak commented Oct 6, 2016

Also, it would be good to test this change with persistent messages displayed via dtags.eftar.

@tulinkry tulinkry mentioned this pull request Oct 6, 2016
@tarzanek
Copy link
Contributor

tarzanek commented Oct 7, 2016

@tulinkry ping me , once you resolve conflicts

@tulinkry
Copy link
Contributor Author

tulinkry commented Oct 7, 2016

I updated the screenshots in the initial PR comment.

Javascript changes are tested in recent Firefox, recent Chrome and IE9.

Some mention of the tool in top-level README would be nice.

  • solved

It would be nice if mouse over the exclamation mark displayed the message.

  • all exclamation marks have mouseover

Also, it would be nice if the pending messages were reflected in the project list on home page (plus maybe in project picker).

  • solved

Also, it would be good to test this change with persistent messages displayed via dtags.eftar.

  • visually no problem with this (tested also on other places, but this is the most conflicting)
    screenshot from 2016-10-07 12-54-51

@tulinkry
Copy link
Contributor Author

tulinkry commented Oct 7, 2016

Internal demo available here, with some messages with expiration +15 days.

@tulinkry
Copy link
Contributor Author

tulinkry commented Oct 7, 2016

I added the Messages into a Solaris package, I did the same like @vladak yesterday, but I'm not sure if the group shouldn't be also bin like for the OpenGrok script.

 PKG pkgsend add file OpenGrok mode=0555 owner=root group=bin path=/usr/opengrok/bin/OpenGrok
 PKG pkgsend add file tools/Groups mode=0555 owner=root group=sys path=/usr/opengrok/bin/Groups
+PKG pkgsend add file tools/Messages mode=0555 owner=root group=sys path=/usr/opengrok/bin/Messages

@tulinkry tulinkry force-pushed the messages branch 2 times, most recently from aed876b to b9db44e Compare October 7, 2016 11:35
@vladak
Copy link
Member

vladak commented Oct 7, 2016

bin for scripts/binaries probably makes more sense, feel free to change.

@tulinkry tulinkry force-pushed the messages branch 2 times, most recently from c26663b to b7ddd6d Compare October 7, 2016 12:27
@tulinkry
Copy link
Contributor Author

tulinkry commented Oct 7, 2016

@tarzanek ready

@tarzanek
Copy link
Contributor

tarzanek commented Oct 9, 2016

thank you sir, merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants