Skip to content

Commit 20eba07

Browse files
committed
Session expiration message (merge commit)
Merge branch 'feature/mime-type' into 'main' * Use verb 'update' instead of 'refresh' * Update krakend version to 2026.4.0 * Fix FilesOpen() for macOS so that an open terminal does not prevent update * Show session expiration in toast when running GUI * Do not call IsValisOpen() when running on Linux to avoid overhead * Add -race flag back to 'wails dev' after Go version update fixed segfault * Make parameters in GetObjects clearer with no variable length parameters Closes #68 See merge request https://gitlab.ci.csc.fi/sds-dev/sd-desktop/sda-filesystem/-/merge_requests/174 Approved-by: Teemu Kataja <teemu.kataja@csc.fi> Merged by Emmi Rehn <emmi.rehn@csc.fi>
2 parents 11bb76c + cb495cb commit 20eba07

22 files changed

Lines changed: 257 additions & 251 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ gui: wails_update ## Run GUI version of filesystem on your own computer
9494
@$(MAKE) _wait_for_container CONTAINER_NAME=data-upload
9595
@export $$($(MAKE) envs); \
9696
trap 'exit 0' SIGINT; cd cmd/gui; \
97-
wails dev $(WAILS_FLAGS);
97+
wails dev -race $(WAILS_FLAGS);
9898

9999
gui_build: wails_update ## Compile a production-ready GUI binary and save it in build/bin
100100
cd cmd/gui; wails build $(WAILS_FLAGS) -trimpath -clean -s

cmd/cli/import.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func applyCommand(ch <-chan []string) {
8181
if filesystem.FilesOpen() {
8282
logs.Errorf("You have files in use which prevents updating Data Gateway")
8383
} else {
84-
filesystem.RefreshFilesystem()
84+
filesystem.UpdateFilesystem()
8585
}
8686
case "clear":
8787
if len(input) > 1 {

cmd/cli/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func main() {
142142
logs.Fatal(err)
143143
}
144144

145-
access, err := api.GetProfile()
145+
access, err := api.GetProfileCLI()
146146
if err != nil {
147147
logs.Fatal(err)
148148
}

cmd/gui/app.go

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,13 @@ func (a *App) InitializeAPI() (bool, error) {
108108
wailsruntime.EventsEmit(a.ctx, "setRepositories", reps)
109109
}()
110110

111-
ch := make(chan bool)
112-
go a.monitorScans(ch)
113-
114111
if err := api.Setup(certs.Files); err != nil {
115112
logs.Error(err)
116113
outer, _ := logs.Wrapper(err)
117114

118115
return false, errors.New(outer)
119116
}
120-
access, err := api.GetProfile(ch)
117+
access, err := api.GetProfile(a.informSessionExpired, a.informScanningResult)
121118
if err != nil {
122119
logs.Error(err)
123120
outer, _ := logs.Wrapper(err)
@@ -138,16 +135,18 @@ func (a *App) InitializeAPI() (bool, error) {
138135
return access, nil
139136
}
140137

141-
func (a *App) monitorScans(ch <-chan bool) {
142-
for ok := range ch {
143-
if ok {
144-
wailsruntime.EventsEmit(a.ctx, "virusFound")
145-
} else {
146-
wailsruntime.EventsEmit(
147-
a.ctx, "showToast", "Virus scanning was interrupted",
148-
"Please check the logs for details or contact servicedesk@csc.fi (subject: SD Services) for support.",
149-
)
150-
}
138+
func (a *App) informSessionExpired() {
139+
wailsruntime.EventsEmit(a.ctx, "sessionExpired")
140+
}
141+
142+
func (a *App) informScanningResult(found bool) {
143+
if found {
144+
wailsruntime.EventsEmit(a.ctx, "virusFound")
145+
} else {
146+
wailsruntime.EventsEmit(
147+
a.ctx, "showToast", "Virus scanning was interrupted",
148+
"Please check the logs for details or contact servicedesk@csc.fi (subject: SD Services) for support.",
149+
)
151150
}
152151
}
153152

@@ -195,7 +194,7 @@ func (a *App) InitFuse() {
195194
go func() {
196195
for {
197196
<-cmd
198-
wailsruntime.EventsEmit(a.ctx, "refresh")
197+
wailsruntime.EventsEmit(a.ctx, "update")
199198
}
200199
}()
201200
go func() {
@@ -244,11 +243,11 @@ func (a *App) FilesOpen() bool {
244243
return filesystem.FilesOpen()
245244
}
246245

247-
func (a *App) RefreshFuse() {
246+
func (a *App) UpdateFuse() {
248247
time.Sleep(200 * time.Millisecond)
249248

250249
a.ph.DeleteProjects()
251-
filesystem.RefreshFilesystem()
250+
filesystem.UpdateFilesystem()
252251

253252
buckets := filesystem.GetNodeChildren(api.SDConnect.ForPath() + "/" + api.GetProjectName())
254253
if len(buckets) > 0 {

dev-tools/compose/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ services:
100100
condition: service_healthy
101101

102102
krakend:
103-
image: "${ARTIFACTORY_SERVER}/sds/krakend-api-gateway:2026.3.11"
103+
image: "${ARTIFACTORY_SERVER}/sds/krakend-api-gateway:2026.4.0"
104104
container_name: krakend
105105
env_file:
106106
- .env

frontend/src/App.vue

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts" setup>
22
import { CToastMessage, CToastType } from "@cscfi/csc-ui/dist/types";
33
import { ref, computed, onMounted } from "vue";
4-
import { EventsOn, EventsEmit } from "../wailsjs/runtime";
4+
import { EventsOn, EventsEmit, EventsOnce } from "../wailsjs/runtime";
55
import { InitializeAPI, Quit } from "../wailsjs/go/main/App";
66
import { mdiLogoutVariant } from "@mdi/js";
77
import { TabType } from "./types/common";
@@ -40,27 +40,31 @@ const visibleTabs = computed(() => componentData.value.filter((data) => data.vis
4040
// eslint-disable-next-line no-undef
4141
const toasts = ref<HTMLCToastsElement | null>(null);
4242
43+
const sessionMessage: CToastMessage = {
44+
message: "Data Gateway connection needs to be refreshed. Please log out from the virtual machine and SD Desktop, and log in again.",
45+
type: "warning" as CToastType,
46+
persistent: true,
47+
indeterminate: true
48+
};
49+
4350
onMounted(() => {
4451
InitializeAPI().then((access: boolean) => {
4552
console.log("Initializing Data Gateway finished");
4653
initialized.value = true;
4754
if (!access) {
4855
disabled.value = true;
49-
const message: CToastMessage = {
50-
message: "Data Gateway connection needs to be refreshed. Please log out from the virtual machine and SD Desktop, and log in again.",
51-
type: "warning" as CToastType,
52-
persistent: true,
53-
indeterminate: true
54-
};
55-
56-
toasts.value?.addToast(message);
56+
toasts.value?.addToast(sessionMessage);
5757
}
5858
}).catch((e) => {
5959
disabled.value = true;
6060
EventsEmit("showToast", "Initializing Data Gateway failed", e as string);
6161
});
6262
});
6363
64+
EventsOnce("sessionExpired", () => {
65+
toasts.value?.addToast(sessionMessage);
66+
});
67+
6468
EventsOn("showToast", (title: string, err: string) => {
6569
const message: CToastMessage = {
6670
title: title,

frontend/src/pages/AccessPage.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { reactive, ref, onMounted, computed } from "vue";
44
import {
55
GetDefaultMountPoint,
66
OpenFuse,
7-
RefreshFuse,
7+
UpdateFuse,
88
ChangeMountPoint,
99
FilesOpen,
1010
InitFuse,
@@ -93,7 +93,7 @@ EventsOn("updateProjectProgress", (name: string, repository: string, progress: n
9393
9494
EventsOn("fuseReady", () => {pageIdx.value = 4; updating.value = false;});
9595
96-
EventsOn("refresh", () => refresh());
96+
EventsOn("update", () => update());
9797
9898
EventsOn("virusFound", () => {virusFound.value = true;});
9999
@@ -105,14 +105,14 @@ function changeMountPoint() {
105105
});
106106
}
107107
108-
function refresh() {
108+
function update() {
109109
updating.value = true;
110110
111111
FilesOpen().then((open: boolean) => {
112112
if (open) {
113113
EventsEmit(
114114
"showToast",
115-
"Refresh not possible",
115+
"Update not possible",
116116
"You have files in use which prevents updating Data Gateway"
117117
);
118118
updating.value = false;
@@ -126,7 +126,7 @@ function refresh() {
126126
});
127127
projectKey.value = 0;
128128
129-
RefreshFuse();
129+
UpdateFuse();
130130
}
131131
});
132132
}
@@ -161,10 +161,10 @@ function refresh() {
161161
<div v-else>
162162
<h2>{{ pageIdx == 2 ? "Preparing access" : "Access ready" }}</h2>
163163
<div v-if="pageIdx > 2">
164-
<p>If you update the contents of projects, please refresh access.</p>
164+
<p>If you update the contents of projects, please update access.</p>
165165
<c-row gap="20" justify="end">
166-
<c-button outlined :disabled="updating" @click="refresh">
167-
Refresh access
166+
<c-button outlined :disabled="updating" @click="update">
167+
Update access
168168
</c-button>
169169
<c-button :disabled="updating" @click="OpenFuse">
170170
Open folder

frontend/wailsjs/go/main/App.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ export function Panic():Promise<void>;
2828

2929
export function Quit():Promise<void>;
3030

31-
export function RefreshFuse():Promise<void>;
32-
3331
export function SelectFiles():Promise<Array<string>>;
3432

33+
export function UpdateFuse():Promise<void>;
34+
3535
export function UpdateRepositorySelection(arg1:Record<string, boolean>):Promise<void>;
3636

3737
export function ValidateEmail(arg1:string):Promise<string>;

frontend/wailsjs/go/main/App.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ export function Quit() {
5454
return window['go']['main']['App']['Quit']();
5555
}
5656

57-
export function RefreshFuse() {
58-
return window['go']['main']['App']['RefreshFuse']();
59-
}
60-
6157
export function SelectFiles() {
6258
return window['go']['main']['App']['SelectFiles']();
6359
}
6460

61+
export function UpdateFuse() {
62+
return window['go']['main']['App']['UpdateFuse']();
63+
}
64+
6565
export function UpdateRepositorySelection(arg1) {
6666
return window['go']['main']['App']['UpdateRepositorySelection'](arg1);
6767
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module sda-filesystem
22

33
go 1.25.7
44

5-
toolchain go1.26.1
5+
toolchain go1.26.2
66

77
require (
88
github.com/aws/aws-sdk-go-v2 v1.41.4

0 commit comments

Comments
 (0)