Skip to content

Commit

Permalink
Fix the edit button
Browse files Browse the repository at this point in the history
  • Loading branch information
AchoArnold committed Apr 29, 2024
1 parent 329d68f commit 5817563
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 52 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ api/.env
api/docs
web/static/icons/Downloads*
api/main.exe
node_modules
7 changes: 0 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,3 @@ repos:
rev: v4.0.0-alpha.8
hooks:
- id: prettier

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.1.1
hooks:
- id: eslint
files: (\.[jt]s)|(\.vue)$
types: [file]
96 changes: 51 additions & 45 deletions web/pages/projects/_id/integrations/link/_integrationId/edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,109 +136,115 @@
</template>

<script>
import { mdiMenuDown, mdiDelete, mdiContentSave, mdiSquare } from '@mdi/js'
import { mdiMenuDown, mdiDelete, mdiContentSave, mdiSquare } from "@mdi/js";
export default {
name: 'ProjectsIntegrationsLinkEdit',
layout: 'project',
name: "ProjectsIntegrationsLinkEdit",
layout: "project",
data() {
return {
mdiContentSave,
mdiMenuDown,
mdiDelete,
mdiSquare,
savingIntegration: false,
formName: '',
formIcon: 'link',
formText: '',
formWebsite: '',
formColor: '#1E88E5',
formName: "",
formIcon: "link",
formText: "",
formWebsite: "",
formColor: "#1E88E5",
linkIcons: [
{
text: 'Link Icon',
value: 'link',
text: "Link Icon",
value: "link",
},
{
text: 'Documentation Icon',
value: 'documentation',
text: "Documentation Icon",
value: "documentation",
},
{
text: 'Mail Icon',
value: 'mail',
text: "Mail Icon",
value: "mail",
},
{
text: 'Github Icon',
value: 'github',
text: "Github Icon",
value: "github",
},
{
text: "Map Icon",
value: "map",
},
],
}
};
},
computed: {
widgetColor() {
return /^#[0-9A-F]{6}$/i.test(this.formColor) ? this.formColor : '#1E88E5'
return /^#[0-9A-F]{6}$/i.test(this.formColor)
? this.formColor
: "#1E88E5";
},
},
async mounted() {
if (!this.$store.getters.authUser) {
return this.$router.push('/login')
return this.$router.push("/login");
}
await Promise.all([this.$store.dispatch('loadProjects')])
this.loadIntegration()
await Promise.all([this.$store.dispatch("loadProjects")]);
this.loadIntegration();
},
methods: {
getIconURL(value) {
return window.location.origin + '/icons/' + value + '.svg'
return window.location.origin + "/icons/" + value + ".svg";
},
loadIntegration() {
this.savingIntegration = true
this.savingIntegration = true;
this.$store
.dispatch('getLinkIntegration', {
.dispatch("getLinkIntegration", {
projectId: this.$store.getters.activeProjectId,
integrationId: this.$route.params.integrationId,
})
.then((payload) => {
this.setDefaults(payload)
this.setDefaults(payload);
})
.finally(() => {
this.savingIntegration = false
})
this.savingIntegration = false;
});
},
/**
*
* @param {EntitiesLinkIntegration} integration
*/
setDefaults(integration) {
this.formName = integration.name
this.formText = integration.text
this.formIcon = integration.icon
this.formColor = integration.color ? integration.color : this.formColor
this.formWebsite = integration.url
this.formName = integration.name;
this.formText = integration.text;
this.formIcon = integration.icon;
this.formColor = integration.color ? integration.color : this.formColor;
this.formWebsite = integration.url;
},
deleteIntegration() {
this.savingIntegration = true
this.savingIntegration = true;
this.$store
.dispatch('deleteLinkIntegration', {
.dispatch("deleteLinkIntegration", {
projectId: this.$store.getters.activeProjectId,
integrationId: this.$route.params.integrationId,
})
.then(() => {
this.$router.push({
name: 'projects-id-integrations',
name: "projects-id-integrations",
params: {
id: this.$store.getters.activeProjectId,
},
})
});
})
.finally(() => {
this.savingIntegration = false
})
this.savingIntegration = false;
});
},
saveIntegration() {
this.savingIntegration = true
this.savingIntegration = true;
this.$store
.dispatch('updateLinkIntegration', {
.dispatch("updateLinkIntegration", {
projectId: this.$store.getters.activeProjectId,
integrationId: this.$route.params.integrationId,
name: this.formName,
Expand All @@ -249,16 +255,16 @@ export default {
})
.then(() => {
this.$router.push({
name: 'projects-id-integrations',
name: "projects-id-integrations",
params: {
id: this.$store.getters.activeProjectId,
},
})
});
})
.finally(() => {
this.savingIntegration = false
})
this.savingIntegration = false;
});
},
},
}
};
</script>

0 comments on commit 5817563

Please sign in to comment.