Skip to content

Commit

Permalink
Merge branch 'main/develop' into main/master
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou committed Sep 16, 2022
2 parents 1e9120e + e150a4e commit f65bc9f
Show file tree
Hide file tree
Showing 16 changed files with 367 additions and 312 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Before you work on a PR and submit it, please pay attention to the following gui
- Upon merging, we will squash all commits of the PR into a single commit for a clean history and release changelogs.
7. Please sign off each commit and your PR. It must contain your real name and a current email address (see example in item 4).
- The sign-off should follow this pattern: `Signed-off-by: My Name <[email protected]>`
- The sign-off certifies that you agree with the [developer certificate of origin](https://github.com/mainsail-crew/mainsail/.github/DEVELOPER_CERTIFICATE_OF_ORIGIN.md).
- The sign-off certifies that you agree with the [developer certificate of origin](https://github.com/mainsail-crew/mainsail/blob/develop/.github/DEVELOPER_CERTIFICATE_OF_ORIGIN.md).
- If you provide a translation, a sign-off is not necessarily required.
8. When opening a pull request, keep `Allow edits and access to secrets by maintainers` **enabled**.

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mainsail",
"version": "2.3.0",
"version": "2.3.1",
"private": true,
"decription": "a klipper web interface",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion src/components/inputs/Codemirror.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default class Codemirror extends Mixins(BaseMixin) {
if (['cfg', 'conf'].includes(this.fileExtension)) extensions.push(StreamLanguage.define(klipper_config))
else if (['gcode'].includes(this.fileExtension)) extensions.push(StreamLanguage.define(gcode))
else if (['json'].includes(this.fileExtension)) extensions.push(json())
else if (['css'].includes(this.fileExtension)) extensions.push(css())
else if (['css', 'scss', 'sass'].includes(this.fileExtension)) extensions.push(css())
return extensions
}
Expand Down
28 changes: 25 additions & 3 deletions src/components/panels/GcodefilesPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,16 @@
v-model="dialogCreateDirectory.name"
:label="$t('Files.Name')"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@keypress.enter="createDirectoryAction"></v-text-field>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="dialogCreateDirectory.show = false">{{ $t('Files.Cancel') }}</v-btn>
<v-btn color="primary" text @click="createDirectoryAction">{{ $t('Files.Create') }}</v-btn>
<v-btn :disabled="isInvalidName" color="primary" text @click="createDirectoryAction">
{{ $t('Files.Create') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
Expand All @@ -399,12 +403,16 @@
v-model="dialogRenameFile.newName"
:label="$t('Files.Name').toString()"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@keyup.enter="renameFileAction"></v-text-field>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="dialogRenameFile.show = false">{{ $t('Files.Cancel') }}</v-btn>
<v-btn color="primary" text @click="renameFileAction">{{ $t('Files.Rename') }}</v-btn>
<v-btn :disabled="isInvalidName" color="primary" text @click="renameFileAction">
{{ $t('Files.Rename') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
Expand All @@ -424,12 +432,16 @@
v-model="dialogRenameDirectory.newName"
:label="$t('Files.Name')"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@keyup.enter="renameDirectoryAction"></v-text-field>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="dialogRenameDirectory.show = false">{{ $t('Files.Cancel') }}</v-btn>
<v-btn color="primary" text @click="renameDirectoryAction">{{ $t('Files.Rename') }}</v-btn>
<v-btn :disabled="isInvalidName" color="primary" text @click="renameDirectoryAction">
{{ $t('Files.Rename') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
Expand Down Expand Up @@ -647,6 +659,16 @@ export default class GcodefilesPanel extends Mixins(BaseMixin, ControlMixin) {
private deleteSelectedDialog = false
private isInvalidName = true
private nameInputRules = [
(value: string) => !!value || this.$t('Files.InvalidNameEmpty'),
(value: string) => !this.existsFilename(value) || this.$t('Files.InvalidNameAlreadyExists'),
]
existsFilename(name: string) {
return this.files.findIndex((file) => file.filename === name) >= 0
}
get currentPath() {
const path = this.$store.state.gui.view.gcodefiles.currentPath
if (path === 'gcodes') return ''
Expand Down
26 changes: 22 additions & 4 deletions src/components/panels/Machine/ConfigFilesPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,16 @@
v-model="dialogCreateFile.name"
:label="$t('Machine.ConfigFilesPanel.Name')"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@keyup.enter="createFileAction"></v-text-field>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="dialogCreateFile.show = false">
{{ $t('Machine.ConfigFilesPanel.Cancel') }}
</v-btn>
<v-btn color="primary" text @click="createFileAction">
<v-btn :disabled="isInvalidName" color="primary" text @click="createFileAction">
{{ $t('Machine.ConfigFilesPanel.Create') }}
</v-btn>
</v-card-actions>
Expand All @@ -306,14 +308,16 @@
v-model="dialogRenameFile.newName"
:label="$t('Machine.ConfigFilesPanel.Name')"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@keyup.enter="renameFileAction"></v-text-field>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="dialogRenameFile.show = false">
{{ $t('Machine.ConfigFilesPanel.Cancel') }}
</v-btn>
<v-btn color="primary" text @click="renameFileAction">
<v-btn :disabled="isInvalidName" color="primary" text @click="renameFileAction">
{{ $t('Machine.ConfigFilesPanel.Rename') }}
</v-btn>
</v-card-actions>
Expand All @@ -335,14 +339,16 @@
v-model="dialogCreateDirectory.name"
:label="$t('Machine.ConfigFilesPanel.Name')"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@keyup.enter="createDirectoryAction"></v-text-field>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="dialogCreateDirectory.show = false">
{{ $t('Machine.ConfigFilesPanel.Cancel') }}
</v-btn>
<v-btn color="primary" text @click="createDirectoryAction">
<v-btn :disabled="isInvalidName" color="primary" text @click="createDirectoryAction">
{{ $t('Machine.ConfigFilesPanel.Create') }}
</v-btn>
</v-card-actions>
Expand All @@ -364,14 +370,16 @@
v-model="dialogRenameDirectory.newName"
:label="$t('Machine.ConfigFilesPanel.Name')"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@keyup.enter="renameDirectoryAction"></v-text-field>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="dialogRenameDirectory.show = false">
{{ $t('Machine.ConfigFilesPanel.Cancel') }}
</v-btn>
<v-btn color="primary" text @click="renameDirectoryAction">
<v-btn :disabled="isInvalidName" color="primary" text @click="renameDirectoryAction">
{{ $t('Machine.ConfigFilesPanel.Rename') }}
</v-btn>
</v-card-actions>
Expand Down Expand Up @@ -639,6 +647,16 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
private deleteSelectedDialog = false
private isInvalidName = true
private nameInputRules = [
(value: string) => !!value || this.$t('Files.InvalidNameEmpty'),
(value: string) => !this.existsFilename(value) || this.$t('Files.InvalidNameAlreadyExists'),
]
existsFilename(name: string) {
return this.files.findIndex((file) => file.filename === name) >= 0
}
get blockFileUpload() {
return this.$store.state.gui.view.blockFileUpload ?? false
}
Expand Down
46 changes: 33 additions & 13 deletions src/components/panels/Timelapse/TimelapseFilesPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,16 @@
v-model="dialogRenameFile.newName"
:label="$t('Timelapse.Name')"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@keypress.enter="renameFileAction"></v-text-field>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="dialogRenameFile.show = false">{{ $t('Timelapse.Cancel') }}</v-btn>
<v-btn color="primary" text @click="renameFileAction">{{ $t('Timelapse.Rename') }}</v-btn>
<v-btn :disabled="isInvalidName" color="primary" text @click="renameFileAction">
{{ $t('Timelapse.Rename') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
Expand All @@ -261,16 +265,19 @@
ref="inputFieldCreateDirectory"
v-model="dialogCreateDirectory.name"
:label="$t('Timelapse.Name')"
:rules="input_rules"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@keypress.enter="createDirectoryAction"></v-text-field>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="dialogCreateDirectory.show = false">
{{ $t('Timelapse.Cancel') }}
</v-btn>
<v-btn color="primary" text @click="createDirectoryAction">{{ $t('Timelapse.Create') }}</v-btn>
<v-btn :disabled="isInvalidName" color="primary" text @click="createDirectoryAction">
{{ $t('Timelapse.Create') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
Expand All @@ -290,14 +297,18 @@
v-model="dialogRenameDirectory.newName"
:label="$t('Timelapse.Name')"
required
:rules="nameInputRules"
@update:error="isInvalidName = !isInvalidName"
@keyup.enter="renameDirectoryAction"></v-text-field>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="" text @click="dialogRenameDirectory.show = false">
{{ $t('Timelapse.Cancel') }}
</v-btn>
<v-btn color="primary" text @click="renameDirectoryAction">{{ $t('Timelapse.Rename') }}</v-btn>
<v-btn :disabled="isInvalidName" color="primary" text @click="renameDirectoryAction">
{{ $t('Timelapse.Rename') }}
</v-btn>
</v-card-actions>
</panel>
</v-dialog>
Expand Down Expand Up @@ -496,7 +507,15 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
private deleteSelectedDialog = false
private input_rules = [(value: string) => value.indexOf(' ') === -1 || 'Name contains spaces!']
private isInvalidName = true
private nameInputRules = [
(value: string) => !!value || this.$t('Files.InvalidNameEmpty'),
(value: string) => !this.existsFilename(value) || this.$t('Files.InvalidNameAlreadyExists'),
]
existsFilename(name: string) {
return this.files.findIndex((file) => file.filename === name) >= 0
}
get headers() {
return [
Expand Down Expand Up @@ -593,14 +612,15 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
}
createDirectoryAction() {
if (this.dialogCreateDirectory.name.length && this.dialogCreateDirectory.name.indexOf(' ') === -1) {
this.dialogCreateDirectory.show = false
this.$socket.emit(
'server.files.post_directory',
{ path: this.currentPath + '/' + this.dialogCreateDirectory.name },
{ action: 'files/getCreateDir' }
)
}
this.dialogCreateDirectory.show = false
this.$socket.emit(
'server.files.post_directory',
{
path: this.currentPath + '/' + this.dialogCreateDirectory.name,
},
{ action: 'files/getCreateDir' }
)
}
refreshFileList() {
Expand Down
Loading

0 comments on commit f65bc9f

Please sign in to comment.