Skip to content

Upgrading Guide

Dimitrios Zorbas edited this page Feb 21, 2017 · 5 revisions

This document contains changes required to overcome incompatibilities introduced between released versions.

0.5.1

This version packages the core Kitto JavaScript library so that it can be easier to be updated without having to manually copy files.

Download and run the update script.

via curl

sh -c "$(curl -fsSL https://gist.githubusercontent.com/Zorbash/eaffc7e24f86eac476506e62be8797dd/raw/2c43ac2d0e0f5d625e1424952578df805581c6dd/kitto_updater.sh)"

The script will download the latest versions of the core widgets (the ones that were generated with mix kitto.new) and will not keep backups of the existing sources of those widgets. Hopefully you're using a version control system like git and having made any changes to those files, it will be quite simple to keep only what you deem necessary.

application.js

It has changed to import the packaged kitto library.

import '../stylesheets/application.scss';

import $ from 'jquery';
import {Kitto} from 'kitto';

window.jQuery = window.$ = $;

Kitto.start();

assets/javascripts/{widget,helpers}.js

They are no longer required and they should be removed

package.json

Change: 7c5ea0f

You package.json has to include "kitto": "file:deps/kitto" in the dependencies section.

Widgets

Widgets have been updated to work with the packaged Kitto JavaScript library. From now on custom widgets should require Widget as follows:

// Before 0.5.1
import Widget from '../../assets/javascripts/widget';

// >= 0.5.1
import {Widget} from 'kitto';

Widgets no longer need to import helper functions like:

import {updatedAt, truncate} from '../../assets/javascripts/helpers';

All core helper functions updatedAt, shortenedNumber, prettyNumber, prepend, append, truncate are now available as instance methods of Widget.

// This
<p className="updated-at">{updatedAt(this.state.updated_at)}</p>

// Becomes
<p className="updated-at">{this.updatedAt(this.state.updated_at)}</p>

You can still import the Helpers module for use outside the scope of a Widget like:

import {Helpers} from 'kitto';

0.3.0 -> 0.3.2

Umbrella Apps Asset Serving on Production

See: #77

Umbrella apps have to change their config/config.exs adding:

config :kitto, otp_app: :name_of_your_app

Example:

For a dashboard generated with mix kitto.new photos the value of :otp_app must be :photos

0.3.0 -> 0.3.1

Error pages

Dashboard apps generated using the 0.3.1 installer include pages which are missing from previous versions. To get them run:

curl https://raw.githubusercontent.com/kittoframework/kitto/master/installer/templates/new/dashboards/error.html.eex > dashboards/error.html.eex

from the root path of your dashboard app.

Layout

In /dashboards/layout.html.eex (which is the default layout) change <%= template %> to <%= @template %>.

If you've set the :default_layout config to a different layout file, apply this change accordingly.

See: a539f37c3468