-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b7524a2
commit 7b00911
Showing
8 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
xtuple-field-dev-sample-2 | ||
================ | ||
|
||
### Overview | ||
|
||
Customer says to you: I want a read-only, searchable list of the `metric` table in | ||
the setup area. But I also need some `foo` on every record. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/*jshint indent:2, curly:true, eqeqeq:true, immed:true, latedef:true, | ||
newcap:true, noarg:true, regexp:true, undef:true, strict:true, trailing:true, | ||
white:true*/ | ||
/*global XT:true, XM:true, XV:true, enyo:true */ | ||
|
||
(function () { | ||
"use strict"; | ||
|
||
XT.extensions.xtuple_field_dev_sample_2 = { | ||
|
||
initModels: function () { | ||
XM.MetricFoo = XM.Model.extend({ | ||
recordType: "XM.MetricFoo" | ||
}); | ||
XM.MetricFooCollection = XM.Collection.extend({ | ||
model: XM.MetricFoo | ||
}); | ||
}, | ||
|
||
initViews: function () { | ||
enyo.kind({ | ||
name: "XV.MetricFooListParameters", | ||
kind: "XV.ParameterWidget", | ||
components: [ | ||
{kind: "onyx.GroupboxHeader", content: "_metrics".loc()}, | ||
{name: "name", label: "_name".loc(), attr: "name"}, | ||
{name: "value", label: "_value".loc(), attr: "value"} | ||
] | ||
}); | ||
|
||
enyo.kind({ | ||
name: "XV.MetricFooList", | ||
kind: "XV.List", | ||
label: "_metrics".loc(), | ||
collection: "XM.MetricFooCollection", | ||
parameterWidget: "XV.MetricFooListParameters", | ||
query: {orderBy: [ | ||
{attribute: 'name'} | ||
]}, | ||
components: [ | ||
{kind: "XV.ListItem", components: [ | ||
{kind: "FittableColumns", components: [ | ||
{kind: "XV.ListColumn", classes: "first", components: [ | ||
{kind: "XV.ListAttr", attr: "name"}, | ||
{kind: "XV.ListAttr", attr: "foo"} | ||
]}, | ||
{kind: "XV.ListColumn", classes: "last", fit: true, components: [ | ||
{kind: "XV.ListAttr", attr: "value"} | ||
]} | ||
]} | ||
]} | ||
] | ||
}); | ||
|
||
XT.app.$.postbooks.appendPanels("setup", [{name: "metricFooList", kind: "XV.MetricFooList"}]); | ||
} | ||
}; | ||
|
||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/*jshint node:true, indent:2, curly:false, eqeqeq:true, immed:true, | ||
latedef:true, newcap:true, noarg:true, regexp:true, undef:true, | ||
strict:true, trailing:true, white:true */ | ||
/*global XT:true */ | ||
|
||
(function () { | ||
"use strict"; | ||
|
||
var lang = XT.stringsFor("en_US", { | ||
"_metrics": "Metrics" | ||
}); | ||
|
||
if (typeof exports !== 'undefined') { | ||
exports.language = lang; | ||
} | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
enyo.depends( | ||
"core.js" | ||
); |
44 changes: 44 additions & 0 deletions
44
source/xtuple-field-dev-sample-2/database/orm/models/metric.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[ | ||
{ | ||
"context": "xtuple-field-dev-sample-2", | ||
"nameSpace": "XM", | ||
"type": "MetricFoo", | ||
"table": "xtfielddev.metric_foo", | ||
"comment": "Metric Map With Foo", | ||
"privileges": { | ||
"all": { | ||
"create": false, | ||
"read": true, | ||
"update": false, | ||
"delete": false | ||
} | ||
}, | ||
"properties": [ | ||
{ | ||
"name": "name", | ||
"attr": { | ||
"type": "String", | ||
"column": "metric_name", | ||
"isPrimaryKey": true, | ||
"isNaturalKey": true | ||
} | ||
}, | ||
{ | ||
"name": "value", | ||
"attr": { | ||
"type": "String", | ||
"column": "metric_value" | ||
} | ||
}, | ||
{ | ||
"name": "foo", | ||
"attr": { | ||
"type": "String", | ||
"column": "foo" | ||
} | ||
} | ||
], | ||
"isSystem": true | ||
} | ||
] | ||
|
10 changes: 10 additions & 0 deletions
10
source/xtuple-field-dev-sample-2/database/source/manifest.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "xtuple-field-dev-sample-2", | ||
"version": "0.0.1", | ||
"comment": "Simple field dev 2", | ||
"loadOrder": 999, | ||
"dependencies": [], | ||
"databaseScripts": [ | ||
"metric_with_foo.sql" | ||
] | ||
} |
8 changes: 8 additions & 0 deletions
8
source/xtuple-field-dev-sample-2/database/source/metric_with_foo.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
select xt.create_schema('xtfielddev'); | ||
|
||
select xt.create_view('xtfielddev.metric_foo', $$ | ||
|
||
select metric_name, metric_value, 'foo'::text as foo | ||
from public.metric | ||
|
||
$$); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"author": "Steve Hackbarth <[email protected]>", | ||
"name": "xtuple-field-dev-sample-2", | ||
"description": "Another xTuple field dev sample", | ||
"version": "0.0.1", | ||
"dependencies": { | ||
}, | ||
"peerDependencies": { | ||
"xtuple": "~4.7.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/shackbarth/xtuple-extensions" | ||
}, | ||
"engines": { | ||
"node": "0.8.x" | ||
} | ||
} |