1662 lines
53 KiB
Vue
1662 lines
53 KiB
Vue
<template>
|
|
<div>
|
|
<gz-report-selector ref="reportSelector"></gz-report-selector>
|
|
<div v-if="formState.ready">
|
|
<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-text-field
|
|
ref="name"
|
|
v-model="obj.name"
|
|
dense
|
|
:readonly="formState.readOnly"
|
|
:label="$sock.t('SubServerName')"
|
|
:rules="[form().required(this, 'name')]"
|
|
:error-messages="form().serverErrors(this, 'name')"
|
|
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">
|
|
<gz-url
|
|
v-model="obj.name"
|
|
readonly
|
|
:label="$sock.t('SubServerName')"
|
|
></gz-url>
|
|
</v-col>
|
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
<gz-pick-list
|
|
ref="customerId"
|
|
v-model="obj.customerId"
|
|
:aya-type="sockTypes().Customer"
|
|
show-edit-icon
|
|
:readonly="formState.readOnly"
|
|
:label="$sock.t('Customer')"
|
|
:error-messages="form().serverErrors(this, 'customerId')"
|
|
@input="fieldValueChanged('customerId')"
|
|
></gz-pick-list>
|
|
</v-col>
|
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
<v-select
|
|
ref="serverState"
|
|
v-model="obj.serverState"
|
|
dense
|
|
:items="selectLists.serverStates"
|
|
item-text="name"
|
|
item-value="id"
|
|
:readonly="formState.readOnly"
|
|
:label="$sock.t('ServerState')"
|
|
data-cy="serverState"
|
|
:rules="[form().integerValid(this, 'serverState')]"
|
|
:error-messages="form().serverErrors(this, 'serverState')"
|
|
@input="fieldValueChanged('serverState')"
|
|
></v-select>
|
|
</v-col>
|
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
<gz-date-time-picker
|
|
ref="created"
|
|
v-model="obj.created"
|
|
:label="$sock.t('Created')"
|
|
:rules="[form().required(this, 'created')]"
|
|
:readonly="formState.readOnly"
|
|
:error-messages="form().serverErrors(this, 'created')"
|
|
data-cy="created"
|
|
@input="fieldValueChanged('created')"
|
|
></gz-date-time-picker>
|
|
</v-col>
|
|
|
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
<v-select
|
|
ref="dataCenter"
|
|
v-model="obj.dataCenter"
|
|
dense
|
|
:items="selectLists.dataCenters"
|
|
item-text="name"
|
|
item-value="id"
|
|
:label="$sock.t('SubServerDatacenter')"
|
|
:error-messages="form().serverErrors(this, 'dataCenter')"
|
|
:rules="[form().required(this, 'dataCenter')]"
|
|
@input="fieldValueChanged('dataCenter')"
|
|
></v-select>
|
|
</v-col>
|
|
|
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
<v-select
|
|
ref="timeZone"
|
|
v-model="obj.timeZone"
|
|
dense
|
|
:items="selectLists.timeZones"
|
|
:label="$sock.t('SubServerTimeZone')"
|
|
:error-messages="form().serverErrors(this, 'timeZone')"
|
|
:rules="[form().required(this, 'timeZone')]"
|
|
@input="fieldValueChanged('timeZone')"
|
|
></v-select>
|
|
</v-col>
|
|
|
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
<v-text-field
|
|
ref="dbId"
|
|
v-model="obj.dbId"
|
|
dense
|
|
:readonly="formState.readOnly"
|
|
:label="$sock.t('DatabaseID')"
|
|
data-cy="dbId"
|
|
:error-messages="form().serverErrors(this, 'dbId')"
|
|
@input="fieldValueChanged('dbId')"
|
|
></v-text-field>
|
|
</v-col>
|
|
|
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
<gz-date-time-picker
|
|
ref="lastUpdated"
|
|
v-model="obj.lastUpdated"
|
|
:label="$sock.t('SubServerLastUpdated')"
|
|
:readonly="formState.readOnly"
|
|
:error-messages="form().serverErrors(this, 'lastUpdated')"
|
|
data-cy="lastUpdated"
|
|
@input="fieldValueChanged('lastUpdated')"
|
|
></gz-date-time-picker>
|
|
</v-col>
|
|
|
|
<!-- case 4600: expiry only applies to trial servers; a paid server renews monthly -->
|
|
<v-col v-if="obj.trial" cols="12" sm="6" lg="4" xl="3">
|
|
<v-row no-gutters>
|
|
<v-col cols="1">
|
|
<v-menu offset-y>
|
|
<template v-slot:activator="{ on, attrs }">
|
|
<v-btn icon v-bind="attrs" v-on="on">
|
|
<v-icon small>$sockiPlus</v-icon>
|
|
</v-btn>
|
|
</template>
|
|
<v-list>
|
|
<v-list-item @click="subExpireAddOneWeek">
|
|
<v-list-item-icon>
|
|
<v-icon>$sockiPlus</v-icon>
|
|
</v-list-item-icon>
|
|
<v-list-item-title>One week</v-list-item-title>
|
|
</v-list-item>
|
|
<v-list-item @click="subExpireAddOneMonth">
|
|
<v-list-item-icon>
|
|
<v-icon>$sockiPlus</v-icon>
|
|
</v-list-item-icon>
|
|
<v-list-item-title>One month</v-list-item-title>
|
|
</v-list-item>
|
|
<v-list-item @click="subExpireAddOneYear">
|
|
<v-list-item-icon>
|
|
<v-icon>$sockiPlus</v-icon>
|
|
</v-list-item-icon>
|
|
<v-list-item-title>One year</v-list-item-title>
|
|
</v-list-item>
|
|
</v-list>
|
|
</v-menu>
|
|
</v-col>
|
|
<v-col>
|
|
<gz-date-time-picker
|
|
ref="subscriptionExpire"
|
|
v-model="obj.subscriptionExpire"
|
|
:label="$sock.t('SubServerSubExpire')"
|
|
:rules="[form().required(this, 'subscriptionExpire')]"
|
|
:readonly="formState.readOnly"
|
|
:error-messages="
|
|
form().serverErrors(this, 'subscriptionExpire')
|
|
"
|
|
data-cy="subscriptionExpire"
|
|
@input="fieldValueChanged('subscriptionExpire')"
|
|
></gz-date-time-picker>
|
|
</v-col>
|
|
</v-row>
|
|
</v-col>
|
|
|
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
<v-text-field
|
|
ref="lastHealthStatus"
|
|
v-model="obj.lastHealthStatus"
|
|
dense
|
|
:readonly="formState.readOnly"
|
|
:label="$sock.t('SubServerLastHealthStatus')"
|
|
data-cy="lastHealthStatus"
|
|
@input="fieldValueChanged('lastHealthStatus')"
|
|
></v-text-field>
|
|
</v-col>
|
|
|
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
<gz-date-time-picker
|
|
ref="lastHealthCheck"
|
|
v-model="obj.lastHealthCheck"
|
|
:label="$sock.t('SubServerLastHealthCheck')"
|
|
readonly
|
|
data-cy="lastHealthCheck"
|
|
></gz-date-time-picker>
|
|
</v-col>
|
|
|
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
<v-text-field
|
|
ref="operatingSystem"
|
|
v-model="obj.operatingSystem"
|
|
dense
|
|
:readonly="formState.readOnly"
|
|
:label="$sock.t('SubServerOperatingSystem')"
|
|
data-cy="operatingSystem"
|
|
:error-messages="form().serverErrors(this, 'operatingSystem')"
|
|
@input="fieldValueChanged('operatingSystem')"
|
|
></v-text-field>
|
|
</v-col>
|
|
|
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
<v-text-field
|
|
ref="customerSubDomain"
|
|
v-model="obj.customerSubDomain"
|
|
dense
|
|
:readonly="formState.readOnly"
|
|
:label="$sock.t('SubServerCustomerDomain')"
|
|
data-cy="customerSubDomain"
|
|
:error-messages="form().serverErrors(this, 'customerSubDomain')"
|
|
@input="fieldValueChanged('customerSubDomain')"
|
|
></v-text-field>
|
|
</v-col>
|
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
<gz-currency
|
|
ref="cost"
|
|
v-model="obj.cost"
|
|
:readonly="formState.readOnly"
|
|
:label="$sock.t('LoanUnitRateMonthCost')"
|
|
data-cy="cost"
|
|
:rules="[
|
|
form().decimalValid(this, 'cost'),
|
|
form().required(this, 'cost')
|
|
]"
|
|
:error-messages="form().serverErrors(this, 'cost')"
|
|
@input="fieldValueChanged('cost')"
|
|
></gz-currency>
|
|
</v-col>
|
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
<v-checkbox
|
|
ref="trial"
|
|
v-model="obj.trial"
|
|
dense
|
|
:readonly="formState.readOnly"
|
|
:label="$sock.t('SubServerTrial')"
|
|
data-cy="trial"
|
|
:error-messages="form().serverErrors(this, 'trial')"
|
|
@change="fieldValueChanged('trial')"
|
|
></v-checkbox>
|
|
</v-col>
|
|
|
|
<v-col v-if="obj.trial" cols="12" sm="6" lg="4" xl="3">
|
|
<v-text-field
|
|
ref="trialCompany"
|
|
v-model="obj.trialCompany"
|
|
dense
|
|
:readonly="formState.readOnly"
|
|
:label="$sock.t('SubServerTrialCompany')"
|
|
data-cy="trialCompany"
|
|
:error-messages="form().serverErrors(this, 'trialCompany')"
|
|
@input="fieldValueChanged('trialCompany')"
|
|
></v-text-field>
|
|
</v-col>
|
|
|
|
<v-col v-if="obj.trial" cols="12" sm="6" lg="4" xl="3">
|
|
<v-text-field
|
|
ref="trialContact"
|
|
v-model="obj.trialContact"
|
|
dense
|
|
:readonly="formState.readOnly"
|
|
:label="$sock.t('SubServerTrialContact')"
|
|
data-cy="trialContact"
|
|
:error-messages="form().serverErrors(this, 'trialContact')"
|
|
@input="fieldValueChanged('trialContact')"
|
|
></v-text-field>
|
|
</v-col>
|
|
|
|
<v-col v-if="obj.trial" cols="12" sm="6" lg="4" xl="3">
|
|
<gz-email
|
|
ref="trialEmail"
|
|
v-model="obj.trialEmail"
|
|
:readonly="formState.readOnly"
|
|
:label="$sock.t('SubServerTrialEmail')"
|
|
data-cy="trialEmail"
|
|
:error-messages="form().serverErrors(this, 'trialEmail')"
|
|
@input="fieldValueChanged('trialEmail')"
|
|
></gz-email>
|
|
</v-col>
|
|
|
|
<v-col v-if="form().showMe(this, 'SubServerNotes')" cols="12">
|
|
<v-textarea
|
|
ref="notes"
|
|
v-model="obj.notes"
|
|
dense
|
|
:readonly="formState.readOnly"
|
|
:label="$sock.t('SubServerNotes')"
|
|
:error-messages="form().serverErrors(this, 'notes')"
|
|
data-cy="notes"
|
|
auto-grow
|
|
@input="fieldValueChanged('notes')"
|
|
></v-textarea>
|
|
</v-col>
|
|
|
|
<!-- --------------------------------- -->
|
|
|
|
<v-col v-if="form().showMe(this, 'Tags')" cols="12">
|
|
<gz-tag-picker
|
|
ref="tags"
|
|
v-model="obj.tags"
|
|
:readonly="formState.readOnly"
|
|
data-cy="tags"
|
|
:error-messages="form().serverErrors(this, 'tags')"
|
|
@input="fieldValueChanged('tags')"
|
|
></gz-tag-picker>
|
|
</v-col>
|
|
|
|
<v-col v-if="form().showMe(this, 'Wiki')" cols="12">
|
|
<gz-wiki
|
|
ref="wiki"
|
|
v-model="obj.wiki"
|
|
:aya-type="sockType"
|
|
:aya-id="obj.id"
|
|
:readonly="formState.readOnly"
|
|
@input="fieldValueChanged('wiki')"
|
|
></gz-wiki
|
|
></v-col>
|
|
|
|
<v-col v-if="form().showMe(this, 'Attachments') && obj.id" cols="12">
|
|
<gz-attachments
|
|
:readonly="formState.readOnly"
|
|
:aya-type="sockType"
|
|
:aya-id="obj.id"
|
|
></gz-attachments
|
|
></v-col>
|
|
</v-row>
|
|
</v-form>
|
|
</div>
|
|
<v-overlay :value="!formState.ready || formState.loading">
|
|
<v-progress-circular indeterminate :size="64" />
|
|
</v-overlay>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
const FORM_KEY = "subscription-server-edit";
|
|
const API_BASE_URL = "subscription-server/";
|
|
const FORM_CUSTOM_TEMPLATE_KEY = "SubscriptionServer";
|
|
export default {
|
|
data() {
|
|
return {
|
|
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
|
|
obj: {
|
|
id: 0,
|
|
concurrency: 0,
|
|
name: null,
|
|
customerId: null,
|
|
serverState: 0,
|
|
notes: null,
|
|
created: window.$gz.locale.nowUTC8601String(),
|
|
dataCenter: null,
|
|
timeZone: null,
|
|
dbId: null,
|
|
lastUpdated: null,
|
|
subscriptionExpire: null,
|
|
lastHealthStatus: null,
|
|
lastHealthCheck: null,
|
|
trial: true,
|
|
trialContact: null,
|
|
trialEmail: null,
|
|
trialCompany: null,
|
|
operatingSystem: "Ubuntu 22.10",
|
|
customerSubDomain: null,
|
|
cost: 7.0,
|
|
wiki: null,
|
|
tags: []
|
|
},
|
|
selectLists: {
|
|
serverStates: [],
|
|
dataCenters: [
|
|
{ id: "SF", name: "San Francisco" },
|
|
{ id: "ATL", name: "Atlanta" },
|
|
{ id: "NY", name: "New York" },
|
|
{ id: "TOR", name: "Toronto" },
|
|
{ id: "AMS", name: "Amsterdam" },
|
|
{ id: "LON", name: "London" },
|
|
{ id: "FFT", name: "Frankfurt" },
|
|
{ id: "SNG", name: "Singapore" },
|
|
{ id: "BNG", name: "Bangalore" },
|
|
{ id: "SYD", name: "Sydney Australia" }
|
|
],
|
|
timeZones: [
|
|
"Africa/Abidjan",
|
|
"Africa/Accra",
|
|
"Africa/Addis_Ababa",
|
|
"Africa/Algiers",
|
|
"Africa/Asmara",
|
|
"Africa/Asmera",
|
|
"Africa/Bamako",
|
|
"Africa/Bangui",
|
|
"Africa/Banjul",
|
|
"Africa/Bissau",
|
|
"Africa/Blantyre",
|
|
"Africa/Brazzaville",
|
|
"Africa/Bujumbura",
|
|
"Africa/Cairo",
|
|
"Africa/Casablanca",
|
|
"Africa/Ceuta",
|
|
"Africa/Conakry",
|
|
"Africa/Dakar",
|
|
"Africa/Dar_es_Salaam",
|
|
"Africa/Djibouti",
|
|
"Africa/Douala",
|
|
"Africa/El_Aaiun",
|
|
"Africa/Freetown",
|
|
"Africa/Gaborone",
|
|
"Africa/Harare",
|
|
"Africa/Johannesburg",
|
|
"Africa/Juba",
|
|
"Africa/Kampala",
|
|
"Africa/Khartoum",
|
|
"Africa/Kigali",
|
|
"Africa/Kinshasa",
|
|
"Africa/Lagos",
|
|
"Africa/Libreville",
|
|
"Africa/Lome",
|
|
"Africa/Luanda",
|
|
"Africa/Lubumbashi",
|
|
"Africa/Lusaka",
|
|
"Africa/Malabo",
|
|
"Africa/Maputo",
|
|
"Africa/Maseru",
|
|
"Africa/Mbabane",
|
|
"Africa/Mogadishu",
|
|
"Africa/Monrovia",
|
|
"Africa/Nairobi",
|
|
"Africa/Ndjamena",
|
|
"Africa/Niamey",
|
|
"Africa/Nouakchott",
|
|
"Africa/Ouagadougou",
|
|
"Africa/Porto-Novo",
|
|
"Africa/Sao_Tome",
|
|
"Africa/Timbuktu",
|
|
"Africa/Tripoli",
|
|
"Africa/Tunis",
|
|
"Africa/Windhoek",
|
|
"America/Adak",
|
|
"America/Anchorage",
|
|
"America/Anguilla",
|
|
"America/Antigua",
|
|
"America/Araguaina",
|
|
"America/Argentina/Buenos_Aires",
|
|
"America/Argentina/Catamarca",
|
|
"America/Argentina/ComodRivadavia",
|
|
"America/Argentina/Cordoba",
|
|
"America/Argentina/Jujuy",
|
|
"America/Argentina/La_Rioja",
|
|
"America/Argentina/Mendoza",
|
|
"America/Argentina/Rio_Gallegos",
|
|
"America/Argentina/Salta",
|
|
"America/Argentina/San_Juan",
|
|
"America/Argentina/San_Luis",
|
|
"America/Argentina/Tucuman",
|
|
"America/Argentina/Ushuaia",
|
|
"America/Aruba",
|
|
"America/Asuncion",
|
|
"America/Atikokan",
|
|
"America/Atka",
|
|
"America/Bahia",
|
|
"America/Bahia_Banderas",
|
|
"America/Barbados",
|
|
"America/Belem",
|
|
"America/Belize",
|
|
"America/Blanc-Sablon",
|
|
"America/Boa_Vista",
|
|
"America/Bogota",
|
|
"America/Boise",
|
|
"America/Buenos_Aires",
|
|
"America/Cambridge_Bay",
|
|
"America/Campo_Grande",
|
|
"America/Cancun",
|
|
"America/Caracas",
|
|
"America/Catamarca",
|
|
"America/Cayenne",
|
|
"America/Cayman",
|
|
"America/Chicago",
|
|
"America/Chihuahua",
|
|
"America/Ciudad_Juarez",
|
|
"America/Coral_Harbour",
|
|
"America/Cordoba",
|
|
"America/Costa_Rica",
|
|
"America/Creston",
|
|
"America/Cuiaba",
|
|
"America/Curacao",
|
|
"America/Danmarkshavn",
|
|
"America/Dawson",
|
|
"America/Dawson_Creek",
|
|
"America/Denver",
|
|
"America/Detroit",
|
|
"America/Dominica",
|
|
"America/Edmonton",
|
|
"America/Eirunepe",
|
|
"America/El_Salvador",
|
|
"America/Ensenada",
|
|
"America/Fort_Nelson",
|
|
"America/Fort_Wayne",
|
|
"America/Fortaleza",
|
|
"America/Glace_Bay",
|
|
"America/Godthab",
|
|
"America/Goose_Bay",
|
|
"America/Grand_Turk",
|
|
"America/Grenada",
|
|
"America/Guadeloupe",
|
|
"America/Guatemala",
|
|
"America/Guayaquil",
|
|
"America/Guyana",
|
|
"America/Halifax",
|
|
"America/Havana",
|
|
"America/Hermosillo",
|
|
"America/Indiana/Indianapolis",
|
|
"America/Indiana/Knox",
|
|
"America/Indiana/Marengo",
|
|
"America/Indiana/Petersburg",
|
|
"America/Indiana/Tell_City",
|
|
"America/Indiana/Vevay",
|
|
"America/Indiana/Vincennes",
|
|
"America/Indiana/Winamac",
|
|
"America/Indianapolis",
|
|
"America/Inuvik",
|
|
"America/Iqaluit",
|
|
"America/Jamaica",
|
|
"America/Jujuy",
|
|
"America/Juneau",
|
|
"America/Kentucky/Louisville",
|
|
"America/Kentucky/Monticello",
|
|
"America/Knox_IN",
|
|
"America/Kralendijk",
|
|
"America/La_Paz",
|
|
"America/Lima",
|
|
"America/Los_Angeles",
|
|
"America/Louisville",
|
|
"America/Lower_Princes",
|
|
"America/Maceio",
|
|
"America/Managua",
|
|
"America/Manaus",
|
|
"America/Marigot",
|
|
"America/Martinique",
|
|
"America/Matamoros",
|
|
"America/Mazatlan",
|
|
"America/Mendoza",
|
|
"America/Menominee",
|
|
"America/Merida",
|
|
"America/Metlakatla",
|
|
"America/Mexico_City",
|
|
"America/Miquelon",
|
|
"America/Moncton",
|
|
"America/Monterrey",
|
|
"America/Montevideo",
|
|
"America/Montreal",
|
|
"America/Montserrat",
|
|
"America/Nassau",
|
|
"America/New_York",
|
|
"America/Nipigon",
|
|
"America/Nome",
|
|
"America/Noronha",
|
|
"America/North_Dakota/Beulah",
|
|
"America/North_Dakota/Center",
|
|
"America/North_Dakota/New_Salem",
|
|
"America/Nuuk",
|
|
"America/Ojinaga",
|
|
"America/Panama",
|
|
"America/Pangnirtung",
|
|
"America/Paramaribo",
|
|
"America/Phoenix",
|
|
"America/Port-au-Prince",
|
|
"America/Port_of_Spain",
|
|
"America/Porto_Acre",
|
|
"America/Porto_Velho",
|
|
"America/Puerto_Rico",
|
|
"America/Punta_Arenas",
|
|
"America/Rainy_River",
|
|
"America/Rankin_Inlet",
|
|
"America/Recife",
|
|
"America/Regina",
|
|
"America/Resolute",
|
|
"America/Rio_Branco",
|
|
"America/Rosario",
|
|
"America/Santa_Isabel",
|
|
"America/Santarem",
|
|
"America/Santiago",
|
|
"America/Santo_Domingo",
|
|
"America/Sao_Paulo",
|
|
"America/Scoresbysund",
|
|
"America/Shiprock",
|
|
"America/Sitka",
|
|
"America/St_Barthelemy",
|
|
"America/St_Johns",
|
|
"America/St_Kitts",
|
|
"America/St_Lucia",
|
|
"America/St_Thomas",
|
|
"America/St_Vincent",
|
|
"America/Swift_Current",
|
|
"America/Tegucigalpa",
|
|
"America/Thule",
|
|
"America/Thunder_Bay",
|
|
"America/Tijuana",
|
|
"America/Toronto",
|
|
"America/Tortola",
|
|
"America/Vancouver",
|
|
"America/Virgin",
|
|
"America/Whitehorse",
|
|
"America/Winnipeg",
|
|
"America/Yakutat",
|
|
"America/Yellowknife",
|
|
"Antarctica/Casey",
|
|
"Antarctica/Davis",
|
|
"Antarctica/DumontDUrville",
|
|
"Antarctica/Macquarie",
|
|
"Antarctica/Mawson",
|
|
"Antarctica/McMurdo",
|
|
"Antarctica/Palmer",
|
|
"Antarctica/Rothera",
|
|
"Antarctica/South_Pole",
|
|
"Antarctica/Syowa",
|
|
"Antarctica/Troll",
|
|
"Antarctica/Vostok",
|
|
"Arctic/Longyearbyen",
|
|
"Asia/Aden",
|
|
"Asia/Almaty",
|
|
"Asia/Amman",
|
|
"Asia/Anadyr",
|
|
"Asia/Aqtau",
|
|
"Asia/Aqtobe",
|
|
"Asia/Ashgabat",
|
|
"Asia/Ashkhabad",
|
|
"Asia/Atyrau",
|
|
"Asia/Baghdad",
|
|
"Asia/Bahrain",
|
|
"Asia/Baku",
|
|
"Asia/Bangkok",
|
|
"Asia/Barnaul",
|
|
"Asia/Beirut",
|
|
"Asia/Bishkek",
|
|
"Asia/Brunei",
|
|
"Asia/Calcutta",
|
|
"Asia/Chita",
|
|
"Asia/Choibalsan",
|
|
"Asia/Chongqing",
|
|
"Asia/Chungking",
|
|
"Asia/Colombo",
|
|
"Asia/Dacca",
|
|
"Asia/Damascus",
|
|
"Asia/Dhaka",
|
|
"Asia/Dili",
|
|
"Asia/Dubai",
|
|
"Asia/Dushanbe",
|
|
"Asia/Famagusta",
|
|
"Asia/Gaza",
|
|
"Asia/Harbin",
|
|
"Asia/Hebron",
|
|
"Asia/Ho_Chi_Minh",
|
|
"Asia/Hong_Kong",
|
|
"Asia/Hovd",
|
|
"Asia/Irkutsk",
|
|
"Asia/Istanbul",
|
|
"Asia/Jakarta",
|
|
"Asia/Jayapura",
|
|
"Asia/Jerusalem",
|
|
"Asia/Kabul",
|
|
"Asia/Kamchatka",
|
|
"Asia/Karachi",
|
|
"Asia/Kashgar",
|
|
"Asia/Kathmandu",
|
|
"Asia/Katmandu",
|
|
"Asia/Khandyga",
|
|
"Asia/Kolkata",
|
|
"Asia/Krasnoyarsk",
|
|
"Asia/Kuala_Lumpur",
|
|
"Asia/Kuching",
|
|
"Asia/Kuwait",
|
|
"Asia/Macao",
|
|
"Asia/Macau",
|
|
"Asia/Magadan",
|
|
"Asia/Makassar",
|
|
"Asia/Manila",
|
|
"Asia/Muscat",
|
|
"Asia/Nicosia",
|
|
"Asia/Novokuznetsk",
|
|
"Asia/Novosibirsk",
|
|
"Asia/Omsk",
|
|
"Asia/Oral",
|
|
"Asia/Phnom_Penh",
|
|
"Asia/Pontianak",
|
|
"Asia/Pyongyang",
|
|
"Asia/Qatar",
|
|
"Asia/Qostanay",
|
|
"Asia/Qyzylorda",
|
|
"Asia/Rangoon",
|
|
"Asia/Riyadh",
|
|
"Asia/Saigon",
|
|
"Asia/Sakhalin",
|
|
"Asia/Samarkand",
|
|
"Asia/Seoul",
|
|
"Asia/Shanghai",
|
|
"Asia/Singapore",
|
|
"Asia/Srednekolymsk",
|
|
"Asia/Taipei",
|
|
"Asia/Tashkent",
|
|
"Asia/Tbilisi",
|
|
"Asia/Tehran",
|
|
"Asia/Tel_Aviv",
|
|
"Asia/Thimbu",
|
|
"Asia/Thimphu",
|
|
"Asia/Tokyo",
|
|
"Asia/Tomsk",
|
|
"Asia/Ujung_Pandang",
|
|
"Asia/Ulaanbaatar",
|
|
"Asia/Ulan_Bator",
|
|
"Asia/Urumqi",
|
|
"Asia/Ust-Nera",
|
|
"Asia/Vientiane",
|
|
"Asia/Vladivostok",
|
|
"Asia/Yakutsk",
|
|
"Asia/Yangon",
|
|
"Asia/Yekaterinburg",
|
|
"Asia/Yerevan",
|
|
"Atlantic/Azores",
|
|
"Atlantic/Bermuda",
|
|
"Atlantic/Canary",
|
|
"Atlantic/Cape_Verde",
|
|
"Atlantic/Faeroe",
|
|
"Atlantic/Faroe",
|
|
"Atlantic/Jan_Mayen",
|
|
"Atlantic/Madeira",
|
|
"Atlantic/Reykjavik",
|
|
"Atlantic/South_Georgia",
|
|
"Atlantic/St_Helena",
|
|
"Atlantic/Stanley",
|
|
"Australia/ACT",
|
|
"Australia/Adelaide",
|
|
"Australia/Brisbane",
|
|
"Australia/Broken_Hill",
|
|
"Australia/Canberra",
|
|
"Australia/Currie",
|
|
"Australia/Darwin",
|
|
"Australia/Eucla",
|
|
"Australia/Hobart",
|
|
"Australia/LHI",
|
|
"Australia/Lindeman",
|
|
"Australia/Lord_Howe",
|
|
"Australia/Melbourne",
|
|
"Australia/NSW",
|
|
"Australia/North",
|
|
"Australia/Perth",
|
|
"Australia/Queensland",
|
|
"Australia/South",
|
|
"Australia/Sydney",
|
|
"Australia/Tasmania",
|
|
"Australia/Victoria",
|
|
"Australia/West",
|
|
"Australia/Yancowinna",
|
|
"Brazil/Acre",
|
|
"Brazil/DeNoronha",
|
|
"Brazil/East",
|
|
"Brazil/West",
|
|
"CET",
|
|
"CST6CDT",
|
|
"Canada/Atlantic",
|
|
"Canada/Central",
|
|
"Canada/Eastern",
|
|
"Canada/Mountain",
|
|
"Canada/Newfoundland",
|
|
"Canada/Pacific",
|
|
"Canada/Saskatchewan",
|
|
"Canada/Yukon",
|
|
"Chile/Continental",
|
|
"Chile/EasterIsland",
|
|
"Cuba",
|
|
"EET",
|
|
"EST",
|
|
"EST5EDT",
|
|
"Egypt",
|
|
"Eire",
|
|
"Etc/GMT",
|
|
"Etc/GMT+0",
|
|
"Etc/GMT+1",
|
|
"Etc/GMT+10",
|
|
"Etc/GMT+11",
|
|
"Etc/GMT+12",
|
|
"Etc/GMT+2",
|
|
"Etc/GMT+3",
|
|
"Etc/GMT+4",
|
|
"Etc/GMT+5",
|
|
"Etc/GMT+6",
|
|
"Etc/GMT+7",
|
|
"Etc/GMT+8",
|
|
"Etc/GMT+9",
|
|
"Etc/GMT-0",
|
|
"Etc/GMT-1",
|
|
"Etc/GMT-10",
|
|
"Etc/GMT-11",
|
|
"Etc/GMT-12",
|
|
"Etc/GMT-13",
|
|
"Etc/GMT-14",
|
|
"Etc/GMT-2",
|
|
"Etc/GMT-3",
|
|
"Etc/GMT-4",
|
|
"Etc/GMT-5",
|
|
"Etc/GMT-6",
|
|
"Etc/GMT-7",
|
|
"Etc/GMT-8",
|
|
"Etc/GMT-9",
|
|
"Etc/GMT0",
|
|
"Etc/Greenwich",
|
|
"Etc/UCT",
|
|
"Etc/UTC",
|
|
"Etc/Universal",
|
|
"Etc/Zulu",
|
|
"Europe/Amsterdam",
|
|
"Europe/Andorra",
|
|
"Europe/Astrakhan",
|
|
"Europe/Athens",
|
|
"Europe/Belfast",
|
|
"Europe/Belgrade",
|
|
"Europe/Berlin",
|
|
"Europe/Bratislava",
|
|
"Europe/Brussels",
|
|
"Europe/Bucharest",
|
|
"Europe/Budapest",
|
|
"Europe/Busingen",
|
|
"Europe/Chisinau",
|
|
"Europe/Copenhagen",
|
|
"Europe/Dublin",
|
|
"Europe/Gibraltar",
|
|
"Europe/Guernsey",
|
|
"Europe/Helsinki",
|
|
"Europe/Isle_of_Man",
|
|
"Europe/Istanbul",
|
|
"Europe/Jersey",
|
|
"Europe/Kaliningrad",
|
|
"Europe/Kiev",
|
|
"Europe/Kirov",
|
|
"Europe/Kyiv",
|
|
"Europe/Lisbon",
|
|
"Europe/Ljubljana",
|
|
"Europe/London",
|
|
"Europe/Luxembourg",
|
|
"Europe/Madrid",
|
|
"Europe/Malta",
|
|
"Europe/Mariehamn",
|
|
"Europe/Minsk",
|
|
"Europe/Monaco",
|
|
"Europe/Moscow",
|
|
"Europe/Nicosia",
|
|
"Europe/Oslo",
|
|
"Europe/Paris",
|
|
"Europe/Podgorica",
|
|
"Europe/Prague",
|
|
"Europe/Riga",
|
|
"Europe/Rome",
|
|
"Europe/Samara",
|
|
"Europe/San_Marino",
|
|
"Europe/Sarajevo",
|
|
"Europe/Saratov",
|
|
"Europe/Simferopol",
|
|
"Europe/Skopje",
|
|
"Europe/Sofia",
|
|
"Europe/Stockholm",
|
|
"Europe/Tallinn",
|
|
"Europe/Tirane",
|
|
"Europe/Tiraspol",
|
|
"Europe/Ulyanovsk",
|
|
"Europe/Uzhgorod",
|
|
"Europe/Vaduz",
|
|
"Europe/Vatican",
|
|
"Europe/Vienna",
|
|
"Europe/Vilnius",
|
|
"Europe/Volgograd",
|
|
"Europe/Warsaw",
|
|
"Europe/Zagreb",
|
|
"Europe/Zaporozhye",
|
|
"Europe/Zurich",
|
|
"Factory",
|
|
"GB",
|
|
"GB-Eire",
|
|
"GMT",
|
|
"GMT+0",
|
|
"GMT-0",
|
|
"GMT0",
|
|
"Greenwich",
|
|
"HST",
|
|
"Hongkong",
|
|
"Iceland",
|
|
"Indian/Antananarivo",
|
|
"Indian/Chagos",
|
|
"Indian/Christmas",
|
|
"Indian/Cocos",
|
|
"Indian/Comoro",
|
|
"Indian/Kerguelen",
|
|
"Indian/Mahe",
|
|
"Indian/Maldives",
|
|
"Indian/Mauritius",
|
|
"Indian/Mayotte",
|
|
"Indian/Reunion",
|
|
"Iran",
|
|
"Israel",
|
|
"Jamaica",
|
|
"Japan",
|
|
"Kwajalein",
|
|
"Libya",
|
|
"MET",
|
|
"MST",
|
|
"MST7MDT",
|
|
"Mexico/BajaNorte",
|
|
"Mexico/BajaSur",
|
|
"Mexico/General",
|
|
"NZ",
|
|
"NZ-CHAT",
|
|
"Navajo",
|
|
"PRC",
|
|
"PST8PDT",
|
|
"Pacific/Apia",
|
|
"Pacific/Auckland",
|
|
"Pacific/Bougainville",
|
|
"Pacific/Chatham",
|
|
"Pacific/Chuuk",
|
|
"Pacific/Easter",
|
|
"Pacific/Efate",
|
|
"Pacific/Enderbury",
|
|
"Pacific/Fakaofo",
|
|
"Pacific/Fiji",
|
|
"Pacific/Funafuti",
|
|
"Pacific/Galapagos",
|
|
"Pacific/Gambier",
|
|
"Pacific/Guadalcanal",
|
|
"Pacific/Guam",
|
|
"Pacific/Honolulu",
|
|
"Pacific/Johnston",
|
|
"Pacific/Kanton",
|
|
"Pacific/Kiritimati",
|
|
"Pacific/Kosrae",
|
|
"Pacific/Kwajalein",
|
|
"Pacific/Majuro",
|
|
"Pacific/Marquesas",
|
|
"Pacific/Midway",
|
|
"Pacific/Nauru",
|
|
"Pacific/Niue",
|
|
"Pacific/Norfolk",
|
|
"Pacific/Noumea",
|
|
"Pacific/Pago_Pago",
|
|
"Pacific/Palau",
|
|
"Pacific/Pitcairn",
|
|
"Pacific/Pohnpei",
|
|
"Pacific/Ponape",
|
|
"Pacific/Port_Moresby",
|
|
"Pacific/Rarotonga",
|
|
"Pacific/Saipan",
|
|
"Pacific/Samoa",
|
|
"Pacific/Tahiti",
|
|
"Pacific/Tarawa",
|
|
"Pacific/Tongatapu",
|
|
"Pacific/Truk",
|
|
"Pacific/Wake",
|
|
"Pacific/Wallis",
|
|
"Pacific/Yap",
|
|
"Poland",
|
|
"Portugal",
|
|
"ROC",
|
|
"ROK",
|
|
"Singapore",
|
|
"Turkey",
|
|
"UCT",
|
|
"US/Alaska",
|
|
"US/Aleutian",
|
|
"US/Arizona",
|
|
"US/Central",
|
|
"US/East-Indiana",
|
|
"US/Eastern",
|
|
"US/Hawaii",
|
|
"US/Indiana-Starke",
|
|
"US/Michigan",
|
|
"US/Mountain",
|
|
"US/Pacific",
|
|
"US/Samoa",
|
|
"UTC",
|
|
"Universal",
|
|
"W-SU",
|
|
"WET",
|
|
"Zulu"
|
|
]
|
|
},
|
|
formState: {
|
|
ready: false,
|
|
dirty: false,
|
|
valid: true,
|
|
readOnly: false,
|
|
loading: true,
|
|
errorBoxMessage: null,
|
|
appError: null,
|
|
serverError: {}
|
|
},
|
|
rights: window.$gz.role.defaultRightsObject(),
|
|
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
|
|
sockType: window.$gz.type.SubscriptionServer
|
|
};
|
|
},
|
|
watch: {
|
|
formState: {
|
|
handler: function(val) {
|
|
if (this.formState.loading) {
|
|
return;
|
|
}
|
|
|
|
if (val.dirty && val.valid && !val.readOnly) {
|
|
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":save");
|
|
} else {
|
|
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save");
|
|
}
|
|
|
|
if (!val.dirty && val.valid && !val.readOnly) {
|
|
window.$gz.eventBus.$emit(
|
|
"menu-enable-item",
|
|
FORM_KEY + ":duplicate"
|
|
);
|
|
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":new");
|
|
} else {
|
|
window.$gz.eventBus.$emit(
|
|
"menu-disable-item",
|
|
FORM_KEY + ":duplicate"
|
|
);
|
|
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":new");
|
|
}
|
|
},
|
|
deep: true
|
|
}
|
|
},
|
|
async created() {
|
|
const vm = this;
|
|
try {
|
|
await initForm(vm);
|
|
vm.rights = window.$gz.role.getRights(window.$gz.type.SubscriptionServer);
|
|
vm.formState.readOnly = !vm.rights.change;
|
|
window.$gz.eventBus.$on("menu-click", clickHandler);
|
|
//---------------------------------
|
|
let setDirty = false;
|
|
//id 0 means create or duplicate to new
|
|
if (vm.$route.params.recordid != 0) {
|
|
//is there already an obj from a prior operation?
|
|
if (this.$route.params.obj) {
|
|
//yes, no need to fetch it
|
|
this.obj = this.$route.params.obj;
|
|
} else {
|
|
await vm.getDataFromApi(vm.$route.params.recordid);
|
|
}
|
|
} else {
|
|
//Might be a duplicate and contain another record
|
|
if (this.$route.params.obj) {
|
|
this.obj = this.$route.params.obj;
|
|
this.obj.concurrency = undefined;
|
|
this.obj.id = 0;
|
|
this.obj.name = `${this.obj.name} - ${window.$gz.translation.get(
|
|
"Copy"
|
|
)}`;
|
|
setDirty = true;
|
|
}
|
|
}
|
|
window.$gz.form.setFormState({
|
|
vm: vm,
|
|
loading: false,
|
|
dirty: setDirty,
|
|
valid: true
|
|
});
|
|
//----------------------------
|
|
generateMenu(vm);
|
|
} catch (error) {
|
|
window.$gz.errorHandler.handleFormError(error, vm);
|
|
} finally {
|
|
vm.formState.ready = true;
|
|
}
|
|
},
|
|
async beforeRouteLeave(to, from, next) {
|
|
if (!this.formState.dirty || JUST_DELETED) {
|
|
next();
|
|
return;
|
|
}
|
|
if ((await window.$gz.dialog.confirmLeaveUnsaved()) === true) {
|
|
next();
|
|
} else {
|
|
next(false);
|
|
}
|
|
},
|
|
beforeDestroy() {
|
|
window.$gz.eventBus.$off("menu-click", clickHandler);
|
|
},
|
|
methods: {
|
|
subExpireAddOneWeek: function() {
|
|
// // eslint-disable-next-line
|
|
// debugger;
|
|
const now = window.$gz.locale.nowUTC8601String(this.timeZoneName);
|
|
this.obj.subscriptionExpire = window.$gz.locale.addDurationToUTC8601String(
|
|
now,
|
|
{
|
|
days: 7
|
|
}
|
|
);
|
|
},
|
|
subExpireAddOneMonth: function() {
|
|
const now = window.$gz.locale.nowUTC8601String(this.timeZoneName);
|
|
this.obj.subscriptionExpire = window.$gz.locale.addDurationToUTC8601String(
|
|
now,
|
|
{
|
|
months: 1
|
|
}
|
|
);
|
|
},
|
|
subExpireAddOneYear: function() {
|
|
const now = window.$gz.locale.nowUTC8601String(this.timeZoneName);
|
|
this.obj.subscriptionExpire = window.$gz.locale.addDurationToUTC8601String(
|
|
now,
|
|
{
|
|
years: 1
|
|
}
|
|
);
|
|
},
|
|
canSave: function() {
|
|
return this.formState.valid && this.formState.dirty;
|
|
},
|
|
canDuplicate: function() {
|
|
return this.formState.valid && !this.formState.dirty;
|
|
},
|
|
sockTypes: function() {
|
|
return window.$gz.type;
|
|
},
|
|
form() {
|
|
return window.$gz.form;
|
|
},
|
|
fieldValueChanged(ref) {
|
|
if (
|
|
this.formState.ready &&
|
|
!this.formState.loading &&
|
|
!this.formState.readOnly
|
|
) {
|
|
window.$gz.form.fieldValueChanged(this, ref);
|
|
}
|
|
},
|
|
async getDataFromApi(recordId) {
|
|
const vm = this;
|
|
window.$gz.form.setFormState({
|
|
vm: vm,
|
|
loading: true
|
|
});
|
|
if (!recordId) {
|
|
throw new Error(FORM_KEY + "::getDataFromApi -> Missing recordID!");
|
|
}
|
|
try {
|
|
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
|
const res = await window.$gz.api.get(API_BASE_URL + recordId);
|
|
if (res.error) {
|
|
if (res.error.code == "2010") {
|
|
window.$gz.form.handleObjectNotFound(vm);
|
|
}
|
|
vm.formState.serverError = res.error;
|
|
window.$gz.form.setErrorBoxErrors(vm);
|
|
} else {
|
|
vm.obj = res.data;
|
|
generateMenu(vm);
|
|
window.$gz.form.setFormState({
|
|
vm: vm,
|
|
dirty: false,
|
|
valid: true,
|
|
loading: false
|
|
});
|
|
}
|
|
} catch (error) {
|
|
window.$gz.errorHandler.handleFormError(error, vm);
|
|
} finally {
|
|
window.$gz.form.setFormState({
|
|
vm: vm,
|
|
loading: false
|
|
});
|
|
}
|
|
},
|
|
async submit() {
|
|
const vm = this;
|
|
if (vm.canSave == false) {
|
|
return;
|
|
}
|
|
try {
|
|
window.$gz.form.setFormState({
|
|
vm: vm,
|
|
loading: true
|
|
});
|
|
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
|
//case 4600: expiry is hidden and unused for a paid server, but the record still needs a date
|
|
if (!vm.obj.trial && !vm.obj.subscriptionExpire) {
|
|
vm.obj.subscriptionExpire = window.$gz.locale.nowUTC8601String();
|
|
}
|
|
if (vm.obj.operatingSystem == null) {
|
|
vm.obj.operatingSystem = "Ubuntu 22.10";
|
|
}
|
|
if (vm.obj.cost == 0) {
|
|
vm.obj.cost = 7.0;
|
|
}
|
|
const res = await window.$gz.api.upsert(API_BASE_URL, vm.obj);
|
|
if (res.error) {
|
|
vm.formState.serverError = res.error;
|
|
window.$gz.form.setErrorBoxErrors(vm);
|
|
} else {
|
|
if (res.data.id) {
|
|
//POST
|
|
vm.obj = res.data;
|
|
this.$router.replace({
|
|
name: "subscription-server-edit",
|
|
params: {
|
|
recordid: res.data.id,
|
|
obj: res.data
|
|
}
|
|
});
|
|
} else {
|
|
//PUT
|
|
vm.obj.concurrency = res.data.concurrency;
|
|
}
|
|
window.$gz.form.setFormState({
|
|
vm: vm,
|
|
dirty: false,
|
|
valid: true
|
|
});
|
|
}
|
|
} catch (ex) {
|
|
window.$gz.errorHandler.handleFormError(ex, vm);
|
|
} finally {
|
|
window.$gz.form.setFormState({
|
|
vm: vm,
|
|
loading: false
|
|
});
|
|
}
|
|
},
|
|
async remove() {
|
|
try {
|
|
const dialogResult = await window.$gz.dialog.confirmDelete();
|
|
if (dialogResult != true) {
|
|
return;
|
|
}
|
|
window.$gz.form.setFormState({
|
|
vm: this,
|
|
loading: true
|
|
});
|
|
|
|
if (this.$route.params.recordid == 0) {
|
|
JUST_DELETED = true;
|
|
|
|
this.$router.go(-1);
|
|
} else {
|
|
window.$gz.form.deleteAllErrorBoxErrors(this);
|
|
const res = await window.$gz.api.remove(
|
|
API_BASE_URL + this.$route.params.recordid
|
|
);
|
|
if (res.error) {
|
|
this.formState.serverError = res.error;
|
|
window.$gz.form.setErrorBoxErrors(this);
|
|
} else {
|
|
JUST_DELETED = true;
|
|
this.$router.go(-1);
|
|
}
|
|
}
|
|
} catch (error) {
|
|
window.$gz.errorHandler.handleFormError(error, this);
|
|
} finally {
|
|
window.$gz.form.setFormState({
|
|
vm: this,
|
|
loading: false
|
|
});
|
|
}
|
|
},
|
|
duplicate() {
|
|
this.$router.push({
|
|
name: "subscription-server-edit",
|
|
params: {
|
|
recordid: 0,
|
|
obj: this.obj
|
|
}
|
|
});
|
|
}
|
|
}
|
|
};
|
|
|
|
/////////////////////////////
|
|
//
|
|
//
|
|
async function clickHandler(menuItem) {
|
|
if (!menuItem) {
|
|
return;
|
|
}
|
|
const m = window.$gz.menu.parseMenuItem(menuItem);
|
|
if (m.owner == FORM_KEY && !m.disabled) {
|
|
switch (m.key) {
|
|
case "save":
|
|
m.vm.submit();
|
|
break;
|
|
case "delete":
|
|
m.vm.remove();
|
|
break;
|
|
case "new":
|
|
m.vm.$router.push({
|
|
name: "subscription-server-edit",
|
|
params: { recordid: 0 }
|
|
});
|
|
break;
|
|
case "duplicate":
|
|
m.vm.duplicate();
|
|
break;
|
|
case "report":
|
|
{
|
|
const res = await m.vm.$refs.reportSelector.open(
|
|
{
|
|
AType: window.$gz.type.SubscriptionServer,
|
|
selectedRowIds: [m.vm.obj.id]
|
|
},
|
|
m.id
|
|
);
|
|
if (res == null) {
|
|
return;
|
|
}
|
|
window.$gz.form.setLastReportMenuItem(FORM_KEY, res, m.vm);
|
|
}
|
|
break;
|
|
// case "terminal":
|
|
// alert("putty -agent -ssh sportseffect.onayanova.com");
|
|
// break;
|
|
case "script":
|
|
window.$gz.util.copyToClipboard(
|
|
`#!/bin/bash
|
|
|
|
# 1) create new droplet **DO NOT PICK IPV6 just the monitoring option**
|
|
# 2) immediately set subdomain name in networking
|
|
# 3) Add droplet into raven-server-standard-firewall
|
|
# 4) check DNS available using https://letsdebug.net/
|
|
# 5) Open putty, select X.onayanova.com, change ip to new droplet domain name and open it
|
|
# 6) apt-get update && apt-get dist-upgrade reboot
|
|
# 7) TRIAL: make calendar entry 8 days hence to decommision and blueberry color reminder 0 days 11am
|
|
# 8) nano ayinit.sh paste in this
|
|
# 9) CHANGE the values at the top of the script to the desired time zone (see rfdocs for list) and subdomain, Save and exit nano
|
|
# 9) chmod a+x ayinit.sh
|
|
# 10) ./ayinit.sh
|
|
# Done. If trial use response email template from rfdocs and set server path
|
|
|
|
TIMEZONE='${m.vm.obj.timeZone}'
|
|
DOMAINNAME='${m.vm.obj.name}'
|
|
|
|
|
|
#############################
|
|
echo STARTING...
|
|
timedatectl set-timezone $TIMEZONE
|
|
# no phased updates, so weekly updates match what was tested on devtest first
|
|
echo 'APT::Get::Never-Include-Phased-Updates "true";' > /etc/apt/apt.conf.d/52no-phasing
|
|
apt-get update
|
|
apt-get dist-upgrade -y
|
|
dpkg-reconfigure unattended-upgrades
|
|
echo SET SWAP FILE
|
|
fallocate -l 1G /swapfile
|
|
chmod 600 /swapfile
|
|
mkswap /swapfile
|
|
swapon /swapfile
|
|
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
|
|
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
|
|
echo 'vm.vfs_cache_pressure=50' | sudo tee -a /etc/sysctl.conf
|
|
echo INSTALL .NET CORE
|
|
apt-get install -y aspnetcore-runtime-10.0
|
|
echo GENERATE SERVER SECRETS
|
|
# unique per server, letters and digits only so they are safe in SQL, JSON and the connection string
|
|
DBPASSWORD=$(openssl rand -hex 24)
|
|
JWTSECRET=$(openssl rand -hex 16)
|
|
echo "PostgreSQL postgres password: $DBPASSWORD" > /root/ayanova-secrets.txt
|
|
echo "AYANOVA_JWT_SECRET: $JWTSECRET" >> /root/ayanova-secrets.txt
|
|
chmod 600 /root/ayanova-secrets.txt
|
|
echo INSTALL POSTGRESQL
|
|
# PostgreSQL project repository (same PostgreSQL build on every Ubuntu release); apt-key no longer exists on newer Ubuntu
|
|
apt-get install -y postgresql-common
|
|
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
|
|
sudo apt-get -y install postgresql
|
|
sudo -u postgres psql -U postgres -d postgres -c "alter user postgres with password '$DBPASSWORD';"
|
|
echo INSTALL REPORTING LIBS
|
|
|
|
# Ubuntu 24.04 and 26.04
|
|
sudo apt-get update
|
|
sudo apt-get install -y libatk1.0-0t64 libc6 libcairo2 libdbus-1-3 libexpat1 libfontconfig1 libgcc-s1 libgdk-pixbuf-2.0-0 libglib2.0-0t64 libgtk-3-0t64 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libnss3 lsb-release libgbm-dev xdg-utils
|
|
sudo apt-get update
|
|
sudo apt-get install -y libatk-bridge2.0-0t64 libcups2t64 libxcomposite1 libxdamage1 libpangocairo-1.0-0 libxfixes3 libxrandr2 libgbm1 libcairo2 libpango-1.0-0 libasound2t64 wget
|
|
# NOTE: for future releases of ubuntu when need to update packages this was helpful https://itsfoss.com/unable-to-locate-package-error-ubuntu/
|
|
echo INSTALL AYANOVA
|
|
apt install zip unzip -y
|
|
mkdir /var/ayanova
|
|
mkdir /var/ayanova/data
|
|
cd /var/ayanova
|
|
curl -O https://www.ayanova.com/download/ayanova-subscription-linux-x64-server.zip && unzip -o ayanova-subscription-linux-x64-server.zip
|
|
# put this server's own secrets in place of the shipped defaults
|
|
sed -i "s/Password=YOUR_PASSWORD_HERE;/Password=$DBPASSWORD;/" /var/ayanova/config.json
|
|
sed -i "s/12345YourRandom32CharacterSecret/$JWTSECRET/" /var/ayanova/config.json
|
|
# nginx is the only way in: listen on this server only, not on its public address
|
|
sed -i 's#http://[*]:7575#http://127.0.0.1:7575#' /var/ayanova/config.json
|
|
chown -vR :www-data /var/ayanova
|
|
# program files read only for the service account; it writes to data only
|
|
chmod -R go-w /var/ayanova
|
|
chmod -R g+rw /var/ayanova/data
|
|
# config.json holds the database password: readable by root and the service group only
|
|
chmod 640 /var/ayanova/config.json
|
|
echo '[Unit]' >> /etc/systemd/system/ayanova.service
|
|
echo 'Description=AyaNova server' >> /etc/systemd/system/ayanova.service
|
|
echo '' >> /etc/systemd/system/ayanova.service
|
|
echo '[Service]' >> /etc/systemd/system/ayanova.service
|
|
echo 'WorkingDirectory=/var/ayanova' >> /etc/systemd/system/ayanova.service
|
|
echo 'ExecStart=/usr/bin/dotnet /var/ayanova/AyaNova.dll' >> /etc/systemd/system/ayanova.service
|
|
echo 'Restart=always' >> /etc/systemd/system/ayanova.service
|
|
echo 'RestartSec=10' >> /etc/systemd/system/ayanova.service
|
|
echo 'KillSignal=SIGINT' >> /etc/systemd/system/ayanova.service
|
|
echo 'SyslogIdentifier=ayanova-server' >> /etc/systemd/system/ayanova.service
|
|
echo 'User=www-data' >> /etc/systemd/system/ayanova.service
|
|
echo 'Environment=ASPNETCORE_ENVIRONMENT=Production' >> /etc/systemd/system/ayanova.service
|
|
echo 'Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false' >> /etc/systemd/system/ayanova.service
|
|
echo 'NoNewPrivileges=true' >> /etc/systemd/system/ayanova.service
|
|
echo 'ProtectSystem=strict' >> /etc/systemd/system/ayanova.service
|
|
echo 'ReadWritePaths=/var/ayanova/data' >> /etc/systemd/system/ayanova.service
|
|
echo 'PrivateTmp=true' >> /etc/systemd/system/ayanova.service
|
|
echo 'ProtectHome=true' >> /etc/systemd/system/ayanova.service
|
|
echo '' >> /etc/systemd/system/ayanova.service
|
|
echo '[Install]' >> /etc/systemd/system/ayanova.service
|
|
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/ayanova.service
|
|
systemctl enable ayanova.service
|
|
echo START AYANOVA SERVICE
|
|
systemctl start ayanova.service
|
|
echo INSTALL NGINX
|
|
apt install nginx -y
|
|
echo 'server {' > /etc/nginx/sites-available/default
|
|
echo ' listen 80;' >> /etc/nginx/sites-available/default
|
|
echo " server_name $DOMAINNAME;" >> /etc/nginx/sites-available/default
|
|
echo ' location / {' >> /etc/nginx/sites-available/default
|
|
echo ' add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;' >> /etc/nginx/sites-available/default
|
|
echo ' add_header X-XSS-Protection "1; mode=block" always;' >> /etc/nginx/sites-available/default
|
|
echo ' add_header X-Content-Type-Options "nosniff" always;' >> /etc/nginx/sites-available/default
|
|
echo ' add_header X-Frame-Options "SAMEORIGIN" always;' >> /etc/nginx/sites-available/default
|
|
echo ' add_header Referrer-Policy "strict-origin" always;' >> /etc/nginx/sites-available/default
|
|
echo ' gzip on;' >> /etc/nginx/sites-available/default
|
|
echo ' gzip_vary on;' >> /etc/nginx/sites-available/default
|
|
echo ' gzip_min_length 10240;' >> /etc/nginx/sites-available/default
|
|
echo ' gzip_proxied expired no-cache no-store private auth;' >> /etc/nginx/sites-available/default
|
|
echo ' gzip_http_version 1.1;' >> /etc/nginx/sites-available/default
|
|
echo ' gzip_types application/javascript text/css application/json text/plain;' >> /etc/nginx/sites-available/default
|
|
echo '' >> /etc/nginx/sites-available/default
|
|
echo ' proxy_pass http://127.0.0.1:7575;' >> /etc/nginx/sites-available/default
|
|
echo ' proxy_http_version 1.1;' >> /etc/nginx/sites-available/default
|
|
echo ' proxy_set_header Upgrade $http_upgrade;' >> /etc/nginx/sites-available/default
|
|
echo ' proxy_set_header Connection keep-alive;' >> /etc/nginx/sites-available/default
|
|
echo ' proxy_set_header Host $host;' >> /etc/nginx/sites-available/default
|
|
echo ' proxy_cache_bypass $http_upgrade;' >> /etc/nginx/sites-available/default
|
|
echo ' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' >> /etc/nginx/sites-available/default
|
|
echo ' proxy_set_header X-Forwarded-Proto $scheme;' >> /etc/nginx/sites-available/default
|
|
echo ' proxy_connect_timeout 3600;' >> /etc/nginx/sites-available/default
|
|
echo ' proxy_send_timeout 3600;' >> /etc/nginx/sites-available/default
|
|
echo ' proxy_read_timeout 3600;' >> /etc/nginx/sites-available/default
|
|
echo ' send_timeout 3600; ' >> /etc/nginx/sites-available/default
|
|
echo ' client_max_body_size 25M;' >> /etc/nginx/sites-available/default
|
|
echo ' }' >> /etc/nginx/sites-available/default
|
|
echo '}' >> /etc/nginx/sites-available/default
|
|
systemctl restart nginx
|
|
echo INSTALL CERTBOT
|
|
apt install certbot python3-certbot-nginx -y
|
|
echo GET CERTIFICATE
|
|
certbot --nginx --noninteractive --agree-tos --email ops@onayanova.com --no-eff-email -d $DOMAINNAME
|
|
echo ...COMPLETED
|
|
`
|
|
);
|
|
break;
|
|
|
|
default:
|
|
window.$gz.eventBus.$emit(
|
|
"notify-warning",
|
|
FORM_KEY + "::context click: [" + m.key + "]"
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
//////////////////////
|
|
//
|
|
//
|
|
function generateMenu(vm) {
|
|
const menuOptions = {
|
|
isMain: false,
|
|
readOnly: vm.formState.readOnly,
|
|
icon: "$sockiCloud",
|
|
title: "SubscriptionServer",
|
|
formData: {
|
|
sockType: window.$gz.type.SubscriptionServer,
|
|
recordId: vm.$route.params.recordid,
|
|
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
|
|
recordName: vm.obj.name
|
|
},
|
|
menuItems: []
|
|
};
|
|
|
|
if (vm.rights.change) {
|
|
menuOptions.menuItems.push({
|
|
title: "Save",
|
|
icon: "$sockiSave",
|
|
surface: true,
|
|
key: FORM_KEY + ":save",
|
|
vm: vm
|
|
});
|
|
}
|
|
|
|
menuOptions.menuItems.push({
|
|
title: "Report",
|
|
icon: "$sockiFileAlt",
|
|
key: FORM_KEY + ":report",
|
|
vm: vm
|
|
});
|
|
|
|
const lastReport = window.$gz.form.getLastReport(FORM_KEY);
|
|
if (lastReport != null) {
|
|
menuOptions.menuItems.push({
|
|
title: lastReport.name,
|
|
notrans: true,
|
|
icon: "$sockiFileAlt",
|
|
key: FORM_KEY + ":report:" + lastReport.id,
|
|
vm: vm
|
|
});
|
|
}
|
|
|
|
if (vm.rights.change) {
|
|
menuOptions.menuItems.push({
|
|
title: "New",
|
|
icon: "$sockiPlus",
|
|
key: FORM_KEY + ":new",
|
|
vm: vm
|
|
});
|
|
}
|
|
|
|
if (vm.rights.change && vm.$route.params.recordid != 0) {
|
|
menuOptions.menuItems.push({
|
|
title: "Duplicate",
|
|
icon: "$sockiClone",
|
|
key: FORM_KEY + ":duplicate",
|
|
vm: vm
|
|
});
|
|
}
|
|
if (vm.rights.delete && vm.$route.params.recordid != 0) {
|
|
menuOptions.menuItems.push({
|
|
title: "Delete",
|
|
icon: "$sockiTrashAlt",
|
|
surface: false,
|
|
key: FORM_KEY + ":delete",
|
|
vm: vm
|
|
});
|
|
}
|
|
menuOptions.menuItems.push({ divider: true, inset: false });
|
|
|
|
menuOptions.menuItems.push({
|
|
title: "Droplets",
|
|
icon: "$sockiEgg",
|
|
notrans: true,
|
|
href:
|
|
"https://cloud.digitalocean.com/projects/7c57f24a-378b-40d1-ace0-79f73af89925/resources?i=ce622a",
|
|
target: "_blank",
|
|
key: "droplets"
|
|
});
|
|
|
|
menuOptions.menuItems.push({
|
|
title: "Script",
|
|
notrans: true,
|
|
icon: "$sockiFileCode",
|
|
key: FORM_KEY + ":script",
|
|
vm: vm
|
|
});
|
|
|
|
//
|
|
// menuOptions.menuItems.push({
|
|
// title: "QuoteList",
|
|
// icon: "$sockiPencilAlt",
|
|
// key: FORM_KEY + ":QuoteList",
|
|
// vm: vm
|
|
// });
|
|
|
|
// menuOptions.menuItems.push({
|
|
// title: "PMList",
|
|
// icon: "$sockiBusinessTime",
|
|
// key: FORM_KEY + ":PMList",
|
|
// vm: vm
|
|
// });
|
|
|
|
menuOptions.menuItems.push({ divider: true, inset: false });
|
|
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
|
}
|
|
|
|
let JUST_DELETED = false;
|
|
|
|
/////////////////////////////////
|
|
//
|
|
//
|
|
async function initForm(vm) {
|
|
await fetchTranslatedText();
|
|
await window.$gz.formCustomTemplate.get(FORM_CUSTOM_TEMPLATE_KEY, vm);
|
|
await populateSelectionLists(vm);
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////
|
|
//
|
|
// Ensures UI translated text is available
|
|
//
|
|
async function fetchTranslatedText() {
|
|
await window.$gz.translation.cacheTranslations([
|
|
"SubscriptionServer",
|
|
"SubServerName",
|
|
"Customer",
|
|
"SubServerNotes",
|
|
"Created",
|
|
"SubServerDatacenter",
|
|
"SubServerTimeZone",
|
|
"DatabaseID",
|
|
"SubServerLastUpdated",
|
|
"SubServerSubExpire",
|
|
"SubServerLastHealthStatus",
|
|
"SubServerLastHealthCheck",
|
|
"SubServerTrial",
|
|
"SubServerTrialContact",
|
|
"SubServerTrialEmail",
|
|
"SubServerTrialCompany",
|
|
"SubServerOperatingSystem",
|
|
"SubServerCustomerDomain",
|
|
"LoanUnitRateMonthCost",
|
|
"SubServerIP",
|
|
"ServerState"
|
|
]);
|
|
}
|
|
|
|
//////////////////////
|
|
//
|
|
//
|
|
async function populateSelectionLists(vm) {
|
|
//ensure the pick lists required are pre-fetched
|
|
await window.$gz.enums.fetchEnumList("ServerState");
|
|
vm.selectLists.serverStates = window.$gz.enums.getSelectionList(
|
|
"ServerState"
|
|
);
|
|
}
|
|
</script>
|