This commit is contained in:
2023-01-03 02:00:09 +00:00
parent 9e95c7fae2
commit 0c10bcb050
6 changed files with 117 additions and 20 deletions

View File

@@ -235,6 +235,13 @@ export default {
});
break;
case socktype.Purchase:
vm.$router.push({
name: "purchase-edit",
params: { recordid: tid.id }
});
break;
case socktype.SubscriptionServer:
vm.$router.push({
name: "subscription-server-edit",

View File

@@ -0,0 +1,63 @@
<template>
<v-text-field
dense
v-bind="$attrs"
type="url"
prepend-icon="$sockiTerminal"
:readonly="readonly"
:disabled="disabled"
:label="label"
:rules="rules"
:value="value"
:error-messages="errorMessages"
v-on="$listeners"
@click:prepend="openUrl"
></v-text-field>
</template>
<script>
export default {
props: {
label: { type: String, default: null },
value: { type: String, default: null },
rules: { type: Array, default: undefined },
readonly: { type: Boolean, default: false },
disabled: { type: Boolean, default: false },
errorMessages: { type: Array, default: null }
},
methods: {
openUrl() {
if (this.value) {
window.open(`ssh:${this.value}`, "ssh");
}
}
}
};
/*
TO USE THIS:
Must have a SSH URI handler set in registry on windows to open putty like this:
----------------
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\ssh]
@="URL:SSH Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\ssh\DefaultIcon]
@="%%ProgramFiles%%\\PuTTY\\putty.exe"
[HKEY_CLASSES_ROOT\ssh\shell]
[HKEY_CLASSES_ROOT\ssh\shell\open]
[HKEY_CLASSES_ROOT\ssh\shell\open\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -Command \"$val='%l'; $val = $val.TrimEnd('/');if ($val.StartsWith('ssh://')) { $val = $val.SubString(6) }; & 'C:\\Program Files\\PuTTY\\putty.exe' \"$val\"\""
----------------
Also in putty need to set default to use pagent agent and then open the keys in KeePass so relies on a lot specific to us but it works great
https://documentation.help/PuTTY/config-saving.html#S4.1.2
*/
</script>

View File

@@ -47,6 +47,7 @@ import decimalControl from "./components/decimal-control.vue";
import percentControl from "./components/percent-control.vue";
import phoneControl from "./components/phone-control.vue";
import emailControl from "./components/email-control.vue";
import sshControl from "./components/ssh-control.vue";
import urlControl from "./components/url-control.vue";
import roleControl from "./components/role-control.vue";
import durationControl from "./components/duration-control.vue";
@@ -169,6 +170,7 @@ Vue.component("gz-decimal", decimalControl);
Vue.component("gz-phone", phoneControl);
Vue.component("gz-email", emailControl);
Vue.component("gz-url", urlControl);
Vue.component("gz-ssh", sshControl);
Vue.component("gz-role-picker", roleControl);
Vue.component("gz-duration-picker", durationControl);
Vue.component("gz-error", errorControl);

View File

@@ -217,6 +217,7 @@ import {
faTachometerAlt,
faTags,
faTasks,
faTerminal,
faThList,
faTicketAlt,
faTimesCircle,
@@ -413,6 +414,7 @@ library.add(
faTachometerAlt,
faTags,
faTasks,
faTerminal,
faThList,
faTicketAlt,
faTimesCircle,
@@ -1413,6 +1415,12 @@ const CUSTOM_ICONS = {
icon: ["fas", "tasks"]
}
},
sockiTerminal: {
component: FontAwesomeIcon,
props: {
icon: ["fas", "terminal"]
}
},
sockiThList: {
component: FontAwesomeIcon,
props: {

View File

@@ -14,7 +14,6 @@
:readonly="formState.readOnly"
:label="$sock.t('Customer')"
:error-messages="form().serverErrors(this, 'customerId')"
:rules="[form().required(this, 'customerId')]"
@input="fieldValueChanged('customerId')"
></gz-pick-list>
</v-col>
@@ -243,7 +242,7 @@ export default {
concurrency: 0,
customerId: 0,
vendorId: 1,
productId: 0,
productId: null,
salesOrderNumber: null,
purchaseDate: window.$gz.locale.nowUTC8601String(),
expireDate: null,

View File

@@ -5,7 +5,7 @@
<gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
<v-form ref="form">
<v-row dense>
<v-col cols="12" sm="6" lg="4" xl="3">
<!-- <v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
ref="name"
v-model="obj.name"
@@ -17,6 +17,30 @@
data-cy="name"
@input="fieldValueChanged('name')"
></v-text-field>
</v-col> -->
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-ssh
ref="name"
v-model="obj.name"
:readonly="formState.readOnly"
:label="$sock.t('SubServerName')"
data-cy="name"
:rules="[form().required(this, 'name')]"
:error-messages="form().serverErrors(this, 'name')"
@input="fieldValueChanged('name')"
></gz-ssh>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
ref="iPAddress"
v-model="obj.iPAddress"
dense
:readonly="formState.readOnly"
:label="$sock.t('SubServerIP')"
data-cy="iPAddress"
:error-messages="form().serverErrors(this, 'iPAddress')"
@input="fieldValueChanged('iPAddress')"
></v-text-field>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
@@ -182,7 +206,7 @@
ref="cost"
v-model="obj.cost"
:readonly="formState.readOnly"
:label="$ay.t('LoanUnitRateMonthCost')"
:label="$sock.t('LoanUnitRateMonthCost')"
data-cy="cost"
:rules="[
form().decimalValid(this, 'cost'),
@@ -1273,15 +1297,8 @@ async function clickHandler(menuItem) {
window.$gz.form.setLastReportMenuItem(FORM_KEY, res, m.vm);
}
break;
case "WorkOrderList":
m.vm.$router.push({
name: "svc-workorders",
params: {
aType: m.vm.sockType,
objectId: m.vm.obj.id,
name: m.vm.obj.name
}
});
case "terminal":
alert("putty -agent -ssh sportseffect.onayanova.com");
break;
case "QuoteList":
m.vm.$router.push({
@@ -1386,12 +1403,12 @@ function generateMenu(vm) {
}
menuOptions.menuItems.push({ divider: true, inset: false });
// menuOptions.menuItems.push({
// title: "WorkOrderList",
// icon: "$sockiTools",
// key: FORM_KEY + ":WorkOrderList",
// vm: vm
// });
menuOptions.menuItems.push({
title: "OpenTerminal",
icon: "$sockiTerminal",
key: FORM_KEY + ":terminal",
vm: vm
});
// menuOptions.menuItems.push({
// title: "QuoteList",
@@ -1443,7 +1460,8 @@ async function fetchTranslatedText() {
"SubServerTrialCompany",
"SubServerOperatingSystem",
"SubServerCustomerDomain",
"LoanUnitRateMonthCost"
"LoanUnitRateMonthCost",
"SubServerIP"
]);
}
/*