-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
184 additions
and
108 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
106 changes: 3 additions & 103 deletions
106
api/web/src/components/CloudTAK/Menu/SettingsCallsign.vue
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,120 +1,20 @@ | ||
<template> | ||
<MenuTemplate name='Callsign & Device'> | ||
<div class='mx-2'> | ||
<TablerLoading v-if='loading' /> | ||
<template v-else> | ||
<div class='col-12'> | ||
<TablerInput | ||
v-model='profile.tak_callsign' | ||
label='User Callsign' | ||
/> | ||
</div> | ||
<div class='col-12'> | ||
<TablerEnum | ||
v-model='profile.tak_group' | ||
label='User Group' | ||
:options='tak_groups' | ||
/> | ||
</div> | ||
<div class='col-12'> | ||
<TablerEnum | ||
v-model='profile.tak_role' | ||
label='User Role' | ||
:options='tak_roles' | ||
/> | ||
</div> | ||
<div class='col-12 d-flex py-3'> | ||
<div class='ms-auto'> | ||
<button | ||
class='btn btn-primary' | ||
@click='updateProfile' | ||
> | ||
Update | ||
</button> | ||
</div> | ||
</div> | ||
</template> | ||
<SettingsCallsign/> | ||
</div> | ||
</MenuTemplate> | ||
</template> | ||
|
||
<script> | ||
import MenuTemplate from '../util/MenuTemplate.vue'; | ||
import { std } from '/src/std.ts'; | ||
import { | ||
TablerInput, | ||
TablerEnum, | ||
TablerLoading | ||
} from '@tak-ps/vue-tabler'; | ||
import { useProfileStore } from '/src/stores/profile.ts'; | ||
const profileStore = useProfileStore(); | ||
import SettingsCallsign from '../util/SettingsCallsign.vue'; | ||
export default { | ||
name: 'CloudTAKSettingsCallsign', | ||
components: { | ||
TablerInput, | ||
TablerEnum, | ||
TablerLoading, | ||
MenuTemplate, | ||
SettingsCallsign | ||
}, | ||
data: function() { | ||
return { | ||
loading: true, | ||
profile: {}, | ||
config: {} | ||
} | ||
}, | ||
computed: { | ||
tak_groups: function() { | ||
const groups = []; | ||
for (const g in this.config.groups) { | ||
if (this.config.groups[g]) { | ||
groups.push(`${g} - ${this.config.groups[g]}`); | ||
} else { | ||
groups.push(g); | ||
} | ||
} | ||
return groups; | ||
}, | ||
tak_roles: function() { | ||
return this.config.roles; | ||
} | ||
}, | ||
mounted: async function() { | ||
this.loading = true; | ||
await this.fetchConfig(); | ||
await profileStore.load(); | ||
const profile = JSON.parse(JSON.stringify(profileStore.profile)); | ||
if (this.config.groups[profile.tak_group]) { | ||
profile.tak_group = `${profile.tak_group} - ${this.config.groups[profile.tak_group]}`; | ||
} | ||
this.profile = profile; | ||
this.loading = false; | ||
}, | ||
methods: { | ||
fetchConfig: async function() { | ||
const config = await std('/api/config/group'); | ||
const groups = {}; | ||
for (const key in config.groups) { | ||
groups[key.replace('group::', '')] = config.groups[key]; | ||
} | ||
this.config = { | ||
groups, | ||
roles: config.roles | ||
}; | ||
}, | ||
updateProfile: async function() { | ||
const profile = JSON.parse(JSON.stringify(this.profile)); | ||
profile.tak_group = profile.tak_group.replace(/\s-\s.*$/, ''); | ||
await profileStore.update(profile); | ||
this.$router.push("/menu/settings"); | ||
} | ||
} | ||
} | ||
</script> |
114 changes: 114 additions & 0 deletions
114
api/web/src/components/CloudTAK/util/SettingsCallsign.vue
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> | ||
<TablerLoading v-if='loading' /> | ||
<template v-else> | ||
<div class='col-12'> | ||
<TablerInput | ||
v-model='profile.tak_callsign' | ||
label='User Callsign' | ||
/> | ||
</div> | ||
<div class='col-12'> | ||
<TablerEnum | ||
v-model='profile.tak_group' | ||
label='User Group' | ||
:options='tak_groups' | ||
/> | ||
</div> | ||
<div class='col-12'> | ||
<TablerEnum | ||
v-model='profile.tak_role' | ||
label='User Role' | ||
:options='tak_roles' | ||
/> | ||
</div> | ||
<div class='col-12 d-flex py-3'> | ||
<div class='ms-auto'> | ||
<button | ||
class='btn btn-primary' | ||
@click='updateProfile' | ||
> | ||
Update | ||
</button> | ||
</div> | ||
</div> | ||
</template> | ||
</template> | ||
|
||
<script> | ||
import { std } from '/src/std.ts'; | ||
import { | ||
TablerInput, | ||
TablerEnum, | ||
TablerLoading | ||
} from '@tak-ps/vue-tabler'; | ||
import { useProfileStore } from '/src/stores/profile.ts'; | ||
const profileStore = useProfileStore(); | ||
export default { | ||
name: 'CloudTAKSettingsCallsign', | ||
components: { | ||
TablerInput, | ||
TablerEnum, | ||
TablerLoading, | ||
}, | ||
data: function() { | ||
return { | ||
loading: true, | ||
profile: {}, | ||
config: {} | ||
} | ||
}, | ||
computed: { | ||
tak_groups: function() { | ||
const groups = []; | ||
for (const g in this.config.groups) { | ||
if (this.config.groups[g]) { | ||
groups.push(`${g} - ${this.config.groups[g]}`); | ||
} else { | ||
groups.push(g); | ||
} | ||
} | ||
return groups; | ||
}, | ||
tak_roles: function() { | ||
return this.config.roles; | ||
} | ||
}, | ||
mounted: async function() { | ||
this.loading = true; | ||
await this.fetchConfig(); | ||
await profileStore.load(); | ||
const profile = JSON.parse(JSON.stringify(profileStore.profile)); | ||
if (this.config.groups[profile.tak_group]) { | ||
profile.tak_group = `${profile.tak_group} - ${this.config.groups[profile.tak_group]}`; | ||
} | ||
this.profile = profile; | ||
this.loading = false; | ||
}, | ||
methods: { | ||
fetchConfig: async function() { | ||
const config = await std('/api/config/group'); | ||
const groups = {}; | ||
for (const key in config.groups) { | ||
groups[key.replace('group::', '')] = config.groups[key]; | ||
} | ||
this.config = { | ||
groups, | ||
roles: config.roles | ||
}; | ||
}, | ||
updateProfile: async function() { | ||
const profile = JSON.parse(JSON.stringify(this.profile)); | ||
profile.tak_group = profile.tak_group.replace(/\s-\s.*$/, ''); | ||
await profileStore.update(profile); | ||
this.$router.push("/menu/settings"); | ||
} | ||
} | ||
} | ||
</script> |
52 changes: 52 additions & 0 deletions
52
api/web/src/components/CloudTAK/util/WarnConfiguration.vue
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,52 @@ | ||
<template> | ||
<TablerModal size='lg'> | ||
<div class='modal-status bg-red' /> | ||
<button | ||
type='button' | ||
class='btn-close' | ||
aria-label='Close' | ||
@click='$emit("close")' | ||
/> | ||
<div class='modal-header text-white'> | ||
<div class='d-flex align-items-center'> | ||
<IconInfoSquare | ||
:size='28' | ||
:stroke='1' | ||
/> | ||
<span class='mx-2'>Welcome to CloudTAK</span> | ||
</div> | ||
</div> | ||
<div class='modal-body text-white'> | ||
<SettingsCallsign/> | ||
</div> | ||
</TablerModal> | ||
</template> | ||
|
||
<script> | ||
import { | ||
TablerModal, | ||
} from '@tak-ps/vue-tabler'; | ||
import { | ||
IconInfoSquare, | ||
} from '@tabler/icons-vue'; | ||
import SettingsCallsign from './SettingsCallsign.vue'; | ||
export default { | ||
name: 'WarnConfiguration', | ||
components: { | ||
TablerModal, | ||
IconInfoSquare, | ||
SettingsCallsign | ||
}, | ||
emits: [ | ||
'close' | ||
], | ||
methods: { | ||
selectChannels: function() { | ||
this.$emit('close'); | ||
this.$router.push('/menu/channels'); | ||
}, | ||
} | ||
} | ||
</script> |
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