Skip to content
Permalink
Browse files

Add duplicate menu entry using PREvant's REST API to make copies of a…

…pplications easy

- Extend drop down menu with entry that starts a duplication of an application card
- Add dialog component for such dialog applications
- Improve UI showing long running processes such as deletion and duplications of applications
  • Loading branch information...
schrieveslaach committed Apr 1, 2019
1 parent 3eb0d2e commit c0ad86b732ac078c512fadef63c1e8096cd53adc

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -8,19 +8,19 @@
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^5.3.1",
"@fortawesome/fontawesome-svg-core": "^1.2.4",
"@fortawesome/free-solid-svg-icons": "^5.3.1",
"@fortawesome/vue-fontawesome": "^0.1.1",
"@fortawesome/fontawesome-free": "^5.8.1",
"@fortawesome/fontawesome-svg-core": "^1.2.17",
"@fortawesome/free-solid-svg-icons": "^5.8.1",
"@fortawesome/vue-fontawesome": "^0.1.6",
"bootstrap-material-design": "^4.1.1",
"extract-text-webpack-plugin": "^3.0.2",
"isomorphic-fetch": "^2.2.1",
"jquery": "^3.3.1",
"mdn-polyfills": "^5.12.0",
"mdn-polyfills": "^5.16.0",
"moment": "^2.22.2",
"swagger-ui-dist": "^3.20.7",
"swagger-ui-dist": "^3.22.0",
"v-tooltip": "^2.0.0-rc.33",
"vue": "^2.5.17",
"vue": "^2.6.10",
"vue-resource": "^1.5.1",
"vuex": "^3.0.1"
},
@@ -31,9 +31,9 @@
"Chrome >= 60"
],
"devDependencies": {
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"autoprefixer": "^9.1.5",
"@babel/core": "^7.4.0",
"@babel/preset-env": "^7.4.2",
"autoprefixer": "^9.5.0",
"babel-loader": "^8.0.4",
"cross-env": "^5.0.5",
"css-loader": "^0.28.11",
@@ -43,11 +43,11 @@
"postcss-loader": "^3.0.0",
"sass-loader": "^7.0.3",
"style-loader": "^0.21.0",
"vue-loader": "^15.2.6",
"vue-template-compiler": "^2.5.17",
"webpack": "^4.16.1",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.4",
"vue-loader": "^15.7.0",
"vue-template-compiler": "^2.6.10",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.2.1",
"webpack-notifier": "^1.6.0"
}
}
@@ -0,0 +1,74 @@
/*-
* ========================LICENSE_START=================================
* PREvant Frontend
* %%
* Copyright (C) 2018 - 2019 aixigo AG
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* =========================LICENSE_END==================================
*/
<template>
<div ref="dialog" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{{ title }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<slot name="body"></slot>

<div class="alert alert-danger" role="alert" v-if="errorStatusText">
{{errorStatusText}} <span v-if="errorStatus" class="badge badge-danger">{{errorStatus}}</span>
</div>
</div>
<div class="modal-footer">
<slot name="footer"></slot>
</div>
</div>
</div>
</div>
</template>

<script>
export default {
data() {
return {}
},
props: {
title: {type: String},
errorStatusText: {type: String},
errorStatus: {type: Number}
},
methods: {
open() {
$(this.$refs.dialog).modal({
backdrop: 'static',
keyboard: false
});
},
close() {
$(this.$refs.dialog).modal('hide');
}
},
}
</script>
@@ -0,0 +1,99 @@
/*-
* ========================LICENSE_START=================================
* PREvant Frontend
* %%
* Copyright (C) 2018 - 2019 aixigo AG
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* =========================LICENSE_END==================================
*/

<template>
<dlg ref="dialog" :title="'Duplicate' + appName" :error-status="errorStatus" :error-status-text="errorStatusText">
<template slot="body">
<div class="form-group">
<input
type="name"
class="form-control"
placeholder="Enter app name"
v-model="newAppName"
:disabled="noInteraction ? true : false"
@keyup="keyPressed">
</div>
</template>
<template slot="footer">
<button
type="button"
class="btn btn-outline-primary"
@click="duplicateApp()"
:disabled="noInteraction">
<font-awesome-icon icon="spinner" spin v-if="noInteraction"/> Duplicate
</button>
</template>
</dlg>
</template>

<script>
import Dialog from './Dialog.vue';
export default {
data() {
return {
newAppName: '',
noInteraction: false,
errorStatus: null,
errorStatusText: null,
};
},
components: {
'dlg': Dialog
},
props: {
duplicateFromAppName: {type: String}
},
methods: {
open() {
this.$refs.dialog.open();
},
keyPressed(e) {
if (e.keyCode === 13) {
this.duplicateApp();
}
},
duplicateApp() {
this.noInteraction = true;
this.$http.post(`/api/apps/${this.newAppName}?replicateFrom=${this.duplicateFromAppName}`, JSON.stringify([]))
.then(r => {
this.noInteraction = false;
this.$refs.dialog.close();
// TODO: use a vue.js event to refetch all apps
location.reload();
}, err => {
this.noInteraction = false;
this.errorStatus = err.status;
this.errorStatusText = err.statusText;
});
}
}
}
</script>
Oops, something went wrong.

0 comments on commit c0ad86b

Please sign in to comment.
You can’t perform that action at this time.