|
@ -56,16 +56,26 @@ |
|
|
href="#" |
|
|
href="#" |
|
|
:class="computedStarredTabStyleClassNames()" |
|
|
:class="computedStarredTabStyleClassNames()" |
|
|
@click=" |
|
|
@click=" |
|
|
|
|
|
projects = []; |
|
|
|
|
|
userProfiles = []; |
|
|
|
|
|
isStarredActive = true; |
|
|
isLocalActive = false; |
|
|
isLocalActive = false; |
|
|
isMappedActive = false; |
|
|
isMappedActive = false; |
|
|
isAnywhereActive = false; |
|
|
isAnywhereActive = false; |
|
|
isStarredActive = true; |
|
|
|
|
|
isSearchVisible = false; |
|
|
isSearchVisible = false; |
|
|
tempSearchBox = null; |
|
|
tempSearchBox = null; |
|
|
loadStarred(); |
|
|
searchStarred(); |
|
|
" |
|
|
" |
|
|
> |
|
|
> |
|
|
Starred |
|
|
Starred |
|
|
|
|
|
<!-- restore when the links don't jump around for different numbers |
|
|
|
|
|
<span |
|
|
|
|
|
class="font-semibold text-sm bg-slate-200 px-1.5 py-0.5 rounded-md" |
|
|
|
|
|
v-if="isLocalActive" |
|
|
|
|
|
> |
|
|
|
|
|
{{ localCount > -1 ? localCount : "?" }} |
|
|
|
|
|
</span> |
|
|
|
|
|
--> |
|
|
</a> |
|
|
</a> |
|
|
</li> |
|
|
</li> |
|
|
<li> |
|
|
<li> |
|
@ -75,6 +85,7 @@ |
|
|
@click=" |
|
|
@click=" |
|
|
projects = []; |
|
|
projects = []; |
|
|
userProfiles = []; |
|
|
userProfiles = []; |
|
|
|
|
|
isStarredActive = false; |
|
|
isLocalActive = true; |
|
|
isLocalActive = true; |
|
|
isMappedActive = false; |
|
|
isMappedActive = false; |
|
|
isAnywhereActive = false; |
|
|
isAnywhereActive = false; |
|
@ -102,6 +113,7 @@ |
|
|
@click=" |
|
|
@click=" |
|
|
projects = []; |
|
|
projects = []; |
|
|
userProfiles = []; |
|
|
userProfiles = []; |
|
|
|
|
|
isStarredActive = false; |
|
|
isLocalActive = false; |
|
|
isLocalActive = false; |
|
|
isMappedActive = true; |
|
|
isMappedActive = true; |
|
|
isAnywhereActive = false; |
|
|
isAnywhereActive = false; |
|
@ -122,6 +134,7 @@ |
|
|
@click=" |
|
|
@click=" |
|
|
projects = []; |
|
|
projects = []; |
|
|
userProfiles = []; |
|
|
userProfiles = []; |
|
|
|
|
|
isStarredActive = false; |
|
|
isLocalActive = false; |
|
|
isLocalActive = false; |
|
|
isMappedActive = false; |
|
|
isMappedActive = false; |
|
|
isAnywhereActive = true; |
|
|
isAnywhereActive = true; |
|
@ -222,7 +235,9 @@ |
|
|
that search.</span |
|
|
that search.</span |
|
|
> |
|
|
> |
|
|
<span v-else-if="isStarredActive"> |
|
|
<span v-else-if="isStarredActive"> |
|
|
<p>You have no starred projects. Star some projects to see them here.</p> |
|
|
<p> |
|
|
|
|
|
You have no starred projects. Star some projects to see them here. |
|
|
|
|
|
</p> |
|
|
<p class="mt-4"> |
|
|
<p class="mt-4"> |
|
|
When you star projects, you will get a notice on the front page when |
|
|
When you star projects, you will get a notice on the front page when |
|
|
they change. |
|
|
they change. |
|
@ -360,10 +375,8 @@ import { |
|
|
didInfo, |
|
|
didInfo, |
|
|
errorStringForLog, |
|
|
errorStringForLog, |
|
|
getHeaders, |
|
|
getHeaders, |
|
|
getPlanFromCache, |
|
|
|
|
|
} from "../libs/endorserServer"; |
|
|
} from "../libs/endorserServer"; |
|
|
import { OnboardPage, retrieveAccountDids } from "../libs/util"; |
|
|
import { OnboardPage, retrieveAccountDids } from "../libs/util"; |
|
|
import { parseJsonField } from "../db/databaseUtil"; |
|
|
|
|
|
import { logger } from "../utils/logger"; |
|
|
import { logger } from "../utils/logger"; |
|
|
import { UserProfile } from "@/libs/partnerServer"; |
|
|
import { UserProfile } from "@/libs/partnerServer"; |
|
|
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin"; |
|
|
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin"; |
|
@ -416,10 +429,12 @@ export default class DiscoverView extends Vue { |
|
|
allMyDids: Array<string> = []; |
|
|
allMyDids: Array<string> = []; |
|
|
apiServer = ""; |
|
|
apiServer = ""; |
|
|
isLoading = false; |
|
|
isLoading = false; |
|
|
|
|
|
|
|
|
isLocalActive = false; |
|
|
isLocalActive = false; |
|
|
isMappedActive = false; |
|
|
isMappedActive = false; |
|
|
isAnywhereActive = true; |
|
|
isAnywhereActive = true; |
|
|
isStarredActive = false; |
|
|
isStarredActive = false; |
|
|
|
|
|
|
|
|
isProjectsActive = true; |
|
|
isProjectsActive = true; |
|
|
isPeopleActive = false; |
|
|
isPeopleActive = false; |
|
|
isSearchVisible = true; |
|
|
isSearchVisible = true; |
|
@ -505,7 +520,7 @@ export default class DiscoverView extends Vue { |
|
|
}; |
|
|
}; |
|
|
this.requestTiles(mapRef.leafletObject); // not ideal because I found this from experimentation, not documentation |
|
|
this.requestTiles(mapRef.leafletObject); // not ideal because I found this from experimentation, not documentation |
|
|
} else if (this.isStarredActive) { |
|
|
} else if (this.isStarredActive) { |
|
|
await this.loadStarred(); |
|
|
await this.searchStarred(); |
|
|
} else { |
|
|
} else { |
|
|
await this.searchAll(); |
|
|
await this.searchAll(); |
|
|
} |
|
|
} |
|
@ -576,7 +591,7 @@ export default class DiscoverView extends Vue { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async loadStarred() { |
|
|
public async searchStarred() { |
|
|
this.resetCounts(); |
|
|
this.resetCounts(); |
|
|
|
|
|
|
|
|
// Clear any previous results |
|
|
// Clear any previous results |
|
@ -588,52 +603,37 @@ export default class DiscoverView extends Vue { |
|
|
|
|
|
|
|
|
// Get starred project IDs from settings |
|
|
// Get starred project IDs from settings |
|
|
const settings = await this.$accountSettings(); |
|
|
const settings = await this.$accountSettings(); |
|
|
const starredIds: string[] = parseJsonField( |
|
|
|
|
|
settings.starredProjectIds, |
|
|
|
|
|
[], |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const starredIds = settings.starredPlanHandleIds || []; |
|
|
if (starredIds.length === 0) { |
|
|
if (starredIds.length === 0) { |
|
|
// No starred projects |
|
|
// No starred projects |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Load each starred project using getPlanFromCache |
|
|
// This could be optimized to only pull those not already in the cache (endorserServer.ts) |
|
|
const projectPromises = starredIds.map(async (handleId) => { |
|
|
|
|
|
try { |
|
|
|
|
|
const project = await getPlanFromCache( |
|
|
|
|
|
handleId, |
|
|
|
|
|
this.axios, |
|
|
|
|
|
this.apiServer, |
|
|
|
|
|
this.activeDid, |
|
|
|
|
|
); |
|
|
|
|
|
if (project) { |
|
|
|
|
|
// Convert PlanSummaryRecord to PlanData |
|
|
|
|
|
return { |
|
|
|
|
|
description: project.description, |
|
|
|
|
|
handleId: project.handleId, |
|
|
|
|
|
image: project.image, |
|
|
|
|
|
issuerDid: project.issuerDid, |
|
|
|
|
|
name: project.name || UNNAMED_PROJECT, |
|
|
|
|
|
rowId: project.jwtId, |
|
|
|
|
|
} as PlanData; |
|
|
|
|
|
} |
|
|
|
|
|
return null; |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
logger.warn(`Failed to load starred project ${handleId}:`, error); |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const projects = await Promise.all(projectPromises); |
|
|
|
|
|
|
|
|
|
|
|
// Filter out null results and add to projects array |
|
|
const planHandleIdsJson = JSON.stringify(starredIds); |
|
|
const validProjects = projects.filter( |
|
|
const endpoint = |
|
|
(project): project is PlanData => |
|
|
this.apiServer + |
|
|
project !== null && project !== undefined, |
|
|
"/api/v2/report/plans?planHandleIds=" + |
|
|
); |
|
|
encodeURIComponent(planHandleIdsJson); |
|
|
|
|
|
const response = await this.axios.get(endpoint, { |
|
|
|
|
|
headers: await getHeaders(this.activeDid), |
|
|
|
|
|
}); |
|
|
|
|
|
if (response.status !== 200) { |
|
|
|
|
|
this.notify.error("Failed to load starred projects", TIMEOUTS.SHORT); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
const starredPlans: PlanData[] = response.data.data; |
|
|
|
|
|
if (response.data.hitLimit) { |
|
|
|
|
|
// someday we'll have to let them incrementally load the rest |
|
|
|
|
|
this.notify.warning( |
|
|
|
|
|
"Beware: you have so many starred projects that we cannot load them all.", |
|
|
|
|
|
TIMEOUTS.SHORT, |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.projects = validProjects; |
|
|
this.projects = starredPlans; |
|
|
} catch (error: unknown) { |
|
|
} catch (error: unknown) { |
|
|
logger.error("Error loading starred projects:", error); |
|
|
logger.error("Error loading starred projects:", error); |
|
|
this.notify.error( |
|
|
this.notify.error( |
|
@ -738,6 +738,8 @@ export default class DiscoverView extends Vue { |
|
|
const latestProject = this.projects[this.projects.length - 1]; |
|
|
const latestProject = this.projects[this.projects.length - 1]; |
|
|
if (this.isLocalActive || this.isMappedActive) { |
|
|
if (this.isLocalActive || this.isMappedActive) { |
|
|
this.searchLocal(latestProject.rowId); |
|
|
this.searchLocal(latestProject.rowId); |
|
|
|
|
|
} else if (this.isStarredActive) { |
|
|
|
|
|
this.searchStarred(); |
|
|
} else if (this.isAnywhereActive) { |
|
|
} else if (this.isAnywhereActive) { |
|
|
this.searchAll(latestProject.rowId); |
|
|
this.searchAll(latestProject.rowId); |
|
|
} |
|
|
} |
|
@ -881,6 +883,24 @@ export default class DiscoverView extends Vue { |
|
|
this.$router.push(route); |
|
|
this.$router.push(route); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public computedStarredTabStyleClassNames() { |
|
|
|
|
|
return { |
|
|
|
|
|
"inline-block": true, |
|
|
|
|
|
"py-3": true, |
|
|
|
|
|
"rounded-t-lg": true, |
|
|
|
|
|
"border-b-2": true, |
|
|
|
|
|
|
|
|
|
|
|
active: this.isStarredActive, |
|
|
|
|
|
"text-black": this.isStarredActive, |
|
|
|
|
|
"border-black": this.isStarredActive, |
|
|
|
|
|
"font-semibold": this.isStarredActive, |
|
|
|
|
|
|
|
|
|
|
|
"text-blue-600": !this.isStarredActive, |
|
|
|
|
|
"border-transparent": !this.isStarredActive, |
|
|
|
|
|
"hover:border-slate-400": !this.isStarredActive, |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public computedLocalTabStyleClassNames() { |
|
|
public computedLocalTabStyleClassNames() { |
|
|
return { |
|
|
return { |
|
|
"inline-block": true, |
|
|
"inline-block": true, |
|
@ -935,24 +955,6 @@ export default class DiscoverView extends Vue { |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public computedStarredTabStyleClassNames() { |
|
|
|
|
|
return { |
|
|
|
|
|
"inline-block": true, |
|
|
|
|
|
"py-3": true, |
|
|
|
|
|
"rounded-t-lg": true, |
|
|
|
|
|
"border-b-2": true, |
|
|
|
|
|
|
|
|
|
|
|
active: this.isStarredActive, |
|
|
|
|
|
"text-black": this.isStarredActive, |
|
|
|
|
|
"border-black": this.isStarredActive, |
|
|
|
|
|
"font-semibold": this.isStarredActive, |
|
|
|
|
|
|
|
|
|
|
|
"text-blue-600": !this.isStarredActive, |
|
|
|
|
|
"border-transparent": !this.isStarredActive, |
|
|
|
|
|
"hover:border-slate-400": !this.isStarredActive, |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public computedProjectsTabStyleClassNames() { |
|
|
public computedProjectsTabStyleClassNames() { |
|
|
return { |
|
|
return { |
|
|
"inline-block": true, |
|
|
"inline-block": true, |
|
|