-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Features/824 redesign data pages #1133
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,23 +13,27 @@ except according to the terms contained in the LICENSE file. | |
<div id="dataset-entities"> | ||
<page-section> | ||
<template #heading> | ||
<span>{{ $t('resource.entities') }}</span> | ||
<button v-if="project.dataExists && project.permits('entity.create')" | ||
id="dataset-entities-upload-button" type="button" | ||
class="btn btn-primary" @click="upload.show()"> | ||
<span class="icon-upload"></span>{{ $t('action.upload') }} | ||
</button> | ||
<template v-if="deletedEntityCount.dataExists"> | ||
<button v-if="canDelete && (deletedEntityCount.value > 0 || deleted)" type="button" | ||
class="btn toggle-deleted-entities" :class="{ 'btn-danger': deleted, 'btn-link': !deleted }" | ||
@click="toggleDeleted"> | ||
<span class="icon-trash"></span>{{ $tcn('action.toggleDeletedEntities', deletedEntityCount.value) }} | ||
<span v-show="deleted" class="icon-close"></span> | ||
<div class="dataset-entities-heading-row"> | ||
<button v-if="project.dataExists && project.permits('entity.create')" | ||
id="dataset-entities-upload-button" type="button" | ||
class="btn btn-primary" @click="upload.show()"> | ||
<span class="icon-upload"></span>{{ $t('upload') }} | ||
</button> | ||
</template> | ||
<odata-data-access :analyze-disabled="deleted" | ||
:analyze-disabled-message="$t('analyzeDisabledDeletedData')" | ||
@analyze="analyze.show()"/> | ||
<template v-if="deletedEntityCount.dataExists"> | ||
<button v-if="canDelete && (deletedEntityCount.value > 0 || deleted)" type="button" | ||
class="btn toggle-deleted-entities" :class="{ 'btn-danger': deleted, 'btn-link': !deleted }" | ||
@click="toggleDeleted"> | ||
<span class="icon-trash"></span>{{ $tcn('action.toggleDeletedEntities', deletedEntityCount.value) }} | ||
<span v-show="deleted" class="icon-close"></span> | ||
</button> | ||
</template> | ||
<odata-data-access :analyze-disabled="deleted" | ||
:analyze-disabled-message="$t('analyzeDisabledDeletedData')" | ||
@analyze="analyze.show()"/> | ||
<entity-download-button | ||
:aria-disabled="deleted" | ||
v-tooltip.aria-describedby="deleted ? $t('downloadDisabled') : null"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the message for |
||
</div> | ||
</template> | ||
<template #body> | ||
<entity-list ref="list" :project-id="projectId" | ||
|
@@ -54,6 +58,7 @@ import OdataDataAccess from '../odata/data-access.vue'; | |
import PageSection from '../page/section.vue'; | ||
import useEntities from '../../request-data/entities'; | ||
import useQueryRef from '../../composables/query-ref'; | ||
import EntityDownloadButton from '../entity/download-button.vue'; | ||
|
||
import { apiPaths } from '../../util/request'; | ||
import { loadAsync } from '../../util/load-async'; | ||
|
@@ -68,9 +73,13 @@ export default { | |
OdataDataAccess, | ||
EntityList, | ||
EntityUpload: defineAsyncComponent(loadAsync('EntityUpload')), | ||
EntityDownloadButton, | ||
PageSection | ||
}, | ||
inject: ['alert'], | ||
provide() { | ||
return { projectId: this.projectId, datasetName: this.datasetName }; | ||
}, | ||
props: { | ||
projectId: { | ||
type: String, | ||
|
@@ -155,8 +164,6 @@ export default { | |
<style lang="scss"> | ||
@import '../../assets/scss/variables'; | ||
|
||
#odata-data-access { float: right; } | ||
|
||
#dataset-entities { | ||
.toggle-deleted-entities { | ||
margin-left: 8px; | ||
|
@@ -175,12 +182,24 @@ export default { | |
left: 12px; | ||
font-size: 14px; | ||
} | ||
|
||
.dataset-entities-heading-row { | ||
display: flex; | ||
align-items: center; | ||
gap: 10px; | ||
} | ||
|
||
#odata-data-access { | ||
margin-left: auto; | ||
font-size: initial; | ||
} | ||
} | ||
</style> | ||
|
||
<i18n lang="json5"> | ||
{ | ||
"en": { | ||
"upload": "Upload Entities", | ||
"alert": { | ||
"upload": "Success! Your Entities have been uploaded." | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,14 +10,15 @@ including this file, may be copied, modified, propagated, or distributed | |
except according to the terms contained in the LICENSE file. | ||
--> | ||
<template> | ||
<label class="form-group"><!-- eslint-disable-line vuejs-accessibility/label-has-for --> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The linter doesn't usually yell at us about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have removed the |
||
<label id="date-range-picker-container" for="datepicker" class="form-group"> | ||
<!-- We use a class to indicate whether the input is required, because | ||
flatpickr does not support the `required` attribute: | ||
https://github.com/ankurk91/vue-flatpickr-component/issues/47 --> | ||
<flatpickr ref="flatpickr" v-model="flatpickrValue" :config="config" | ||
class="form-control" :class="{ required }" | ||
<flatpickr id="datepicker" ref="flatpickr" v-model="flatpickrValue" :config="config" | ||
class="form-control" | ||
:class="{ required, 'flatpickr-input': true, 'has-value': modelValue.length === 2, none: modelValue.length === 0 }" | ||
:aria-disabled="disabled" v-tooltip.aria-describedby="disabledMessage" | ||
:placeholder="requiredLabel(placeholder, required)" autocomplete="off" | ||
:placeholder="$t('common.none')" autocomplete="off" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it's possible to use a single word for "none" for different filters, since some languages inflect "none" based on what it describes. For example, we translate |
||
@keydown="stopPropagationIfDisabled" | ||
@on-close="close"/> | ||
<template v-if="!required"> | ||
|
@@ -26,7 +27,9 @@ except according to the terms contained in the LICENSE file. | |
<span aria-hidden="true">×</span> | ||
</button> | ||
</template> | ||
<span class="form-label">{{ requiredLabel(placeholder, required) }}</span> | ||
<span v-show="!disabled && (required || modelValue.length < 2)" aria-hidden="true" class="icon-angle-down"> | ||
</span> | ||
<span class="form-label">{{ requiredLabel(label, required) }}</span> | ||
</label> | ||
</template> | ||
|
||
|
@@ -70,7 +73,7 @@ export default { | |
type: Boolean, | ||
default: false | ||
}, | ||
placeholder: { | ||
label: { | ||
type: String, | ||
required: true | ||
}, | ||
|
@@ -187,13 +190,34 @@ export default { | |
} | ||
|
||
.form-inline .flatpickr-input { | ||
// Leave space for the .close button. | ||
width: 205px; | ||
&.required { width: 193px }; | ||
width: 87px; | ||
|
||
&:lang(ja) { | ||
&.has-value { | ||
// Leave space for the .close button. | ||
width: 207px; | ||
&.required { width: 193px }; | ||
} | ||
|
||
&.has-value:lang(ja) { | ||
width: 252px; | ||
&.required { width: 240px; } | ||
} | ||
|
||
&.none { | ||
font-style: italic; | ||
} | ||
} | ||
|
||
#date-range-picker-container { | ||
.icon-angle-down { | ||
font-size: 16px; | ||
color: #555555; | ||
font-weight: bold; | ||
vertical-align: -4px; | ||
} | ||
|
||
.form-label { | ||
transform: translateY(2px); | ||
} | ||
} | ||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,17 +11,14 @@ except according to the terms contained in the LICENSE file. | |
--> | ||
<template> | ||
<a id="entity-download-button" class="btn btn-primary" :href="href"> | ||
<span class="icon-arrow-circle-down"></span>{{ text }} | ||
<span class="icon-arrow-circle-down"></span> | ||
<span>{{ $t('action.download') }}</span> | ||
</a> | ||
</template> | ||
|
||
<script setup> | ||
import { computed, inject } from 'vue'; | ||
import { useI18n } from 'vue-i18n'; | ||
|
||
import { apiPaths } from '../../util/request'; | ||
import { useI18nUtils } from '../../util/i18n'; | ||
import { useRequestData } from '../../request-data'; | ||
|
||
const props = defineProps({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't look like
|
||
odataFilter: String | ||
|
@@ -33,16 +30,6 @@ const datasetName = inject('datasetName'); | |
const href = computed(() => | ||
apiPaths.entities(projectId, datasetName, '.csv', { $filter: props.odataFilter })); | ||
|
||
const { dataset, odataEntities } = useRequestData(); | ||
const { t } = useI18n(); | ||
const { tn } = useI18nUtils(); | ||
const text = computed(() => (props.odataFilter == null | ||
? (dataset.dataExists | ||
? tn('action.download.unfiltered', dataset.entities) | ||
: '') // The button is not visible in this case. | ||
: (odataEntities.dataExists | ||
? tn('action.download.filtered.withCount', odataEntities.count) | ||
: t('action.download.filtered.withoutCount')))); | ||
</script> | ||
|
||
<i18n lang="json5"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the form control is in the
<label>
, I don't think the<label>
needsfor
. From MDN: