Data Request API helper #10
8 changed files with 43 additions and 27 deletions
|
|
@ -14,9 +14,18 @@
|
|||
"sheet-names": {
|
||||
"PlayerSheet": "Player Sheet"
|
||||
},
|
||||
"misc": {
|
||||
"Key": "Key",
|
||||
"Value": "Value",
|
||||
"no-data-submitted": "No data submitted",
|
||||
"data-query-notif-header": "Data Query Notification"
|
||||
},
|
||||
"Apps": {
|
||||
"QueryStatus": {
|
||||
"user-disconnected-tooltip": "This user is not logged in to Foundry"
|
||||
"user-disconnected-tooltip": "This user is not logged in to Foundry",
|
||||
"cancel-request": "Cancel Request",
|
||||
"finish-early": "Finish Request Early",
|
||||
"send-request": "Send Request"
|
||||
},
|
||||
"TAFDocumentSheetConfig": {
|
||||
"Sizing": "Sizing",
|
||||
|
|
@ -35,6 +44,9 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"sockets": {
|
||||
"user-list-required": "A list fo users must be provided"
|
||||
},
|
||||
"notifs": {
|
||||
"error": {
|
||||
"missing-id": "An ID must be provided",
|
||||
|
|
|
|||
|
|
@ -1,16 +1,17 @@
|
|||
import { DialogManager } from "../../utils/DialogManager.mjs";
|
||||
import { localizer } from "../../utils/localizer.mjs";
|
||||
|
||||
export async function queryCancel(payload) {
|
||||
const { id } = payload;
|
||||
|
||||
if (!id) {
|
||||
ui.notifications.error(game.i18n.format(
|
||||
ui.notifications.error(localizer(
|
||||
`taf.notifs.error.malformed-socket-payload`,
|
||||
{
|
||||
event: `query.cancel`,
|
||||
|
Oliver marked this conversation as resolved
|
||||
details: `A request ID must be provided`,
|
||||
}),
|
||||
);
|
||||
details: `taf.notifs.error.missing-id`,
|
||||
},
|
||||
));
|
||||
return;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { localizer } from "../../utils/localizer.mjs";
|
||||
import { respondedToQueries } from "../../utils/QueryManager.mjs";
|
||||
|
||||
export function queryNotify(payload) {
|
||||
|
|
@ -14,7 +15,7 @@ export function queryNotify(payload) {
|
|||
};
|
||||
|
||||
ChatMessage.implementation.create({
|
||||
|
Oliver marked this conversation as resolved
Oliver
commented
Localizing this would be nice Localizing this would be nice
|
||||
flavor: `Data Query Notification`,
|
||||
flavor: localizer(`taf.misc.data-query-notif-header`),
|
||||
content,
|
||||
whisper,
|
||||
style: CONST.CHAT_MESSAGE_STYLES.OOC,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { DialogManager } from "../../utils/DialogManager.mjs";
|
||||
import { localizer } from "../../utils/localizer.mjs";
|
||||
import { respondedToQueries } from "../../utils/QueryManager.mjs";
|
||||
|
||||
export async function queryPrompt(payload) {
|
||||
|
|
@ -10,25 +11,25 @@ export async function queryPrompt(payload) {
|
|||
} = payload;
|
||||
|
||||
if (!id) {
|
||||
ui.notifications.error(game.i18n.format(
|
||||
ui.notifications.error(localizer(
|
||||
`taf.notifs.error.malformed-socket-payload`,
|
||||
{
|
||||
event: `query.prompt`,
|
||||
details: `A request ID must be provided`,
|
||||
}),
|
||||
);
|
||||
event: `query.cancel`,
|
||||
|
Oliver marked this conversation as resolved
Outdated
Oliver
commented
Localizing this would be nice Localizing this would be nice
|
||||
details: `taf.notifs.error.missing-id`,
|
||||
},
|
||||
));
|
||||
return;
|
||||
};
|
||||
|
||||
// null/undefined is a special case for "all users but me" by default
|
||||
if (users != null && !Array.isArray(users)) {
|
||||
ui.notifications.error(game.i18n.format(
|
||||
ui.notifications.error(localizer(
|
||||
`taf.notifs.error.malformed-socket-payload`,
|
||||
{
|
||||
event: `query.prompt`,
|
||||
details: `A list of users must be provided`,
|
||||
}),
|
||||
);
|
||||
event: `query.cancel`,
|
||||
|
Oliver marked this conversation as resolved
Outdated
Oliver
commented
Localizing this would be nice Localizing this would be nice
|
||||
details: `taf.sockets.user-list-required`,
|
||||
},
|
||||
));
|
||||
return;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { addResponse, has as hasQuery } from "../../utils/QueryManager.mjs";
|
||||
import { localizer } from "../../utils/localizer.mjs";
|
||||
|
||||
export function querySubmit(payload, user) {
|
||||
const {
|
||||
|
|
@ -7,13 +8,13 @@ export function querySubmit(payload, user) {
|
|||
} = payload;
|
||||
|
||||
if (!id) {
|
||||
ui.notifications.error(game.i18n.format(
|
||||
ui.notifications.error(localizer(
|
||||
`taf.notifs.error.malformed-socket-payload`,
|
||||
{
|
||||
event: `query.submit`,
|
||||
details: `A request ID must be provided`,
|
||||
}),
|
||||
);
|
||||
event: `query.cancel`,
|
||||
|
Oliver marked this conversation as resolved
Outdated
Oliver
commented
Localizing this would be nice Localizing this would be nice
|
||||
details: `taf.notifs.error.missing-id`,
|
||||
},
|
||||
));
|
||||
return;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<div class="control-row">
|
||||
<button data-action="cancelRequest">
|
||||
Cancel Request
|
||||
{{ localize "taf.Apps.QueryStatus.cancel-request" }}
|
||||
|
Oliver marked this conversation as resolved
Outdated
Oliver
commented
Localizing this would be nice Localizing this would be nice
|
||||
</button>
|
||||
<button data-action="finishEarly">
|
||||
Finish Request Early
|
||||
{{ localize "taf.Apps.QueryStatus.finish-early" }}
|
||||
|
Oliver marked this conversation as resolved
Outdated
Oliver
commented
Localizing this would be nice Localizing this would be nice
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
type="button"
|
||||
data-action="promptUser"
|
||||
>
|
||||
Send Request
|
||||
{{ localize "taf.Apps.QueryStatus.send-request" }}
|
||||
|
Oliver marked this conversation as resolved
Oliver
commented
Localize Localize
|
||||
</button>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
{{#if answers}}
|
||||
<table class="taf-query-summary">
|
||||
<tr>
|
||||
<td>Key</td>
|
||||
<td>Value</td>
|
||||
<td>{{ localize "taf.misc.Key" }}</td>
|
||||
|
Oliver marked this conversation as resolved
Outdated
Oliver
commented
Localize Localize
|
||||
<td>{{ localize "taf.misc.Value" }}</td>
|
||||
|
Oliver marked this conversation as resolved
Outdated
Oliver
commented
Localize Localize
|
||||
</tr>
|
||||
{{#each answers as | answer |}}
|
||||
<tr>
|
||||
|
|
@ -12,5 +12,5 @@
|
|||
{{/each}}
|
||||
</table>
|
||||
{{else}}
|
||||
No data submitted
|
||||
{{ localize "taf.misc.no-data-submitted" }}
|
||||
{{/if}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue
Localizing this would be nice