Skip to content

Commit

Permalink
Move analyze/odata popup to more generic location
Browse files Browse the repository at this point in the history
  • Loading branch information
ktuite committed Feb 8, 2023
1 parent 9d73c59 commit cd12ba7
Show file tree
Hide file tree
Showing 7 changed files with 335 additions and 667 deletions.
12 changes: 6 additions & 6 deletions src/components/form/submissions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ except according to the terms contained in the LICENSE file.
<enketo-fill v-if="rendersEnketoFill" :form-version="form">
<span class="icon-plus-circle"></span>{{ $t('action.createSubmission') }}
</enketo-fill>
<submission-data-access :form-version="form"
<o-data-access :form-version="form"
@analyze="showModal('analyze')"/>
</template>
<template #body>
<submission-list :project-id="projectId" :xml-form-id="xmlFormId"/>
</template>
</page-section>
<submission-analyze v-bind="analyze" @hide="hideModal('analyze')"/>
<o-data-analyze v-bind="analyze" @hide="hideModal('analyze')"/>
</div>
</template>

<script>
import EnketoFill from '../enketo/fill.vue';
import Loading from '../loading.vue';
import PageSection from '../page/section.vue';
import SubmissionAnalyze from '../submission/analyze.vue';
import SubmissionDataAccess from '../submission/data-access.vue';
import ODataAnalyze from '../odata/analyze.vue';
import ODataAccess from '../odata/data-access.vue';
import SubmissionList from '../submission/list.vue';
import modal from '../../mixins/modal';
Expand All @@ -48,8 +48,8 @@ export default {
EnketoFill,
Loading,
PageSection,
SubmissionAnalyze,
SubmissionDataAccess,
ODataAnalyze,
ODataAccess,
SubmissionList
},
mixins: [modal()],
Expand Down
224 changes: 224 additions & 0 deletions src/components/odata/analyze.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
<!--
Copyright 2017 ODK Central Developers
See the NOTICE file at the top-level directory of this distribution and at
https://github.com/getodk/central-frontend/blob/master/NOTICE.
This file is part of ODK Central. It is subject to the license terms in
the LICENSE file found in the top-level directory of this distribution and at
https://www.apache.org/licenses/LICENSE-2.0. No part of ODK Central,
including this file, may be copied, modified, propagated, or distributed
except according to the terms contained in the LICENSE file.
-->
<template>
<modal id="odata-analyze" :state="state" hideable backdrop
@hide="$emit('hide')">
<template #title>{{ $t('title') }}</template>
<template #body>
<div id="odata-analyze-head">
<div class="modal-introduction">
<i18n-t tag="p" keypath="introduction[0]">
<template #powerBi>
<a href="https://powerbi.microsoft.com/en-us/" target="_blank" rel="noopener">Microsoft Power BI</a>
</template>
<template #r>
<a href="https://www.r-project.org" target="_blank" rel="noopener">R</a>
</template>
</i18n-t>
<p>{{ $t('introduction[1]') }}</p>
<p>{{ $t('introduction[2]') }}</p>
</div>
<ul class="nav nav-tabs">
<li :class="tabClass('microsoft')" role="presentation">
<a href="#" @click.prevent="setTool('microsoft')">{{ $t('tab.microsoft') }}</a>
</li>
<li :class="tabClass('r')" role="presentation">
<a href="#" @click.prevent="setTool('r')">R</a>
</li>
<li :class="tabClass('other')" role="presentation">
<a href="#" @click.prevent="setTool('other')">{{ $t('tab.other') }}</a>
</li>
</ul>
</div>
<div id="odata-analyze-odata-url" class="modal-introduction">
<selectable>{{ odataUrl }}</selectable>
</div>
<div id="odata-analyze-tool-help" class="modal-introduction">
<i18n-t v-if="tool === 'microsoft'" tag="p" keypath="help.microsoft.full">
<template #pageForExcel>
<a href="https://support.office.com/en-us/article/connect-to-an-odata-feed-power-query-4441a94d-9392-488a-a6a9-739b6d2ad500" target="_blank" rel="noopener">{{ $t('help.microsoft.pageForExcel') }}</a>
</template>
<template #pageForPowerBi>
<a href="https://docs.microsoft.com/en-us/power-bi/desktop-connect-odata" target="_blank" rel="noopener">{{ $t('help.microsoft.pageForPowerBi') }}</a>
</template>
</i18n-t>
<template v-else-if="tool === 'r'">
<i18n-t tag="p" keypath="help.r[0].full">
<template #r>
<a href="https://www.r-project.org" target="_blank" rel="noopener">R</a>
</template>
<template #ruODK>
<a href="https://docs.ropensci.org/ruODK/index.html" target="_blank" rel="noopener">ruODK</a>
</template>
<template #oData>
<a href="https://docs.ropensci.org/ruODK/articles/odata-api.html" target="_blank" rel="noopener">OData</a>
</template>
<template #restful>
<a href="https://docs.ropensci.org/ruODK/articles/restful-api.html" target="_blank" rel="noopener">{{ $t('help.r[0].restful') }}</a>
</template>
</i18n-t>
<i18n-t tag="p" keypath="help.r[1].full">
<template #here>
<a href="https://docs.ropensci.org/ruODK/CONTRIBUTING.html" target="_blank" rel="noopener">{{ $t('help.r[1].here') }}</a>
</template>
</i18n-t>
</template>
<i18n-t v-else-if="tool === 'other'" tag="p" keypath="help.other.full">
<template #article>
<a href="https://odkcentral.docs.apiary.io/#reference/odata-endpoints" target="_blank" rel="noopener">{{ $t('help.other.article') }}</a>
</template>
</i18n-t>
</div>
<div id="odata-analyze-actions-container">
<div class="modal-actions">
<button type="button" class="btn btn-primary" @click="$emit('hide')">
{{ $t('action.done') }}
</button>
</div>
</div>
</template>
</modal>
</template>

<script>
import Modal from '../modal.vue';
import Selectable from '../selectable.vue';
import { apiPaths } from '../../util/request';
import { useRequestData } from '../../request-data';
export default {
name: 'ODataAnalyze',
components: { Modal, Selectable },
props: {
state: Boolean
},
emits: ['hide'],
setup() {
const { form } = useRequestData();
return { form };
},
data() {
return {
tool: 'microsoft'
};
},
computed: {
odataUrl() {
if (!this.form.dataExists) return '';
const path = apiPaths.odataSvc(this.form.projectId, this.form.xmlFormId);
return `${window.location.origin}${path}`;
}
},
watch: {
state(state) {
if (!state) this.tool = 'microsoft';
}
},
methods: {
tabClass(tool) {
return { active: this.tool === tool };
},
setTool(tool) {
this.tool = tool;
}
}
};
</script>

<style lang="scss">
@import '../../assets/scss/variables';
#odata-analyze .modal-body {
padding-left: 0;
padding-right: 0;
.modal-introduction {
margin-bottom: 10px;
}
#odata-analyze-head {
border-bottom: 1px solid $color-subpanel-border-strong;
padding-left: $padding-modal-body;
padding-right: $padding-modal-body;
.nav-tabs {
margin-top: 15px;
}
}
#odata-analyze-odata-url {
background-color: $color-subpanel-background;
margin-bottom: 10px;
padding: 12px $padding-modal-body;
}
#odata-analyze-tool-help {
margin-top: 15px;
padding-left: $padding-modal-body;
padding-right: $padding-modal-body;
&:empty {
margin-top: 0px;
}
}
#odata-analyze-actions-container {
padding-left: $padding-modal-body;
padding-right: $padding-modal-body;
}
}
</style>

<i18n lang="json5">
{
"en": {
// This is the title at the top of a pop-up.
"title": "Using OData",
"introduction": [
// The text of {powerBi} is "Microsoft Power BI". The text of {r} is "R".
// {powerBi} and {r} are both links.
"OData is a new standard for transferring data between tools and services. Free and powerful analysis tools like Excel, {powerBi}, and {r} can fetch data over OData for analysis.",
"There are many advantages to OData, but importantly it supports the full-fidelity transfer of complicated types like numbers and geographic data, and it enables the latest version of your data to synchronize easily with any tools using it.",
"To begin using OData, select your tool and copy the link into it."
],
"tab": {
"microsoft": "Excel/Power BI",
// This is the text of a navigation tab. "Other" refers to "other tool".
"other": "Other"
},
"help": {
"microsoft": {
"full": "For help using OData with Excel, see {pageForExcel}. For help with Power BI, see {pageForPowerBi}.",
"pageForExcel": "this page",
"pageForPowerBi": "this page"
},
"r": [
{
// The text of {r} is "R". The text of {ruODK} is "ruODK". The text of
// {oData} is "OData". All three are links.
"full": "To access Central data from {r}, we recommend you use {ruODK}. See ruODK’s vignettes for examples of using both the {oData} and the {restful} API.",
"restful": "RESTful"
},
{
"full": "Just like ODK itself, ruODK is developed and supported by community members. If you wish to help improve it, you can find information {here}.",
"here": "here"
}
],
"other": {
"full": "For a full description of our OData support, please see {article}.",
"article": "this article"
}
}
}
}
</i18n>
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ including this file, may be copied, modified, propagated, or distributed
except according to the terms contained in the LICENSE file.
-->
<template>
<span id="submission-data-access">
<span id="odata-access">
<a class="btn btn-default"
href="https://odkcentral.docs.apiary.io/#reference/odata-endpoints"
target="_blank" rel="noopener">
<span class="icon-plug"></span>{{ $t('action.apiAccess') }}
</a>
<button id="submission-data-access-analyze-button" type="button"
<button id="odata-access-analyze-button" type="button"
class="btn btn-default" :aria-disabled="analyzeDisabled"
v-tooltip.aria-describedby="analyzeDisabled ? $t('analyzeDisabled') : null"
@click="$emit('analyze')">
Expand All @@ -29,7 +29,7 @@ except according to the terms contained in the LICENSE file.
import { useRequestData } from '../../request-data';
export default {
name: 'SubmissionDataAccess',
name: 'ODataAccess',
props: {
formVersion: Object
},
Expand All @@ -56,7 +56,7 @@ export default {
</script>

<style lang="scss">
#submission-data-access-analyze-button { margin-left: 5px; }
#odata-access-analyze-button { margin-left: 5px; }
</style>

<i18n lang="json5">
Expand All @@ -70,65 +70,3 @@ export default {
}
}
</i18n>

<!-- Autogenerated by destructure.js -->
<i18n>
{
"cs": {
"action": {
"apiAccess": "API přístup",
"analyze": "Analyzujte pomocí OData"
},
"analyzeDisabled": "Přístup OData není k dispozici kvůli šifrování formuláře"
},
"de": {
"action": {
"apiAccess": "API-Zugriff",
"analyze": "Mittels OData analysieren"
},
"analyzeDisabled": "OData-Zugriff ist wegen Formularverschlüsselung nicht verfügbar."
},
"es": {
"action": {
"apiAccess": "Acceso API",
"analyze": "Analizar a través de OData"
},
"analyzeDisabled": "El acceso a OData no está disponible debido al cifrado de Formulario"
},
"fr": {
"action": {
"apiAccess": "Accès via l'API",
"analyze": "Analyser via OData"
},
"analyzeDisabled": "L'accès via OData n'est ps disponible du fait du chiffrement du formulaire"
},
"id": {
"action": {
"apiAccess": "Akses API",
"analyze": "Analisa lewat OData"
},
"analyzeDisabled": "Akses OData tidak tersedia karena enkripsi Formulir"
},
"it": {
"action": {
"apiAccess": "accesso attraverso API",
"analyze": "Analizzare attraverso OData"
},
"analyzeDisabled": "L'accesso OData non è disponibile a causa della crittografia del formulario"
},
"ja": {
"action": {
"apiAccess": "APIアクセス",
"analyze": "OData経由で解析"
},
"analyzeDisabled": "フォームの暗号化のため、ODataによるアクセスは利用できません"
},
"sw": {
"action": {
"apiAccess": "Ufikiaji wa API",
"analyze": "Changanua kupitia OData"
},
"analyzeDisabled": "Ufikiaji wa OData haupatikani kwa sababu ya usimbaji fiche wa Fomu"
}
}
</i18n>
Loading

0 comments on commit cd12ba7

Please sign in to comment.