forked from OpenWF/SpaceNinjaServer
		
	feat(webui): change SupportedSyndicate (#923)
Closes #829 Reviewed-on: OpenWF/SpaceNinjaServer#923 Reviewed-by: Sainan <sainan@calamity.inc> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									3d62fc4259
								
							
						
					
					
						commit
						90b6d13923
					
				@ -8,6 +8,7 @@ import {
 | 
				
			|||||||
    ExportRecipes,
 | 
					    ExportRecipes,
 | 
				
			||||||
    ExportResources,
 | 
					    ExportResources,
 | 
				
			||||||
    ExportSentinels,
 | 
					    ExportSentinels,
 | 
				
			||||||
 | 
					    ExportSyndicates,
 | 
				
			||||||
    ExportUpgrades,
 | 
					    ExportUpgrades,
 | 
				
			||||||
    ExportWarframes,
 | 
					    ExportWarframes,
 | 
				
			||||||
    ExportWeapons
 | 
					    ExportWeapons
 | 
				
			||||||
@ -36,6 +37,7 @@ const getItemListsController: RequestHandler = (req, response) => {
 | 
				
			|||||||
    res.SpaceSuits = [];
 | 
					    res.SpaceSuits = [];
 | 
				
			||||||
    res.MechSuits = [];
 | 
					    res.MechSuits = [];
 | 
				
			||||||
    res.miscitems = [];
 | 
					    res.miscitems = [];
 | 
				
			||||||
 | 
					    res.Syndicates = [];
 | 
				
			||||||
    for (const [uniqueName, item] of Object.entries(ExportWarframes)) {
 | 
					    for (const [uniqueName, item] of Object.entries(ExportWarframes)) {
 | 
				
			||||||
        if (
 | 
					        if (
 | 
				
			||||||
            item.productCategory == "Suits" ||
 | 
					            item.productCategory == "Suits" ||
 | 
				
			||||||
@ -160,6 +162,12 @@ const getItemListsController: RequestHandler = (req, response) => {
 | 
				
			|||||||
            badItems[uniqueName] = true;
 | 
					            badItems[uniqueName] = true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    for (const [uniqueName, syndicate] of Object.entries(ExportSyndicates)) {
 | 
				
			||||||
 | 
					        res.Syndicates.push({
 | 
				
			||||||
 | 
					            uniqueName,
 | 
				
			||||||
 | 
					            name: getString(syndicate.name, lang)
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    response.json({
 | 
					    response.json({
 | 
				
			||||||
        badItems,
 | 
					        badItems,
 | 
				
			||||||
 | 
				
			|||||||
@ -465,6 +465,15 @@
 | 
				
			|||||||
                            <div class="card-body">
 | 
					                            <div class="card-body">
 | 
				
			||||||
                                <p><button class="btn btn-primary" onclick="doUnlockAllFocusSchools();" data-loc="cheats_unlockAllFocusSchools"></button></p>
 | 
					                                <p><button class="btn btn-primary" onclick="doUnlockAllFocusSchools();" data-loc="cheats_unlockAllFocusSchools"></button></p>
 | 
				
			||||||
                                <button class="btn btn-primary" onclick="doHelminthUnlockAll();" data-loc="cheats_helminthUnlockAll"></button>
 | 
					                                <button class="btn btn-primary" onclick="doHelminthUnlockAll();" data-loc="cheats_helminthUnlockAll"></button>
 | 
				
			||||||
 | 
					                                <form class="mt-2" onsubmit="doChangeSupportedSyndicate(); return false;">
 | 
				
			||||||
 | 
					                                    <label class="form-label" for="changeSyndicate" data-loc="cheats_changeSupportedSyndicate"></label>
 | 
				
			||||||
 | 
					                                    <div class="input-group">
 | 
				
			||||||
 | 
					                                        <select class="form-control" id="changeSyndicate">
 | 
				
			||||||
 | 
					                                            <option value="" data-loc="cheats_none"></option>
 | 
				
			||||||
 | 
					                                        </select>
 | 
				
			||||||
 | 
					                                        <button class="btn btn-primary" type="submit" data-loc="cheats_changeButton"></button>
 | 
				
			||||||
 | 
					                                    </div>
 | 
				
			||||||
 | 
					                                </form>
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                        </div>
 | 
					                        </div>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
 | 
				
			|||||||
@ -191,6 +191,15 @@ function fetchItemList() {
 | 
				
			|||||||
                    });
 | 
					                    });
 | 
				
			||||||
                } else if (type == "uniqueLevelCaps") {
 | 
					                } else if (type == "uniqueLevelCaps") {
 | 
				
			||||||
                    uniqueLevelCaps = items;
 | 
					                    uniqueLevelCaps = items;
 | 
				
			||||||
 | 
					                } else if (type == "Syndicates") {
 | 
				
			||||||
 | 
					                    items.forEach(item => {
 | 
				
			||||||
 | 
					                        if (item.uniqueName.startsWith("RadioLegion")) item.name += " (" + item.uniqueName + ")";
 | 
				
			||||||
 | 
					                        const option = document.createElement("option");
 | 
				
			||||||
 | 
					                        option.value = item.uniqueName;
 | 
				
			||||||
 | 
					                        option.innerHTML = item.name;
 | 
				
			||||||
 | 
					                        document.getElementById("changeSyndicate").appendChild(option);
 | 
				
			||||||
 | 
					                        itemMap[item.uniqueName] = { ...item, type };
 | 
				
			||||||
 | 
					                    });
 | 
				
			||||||
                } else if (type != "badItems") {
 | 
					                } else if (type != "badItems") {
 | 
				
			||||||
                    items.forEach(item => {
 | 
					                    items.forEach(item => {
 | 
				
			||||||
                        if (item.uniqueName in data.badItems) {
 | 
					                        if (item.uniqueName in data.badItems) {
 | 
				
			||||||
@ -524,6 +533,8 @@ function updateInventory() {
 | 
				
			|||||||
                    single.loadRoute("/webui/inventory");
 | 
					                    single.loadRoute("/webui/inventory");
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            document.getElementById("changeSyndicate").value = data.SupportedSyndicate ?? "";
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1096,3 +1107,12 @@ function doImport() {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function doChangeSupportedSyndicate() {
 | 
				
			||||||
 | 
					    const uniqueName = document.getElementById("changeSyndicate").value;
 | 
				
			||||||
 | 
					    revalidateAuthz(() => {
 | 
				
			||||||
 | 
					        $.get("/api/setSupportedSyndicate.php?" + window.authz + "&syndicate=" + uniqueName).done(function () {
 | 
				
			||||||
 | 
					            updateInventory();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -106,6 +106,9 @@ dict = {
 | 
				
			|||||||
	cheats_account: `Account`,
 | 
						cheats_account: `Account`,
 | 
				
			||||||
	cheats_unlockAllFocusSchools: `Unlock All Focus Schools`,
 | 
						cheats_unlockAllFocusSchools: `Unlock All Focus Schools`,
 | 
				
			||||||
	cheats_helminthUnlockAll: `Fully Level Up Helminth`,
 | 
						cheats_helminthUnlockAll: `Fully Level Up Helminth`,
 | 
				
			||||||
 | 
						cheats_changeSupportedSyndicate: `Supported syndicate`,
 | 
				
			||||||
 | 
						cheats_changeButton: `Change`,
 | 
				
			||||||
 | 
						cheats_none: `None`,
 | 
				
			||||||
	import_importNote: `You can provide a full or partial inventory response (client respresentation) here. All fields that are supported by the importer <b>will be overwritten</b> in your account.`,
 | 
						import_importNote: `You can provide a full or partial inventory response (client respresentation) here. All fields that are supported by the importer <b>will be overwritten</b> in your account.`,
 | 
				
			||||||
	import_submit: `Submit`,
 | 
						import_submit: `Submit`,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -107,6 +107,9 @@ dict = {
 | 
				
			|||||||
	cheats_account: `Аккаунт`,
 | 
						cheats_account: `Аккаунт`,
 | 
				
			||||||
	cheats_unlockAllFocusSchools: `Разблокировать все школы фокуса`,
 | 
						cheats_unlockAllFocusSchools: `Разблокировать все школы фокуса`,
 | 
				
			||||||
	cheats_helminthUnlockAll: `Полностью улучшить Гельминта`,
 | 
						cheats_helminthUnlockAll: `Полностью улучшить Гельминта`,
 | 
				
			||||||
 | 
						cheats_changeSupportedSyndicate: `Поддерживаемый синдикат`,
 | 
				
			||||||
 | 
						cheats_changeButton: `Изменить`,
 | 
				
			||||||
 | 
						cheats_none: `Отсутствует`,
 | 
				
			||||||
	import_importNote: `Вы можете загрузить полный или частичный ответ инвентаря (клиентское представление) здесь. Все поддерживаемые поля <b>будут перезаписаны</b> в вашем аккаунте.`,
 | 
						import_importNote: `Вы можете загрузить полный или частичный ответ инвентаря (клиентское представление) здесь. Все поддерживаемые поля <b>будут перезаписаны</b> в вашем аккаунте.`,
 | 
				
			||||||
	import_submit: `Отправить`,
 | 
						import_submit: `Отправить`,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user