Browse Source

fix project loading & saving to include all the claim data

pull/89/head
Trent Larson 12 months ago
parent
commit
3f436476a2
  1. 1
      project.task.yaml
  2. 35
      src/views/NewEditProjectView.vue
  3. 2
      src/views/ProjectViewView.vue

1
project.task.yaml

@ -17,6 +17,7 @@ tasks:
- .5 make a VC details page, or link to endorser.ch (including confirmations) - .5 make a VC details page, or link to endorser.ch (including confirmations)
- .3 Add URL for project - .3 Add URL for project
- .5 Add start date to project
- 01 allow download of each VC (& confirmations, to show that they actually own their data) - 01 allow download of each VC (& confirmations, to show that they actually own their data)
- .3 check that Android shows "back" buttons on screens without bottom tray - .3 check that Android shows "back" buttons on screens without bottom tray
- .1 Make give description text box into something that expands as they type? - .1 Make give description text box into something that expands as they type?

35
src/views/NewEditProjectView.vue

@ -26,18 +26,18 @@
type="text" type="text"
placeholder="Idea Name" placeholder="Idea Name"
class="block w-full rounded border border-slate-400 mb-4 px-3 py-2" class="block w-full rounded border border-slate-400 mb-4 px-3 py-2"
v-model="projectName" v-model="fullClaim.name"
/> />
<textarea <textarea
placeholder="Description" placeholder="Description"
class="block w-full rounded border border-slate-400 mb-4 px-3 py-2" class="block w-full rounded border border-slate-400 mb-4 px-3 py-2"
rows="5" rows="5"
v-model="description" v-model="fullClaim.description"
maxlength="5000" maxlength="5000"
></textarea> ></textarea>
<div class="text-xs text-slate-500 italic -mt-3 mb-4"> <div class="text-xs text-slate-500 italic -mt-3 mb-4">
{{ description.length }}/5000 max. characters {{ fullClaim.description.length }}/5000 max. characters
</div> </div>
<div class="flex items-center mb-4"> <div class="flex items-center mb-4">
@ -72,7 +72,7 @@
name="OpenStreetMap" name="OpenStreetMap"
/> />
<l-marker <l-marker
v-if="latitude || longitude" v-if="latitude && longitude"
:lat-lng="[latitude, longitude]" :lat-lng="[latitude, longitude]"
@click="maybeEraseLatLong()" @click="maybeEraseLatLong()"
/> />
@ -136,13 +136,17 @@ export default class NewEditProjectView extends Vue {
activeDid = ""; activeDid = "";
apiServer = ""; apiServer = "";
description = "";
errorMessage = ""; errorMessage = "";
fullClaim: PlanVerifiableCredential = {
"@context": "https://schema.org",
"@type": "PlanAction",
name: "",
description: "",
};
includeLocation = false; includeLocation = false;
latitude = 0; latitude = 0;
longitude = 0; longitude = 0;
numAccounts = 0; numAccounts = 0;
projectName = "";
zoom = 2; zoom = 2;
async beforeCreate() { async beforeCreate() {
@ -214,9 +218,12 @@ export default class NewEditProjectView extends Vue {
try { try {
const resp = await this.axios.get(url, { headers }); const resp = await this.axios.get(url, { headers });
if (resp.status === 200) { if (resp.status === 200) {
const claim = resp.data.claim; this.fullClaim = resp.data.claim;
this.projectName = claim.name; if (this.fullClaim?.location) {
this.description = claim.description; this.includeLocation = true;
this.latitude = this.fullClaim.location.geo.latitude;
this.longitude = this.fullClaim.location.geo.longitude;
}
} }
} catch (error) { } catch (error) {
console.error("Got error retrieving that project", error); console.error("Got error retrieving that project", error);
@ -225,13 +232,7 @@ export default class NewEditProjectView extends Vue {
private async SaveProject(identity: IIdentifier) { private async SaveProject(identity: IIdentifier) {
// Make a claim // Make a claim
const vcClaim: PlanVerifiableCredential = { const vcClaim: PlanVerifiableCredential = this.fullClaim;
"@context": "https://schema.org",
"@type": "PlanAction",
name: this.projectName,
description: this.description,
identifier: this.projectId || undefined,
};
if (this.projectId) { if (this.projectId) {
vcClaim.identifier = this.projectId; vcClaim.identifier = this.projectId;
} }
@ -314,8 +315,8 @@ export default class NewEditProjectView extends Vue {
error?: { message?: string }; error?: { message?: string };
}>; }>;
if (serverError) { if (serverError) {
console.log("Got error from server", serverError);
if (Object.prototype.hasOwnProperty.call(serverError, "message")) { if (Object.prototype.hasOwnProperty.call(serverError, "message")) {
console.log(serverError);
userMessage = serverError.response?.data?.error?.message || ""; // This is info for the user. userMessage = serverError.response?.data?.error?.message || ""; // This is info for the user.
this.$notify( this.$notify(
{ {

2
src/views/ProjectViewView.vue

@ -35,7 +35,7 @@
<fa icon="user" class="fa-fw text-slate-400"></fa> <fa icon="user" class="fa-fw text-slate-400"></fa>
{{ issuer }} {{ issuer }}
</div> </div>
<div> <div v-if="timeSince">
<fa icon="calendar" class="fa-fw text-slate-400"></fa> <fa icon="calendar" class="fa-fw text-slate-400"></fa>
{{ timeSince }} {{ timeSince }}
</div> </div>

Loading…
Cancel
Save