Skip to content

Commit

Permalink
chore: use events and d-frame instead of v-iframe and notify
Browse files Browse the repository at this point in the history
  • Loading branch information
albanm committed Dec 17, 2024
1 parent 66915a6 commit c96c4f5
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 18 deletions.
1 change: 0 additions & 1 deletion api/config/custom-environment-variables.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ module.exports = {
},
perOrgStorageTypes: jsonEnv('PER_ORG_STORAGE_TYPES'),
cipherPassword: 'CIPHER_PASSWORD',
notifyUrl: 'NOTIFY_URL',
privateNotifyUrl: 'PRIVATE_NOTIFY_URL',
plannedDeletionDelay: 'PLANNED_DELETION_DELAY',
cleanup: {
Expand Down
1 change: 0 additions & 1 deletion api/config/default.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ module.exports = {
// allow configuring external storages per organization
perOrgStorageTypes: [],
cipherPassword: undefined,
notifyUrl: undefined,
privateNotifyUrl: undefined,
plannedDeletionDelay: 14,
cleanup: {
Expand Down
3 changes: 1 addition & 2 deletions api/config/development.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@ module.exports = {
limits: 'testkey',
readAll: 'testkey',
metrics: 'testkey',
notifications: 'secret-notifications',
notifications: 'secret-events',
sites: 'secret-sites'
},
perOrgStorageTypes: ['ldap'],
cipherPassword: 'dev',
notifyUrl: 'http://localhost:5689/notify',
privateNotifyUrl: 'http://localhost:8088',
plannedDeletionDelay: 1,
cleanup: {
Expand Down
5 changes: 2 additions & 3 deletions dev/resources/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ http {
rewrite ^/mails/(.*) /$1 break;
proxy_pass http://localhost:1080/;
}
location /notify {
rewrite ^/notify/(.*) /$1 break;
proxy_pass http://localhost:8088/;
location /events {
proxy_pass http://localhost:8088;
}
}

Expand Down
11 changes: 6 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,20 @@ services:
# related services from the data-fair stack
#####

notify:
events:
profiles:
- dev
image: ghcr.io/data-fair/notify:master
image: ghcr.io/data-fair/events:main
network_mode: host
environment:
- PORT=8088
- PUBLIC_URL=http://localhost:5689/notify
- WS_PUBLIC_URL=ws://localhost:5689/notify
- DIRECTORY_URL=http://localhost:5689/simple-directory
- SECRET_NOTIFICATIONS=secret-notifications
- PRIVATE_DIRECTORY_URL=http://localhost:5689/simple-directory
- SECRET_EVENTS=secret-events
- SECRET_IDENTITIES=secret-identities
- SECRET_SENDMAILS=secret-sendmails
- PROMETHEUS_ACTIVE=false
- OBSERVER_ACTIVE=false

#####
# db
Expand Down
7 changes: 7 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"lint-fix": "eslint --fix ."
},
"dependencies": {
"@data-fair/frame": "^0.2.1",
"@data-fair/lib-vue": "^1.13.10",
"@data-fair/lib-vuetify": "^1.6.6",
"@intlify/unplugin-vue-i18n": "^5.2.0",
Expand Down
16 changes: 11 additions & 5 deletions ui/src/components/notify-menu.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- eslint-disable vue/no-deprecated-slot-attribute -->
<template>
<v-menu
:close-on-content-click="false"
Expand All @@ -15,22 +16,27 @@
</v-btn>
</template>
<v-card width="500">
<v-iframe :src="notifySubscribeUrl" />
<d-frame
:src="notifySubscribeUrl"
resize
>
<div slot="loader">
<v-skeleton-loader type="paragraph" />
</div>
</d-frame>
</v-card>
</v-menu>
</template>

<script setup lang="ts">
import 'iframe-resizer/js/iframeResizer'
// @ts-ignore
import VIframe from '@koumoul/v-iframe'
import '@data-fair/frame/lib/d-frame.js'

const { topics, sender } = defineProps({
topics: { type: Array as () => { key: string, title: string }[], required: true },
sender: { type: String, required: true }
})

const notifySubscribeUrl = computed(() => `${$sitePath}/notify/embed/subscribe?key=${encodeURIComponent(topics.map(t => t.key).join(','))}&title=${encodeURIComponent(topics.map(t => t.title).join(','))}&sender=${encodeURIComponent(sender)}&register=false`)
const notifySubscribeUrl = computed(() => `${$sitePath}/events/embed/subscribe?key=${encodeURIComponent(topics.map(t => t.key).join(','))}&title=${encodeURIComponent(topics.map(t => t.title).join(','))}&sender=${encodeURIComponent(sender)}&register=false`)
</script>

<style>
Expand Down
3 changes: 3 additions & 0 deletions ui/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ import { createUiNotif } from '@data-fair/lib-vue/ui-notif.js'
import { createI18n } from 'vue-i18n'
import { createHead } from '@unhead/vue'
import App from './App.vue'
// TODO: remove v-iframe and iframe-resizer when d-frame is fully integrated
import '@koumoul/v-iframe/content-window'
import 'iframe-resizer/js/iframeResizer.contentWindow.js'
import dFrameContent from '@data-fair/frame/lib/vue-router/d-frame-content.js'

(window as any).iFrameResizer = { heightCalculationMethod: 'taggedElement' };

(async function () {
const router = createRouter({ history: createWebHistory($sitePath + '/simple-directory/'), routes })
dFrameContent(router)
const reactiveSearchParams = createReactiveSearchParams(router)
const session = await createSession({ directoryUrl: $sitePath + '/simple-directory', siteInfo: true })
const localeDayjs = createLocaleDayjs(session.state.lang)
Expand Down
2 changes: 1 addition & 1 deletion ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default defineConfig({
dts: './dts/typed-router.d.ts',
exclude: process.env.NODE_ENV === 'development' ? [] : ['src/pages/dev.vue']
}),
Vue(),
Vue({ template: { compilerOptions: { isCustomElement: (tag) => ['d-frame'].includes(tag) } } }),
VueI18nPlugin(),
Vuetify(),
AutoImport({
Expand Down

0 comments on commit c96c4f5

Please sign in to comment.