Skip to content
Snippets Groups Projects
Commit 218e1006 authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

Merge branch 'Sprint/2020-10' into 'master'

Sprint/2020-10

See merge request coscine/vue/project-creation!40
parents e88b1294 a77bf4c2
No related branches found
No related tags found
1 merge request!40Sprint/2020-10
Source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -22,15 +22,15 @@ ...@@ -22,15 +22,15 @@
"dist/*" "dist/*"
], ],
"dependencies": { "dependencies": {
"@coscine/api-connection": "^1.13.0", "@coscine/api-connection": "^1.15.0",
"@coscine/app-util": "^1.3.2", "@coscine/app-util": "^1.4.0",
"@types/jquery": "^3.3.35", "@types/jquery": "^3.3.38",
"@types/vuelidate": "^0.7.13", "@types/vuelidate": "^0.7.13",
"@voerro/vue-tagsinput": "^2.2.0", "@voerro/vue-tagsinput": "^2.2.0",
"bootstrap-vue": "^2.12.0", "bootstrap-vue": "^2.15.0",
"jquery": "^3.5.0", "jquery": "^3.5.1",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-i18n": "^8.17.3", "vue-i18n": "^8.18.2",
"vue-multiselect": "^2.1.6", "vue-multiselect": "^2.1.6",
"vuejs-datepicker": "^1.6.2", "vuejs-datepicker": "^1.6.2",
"vue-loading-overlay": "^3.3.2", "vue-loading-overlay": "^3.3.2",
...@@ -46,18 +46,18 @@ ...@@ -46,18 +46,18 @@
"@semantic-release/release-notes-generator": "^9.0.1", "@semantic-release/release-notes-generator": "^9.0.1",
"@types/chai": "^4.2.11", "@types/chai": "^4.2.11",
"@types/mocha": "^7.0.2", "@types/mocha": "^7.0.2",
"@vue/cli-plugin-babel": "^4.3.1", "@vue/cli-plugin-babel": "^4.4.4",
"@vue/cli-plugin-typescript": "^4.3.1", "@vue/cli-plugin-typescript": "^4.4.4",
"@vue/cli-plugin-unit-mocha": "^4.3.1", "@vue/cli-plugin-unit-mocha": "^4.4.4",
"@vue/cli-service": "^4.3.1", "@vue/cli-service": "^4.4.4",
"@vue/test-utils": "1.0.0-beta.33", "@vue/test-utils": "1.0.3",
"bili": "^4.9.1", "bili": "^5.0.4",
"chai": "^4.2.0", "chai": "^4.2.0",
"rollup": "^2.7.2", "rollup": "^2.17.1",
"rollup-plugin-typescript2": "^0.27.0", "rollup-plugin-typescript2": "^0.27.1",
"rollup-plugin-vue": "^5.1.6", "rollup-plugin-vue": "^5.1.9",
"semantic-release": "^17.0.7", "semantic-release": "^17.0.8",
"typescript": "^3.8.3", "typescript": "^3.9.5",
"vue-template-compiler": "^2.6.11" "vue-template-compiler": "^2.6.11"
}, },
"repository": { "repository": {
......
...@@ -204,7 +204,6 @@ ...@@ -204,7 +204,6 @@
:displayName="form.DisplayName" :displayName="form.DisplayName"
:projectParentId="form.ParentId" :projectParentId="form.ParentId"
:languageLocale="languageLocale" :languageLocale="languageLocale"
:handleDelete="$props.deleteHandler"
style="display: inline;" style="display: inline;"
v-show="isOwner"></DeleteModal> v-show="isOwner"></DeleteModal>
<b-button <b-button
...@@ -239,10 +238,9 @@ import { de, en } from 'vuejs-datepicker/dist/locale'; ...@@ -239,10 +238,9 @@ import { de, en } from 'vuejs-datepicker/dist/locale';
import { validationMixin } from 'vuelidate'; import { validationMixin } from 'vuelidate';
import { required, minLength, maxLength } from 'vuelidate/lib/validators'; import { required, minLength, maxLength } from 'vuelidate/lib/validators';
import tag_inputs_helper from './utils/tag_inputs_helper'; import tag_inputs_helper from './utils/tag_inputs_helper';
import { ProjectApi, ProjectRoleApi, DisciplineApi, OrganizationApi, VisibilityApi, redirectToProject, ActivatedFeaturesApi } from '@coscine/api-connection'; import { ProjectApi, ProjectRoleApi, DisciplineApi, OrganizationApi, VisibilityApi, ActivatedFeaturesApi } from '@coscine/api-connection';
import { GuidUtil } from '@coscine/app-util'; import { GuidUtil, LinkUtil } from '@coscine/app-util';
import locales from './locale/locales';
import VueI18n from 'vue-i18n'; import VueI18n from 'vue-i18n';
import BootstrapVue from 'bootstrap-vue'; import BootstrapVue from 'bootstrap-vue';
...@@ -260,8 +258,8 @@ Vue.use(BootstrapVue); ...@@ -260,8 +258,8 @@ Vue.use(BootstrapVue);
Vue.use(VueI18n); Vue.use(VueI18n);
const i18n = new VueI18n({ const i18n = new VueI18n({
locale: 'en', // set locale locale: 'en',
messages: locales, // set locale messages messages: coscine.i18n['project-creation'],
silentFallbackWarn: true, silentFallbackWarn: true,
}); });
...@@ -389,14 +387,6 @@ export default Vue.extend({ ...@@ -389,14 +387,6 @@ export default Vue.extend({
default: 'en', default: 'en',
type: String type: String
}, },
saveHandler: {
type: Function,
default: redirectToProject,
},
deleteHandler: {
type: Function,
default: redirectToProject,
},
}, },
watch: { watch: {
'form.Discipline': function(newVal, oldVal) { 'form.Discipline': function(newVal, oldVal) {
...@@ -457,7 +447,7 @@ export default Vue.extend({ ...@@ -457,7 +447,7 @@ export default Vue.extend({
} }
} }
this.$props.saveHandler(response.data); LinkUtil.redirectToExternalProject(response.data.slug);
this.handleAfterSave(); this.handleAfterSave();
}); });
} else { } else {
...@@ -474,8 +464,8 @@ export default Vue.extend({ ...@@ -474,8 +464,8 @@ export default Vue.extend({
} }
response.data === 1 response.data === 1
? this.$props.saveHandler({id: this.projectId}) ? LinkUtil.redirectToProject('EditProject')
: this.$props.saveHandler({id: this.form.ParentId}); : LinkUtil.redirectToRoot();
this.handleAfterSave(); this.handleAfterSave();
}); });
} }
......
...@@ -57,14 +57,13 @@ import { ProjectApi, SubProjectApi } from '@coscine/api-connection'; ...@@ -57,14 +57,13 @@ import { ProjectApi, SubProjectApi } from '@coscine/api-connection';
import Loading from 'vue-loading-overlay'; import Loading from 'vue-loading-overlay';
import 'vue-loading-overlay/dist/vue-loading.css'; import 'vue-loading-overlay/dist/vue-loading.css';
import locales from '../locale/locales';
import VueI18n from 'vue-i18n'; import VueI18n from 'vue-i18n';
import { GuidUtil } from '@coscine/app-util'; import { GuidUtil, LinkUtil } from '@coscine/app-util';
Vue.use(VueI18n); Vue.use(VueI18n);
const i18n = new VueI18n({ const i18n = new VueI18n({
locale: 'en', locale: 'en',
messages: locales, messages: coscine.i18n['project-creation'],
silentFallbackWarn: true, silentFallbackWarn: true,
}); });
...@@ -93,7 +92,6 @@ export default Vue.extend({ ...@@ -93,7 +92,6 @@ export default Vue.extend({
}, },
projectId: String, projectId: String,
displayName: String, displayName: String,
handleDelete: Function,
}, },
methods: { methods: {
checkFormValidity() { checkFormValidity() {
...@@ -115,6 +113,14 @@ export default Vue.extend({ ...@@ -115,6 +113,14 @@ export default Vue.extend({
bvModalEvt.preventDefault(); bvModalEvt.preventDefault();
this.handleSubmit(); this.handleSubmit();
}, },
afterDeleteHandler(projectSlug: string = ''){
if (projectSlug !== ''){
LinkUtil.redirectToExternalProject(projectSlug);
} else {
LinkUtil.redirectToRoot();
}
this.isWaitingForResponse = false;
},
handleSubmit() { handleSubmit() {
if (!this.checkFormValidity()) { if (!this.checkFormValidity()) {
this.showHelp = true; this.showHelp = true;
...@@ -123,20 +129,27 @@ export default Vue.extend({ ...@@ -123,20 +129,27 @@ export default Vue.extend({
this.isWaitingForResponse = true; this.isWaitingForResponse = true;
SubProjectApi.getAccessibleParent(this.projectId, (response: any) =>{ SubProjectApi.getAccessibleParent(this.projectId, (response: any) =>{
let parentId = response.data.id; let parentId = response.data.id;
ProjectApi.getProjectInformation(parentId,
(response: any) => {
ProjectApi.deleteProject( ProjectApi.deleteProject(
this.projectId, this.projectId,
(response: any) => { (response: any) => {
this.handleDelete({ id: parentId }); this.afterDeleteHandler(response.data.slug);
this.isWaitingForResponse = false;
}, },
(errorResponse: any) => { (errorResponse: any) => {
this.handleDelete({ id: parentId }); this.afterDeleteHandler(response.data.slug);
this.isWaitingForResponse = false; });
},(error: any) => {
ProjectApi.deleteProject(
this.projectId,
(response: any) => {
this.afterDeleteHandler();
},
(errorResponse: any) => {
this.afterDeleteHandler();
});
}); });
}); });
}, },
}, },
}); });
......
...@@ -2,6 +2,9 @@ declare var coscine: { ...@@ -2,6 +2,9 @@ declare var coscine: {
language: { language: {
locale: string, locale: string,
}, },
i18n: {
'project-creation': {},
},
}; };
declare var _spPageContextInfo: any; declare var _spPageContextInfo: any;
......
export default {
back: 'Zurück',
createProjectMenuText: 'Projekt erstellen',
displayName: 'Anzeigename',
displayNameLabel: 'Anzeigename:',
displayNameHelp: 'Dieses Feld ist erforderlich und besitzt eine Maximallänge von 25 Zeichen.',
projectName: 'Projektname',
projectNameLabel: 'Projektname:',
projectNameHelp: 'Dieses Feld ist erforderlich und besitzt eine Maximallänge von 200 Zeichen.',
projectDescription: 'Projektbeschreibung',
projectDescriptionLabel: 'Projektbeschreibung:',
projectDescriptionHelp: 'Dieses Feld ist erforderlich und besitzt eine Maximallänge von 5000 Zeichen.',
projectStart: 'Projektstart',
projectStartLabel: 'Projektstart:',
projectEnd: 'Projektende',
projectEndLabel: 'Projektende:',
projectKeywordsLabel: 'Projektschlagwörter:',
projectKeywords: 'Tippen Sie und drücken dann "Enter" um ein Schlagwort einzufügen.',
projectKeywordsHelp: 'Dieses Feld ist erforderlich und besitzt eine Maximallänge von 1000 Zeichen.',
deleteNameHelp: 'Bitte geben Sie den Projektnamen des zu löschenden Projekts an.',
archive: 'Archivieren',
deleteButton: 'Entfernen',
save: 'Abschicken',
cancel: 'Abbrechen',
clearFormButton: 'Zurücksetzen',
projectPrincipleInvestigatorsLabel: 'Principal Investigators (PIs):',
projectPrincipleInvestigators: 'Principal Investigators (PIs)',
projectPrincipleInvestigatorsHelp: 'Dieses Feld ist erforderlich und besitzt eine Maximallänge von 500 Zeichen.',
projectDisciplineLabel: 'Disziplin:',
projectDiscipline: 'Disziplin',
projectOrganizationLabel: 'Teilnehmende Organization:',
projectOrganization: 'Teilnehmende Organization',
projectVisibilityLabel: 'Sichtbarkeit:',
projectVisibility: 'Sichtbarkeit',
projectGrantIdLabel: 'Grant ID:',
projectGrantId: 'Grant ID',
projectGrantIdHelp: 'Dieses Feld ist erforderlich und besitzt eine Maximallänge von 500 Zeichen.',
deleteModalHeadline: 'Projekt wirklich entfernen?',
deleteModalDescription: 'Wenn Sie sicher sind, dass Sie dieses Projekt entfernen möchten, wiederholen Sie bitte den Projektnamen:',
deleteModalHelp: 'Der angegebene Name stimmt nicht mit dem Projektname überein.',
tagPlaceholder: 'Sie können diesen Tag hinzufügen',
activatedFeaturesHeadline: 'Projekteinstellungen',
};
export default {
back: 'Back',
createProjectMenuText: 'Create a project',
displayName: 'Display Name',
displayNameLabel: 'Display Name:',
displayNameHelp: 'This is a required field and can only be up to 25 characters long.',
projectName: 'Project Name',
projectNameLabel: 'Project Name:',
projectNameHelp: 'This is a required field and can only be up to 200 characters long.',
projectDescription: 'Project Description',
projectDescriptionLabel: 'Project Description:',
projectDescriptionHelp: 'This is a required field and can only be up to 5000 characters long.',
projectStart: 'Project Start',
projectStartLabel: 'Project Start:',
projectEnd: 'Project End',
projectEndLabel: 'Project End:',
projectKeywordsLabel: 'Project Keywords:',
projectKeywords: 'Type then press "enter" to insert a Keyword.',
projectKeywordsHelp: 'This is a required field and can only be up to 1000 characters.',
deleteNameHelp: 'Please enter the name of the project to be deleted.',
archive: 'Archive',
deleteButton: 'Delete',
save: 'Submit',
cancel: 'Cancel',
clearFormButton: 'Reset',
projectPrincipleInvestigatorsLabel: 'Principal Investigators (PIs):',
projectPrincipleInvestigators: 'Principal Investigators (PIs)',
projectPrincipleInvestigatorsHelp: 'This is a required field and can only be up to 500 characters long.',
projectDisciplineLabel: 'Discipline:',
projectDiscipline: 'Discipline',
projectOrganizationLabel: 'Participating Organizations:',
projectOrganization: 'Participating Organizations',
projectVisibilityLabel: 'Visibility:',
projectVisibility: 'Visibility',
projectGrantIdLabel: 'Grant ID:',
projectGrantId: 'Grant ID',
projectGrantIdHelp: 'This is a required field and can only be up to 500 characters long.',
deleteModalHeadline: 'Do you really want to delete this project?',
deleteModalDescription: 'If you are sure you really want to delete this project, please repeat the project name:',
deleteModalHelp: 'The entered name does not match the project name.',
tagPlaceholder: 'You can add this tag',
activatedFeaturesHeadline: 'Project features',
};
import de from './de';
import en from './en';
export default {
de,
en,
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment