summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannik Schönartz2020-05-08 00:03:26 +0200
committerJannik Schönartz2020-05-08 00:03:26 +0200
commit2bc74d4d36f5320bb535db972a43fd46cd45a93b (patch)
treeed8eb1fd4e44e999001c07f4d44265ff1a096be6
parent[server/registration] Manual registration: Add client to the manual selected ... (diff)
downloadbas-2bc74d4d36f5320bb535db972a43fd46cd45a93b.tar.gz
bas-2bc74d4d36f5320bb535db972a43fd46cd45a93b.tar.xz
bas-2bc74d4d36f5320bb535db972a43fd46cd45a93b.zip
[webapp/external-backends] Remove step 3 from stepper & eslint fixes
-rw-r--r--server/api/registration.js2
-rw-r--r--server/lib/external-backends/backends/infoblox-backend.js14
-rw-r--r--webapp/src/components/BackendModuleEdit.vue84
3 files changed, 14 insertions, 86 deletions
diff --git a/server/api/registration.js b/server/api/registration.js
index 3a88bee..86bf185 100644
--- a/server/api/registration.js
+++ b/server/api/registration.js
@@ -510,7 +510,7 @@ function buildIpxeMenu (id, name, groups, parents) {
// Add client menu
script += 'item select Add client to ' + toAscii(name) + '\r\n'
menuscript += `:select\r\necho Enter client name\r\nread clientname\r\nparams\r\n`
- menuscript += `param client { "name": "\${clientname}", "type": "CLIENT", "uuid": "\${uuid}", "purpose": "Pool PC", "parents": [` + parents[parents.length -1].id + `], "networks": [{ "ip": "\${net0/ip}", "mac": "\${net0/mac}" }] }\r\n`
+ menuscript += `param client { "name": "\${clientname}", "type": "CLIENT", "uuid": "\${uuid}", "purpose": "Pool PC", "parents": [` + parents[parents.length - 1].id + `], "networks": [{ "ip": "\${net0/ip}", "mac": "\${net0/mac}" }] }\r\n`
menuscript += 'param ipxe true\r\n'
menuscript += 'chain --replace ' + basUrl + '/api/registration/clients##params\r\n\r\n'
diff --git a/server/lib/external-backends/backends/infoblox-backend.js b/server/lib/external-backends/backends/infoblox-backend.js
index 71f0a4b..ca7a7f9 100644
--- a/server/lib/external-backends/backends/infoblox-backend.js
+++ b/server/lib/external-backends/backends/infoblox-backend.js
@@ -34,21 +34,21 @@ class InfobloxBackend extends ExternalBackends {
})
// Add custom timeout to the infoblox login
- return await Promise.race([
+ return Promise.race([
new Promise(async (resolve, reject) => {
try {
const result = await ipam.login(c.username, c.password)
- if (!result) resolve({ error: 'LOGIN_FAILED', message: 'Login failed' })
- else resolve(result)
+ if (!result) resolve({ error: 'LOGIN_FAILED', message: 'Login failed' })
+ else resolve(result)
} catch (e) {
resolve({ error: 'LOGIN_FAILED', message: e })
}
}),
new Promise((resolve, reject) => {
- let wait = setTimeout(() => {
- clearTimeout(wait)
- resolve({ error: 'LOGIN_FAILED', message: 'Timeout' })
- }, 15000)
+ let wait = setTimeout(() => {
+ clearTimeout(wait)
+ resolve({ error: 'LOGIN_FAILED', message: 'Timeout' })
+ }, 15000)
})])
}
diff --git a/webapp/src/components/BackendModuleEdit.vue b/webapp/src/components/BackendModuleEdit.vue
index 0b235da..b6fcfd5 100644
--- a/webapp/src/components/BackendModuleEdit.vue
+++ b/webapp/src/components/BackendModuleEdit.vue
@@ -7,13 +7,7 @@
"backendEmptyError": "This field can not be empty.",
"backendType": "Backend type",
"backendtypeEmptyError": "Please choose a backend type.",
- "backendSaved": "Backend was successfully saved.",
- "stepperOptional": "optional",
- "pending": "pending",
- "progress": "in progress ...",
- "success": "success",
- "error": "error",
- "testConnection": "Test connection"
+ "backendSaved": "Backend was successfully saved."
},
"de": {
"inputCredentials": "Anmeldedaten",
@@ -22,13 +16,7 @@
"backendEmptyError": "Dieses Feld darf nicht leer sein.",
"backendType": "Backend Typ",
"backendtypeEmptyError": "Bitte wähle einen Backendtyp aus.",
- "backendSaved": "Backend wurde erfolgreich gespeichert.",
- "stepperOptional": "Optional",
- "pending": "nicht getestet",
- "progress": "test läuft ...",
- "success": "erfolgreich",
- "error": "Fehler",
- "testConnection": "Verbindung überprüfen"
+ "backendSaved": "Backend wurde erfolgreich gespeichert."
}
}
</i18n>
@@ -57,13 +45,6 @@
step="2"
:editable="stepCompleted >= 2"
>{{ $t('inputCredentials') }}</v-stepper-step>
- <v-divider></v-divider>
- <v-stepper-step
- :complete="stepCompleted >= 3"
- step="3"
- :editable="stepCompleted >= 3"
- >{{ $t('testConnection') }}<small>{{ $t('stepperOptional') }}</small>
- </v-stepper-step>
</v-stepper-header>
</v-stepper>
</v-card-title>
@@ -91,25 +72,6 @@
></v-text-field>
<backend-module-edit-dynamic-fields :elements="elements"/>
</v-stepper-content>
- <v-stepper-content step="3">
- <v-container>
- <v-layout align-center justify-center column>
- <v-btn
- fab
- dark
- icon
- :loading="loading"
- :disabled="loading"
- @click.stop="checkConnection"
- large
- >
- <v-icon x-large color="primary">cached</v-icon>
- </v-btn>
- <div class="display-1">{{ $t('Status') }}: <strong :class="statusColor">{{ statusLabel }}</strong></div>
- <div class="display-1">{{ $t('Status') }}: <strong :class="statusColor">TODO: REMOVE</strong></div>
- </v-layout>
- </v-container>
- </v-stepper-content>
</v-stepper-items>
</v-stepper>
</v-form>
@@ -119,8 +81,7 @@
<v-flex xl10 offset-xl2 lg12 text-right>
<v-btn text @click.native="$store.commit('backends/setEdit', false)">{{ $t('cancel') }}</v-btn>
<v-btn color="primary" v-show="step == 1" @click.native="completeStepOne()">{{ $t('continue') }}</v-btn>
- <v-btn color="primary" v-show="step == 2" @click.native="completeStepTwo()">{{ $t('continue') }}</v-btn>
- <v-btn type="submit" @click="submit" v-show="step == 3" class="primary" raised>{{ backendId ? $t('save') : $t('create') }}</v-btn>
+ <v-btn type="submit" @click.native="completeStepTwo()" @click="submit" v-show="step == 2" class="primary" raised>{{ backendId ? $t('save') : $t('create') }}</v-btn>
</v-flex>
</v-card-actions>
</v-card>
@@ -145,10 +106,7 @@ export default {
backendType: '',
backendName: '',
elements: [],
- loadData: false,
- loading: false,
- statusColor: 'primary--text',
- statusLabel: this.$t('pending')
+ loadData: false
}
},
methods: {
@@ -206,38 +164,10 @@ export default {
completeStepTwo () {
// Error handling
if (this.backendName !== '') {
- this.step = 3
this.stepCompleted = Math.max(2, this.stepCompleted)
} else {
this.$refs.form.validate()
}
- },
- checkConnection () {
- // Start the loading animation and reset the label colors.
- this.loading = true
- this.statusColor = 'primary--text'
- this.statusLabel = this.$t('progress')
-
- // Test the credential connection.
- this.$http.post('/api/backends/0/connection', {
- name: this.backendName,
- type: this.backendType,
- credentials: JSON.stringify(this.credentials),
- headers: {
- 'Cache-Control': 'no-cache'
- }
- }).then(response => {
- if (response.data.success) {
- this.statusColor = 'success--text'
- this.statusLabel = this.$t('success')
- } else {
- this.statusColor = 'error--text'
- this.statusLabel = this.$t('error')
- this.$snackbar({ color: 'error', text: response.data.error })
- }
- // End the loading animation.
- this.loading = false
- })
}
},
computed: {
@@ -252,14 +182,12 @@ export default {
edit: function (value) {
if (value) {
this.loadBackendTypes()
- this.statusColor = 'primary--text'
- this.statusLabel = this.$t('pending')
- this.$refs.form.reset()
+ if (this.$refs.form) this.$refs.form.reset()
this.elements = []
if (this.backendId !== 0) {
this.loadBackend(this.backendId)
this.step = 2
- this.stepCompleted = 3
+ this.stepCompleted = 2
} else {
this.backendName = ''
this.backendType = ''