diff --git a/CHANGELOG.md b/CHANGELOG.md
index 81bc69b..b25a520 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -35,20 +35,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### [PATCH]
- Fix: refresh does not seem to propagate to child components on ibindex pages
- Fix: dashboard refreshed when alarm trigger is saved and refresh success notification is shown
+- Fix: toggle dark/light mode takes 2 clicks the first time
+- Refactor watchlist solution to include watched items from Ibindex, Fbindex, and FI
+- Update dependencies: @intlify/unplugin-vue-i18n 4.0.0 -> 5.2.0 - major update
### [FUTURE]
- Change: change from localforage -> Dexie
-- Refactor watchlist solution to include watched items from Ibindex, Fbindex, and FI
## [IN-PROGRESS]
## [UNRELEASED]
+
+## v1.1.0 - 2024-09-29
- Removed references to Quasar CLI from README.md and package.json.
- Added more info about the project in README.md.
- Migrated to Tauri v2-rc
- Added support for displaying data from fbindex.se (Fastighetsbolagsindex)
- Added new component CompanyDetails, which replaces ComponentIbindexCompanyEvents, ComponentIbindexCompanyHoldings and ComponentIbindexRebatePremium.
- Added support for displaying company holding being public or not.
+- Fixed Tauri fetch() related issues in FI component.
+- Updated Cargo dependencies
## v1.0.3 - 2024-08-01
- Added persistence of visible columns in local storage.
diff --git a/package.json b/package.json
index e5e3b9a..37ebd84 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "stoqster",
- "version": "1.0.4",
+ "version": "1.1.0",
"productName": "Stoqster",
"author": "Péter Blénessy",
"private": true,
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 51a6353..97d1e33 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -2046,9 +2046,12 @@ dependencies = [
[[package]]
name = "once_cell"
-version = "1.19.0"
+version = "1.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
+checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1"
+dependencies = [
+ "portable-atomic",
+]
[[package]]
name = "option-ext"
@@ -2288,6 +2291,12 @@ dependencies = [
"miniz_oxide",
]
+[[package]]
+name = "portable-atomic"
+version = "1.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
+
[[package]]
name = "powerfmt"
version = "0.2.0"
@@ -2559,9 +2568,9 @@ dependencies = [
[[package]]
name = "regex"
-version = "1.10.6"
+version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619"
+checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8"
dependencies = [
"aho-corasick",
"memchr",
@@ -2571,9 +2580,9 @@ dependencies = [
[[package]]
name = "regex-automata"
-version = "0.4.7"
+version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
+checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3"
dependencies = [
"aho-corasick",
"memchr",
@@ -2582,9 +2591,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
-version = "0.8.4"
+version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
+checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "reqwest"
@@ -3066,7 +3075,7 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "stoqster"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"serde",
"serde_json",
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index dd75099..cd17d70 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "stoqster"
-version = "0.1.0"
+version = "0.1.1"
description = "A Tauri App"
authors = ["Péter Blénessy"]
edition = "2021"
diff --git a/src/api/fiAPI.js b/src/api/fiAPI.js
index 9668e5b..d3b2572 100644
--- a/src/api/fiAPI.js
+++ b/src/api/fiAPI.js
@@ -1,32 +1,4 @@
-// Get color based on value being negative or positive
-const setStyle = (number, ifNegative = "red", ifPositive = "green") => {
- if (number != 0) {
- return number < 0 ? "color:" + ifNegative : "color:" + ifPositive;
- }
-};
-
-// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat
-//const locale = new Intl.locale("se-SV", { language: 'sv'});
-const formatter = new Intl.NumberFormat("sv-SE", {
- // style: 'currency',
- // currency: 'SEK',
- // currencyDisplay: 'code',
- //notation: 'compact',
- //compactDisplay: 'short',
- // These options are needed to round to whole numbers if that's what you want.
- //minimumFractionDigits: 0, // (this suffices for whole numbers, but will print 2500.10 as $2,500.1)
- maximumFractionDigits: 0, // (causes 2500.99 to be printed as $2,501)
-});
-
-const isValidNumber = (val) => {
- return (
- val != 0 &&
- val != "" &&
- val != " " &&
- typeof Number.parseFloat(val) === "number" &&
- isFinite(val)
- );
-};
+import { setStyle, formatter, isValidNumber } from "./helpers.js";
const baseUrl = "https://www.fi.se";
diff --git a/src/api/helpers.js b/src/api/helpers.js
index 70fc027..05140b2 100644
--- a/src/api/helpers.js
+++ b/src/api/helpers.js
@@ -16,4 +16,14 @@ const formatter = new Intl.NumberFormat("sv-SE", {
maximumFractionDigits: 0, // (causes 2500.99 to be printed as $2,501)
});
-export { setStyle, formatter };
+const isValidNumber = (val) => {
+ return (
+ val != 0 &&
+ val != "" &&
+ val != " " &&
+ typeof Number.parseFloat(val) === "number" &&
+ isFinite(val)
+ );
+};
+
+export { setStyle, formatter, isValidNumber };
diff --git a/src/components/ComponentFbindex.vue b/src/components/ComponentFbindex.vue
index 8fecec3..27b27dc 100644
--- a/src/components/ComponentFbindex.vue
+++ b/src/components/ComponentFbindex.vue
@@ -255,10 +255,7 @@ export default {
`Error - fetch() status code: ${response.status}`,
);
}
- let data = response.json();
- console.log(data);
-
- return data;
+ return response.json();
})
.then((data) => {
rows.value = [...data];
diff --git a/src/components/ComponentFundHoldings.vue b/src/components/ComponentFundHoldings.vue
index 1e5e5ec..517d263 100644
--- a/src/components/ComponentFundHoldings.vue
+++ b/src/components/ComponentFundHoldings.vue
@@ -1,59 +1,91 @@
-
-
+
-
+
-
diff --git a/src/components/ComponentFunds.vue b/src/components/ComponentFunds.vue
index d751338..e433317 100644
--- a/src/components/ComponentFunds.vue
+++ b/src/components/ComponentFunds.vue
@@ -225,6 +225,8 @@ export default {
const loading = ref(false);
const refreshColor = ref("primary");
+ const loadedFromWeb = ref(false);
+
async function unzipAndImportToDB(zipFile) {
console.time("fiUnzipAndImportToDB()");
@@ -308,10 +310,10 @@ export default {
);
}
- let text = response.data;
+ let text = await response.text();
let parser = new DOMParser();
let doc = parser.parseFromString(text, "text/html");
- let table = doc.getElementsByTagName("table")[0];
+ let table = doc.getElementsByTagName("tbody")[0];
let aList = table.querySelectorAll("tr td:first-child a");
// The first item in the list of links is the latest.
@@ -320,20 +322,21 @@ export default {
let a = aList[0];
let url = fiDownload.url + a.pathname + a.search;
console.timeEnd("fiScrapeZipUrl()");
+ console.log("fiScrapeZipUrl() - url: ", url);
return url;
}
// Download zipped fund reports from FinansInspektionen
async function fiFetchZipFile(url) {
console.time("fiFetchZipFile()");
- let response = await fetch(url, { responseType: "blob" });
+ let response = await fetch(url, { responseType: "arrayBuffer" });
if (!response.ok) {
return Promise.reject(
`Error - fetch() status code: ${response.status}`,
);
}
console.timeEnd("fiFetchZipFile()");
- return response.data;
+ return Promise.resolve(response.blob());
}
// Download data from FinansInspektionen and store it in IndexedDB
@@ -343,10 +346,15 @@ export default {
let url = await fundsStore.getItem(fiQuarterlyHoldingsUrl);
if (url === null) {
fiScrapeZipUrl()
- .then((zipUrl) => fiFetchZipFile(zipUrl))
+ .then((zipUrl) => {
+ fiCommonStore.setItem(fiQuarterlyHoldingsUrl, zipUrl);
+ return fiFetchZipFile(zipUrl);
+ })
.then((zipFile) => unzipAndImportToDB(zipFile))
- .then(() => {
- fiCommonStore.setItem(fiQuarterlyHoldingsUrl, url);
+ .then((data) => {
+ rows.value = data;
+ loadedFromWeb.value = true;
+ console.log("loadedFromWeb.value = true");
})
.catch((error) => {
throw new Error(error);
@@ -389,6 +397,7 @@ export default {
loadDataFromWeb()
.then(() => {
console.log("Data loaded from web");
+ loadedFromWeb.value = true;
$q.notify({
type: "positive",
message: "Uppdateringen gick bra",
@@ -427,7 +436,14 @@ export default {
(newVal) => (fiVisibleColumns.value = [...newVal]),
);
+ watch(loadedFromWeb, (newVal) => {
+ if (newVal) {
+ loadDataFromDB().then(() => console.log("Data loaded from DB"));
+ }
+ });
+
return {
+ loadData,
loadDataFromWeb,
loading,
refreshColor,