rule book ui
This commit is contained in:
+94
-57
@@ -108,6 +108,57 @@ paths:
|
||||
'*/*':
|
||||
schema:
|
||||
$ref: "#/components/schemas/CombinedLedgerResponse"
|
||||
/characters/{characterId}/rule-book:
|
||||
get:
|
||||
tags:
|
||||
- rule-book-controller
|
||||
operationId: findByCharacterId
|
||||
parameters:
|
||||
- name: characterId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
"404":
|
||||
description: Not Found
|
||||
"400":
|
||||
description: Bad Request
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
'*/*':
|
||||
schema:
|
||||
$ref: "#/components/schemas/RuleBookResponse"
|
||||
post:
|
||||
tags:
|
||||
- rule-book-controller
|
||||
operationId: setCharacterRuleBook
|
||||
parameters:
|
||||
- name: characterId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/SetCharacterRuleBookRequest"
|
||||
required: true
|
||||
responses:
|
||||
"404":
|
||||
description: Not Found
|
||||
"400":
|
||||
description: Bad Request
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
'*/*':
|
||||
schema:
|
||||
$ref: "#/components/schemas/RuleBookResponse"
|
||||
/activity/fetch/{characterId}:
|
||||
post:
|
||||
tags:
|
||||
@@ -190,29 +241,6 @@ paths:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/CharacterResponse"
|
||||
/characters/{characterId}/rule-book:
|
||||
get:
|
||||
tags:
|
||||
- rule-book-controller
|
||||
operationId: findByCharacterId
|
||||
parameters:
|
||||
- name: characterId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
"404":
|
||||
description: Not Found
|
||||
"400":
|
||||
description: Bad Request
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
'*/*':
|
||||
schema:
|
||||
$ref: "#/components/schemas/RuleBookResponse"
|
||||
components:
|
||||
schemas:
|
||||
UpdateMainLedgerRequest:
|
||||
@@ -301,40 +329,6 @@ components:
|
||||
required:
|
||||
- memberLedgerIds
|
||||
- name
|
||||
LedgerResponse:
|
||||
type: object
|
||||
discriminator:
|
||||
propertyName: type
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- MAIN
|
||||
- COMBINED
|
||||
CharacterResponse:
|
||||
type: object
|
||||
properties:
|
||||
characterId:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- characterId
|
||||
- name
|
||||
RuleBookResponse:
|
||||
type: object
|
||||
properties:
|
||||
characterId:
|
||||
type: integer
|
||||
format: int64
|
||||
ruleSets:
|
||||
type: object
|
||||
additionalProperties:
|
||||
$ref: "#/components/schemas/RuleSetResponse"
|
||||
required:
|
||||
- characterId
|
||||
- ruleSets
|
||||
RuleResponse:
|
||||
type: object
|
||||
properties:
|
||||
@@ -363,3 +357,46 @@ components:
|
||||
$ref: "#/components/schemas/RuleResponse"
|
||||
required:
|
||||
- rules
|
||||
SetCharacterRuleBookRequest:
|
||||
type: object
|
||||
properties:
|
||||
ruleSets:
|
||||
type: object
|
||||
additionalProperties:
|
||||
$ref: "#/components/schemas/RuleSetResponse"
|
||||
required:
|
||||
- ruleSets
|
||||
RuleBookResponse:
|
||||
type: object
|
||||
properties:
|
||||
characterId:
|
||||
type: integer
|
||||
format: int64
|
||||
ruleSets:
|
||||
type: object
|
||||
additionalProperties:
|
||||
$ref: "#/components/schemas/RuleSetResponse"
|
||||
required:
|
||||
- characterId
|
||||
- ruleSets
|
||||
LedgerResponse:
|
||||
type: object
|
||||
discriminator:
|
||||
propertyName: type
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- MAIN
|
||||
- COMBINED
|
||||
CharacterResponse:
|
||||
type: object
|
||||
properties:
|
||||
characterId:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- characterId
|
||||
- name
|
||||
|
||||
@@ -100,6 +100,9 @@ export type RuleResponseRateEnum = typeof RuleResponseRateEnum[keyof typeof Rule
|
||||
export interface RuleSetResponse {
|
||||
'rules': Array<RuleResponse>;
|
||||
}
|
||||
export interface SetCharacterRuleBookRequest {
|
||||
'ruleSets': { [key: string]: RuleSetResponse; };
|
||||
}
|
||||
export interface UpdateCombinedLedgerRequest {
|
||||
'name': string;
|
||||
'memberLedgerIds': Array<string>;
|
||||
@@ -755,6 +758,44 @@ export const RuleBookControllerApiAxiosParamCreator = function (configuration?:
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {number} characterId
|
||||
* @param {SetCharacterRuleBookRequest} setCharacterRuleBookRequest
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
setCharacterRuleBook: async (characterId: number, setCharacterRuleBookRequest: SetCharacterRuleBookRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'characterId' is not null or undefined
|
||||
assertParamExists('setCharacterRuleBook', 'characterId', characterId)
|
||||
// verify required parameter 'setCharacterRuleBookRequest' is not null or undefined
|
||||
assertParamExists('setCharacterRuleBook', 'setCharacterRuleBookRequest', setCharacterRuleBookRequest)
|
||||
const localVarPath = `/characters/{characterId}/rule-book`
|
||||
.replace('{characterId}', encodeURIComponent(String(characterId)));
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||
let baseOptions;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
}
|
||||
|
||||
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
localVarHeaderParameter['Accept'] = '*/*';
|
||||
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
localVarRequestOptions.data = serializeDataIfNeeded(setCharacterRuleBookRequest, localVarRequestOptions, configuration)
|
||||
|
||||
return {
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
@@ -781,6 +822,19 @@ export const RuleBookControllerApiFp = function(configuration?: Configuration) {
|
||||
const localVarOperationServerBasePath = operationServerMap['RuleBookControllerApi.findByCharacterId']?.[localVarOperationServerIndex]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {number} characterId
|
||||
* @param {SetCharacterRuleBookRequest} setCharacterRuleBookRequest
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async setCharacterRuleBook(characterId: number, setCharacterRuleBookRequest: SetCharacterRuleBookRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RuleBookResponse>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.setCharacterRuleBook(characterId, setCharacterRuleBookRequest, options);
|
||||
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||
const localVarOperationServerBasePath = operationServerMap['RuleBookControllerApi.setCharacterRuleBook']?.[localVarOperationServerIndex]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
@@ -799,6 +853,16 @@ export const RuleBookControllerApiFactory = function (configuration?: Configurat
|
||||
findByCharacterId(characterId: number, options?: RawAxiosRequestConfig): AxiosPromise<RuleBookResponse> {
|
||||
return localVarFp.findByCharacterId(characterId, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {number} characterId
|
||||
* @param {SetCharacterRuleBookRequest} setCharacterRuleBookRequest
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
setCharacterRuleBook(characterId: number, setCharacterRuleBookRequest: SetCharacterRuleBookRequest, options?: RawAxiosRequestConfig): AxiosPromise<RuleBookResponse> {
|
||||
return localVarFp.setCharacterRuleBook(characterId, setCharacterRuleBookRequest, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -815,6 +879,17 @@ export class RuleBookControllerApi extends BaseAPI {
|
||||
public findByCharacterId(characterId: number, options?: RawAxiosRequestConfig) {
|
||||
return RuleBookControllerApiFp(this.configuration).findByCharacterId(characterId, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} characterId
|
||||
* @param {SetCharacterRuleBookRequest} setCharacterRuleBookRequest
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
public setCharacterRuleBook(characterId: number, setCharacterRuleBookRequest: SetCharacterRuleBookRequest, options?: RawAxiosRequestConfig) {
|
||||
return RuleBookControllerApiFp(this.configuration).setCharacterRuleBook(characterId, setCharacterRuleBookRequest, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { LoadingSpinner, Tooltip } from '@/components';
|
||||
import { formatIsk } from '@/formaters';
|
||||
import { getHistory, getHistoryQuartils } from '@/market';
|
||||
import { ArrowTrendingDownIcon, ArrowTrendingUpIcon } from '@heroicons/vue/24/outline';
|
||||
import { computedAsync } from '@vueuse/core';
|
||||
import { ref, watchEffect } from 'vue';
|
||||
import {LoadingSpinner, Tooltip} from '@/components';
|
||||
import {formatIsk} from '@/formaters';
|
||||
import {getHistory, getHistoryQuartils} from '@/market';
|
||||
import {ArrowTrendingDownIcon, ArrowTrendingUpIcon} from '@heroicons/vue/24/outline';
|
||||
import {computedAsync} from '@vueuse/core';
|
||||
import {ref, watchEffect} from 'vue';
|
||||
|
||||
const trendingScale = 3;
|
||||
|
||||
@@ -76,6 +76,7 @@ watchEffect(async () => {
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
|
||||
.tooltip {
|
||||
@apply ms-auto;
|
||||
>:deep(div.header) {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { ClipboardButton } from '@/components';
|
||||
import { MarketType, MarketTypeInput, getMarketType, useApraisalStore } from "@/market";
|
||||
import { AcquisitionResultTable, BuyModal, useAcquiredTypesStore } from '@/market/acquisition';
|
||||
import { TrackingResultTable, createResult, useMarketTrackingStore } from '@/market/tracking';
|
||||
import { BookmarkIcon, BookmarkSlashIcon, ShoppingCartIcon } from '@heroicons/vue/24/outline';
|
||||
import { computedAsync } from '@vueuse/core/index.cjs';
|
||||
import {ClipboardButton} from '@/components';
|
||||
import {getMarketType, MarketType, MarketTypeInput, useApraisalStore} from "@/market";
|
||||
import {AcquisitionResultTable, BuyModal, useAcquiredTypesStore} from '@/market/acquisition';
|
||||
import {createResult, TrackingResultTable, useMarketTrackingStore} from '@/market/tracking';
|
||||
import {BookmarkIcon, BookmarkSlashIcon, ShoppingCartIcon} from '@heroicons/vue/24/outline';
|
||||
import log from "loglevel";
|
||||
import { computed, ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import {computed, ref, watch} from "vue";
|
||||
import {useRoute, useRouter} from "vue-router";
|
||||
import {computedAsync} from "@vueuse/core";
|
||||
|
||||
const buyModal = ref<typeof BuyModal>();
|
||||
|
||||
@@ -115,6 +115,7 @@ watch(useRoute(), async route => {
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
|
||||
img.type-image {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
|
||||
@@ -3,7 +3,7 @@ import {Character, CharacterLabel, useCharactersStore} from "@/characters";
|
||||
import {useRoute} from "vue-router";
|
||||
import {ref, watch, watchEffect} from "vue";
|
||||
import log from "loglevel";
|
||||
import {activityTypes, findByCharacterId, RuleBook, RuleSetInput} from "@/rules";
|
||||
import {activityTypes, findByCharacterId, RuleBook, RuleSetInput, setCharacterRuleBook} from "@/rules";
|
||||
|
||||
const {findById: findCharacterById} = useCharactersStore();
|
||||
const character = ref<Character>();
|
||||
@@ -18,6 +18,14 @@ watchEffect(async () => {
|
||||
}
|
||||
});
|
||||
|
||||
const save = () => {
|
||||
const characterId = character.value?.characterId;
|
||||
|
||||
if (characterId && ruleBook.value) {
|
||||
setCharacterRuleBook(characterId, ruleBook.value);
|
||||
}
|
||||
}
|
||||
|
||||
watch(useRoute(), async route => {
|
||||
if (route.params.characterId) {
|
||||
const id = parseInt(typeof route.params.characterId === 'string' ? route.params.characterId : route.params.characterId[0]);
|
||||
@@ -35,6 +43,9 @@ watch(useRoute(), async route => {
|
||||
<div v-if="character" class="grid mb-2 mt-4">
|
||||
<div class="mb-2 border-b-1 flex">
|
||||
<CharacterLabel class="flex grow mb-2" :character="character" :size="64" />
|
||||
<div>
|
||||
<button @click="save">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="ruleBook" class="flex-col">
|
||||
<div class="flex-col grow border-b-1" v-for="activityType in activityTypes" :key="activityType">
|
||||
|
||||
+4
-1
@@ -13,4 +13,7 @@ export type RuleBook = RuleBookResponse & { ruleSets: { [key: ActivityType]: Rul
|
||||
|
||||
export const findByCharacterId = (characterId: number): Promise<RuleBook> => ruleBookControllerApi.findByCharacterId(characterId)
|
||||
.then(response => response.data)
|
||||
.catch(() => ({characterId, ruleSets: {}}));
|
||||
.catch(() => ({characterId, ruleSets: {}}));
|
||||
|
||||
export const setCharacterRuleBook = (characterId: number, ruleBook: RuleBook): Promise<RuleBook> => ruleBookControllerApi.setCharacterRuleBook(characterId, ruleBook)
|
||||
.then(response => response.data);
|
||||
Reference in New Issue
Block a user