Skip to content

Commit

Permalink
add SPDX to SaveStatus.vue
Browse files Browse the repository at this point in the history
Signed-off-by: grnd-alt <[email protected]>
  • Loading branch information
grnd-alt committed Nov 5, 2024
1 parent 6fa73ff commit 6bf25be
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/SaveStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
import SaveStatus from './SaveStatus.vue'
import VueWrapper from './VueWrapper'

export default function(props:{saving: Boolean}) {
export default function(props:{saving: boolean}) {
return React.createElement(VueWrapper, { componentProps: props, component: SaveStatus })
}
15 changes: 10 additions & 5 deletions src/SaveStatus.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
<template>
<NcButton type="tertiary" v-on:click="onClick">
<NcButton type="tertiary" @click="onClick">
<template #icon>
<NcSavingIndicatorIcon :saving="saving" />
</template>
Expand All @@ -9,19 +13,20 @@
<script>
import { NcButton, NcSavingIndicatorIcon } from '@nextcloud/vue'
export default {
name: "SaveStatus",
name: 'SaveStatus',
components: {
NcButton,
NcSavingIndicatorIcon,
},
props: {
saving: {
type: Boolean,
default: false
default: false,
},
onClick: {
type: Function
}
type: Function,
default: () => { },
},
},
}
</script>
2 changes: 0 additions & 2 deletions websocket_server/AppManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
import dotenv from 'dotenv'
import express from 'express'
import PrometheusDataManager from './PrometheusDataManager.js'
import StorageManager from './StorageManager.js'

dotenv.config()

export default class AppManager {

/** @param {StorageManager} storageManager*/
constructor(storageManager) {
this.app = express()
this.storageManager = storageManager
Expand Down
16 changes: 6 additions & 10 deletions websocket_server/SocketManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ import dotenv from 'dotenv'
import Utils from './Utils.js'
import { createAdapter } from '@socket.io/redis-streams-adapter'
import SocketDataManager from './SocketDataManager.js'
import StorageManager from './StorageManager.js'

dotenv.config()

export default class SocketManager {

/** @param {StorageManager} storageManager */
constructor(server, roomDataManager, storageManager) {
this.roomDataManager = roomDataManager
this.storageManager = storageManager
Expand Down Expand Up @@ -121,13 +119,13 @@ export default class SocketManager {
}

/**
* @param {int} roomID
* @param {Socket} socket
*/
* @param {number} roomID roomID
* @param {Socket} socket socket
*/
async storeToServerHandler(roomID, socket) {
this.storageManager.saveRoomDataToServer(roomID).then(() => {
socket.emit("room-data-saved", roomID)
socket.broadcast.to(roomID).emit("room-data-saved", roomID)
socket.emit('room-data-saved', roomID)
socket.broadcast.to(roomID).emit('room-data-saved', roomID)
})
}

Expand Down Expand Up @@ -227,9 +225,7 @@ export default class SocketManager {
socketData.user.id,
)
}
/**
* @param {Socket} socket
*/

async serverVolatileBroadcastHandler(socket, roomID, encryptedData) {
const payload = JSON.parse(
Utils.convertArrayBufferToString(encryptedData),
Expand Down
18 changes: 11 additions & 7 deletions websocket_server/StorageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
import StorageStrategy from './StorageStrategy.js'
import LRUCacheStrategy from './LRUCacheStrategy.js'
import RedisStrategy from './RedisStrategy.js'
import ApiService from './ApiService.js';
import Room from './Room.js'
import ApiService from './ApiService.js'

export default class StorageManager {
/** @param {StorageStrategy} strategy
* @param {ApiService} apiService

/**
* @param {StorageStrategy} strategy StorageStrategy
* @param {ApiService} apiService ApiService
*/
constructor(strategy, apiService) {
this.setStrategy(strategy)
Expand Down Expand Up @@ -43,10 +44,13 @@ export default class StorageManager {
async clear() {
await this.strategy.clear()
}
/** @param { number }roomId */

/**
* @param { number } roomId roomId
*/
async saveRoomDataToServer(roomId) {
const room = await this.get(roomId)
this.apiService.saveRoomDataToServer(roomId, room.data, room.lastEditedUser, room.files);
this.apiService.saveRoomDataToServer(roomId, room.data, room.lastEditedUser, room.files)
}

getRooms() {
Expand All @@ -68,7 +72,7 @@ export default class StorageManager {
throw new Error('Invalid storage strategy type')
}

return new StorageManager(strategy,apiService)
return new StorageManager(strategy, apiService)
}

}

0 comments on commit 6bf25be

Please sign in to comment.