Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Fix Issue 456 where dialogs retain values. #468

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions frontend/src/components/CreateSchema.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<v-card class="mx-auto">
<v-card-title class="bg-light"> Create Schema </v-card-title>
<v-card-text>
<v-container>
<v-form ref="form" v-model="valid">
<v-row>
<v-col cols="4" class="pb-0">
<p class="grey--text text--darken-2 font-weight-medium">
Expand Down Expand Up @@ -108,7 +108,7 @@
</v-row>
</v-col>
</v-row>
</v-container>
</v-form>
</v-card-text>
<v-card-actions>
<v-layout align-end justify-end>
Expand Down Expand Up @@ -137,6 +137,7 @@ export default {
props: {},
data: () => {
return {
valid: true,
schemaLabel: "",
schemaName: "",
schemaVersion: "",
Expand Down Expand Up @@ -198,6 +199,13 @@ export default {
defaultAttributeName: defaultAttr ? defaultAttr.text : undefined,
};
},
resetForm() {
// reset validation
this.$refs.form.reset();
// reset form data
const initialData = this.$options.data.call(this);
Object.assign(this.$data, initialData);
},
async saveSchema() {
try {
const schemaForm = this.getSchemaFormData();
Expand All @@ -219,6 +227,7 @@ export default {
const _schema = await this.saveSchema();
if (_schema) {
EventBus.$emit("success", "Schema created successfully");
this.resetForm();
this.$emit("success");
}
} catch (error) {
Expand All @@ -227,6 +236,7 @@ export default {
}
},
cancel() {
this.resetForm();
this.$emit("cancelled");
},
},
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/SchemaList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ export default {
this.dialog = true;
this.dirty = false;
this.schema = item;
if (!this.schema.credentialDefinitions) {
this.schema.credentialDefinitions = [];
}
if (!this.schema.trustedIssuer) {
this.schema.trustedIssuer = [];
}
},
onClosed() {
this.dialog = false;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const routes = [
component: About,
},
{
path: "/credentialManagement",
path: "/app/credentialManagement",
name: "CredentialManagement",
component: CredentialManagement,
},
Expand Down