Skip to content

Commit

Permalink
Move code changes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Feb 8, 2022
1 parent 085f6ac commit d57ec53
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/web-runtime/src/components/Topbar/ApplicationsMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
appearance="raw"
:class="{ 'oc-background-primary-gradient': n.active }"
:variation="n.active ? 'inverse' : 'passive'"
@click="clickApp(n)"
>
<span class="icon-box" :class="{ 'icon-box-active': n.active }">
<oc-icon :name="n.icon" />
Expand All @@ -48,6 +49,8 @@
</template>

<script>
import { mapGetters } from 'vuex'
export default {
props: {
applicationsList: {
Expand All @@ -57,6 +60,8 @@ export default {
}
},
computed: {
...mapGetters(['configuration', 'getToken']),
applicationSwitcherLabel() {
return this.$gettext('Application Switcher')
}
Expand All @@ -66,6 +71,27 @@ export default {
onHidden: () => this.$refs.menubutton.$el.focus(),
onShown: () => this.$refs.menu.$el.querySelector('a:first-of-type').focus()
})
},
methods: {
async clickApp(appEntry) {
// @TODO use id or similar
if (appEntry.iconMaterial === 'switch_ui') {
await this.setClassicUIDefault()
}
},
setClassicUIDefault() {
const endpoint = new URL(this.configuration.server || window.location.origin)
endpoint.pathname =
endpoint.pathname.replace(/\/$/, '') + '/index.php/apps/web/settings/default'
const headers = new Headers()
headers.append('Authorization', 'Bearer ' + this.getToken)
headers.append('X-Requested-With', 'XMLHttpRequest')
return fetch(endpoint.href, {
headers,
method: 'POST',
body: JSON.stringify({ isDefault: false })
})
}
}
}
</script>
Expand Down

0 comments on commit d57ec53

Please sign in to comment.