Skip to content

Commit

Permalink
Update Config to include group list
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Oct 15, 2024
1 parent 85b50ee commit 16a4db1
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 48 deletions.
14 changes: 7 additions & 7 deletions api/web/src/components/Admin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<IconServer
:size='32'
:stroke='1'
/><span class='mx-3'>TAK Server</span>
/><span class='mx-3'>TAK Server Connection</span>
</span>
<span
class='list-group-item list-group-item-action d-flex align-items-center'
Expand All @@ -58,7 +58,7 @@
><IconSettings
:size='32'
:stroke='1'
/><span class='mx-3'>Settings</span></span>
/><span class='mx-3'>CloudTAK Settings</span></span>
<span
class='list-group-item list-group-item-action d-flex align-items-center'
:class='{
Expand Down Expand Up @@ -88,7 +88,7 @@
"cursor-pointer": $route.name !== "admin-task"
}'
@click='$router.push(`/admin/task`)'
><IconBrandDocker
><IconBrandDocker
:size='32'
:stroke='1'
/><span class='mx-3'>Registered Tasks</span></span>
Expand Down Expand Up @@ -121,7 +121,7 @@
"cursor-pointer": $route.name !== "admin-data"
}'
@click='$router.push(`/admin/data`)'
><IconDatabase
><IconDatabase
:size='32'
:stroke='1'
/><span class='mx-3'>Data Syncs</span></span>
Expand All @@ -132,7 +132,7 @@
"cursor-pointer": !$route.name.startsWith("admin-user")
}'
@click='$router.push(`/admin/user`)'
><IconUsers
><IconUsers
:size='32'
:stroke='1'
/><span class='mx-3'>Users</span></span>
Expand All @@ -143,7 +143,7 @@
"cursor-pointer": !$route.name.includes("admin-video")
}'
@click='$router.push(`/admin/video`)'
><IconVideo
><IconVideo
:size='32'
:stroke='1'
/><span class='mx-3'>Video Services</span></span>
Expand All @@ -154,7 +154,7 @@
"cursor-pointer": !$route.name.includes("admin-export")
}'
@click='$router.push(`/admin/export`)'
><IconDatabaseExport
><IconDatabaseExport
:size='32'
:stroke='1'
/><span class='mx-3'>Export</span></span>
Expand Down
162 changes: 121 additions & 41 deletions api/web/src/components/Admin/AdminConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,42 +20,92 @@
</div>
</div>
<div class='card-body row'>
<div class='col-lg-12 py-2'>
<TablerToggle
v-model='config["agol::enabled"]'
:disabled='!edit'
label='ArcGIS Online Enabled'
/>
<TablerInput
v-model='config["agol::token"]'
type='password'
:disabled='!edit'
label='ArcGIS Online API Token'
/>
<div
@click='opened.has("agol") ? opened.delete("agol") : opened.add("agol")'
class='col-lg-12 hover-light py-2 cursor-pointer'
>
<IconChevronDown v-if='opened.has("agol")'/>
<IconChevronRight v-else/>

<span class='mx-2 user-select-none'>ArcGIS Online</span>
</div>

<div class='col-lg-12 py-2 row'>
<TablerInput
v-model='config["media::url"]'
:disabled='!edit'
label='Hosted Media Service URL'
/>

<div class='col-lg-6'>
<TablerInput
v-model='config["media::username"]'
:disabled='!edit'
label='Hosted Media Service Username'
/>
<div v-if='opened.has("agol")' class='col-lg-12 py-2 border rounded'>
<div class='row'>
<div class='col-lg-12'>
<TablerToggle
v-model='config["agol::enabled"]'
:disabled='!edit'
label='ArcGIS Online Enabled'
/>
<TablerInput
v-model='config["agol::token"]'
type='password'
:disabled='!edit'
label='ArcGIS Online API Token'
/>
</div>
</div>
</div>

<div class='col-lg-6'>
<TablerInput
v-model='config["media::password"]'
type='password'
:disabled='!edit'
label='Hosted Media Service Password'
/>
<div
@click='opened.has("media") ? opened.delete("media") : opened.add("media")'
class='col-lg-12 hover-light py-2 cursor-pointer'
>
<IconChevronDown v-if='opened.has("media")'/>
<IconChevronRight v-else/>

<span class='mx-2 user-select-none'>Media Server</span>
</div>

<div v-if='opened.has("media")' class='col-lg-12 py-2 border rounded'>
<div class='row'>
<div class='col-lg-12'>
<TablerInput
v-model='config["media::url"]'
:disabled='!edit'
label='Hosted Media Service URL'
/>
</div>

<div class='col-lg-6'>
<TablerInput
v-model='config["media::username"]'
:disabled='!edit'
label='Hosted Media Service Username'
/>
</div>

<div class='col-lg-6'>
<TablerInput
v-model='config["media::password"]'
type='password'
:disabled='!edit'
label='Hosted Media Service Password'
/>
</div>
</div>
</div>

<div
@click='opened.has("groups") ? opened.delete("groups") : opened.add("groups")'
class='col-lg-12 hover-light py-2 cursor-pointer'
>
<IconChevronDown v-if='opened.has("groups")'/>
<IconChevronRight v-else/>

<span class='mx-2 user-select-none'>TAK User Groups</span>
</div>

<div v-if='opened.has("groups")' class='col-lg-12 py-2 border rounded'>
<div class='row'>
<div v-for='group in groups' :key='group' class='col-lg-12'>
<TablerInput
:label='group'
v-model='config[`group::${group}`]'
:disabled='!edit'
/>
</div>
</div>
</div>

Expand Down Expand Up @@ -91,30 +141,59 @@ import {
TablerInput
} from '@tak-ps/vue-tabler';
import {
IconSettings
IconSettings,
IconChevronRight,
IconChevronDown,
} from '@tabler/icons-vue';
import timeDiff from '../../timediff.ts';
export default {
name: 'AdminConfig',
components: {
IconSettings,
IconChevronRight,
IconChevronDown,
TablerLoading,
TablerToggle,
TablerInput,
},
data: function() {
const groups = [
"Yellow",
"Cyan",
"Green",
"Red",
"Purple",
"Orange",
"Blue",
"Magenta",
"White",
"Maroon",
"Dark Blue",
"Teal",
"Dark Green",
"Brown",
];
const config = {
'agol::enabled': false,
'agol::token': '',
'media::url': '',
'media::username': '',
'media::password': ''
}
for (const group of groups) {
config[`group::${group}`] = '';
}
return {
edit: false,
loading: true,
config: {
'agol::enabled': false,
'agol::token': '',
'media::url': '',
'media::username': '',
'media::password': ''
}
opened: new Set(),
groups,
config
}
},
mounted: async function() {
Expand All @@ -135,6 +214,7 @@ export default {
if (config[key] === undefined) continue;
this.config[key] = config[key];
}
this.loading = false;
},
postConfig: async function() {
Expand Down

0 comments on commit 16a4db1

Please sign in to comment.