Adding in archiver screen, temp api calls
This commit is contained in:
@@ -1,2 +1,11 @@
|
|||||||
<form>
|
<div>
|
||||||
</form>
|
<div class="details">
|
||||||
|
Hello There {{this.potato}}
|
||||||
|
<input/>
|
||||||
|
</div>
|
||||||
|
<div class="available-versions">
|
||||||
|
Avaiable Versions Go Here
|
||||||
|
{{this.reads}}
|
||||||
|
</div>
|
||||||
|
<button class="archive-button">Archive</button>
|
||||||
|
</div>
|
||||||
@@ -1,14 +1,67 @@
|
|||||||
|
import { id as moduleId } from "../../module.json";
|
||||||
|
import { CharacterManagerClient } from "../../proto/character.client";
|
||||||
|
import { GetCharacterRequest } from '../../proto/character'
|
||||||
|
import { GrpcWebFetchTransport } from '@protobuf-ts/grpcweb-transport'
|
||||||
|
|
||||||
|
|
||||||
export class CharacterArchiver extends Application {
|
export class CharacterArchiver extends Application {
|
||||||
|
|
||||||
static override get defaultOptions() {
|
readonly characterId: String;
|
||||||
const options = super.defaultOptions;
|
readonly character: Actor | undefined;
|
||||||
options.id = "character-archiver";
|
|
||||||
options.template = "modules/rush-character-archive-foundry-module/templates/CharacterArchiver.hbs";
|
readonly client = new CharacterManagerClient(
|
||||||
options.width = 500;
|
new GrpcWebFetchTransport({
|
||||||
options.height = 270;
|
baseUrl: 'http://localhost/api',
|
||||||
options.tabs = [{ navSelector: ".tabs", contentSelector: ".theatre-config-contents", initial: "main" }];
|
format: 'binary',
|
||||||
return options;
|
}),
|
||||||
}
|
);
|
||||||
|
|
||||||
|
thingy: any;
|
||||||
|
|
||||||
|
constructor(characterId: string) {
|
||||||
|
super()
|
||||||
|
this.characterId = characterId;
|
||||||
|
this.character = (game as Game).actors!.get(characterId);
|
||||||
|
}
|
||||||
|
|
||||||
|
static override get defaultOptions() {
|
||||||
|
const options = super.defaultOptions;
|
||||||
|
options.id = "character-archiver";
|
||||||
|
options.template = `modules/${moduleId}/templates/CharacterArchiver.hbs`;
|
||||||
|
options.width = 500;
|
||||||
|
options.height = 270;
|
||||||
|
options.tabs = [];
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
override getData() {
|
||||||
|
return {
|
||||||
|
potato: "potato tato po tato",
|
||||||
|
reads: this.thingy
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override activateListeners(html: JQuery<HTMLElement>): void {
|
||||||
|
console.log("activating listeners");
|
||||||
|
super.activateListeners(html);
|
||||||
|
html
|
||||||
|
.find("button.archive-button")
|
||||||
|
.on("click", this._archiveButton.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
private async _archiveButton() {
|
||||||
|
|
||||||
|
console.log("Potato");
|
||||||
|
let request = GetCharacterRequest.fromJson({
|
||||||
|
})
|
||||||
|
console.log("Potato");
|
||||||
|
await this.client.getCharacter(request).then((res: any) => {
|
||||||
|
console.log(res)
|
||||||
|
this.thingy = res.response;
|
||||||
|
console.log(res);
|
||||||
|
this.render(true);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,19 +2,19 @@ import { CharacterManagerClient } from "../proto/character.client";
|
|||||||
import { GetCharacterRequest } from '../proto/character'
|
import { GetCharacterRequest } from '../proto/character'
|
||||||
import { GrpcWebFetchTransport } from '@protobuf-ts/grpcweb-transport'
|
import { GrpcWebFetchTransport } from '@protobuf-ts/grpcweb-transport'
|
||||||
|
|
||||||
import { ModuleData } from "@league-of-foundry-developers/foundry-vtt-types/src/foundry/common/packages.mjs";
|
// import { ModuleData } from "@league-of-foundry-developers/foundry-vtt-types/src/foundry/common/packages.mjs";
|
||||||
import { id as moduleId } from "../module.json";
|
import { id as moduleId } from "../module.json";
|
||||||
import DogBrowser from "./apps/NewCharacter";
|
// import DogBrowser from "./apps/NewCharacter";
|
||||||
|
|
||||||
import { initializeSettings } from "./settings";
|
import { initializeSettings } from "./settings";
|
||||||
import { CharacterArchiver } from "./apps/CharacterArchiver"
|
import { CharacterArchiver } from "./apps/CharacterArchiver"
|
||||||
|
|
||||||
|
|
||||||
interface MyModule extends Game.ModuleData<ModuleData> {
|
// interface MyModule extends Game.ModuleData<ModuleData> {
|
||||||
dogBrowser: DogBrowser;
|
// dogBrowser: DogBrowser;
|
||||||
}
|
// }
|
||||||
|
|
||||||
let module: MyModule;
|
// let module: MyModule;
|
||||||
|
|
||||||
Hooks.once("init", async () => {
|
Hooks.once("init", async () => {
|
||||||
|
|
||||||
@@ -45,10 +45,6 @@ Hooks.once("init", async () => {
|
|||||||
console.log("Potato");
|
console.log("Potato");
|
||||||
|
|
||||||
console.log(`Initializing ${moduleId}`);
|
console.log(`Initializing ${moduleId}`);
|
||||||
|
|
||||||
module = (game as Game).modules.get(moduleId) as MyModule;
|
|
||||||
module.dogBrowser = new DogBrowser();
|
|
||||||
module.dogBrowser.render(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add to the character sheet header bar.
|
// Add to the character sheet header bar.
|
||||||
@@ -64,7 +60,7 @@ Hooks.on("getActorSheetHeaderButtons", (app: any, buttons: any) => {
|
|||||||
icon: "fas fa-save",
|
icon: "fas fa-save",
|
||||||
onclick: (ev: any) => {
|
onclick: (ev: any) => {
|
||||||
console.log(ev)
|
console.log(ev)
|
||||||
new CharacterArchiver().render(true);
|
new CharacterArchiver("").render(true);
|
||||||
|
|
||||||
console.log("ARCHIVE ME!");
|
console.log("ARCHIVE ME!");
|
||||||
}
|
}
|
||||||
@@ -85,18 +81,26 @@ Hooks.on("getActorDirectoryEntryContext", async (html: any, options: any) => {
|
|||||||
return (game as Game).actors!.get(target.data("documentId"));
|
return (game as Game).actors!.get(target.data("documentId"));
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(getActorData)
|
// console.log("char--^^")
|
||||||
|
// console.log(getActorData(html))
|
||||||
|
// console.log(html[0])
|
||||||
|
// console.log(options)
|
||||||
|
// console.log("char^^--")
|
||||||
|
|
||||||
options.splice(
|
options.splice(
|
||||||
3,
|
3,
|
||||||
0,
|
0,
|
||||||
{
|
{
|
||||||
name: "Archive",
|
name: "Archive",
|
||||||
icon: '<i class="fas fa-save"></i>',
|
icon: '<i class="fas fa-save"></i>',
|
||||||
callback: (target: any) => {
|
callback: (target: any) => {
|
||||||
console.log(target)
|
console.log("char-->")
|
||||||
new CharacterArchiver().render(true);
|
console.log(getActorData(target))
|
||||||
},
|
console.log("char--<")
|
||||||
|
console.log(target)
|
||||||
|
console.log(target[0].dataset.documentId)
|
||||||
|
new CharacterArchiver(target[0].dataset.documentId).render(true);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user