GithubHelp home page GithubHelp logo

malmostad / intranet-dashboard Goto Github PK

View Code? Open in Web Editor NEW
24.0 7.0 7.0 2.1 MB

Ruby on Rails based intranet dashboard and staff directory for employees at City of Malmö

License: GNU Affero General Public License v3.0

Ruby 67.54% CoffeeScript 5.45% JavaScript 0.01% CSS 7.17% HTML 17.20% Shell 0.78% Pascal 1.86%
intranet employees dashboard avatar-service staff-directory

intranet-dashboard's Introduction

Intranet Dashboard

The Intranet Dashboard, “Min sida”, is City of Malmö’s personalized intranet front. News and tools on the dashboard are targeted for the employee based on roles and her own preferences. The dashboards core functionality is:

  • Targeted and user selected news from the organization and external resources.
  • Staff directory with searchable employee information with data compiled from other systems and a self service interface where the employees can update their information.
  • Direct access to tools and applications based on the user’s roles and profile.
  • User managed portrait pictures. The system acts as an avatar service for other intranet systems.

For more information about the Intranet Dashboard, contact [email protected].

Dependencies

  • Ruby 2.3
  • Ruby on Rails 4.2
  • Nginx (for production)
  • MySQL
  • Elasticsearch 5.x
  • Memcached
  • Monit
  • LDAP or a SAML 2.0 IdP for authentication
  • LDAP directory for employee attributes
  • ImageMagick
  • PhantomJS (for testing)
  • Global Assets.

We use Puppet in standalone mode to setup development and server environments, see puppet-mcommons for in-depth details.

Development Setup

Development dependencies:

  • Vagrant
  • A Vagrant compatible virtual machine such as VirtualBox or VMWare

To get the project files and create a Vagrant box with a ready-to-use development environment on your own machine, run the following commands:

$ git clone [email protected]:malmostad/dashboard.git
$ cd dashboard
$ vagrant up

Check the generated install_info.txt file in the project root for database details when the provisioning has finished.

Log in to the Vagrant box as the vagrant user and start the application in the Vagrant box:

$ vagrant ssh
$ cd /vagrant
$ rails s -b 0.0.0.0

You might need to run some of the following commands if you get errors:

$ sudo apt-get install nodejs
$ bundle exec install
$ bundle exec rake db:schema:load

Point a browser on your host system to http://127.0.0.1:3031. Editing of the project files on your host system will be reflected when you hit reload in your browser.

When you run the vagrant up command for the first time it creates an Ubuntu 16.04 based Vagrant box with a ready-to-use development environment for the application. This will take some time. Vagrant will launch fast after the first run.

If you get port conflicts in your host system, change forwarded_port in the Vagrantfile You might also want to edit the value for vm.hostname and puppet.facter in the same file or do a mapping localhost mapping in your hosts host file to reflect that value.

Server Provisioning

The project contains resources for a standalone Puppet (no master) one-time provisioning setup. Do not run or re-run the provisioning on an existing server if you have made manual changes to config files generated by Puppet. It will overwrite.

On a fresh server running a base install of Ubuntu 16.04:

  1. Add app_runner as a sudo user.

  2. Log on to the server as app_runner and download the two provisioning files needed:

     $ wget https://raw.githubusercontent.com/malmostad/dashboard/master/puppet/bootstrap.sh
     $ wget https://raw.githubusercontent.com/malmostad/dashboard/master/puppet/server.pp
    
  3. Run the provisioning:

     $ sudo bash ./bootstrap.sh
    

When finished, read the generated install_info.txt file in app_runner's home directory for database details.

So, what happened?

  • Nginx, MySQL, Elasticsearch, memcached and Monit are configured and installed as services
  • A database ready for Rails migration via schema load is created (see deployment below)
  • Logrotating and database backup are configured
  • Snakeoil SSL certs are generated as placeholders
  • Ruby is compiled and managed using rbenv for the app_runner user.

The environment should now be ready for application deployment as described below.

The user app_runner must be used for all deployment task and for command executions related to the Rails application on the server. Rbenv is configured for that specific user only. The Rack application server, Unicorn, is run by app_runner.

Build and Deployment

Build and deployment is made with Capistrano 3.

In the project root, run one of the following commands including the appropriate environment name:

$ bundle exec cap staging deploy
$ bundle exec cap production deploy

Testing

Run tests before pushing code to the Git repository and before performing deployments. The application contains unit tests and high level integration/feature tests using RSpec, Capybara and PhantomJS.

Note that the test environment is named local_test due to some old Capistrano config issues.

For Ubuntu 16.04, you will need to install PhantomJS manually before running test cases:

$ cd ~/
$ wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
$ tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2
$ sudo cp phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/bin/
$ rm -rf phantomjs-2.1.1-linux-x86_64*
$ phantomjs -v

Run the test cases in the projects root directory in your Vagrant box:

$ bundle exec rspec

Feed Worker

The feed worker daemon updates all news feeds that are in use in the dashboard. It runs as a daemon started and monitored by Monit. The aggressiveness is defined in app_config.yml. The daemon is started/restarted by the Capistrano deployment in staging and production. To check the status, use Monit:

$ sudo monit status

Delayed Job Worker

The Delayed Job worker is started and monitored by Monit and is restarted after Capistrano deployment. To check the status, use Monit:

$ sudo monit status

Scheduled Jobs

The whenever gem is used to add database maintenance rake tasks to cron. Change the settings in schedule.rb to match your staging and production environments. Capistrano runs whenever during deployment.

LDAP Sync Worker

Syncing of LDAP attributes for all employees in the system is made with a worker and runs as a scheduled job defined in the whenever script schedule.rb.

Avatar Service

The system contains management of employee portraits and is used as an avatar service for other applications on the intranet with a REST API. If you use the Contacts API (below) you will get the URL to an employee's avatars.

Contacts API

A REST API for employees and group contacts is available.

License

Released under AGPL version 3.

intranet-dashboard's People

Contributors

jesperbylund avatar leonstafford avatar magnivar avatar martent avatar pbrotherton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

intranet-dashboard's Issues

Remove Employee

Administrator should be allowed to remove an employee. The account and all her data and relations will be removed permanently.

cc @jesperbylund

Alternative ways to see news

An often commented feature on the dashboard is the news box.

  1. Today, some people think that news about computer problems is in the way for other news items, and ITS feels that other news items are in the way for the important computer problem news items.
  2. Some people also would like to have news items sorted in the different sources, rather than in time.
  3. And some people would like to have the "super stream", when everything is sorted in one big list.

In order to satisfy all the different tastes, would it be possible to develop the news box with a button group and build other sorting choices? Something like this, maybe:

typ
Like before.

superstream
Every feed item mashed in one stream, time sorted.

uppdelat
every single feed in a separate subbox, subboxes possible to sort inside the box.

Aggressive warning for Explorer

Time to kill Explorer 8 and below.

If the user uses Explorer ≤8, show a warning that the intranet is not built for ancient web browsers. The warning should always be visible and not have any "ok"/"remind me later" buttons.

Member of projects

Came up when @jesperbylund and I discussed #28.

We add a "Member of projects" tagging function to the employee profiles. It has the same logic and presentation format as skills and languages. It serves to purposes:

  1. Dynamic presentation views of project groups and working units not related to the HR structure can easily be made by tagging employees.
  2. It adds another level in the employee card where one can see what the person is engaged in (for those working in a project organization).

Does not need to be released or developed at the same time as #28 but might be good to have in mind in the discussions of that one.

Exact name of the field/header for those tags can be set later, but before it is rolled out.

Add functionality for "unit" and "place of work" in the staff directory

Today the staff directory has department (förvaltning) from the AD.

I have lost hope that we will get unit (avdelning) in the AD in the foreseeable future. Therefore we will have to build something locally in the dashboard.

Suggestion:
Fileds: The field "unit" ("avdelning") and the field "place of work" ("arbetsplats").
Inheritance: Fields are inherited down through the line manager structure.
Update/fill: Only open for dashboard sub admins to fill. (new role)

Effect: If the dashboard sub admin writes "Kommunikationsavdelningen" in the field "avdelning" on Anders Mellberg http://webapps06.malmo.se/dashboard/users/andmel1 everyone below him (e.g. 1down Jesper Bylund http://webapps06.malmo.se/dashboard/users/jesbyl and 2down Åsa Olsson http://webapps06.malmo.se/dashboard/users/asaols6, and n-down) get the same value. If admin writes a different value for Jesper Bylund instead of accepting the inheritance, he and the people below him get the different value.

Field "Arbetsplats" is for having the possibility to add e.g. "Borgarskolan" on a person that belong to the unit "Utbildningsområde Söder" in the department "Grundskoleförvaltningen".

Dashboard sub admins is a group with rights to edit other employees but not edit the other stuff in the dashboard.

Expose unit and place of work after department front-end in the staff directory (taking into account that one or both fields can be empty for an employee).

BI box

@jesperbylund wrote in email:

Skulle vi kunna samla lite mer och bygga en BI-box med dessa data? BI-boxen ska visas för dem som valt kommunikationsarbete som arbetsfält.

Idéer

  1. Balans desktop-/mobil-användning denna vecka
  2. Antal inloggade hittills denna vecka
  3. Antal laddningar av dashboarden denna vecka
  4. Aktiva senaste timmen
  5. Plotta mobilanvändandet på karta, var accesser medarbetare Komin med mobilen?
  6. 3 bästa förvaltningarna (användningsfrekvens denna vecka)
  7. Antal sökningar i kontaktboken denna vecka

Theme box, enhancement

The first iteration of the Theme box in the dashboard is not the perfect solution. Work with real content in it has shown that it is very hard to get the pictures look good. There is too much uncertainty about the end result front-end due to the auto cropping.

Maybe we should build back-end production controls for this box locally in the dashboard instead? The producer writes header and blurb, uploads a picture and paste a link. Then we could get more control over the picture format, and higher pic quality front end.

Corners on search fields and buttons

Some of the corners on the search fields and buttons are sharp and some rounded on the fly down search in the masthead. The single field shown in masthead should have rounded corners, when the full box is shown, edges that is connected to another object should be sharp, others rounded.

Spotted by Svempan, not on Github.

cc @jesperbylund

Upgrade to Rails 4.0 or 4.1

We should upgrade the Dashboard from Rails 3.2.x to 4.0 (or 4.1 if a stable is released) during Q1. This requires code changes but is prepared.

The Dashboard has run Rails 3.2.x since start and has only been upgrade with patch versions. 3.2 was the last minor version in 3 major.

@jesperbylund

Sync geodata for address

Use the streetaddress from the LDAP and query SBK’s address API to get geo data. Make the address clickable in the presentation and show it on a map if the street address was found in the address API.

@jesperbylund

Enhancements front-end in the box "Verktyg & system" and "Jag vill"

Scope: Make it more obvious that it is possible to adjust the content in the dashboard box "Verktyg & system". Expand the possibilities to personalize the box.

enh_verktygsystem

More touch-friendly text in staff directory

When using the staff directory in the mobile skills and projects are links in a paragraph. It is easy to read, but it is hard to click on the right skill/project.

Bigger text, more spacing or/and a different way of presenting the content is needed.

Users removed from LDAP

When employees are remove from the LDAP directory or when they are moved outside the ou personal (both happens), should they be removed from the Employee DB or should we keep them but mark them as inactive?

Should we rely on the IdP when it comes to authorisation or should we lock them out if we mark them as inactive?

Upgrade Ruby in production

Upgrading the Dashboard from Ruby 1.9.3 to Ruby 2.1 is prepared. All test cases are passing and I've run it in Ruby 2.1 locally for two weeks.

Since test and production are on the same server there is a risk for failure. Upgrading will be done off work hours and the maintenance page will be displayed. Production will be restarted first. Downgrading will be done on failure or if we see any problems when monitoring the environment after upgrade.

Site search on s1 runs on Ruby 2.1 since a week and was upgrade from Ruby 2.0 without downtime during work hours. That server has a more flexible setup.

@jesperbylund

Compress boxes "Verktyg & system" and "Jag vill" at ≤44em

Compress boxes "Verktyg & system" and "Jag vill" in ≤44em (= when the dashboard becomes 1 column) so that not all lists are exposed.

Button "Visa verktyg" in the box like "Visa fler" in the news box? Or a "closed box" (which we don't have design for today)? Control "open/closed" in the box head might collide with the adjust control.

Admin function for merging skills and languages

Some skills/languages are the same, but users have spelled them differently.

Admin function for merging two different skills/languages into one. (Relevant users should get the new, merged value instead of the old one.)

Auto suggest on employee search

  1. Enable auto suggest on employee search in the masthead. Do not required authentication.
  2. Route users not logged on to the page they requested before they ended up on the login page. General function but needed for (1) to make sense.

cc @jesperbylund

Switch places of column 1 and 2 in test

Switch places of column 1 and 2 in test so I can evaluate if this easy solution is ok for getting the content in a better order in mobile devices.

Alt. give me some code to paste in my laptops client browser that do the same thing.

Export a contact as a vCard

Got a request from a manager in the organisation. He would like to have the possibility to export a contact in the staff directory as a vCard/similar file. I guess we should support the best format for iOS and Android and maybe Windows Phone.

How big is this function to develop?

Error in address lookup in the staff directory

When a user tries to specify a visiting address, the system does ont give any suggestions for some street addresses, e.g.:
Södergatan
von rosens väg
stora ...
västra ...

But other street addresses are working, like:
August ...
Bergsgatan

Group contact fields mapping

Here is a draft for the data mapping from MalmoAut to the new group contacts in the dashboard.

Human MalmoAut Dashboard Data Model
Titel cn name
E-post malmokonepost email
Fast telefon malmokontelefonnr phone
Mobil cell_phone
Fax malmokonfaxnr fax
Telefontider malmokonteletid phone_hours
Hemsida malmokonhemsida homepage
Postadress malmokonpostadr address
malmokonpostnr zip_code
postal_town
geo_position_x
geo_position_y
district
Besöksadress malmokonbesokadr visitors_address
malmokonbesokpostnr visitors_address_zip_code
visitors_address_postal_town
visitors_address_geo_position_x
visitors_address_geo_position_y
visitors_district
Besökstider malmokonbesoktid visiting_hours
malmoforvaltningn

The mapping requires that the address/visitors address, zip code and postal town (SBK's name) are split into three separate fields. Shouldn't be that much of a job to do manually but it requires that the existing posts in MalmoAut isn't edited in the meantime.

On the other hand, if we don't have any need for separating those fields, for the the address and visitors address we can keep them as they are and merge the SBK Map fields when they are updated. Simplified, and without the geo positions, it will look like this:

Human MalmoAut Dashboard Data Model
Titel cn name
E-post malmokonepost email
Fast telefon malmokontelefonnr phone
Mobil cell_phone
Fax malmokonfaxnr fax
Telefontider malmokonteletid phone_hours
Hemsida malmokonhemsida homepage
Postadress malmokonpostadr address
geo_position_x
geo_position_y
district
Besöksadress malmokonbesokadr visitors_address
malmokonbesokpostnr visitors_address_geo_position_x
malmokonbesokpostnr visitors_address_geo_position_y
visitors_district
Besökstider malmokonbesoktid visiting_hours
malmoforvaltningn

Is the data field malmoforvaltningn used for anything? It is surely use in the contact portlet itself, i.e. the consuming application, but the value is selected there for a specific card and not fetch from MalmoAut. To put it differently, the editor can assign any department to any card in the portlet no matter what is in the catalog.

Notes

geo_positions* will be retrieved when a post is manually updated, or if we implement #7 that is on hold. Since there are a lot of map view problems, we may limit the "Show on map" links to the post that have a geo position and not just an address.

I guess we need the geo data for both the addressand the visitors_address since the first is used for both in many cases when the second is empty, i.e. same visiting and mail deivery address.

Self-service management for room and streetaddress

The employee can trigger a change for the fields room and streetaddres. The change will not be made directly in the EmployeeDB but an email will be sent to the phone switchboard group who will change it in the LDAP catalog. On the next LDAP sync, the EmployeeDB will be updated with the new information.

The email will contain the employee’s:

  1. username
  2. email address
  3. phone number
  4. and a direct link to the employee’s contact card

cc: @jesperbylund

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.