Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • coscine/frontend/libraries/project-creation
1 result
Select Git revision
Loading items
Show changes
Commits on Source (6)
This diff is collapsed.
{
"name": "@coscine/project-creation",
"version": "1.8.1",
"version": "1.9.0",
"main": "./dist/index.js",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts",
......@@ -22,18 +22,18 @@
"dist/*"
],
"dependencies": {
"@coscine/api-connection": "^1.15.0",
"@coscine/app-util": "^1.4.0",
"@types/jquery": "^3.3.38",
"@coscine/api-connection": "^1.18.0",
"@coscine/app-util": "^1.5.0",
"@types/jquery": "^3.5.1",
"@types/vuelidate": "^0.7.13",
"@voerro/vue-tagsinput": "^2.2.0",
"bootstrap-vue": "^2.15.0",
"bootstrap-vue": "^2.16.0",
"jquery": "^3.5.1",
"vue": "^2.6.11",
"vue-i18n": "^8.18.2",
"vue-i18n": "^8.21.0",
"vue-multiselect": "^2.1.6",
"vuejs-datepicker": "^1.6.2",
"vue-loading-overlay": "^3.3.2",
"vue-loading-overlay": "^3.3.3",
"vue-runtime-helpers": "^1.1.2",
"vuelidate": "^0.7.5"
},
......@@ -44,20 +44,20 @@
"@semantic-release/gitlab": "^6.0.4",
"@semantic-release/npm": "^7.0.5",
"@semantic-release/release-notes-generator": "^9.0.1",
"@types/chai": "^4.2.11",
"@types/mocha": "^7.0.2",
"@vue/cli-plugin-babel": "^4.4.4",
"@vue/cli-plugin-typescript": "^4.4.4",
"@vue/cli-plugin-unit-mocha": "^4.4.4",
"@vue/cli-service": "^4.4.4",
"@types/chai": "^4.2.12",
"@types/mocha": "^8.0.2",
"@vue/cli-plugin-babel": "^4.5.3",
"@vue/cli-plugin-typescript": "^4.5.3",
"@vue/cli-plugin-unit-mocha": "^4.5.3",
"@vue/cli-service": "^4.5.3",
"@vue/test-utils": "1.0.3",
"bili": "^5.0.4",
"bili": "^5.0.5",
"chai": "^4.2.0",
"rollup": "^2.17.1",
"rollup-plugin-typescript2": "^0.27.1",
"rollup": "^2.25.0",
"rollup-plugin-typescript2": "^0.27.2",
"rollup-plugin-vue": "^5.1.9",
"semantic-release": "^17.0.8",
"typescript": "^3.9.5",
"semantic-release": "^17.1.1",
"typescript": "^3.9.7",
"vue-template-compiler": "^2.6.11"
},
"repository": {
......
......@@ -45,6 +45,22 @@
/>
<div class="invalid-tooltip">{{ $t('projectDescriptionHelp') }}</div>
</b-form-group>
<!-- copy metadata from parent -->
<div class="h-divider">
</div>
<div>
<h5>{{$t('activatedImportFromParent')}}</h5>
</div>
<div v-show="copyMetadataLabel !== ''">
<b-form-group label-for="CopyData" label-cols-sm="3" label-align-sm="right" :label="copyMetadataLabel">
<b-button
variant="secondary"
id="project_copy_button"
@click.prevent="clickCopyMetadata"
v-bind:disabled="!(this.isOwner || isNewProject)"
>{{ $t('copyMetadataButton') }}</b-button>
</b-form-group>
</div>
<b-form-group class="mandatory" label-for="PrincipleInvestigators" label-cols-sm="3" label-align-sm="right" :label="$t('projectPrincipleInvestigatorsLabel')">
<b-form-input
id="PrincipleInvestigators"
......@@ -375,36 +391,36 @@ export default Vue.extend({
keywordoptions: [] as object[],
disabledEndDates: {to: new Date(1000, 1, 1) },
features: [] as object[],
// --- data for copyMetadata ----
copyMetadataLabel: '',
parentData: {},
};
},
props: {
projectId: String,
parentId: {
default: '00000000-0000-0000-0000-000000000000',
type: String
},
parentId: String,
languageLocale: {
default: 'en',
type: String
type: String,
},
},
watch: {
'form.Discipline': function(newVal, oldVal) {
'form.Discipline'(newVal, oldVal) {
if (oldVal.length > 0) {
this.$v.form!.Discipline!.$touch()
this.$v.form!.Discipline!.$touch();
}
},
'form.Organization': function(newVal, oldVal) {
'form.Organization'(newVal, oldVal) {
if (oldVal.length > 0) {
this.$v.form!.Organization!.$touch()
this.$v.form!.Organization!.$touch();
}
},
'form.Keywords': function(newVal, oldVal) {
'form.Keywords'(newVal, oldVal) {
if (oldVal.length > 0) {
this.$v.form!.Keywords!.$touch()
}
this.$v.form!.Keywords!.$touch();
}
},
},
methods: {
addTag(newTag: any) {
this.form.Keywords.push(newTag);
......@@ -418,7 +434,7 @@ export default Vue.extend({
},
checkOwnership(projectRoles: any) {
const thisComponent = this;
for (let projectRole in projectRoles) {
for (const projectRole in projectRoles) {
if (projectRoles[projectRole].role.displayName === 'Owner') {
thisComponent.isOwner = true;
}
......@@ -441,7 +457,7 @@ export default Vue.extend({
this.form,
(response: any) => {
// activate initial features
for (let feature of this.features) {
for (const feature of this.features) {
if ((feature as any).activated) {
ActivatedFeaturesApi.activateFeature(response.data.id, (feature as any).id);
}
......@@ -455,7 +471,7 @@ export default Vue.extend({
this.form,
(response: any) => {
// update features
for (let feature of this.features) {
for (const feature of this.features) {
if ((feature as any).activated) {
ActivatedFeaturesApi.activateFeature(this.projectId, (feature as any).id);
} else {
......@@ -504,6 +520,10 @@ export default Vue.extend({
this.form.ProjectName = data.projectName;
this.form.DisplayName = data.displayName;
this.form.Description = data.description;
this.fillProjectMetadata(data);
},
// ----- fillForm by parent information --------------
fillProjectMetadata(data: any) {
this.form.PrincipleInvestigators = data.principleInvestigators;
this.form.StartDate = new Date(data.startDate);
this.startDateSelected(new Date(this.form.StartDate));
......@@ -524,15 +544,15 @@ export default Vue.extend({
to.StartDate = from.StartDate;
to.EndDate = from.EndDate;
to.Keywords = [] as object[];
for (let keyword in from.Keywords) {
for (const keyword in from.Keywords) {
to.Keywords.push(from.Keywords[keyword]);
}
to.Organization = [] as Organization[];
for (let organization in from.Organization) {
for (const organization in from.Organization) {
to.Organization.push(from.Organization[organization]);
}
to.Discipline = [] as object[];
for (let discipline in from.Discipline) {
for (const discipline in from.Discipline) {
to.Discipline.push(from.Discipline[discipline]);
}
to.Visibility = from.Visibility;
......@@ -541,16 +561,31 @@ export default Vue.extend({
},
checkSelectedOrganisationLabels() {
if (this.organizations.length > 0) {
for (let organization in this.form.Organization) {
var orgEntry = this.form.Organization[organization] as Organization;
for (const organization in this.form.Organization) {
const orgEntry = this.form.Organization[organization] as Organization;
if (orgEntry.url === orgEntry.displayName) {
let realOrgEntry = this.organizations.find(
const realOrgEntry = this.organizations.find(
(entry: Organization) => entry.url === orgEntry.url) as Organization;
orgEntry.displayName = realOrgEntry.displayName;
}
}
}
},
clickCopyMetadata() {
if (this.parentData) {
this.fillProjectMetadata(this.parentData);
this.checkSelectedOrganisationLabels();
}
},
setCopyMetadata(parentId: string) {
ProjectApi.getProjectInformation(parentId,
(response: any) => {
this.parentData = response.data;
// ---- set label for copyMetadata -----
const parentProjectName = response.data.projectName;
this.copyMetadataLabel = this.$t('copyMetadataLabel') + ' "' + parentProjectName + '":';
});
},
},
async created() {
i18n.locale = this.$props.languageLocale;
......@@ -581,41 +616,48 @@ export default Vue.extend({
});
},
);
ProjectApi.getProjectInformation(this.projectId,
(response: any) => { this.fillForm(response.data);
(response: any) => {
const parentId = response.data.parentId;
if (GuidUtil.isValidGuid(parentId)) {
this.setCopyMetadata(parentId);
}
this.fillForm(response.data);
this.tranferFormValues(this.form, this.initialState);
this.checkSelectedOrganisationLabels(); });
this.checkSelectedOrganisationLabels();
});
ProjectRoleApi.getUserRoles(this.projectId,
(response: any) => { this.checkOwnership(response.data); });
(response: any) => {
this.checkOwnership(response.data);
});
} else {
// --- get parent information ---
if (GuidUtil.isValidGuid(this.parentId)) {
this.setCopyMetadata(this.parentId);
}
ActivatedFeaturesApi.listAllFeatures(
(response: any) => {
response.data.forEach((feature: any) => {
this.features.push(feature);
});
},
);
});
this.isNewProject = true;
this.tranferFormValues(this.form, this.initialState);
}
let disciplines = await DisciplineApi.getDisciplines((response: any) => { return response.data } );
for (let discipline of disciplines) {
const disciplines = await DisciplineApi.getDisciplines((response: any) => response.data );
for (const discipline of disciplines) {
this.disciplines.push(discipline);
}
let organizationUris = await OrganizationApi.getOrganizations((response: any) => { return response.data; } );
for (let organizationUri in organizationUris) {
for (let subOrg in organizationUris[organizationUri]) {
let org = organizationUris[organizationUri][subOrg];
let displayName = org["http://www.w3.org/2000/01/rdf-schema#label"][0]["value"];
let pushedOrg = { displayName, url: subOrg };
const organizationUris = await OrganizationApi.getOrganizations((response: any) => response.data );
for (const organizationUri in organizationUris) {
for (const subOrg in organizationUris[organizationUri]) {
const org = organizationUris[organizationUri][subOrg];
const displayName = org['http://www.w3.org/2000/01/rdf-schema#label'][0].value;
const pushedOrg = { displayName, url: subOrg };
this.organizations.push(pushedOrg);
}
}
this.checkSelectedOrganisationLabels();
},
});
</script>
......
......@@ -80,7 +80,7 @@ export default Vue.extend({
showHelp: false,
isWaitingForResponse: false,
color: '#00549f',
}
};
},
beforeMount() {
i18n.locale = this.$props.languageLocale;
......@@ -88,7 +88,7 @@ export default Vue.extend({
props: {
languageLocale: {
default: 'en',
type: String
type: String,
},
projectId: String,
displayName: String,
......@@ -128,7 +128,7 @@ export default Vue.extend({
}
this.isWaitingForResponse = true;
SubProjectApi.getAccessibleParent(this.projectId, (response: any) => {
let parentId = response.data.id;
const parentId = response.data.id;
ProjectApi.getProjectInformation(parentId,
(response: any) => {
ProjectApi.deleteProject(
......
......@@ -10,6 +10,6 @@ declare var coscine: {
declare var _spPageContextInfo: any;
declare class Organization {
url: string;
displayName: string;
};
\ No newline at end of file
public url: string;
public displayName: string;
}