-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add page to view edit history for projects
- Loading branch information
Showing
5 changed files
with
166 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,6 +99,10 @@ function get_template_keys($items,&$output) | |
<script src="//cdnjs.cloudflare.com/ajax/libs/Vue.Draggable/2.20.0/vuedraggable.umd.min.js"></script> | ||
|
||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/vue-json-pretty.min.js"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/lib/styles.min.css"> | ||
|
||
|
||
|
||
<?php echo $this->load->view("metadata_editor/index_vuetify_main_app",null,true);?> | ||
|
||
|
@@ -969,6 +973,8 @@ function(error) { | |
} | ||
} | ||
}) | ||
|
||
Vue.component('VueJsonPretty', VueJsonPretty.default); | ||
</script> | ||
|
||
<script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
application/views/metadata_editor/vue-project-history-component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
Vue.component('project-history', { | ||
props: [], | ||
data() { | ||
return { | ||
is_loading: false, | ||
history: [], | ||
deep: 0 | ||
} | ||
}, | ||
mounted:function(){ | ||
this.loadEditHistory(); | ||
}, | ||
methods: { | ||
loadEditHistory: async function() | ||
{ | ||
vm=this; | ||
vm.is_loading=true; | ||
let url=CI.base_url + '/api/editor/history/'+this.ProjectID; | ||
|
||
let resp = await axios.get(url); | ||
|
||
console.log(resp.data); | ||
|
||
vm.history = resp.data; | ||
vm.is_loading=false; | ||
}, | ||
momentDate(date) { | ||
return moment(date).format("YYYY/MM/DD hh:mm A"); | ||
}, | ||
|
||
}, | ||
computed: { | ||
ProjectID(){ | ||
return this.$store.state.project_id; | ||
}, | ||
ProjectTemplate(){ | ||
return this.$store.state.formTemplate; | ||
}, | ||
TemplateItems() | ||
{ | ||
return this.ProjectTemplate.template.items; | ||
} | ||
|
||
}, | ||
template: ` | ||
<div class="vue-project-history-component m-3 mt-5 "> | ||
<div v-if="is_loading" class="text-center"> | ||
<v-progress-circular | ||
indeterminate | ||
color="primary" | ||
></v-progress-circular> | ||
</div> | ||
<div v-else> | ||
<div class="bg-light p-3"> | ||
Revisions | ||
</div> | ||
</div> | ||
<v-simple-table v-if="history && history.history && history.history.length>0"> | ||
<template v-slot:default> | ||
<thead> | ||
<tr> | ||
<th class="text-left" style="width:200px">Date</th> | ||
<th class="text-left" style="width:100px">User</th> | ||
<th class="text-left"></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr v-for="revision in history.history"> | ||
<td>{{momentDate(revision.created)}}</td> | ||
<td>{{revision.username}}</td> | ||
<td> | ||
<div style="max-height:500px;overflow:auto"> | ||
<vue-json-pretty :data="revision.metadata" :deep="deep" /> | ||
</div> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</template> | ||
</v-simple-table> | ||
<div v-else> | ||
<v-alert outlined color="red"> | ||
No revisions found. | ||
</v-alert> | ||
</div> | ||
</div> | ||
` | ||
}); | ||
|