Skip to content

Instantly share code, notes, and snippets.

@LefterisJP
Last active August 27, 2021 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LefterisJP/6a8309420bcd20c9d92e4d05cab663e0 to your computer and use it in GitHub Desktop.
Save LefterisJP/6a8309420bcd20c9d92e4d05cab663e0 to your computer and use it in GitHub Desktop.
ClosedTrades.vue diff
diff --cc frontend/app/src/components/history/ClosedTrades.vue
index b25659f9e,bcea69624..000000000
--- a/frontend/app/src/components/history/ClosedTrades.vue
+++ b/frontend/app/src/components/history/ClosedTrades.vue
@@@ -19,121 -19,195 +19,312 @@@
:tooltip="$t('closed_trades.refresh_tooltip')"
@refresh="refresh"
/>
+ {{ $t('closed_trades.title') }}
+ </template>
+ <template #actions>
+ <v-row>
+ <v-col cols="12" sm="6">
+ <ignore-buttons
+ :disabled="selected.length === 0 || loading || refreshing"
+ @ignore="ignoreTrades"
+ />
+ </v-col>
+ <v-col cols="12" sm="6">
+ <table-filter
+ :matchers="matchers"
+ @update:matches="updateFilter($event)"
+ />
+ </v-col>
+ </v-row>
+ </template>
+ <data-table
+ :items="visibleTrades"
+ :headers="headersClosed"
+ :expanded.sync="expanded"
+ single-expand
+ show-expand
+ sort-by="timestamp"
+ class="closed-trades"
+ item-key="tradeId"
+ :page.sync="page"
+ :loading="refreshing"
+ >
+ <template #header.selection>
+ <v-simple-checkbox
+ :ripple="false"
+ :value="allSelected"
+ color="primary"
+ @input="setSelected($event)"
+ />
+ </template>
+ <template #item.baseAsset="{ item }">
+ <asset-details
+ data-cy="trade_base"
+ hide-name
+ :asset="item.baseAsset"
+ />
+ </template>
+ <template #item.quoteAsset="{ item }">
+ <asset-details
+ hide-name
+ :asset="item.quoteAsset"
+ data-cy="trade_quote"
+ />
+ </template>
+ <template #item.description="{ item }">
+ {{
+ item.tradeType === 'buy'
+ ? $t('closed_trades.description.with')
+ : $t('closed_trades.description.for')
+ }}
+ </template>
+ <template #item.selection="{ item }">
+ <v-simple-checkbox
+ :ripple="false"
+ color="primary"
+ :value="selected.includes(item.tradeId)"
+ @input="selectionChanged(item.tradeId, $event)"
+ />
+ </template>
+ <template #item.location="{ item }">
+ <location-display :identifier="item.location" />
+ </template>
+ <template #item.rate="{ item }">
+ <amount-display
+ class="closed-trades__trade__rate"
+ :value="item.rate"
+ />
+ </template>
+ <template #item.amount="{ item }">
+ <amount-display
+ class="closed-trades__trade__amount"
+ :value="item.amount"
+ />
+ </template>
+ <template #item.ignoredInAccounting="{ item }">
+ <v-icon v-if="item.ignoredInAccounting">mdi-check</v-icon>
+ </template>
+ <template #item.timestamp="{ item }">
+ <div class="d-flex flex-row align-center">
+ <date-display :timestamp="item.timestamp" />
+ <v-spacer v-if="item.location === 'external'" />
+ <row-actions
+ v-if="item.location === 'external'"
+ edit-tooltip=""
+ delete-tooltip=""
+ @edit-click="editTrade(item)"
+ @delete-click="promptForDelete(item)"
+ />
+ </div>
+ </template>
++<<<<<<< HEAD
+ <template #expanded-item="{ headers, item }">
+ <trade-details :span="headers.length" :item="item" />
+ </template>
+ <template
+ v-if="tradesLimit <= tradesTotal && tradesLimit > 0"
+ #body.append="{ headers }"
+ >
+ <upgrade-row
+ :limit="tradesLimit"
+ :total="tradesTotal"
+ :colspan="headers.length"
+ :label="$t('closed_trades.label')"
+ />
+ </template>
+ </data-table>
+ </card>
++=======
+ <card-title class="ms-2">{{ $t('closed_trades.title') }}</card-title>
+ </v-card-title>
+ <v-card-text>
+ <ignore-buttons
+ :disabled="selected.length === 0 || loading || refreshing"
+ @ignore="ignoreTrades"
+ />
+ <v-sheet outlined rounded>
+ <data-table
+ :items="data"
+ :headers="headersClosed"
+ :expanded.sync="expanded"
+ single-expand
+ show-expand
+ sort-by="timestamp"
+ class="closed-trades"
+ item-key="tradeId"
+ :page.sync="page"
+ :loading="refreshing"
+ >
+ <template #header.selection>
+ <v-simple-checkbox
+ :ripple="false"
+ :value="allSelected"
+ color="primary"
+ @input="setSelected($event)"
+ />
+ </template>
+ <template #item.baseAsset="{ item }">
+ <asset-details
+ v-if="typeof item.baseAsset === 'string'"
+ data-cy="trade_base"
+ hide-name
+ :asset="item.baseAsset"
+ />
+ <asset-details-base
+ v-else
+ data-cy="trade_base"
+ hide-name
+ :asset="item.baseAsset"
+ />
+ </template>
+ <template #item.quoteAsset="{ item }">
+ <asset-details
+ v-if="typeof item.quoteAsset === 'string'"
+ data-cy="trade_quote"
+ hide-name
+ :asset="item.quoteAsset"
+ />
+ <asset-details-base
+ v-else
+ hide-name
+ :asset="item.quoteAsset"
+ data-cy="trade_quote"
+ />
+ </template>
+ <template #item.description="{ item }">
+ {{
+ item.tradeType === 'buy'
+ ? $t('closed_trades.description.with')
+ : $t('closed_trades.description.for')
+ }}
+ </template>
+ <template #item.selection="{ item }">
+ <v-simple-checkbox
+ :ripple="false"
+ color="primary"
+ :value="selected.includes(item.tradeId)"
+ @input="selectionChanged(item.tradeId, $event)"
+ />
+ </template>
+ <template #item.location="{ item }">
+ <location-display :identifier="item.location" />
+ </template>
+ <template #item.rate="{ item }">
+ <amount-display
+ class="closed-trades__trade__rate"
+ :value="item.rate"
+ />
+ </template>
+ <template #item.amount="{ item }">
+ <amount-display
+ class="closed-trades__trade__amount"
+ :value="item.amount"
+ />
+ </template>
+ <template #item.ignoredInAccounting="{ item }">
+ <v-icon v-if="item.ignoredInAccounting">mdi-check</v-icon>
+ </template>
+ <template #item.timestamp="{ item }">
+ <div class="d-flex flex-row align-center">
+ <date-display :timestamp="item.timestamp" />
+ <v-spacer v-if="item.location === 'external'" />
+ <div v-if="item.location === 'external'">
+ <v-btn icon>
+ <v-icon
+ small
+ class="closed-trades__trade__actions__edit"
+ @click="editTrade(item)"
+ >
+ mdi-pencil
+ </v-icon>
+ </v-btn>
+ <v-btn icon>
+ <v-icon
+ class="closed-trades__trade__actions__delete"
+ small
+ @click="promptForDelete(item)"
+ >
+ mdi-delete
+ </v-icon>
+ </v-btn>
+ </div>
+ </div>
+ </template>
+
+ <template #expanded-item="{ headers, item }">
+ <table-expand-container visible :colspan="headers.length">
+ <template #title>
+ {{ $t('closed_trades.details.title') }}
+ </template>
+ <v-row>
+ <v-col cols="auto" class="font-weight-medium">
+ {{ $t('closed_trades.details.fee') }}
+ </v-col>
+ <v-col>
+ <amount-display
+ v-if="!!item.fee"
+ class="closed-trades__trade__fee"
+ :asset="item.feeCurrency"
+ :value="item.fee"
+ />
+ <span v-else>-</span>
+ </v-col>
+ </v-row>
+ <v-row>
+ <v-col cols="auto" class="font-weight-medium">
+ {{ $t('closed_trades.details.link') }}
+ </v-col>
+ <v-col>
+ {{
+ item.link
+ ? item.link
+ : $t('closed_trades.details.link_data')
+ }}
+ </v-col>
+ <v-col>
+ <v-tooltip v-if="hasLink(item)" top open-delay="600">
+ <template #activator="{ on, attrs }">
+ <v-btn
+ v-if="hasLink(item)"
+ :small="true"
+ icon
+ v-bind="attrs"
+ :width="'20px'"
+ color="primary"
+ class="ml-1"
+ :class="dark ? null : 'grey lighten-4'"
+ :href="href(item.link)"
+ :target="target"
+ v-on="on"
+ @click="openLink(item.link)"
+ >
+ <v-icon :small="true"> mdi-launch </v-icon>
+ </v-btn>
+ </template>
+ <span>{{ item.link }}</span>
+ </v-tooltip>
+ </v-col>
+ </v-row>
+ <notes-display :notes="item.notes" />
+ </table-expand-container>
+ </template>
+ <template
+ v-if="tradesLimit <= tradesTotal && tradesLimit > 0"
+ #body.append="{ headers }"
+ >
+ <upgrade-row
+ :limit="tradesLimit"
+ :total="tradesTotal"
+ :colspan="headers.length"
+ :label="$t('closed_trades.label')"
+ />
+ </template>
+ </data-table>
+ </v-sheet>
+ </v-card-text>
+ </v-card>
++>>>>>>> bugfixes
<big-dialog
:display="openDialog"
:title="dialogTitle"
@@@ -193,7 -254,7 +384,11 @@@ import UpgradeRow from '@/components/hi
import CardTitle from '@/components/typography/CardTitle.vue';
import AssetMixin from '@/mixins/asset-mixin';
import StatusMixin from '@/mixins/status-mixin';
++<<<<<<< HEAD
+import { TradeLocation } from '@/services/history/types';
++=======
+ import ThemeMixin from '@/mixins/theme-mixin';
++>>>>>>> bugfixes
import { Section } from '@/store/const';
import { HistoryActions, IGNORE_TRADES } from '@/store/history/consts';
import { IgnoreActionPayload, TradeEntry } from '@/store/history/types';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment