Skip to content
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

Features/interface fixes #157

Merged
merged 24 commits into from
Oct 5, 2018
Merged

Features/interface fixes #157

merged 24 commits into from
Oct 5, 2018

Conversation

RutgerLubbers
Copy link

Hi Howard,

as per previous pull request, this PR with some functionality fixes. We've bundled them together.

The changes are:
Management:

  • add group
  • remove group
  • add map to group
  • remove map from group
  • disable map

Weathermap:

  • fix overlib: show graph next to cursor when hovering
  • fix clicking on map: go to graphs
  • fix showing of map?
  • show groups as tab (design / css)

General:

  • css consistency (reload, order, etc)

These changes may not be as you would like to see the final release, but it is working now (a bit more :-) ).

Kind regards,

Rutger Lubbers

@howardjones
Copy link
Owner

Wow, this is a big one! Thanks! It'll take a little while to go through, but a couple of immediate comments:

  1. What's Q24-Readme?
  2. You're right about the approach not being the intended one, but hey, I haven't really documented that either. This will work. (specifically - the PDO queries you've added are already in MapManager which is intended to be the home for all the non-Cacti-specific parts of the management plugin)

This looks great though, I'll be reading some more later tonight!

@howardjones
Copy link
Owner

Rutger - one other thing that I thought I'd already done, but it turns out I haven't yet. I'm planning to change the license for Weathermap from GPL to MIT. Since this PR is the first major code contribution, I thought I should let you know before anything gets merged, in case that is a problem for you.

Copy link
Contributor

@pautiina pautiina left a comment

Choose a reason for hiding this comment

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

Some changes are needed, but this can be done later

@@ -59,13 +59,13 @@ public function handleManagementMainScreen($request, $appObject)
$locale = $this->manager->application->getLocale();
print "<h3>This is the React UI below here</h3>";
print "<h1>INCOMPLETE</h1>";
print '<style>@import "cacti-resources/mgmt/main.css";</style>';
print '<style>@import "/cacti/plugins/weathermap/cacti-resources/mgmt/main.css";</style>';
Copy link
Contributor

Choose a reason for hiding this comment

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

It is more correct to do this:
above add global $config;
and replace the string with:
print '<style>@import "' . $config['url_path'] . 'plugins/weathermap/cacti-resources/mgmt/main.css";</style>';

Copy link
Owner

Choose a reason for hiding this comment

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

This is the other one I was going to comment on last night, but didn't have the Cacti source handy to check the config item name. Thanks @pautiina.

Copy link
Contributor

Choose a reason for hiding this comment

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

I really should start testing this for you... but @pautiina is doing a great job and I've too many things to try out too little time.

Copy link
Author

Choose a reason for hiding this comment

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

Should be done now.

print "<h3>Testing API</h3>";
print '<a href="?action=listmaps">Map List</a> - ';
print '<a href="?action=app_settings">Settings</a> - ';
print '<a href="?action=listmapfiles">Map Files</a>';
print "<div id='weathermap-mgmt-root' data-locale='" . $locale . "' data-url='" . $this->makeURL(array("action" => "app_settings")) . "'></div>";
print '<script type="text/javascript" src="cacti-resources/mgmt/main.js"></script>';
print '<script type="text/javascript" src="/cacti/plugins/weathermap/cacti-resources/mgmt/main.js"></script>';
Copy link
Contributor

Choose a reason for hiding this comment

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

applying the above global $config
print '<script type="text/javascript" src="' . $config['url_path'] . 'plugins/weathermap/cacti-resources/mgmt/main.js"></script>';

Copy link
Author

Choose a reason for hiding this comment

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

Should be done now.

@@ -626,6 +658,23 @@ function handleMapListAdd(
}
}


protected
function handleMapsListAdd(
Copy link
Contributor

Choose a reason for hiding this comment

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

It may be better to stick to the spelling standard to write all in one line:
protected function handleMapsListAdd(

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that was a mistake. Howie doesn't normally have lines like that. Good spot!

Copy link
Author

Choose a reason for hiding this comment

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

Should be done now.

print "<h1>INCOMPLETE</h1>";
print '<style src="cacti-resources/user/main.css"></style>';
print '<style>@import "cacti-resources/user/main.css"</style>';
Copy link
Contributor

Choose a reason for hiding this comment

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

also need add global $config and change this line for this:
print '<style>@import "' . $config['url_path'] . 'plugins/weathermap/cacti-resources/user/main.css";</style>';

Copy link
Author

Choose a reason for hiding this comment

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

Should be done now.

print "<h1>INCOMPLETE</h1>";
print '<style src="cacti-resources/user/main.css"></style>';
print '<style>@import "cacti-resources/user/main.css"</style>';
print '<script type="text/javascript" src="overlib.js"></script>';
Copy link
Contributor

@pautiina pautiina Sep 18, 2018

Choose a reason for hiding this comment

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

print '<script type="text/javascript" src="' . $config['url_path'] . 'plugins/weathermap/overlib.js"></script>';

Copy link
Author

Choose a reason for hiding this comment

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

Should be done now.

Copy link
Contributor

Choose a reason for hiding this comment

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

In the cacti world we normally prefix with the $config['url_path'] but if you are using a relative path instead, the first <style> is better for efficiency. Otherwise, the browser has to do multiple steps of retrieving the CSS, importing it into a new style block, parsing that.

Copy link
Author

Choose a reason for hiding this comment

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

The first style might be more efficient. However, there is a (timing?) issue when loading the css.
If we do a 'src="..."' then the CSS does not load (on time), or is not applied.
When we do a '@import ...' then the CSS is applied.

Seems strange, however this fixes some styling issues.

Copy link
Owner

Choose a reason for hiding this comment

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

I've run into these kinds of issues too, where a reload fixed styling or Javascript loading. I had assumed it was to do with the way Cacti loads partial pages, so relative URLs aren't always reliable. I haven't looked into it deeply to confirm though.

Copy link
Author

Choose a reason for hiding this comment

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

That was what we experienced too.

The '@import' fixed (works around?) this issue. At least the CSS is now always loaded.

Copy link
Contributor

@netniV netniV Sep 21, 2018

Choose a reason for hiding this comment

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

Interesting to know. It should use the current location of the first script as the relative base unless something changes it. So, the import shouldn’t make a difference. Guess if it works, go with it as I doubt any of us have that much free time to waste when there’s a workaround 👍

print '<style src="cacti-resources/user/main.css"></style>';
print '<style>@import "cacti-resources/user/main.css"</style>';
print '<script type="text/javascript" src="overlib.js"></script>';

print "<div id='weathermap-user-root' data-locale='" . $locale . "' data-url='" . $this->makeURL(array("action" => "settings")) . "'></div>";
print '<script type="text/javascript" src="cacti-resources/user/main.js"></script>';
Copy link
Contributor

Choose a reason for hiding this comment

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

Forgot to change this line:
print '<script type="text/javascript" src="' . $config['url_path'] . 'plugins/weathermap/cacti-resources/user/main.js"></script>';

Copy link
Author

Choose a reason for hiding this comment

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

Should be done now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Again, I would revert to the direct method rather than using @imports

Copy link
Author

Choose a reason for hiding this comment

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

The first style might be more efficient. However, there is a (timing?) issue when loading the css.
If we do a 'src="..."' then the CSS does not load (on time), or is not applied.
When we do a '@import ...' then the CSS is applied.

Seems strange, however this fixes some styling issues.

@@ -98,7 +100,7 @@ public function validateArgument($type, $value)
}

if ($type != "") {
throw new WeathermapInternalFail("ValidateArgs saw unknown type");
throw new WeathermapInternalFail("ValidateArgs saw unknown type '$type'");
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about this line, namely the addition of single quotes

Copy link
Author

Choose a reason for hiding this comment

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

With the single quotes you can see the difference between an empty value, a value with spaces and typos in the message.

However, I'll remove it. :-)

Copy link
Contributor

@netniV netniV Sep 20, 2018

Choose a reason for hiding this comment

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

I would have left it as is. As you said, it makes things clear that its an actually value not just a string part of the message.

@RutgerLubbers
Copy link
Author

Howard, we're fine with the licence change.

Rutger

Copy link
Owner

@howardjones howardjones left a comment

Choose a reason for hiding this comment

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

This is looking good to me. My only change requests are:

  1. yarn.lock is supposed to be there for the two react apps
  2. Please don't make random files executable (configs/*.conf for some reason)

@pautiina
Copy link
Contributor

pautiina commented Oct 2, 2018

I think it can be merge and then change by you requests

@pautiina
Copy link
Contributor

pautiina commented Oct 5, 2018

@RutgerLubbers can you change?

@howardjones howardjones merged commit c43952f into howardjones:master Oct 5, 2018
@howardjones
Copy link
Owner

I merged and then fixed the permissions.

@pautiina
Copy link
Contributor

pautiina commented Oct 5, 2018

Thith it right

@howardjones
Copy link
Owner

Although it doesn't actually pass the tests. You ran the tests, right, Rutger?

@netniV
Copy link
Contributor

netniV commented Oct 5, 2018

@howardjones that's still the ext-snmp error we haven't managed to resolve.

@howardjones
Copy link
Owner

Fixed - the default group ID for a new map should be 1 not 0.

@howardjones
Copy link
Owner

howardjones commented Oct 5, 2018 via email

@netniV
Copy link
Contributor

netniV commented Oct 5, 2018

I didn't see that one 👍

@howardjones
Copy link
Owner

Anyway - UI is moving forwards... thanks, Rutger & co! :-)

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

Successfully merging this pull request may close these issues.

5 participants