-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #674 from ChicagoWorldcon/PLAN-543-airmeet
PLAN-543 Airmeet Integration
- Loading branch information
Showing
31 changed files
with
720 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
class IntegrationsController < ResourceController | ||
SERIALIZER_CLASS = 'IntegrationSerializer'.freeze | ||
POLICY_CLASS = 'IntegrationPolicy'.freeze | ||
|
||
def airmeet | ||
authorize model_class, policy_class: policy_class | ||
|
||
airmeet = Integration.find_by({name: 'airmeet'}) | ||
|
||
render json: serializer_class.new(airmeet, | ||
{ | ||
include: serializer_includes, | ||
params: {domain: "#{request.base_url}"} | ||
} | ||
).serializable_hash(), | ||
content_type: 'application/json' | ||
end | ||
|
||
def allowed_params | ||
%i[ | ||
id | ||
name | ||
lock_version | ||
config | ||
] | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
class PublishedSessionsController < ResourceController | ||
# TBD | ||
SERIALIZER_CLASS = 'PublishedSessionSerializer'.freeze | ||
POLICY_CLASS = 'PublishedSessionPolicy'.freeze | ||
# | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module IntegrationsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<template> | ||
<div class="container-fluid"> | ||
<div class="row"> | ||
<div class="column"> | ||
<h4 class="mt-3">Configuration</h4> | ||
<b-form-group label="Airmeet ID"> | ||
<b-form-input type="text" v-model="airmeet_id" @blur="patchAirmeetConfig()"></b-form-input> | ||
</b-form-group> | ||
<b-form-group label="Airmeet Host Email"> | ||
<b-form-input type="text" v-model="airmeet_host" @blur="patchAirmeetConfig()"></b-form-input> | ||
</b-form-group> | ||
<h4 class="mt-5">Room Hosts Setup</h4> | ||
<b-form inline @submit.prevent="addAirmeetRoom($event)" class="mb-5 mt-3"> | ||
<b-form-select name="room" :options="nonAirmeetRoomOptions" :value="null"></b-form-select> | ||
<b-input type="text" name="roomHostEmail" placeholder="Room Host Email"></b-input> | ||
<b-button type="submit">Add Airmeet Room</b-button> | ||
</b-form> | ||
<div class="border"> | ||
<b-table :fields="airmeetRoomFields" :items="airmeetRooms" sticky-header class="mb-0"> | ||
<template #cell(room_host_email)="{ item }"> | ||
<b-input type="text" v-model="item.integrations.airmeet.room_host_email" @blur="save(item)"></b-input> | ||
</template> | ||
</b-table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { modelMixinNoProp } from '@/mixins' | ||
import { FETCH_AIRMEET_INTEGRATION, integrationModel, SET_AIRMEET_INTEGRATION } from '@/store/integration.store' | ||
import { PATCH_FIELDS, SAVE } from '@/store/model.store' | ||
import { mapState, mapActions, mapMutations } from 'vuex'; | ||
import toastMixin from '@/shared/toast-mixin'; | ||
export default { | ||
name: "AirmeetSettings", | ||
mixins: [ | ||
modelMixinNoProp, | ||
toastMixin | ||
], | ||
data: () => ({ | ||
airmeetRoomFields: ['name', 'room_host_email'], | ||
model: 'room' | ||
}), | ||
computed: { | ||
...mapState(['airmeet']), | ||
airmeetRooms() { | ||
return this.collection.filter(r => r.integrations?.airmeet) | ||
}, | ||
nonAirmeetRoomOptions() { | ||
return [{text: "Select a room", value: null, disabled: true}, ...this.collection.filter(r => !r.integrations?.airmeet).map(r => ({ | ||
text: r.name, | ||
value: r.id | ||
}))] | ||
}, | ||
airmeet_id: { | ||
get() { | ||
return this.airmeet?.config?.airmeet_id | ||
}, | ||
set(val) { | ||
if(this.airmeet?.config) { | ||
this.airmeet.config.airmeet_id = val; | ||
} | ||
} | ||
}, | ||
airmeet_host: { | ||
get() { | ||
return this.airmeet?.config?.airmeet_host | ||
}, | ||
set(val) { | ||
if(this.airmeet?.config) { | ||
this.airmeet.config.airmeet_host = val; | ||
} | ||
} | ||
} | ||
}, | ||
methods: { | ||
...mapMutations({ | ||
setAirmeetInfo: SET_AIRMEET_INTEGRATION, | ||
}), | ||
...mapActions({ | ||
fetchAirmeetInfo: FETCH_AIRMEET_INTEGRATION, | ||
patchModel: PATCH_FIELDS | ||
}), | ||
addAirmeetRoom($event) { | ||
const roomId = $event.target.elements.room.value; | ||
const roomHostEmail = $event.target.elements.roomHostEmail.value; | ||
const room = this.collection.find(r => r.id === roomId); | ||
room.integrations ||= {} | ||
room.integrations.airmeet ||= {} | ||
room.integrations.airmeet.room_host_email = roomHostEmail; | ||
this.save(room); | ||
}, | ||
patchAirmeetConfig() { | ||
this.toastPromise(new Promise((res, rej) => { | ||
this.patchModel({model: integrationModel, item: this.airmeet, fields: ['config'], selected: false}).then((data) => { | ||
this.setAirmeetInfo(data); | ||
res(data); | ||
}).catch(rej); | ||
}), "Airmeet integration successfully updated.") | ||
} | ||
}, | ||
mounted() { | ||
this.fetch(); | ||
this.fetchAirmeetInfo(); | ||
} | ||
} | ||
</script> | ||
<style> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<template> | ||
<div class="container-fluid"> | ||
<div class="row"> | ||
<div class="column"> | ||
<b-tabs> | ||
<b-tab title="Airmeet"> | ||
<airmeet-settings></airmeet-settings> | ||
</b-tab> | ||
</b-tabs> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import AirmeetSettings from '@/airmeet/airmeet_settings.vue' | ||
export default { | ||
name: "IntegrationSettings", | ||
components: { | ||
AirmeetSettings | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { FETCH } from "./model.store" | ||
|
||
export const integrationModel = 'integration' | ||
|
||
export const integrationEndpoints = { | ||
[integrationModel]: 'integration' | ||
} | ||
|
||
export const FETCH_AIRMEET_INTEGRATION = 'FETCH AIRMEET INTEGRATION' | ||
export const SET_AIRMEET_INTEGRATION = 'SET AIRMEET INTEGRATION' | ||
|
||
export const integrationStore = { | ||
state: { | ||
airmeet: {} | ||
}, | ||
mutations: { | ||
[SET_AIRMEET_INTEGRATION] (state, integration) { | ||
state.airmeet = integration; | ||
} | ||
}, | ||
actions: { | ||
[FETCH_AIRMEET_INTEGRATION] ({dispatch, commit}) { | ||
dispatch(FETCH, {url: 'integration/airmeet'}).then(data => { | ||
commit(SET_AIRMEET_INTEGRATION, data); | ||
}) | ||
} | ||
} | ||
} |
Oops, something went wrong.