@iebh/tera-fy 1.0.1 → 1.0.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/dist/terafy.js +14 -3
- package/dist/terafy.js.map +4 -4
- package/docs/terafy.client.md +114 -85
- package/docs/terafy.server.md +220 -98
- package/index.html +52 -4
- package/lib/terafy.client.js +54 -15
- package/lib/terafy.server.js +198 -51
- package/package.json +2 -1
package/docs/terafy.server.md
CHANGED
|
@@ -9,74 +9,152 @@
|
|
|
9
9
|
<dd></dd>
|
|
10
10
|
</dl>
|
|
11
11
|
|
|
12
|
+
## Functions
|
|
13
|
+
|
|
14
|
+
<dl>
|
|
15
|
+
<dt><a href="#createContext">createContext(e)</a> ⇒ <code>Object</code></dt>
|
|
16
|
+
<dd><p>Create a context based on a shallow copy of this instance + additional functionality for the incoming MessageEvent
|
|
17
|
+
This is used by acceptMessage to provide a means to reply / send messages to the originator</p>
|
|
18
|
+
</dd>
|
|
19
|
+
<dt><a href="#senderRpc">senderRpc(method)</a> ⇒ <code>Promise.<*></code></dt>
|
|
20
|
+
<dd><p>Request an RPC call from the original sender of a mesasge
|
|
21
|
+
This function only works if the context was sub-classed via <code>createContext()</code></p>
|
|
22
|
+
</dd>
|
|
23
|
+
<dt><a href="#handshake">handshake()</a> ⇒ <code>Promise.<Object></code></dt>
|
|
24
|
+
<dd><p>Return basic server information as a form of validation</p>
|
|
25
|
+
</dd>
|
|
26
|
+
<dt><a href="#send">send(message)</a> ⇒ <code>Promise.<*></code></dt>
|
|
27
|
+
<dd><p>Send a message + wait for a response object</p>
|
|
28
|
+
</dd>
|
|
29
|
+
<dt><a href="#sendRaw">sendRaw(message)</a></dt>
|
|
30
|
+
<dd><p>Send raw message content to the client</p>
|
|
31
|
+
</dd>
|
|
32
|
+
<dt><a href="#acceptMessage">acceptMessage(Raw)</a></dt>
|
|
33
|
+
<dd><p>Accept a message from the parent event listener</p>
|
|
34
|
+
</dd>
|
|
35
|
+
<dt><a href="#requestFocus">requestFocus(cb)</a> ⇒ <code>Promise.<*></code></dt>
|
|
36
|
+
<dd><p>Wrapper function which runs a callback after the frontend UI has obtained focus
|
|
37
|
+
This is to fix the issue where the front-end needs to switch between a regular webpage and a focused TERA iFrame wrapper
|
|
38
|
+
Any use of $prompt or other UI calls should be wrapped here</p>
|
|
39
|
+
</dd>
|
|
40
|
+
<dt><a href="#getUser">getUser()</a> ⇒ <code><a href="#User">Promise.<User></a></code></dt>
|
|
41
|
+
<dd><p>Fetch the current session user</p>
|
|
42
|
+
</dd>
|
|
43
|
+
<dt><a href="#getProject">getProject()</a> ⇒ <code>Promise.<(Project|null)></code></dt>
|
|
44
|
+
<dd><p>Get the currently active project, if any</p>
|
|
45
|
+
</dd>
|
|
46
|
+
<dt><a href="#getProjects">getProjects()</a> ⇒ <code>Promise.<Array.<Project>></code></dt>
|
|
47
|
+
<dd><p>Get a list of projects the current session user has access to</p>
|
|
48
|
+
</dd>
|
|
49
|
+
<dt><a href="#setActiveProject">setActiveProject(project)</a></dt>
|
|
50
|
+
<dd><p>Set the currently active project within TERA</p>
|
|
51
|
+
</dd>
|
|
52
|
+
<dt><a href="#requireProject">requireProject([options])</a> ⇒ <code><a href="#Project">Promise.<Project></a></code></dt>
|
|
53
|
+
<dd><p>Ask the user to select a project from those available - if one isn't already active
|
|
54
|
+
Note that this function will percist in asking the uesr even if they try to cancel</p>
|
|
55
|
+
</dd>
|
|
56
|
+
<dt><a href="#selectProject">selectProject([options])</a> ⇒ <code><a href="#Project">Promise.<Project></a></code></dt>
|
|
57
|
+
<dd><p>Prompt the user to select a project from those available</p>
|
|
58
|
+
</dd>
|
|
59
|
+
<dt><a href="#getProjectStateSnapshot">getProjectStateSnapshot([options], Paths)</a> ⇒ <code>Promise.<Object></code></dt>
|
|
60
|
+
<dd><p>Return the current, full snapshot state of the active project</p>
|
|
61
|
+
</dd>
|
|
62
|
+
<dt><a href="#applyProjectStatePatch">applyProjectStatePatch()</a></dt>
|
|
63
|
+
<dd><p>Apply a computed <code>just-diff</code> patch to the current project state</p>
|
|
64
|
+
</dd>
|
|
65
|
+
<dt><a href="#getProjectLibrary">getProjectLibrary([options])</a> ⇒ <code>Promise.<Array.<RefLibRef>></code></dt>
|
|
66
|
+
<dd><p>Fetch the active projects citation library</p>
|
|
67
|
+
</dd>
|
|
68
|
+
<dt><a href="#setProjectLibrary">setProjectLibrary(Collection, [options])</a> ⇒ <code>Promise</code></dt>
|
|
69
|
+
<dd><p>Save back a projects citation library</p>
|
|
70
|
+
</dd>
|
|
71
|
+
<dt><a href="#init">init()</a></dt>
|
|
72
|
+
<dd><p>Initialize the browser listener</p>
|
|
73
|
+
</dd>
|
|
74
|
+
<dt><a href="#debug">debug()</a></dt>
|
|
75
|
+
<dd><p>Debugging output function
|
|
76
|
+
This function will only act if <code>settings.devMode</code> is truthy</p>
|
|
77
|
+
</dd>
|
|
78
|
+
</dl>
|
|
79
|
+
|
|
12
80
|
<a name="TeraFyServer"></a>
|
|
13
81
|
|
|
14
82
|
## TeraFyServer
|
|
15
83
|
**Kind**: global class
|
|
16
|
-
|
|
17
|
-
* [TeraFyServer](#TeraFyServer)
|
|
18
|
-
* [new TeraFyServer()](#new_TeraFyServer_new)
|
|
19
|
-
* [.settings](#TeraFyServer+settings) : <code>Object</code>
|
|
20
|
-
* [.sendRaw(message)](#TeraFyServer+sendRaw)
|
|
21
|
-
* [.acceptMessage(Raw)](#TeraFyServer+acceptMessage)
|
|
22
|
-
* [.handshake()](#TeraFyServer+handshake) ⇒ <code>Promise.<Object></code>
|
|
23
|
-
* [.getUser()](#TeraFyServer+getUser) ⇒ [<code>Promise.<User></code>](#User)
|
|
24
|
-
* [.getProject()](#TeraFyServer+getProject) ⇒ <code>Promise.<(Project\|null)></code>
|
|
25
|
-
* [.getProjects()](#TeraFyServer+getProjects) ⇒ <code>Promise.<Array.<Project>></code>
|
|
26
|
-
* [.requireProject()](#TeraFyServer+requireProject) ⇒ [<code>Promise.<Project></code>](#Project)
|
|
27
|
-
* [.selectProject([options])](#TeraFyServer+selectProject) ⇒ [<code>Promise.<Project></code>](#Project)
|
|
28
|
-
* [.getProjectStateSnapshot([options], Paths)](#TeraFyServer+getProjectStateSnapshot) ⇒ <code>Promise.<Object></code>
|
|
29
|
-
* [.applyProjectStatePatch()](#TeraFyServer+applyProjectStatePatch)
|
|
30
|
-
* [.getProjectLibrary([options])](#TeraFyServer+getProjectLibrary) ⇒ <code>Promise.<Array.<RefLibRef>></code>
|
|
31
|
-
* [.setProjectLibrary(Collection, [options])](#TeraFyServer+setProjectLibrary) ⇒ <code>Promise</code>
|
|
32
|
-
* [.init()](#TeraFyServer+init)
|
|
33
|
-
|
|
34
84
|
<a name="new_TeraFyServer_new"></a>
|
|
35
85
|
|
|
36
86
|
### new TeraFyServer()
|
|
37
87
|
Server-side functions available to the Tera-Fy client library
|
|
38
88
|
|
|
39
|
-
<a name="
|
|
89
|
+
<a name="User"></a>
|
|
90
|
+
|
|
91
|
+
## User
|
|
92
|
+
**Kind**: global class
|
|
93
|
+
**Properties**
|
|
94
|
+
|
|
95
|
+
| Name | Type | Description |
|
|
96
|
+
| --- | --- | --- |
|
|
97
|
+
| id | <code>String</code> | Unique identifier of the user |
|
|
98
|
+
| email | <code>String</code> | The email address of the current user |
|
|
99
|
+
| name | <code>String</code> | The provided full name of the user |
|
|
100
|
+
| isSubscribed | <code>Boolean</code> | Whether the active user has a TERA subscription |
|
|
101
|
+
|
|
102
|
+
<a name="new_User_new"></a>
|
|
103
|
+
|
|
104
|
+
### new User()
|
|
105
|
+
User / active session within TERA
|
|
40
106
|
|
|
41
|
-
|
|
42
|
-
Various settings to configure behaviour
|
|
107
|
+
<a name="Project"></a>
|
|
43
108
|
|
|
44
|
-
|
|
109
|
+
## Project
|
|
110
|
+
**Kind**: global class
|
|
45
111
|
**Properties**
|
|
46
112
|
|
|
47
113
|
| Name | Type | Description |
|
|
48
114
|
| --- | --- | --- |
|
|
49
|
-
|
|
|
50
|
-
|
|
|
115
|
+
| id | <code>String</code> | The Unique ID of the project |
|
|
116
|
+
| name | <code>String</code> | The name of the project |
|
|
117
|
+
| created | <code>String</code> | The creation date of the project as an ISO string |
|
|
118
|
+
| isOwner | <code>Boolean</code> | Whether the current session user is the owner of the project |
|
|
51
119
|
|
|
52
|
-
<a name="
|
|
120
|
+
<a name="new_Project_new"></a>
|
|
53
121
|
|
|
54
|
-
###
|
|
55
|
-
|
|
122
|
+
### new Project()
|
|
123
|
+
Project entry within TERA
|
|
124
|
+
|
|
125
|
+
<a name="createContext"></a>
|
|
56
126
|
|
|
57
|
-
|
|
127
|
+
## createContext(e) ⇒ <code>Object</code>
|
|
128
|
+
Create a context based on a shallow copy of this instance + additional functionality for the incoming MessageEvent
|
|
129
|
+
This is used by acceptMessage to provide a means to reply / send messages to the originator
|
|
130
|
+
|
|
131
|
+
**Kind**: global function
|
|
132
|
+
**Returns**: <code>Object</code> - A context, which is this instance extended with additional properties
|
|
58
133
|
|
|
59
134
|
| Param | Type | Description |
|
|
60
135
|
| --- | --- | --- |
|
|
61
|
-
|
|
|
136
|
+
| e | <code>MessageEvent</code> | Original message event to base the new context on |
|
|
62
137
|
|
|
63
|
-
<a name="
|
|
138
|
+
<a name="senderRpc"></a>
|
|
64
139
|
|
|
65
|
-
|
|
66
|
-
|
|
140
|
+
## senderRpc(method) ⇒ <code>Promise.<\*></code>
|
|
141
|
+
Request an RPC call from the original sender of a mesasge
|
|
142
|
+
This function only works if the context was sub-classed via `createContext()`
|
|
67
143
|
|
|
68
|
-
**Kind**:
|
|
144
|
+
**Kind**: global function
|
|
145
|
+
**Returns**: <code>Promise.<\*></code> - The resolved output of the server function
|
|
69
146
|
|
|
70
147
|
| Param | Type | Description |
|
|
71
148
|
| --- | --- | --- |
|
|
72
|
-
|
|
|
149
|
+
| method | <code>String</code> | The method name to call |
|
|
150
|
+
| [...] | <code>\*</code> | Optional arguments to pass to the function |
|
|
73
151
|
|
|
74
|
-
<a name="
|
|
152
|
+
<a name="handshake"></a>
|
|
75
153
|
|
|
76
|
-
|
|
154
|
+
## handshake() ⇒ <code>Promise.<Object></code>
|
|
77
155
|
Return basic server information as a form of validation
|
|
78
156
|
|
|
79
|
-
**Kind**:
|
|
157
|
+
**Kind**: global function
|
|
80
158
|
**Returns**: <code>Promise.<Object></code> - Basic promise result
|
|
81
159
|
**Properties**
|
|
82
160
|
|
|
@@ -84,41 +162,109 @@ Return basic server information as a form of validation
|
|
|
84
162
|
| --- | --- | --- |
|
|
85
163
|
| date | <code>Date</code> | Server date |
|
|
86
164
|
|
|
87
|
-
<a name="
|
|
165
|
+
<a name="send"></a>
|
|
166
|
+
|
|
167
|
+
## send(message) ⇒ <code>Promise.<\*></code>
|
|
168
|
+
Send a message + wait for a response object
|
|
169
|
+
|
|
170
|
+
**Kind**: global function
|
|
171
|
+
**Returns**: <code>Promise.<\*></code> - A promise which resolves when the operation has completed with the remote reply
|
|
172
|
+
|
|
173
|
+
| Param | Type | Description |
|
|
174
|
+
| --- | --- | --- |
|
|
175
|
+
| message | <code>Object</code> | Message object to send |
|
|
176
|
+
|
|
177
|
+
<a name="sendRaw"></a>
|
|
178
|
+
|
|
179
|
+
## sendRaw(message)
|
|
180
|
+
Send raw message content to the client
|
|
181
|
+
|
|
182
|
+
**Kind**: global function
|
|
183
|
+
|
|
184
|
+
| Param | Type | Description |
|
|
185
|
+
| --- | --- | --- |
|
|
186
|
+
| message | <code>Object</code> | Message object to send |
|
|
187
|
+
|
|
188
|
+
<a name="acceptMessage"></a>
|
|
189
|
+
|
|
190
|
+
## acceptMessage(Raw)
|
|
191
|
+
Accept a message from the parent event listener
|
|
192
|
+
|
|
193
|
+
**Kind**: global function
|
|
194
|
+
|
|
195
|
+
| Param | Type | Description |
|
|
196
|
+
| --- | --- | --- |
|
|
197
|
+
| Raw | <code>MessageEvent</code> | message event to process |
|
|
198
|
+
|
|
199
|
+
<a name="requestFocus"></a>
|
|
200
|
+
|
|
201
|
+
## requestFocus(cb) ⇒ <code>Promise.<\*></code>
|
|
202
|
+
Wrapper function which runs a callback after the frontend UI has obtained focus
|
|
203
|
+
This is to fix the issue where the front-end needs to switch between a regular webpage and a focused TERA iFrame wrapper
|
|
204
|
+
Any use of $prompt or other UI calls should be wrapped here
|
|
88
205
|
|
|
89
|
-
|
|
206
|
+
**Kind**: global function
|
|
207
|
+
**Returns**: <code>Promise.<\*></code> - A promise which resolves with the resulting inner callback payload
|
|
208
|
+
|
|
209
|
+
| Param | Type | Description |
|
|
210
|
+
| --- | --- | --- |
|
|
211
|
+
| cb | <code>function</code> | Async function to run in focused mode |
|
|
212
|
+
|
|
213
|
+
<a name="getUser"></a>
|
|
214
|
+
|
|
215
|
+
## getUser() ⇒ [<code>Promise.<User></code>](#User)
|
|
90
216
|
Fetch the current session user
|
|
91
217
|
|
|
92
|
-
**Kind**:
|
|
218
|
+
**Kind**: global function
|
|
93
219
|
**Returns**: [<code>Promise.<User></code>](#User) - The current logged in user or null if none
|
|
94
|
-
<a name="
|
|
220
|
+
<a name="getProject"></a>
|
|
95
221
|
|
|
96
|
-
|
|
222
|
+
## getProject() ⇒ <code>Promise.<(Project\|null)></code>
|
|
97
223
|
Get the currently active project, if any
|
|
98
224
|
|
|
99
|
-
**Kind**:
|
|
225
|
+
**Kind**: global function
|
|
100
226
|
**Returns**: <code>Promise.<(Project\|null)></code> - The currently active project, if any
|
|
101
|
-
<a name="
|
|
227
|
+
<a name="getProjects"></a>
|
|
102
228
|
|
|
103
|
-
|
|
229
|
+
## getProjects() ⇒ <code>Promise.<Array.<Project>></code>
|
|
104
230
|
Get a list of projects the current session user has access to
|
|
105
231
|
|
|
106
|
-
**Kind**:
|
|
232
|
+
**Kind**: global function
|
|
107
233
|
**Returns**: <code>Promise.<Array.<Project>></code> - Collection of projects the user has access to
|
|
108
|
-
<a name="
|
|
234
|
+
<a name="setActiveProject"></a>
|
|
235
|
+
|
|
236
|
+
## setActiveProject(project)
|
|
237
|
+
Set the currently active project within TERA
|
|
238
|
+
|
|
239
|
+
**Kind**: global function
|
|
109
240
|
|
|
110
|
-
|
|
241
|
+
| Param | Type | Description |
|
|
242
|
+
| --- | --- | --- |
|
|
243
|
+
| project | <code>Object</code> \| <code>String</code> | The project to set as active - either the full Project object or its ID |
|
|
244
|
+
|
|
245
|
+
<a name="requireProject"></a>
|
|
246
|
+
|
|
247
|
+
## requireProject([options]) ⇒ [<code>Promise.<Project></code>](#Project)
|
|
111
248
|
Ask the user to select a project from those available - if one isn't already active
|
|
112
249
|
Note that this function will percist in asking the uesr even if they try to cancel
|
|
113
250
|
|
|
114
|
-
**Kind**:
|
|
251
|
+
**Kind**: global function
|
|
115
252
|
**Returns**: [<code>Promise.<Project></code>](#Project) - The active project
|
|
116
|
-
<a name="TeraFyServer+selectProject"></a>
|
|
117
253
|
|
|
118
|
-
|
|
254
|
+
| Param | Type | Default | Description |
|
|
255
|
+
| --- | --- | --- | --- |
|
|
256
|
+
| [options] | <code>Object</code> | | Additional options to mutate behaviour |
|
|
257
|
+
| [options.autoSetActiveProject] | <code>Boolean</code> | <code>true</code> | After selecting a project set that project as active in TERA |
|
|
258
|
+
| [options.title] | <code>String</code> | <code>"Select a project to work with"</code> | The title of the dialog to display |
|
|
259
|
+
| [options.noSelectTitle] | <code>String</code> | <code>'Select project'</code> | Dialog title when warning the user they need to select something |
|
|
260
|
+
| [options.noSelectBody] | <code>String</code> | <code>'A project needs to be selected to continue'</code> | Dialog body when warning the user they need to select something |
|
|
261
|
+
|
|
262
|
+
<a name="selectProject"></a>
|
|
263
|
+
|
|
264
|
+
## selectProject([options]) ⇒ [<code>Promise.<Project></code>](#Project)
|
|
119
265
|
Prompt the user to select a project from those available
|
|
120
266
|
|
|
121
|
-
**Kind**:
|
|
267
|
+
**Kind**: global function
|
|
122
268
|
**Returns**: [<code>Promise.<Project></code>](#Project) - The active project
|
|
123
269
|
|
|
124
270
|
| Param | Type | Default | Description |
|
|
@@ -127,12 +273,12 @@ Prompt the user to select a project from those available
|
|
|
127
273
|
| [options.title] | <code>String</code> | <code>"Select a project to work with"</code> | The title of the dialog to display |
|
|
128
274
|
| [options.allowCancel] | <code>Boolean</code> | <code>true</code> | Advertise cancelling the operation, the dialog can still be cancelled by closing it |
|
|
129
275
|
|
|
130
|
-
<a name="
|
|
276
|
+
<a name="getProjectStateSnapshot"></a>
|
|
131
277
|
|
|
132
|
-
|
|
278
|
+
## getProjectStateSnapshot([options], Paths) ⇒ <code>Promise.<Object></code>
|
|
133
279
|
Return the current, full snapshot state of the active project
|
|
134
280
|
|
|
135
|
-
**Kind**:
|
|
281
|
+
**Kind**: global function
|
|
136
282
|
**Returns**: <code>Promise.<Object></code> - The current project state snapshot
|
|
137
283
|
|
|
138
284
|
| Param | Type | Default | Description |
|
|
@@ -141,18 +287,18 @@ Return the current, full snapshot state of the active project
|
|
|
141
287
|
| [options.autoRequire] | <code>Boolean</code> | <code>true</code> | Run `requireProject()` automatically before continuing |
|
|
142
288
|
| Paths | <code>Array.<String></code> | | to subscribe to e.g. ['/users/'], |
|
|
143
289
|
|
|
144
|
-
<a name="
|
|
290
|
+
<a name="applyProjectStatePatch"></a>
|
|
145
291
|
|
|
146
|
-
|
|
292
|
+
## applyProjectStatePatch()
|
|
147
293
|
Apply a computed `just-diff` patch to the current project state
|
|
148
294
|
|
|
149
|
-
**Kind**:
|
|
150
|
-
<a name="
|
|
295
|
+
**Kind**: global function
|
|
296
|
+
<a name="getProjectLibrary"></a>
|
|
151
297
|
|
|
152
|
-
|
|
298
|
+
## getProjectLibrary([options]) ⇒ <code>Promise.<Array.<RefLibRef>></code>
|
|
153
299
|
Fetch the active projects citation library
|
|
154
300
|
|
|
155
|
-
**Kind**:
|
|
301
|
+
**Kind**: global function
|
|
156
302
|
**Returns**: <code>Promise.<Array.<RefLibRef>></code> - Collection of references for the selected library
|
|
157
303
|
|
|
158
304
|
| Param | Type | Default | Description |
|
|
@@ -162,12 +308,12 @@ Fetch the active projects citation library
|
|
|
162
308
|
| [options.multiple] | <code>Boolean</code> | <code>false</code> | Allow selection of multiple libraries |
|
|
163
309
|
| [options.hint] | <code>String</code> \| <code>Array.<String></code> | | Hints to identify the library to select in array order of preference. Generally corresponds to the previous stage - e.g. 'deduped', 'review1', 'review2', 'dedisputed' |
|
|
164
310
|
|
|
165
|
-
<a name="
|
|
311
|
+
<a name="setProjectLibrary"></a>
|
|
166
312
|
|
|
167
|
-
|
|
313
|
+
## setProjectLibrary(Collection, [options]) ⇒ <code>Promise</code>
|
|
168
314
|
Save back a projects citation library
|
|
169
315
|
|
|
170
|
-
**Kind**:
|
|
316
|
+
**Kind**: global function
|
|
171
317
|
**Returns**: <code>Promise</code> - A promise which resolves when the save operation has completed
|
|
172
318
|
|
|
173
319
|
| Param | Type | Default | Description |
|
|
@@ -177,45 +323,21 @@ Save back a projects citation library
|
|
|
177
323
|
| [options.autoRequire] | <code>Boolean</code> | <code>true</code> | Run `requireProject()` automatically before continuing |
|
|
178
324
|
| [options.hint] | <code>String</code> | | Hint to store against the library. Generally corresponds to the current operation being performed - e.g. 'deduped' |
|
|
179
325
|
|
|
180
|
-
<a name="
|
|
326
|
+
<a name="init"></a>
|
|
181
327
|
|
|
182
|
-
|
|
328
|
+
## init()
|
|
183
329
|
Initialize the browser listener
|
|
184
330
|
|
|
185
|
-
**Kind**:
|
|
186
|
-
<a name="
|
|
187
|
-
|
|
188
|
-
## User
|
|
189
|
-
**Kind**: global class
|
|
190
|
-
**Properties**
|
|
191
|
-
|
|
192
|
-
| Name | Type | Description |
|
|
193
|
-
| --- | --- | --- |
|
|
194
|
-
| id | <code>String</code> | Unique identifier of the user |
|
|
195
|
-
| email | <code>String</code> | The email address of the current user |
|
|
196
|
-
| name | <code>String</code> | The provided full name of the user |
|
|
197
|
-
| isSubscribed | <code>Boolean</code> | Whether the active user has a TERA subscription |
|
|
198
|
-
|
|
199
|
-
<a name="new_User_new"></a>
|
|
331
|
+
**Kind**: global function
|
|
332
|
+
<a name="debug"></a>
|
|
200
333
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
<a name="Project"></a>
|
|
334
|
+
## debug()
|
|
335
|
+
Debugging output function
|
|
336
|
+
This function will only act if `settings.devMode` is truthy
|
|
205
337
|
|
|
206
|
-
|
|
207
|
-
**Kind**: global class
|
|
208
|
-
**Properties**
|
|
338
|
+
**Kind**: global function
|
|
209
339
|
|
|
210
|
-
|
|
|
340
|
+
| Param | Type | Description |
|
|
211
341
|
| --- | --- | --- |
|
|
212
|
-
|
|
|
213
|
-
| name | <code>String</code> | The name of the project |
|
|
214
|
-
| created | <code>String</code> | The creation date of the project as an ISO string |
|
|
215
|
-
| isOwner | <code>Boolean</code> | Whether the current session user is the owner of the project |
|
|
216
|
-
|
|
217
|
-
<a name="new_Project_new"></a>
|
|
218
|
-
|
|
219
|
-
### new Project()
|
|
220
|
-
Project entry within TERA
|
|
342
|
+
| [msg...] | <code>String</code> | Output to show |
|
|
221
343
|
|
package/index.html
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
.list-group-item-action select.form-control {
|
|
17
17
|
display: inline-flex;
|
|
18
|
-
max-width:
|
|
18
|
+
max-width: 100%;
|
|
19
19
|
}
|
|
20
20
|
</style>
|
|
21
21
|
|
|
@@ -43,6 +43,17 @@
|
|
|
43
43
|
* @type {Boolean}
|
|
44
44
|
*/
|
|
45
45
|
isError: null,
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Last project list from getProjects()
|
|
49
|
+
* @type {Array<Object>}
|
|
50
|
+
*/
|
|
51
|
+
projects: null,
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Currently selected project
|
|
55
|
+
*/
|
|
56
|
+
project: null,
|
|
46
57
|
}},
|
|
47
58
|
methods: {
|
|
48
59
|
/**
|
|
@@ -54,9 +65,23 @@
|
|
|
54
65
|
Promise.resolve()
|
|
55
66
|
.then(()=> this.terafy[method](...args))
|
|
56
67
|
.then(res => {
|
|
57
|
-
this.response = res
|
|
68
|
+
this.response = res === null ? '(null)'
|
|
69
|
+
: res === undefined ? '(undefined)'
|
|
70
|
+
: res;
|
|
71
|
+
|
|
58
72
|
this.isError = false;
|
|
59
73
|
})
|
|
74
|
+
.then(()=> { // Handle some API responses to populate local state {{{
|
|
75
|
+
switch (method) {
|
|
76
|
+
case 'getProjects':
|
|
77
|
+
this.projects = this.response;
|
|
78
|
+
break;
|
|
79
|
+
case 'getProject':
|
|
80
|
+
case 'requireProject':
|
|
81
|
+
case 'selectProject':
|
|
82
|
+
this.project = this.response;
|
|
83
|
+
}
|
|
84
|
+
}) // }}}
|
|
60
85
|
.catch(e => {
|
|
61
86
|
this.response = 'Error: ' + e.toString();
|
|
62
87
|
console.warn('TERA threw error', e);
|
|
@@ -82,10 +107,10 @@
|
|
|
82
107
|
<div class="card-body">
|
|
83
108
|
<div class="list-group">
|
|
84
109
|
<a
|
|
85
|
-
@click="run('
|
|
110
|
+
@click="run('toggleFocus')"
|
|
86
111
|
class="list-group-item list-group-item-action"
|
|
87
112
|
>
|
|
88
|
-
terafy.
|
|
113
|
+
terafy.toggleFocus()
|
|
89
114
|
</a>
|
|
90
115
|
|
|
91
116
|
<a
|
|
@@ -154,6 +179,29 @@
|
|
|
154
179
|
>
|
|
155
180
|
terafy.getProjects()
|
|
156
181
|
</a>
|
|
182
|
+
<a
|
|
183
|
+
@click="run('setActiveProject', project)"
|
|
184
|
+
class="list-group-item list-group-item-action"
|
|
185
|
+
:class="!projects && 'disabled'"
|
|
186
|
+
>
|
|
187
|
+
<div>terafy.setActiveProject(</div>
|
|
188
|
+
<select
|
|
189
|
+
v-if="projects"
|
|
190
|
+
v-model="project"
|
|
191
|
+
class="form-control"
|
|
192
|
+
placeholder="Select project..."
|
|
193
|
+
>
|
|
194
|
+
<option
|
|
195
|
+
v-for="project in projects"
|
|
196
|
+
:key="project.id"
|
|
197
|
+
:value="project.id"
|
|
198
|
+
>
|
|
199
|
+
{{project.id}}
|
|
200
|
+
({{project.name}})
|
|
201
|
+
</option>
|
|
202
|
+
</select>
|
|
203
|
+
<div>)</div>
|
|
204
|
+
</a>
|
|
157
205
|
<a
|
|
158
206
|
@click="run('requireProject')"
|
|
159
207
|
class="list-group-item list-group-item-action"
|