|
|
@ -112,10 +112,25 @@ import { accessToken } from "@/libs/crypto"; |
|
|
|
import { IIdentifier } from "@veramo/core"; |
|
|
|
import InfiniteScroll from "@/components/InfiniteScroll"; |
|
|
|
|
|
|
|
/** |
|
|
|
* Represents data about a project |
|
|
|
**/ |
|
|
|
interface ProjectData { |
|
|
|
/** |
|
|
|
* Name of the project |
|
|
|
**/ |
|
|
|
name: string; |
|
|
|
/** |
|
|
|
* Description of the project |
|
|
|
**/ |
|
|
|
description: string; |
|
|
|
/** |
|
|
|
* URL referencing information about the project |
|
|
|
**/ |
|
|
|
handleId: string; |
|
|
|
/** |
|
|
|
* The Identier of the project |
|
|
|
**/ |
|
|
|
jwtId: string; |
|
|
|
} |
|
|
|
|
|
|
@ -132,6 +147,11 @@ export default class ProjectsView extends Vue { |
|
|
|
}[] = []; |
|
|
|
current: IIdentifier; |
|
|
|
|
|
|
|
/** |
|
|
|
* Core project data loader |
|
|
|
* @param url the url used to fetch the data |
|
|
|
* @param token Authorization token |
|
|
|
**/ |
|
|
|
async dataLoader(url: string, token: string) { |
|
|
|
const headers: { [key: string]: string } = { |
|
|
|
"Content-Type": "application/json", |
|
|
@ -152,9 +172,11 @@ export default class ProjectsView extends Vue { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Data loader used by infinite scroller |
|
|
|
* @param payload is the flag from the InfiniteScroll indicating if it should load |
|
|
|
**/ |
|
|
|
async loadMoreData(payload: boolean) { |
|
|
|
console.log("loadMoreData"); |
|
|
|
console.log(payload); |
|
|
|
if (this.projects.length > 0) { |
|
|
|
const latestProject = this.projects[this.projects.length - 1]; |
|
|
|
const url = `${this.apiServer}/api/v2/report/plansByIssuer?beforeId=${latestProject.jwtId}`; |
|
|
@ -163,6 +185,10 @@ export default class ProjectsView extends Vue { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Handle clicking on a project entry found in the list |
|
|
|
* @param id of the project |
|
|
|
**? |
|
|
|
onClickLoadProject(id: string) { |
|
|
|
localStorage.setItem("projectId", id); |
|
|
|
const route = { |
|
|
@ -171,6 +197,10 @@ export default class ProjectsView extends Vue { |
|
|
|
this.$router.push(route); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Load projects initially |
|
|
|
* @param identity of the user |
|
|
|
**/ |
|
|
|
async LoadProjects(identity: IIdentifier) { |
|
|
|
console.log("LoadProjects"); |
|
|
|
const url = `${this.apiServer}/api/v2/report/plansByIssuer`; |
|
|
@ -178,7 +208,9 @@ export default class ProjectsView extends Vue { |
|
|
|
await this.dataLoader(url, token); |
|
|
|
} |
|
|
|
|
|
|
|
// 'created' hook runs when the Vue instance is first created |
|
|
|
/** |
|
|
|
* 'created' hook runs when the Vue instance is first created |
|
|
|
**/ |
|
|
|
async created() { |
|
|
|
await db.open(); |
|
|
|
const settings = await db.settings.get(MASTER_SETTINGS_KEY); |
|
|
@ -198,6 +230,9 @@ export default class ProjectsView extends Vue { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Handling clicking on the new project button |
|
|
|
**/ |
|
|
|
onClickNewProject(): void { |
|
|
|
localStorage.removeItem("projectId"); |
|
|
|
const route = { |
|
|
|