mirror of
https://github.com/Sheldan/gw2-tools.git
synced 2026-01-05 00:03:25 +00:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8922c047dc | ||
|
|
1b31faa1f5 | ||
|
|
67ce24e7e3 | ||
|
|
914db3d871 | ||
|
|
02278b9e55 | ||
|
|
ebe2d3c986 | ||
|
|
aaf93297b7 | ||
|
|
627e52776b | ||
|
|
b42f3cca24 | ||
|
|
cc3f071373 | ||
|
|
5157d0ea6e | ||
|
|
2e5bd84c07 |
2
.env
2
.env
@@ -1,2 +1,2 @@
|
||||
REGISTRY_PREFIX=harbor.sheldan.dev/gw2/
|
||||
VERSION=0.0.2
|
||||
VERSION=0.0.5
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,6 +1,8 @@
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
.idea/
|
||||
target/
|
||||
*.iml
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
@@ -32,5 +34,4 @@ replay_pid*
|
||||
/gw2-tools-frontend/resources/index.html
|
||||
/gw2-tools-frontend/resources/logo192.png
|
||||
/tilt/gw2-tools-dev/Chart.lock
|
||||
*/target/*
|
||||
*.tgz
|
||||
|
||||
4
Tiltfile
4
Tiltfile
@@ -32,8 +32,8 @@ docker_build(registry + 'gw2-tools-database', 'gw2-tools-backend/database/src/ma
|
||||
|
||||
local('cd tilt/gw2-tools-dev && helm dep up')
|
||||
k8s_yaml(helm('tilt/gw2-tools-dev', values=[
|
||||
'./../drr-environments/argocd/apps/gw2-tools/values/local/values.yaml',
|
||||
'./../drr-environments/argocd/apps/gw2-tools/values/local/values.secrets.yaml'
|
||||
'./../gw2-tools-environments/argocd/apps/gw2-tools/values/local/values.yaml',
|
||||
'secrets://./../gw2-tools-environments/argocd/apps/gw2-tools/values/local/values.secrets.yaml'
|
||||
]))
|
||||
|
||||
k8s_resource('backend', port_forwards='5005:5005', labels=['applications'])
|
||||
|
||||
@@ -2,4 +2,4 @@ apiVersion: v2
|
||||
name: gw2-tools
|
||||
description: A Helm chart for Kubernetes
|
||||
type: application
|
||||
version: 0.0.2
|
||||
version: 0.0.5
|
||||
|
||||
@@ -8,7 +8,7 @@ backend:
|
||||
pullPolicy: Always
|
||||
image: gw2-tools-backend
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: 0.0.1
|
||||
tag:
|
||||
debug:
|
||||
enabled: true
|
||||
port: 5005
|
||||
@@ -73,7 +73,7 @@ dbDeployment:
|
||||
image:
|
||||
repository: harbor.sheldan.dev/gw2
|
||||
image: gw2-tools-database
|
||||
tag: 0.0.1
|
||||
tag:
|
||||
pullPolicy: Always
|
||||
|
||||
cacheJob:
|
||||
@@ -101,7 +101,7 @@ frontend:
|
||||
pullPolicy: IfNotPresent
|
||||
image: gw2-tools-frontend
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: 0.0.1
|
||||
tag:
|
||||
port: 8080
|
||||
service:
|
||||
type: ClusterIP
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.gw2.tools</groupId>
|
||||
<artifactId>gw2-tools</artifactId>
|
||||
<version>0.0.3</version>
|
||||
<version>0.0.6-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>database</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.gw2.tools</groupId>
|
||||
<artifactId>gw2-tools</artifactId>
|
||||
<version>0.0.3</version>
|
||||
<version>0.0.6-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>executable</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.gw2.tools</groupId>
|
||||
<artifactId>gw2-tools</artifactId>
|
||||
<version>0.0.3</version>
|
||||
<version>0.0.6-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>gw2-api-client</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.gw2.tools</groupId>
|
||||
<artifactId>gw2-tools</artifactId>
|
||||
<version>0.0.3</version>
|
||||
<version>0.0.6-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>packaging</artifactId>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</parent>
|
||||
<groupId>dev.sheldan.gw2.tools</groupId>
|
||||
<artifactId>gw2-tools</artifactId>
|
||||
<version>0.0.3</version>
|
||||
<version>0.0.6-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>gw2-tools</name>
|
||||
<description>Tools for GW2</description>
|
||||
@@ -25,7 +25,7 @@
|
||||
<connection>scm:git:${project.scm.url}</connection>
|
||||
<developerConnection>scm:git:${project.scm.url}</developerConnection>
|
||||
<url>https://github.com/Sheldan/gw2-tools.git</url>
|
||||
<tag>0.0.3</tag>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.gw2.tools</groupId>
|
||||
<artifactId>gw2-tools</artifactId>
|
||||
<version>0.0.3</version>
|
||||
<version>0.0.6-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>rest-api</artifactId>
|
||||
|
||||
@@ -51,8 +51,8 @@ def get_account_characters():
|
||||
api_key = request.headers.get(api_key_header_name)
|
||||
headers = {'api-key': api_key}
|
||||
logging.info("Loading characters")
|
||||
inventory_response = requests.get(f'{characters_url}', headers=headers)
|
||||
return inventory_response.text
|
||||
characters_response = requests.get(f'{characters_url}', headers=headers)
|
||||
return characters_response.text, characters_response.status_code
|
||||
|
||||
|
||||
@app.route('/inventory/')
|
||||
@@ -62,7 +62,7 @@ def get_account_inventory():
|
||||
headers = {'api-key': api_key}
|
||||
logging.info("Rendering inventory of full account")
|
||||
inventory_response = requests.get(f'{inventory_url}', headers=headers)
|
||||
text = inventory_response.text
|
||||
text = inventory_response.text, inventory_response.status_code
|
||||
return text
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ def get_account_wallet():
|
||||
headers = {'api-key': api_key}
|
||||
logging.info("Rendering wallet of account")
|
||||
wallet_response = requests.get(f'{wallet_url}', headers=headers)
|
||||
return wallet_response.text
|
||||
return wallet_response.text, wallet_response.status_code
|
||||
|
||||
|
||||
@app.route('/bank/')
|
||||
@@ -83,7 +83,7 @@ def get_account_bank():
|
||||
headers = {'api-key': api_key}
|
||||
logging.info("Rendering bank of account")
|
||||
bank_response = requests.get(f'{bank_url}', headers=headers)
|
||||
return bank_response.text
|
||||
return bank_response.text, bank_response.status_code
|
||||
|
||||
|
||||
@app.route('/materials/')
|
||||
@@ -93,7 +93,7 @@ def get_materials():
|
||||
headers = {'api-key': api_key}
|
||||
logging.info("Rendering materials of account")
|
||||
materials_response = requests.get(f'{materials_url}', headers=headers)
|
||||
return materials_response.text
|
||||
return materials_response.text, materials_response.status_code
|
||||
|
||||
|
||||
@app.route('/sharedInventory/')
|
||||
@@ -103,7 +103,7 @@ def get_shared_inventory():
|
||||
headers = {'api-key': api_key}
|
||||
logging.info("Rendering shared inventory of account")
|
||||
shared_inventory_response = requests.get(f'{shared_inventory_url}', headers=headers)
|
||||
return shared_inventory_response.text
|
||||
return shared_inventory_response.text, shared_inventory_response.status_code
|
||||
|
||||
|
||||
@app.route('/submissionTemplates/')
|
||||
@@ -111,14 +111,14 @@ def get_submission_templates():
|
||||
logging.info("Rendering submission templates")
|
||||
parameters_query = request.query_string.decode()
|
||||
submission_templates_response = requests.get(f'{submission_templates_url}?{parameters_query}')
|
||||
return submission_templates_response.text
|
||||
return submission_templates_response.text, submission_templates_response.status_code
|
||||
|
||||
|
||||
@app.route('/itemRates/')
|
||||
def get_item_rates():
|
||||
logging.info("Rendering item rates")
|
||||
item_rates_response = requests.get(f'{itemRates_url}')
|
||||
return item_rates_response.text
|
||||
return item_rates_response.text, item_rates_response.status_code
|
||||
|
||||
|
||||
@app.route('/openings/', methods=['POST'])
|
||||
@@ -128,7 +128,7 @@ def create_opening():
|
||||
headers = {'api-key': api_key, 'Content-Type': 'application/json'}
|
||||
logging.info("Creating opening")
|
||||
openings_response = requests.post(f'{openings_url}', body, headers=headers)
|
||||
return openings_response.text
|
||||
return openings_response.text, openings_response.status_code
|
||||
|
||||
|
||||
@app.route('/openings/', methods=['GET'])
|
||||
@@ -138,7 +138,7 @@ def get_openings():
|
||||
headers = {'api-key': api_key}
|
||||
logging.info("Loading openings")
|
||||
bank_response = requests.get(f'{openings_url}?{parameters_query}', headers=headers)
|
||||
return bank_response.text
|
||||
return bank_response.text, bank_response.status_code
|
||||
|
||||
|
||||
@app.route('/openings/<opening_id>', methods=['DELETE'])
|
||||
@@ -147,7 +147,7 @@ def delete_opening(opening_id):
|
||||
headers = {'api-key': api_key}
|
||||
logging.info(f"Deleting opening {opening_id}")
|
||||
bank_response = requests.delete(f'{openings_url}/{opening_id}', headers=headers)
|
||||
return bank_response.text
|
||||
return bank_response.text, bank_response.status_code
|
||||
|
||||
|
||||
@app.route('/inventory/<character_name>/')
|
||||
@@ -157,7 +157,7 @@ def get_character_inventory(character_name):
|
||||
headers = {'api-key': api_key}
|
||||
logging.info("rendering inventory of individual character.")
|
||||
inventory_response = requests.get(f'{inventory_url}/{character_name}', headers=headers)
|
||||
return inventory_response.text
|
||||
return inventory_response.text, inventory_response.status_code
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
4
gw2-tools-ui/package-lock.json
generated
4
gw2-tools-ui/package-lock.json
generated
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "drr-ui",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.5",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.5",
|
||||
"dependencies": {
|
||||
"@reduxjs/toolkit": "^2.0.1",
|
||||
"@testing-library/jest-dom": "^5.17.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gw2-tools-ui",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.5",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@reduxjs/toolkit": "^2.0.1",
|
||||
|
||||
@@ -24,13 +24,13 @@ export function Bank() {
|
||||
|
||||
const removedItems =
|
||||
<>
|
||||
{displayAdded ? <span className={styles.spanNewLine}>Removed items</span> : ''}
|
||||
{displayRemoved ? <span className={styles.spanNewLine}>Removed items</span> : ''}
|
||||
{bank.removedSlots.map((item) => <InventoryItem item={item}/>)}
|
||||
</>
|
||||
|
||||
const addedItems =
|
||||
<>
|
||||
{displayRemoved ? <span className={styles.spanNewLine}>Added Items</span> : ''}
|
||||
{displayAdded ? <span className={styles.spanNewLine}>Added Items</span> : ''}
|
||||
{bank.addedSlots.map((item) => <InventoryItem item={item}/>)}
|
||||
</>
|
||||
|
||||
@@ -42,19 +42,23 @@ export function Bank() {
|
||||
|
||||
async function reloadBank() {
|
||||
setBankLoading(true)
|
||||
const bankSlots = await fetchBank();
|
||||
if(!config.locked) {
|
||||
const bankState = {
|
||||
slots: bankSlots,
|
||||
addedSlots: [],
|
||||
removedSlots: []
|
||||
try {
|
||||
const bankSlots = await fetchBank();
|
||||
if(!config.locked) {
|
||||
const bankState = {
|
||||
slots: bankSlots,
|
||||
addedSlots: [],
|
||||
removedSlots: []
|
||||
}
|
||||
dispatch(setBank(bankState))
|
||||
} else {
|
||||
const [slotsToAdd, slotsToRemove, slotsToUpdate] = calculateBankDifferences(bank, bankSlots, config.mocking);
|
||||
dispatch(setRemovedBankSlots(slotsToRemove))
|
||||
dispatch(setAddedBankSlots(slotsToAdd))
|
||||
dispatch(updateChangedBankSlots(slotsToUpdate))
|
||||
}
|
||||
dispatch(setBank(bankState))
|
||||
} else {
|
||||
const [slotsToAdd, slotsToRemove, slotsToUpdate] = calculateBankDifferences(bank, bankSlots, config.mocking);
|
||||
dispatch(setRemovedBankSlots(slotsToRemove))
|
||||
dispatch(setAddedBankSlots(slotsToAdd))
|
||||
dispatch(updateChangedBankSlots(slotsToUpdate))
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
setBankLoading(false)
|
||||
}
|
||||
|
||||
@@ -82,8 +82,12 @@ export const CharacterInventory = ({character}) => {
|
||||
|
||||
async function updateCharacter() {
|
||||
setCharacterLoading(true)
|
||||
await reloadCharacterInventory();
|
||||
await reloadWallet();
|
||||
try {
|
||||
await reloadCharacterInventory();
|
||||
await reloadWallet();
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
setCharacterLoading(false)
|
||||
}
|
||||
|
||||
|
||||
@@ -123,11 +123,15 @@ export function ItemDifference() {
|
||||
|
||||
async function fetchInformation() {
|
||||
dispatch(setLoading(true))
|
||||
await updateWallet()
|
||||
await updateBank()
|
||||
await updateMaterials()
|
||||
await updatedSharedInventory()
|
||||
await updateInventoryCharacterSpecific()
|
||||
try {
|
||||
await updateWallet()
|
||||
await updateBank()
|
||||
await updateMaterials()
|
||||
await updatedSharedInventory()
|
||||
await updateInventoryCharacterSpecific()
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
dispatch(setLoading(false))
|
||||
}
|
||||
|
||||
|
||||
@@ -48,21 +48,26 @@ export function Materials() {
|
||||
|
||||
async function reloadMaterials() {
|
||||
setMaterialsLoading(true)
|
||||
const materialSlots = await fetchMaterials();
|
||||
if(!config.locked) {
|
||||
const materialsState = {
|
||||
slots: materialSlots,
|
||||
addedSlots: [],
|
||||
removedSlots: []
|
||||
}
|
||||
dispatch(setMaterials(materialsState))
|
||||
} else {
|
||||
const [slotsToAdd, slotsToRemove, slotsToUpdate] = calculateMaterialsDifference(materials, materialSlots, config.mocking);
|
||||
try {
|
||||
const materialSlots = await fetchMaterials();
|
||||
if(!config.locked) {
|
||||
const materialsState = {
|
||||
slots: materialSlots,
|
||||
addedSlots: [],
|
||||
removedSlots: []
|
||||
}
|
||||
dispatch(setMaterials(materialsState))
|
||||
} else {
|
||||
const [slotsToAdd, slotsToRemove, slotsToUpdate] = calculateMaterialsDifference(materials, materialSlots, config.mocking);
|
||||
|
||||
dispatch(setRemovedMaterialSlots(slotsToRemove))
|
||||
dispatch(setAddedMaterialSlots(slotsToAdd))
|
||||
dispatch(updateChangedMaterialSlots(slotsToUpdate))
|
||||
dispatch(setRemovedMaterialSlots(slotsToRemove))
|
||||
dispatch(setAddedMaterialSlots(slotsToAdd))
|
||||
dispatch(updateChangedMaterialSlots(slotsToUpdate))
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
|
||||
setMaterialsLoading(false)
|
||||
}
|
||||
|
||||
|
||||
@@ -107,12 +107,16 @@ export function OpeningSubmission() {
|
||||
|
||||
async function submitOpening() {
|
||||
dispatch(setLoading(true))
|
||||
const submissionBody = {}
|
||||
submissionBody.items = getChanges();
|
||||
submissionBody.description = openingDescription;
|
||||
await fetcher("openings", {apiKey: apiKey, method: "POST", body: JSON.stringify(submissionBody), headers: {"Content-Type": "application/json"}})
|
||||
setOpeningDescription("")
|
||||
toast('Opening has been submitted.')
|
||||
try {
|
||||
const submissionBody = {}
|
||||
submissionBody.items = getChanges();
|
||||
submissionBody.description = openingDescription;
|
||||
await fetcher("openings", {apiKey: apiKey, method: "POST", body: JSON.stringify(submissionBody), headers: {"Content-Type": "application/json"}})
|
||||
setOpeningDescription("")
|
||||
toast('Opening has been submitted.')
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
dispatch(setLoading(false))
|
||||
}
|
||||
|
||||
|
||||
@@ -72,9 +72,13 @@ export function OpeningOverview() {
|
||||
}
|
||||
|
||||
async function loadOpenings() {
|
||||
setOpeningsLoading(true)
|
||||
const openings = await fetchOpenings();
|
||||
dispatch(setOpenings(openings))
|
||||
try {
|
||||
setOpeningsLoading(true)
|
||||
const openings = await fetchOpenings();
|
||||
dispatch(setOpenings(openings))
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
setOpeningsLoading(false)
|
||||
}
|
||||
|
||||
|
||||
@@ -144,6 +144,7 @@ export function calculateBankDifferences(existingBank, incomingBankSlots, mockin
|
||||
count: 0,
|
||||
changed: -slot.count
|
||||
})
|
||||
slotsToUpdate[slot.id] = -slot.count
|
||||
}
|
||||
})
|
||||
return [slotsToAdd, slotsToRemove, slotsToUpdate];
|
||||
@@ -187,6 +188,7 @@ export function calculateSharedInventoryDifferences(existingSharedInventory, inc
|
||||
count: 0,
|
||||
changed: -slot.count
|
||||
})
|
||||
slotsToUpdate[slot.id] = -slot.count
|
||||
}
|
||||
})
|
||||
return [slotsToAdd, slotsToRemove, slotsToUpdate];
|
||||
@@ -230,6 +232,7 @@ export function calculateMaterialsDifference(materials, materialSlots, mocking)
|
||||
count: 0,
|
||||
changed: -slot.count
|
||||
})
|
||||
slotsToUpdate[slot.id] = -slot.count
|
||||
}
|
||||
})
|
||||
return [slotsToAdd, slotsToRemove, slotsToUpdate];
|
||||
|
||||
Reference in New Issue
Block a user