Loading package.json +1 −1 Original line number Diff line number Diff line { "name": "@pdn-certic/vue-jama", "version": "0.8.2", "version": "0.8.3", "scripts": { "serve": "rimraf -rf ./node_modules/.cache/vue-loader && vue-cli-service serve", "build": "vue-cli-service build", Loading src/components/VueJama.vue +6 −1 Original line number Diff line number Diff line Loading @@ -403,6 +403,7 @@ import {mapActions, mapGetters} from "vuex"; import {NB_DEFAULT_MODES, RESOURCES_MODE, SEARCH_MODE, TRASH_MODE, UPLOAD_MODE,} from "../const"; import JamaPermissions from "../utils/JamaPermissions"; import CollectionsTree from "./CollectionsTree"; import TasksStatusPlugin from "./plugins/TasksStatusPlugin"; export default { Loading Loading @@ -448,7 +449,11 @@ export default { logoutPath: this.options.logoutPath, conceptsConfig: this.options.conceptsConfig || null, metadataComponent: this.options.metadataComponent || DefaultMetadataEditor, plugins: this.options.plugins || [], plugins: this.options.plugins || [{ component: TasksStatusPlugin, title: 'Tâches en cours', icon: 'mdi-view-list', }], metaDataAttributes: this.options.metaDataAttributes || false,//will add data-meta-attr in resource & collection cards html encoding multiSelectActionAddons: this.options.multiSelectActionAddons || [], //other data Loading src/components/VueJamaApp.vue +11 −10 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ defaultCollectionId: options.defaultCollectionId, showHiddenCollections : options.showHiddenCollections, multiSelectActionAddons: options.multiSelectActionAddons, //plugins: plugins plugins: plugins }" @resource-selected="resourceSelected" /> Loading @@ -27,15 +27,8 @@ <script> import VueJama from './VueJama'; // import HelloWorldPlugin from "./plugins/HelloWorldPlugin"; // import TasksStatusPlugin from "./plugins/TasksStatusPlugin.vue"; // let plugins = [ // { // component: HelloWorldPlugin, // title: 'Gestion des listes de collections & bibliothèques', // icon: 'mdi-view-list', // options : {key :'val'} // } // ] export default { name: 'VueJamaApp', Loading @@ -48,7 +41,15 @@ export default { data() { return { //plugins : plugins plugins : null/*[ { component: HelloWorldPlugin, title: 'Hello Plugin', icon: 'mdi-human-greeting', options : {key :'val'} }, ]*/ } }, Loading src/components/plugins/TasksStatusPlugin.vue 0 → 100644 +104 −0 Original line number Diff line number Diff line <template> <section class="ma-10"> <div> <v-data-table :headers="headers" :items="tasks" hide-default-footer > <template v-slot:item.status="{ item }"> <span> <v-icon>{{ item.status === statuses.wip ? 'mdi-progress-helper' : (item.status === statuses.failed ? 'mdi-alert-circle' : 'mdi-check-bold') }}</v-icon></span> </template> </v-data-table> </div> </section> </template> <script> export default { name: "TasksStatusPlugin", data() { return { statuses: { wip: 'wip', done: 'done', failed: 'failed' }, tasks: [], polling: null } }, beforeMount() { this.fetchData() }, created() { this.pollData() }, beforeDestroy() { clearInterval(this.polling) }, computed: { headers() { return [ { text: 'n°', value: 'id' }, { text: 'description', value: 'description', sortable: false }, { text: 'début', value: 'started_at' }, { text: 'fin', value: 'finished_at' }, { text: 'statut', value: 'status' } ] } }, methods: { pollData() { this.polling = setInterval(() => { this.fetchData() }, 5000) }, fetchData() { this.$jamaClient.userTasksStatus().then((res) => { this.tasks = [] res.forEach((t) => this.tasks.push({ id: t.id, description: t.description, started_at: (new Date(t.started_at)).toLocaleString(), finished_at: t.finished_at ? (new Date(t.finished_at)).toLocaleString() : '', status: t.failed_at ? this.statuses.failed : (t.finished_at ? this.statuses.done : this.statuses.wip) })) }) } } } </script> <style scoped> </style> src/utils/JamaRpcClient.js +22 −0 Original line number Diff line number Diff line Loading @@ -1575,6 +1575,28 @@ class JamaRpcClient extends RpcClient{ return this._rpc("upload_infos", [sha256_hash, project_id]); } /** * Returns list of user tasks. Each task being serialized like so: * * ``` * { * "object_type": "task", * "id": user_task_instance.id, * "description": user_task_instance.description, * "created_at": user_task_instance.created_at.isoformat(), * "started_at": user_task_instance.started_at.isoformat(), * "finished_at": user_task_instance.finished_at.isoformat(), * "failed_at": user_task_instance.failed_at.isoformat(), * } * ``` * * @returns {Array} */ async userTasksStatus() { return this._rpc("user_tasks_status", []); } } export default JamaRpcClient Loading
package.json +1 −1 Original line number Diff line number Diff line { "name": "@pdn-certic/vue-jama", "version": "0.8.2", "version": "0.8.3", "scripts": { "serve": "rimraf -rf ./node_modules/.cache/vue-loader && vue-cli-service serve", "build": "vue-cli-service build", Loading
src/components/VueJama.vue +6 −1 Original line number Diff line number Diff line Loading @@ -403,6 +403,7 @@ import {mapActions, mapGetters} from "vuex"; import {NB_DEFAULT_MODES, RESOURCES_MODE, SEARCH_MODE, TRASH_MODE, UPLOAD_MODE,} from "../const"; import JamaPermissions from "../utils/JamaPermissions"; import CollectionsTree from "./CollectionsTree"; import TasksStatusPlugin from "./plugins/TasksStatusPlugin"; export default { Loading Loading @@ -448,7 +449,11 @@ export default { logoutPath: this.options.logoutPath, conceptsConfig: this.options.conceptsConfig || null, metadataComponent: this.options.metadataComponent || DefaultMetadataEditor, plugins: this.options.plugins || [], plugins: this.options.plugins || [{ component: TasksStatusPlugin, title: 'Tâches en cours', icon: 'mdi-view-list', }], metaDataAttributes: this.options.metaDataAttributes || false,//will add data-meta-attr in resource & collection cards html encoding multiSelectActionAddons: this.options.multiSelectActionAddons || [], //other data Loading
src/components/VueJamaApp.vue +11 −10 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ defaultCollectionId: options.defaultCollectionId, showHiddenCollections : options.showHiddenCollections, multiSelectActionAddons: options.multiSelectActionAddons, //plugins: plugins plugins: plugins }" @resource-selected="resourceSelected" /> Loading @@ -27,15 +27,8 @@ <script> import VueJama from './VueJama'; // import HelloWorldPlugin from "./plugins/HelloWorldPlugin"; // import TasksStatusPlugin from "./plugins/TasksStatusPlugin.vue"; // let plugins = [ // { // component: HelloWorldPlugin, // title: 'Gestion des listes de collections & bibliothèques', // icon: 'mdi-view-list', // options : {key :'val'} // } // ] export default { name: 'VueJamaApp', Loading @@ -48,7 +41,15 @@ export default { data() { return { //plugins : plugins plugins : null/*[ { component: HelloWorldPlugin, title: 'Hello Plugin', icon: 'mdi-human-greeting', options : {key :'val'} }, ]*/ } }, Loading
src/components/plugins/TasksStatusPlugin.vue 0 → 100644 +104 −0 Original line number Diff line number Diff line <template> <section class="ma-10"> <div> <v-data-table :headers="headers" :items="tasks" hide-default-footer > <template v-slot:item.status="{ item }"> <span> <v-icon>{{ item.status === statuses.wip ? 'mdi-progress-helper' : (item.status === statuses.failed ? 'mdi-alert-circle' : 'mdi-check-bold') }}</v-icon></span> </template> </v-data-table> </div> </section> </template> <script> export default { name: "TasksStatusPlugin", data() { return { statuses: { wip: 'wip', done: 'done', failed: 'failed' }, tasks: [], polling: null } }, beforeMount() { this.fetchData() }, created() { this.pollData() }, beforeDestroy() { clearInterval(this.polling) }, computed: { headers() { return [ { text: 'n°', value: 'id' }, { text: 'description', value: 'description', sortable: false }, { text: 'début', value: 'started_at' }, { text: 'fin', value: 'finished_at' }, { text: 'statut', value: 'status' } ] } }, methods: { pollData() { this.polling = setInterval(() => { this.fetchData() }, 5000) }, fetchData() { this.$jamaClient.userTasksStatus().then((res) => { this.tasks = [] res.forEach((t) => this.tasks.push({ id: t.id, description: t.description, started_at: (new Date(t.started_at)).toLocaleString(), finished_at: t.finished_at ? (new Date(t.finished_at)).toLocaleString() : '', status: t.failed_at ? this.statuses.failed : (t.finished_at ? this.statuses.done : this.statuses.wip) })) }) } } } </script> <style scoped> </style>
src/utils/JamaRpcClient.js +22 −0 Original line number Diff line number Diff line Loading @@ -1575,6 +1575,28 @@ class JamaRpcClient extends RpcClient{ return this._rpc("upload_infos", [sha256_hash, project_id]); } /** * Returns list of user tasks. Each task being serialized like so: * * ``` * { * "object_type": "task", * "id": user_task_instance.id, * "description": user_task_instance.description, * "created_at": user_task_instance.created_at.isoformat(), * "started_at": user_task_instance.started_at.isoformat(), * "finished_at": user_task_instance.finished_at.isoformat(), * "failed_at": user_task_instance.failed_at.isoformat(), * } * ``` * * @returns {Array} */ async userTasksStatus() { return this._rpc("user_tasks_status", []); } } export default JamaRpcClient