Skip to content

Commit

Permalink
Merge branch 'main' into grady/bulkactions
Browse files Browse the repository at this point in the history
  • Loading branch information
gbdubs committed Jan 24, 2024
2 parents 42cc876 + b76bc98 commit e4f10a4
Show file tree
Hide file tree
Showing 17 changed files with 225 additions and 172 deletions.
4 changes: 2 additions & 2 deletions frontend/components/LinkButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const href = computed(() => {

<template>
<NuxtLink
v-slot="{ navigate }"
v-slot="{ navigate, navigateExternal }"
:target="target"
:to="to"
:aria-disabled="disabled"
Expand All @@ -171,7 +171,7 @@ const href = computed(() => {
type="button"
:aria-label="defaultAriaLabel"
:aria-disabled="disabled"
@click="navigate"
@click="props.external ? navigate : navigateExternal"
>
<span
v-if="props.loading && !props.icon"
Expand Down
9 changes: 0 additions & 9 deletions frontend/components/analysis/ListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,6 @@ const deleteSpecificAnalysis = async (id: string) => {
</div>
</template>
</PVDataTable>
<div class="flex flex-wrap gap-3 w-full justify-content-between">
<!-- TODO(grady) Hook this up to something. -->
<PVButton
class="p-button-outlined"
:label="tt('How To Run a Report')"
icon="pi pi-question-circle"
icon-pos="right"
/>
</div>
<StandardDebug
:value="selectedAnalyses"
label="Selected Analyses"
Expand Down
14 changes: 4 additions & 10 deletions frontend/components/incompleteupload/ListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const saveChanges = (id: string) => {
<template>
<div class="flex flex-column gap-3">
<p>
TODO(#80) Write some copy about what Incomplete Uploads are, and direct users toward deleting them.
{{ tt('Paragraph1') }}
</p>
<div class="flex gap-2 flex-wrap">
<PVButton
Expand Down Expand Up @@ -112,16 +112,10 @@ const saveChanges = (id: string) => {
<h2 class="mt-0">
Metadata
</h2>
<div class="flex flex-column gap-2 w-fit">
<div class="flex gap-2 justify-content-between">
<span>Created At</span>
<b>{{ humanReadableTimeFromStandardString(slotProps.data.currentValue.value.createdAt).value }}</b>
</div>
</div>
<!-- TODO(grady) add failure information here. -->
<StandardDebug
:value="slotProps.data.editorValues.value"
label="Editor Values"
:value="slotProps.data.currentValue.value"
:label="tt('Metadata')"
always
/>
<h2 class="mt-5">
Editable Properties
Expand Down
8 changes: 0 additions & 8 deletions frontend/components/portfolio/ListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -441,14 +441,6 @@ const auditLogURL = (id: string) => {
to="/upload"
:label="tt('Upload New Portfolios')"
/>
<!-- TODO(grady) Hook this up to something. -->
<PVButton
v-if="props.portfolios.length > 0"
class="p-button-outlined"
:label="tt('How To Run a Report')"
icon="pi pi-question-circle"
icon-pos="right"
/>
</div>
<StandardDebug
:value="selectedPortfolios"
Expand Down
8 changes: 0 additions & 8 deletions frontend/components/portfolio/group/ListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,6 @@ const editorObjectToIds = (editorObject: EditorObject): string[] => {
:label="tt('New Portfolio Group')"
@click="() => newPortfolioGroupVisible = true"
/>
<!-- TODO(grady) Hook this up to something. -->
<PVButton
v-if="portfolioGroups.length > 0"
class="p-button-outlined"
:label="tt('How To Run a Report')"
icon="pi pi-question-circle"
icon-pos="right"
/>
</div>
</div>
</template>
7 changes: 3 additions & 4 deletions frontend/components/standard/Debug.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
const { showStandardDebug } = useLocalStorage()
const { showStandardDebug, showDevTools } = useLocalStorage()
const { t } = useI18n()
const prefix = 'components/standard/Debug'
Expand All @@ -8,7 +8,6 @@ const tt = (s: string) => t(`${prefix}.${s}`)
interface Props {
label?: string
always?: boolean
noAccordion?: boolean
value: unknown
}
const props = withDefaults(defineProps<Props>(), { always: false, label: undefined })
Expand All @@ -27,12 +26,12 @@ function createCircularReplacer (): (this: any, key: string, value: any) => any
return value
}
}
const showIfDebug = computed(() => showStandardDebug.value && showDevTools.value)
</script>

<template>
<PVAccordion
v-if="(showStandardDebug || props.always) && !props.noAccordion"
v-if="showIfDebug || props.always"
class="standard-debug"
>
<PVAccordionTab
Expand Down
7 changes: 5 additions & 2 deletions frontend/components/standard/Footer.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
const { showStandardDebug } = useLocalStorage()
const { showStandardDebug, showDevTools } = useLocalStorage()
const { fakeUsers: { fakeUsersVisible }, missingTranslations: { missingTranslationsVisible } } = useModal()
const { t } = useI18n()
const localePath = useLocalePath()
Expand All @@ -17,7 +17,10 @@ const tt = (s: string) => t(`${prefix}.${s}`)
>Rocky Mountain Institute</a></span>
<span class="text-600">© 2023 RMI</span>
</div>
<div class="flex flex-column align-items-center">
<div
v-if="showDevTools"
class="flex flex-column align-items-center"
>
<div class="flex gap-1">
<PVButton
v-tooltip.top="tt('Manage Fake Users')"
Expand Down
3 changes: 2 additions & 1 deletion frontend/composables/useLocalStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const useLocalStorage = () => {

const helpTextExpanded = (helpTextId: string) => computedBooleanLocalStorageValue(`helpTextExpanded-${helpTextId}`, false)
const showStandardDebug = computedBooleanLocalStorageValue('showStandardDebug', false)

const showDevTools = computedBooleanLocalStorageValue('showDevTools', false)
const languageWasSelectedOrDismissed = computedBooleanLocalStorageValue('languageWasSelectedOrDismissed', false)

return {
Expand All @@ -90,6 +90,7 @@ export const useLocalStorage = () => {
computedDateLocalStorageValue,
helpTextExpanded,
showStandardDebug,
showDevTools,
deviceId,
getDeviceId,
languageWasSelectedOrDismissed,
Expand Down
28 changes: 21 additions & 7 deletions frontend/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,26 @@
"Needs Attention": "Needs Attention"
},
"components/incompleteupload/ListView": {
"Paragraph1": "Incomplete uploads are pieces of data that you have uploaded to the platform, but have not yet finished processing. This can happen if you upload a large file that takes a while to process, or if you upload a file that is not formatted correctly. The two most common responses to this problem are either to delete the data, which you can do below, or enable AdminDebugging on the data and file a bug report so that our team can take a look.",
"Created At": "Created At",
"Metadata": "Incomplete Upload Metadata",
"Details": "Details",
"Name": "Name",
"Delete": "Delete",
"Editable Properties": "Editable Properties",
"Holdings Date": "Holdings Date",
"Metadata": "Metadata",
"Number of Rows": "Number of Rows",
"Save Changes": "Save Changes",
"Refresh": "Refresh"
},
"lib/editor/incomplete_upload": {
"Name": "Name",
"NameHelpText": "This is the name of the incomplete upload source file - it is only for reference and organization, and does not impact analysis.",
"Description": "Description",
"DescriptionHelpText": "This is an optional description of the incomplete upload source file - it is only for reference and organization, and does not impact analysis.",
"AdminDebuggingEnabled": "Administrator Access",
"ADEHelpText": "When enabled, this upload can be accessed by administrators for help with debugging. Only turn this on if you're comfortable with system administrators accessing this data.",
},
"components/analysis/ContextualListView": {
"Ran At": "Ran At",
"Run Audit": "Run Audit",
Expand Down Expand Up @@ -306,7 +315,7 @@
"A project of": "A project of",
"About": "About",
"Dev Tools": "Dev Tools",
"File a Bug": "File a Bug",
"File a Bug": "Report an Issue",
"Manage Fake Users": "Manage Fake Users",
"Missing Translations": "Missing Translations",
"Privacy": "Privacy",
Expand Down Expand Up @@ -400,7 +409,9 @@
"Portfolio Groups": "Portfolio Groups",
"Portfolios": "Portfolios",
"Incomplete Uploads": "Incomplete Uploads",
"Analyses": "Reports and Audits"
"Analyses": "Reports and Audits",
"Paragraph1": "This page is your home base for managing your existing data on the PACTA platform. You can run audits and reports over your portfolios, manage their memberships in groups and initiatives, and view the results of platform analysis.",
"Upload More Portfolios": "Upload More Portfolios"
},
"pages/initiative/invitations": {
"Yes Invitations": "This initiative requires an invitation (a unique, one-time code) to join. You can create and manage these invitations below.",
Expand Down Expand Up @@ -452,8 +463,10 @@
"pages/upload": {
"Input User Guide": "Input User Guide",
"Sample CSV": "Sample CSV",
"Paragraph1": "This is a page where you can upload portfolios to test out the PACTA platform.",
"Paragraph2": "Input files are expected to be structured as CSVs with an expected set of header rows. To learn more, check out the Input User Guide or download a sample CSV.",
"No Files Selected": "No Files Selected",
"Paragraph1": "The PACTA analysis tool is an online platform that allows anyone to better understand the alignment of their financial holdings with various climate scenarios. On this page, you can start this analysis process by uploading one or more portfolios to the platform.",
"Paragraph2": "We understand this data is likely sensitive - that's why this tool is built for privacy and security first - unless you explicitly share your data, only you can access it.",
"Paragraph3": "Input files should be Comma Separated Value files (CSVs) and must contain an expected set of header rows. To learn more, check out the Input User Guide, or if you just want to see how the tool works, use the sample CSV.",
"Add File(s)": "Add File(s)",
"Add More File(s)": "Add More File(s)",
"Cleaning Up": "Cleaning Up",
Expand Down Expand Up @@ -488,11 +501,12 @@
"Secondary Target Owner": "Secondary Target Owner",
"Secondary Target Type": "Secondary Target Type",
"Filter To Specific Values": "Values To Include",
"Columns": "Columns",
"Columns": "Displayed Columns",
"Column Selection": "Column Selection",
"Select or Remove Columns To Display": "Select or Remove Columns to Display",
"Reset": "Reset",
"Reset": "Reset Filters",
"Done": "Done",
"Export": "Export",
"DescriptionParagraph1": "RMI takes the security of your data with the utmost care. To that end, we have implemented a robust audit logging system that tracks all changes to your data, and who made those changes. This audit log is available to you at any time, and can be filtered by time, user, or action. Hopefully this will give you some peace of mind that your sensitive data is being appropriately handled.",
"DescriptionParagraph2": "If you have any questions about the audit log, or if you think that something is missing, or you would like to learn more, please contact us."
},
Expand Down
8 changes: 4 additions & 4 deletions frontend/lib/editor/incomplete_upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ const createEditorIncompleteUploadFields = (translation: Translation): EditorInc
name: 'name',
label: tt('Name'),
validation: [Validation.NotEmpty],
helpText: tt('The name of this uploaded source file.'),
helpText: tt('NameHelpText'),
},
description: {
name: 'description',
label: tt('The description of this upload - helpful for record keeping, not used for anything.'),
label: tt('Description'),
helpText: tt('DescriptionHelpText'),
},
adminDebugEnabled: {
name: 'adminDebugEnabled',
label: tt('Admin Debugging Enabled'),
helpText: tt('When enabled, this upload can be accessed by administrators to help with debugging. Only turn this on if you\'re comfortable with system administrators accessing this data.'),
label: tt('AdminDebuggingEnabled'),
helpText: tt('ADEHelpText'),
},
propertyHoldingsDate: {
name: 'propertyHoldingsDate',
Expand Down
23 changes: 23 additions & 0 deletions frontend/pages/admin/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
const localePath = useLocalePath()
const { showDevTools } = useLocalStorage()
interface AdminItem {
title: string
Expand Down Expand Up @@ -72,6 +73,28 @@ const adminItems: AdminItem[] = [
</template>
</PVCard>
</div>
<div
class="col-12 md:col-6"
>
<PVCard class="h-full">
<template #title>
<div class="flex align-items-center justify-content-between">
<div class="flex align-items-center">
<i
class="text-2xl mr-3 pi pi-cog"
/>
<span>Show Dev Tools</span>
</div>
<PVInputSwitch
v-model="showDevTools"
/>
</div>
</template>
<template #content>
If enabled, the footer of every page will show a set of buttons to help with debugging.
</template>
</PVCard>
</div>
</div>
</StandardContent>
</template>
28 changes: 26 additions & 2 deletions frontend/pages/audit-logs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,24 @@ const toggleColumnControl = (e: Event) => {
}
}
const doExport = () => withLoading(
async () => {
const results: AuditLog[] = []
cursor.value = undefined
do {
await refreshAuditLogs()
results.push(...dataResponse.value.auditLogs)
} while (hasNextPage.value)
const a = document.createElement('a')
const file = new Blob([JSON.stringify(results, null, 2)], { type: 'application/json' })
a.href = URL.createObjectURL(file)
a.download = 'audit-logs.json'
a.click()
a.remove()
}
, 'audit-logs.export')
const defaultAuditLogQuery = (): AuditLogQueryReq => {
const mm = maybeMe.value
return {
Expand Down Expand Up @@ -502,15 +520,21 @@ onMounted(() => {
<PVButton
icon="pi pi-cog"
:label="tt('Columns')"
class="p-button-outlined"
class="p-button-outlined p-button-sm"
@click="toggleColumnControl"
/>
<PVButton
icon="pi pi-refresh"
:label="tt('Reset')"
class="p-button-outlined p-button-secondary"
class="p-button-outlined p-button-secondary p-button-sm"
@click="resetFilters"
/>
<PVButton
icon="pi pi-download"
:label="tt('Export')"
class="p-button-secondary p-button-sm"
@click="doExport"
/>
</div>
<PVOverlayPanel
ref="columnControlOverlay"
Expand Down
5 changes: 5 additions & 0 deletions frontend/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,9 @@ const tt = (s: string) => t(`pages/index.${s}`)
max-width: 100%;
}
}
.p-image-toolbar {
z-index: 1;
background: var(--primary-color);
}
</style>
Loading

0 comments on commit e4f10a4

Please sign in to comment.