Skip to content

Commit

Permalink
last fixed comments, formated style with Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
mortrap committed Apr 15, 2024
1 parent 64c032a commit f59fc1d
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 54 deletions.
67 changes: 44 additions & 23 deletions src/components/DownloadComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
-->
<!-- buttons example -->
<q-card-actions align="right">
<q-btn color="primary" label="Close" icon="close" @click="onCancelClick" />
<q-btn
color="primary"
label="Close"
icon="close"
@click="onCancelClick"
/>
</q-card-actions>

<q-card-section>
Expand All @@ -23,19 +28,27 @@
<div class="text-h6">Download links</div>
<div class="q-pa-md">
<div class="row" bordered separator>
<div class="q-pa-md col col-md-3 col-sm-6 col-xs-12" v-ripple v-for="selectedLink in selectedLinks"
v-bind:key="selectedLink.uid">
<a href="javascript:void(0)" @click.prevent="
downloadRequest(
selectedLink.link,
selectedLink.year +
'-' +
selectedLink.historyData.ticker
)
"><q-icon name="insert_drive_file" />{{
<div
class="q-pa-md col col-md-3 col-sm-6 col-xs-12"
v-ripple
v-for="selectedLink in selectedLinks"
v-bind:key="selectedLink.uid"
>
<a
href="javascript:void(0)"
@click.prevent="
downloadRequest(
selectedLink.link,
selectedLink.year +
'-' +
selectedLink.historyData.ticker
)
"
><q-icon name="insert_drive_file" />{{
selectedLink.historyData.name
}}
{{ selectedLink.year }}</a>
{{ selectedLink.year }}</a
>
</div>
</div>
</div>
Expand All @@ -44,15 +57,25 @@
<div class="">
<div class="text-h6">Bash script</div>
<q-btn @click="copyToClipboard(bashScript)" icon="file_copy">
<q-tooltip anchor="center right" self="center left" :offset="[10, 10]">Copy to clipboard</q-tooltip>
<q-tooltip
anchor="center right"
self="center left"
:offset="[10, 10]"
>Copy to clipboard</q-tooltip
>
</q-btn>
<prism-code language="bash">{{ bashScript }}</prism-code>
</div>
</q-tab-panel>
<q-tab-panel name="cmd">
<div class="text-h6">Windows cmd</div>
<q-btn @click="copyToClipboard(cmdScript)" icon="file_copy">
<q-tooltip anchor="center right" self="center left" :offset="[10, 10]">Copy to clipboard</q-tooltip>
<q-tooltip
anchor="center right"
self="center left"
:offset="[10, 10]"
>Copy to clipboard</q-tooltip
>
</q-btn>
<prism-code language="batch">{{ cmdScript }}</prism-code>
</q-tab-panel>
Expand Down Expand Up @@ -93,9 +116,7 @@ export default {
},
},
emits: [
...useDialogPluginComponent.emits,
],
emits: [...useDialogPluginComponent.emits],
components: { PrismCode },
Expand Down Expand Up @@ -126,7 +147,8 @@ export default {
.flatMap((selectedVal) =>
selectedVal?.years?.map(
(year) =>
`"${toDowloadLink(selectedVal.uid, year)}" "${selectedVal.uid
`"${toDowloadLink(selectedVal.uid, year)}" "${
selectedVal.uid
}_${year}.zip"`
)
)
Expand Down Expand Up @@ -159,8 +181,10 @@ done
.flatMap((selectedVal) =>
selectedVal?.years?.map(
(year) =>
`powershell -Command "Invoke-WebRequest -Headers @{'Authorization' = 'Bearer ${token.value
}'} '${toDowloadLink(selectedVal.uid, year)}' -OutFile '${selectedVal.uid
`powershell -Command "Invoke-WebRequest -Headers @{'Authorization' = 'Bearer ${
token.value
}'} '${toDowloadLink(selectedVal.uid, year)}' -OutFile '${
selectedVal.uid
}_${year}.zip'"`
)
)
Expand Down Expand Up @@ -193,7 +217,6 @@ done
);
async function downloadRequest(link: string, filename: string) {
await api
.get(link, {
responseType: 'blob',
Expand All @@ -211,9 +234,7 @@ done
document.body.removeChild(link);
URL.revokeObjectURL(href);
$q.notify('Download done');
});
}
return {
Expand Down
89 changes: 64 additions & 25 deletions src/components/ExampleComponent.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
<template>
<q-table flat bordered title="Instruments" selection="multiple" v-model:selected="selected" :rows="historyIndexList"
:columns="columns" row-key="uid" :rows-per-page-options="[20, 30, 50, 100]" :filter="filter"
:filter-method="filterMethod" style="min-width: 500px; width: 100%">
<q-table
flat
bordered
title="Instruments"
selection="multiple"
v-model:selected="selected"
:rows="historyIndexList"
:columns="columns"
row-key="uid"
:rows-per-page-options="[20, 30, 50, 100]"
:filter="filter"
:filter-method="filterMethod"
style="min-width: 500px; width: 100%"
>
<template v-slot:top-right>
<q-option-group dense inline v-model="filter.instrumentTypes" :options="allInstrumentTypes" color="green"
type="checkbox" style="padding-right: 16pt" />
<q-option-group
dense
inline
v-model="filter.instrumentTypes"
:options="allInstrumentTypes"
color="green"
type="checkbox"
style="padding-right: 16pt"
/>
<span>&nbsp;</span>
<q-input bordered dense debounce="300" v-model="filter.text" placeholder="Search Ticker">
<q-input
bordered
dense
debounce="300"
v-model="filter.text"
placeholder="Search Ticker"
>
<template v-slot:append>
<q-icon name="search" />
</template>
Expand All @@ -15,8 +39,14 @@
<template v-slot:top-left>
<q-toolbar class="text-primary">
<q-toolbar-title> </q-toolbar-title>
<q-btn flat dense label="Сгенерировать скрипт" icon="file_download" :disable="selected.length < 1"
@click="showDialog" />
<q-btn
flat
dense
label="Сгенерировать скрипт"
icon="file_download"
:disable="selected.length < 1"
@click="showDialog"
/>
</q-toolbar>
</template>

Expand All @@ -26,21 +56,35 @@
<q-checkbox dense v-model="props.selected" :label="props.row.name" />
</q-td>

<q-td v-for="col in props.cols.filter(
(col) => col.name !== 'selected' && col.name !== 'years'
)" :key="col.name" :props="props">
<q-td
v-for="col in props.cols.filter(
(col) => col.name !== 'selected' && col.name !== 'years'
)"
:key="col.name"
:props="props"
>
{{ col.value }}
</q-td>
<q-td>
<span class="q-pr-sm col col-md-3 col-sm-6 col-xs-12" v-ripple v-for="selectedLink in props.row.links"
v-bind:key="selectedLink.year">
<a href="javascript:void(0)" :title="'Скачать архив ' + selectedLink.year + ' ' + props.row.ticker
" @click.prevent="
<span
class="q-pr-sm col col-md-3 col-sm-6 col-xs-12"
v-ripple
v-for="selectedLink in props.row.links"
v-bind:key="selectedLink.year"
>
<a
href="javascript:void(0)"
:title="
'Скачать архив ' + selectedLink.year + ' ' + props.row.ticker
"
@click.prevent="
downloadRequest(
selectedLink.link,
selectedLink.year + '-' + props.row.ticker
)
"><q-icon name="insert_drive_file" /> {{ selectedLink.year }}</a>
"
><q-icon name="insert_drive_file" /> {{ selectedLink.year }}</a
>
</span>
</q-td>
</q-tr>
Expand Down Expand Up @@ -132,7 +176,6 @@ export default defineComponent({
function showDownloadDialog(selectedObjects: Ref<HistoryData[]>) {
const showDialog = () => {
$q.dialog({
component: DownloadComponent,
componentProps: {
Expand All @@ -158,9 +201,7 @@ export default defineComponent({
}
async function downloadRequest(link: string, filename: string) {
const downloadFunc = async () => {
try {
await api
.get(link, {
Expand All @@ -183,22 +224,20 @@ export default defineComponent({
color: 'blue',
});
});
}
catch (err) {
} catch (err) {
$q.notify({
message: 'Error: ' + err,
icon: 'announcement',
color: 'red-10',
});
}
}
};
if (!historyStore.token || historyStore.token.trim().length < 1) {
promptAuthToken(downloadFunc);
} else {
downloadFunc();
}
}
function promptAuthToken(then) {
Expand All @@ -213,7 +252,7 @@ export default defineComponent({
cancel: true,
persistent: true,
}).onOk((data) => {
console.log('>>>> OK, received', data)
console.log('>>>> OK, received', data);
historyStore.setAuthToken(data);
if (then) then();
});
Expand Down Expand Up @@ -288,4 +327,4 @@ export default defineComponent({
};
},
});
</script>
</script>
14 changes: 12 additions & 2 deletions src/pages/ErrorNotFound.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
<template>
<div class="fullscreen bg-blue text-white text-center q-pa-md flex flex-center">
<div
class="fullscreen bg-blue text-white text-center q-pa-md flex flex-center"
>
<div>
<div style="font-size: 30vh">404</div>

<div class="text-h2" style="opacity: 0.4">Oops. Nothing here...</div>

<q-btn class="q-mt-xl" color="white" text-color="blue" unelevated to="/" label="Go Home" no-caps />
<q-btn
class="q-mt-xl"
color="white"
text-color="blue"
unelevated
to="/"
label="Go Home"
no-caps
/>
</div>
</div>
</template>
Expand Down
7 changes: 6 additions & 1 deletion src/pages/IndexPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
</div>
</div>

<example-component title="Example component" active :todos="todos" :meta="meta"></example-component>
<example-component
title="Example component"
active
:todos="todos"
:meta="meta"
></example-component>
</q-page>
</template>

Expand Down
4 changes: 2 additions & 2 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export default route(function (/* { store, ssrContext } */) {
const createHistory = process.env.SERVER
? createMemoryHistory
: process.env.VUE_ROUTER_MODE === 'history'
? createWebHistory
: createWebHashHistory;
? createWebHistory
: createWebHashHistory;

const Router = createRouter({
scrollBehavior: () => ({ left: 0, top: 0 }),
Expand Down
1 change: 0 additions & 1 deletion src/stores/example-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const useCounterStore = defineStore('counter', {
doubleCount: (state) => state.counter * 2,
},
actions: {

increment() {
this.counter++;
},
Expand Down

0 comments on commit f59fc1d

Please sign in to comment.