Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.



Excerpt

This tutorial goes step by step through creating a custom widget.

...

On the "Load" tab of the new project select the "Data Import" tab and click on "Excel" to launch the import wizard.

Step 1: Configure source

Select the 'news.xls' file to upload and click 'Next'.

Step 2: Map to item fields

In the 'Map to Item Fields' step all the fields can be left at the default mapping. Simply press "Next" again.

Step 3: Map to facets

In the 'Map to facets' step create a new facet for "Resource" this will map the incoming data to a new facet called "Resource" which we can use in the create dashboard process later.

Step 4: Schedule job

On the final screen add a data source title (eg: "Excel Test Data") and press "Next" again.

...

Code Block
languagepowershell
squirro_widget ^
    --cluster %CLUSTER% ^
    --token %TOKEN% ^
    upload ^
    --config '{"directory": "result_list_fancy", "title": "Fancy Result List", "baseWidget": "Search", "author": "Developer Name", "description": "Displays a fancy result list"}'

Note that the lines have been wrapped with the circumflex (^) at the end of each line. On Mac and Linux you will need to use backslash (\) instead.

This command assumes that you have set the variables CLUSTER and TOKEN as described in the 86053614 section above.

...

Code Block
languagejs
titlewidget.js
return Widgets.TextBase.extend({
    customEl: '.widget-content',
    renderContent: _.noop,
});

...

Code Block
languagepowershell
squirro_widget ^
    --cluster %CLUSTER% ^
    --token %TOKEN% ^
    upload ^
    --config '{"directory": "clock", "title": "Clock", "author": "Developer Name", "description": "Widget Description"}'

Note that the lines have been wrapped with the circumflex (^) at the end of each line. On Mac and Linux you will need to use backslash (\) instead.

This command assumes that you have set the variables CLUSTER and TOKEN as described in the 86053614 section above.

...

Code Block
languagejs
titlewidget.js
linenumberstrue
return Widgets.TextBase.extend({
    customEl: '.widget-content',
    renderContent: _.noop,

    _timer: null,

    afterInitialize: function () {
        this.updateTime();
    },

    updateTime: function () {
        if (this._timer) {
            clearTimeout(this._timer);
        }
        var now = new Date();
        this.$('.js-clock').text(now.toLocaleTimeString());

        this._timer = setTimeout(this.bind(this.updateTime), 500);
    }
});

...