|
@ -109,6 +109,19 @@ |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div> |
|
|
<div> |
|
|
|
|
|
<div> |
|
|
|
|
|
To |
|
|
|
|
|
{{ |
|
|
|
|
|
offer.fulfillsPlanHandleId |
|
|
|
|
|
? projectNameFromHandleId[offer.fulfillsPlanHandleId] |
|
|
|
|
|
: didInfo( |
|
|
|
|
|
offer.recipientDid, |
|
|
|
|
|
activeDid, |
|
|
|
|
|
allMyDids, |
|
|
|
|
|
allContacts, |
|
|
|
|
|
) |
|
|
|
|
|
}} |
|
|
|
|
|
</div> |
|
|
<div> |
|
|
<div> |
|
|
{{ offer.objectDescription }} |
|
|
{{ offer.objectDescription }} |
|
|
</div> |
|
|
</div> |
|
@ -244,11 +257,14 @@ import QuickNav from "@/components/QuickNav.vue"; |
|
|
import ProjectIcon from "@/components/ProjectIcon.vue"; |
|
|
import ProjectIcon from "@/components/ProjectIcon.vue"; |
|
|
import TopMessage from "@/components/TopMessage.vue"; |
|
|
import TopMessage from "@/components/TopMessage.vue"; |
|
|
import { |
|
|
import { |
|
|
|
|
|
didInfo, |
|
|
getHeaders, |
|
|
getHeaders, |
|
|
|
|
|
getPlanFromCache, |
|
|
OfferSummaryRecord, |
|
|
OfferSummaryRecord, |
|
|
PlanData, |
|
|
PlanData, |
|
|
} from "@/libs/endorserServer"; |
|
|
} from "@/libs/endorserServer"; |
|
|
import EntityIcon from "@/components/EntityIcon.vue"; |
|
|
import EntityIcon from "@/components/EntityIcon.vue"; |
|
|
|
|
|
import { Contact } from "@/db/tables/contacts"; |
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
components: { EntityIcon, InfiniteScroll, QuickNav, ProjectIcon, TopMessage }, |
|
|
components: { EntityIcon, InfiniteScroll, QuickNav, ProjectIcon, TopMessage }, |
|
@ -263,16 +279,19 @@ export default class ProjectsView extends Vue { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
activeDid = ""; |
|
|
activeDid = ""; |
|
|
|
|
|
allContacts: Array<Contact> = []; |
|
|
|
|
|
allMyDids: Array<string> = []; |
|
|
apiServer = ""; |
|
|
apiServer = ""; |
|
|
projects: PlanData[] = []; |
|
|
projects: PlanData[] = []; |
|
|
isLoading = false; |
|
|
isLoading = false; |
|
|
isRegistered = false; |
|
|
isRegistered = false; |
|
|
numAccounts = 0; |
|
|
|
|
|
offers: OfferSummaryRecord[] = []; |
|
|
offers: OfferSummaryRecord[] = []; |
|
|
|
|
|
projectNameFromHandleId: Record<string, string> = {}; // mapping from handleId to description |
|
|
showOffers = true; |
|
|
showOffers = true; |
|
|
showProjects = false; |
|
|
showProjects = false; |
|
|
|
|
|
|
|
|
libsUtil = libsUtil; |
|
|
libsUtil = libsUtil; |
|
|
|
|
|
didInfo = didInfo; |
|
|
|
|
|
|
|
|
async mounted() { |
|
|
async mounted() { |
|
|
try { |
|
|
try { |
|
@ -282,9 +301,13 @@ export default class ProjectsView extends Vue { |
|
|
this.apiServer = (settings?.apiServer as string) || ""; |
|
|
this.apiServer = (settings?.apiServer as string) || ""; |
|
|
this.isRegistered = !!settings?.isRegistered; |
|
|
this.isRegistered = !!settings?.isRegistered; |
|
|
|
|
|
|
|
|
|
|
|
this.allContacts = await db.contacts.toArray(); |
|
|
|
|
|
|
|
|
await accountsDB.open(); |
|
|
await accountsDB.open(); |
|
|
this.numAccounts = await accountsDB.accounts.count(); |
|
|
const allAccounts = await accountsDB.accounts.toArray(); |
|
|
if (this.numAccounts === 0) { |
|
|
this.allMyDids = allAccounts.map((acc) => acc.did); |
|
|
|
|
|
|
|
|
|
|
|
if (allAccounts.length === 0) { |
|
|
console.error("No accounts found."); |
|
|
console.error("No accounts found."); |
|
|
this.errNote("You need an identifier to load your projects."); |
|
|
this.errNote("You need an identifier to load your projects."); |
|
|
} else { |
|
|
} else { |
|
@ -343,10 +366,7 @@ export default class ProjectsView extends Vue { |
|
|
async loadMoreProjectData(payload: boolean) { |
|
|
async loadMoreProjectData(payload: boolean) { |
|
|
if (this.projects.length > 0 && payload) { |
|
|
if (this.projects.length > 0 && payload) { |
|
|
const latestProject = this.projects[this.projects.length - 1]; |
|
|
const latestProject = this.projects[this.projects.length - 1]; |
|
|
await this.loadProjects( |
|
|
await this.loadProjects(`beforeId=${latestProject.rowid}`); |
|
|
this.activeDid, |
|
|
|
|
|
`beforeId=${latestProject.rowid}`, |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -355,7 +375,7 @@ export default class ProjectsView extends Vue { |
|
|
* @param issuerDid of the user |
|
|
* @param issuerDid of the user |
|
|
* @param urlExtra additional url parameters in a string |
|
|
* @param urlExtra additional url parameters in a string |
|
|
**/ |
|
|
**/ |
|
|
async loadProjects(activeDid?: string, urlExtra: string = "") { |
|
|
async loadProjects(urlExtra: string = "") { |
|
|
const url = `${this.apiServer}/api/v2/report/plansByIssuer?${urlExtra}`; |
|
|
const url = `${this.apiServer}/api/v2/report/plansByIssuer?${urlExtra}`; |
|
|
await this.projectDataLoader(url); |
|
|
await this.projectDataLoader(url); |
|
|
} |
|
|
} |
|
@ -402,7 +422,31 @@ export default class ProjectsView extends Vue { |
|
|
this.isLoading = true; |
|
|
this.isLoading = true; |
|
|
const resp = await this.axios.get(url, { headers } as AxiosRequestConfig); |
|
|
const resp = await this.axios.get(url, { headers } as AxiosRequestConfig); |
|
|
if (resp.status === 200 && resp.data.data) { |
|
|
if (resp.status === 200 && resp.data.data) { |
|
|
this.offers = this.offers.concat(resp.data.data); |
|
|
// add one-by-one as they retrieve project names, potentially from the server |
|
|
|
|
|
for (const offer of resp.data.data) { |
|
|
|
|
|
if (offer.fulfillsPlanHandleId) { |
|
|
|
|
|
const project = await getPlanFromCache( |
|
|
|
|
|
offer.fulfillsPlanHandleId, |
|
|
|
|
|
this.axios, |
|
|
|
|
|
this.apiServer, |
|
|
|
|
|
this.activeDid, |
|
|
|
|
|
); |
|
|
|
|
|
const projectName = project?.name as string; |
|
|
|
|
|
console.log( |
|
|
|
|
|
"now have name for", |
|
|
|
|
|
offer.fulfillsPlanHandleId, |
|
|
|
|
|
projectName, |
|
|
|
|
|
); |
|
|
|
|
|
this.projectNameFromHandleId[offer.fulfillsPlanHandleId] = |
|
|
|
|
|
projectName; |
|
|
|
|
|
console.log( |
|
|
|
|
|
"now have a real name for", |
|
|
|
|
|
offer.fulfillsPlanHandleId, |
|
|
|
|
|
this.projectNameFromHandleId[offer.fulfillsPlanHandleId], |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
this.offers = this.offers.concat([offer]); |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
console.error( |
|
|
console.error( |
|
|
"Bad server response & data for offers:", |
|
|
"Bad server response & data for offers:", |
|
|