Hi Devs,
On Tue, Feb 20, 2018 at 7:06 PM, Irindu Nugawela <[email protected]> wrote:
> Hi All,
> I am implementing a feature for Widget Configuration Panel of Carbon
> Dashboard's designer view,
> to allow users(dashboard designers) to configure the properties of the
> widgets such as the widget background color, widget title etc.
>
> The Current situation is that he user(dashboard designer) can only add or
> drop one of the sample widgets or create a new widget of his/her own. but
> has no control over the widget there after except for the complete removal
> of it from the dashboard.
>
> The new feature will allow modification of certain properties of the
> widget so that the user(dashboard designer) won't have to create a
> completely new widget in order to make the changes in a existing widget.
>
> Every widget has a JSON file named widgetConf.json containing it's
> configurations,
> for example: widgetConf.json of widget Overall Revenue Info
>
> {
> "name": "Overall Revenue Info",
> "id": "OverallRevenueInfo",
> "thumbnailURL": "",
> "configs": {
> "pubsub": {
> "types": [
> "subscriber"
> ]
> }
> }
> }
>
> To implement the above feature the widgetConf.json needs to be changed as
> follows
>
> {
>
> "name": "Widget Name",
>
> "id": "WidgetID",
>
> "thumbnailURL": "",
>
> "configs": {
>
> "pubsub": {
>
> "types": [
>
> "subscriber"
>
> ]
>
> },
>
> "options" : [
>
> {
>
> "id": "sampleId1",
>
> "title": "sampleTitle1",
>
> "type" : "text",
>
> "defaultData" : "SamapleData"
>
> },
>
> {
>
> "id": "sampleId2",
>
> "title": "sampleTitle2",
>
> "type" : "boolean",
>
> "defaultData" : "true"
>
> },
>
> {
>
> "id": "sampleId3",
>
> "title": "sampleTitle3",
>
> "type" : "enum",
>
> "possibleValues" : ["SamapleEnumeratedData1","
> SamapleEnumeratedData2","SamapleEnumeratedData3"],
>
> "defaultData" : "SamapleEnumeratedData1"
>
> },
>
> {
>
> "id": "sampleId4",
>
> "title": "sampleTitle4",
>
> "type" : "text",
>
> "defaultData" : "SamapleData"
>
> }
>
> ]
>
IMO, option list should be something like following:
{
id: "someId"
title: "Some Title"
type:
{
name: "text"
defaultValue: "some-default-value"
}
},
{
id: "someId"
title: "Some Title"
type:
{
name: "boolean"
defaultValue: true
}
},
{
id: "someId"
title: "Some Title"
type:
{
name: "enum"
defaultValue: "foo"
values: ["foo", "bar"]
}
}
Why?
- Proposed structure mixes properties of an option object with the
properties of a type object.
- Proposing structure gives a consistent object structure for an option
object.
id: "someId"
title: "Some Title"
type: {}
- Therefore, we can easily introduce a new type without disrupting (much)
to option list processing logic.
- "defaultData" feels awkward to me, correct term is "defaultValue"
Thanks.
> }
>
> }
>
> }
>
>
> All the user changeable options should be included in the options array
> of the widgetConf.json with one option object for each user changeable
> property.
>
> The Structure of each option object is as follows
>
> -
>
> id : this will be used to identify the corresponding property of the
> widget the option value is supposed to change.
> -
>
> title : this is the text displayed to the user(widget designer) at the
> widget configuration panel.
> -
>
> type : the type of option, it can be text, boolean or enum,
> -
>
> A text type option results in a text box.
> -
>
> A boolean type option results in a checkbox.
> -
>
> An enum type option would result in a drop down select.
>
>
>
> The minimal widget configuration panel for a widget with no other user
> changeable options would look like this.
>
>
> [image: Inline image 1]
>
>
> Please suggest any further changes required.
>
>
> Thanks & regards,
> Irindu
>
> Software Engineer Intern, WSO2 Inc.
> Mobile: +94712325238 <+94%2071%20232%205238>
>
>
--
Sajith Janaprasad Ariyarathna
Senior Software Engineer; WSO2, Inc.; http://wso2.com/
<https://wso2.com/signature>
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture