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