goblin-desktop 2.0.9 → 2.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builders/wizard.js +11 -44
- package/package.json +1 -1
- package/widgets/search/widget.js +2 -4
package/builders/wizard.js
CHANGED
|
@@ -39,14 +39,9 @@ module.exports = (config) => {
|
|
|
39
39
|
hinters,
|
|
40
40
|
} = config;
|
|
41
41
|
const goblinName = `${name}-wizard`;
|
|
42
|
-
if (gadgets) {
|
|
43
|
-
for (const [alias, def] of Object.entries(gadgets)) {
|
|
44
|
-
Goblin.registerAliasNamespace(alias, `${def.type}-gadget`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
42
|
const wizardSteps = Object.keys(steps);
|
|
48
43
|
const wizardFlow = ['init'].concat(wizardSteps);
|
|
49
|
-
|
|
44
|
+
const hinterIdsByName = {};
|
|
50
45
|
// Define logic handlers according rc.json
|
|
51
46
|
const logicHandlers = {
|
|
52
47
|
'create': (state, action) => {
|
|
@@ -132,35 +127,7 @@ module.exports = (config) => {
|
|
|
132
127
|
const wizardGadgets = {};
|
|
133
128
|
|
|
134
129
|
if (gadgets) {
|
|
135
|
-
|
|
136
|
-
const gadget = gadgets[key];
|
|
137
|
-
// const newGadgetId = `${gadget.type}@${quest.goblin.id}`;
|
|
138
|
-
const newGadgetId = `${key}@${quest.goblin.id}`; // Uses 'key' instead of 'gadget.type' to allow the same gadget to be used in a wizard more than once.
|
|
139
|
-
wizardGadgets[key] = {id: newGadgetId, type: gadget.type};
|
|
140
|
-
|
|
141
|
-
if (gadgets[key].onActions) {
|
|
142
|
-
for (const handler of Object.keys(gadgets[key].onActions)) {
|
|
143
|
-
quest.goblin.defer(
|
|
144
|
-
quest.sub(`*::${newGadgetId}.${handler}`, function* (
|
|
145
|
-
err,
|
|
146
|
-
{msg, resp}
|
|
147
|
-
) {
|
|
148
|
-
const cmdName = `${key}-${handler}`;
|
|
149
|
-
yield resp.cmd(
|
|
150
|
-
`${goblinName}.${cmdName}`,
|
|
151
|
-
Object.assign({id}, msg.data)
|
|
152
|
-
);
|
|
153
|
-
})
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
yield quest.create(`${gadget.type}-gadget`, {
|
|
159
|
-
id: newGadgetId,
|
|
160
|
-
desktopId,
|
|
161
|
-
options: gadget.options || null,
|
|
162
|
-
});
|
|
163
|
-
}
|
|
130
|
+
yield common.createGadgets(quest, goblinName, gadgets, wizardGadgets);
|
|
164
131
|
}
|
|
165
132
|
if (hinters) {
|
|
166
133
|
yield quest.me.createHinters();
|
|
@@ -209,10 +176,12 @@ module.exports = (config) => {
|
|
|
209
176
|
detailWidget = `${hName}-workitem`;
|
|
210
177
|
}
|
|
211
178
|
if (quest.hasAPI(`${hName}-hinter`)) {
|
|
179
|
+
const id = `${hName}-hinter@${h}@${quest.goblin.id}`;
|
|
180
|
+
hinterIdsByName[h] = id;
|
|
212
181
|
quest.create(
|
|
213
182
|
`${hName}-hinter`,
|
|
214
183
|
{
|
|
215
|
-
id
|
|
184
|
+
id,
|
|
216
185
|
desktopId,
|
|
217
186
|
hinterName: h,
|
|
218
187
|
workitemId: quest.goblin.id,
|
|
@@ -254,11 +223,10 @@ module.exports = (config) => {
|
|
|
254
223
|
|
|
255
224
|
if (gadgets[key].onActions) {
|
|
256
225
|
for (const handler of Object.keys(gadgets[key].onActions)) {
|
|
257
|
-
|
|
226
|
+
const questName = common.jsifyQuestName(`${key}-${handler}`);
|
|
227
|
+
logicHandlers[questName] = gadgets[key].onActions[handler];
|
|
258
228
|
|
|
259
|
-
Goblin.registerSafeQuest(goblinName,
|
|
260
|
-
quest
|
|
261
|
-
) {
|
|
229
|
+
Goblin.registerSafeQuest(goblinName, questName, function* (quest) {
|
|
262
230
|
quest.do();
|
|
263
231
|
yield quest.me.update();
|
|
264
232
|
});
|
|
@@ -430,9 +398,8 @@ module.exports = (config) => {
|
|
|
430
398
|
type,
|
|
431
399
|
withDetail = true
|
|
432
400
|
) {
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
.noThrow();
|
|
401
|
+
const hinterId = hinterIdsByName[type];
|
|
402
|
+
const hinterAPI = quest.getAPI(hinterId).noThrow();
|
|
436
403
|
yield hinterAPI.show();
|
|
437
404
|
if (withDetail) {
|
|
438
405
|
yield hinterAPI.showDetail();
|
|
@@ -451,8 +418,8 @@ module.exports = (config) => {
|
|
|
451
418
|
type,
|
|
452
419
|
entityId
|
|
453
420
|
) {
|
|
421
|
+
const hinterId = hinterIdsByName[type];
|
|
454
422
|
const deskAPI = quest.getAPI(quest.getDesktop()).noThrow();
|
|
455
|
-
const hinterId = `${type}-hinter@${quest.goblin.id}`;
|
|
456
423
|
yield deskAPI.setDetail({
|
|
457
424
|
hinterId,
|
|
458
425
|
});
|
package/package.json
CHANGED
package/widgets/search/widget.js
CHANGED
|
@@ -41,14 +41,13 @@ class HinterNewButton extends Widget {
|
|
|
41
41
|
onNew() {
|
|
42
42
|
const model = this.getRouting().get('location.hash').substring(1);
|
|
43
43
|
const value = this.getModelValue(model, true);
|
|
44
|
-
this.
|
|
44
|
+
this.doFor(this.props.id, 'create-new', {
|
|
45
45
|
value,
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
render() {
|
|
50
50
|
const {id, onNew, title, type} = this.props;
|
|
51
|
-
|
|
52
51
|
if (!id) {
|
|
53
52
|
return null;
|
|
54
53
|
}
|
|
@@ -182,7 +181,6 @@ class Search extends Widget {
|
|
|
182
181
|
|
|
183
182
|
renderParams() {
|
|
184
183
|
const listId = `list@${this.props.id}`;
|
|
185
|
-
|
|
186
184
|
return (
|
|
187
185
|
<div className={this.styles.classNames.params}>
|
|
188
186
|
<div className={this.styles.classNames.pane}>
|
|
@@ -222,7 +220,7 @@ class Search extends Widget {
|
|
|
222
220
|
<div className={this.styles.classNames.sajex} />
|
|
223
221
|
|
|
224
222
|
<Container kind="actions">
|
|
225
|
-
<NewEntityButton id={this.props.
|
|
223
|
+
<NewEntityButton id={`hinter@${this.props.type}@${this.props.id}`} />
|
|
226
224
|
</Container>
|
|
227
225
|
</div>
|
|
228
226
|
);
|