Adding in archiver screen, temp api calls
This commit is contained in:
@@ -1,2 +1,11 @@
|
||||
<form>
|
||||
</form>
|
||||
<div>
|
||||
<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 {
|
||||
|
||||
readonly characterId: String;
|
||||
readonly character: Actor | undefined;
|
||||
|
||||
readonly client = new CharacterManagerClient(
|
||||
new GrpcWebFetchTransport({
|
||||
baseUrl: 'http://localhost/api',
|
||||
format: 'binary',
|
||||
}),
|
||||
);
|
||||
|
||||
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/rush-character-archive-foundry-module/templates/CharacterArchiver.hbs";
|
||||
options.template = `modules/${moduleId}/templates/CharacterArchiver.hbs`;
|
||||
options.width = 500;
|
||||
options.height = 270;
|
||||
options.tabs = [{ navSelector: ".tabs", contentSelector: ".theatre-config-contents", initial: "main" }];
|
||||
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 { 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 DogBrowser from "./apps/NewCharacter";
|
||||
// import DogBrowser from "./apps/NewCharacter";
|
||||
|
||||
import { initializeSettings } from "./settings";
|
||||
import { CharacterArchiver } from "./apps/CharacterArchiver"
|
||||
|
||||
|
||||
interface MyModule extends Game.ModuleData<ModuleData> {
|
||||
dogBrowser: DogBrowser;
|
||||
}
|
||||
// interface MyModule extends Game.ModuleData<ModuleData> {
|
||||
// dogBrowser: DogBrowser;
|
||||
// }
|
||||
|
||||
let module: MyModule;
|
||||
// let module: MyModule;
|
||||
|
||||
Hooks.once("init", async () => {
|
||||
|
||||
@@ -45,10 +45,6 @@ Hooks.once("init", async () => {
|
||||
console.log("Potato");
|
||||
|
||||
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.
|
||||
@@ -64,7 +60,7 @@ Hooks.on("getActorSheetHeaderButtons", (app: any, buttons: any) => {
|
||||
icon: "fas fa-save",
|
||||
onclick: (ev: any) => {
|
||||
console.log(ev)
|
||||
new CharacterArchiver().render(true);
|
||||
new CharacterArchiver("").render(true);
|
||||
|
||||
console.log("ARCHIVE ME!");
|
||||
}
|
||||
@@ -85,7 +81,11 @@ Hooks.on("getActorDirectoryEntryContext", async (html: any, options: any) => {
|
||||
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(
|
||||
3,
|
||||
@@ -94,8 +94,12 @@ Hooks.on("getActorDirectoryEntryContext", async (html: any, options: any) => {
|
||||
name: "Archive",
|
||||
icon: '<i class="fas fa-save"></i>',
|
||||
callback: (target: any) => {
|
||||
console.log("char-->")
|
||||
console.log(getActorData(target))
|
||||
console.log("char--<")
|
||||
console.log(target)
|
||||
new CharacterArchiver().render(true);
|
||||
console.log(target[0].dataset.documentId)
|
||||
new CharacterArchiver(target[0].dataset.documentId).render(true);
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user