Skip to content

Commit

Permalink
Merge branch 'release-2024-fall' into observation/FOUR-19178
Browse files Browse the repository at this point in the history
  • Loading branch information
eiresendez committed Oct 22, 2024
2 parents 75c6753 + cf40c66 commit 9eb3eb9
Show file tree
Hide file tree
Showing 14 changed files with 14,372 additions and 33 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ jobs:
- name: set-vfe-branch
run: |
export VFE_BRANCH=''
if [[ ${{ contains(github.event.pull_request.body, 'ci:next') }} ]]; then
export VFE_BRANCH=next
fi
if [[ "${{ steps.install-vfe.outputs.match }}" != "" ]]; then
export VFE_BRANCH=${{ steps.install-vfe.outputs.group1 }}
fi
Expand Down
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@processmaker/screen-builder",
"version": "3.0.0",
"version": "3.0.1",
"scripts": {
"dev": "VITE_COVERAGE=true vite",
"build": "vite build",
Expand Down Expand Up @@ -57,7 +57,7 @@
"@fortawesome/fontawesome-free": "^5.6.1",
"@originjs/vite-plugin-commonjs": "^1.0.3",
"@panter/vue-i18next": "^0.15.2",
"@processmaker/vue-form-elements": "0.60.0",
"@processmaker/vue-form-elements": "0.60.1",
"@processmaker/vue-multiselect": "2.3.0",
"@storybook/addon-essentials": "^7.6.13",
"@storybook/addon-interactions": "^7.6.13",
Expand Down Expand Up @@ -116,7 +116,7 @@
},
"peerDependencies": {
"@panter/vue-i18next": "^0.15.0",
"@processmaker/vue-form-elements": "0.60.0",
"@processmaker/vue-form-elements": "0.60.1",
"i18next": "^15.0.8",
"vue": "^2.6.12",
"vuex": "^3.1.1"
Expand Down
18 changes: 15 additions & 3 deletions src/components/ScreenTemplateCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@
:key="option.value"
class="col apply-options-container d-flex align-items-baseline flex-column"
>
<div class="icon-container">
<div
class="icon-container"
:class="{ selected: selected.includes(option.value) }"
@click.stop="toggleOption(option.value)"
>
<div v-if="option.value === 'CSS'">
<css-icon />
</div>
Expand All @@ -61,7 +65,7 @@
type="button"
size="sm"
class="btn btn-outline-secondary card-btn"
@click="onCancel"
@click.stop="onCancel"
>
{{ $t("Cancel") }}
</button>
Expand All @@ -70,7 +74,7 @@
type="button"
size="sm"
class="btn btn-primary ml-2 card-btn"
@click="applyTemplate"
@click.stop="applyTemplate"
>
{{ $t("Apply") }}
</button>
Expand Down Expand Up @@ -166,6 +170,14 @@ export default {
onCancel() {
this.isApplyOptionsActive = false;
this.selected = [];
},
toggleOption(value) {
const index = this.selected.indexOf(value);
if (index === -1) {
this.selected.push(value);
} else {
this.selected.splice(index, 1);
}
}
}
};
Expand Down
22 changes: 20 additions & 2 deletions src/components/ScreenTemplates.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
data-cy="my-templates-list"
>
<b-card-group>
<b-card-body v-if="loading" class="d-flex justify-content-center">
<b-spinner variant="primary" label="Spinning"></b-spinner>
</b-card-body>
<b-card-body
v-if="noMyTemplatesFound"
class="p-2 h-100 overflow-auto"
Expand All @@ -59,6 +62,9 @@
data-cy="shared-templates-list"
>
<b-card-group>
<b-card-body v-if="loading" class="d-flex justify-content-center">
<b-spinner variant="primary" label="Spinning"></b-spinner>
</b-card-body>
<b-card-body
v-if="noSharedTemplatesFound"
class="p-2 h-100 overflow-auto"
Expand Down Expand Up @@ -110,7 +116,8 @@ export default {
sharedTemplatesSelected: false,
noMyTemplatesFound: false,
noSharedTemplatesFound: false,
activeTemplateId: null
activeTemplateId: null,
loading: false
};
},
mounted() {
Expand All @@ -128,19 +135,27 @@ export default {
this.fetchMyTemplates();
},
fetchMyTemplates() {
this.loading = true;
ProcessMaker.apiClient
.get(`templates/screen?is_public=0&screen_type=${this.screenType}`)
.then((response) => {
this.myTemplatesData = response.data.data;
if (!this.myTemplatesData || this.myTemplatesData.length === 0) {
if (
this.myTemplatesData.length === 0 ||
this.myTemplatesData === undefined
) {
this.noMyTemplatesFound = true;
}
})
.catch((error) => {
console.error(error);
})
.finally(() => {
this.loading = false;
});
},
fetchSharedTemplates() {
this.loading = true;
ProcessMaker.apiClient
.get(`templates/screen?is_public=1&screen_type=${this.screenType}`)
.then((response) => {
Expand All @@ -154,6 +169,9 @@ export default {
})
.catch((error) => {
console.error(error);
})
.finally(() => {
this.loading = false;
});
},
showSharedTemplates() {
Expand Down
41 changes: 29 additions & 12 deletions src/components/renderer/file-upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,32 +61,34 @@
</ul>
</template>
</uploader-list>
<uploader-drop v-if="uploaderLoaded && isConversationalForm" class="form-control-file">
<uploader-drop v-if="uploaderLoaded && isConversationalForm" class="form-control-file"
:class="this.files.length > 0 && !this.multipleUpload ? 'cf-single-file-upload' : ''"
>
<b-button
v-if="!required"
@click="cfSkipFileUpload"
class="btn cf-skip-btn mb-3"
class="btn cf-skip-btn"
:class="showMultiUploadButton ? 'mb-3' : ''"
>
<i class="fas fa-arrow-left mr-2"></i> {{ $t('Skip Uploading') }}
</b-button>

<uploader-btn
:attrs="nativeButtonAttrs"
:class="[
{ disabled: disabled },
'btn',
showSingleUploadButton ? 'cf-single-upload-btn' : (showMultiUploadButton ? 'cf-multi-upload-btn' : '')
showSingleUploadButton || files.length === 0 && !showMultiUploadButton ? 'cf-single-upload-btn mt-3' : (showMultiUploadButton ? 'cf-multi-upload-btn' : '')
]"
tabindex="0"
v-on:keyup.native="browse"
:aria-label="$attrs['aria-label']"
>
<span v-if="showSingleUploadButton"><i class="far fa-image mr-2"></i> {{ $t('Add File/Photo') }}</span>
<span v-if="showSingleUploadButton || files.length === 0 && !showMultiUploadButton"><i class="far fa-image mr-2"></i> {{ $t('Add File/Photo') }}</span>
<span v-else-if="showMultiUploadButton"><i class="fas fa-plus mr-2"></i> {{ $t('Add another') }}</span>
</uploader-btn>

<b-button v-if="files.length !== 0" class="cf-file-upload-submit" variant="primary" @click="emitConversationalFormSubmit" :aria-label="$t('Submit')">
<i class="fas fa-paper-plane"></i> <span v-if="files.length !== 0 && showMultiUploadButton">{{ $t('Send All') }}</span>
<b-button v-if="files.length !== 0" class="cf-file-upload-submit" :class="!showMultiUploadButton ? 'w-100 mt-3' : ''" variant="primary" @click="emitConversationalFormSubmit" :aria-label="$t('Submit')">
<i class="fas fa-paper-plane"></i> <span v-if="showMultiUploadButton">{{ $t('Send All') }}</span> <span v-else>{{ $t('Submit File/Photo') }}</span>
</b-button>
</uploader-drop>

Expand Down Expand Up @@ -270,7 +272,7 @@ export default {
return this.screenType === 'conversational-forms';
},
showSingleUploadButton() {
return this.files.length === 0 || !this.multipleUpload;
return this.files.length === 0 && !this.multipleUpload;
},
showMultiUploadButton() {
return this.files.length !== 0 && this.multipleUpload;
Expand Down Expand Up @@ -402,7 +404,6 @@ export default {
},
setRequestFiles() {
_.set(window, `PM4ConfigOverrides.requestFiles["${this.fileDataName}"]`, this.files);
console.log("!!!!!! SET REQUEST FILES", this.valueToSend());
this.$emit('input', this.valueToSend());
},
valueToSend() {
Expand Down Expand Up @@ -491,7 +492,7 @@ export default {
}
this.$delete(this.nativeFiles, id);
}
this.$emit('file-deleted', this.files);
},
addToFiles(fileInfo) {
if (this.multipleUpload) {
Expand Down Expand Up @@ -528,6 +529,19 @@ export default {
this.prefix = parent.loopContext + '.';
}
},
validateFile(file, acceptFiles){
const extensions = acceptFiles.filter(item => item.startsWith('.'));
const mimeTypes = acceptFiles.filter(item => !item.startsWith('.'));
const fileExtension = '.' + file.name.split('.').pop().toLowerCase();
const fileType = file.fileType;
const isExtensionValid = extensions.includes(fileExtension);
const isMimeTypeValid = mimeTypes.includes(fileType);
if (!isExtensionValid && !isMimeTypeValid) {
return false;
}
return true;
},
addFile(file) {
if (this.disabled) {
file.ignored = true;
Expand All @@ -544,7 +558,7 @@ export default {
if (this.filesAccept) {
file.ignored = true;
if (this.filesAccept.indexOf(file.fileType) !== -1) {
if (this.validateFile(file, this.filesAccept)) {
file.ignored = false;
}
if (file.ignored) {
Expand Down Expand Up @@ -612,7 +626,6 @@ export default {
this.$set(this.nativeFiles, id, rootFile);
this.addToFiles(fileInfo);
} else {
console.log("!!!!!! FILE UPLOADED", name);
this.$emit('input', name);
}
},
Expand Down Expand Up @@ -750,4 +763,8 @@ export default {
box-shadow: 0px 12px 24px -12px #0000001F;
}
.form-control-file.cf-single-file-upload label {
display: none;
}
</style>
1 change: 1 addition & 0 deletions src/components/task.vue
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ export default {
if (
elementDestinationValue &&
elementDestinationValue !== 'taskSource' &&
data?.params[0]?.tokenId === this.taskId &&
data?.params[0]?.requestStatus === 'ACTIVE'
) {
Expand Down
4 changes: 2 additions & 2 deletions src/form-control-common-properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ export const keyNameProperty = {
config: {
label: 'Variable Name',
name: 'Variable Name',
// Update tests/e2e/specs/Builder.spec.js when changing this
validation: 'regex:/^([a-zA-Z]([a-zA-Z0-9_]?)+\\.?)+(?<!\\.)$/|required|not_in:' + javascriptReservedKeywords,
// Update tests/e2e/specs/Builder.spec.js when changing dot_notation
validation: 'dot_notation|required|not_in:' + javascriptReservedKeywords,
helper: 'A variable name is a symbolic name to reference information.',
},
};
Expand Down
Loading

0 comments on commit 9eb3eb9

Please sign in to comment.