goblin-desktop 4.2.1 → 4.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goblin-desktop",
3
- "version": "4.2.1",
3
+ "version": "4.2.3",
4
4
  "description": "Goblin Desktop",
5
5
  "main": "./builders/builders.js",
6
6
  "scripts": {
@@ -18,6 +18,7 @@ module.exports = {
18
18
  stack: [],
19
19
  index: -1,
20
20
  },
21
+ mateId: null,
21
22
  teamId: null,
22
23
  current: {
23
24
  workitems: {},
@@ -155,6 +156,14 @@ module.exports = {
155
156
  'add-workitem': (state, action) => {
156
157
  return state.set('working', action.get('working'));
157
158
  },
159
+ 'setUserContext': (state, action) => {
160
+ const username = action.get('username');
161
+ const mateId = action.get('mateId');
162
+ if (mateId) {
163
+ state = state.set('mateId', mateId);
164
+ }
165
+ return state.set('username', username);
166
+ },
158
167
  'setHinter': (state, action) => {
159
168
  const workcontext = state.get('current.workcontext');
160
169
  const wid = state.get(`current.workitems.${workcontext}`);
@@ -117,6 +117,14 @@ Goblin.registerQuest(goblinName, 'change-locale', function (quest, locale) {
117
117
  quest.evt(`<${labId}>.user-locale-changed`, {locale});
118
118
  });
119
119
 
120
+ Goblin.registerQuest(goblinName, 'setUserContext', function (
121
+ quest,
122
+ username,
123
+ mateId
124
+ ) {
125
+ quest.do({username, mateId});
126
+ });
127
+
120
128
  Goblin.registerQuest(goblinName, 'setDefaultNewWorkitem', function (
121
129
  quest,
122
130
  workitem
@@ -69,12 +69,21 @@ const UserInfo = Widget.connect((state, props) => {
69
69
  teamIds.get(0)
70
70
  );
71
71
  const team = state.get(`backend.${currentTeam}.alias`, '');
72
+ const mateIds = state.get(`backend.${currentTeam}.mateIds`, '');
73
+ const items = mateIds.reduce((items, id) => {
74
+ const mate = state.get(`backend.${id}`);
75
+ if (mate) {
76
+ items.push({text: mate.get('meta.summaries.info'), value: id});
77
+ }
78
+ return items;
79
+ }, []);
72
80
 
73
81
  return {
74
82
  text: `${props.user} ${team}`,
75
83
  kind: 'main-tab-right',
84
+ items,
76
85
  };
77
- })(Button);
86
+ })(MainTabMenu);
78
87
 
79
88
  /******************************************************************************/
80
89
 
@@ -85,6 +94,7 @@ class DesktopTopbarNC extends Widget {
85
94
  this.onChangeScreen = this.onChangeScreen.bind(this);
86
95
  this.onChangeLocale = this.onChangeLocale.bind(this);
87
96
  this.onChangeTeam = this.onChangeTeam.bind(this);
97
+ this.onChangeUser = this.onChangeUser.bind(this);
88
98
  this.onTogglePrototypeMode = this.onTogglePrototypeMode.bind(this);
89
99
  }
90
100
 
@@ -100,6 +110,12 @@ class DesktopTopbarNC extends Widget {
100
110
  this.doAs('desktop', 'change-team', {teamId});
101
111
  }
102
112
 
113
+ onChangeUser(mateId) {
114
+ const state = this.getState().backend.get(mateId);
115
+ const username = state.get('meta').get('summaries').get('info');
116
+ this.doAs('desktop', 'setUserContext', {username, mateId});
117
+ }
118
+
103
119
  onTogglePrototypeMode() {
104
120
  this.doFor(this.props.clientSessionId, 'toggle-prototype-mode');
105
121
  }
@@ -109,7 +125,11 @@ class DesktopTopbarNC extends Widget {
109
125
  renderUserPart() {
110
126
  return (
111
127
  <>
112
- <UserInfo user={this.props.username} desktopId={this.props.id} />
128
+ <UserInfo
129
+ user={this.props.username}
130
+ desktopId={this.props.id}
131
+ onChange={this.onChangeUser}
132
+ />
113
133
  <TeamSelector
114
134
  kind="main-tab-right"
115
135
  desktopId={this.props.id}
@@ -205,9 +205,7 @@ class Hinter extends Widget {
205
205
  }
206
206
 
207
207
  onNew() {
208
- const model = this.getRouting().get('location.hash').substring(1);
209
- const value = this.getBackendState(model);
210
- this.do('create-new', {value});
208
+ this.do('create-new', {value: ''});
211
209
  }
212
210
 
213
211
  validate() {
@@ -39,10 +39,8 @@ class HinterNewButton extends Widget {
39
39
  }
40
40
 
41
41
  onNew() {
42
- const model = this.getRouting().get('location.hash').substring(1);
43
- const value = model ?? this.getBackendState(model);
44
42
  this.doFor(this.props.id, 'create-new', {
45
- value,
43
+ value: '',
46
44
  });
47
45
  }
48
46