-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* gke provisioning without validation or tests * move version from config tab to location tab, rename config networking and location config * add form validation * sort en-us mock gcp data networking tests config tests fix upgrade np version checkbox fix account access on edit typescript errors authscopes util tests * add private nodes warning banner and fix accountaccess on create * lint * update yarn lock to include ipaddr.js * fix e2e test * testing credential bug * fix selectcredential not allowing new credential to be created * automatically use project id when a new gcp credential is created; block saving cluster until project id is authenticated * logging banner * fix networking when subnet ha sno secondary ip ranges * add svc account fetch and some node pool tests * fix auth scopes styling and view config mode * review feedback and ts errors * no auto-authenticate * fix lint * update networking input placement * add loading component to crugke, crueks, cruaks; shuffle gke node pool component inputs * fix lint and loading import * fix extra zone checkboxes on edit and add unit test * fix gke node pool version checkbox when adding pools * fix lint * fix extrazoneoptions display in view config mode * clean up extraZoneOptions
- Loading branch information
1 parent
374a839
commit ae9d1cb
Showing
33 changed files
with
5,642 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./.shell/pkg/babel.config.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
<script lang="ts"> | ||
import { defineComponent } from 'vue'; | ||
import { _CREATE, _VIEW } from '@shell/config/query-params'; | ||
import LabeledInput from '@components/Form/LabeledInput/LabeledInput.vue'; | ||
import SelectCredential from '@shell/edit/provisioning.cattle.io.cluster/SelectCredential.vue'; | ||
import AsyncButton from '@shell/components/AsyncButton.vue'; | ||
import { mapGetters, Store } from 'vuex'; | ||
import { getGKEZones } from '../util/gcp'; | ||
export default defineComponent({ | ||
name: 'GKEAccountAccess', | ||
components: { | ||
LabeledInput, | ||
SelectCredential, | ||
AsyncButton | ||
}, | ||
props: { | ||
mode: { | ||
type: String, | ||
default: _CREATE | ||
}, | ||
credential: { | ||
type: String, | ||
default: null | ||
}, | ||
project: { | ||
type: String, | ||
default: '' | ||
}, | ||
isAuthenticated: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
}, | ||
created() { | ||
if (this.mode === _VIEW) { | ||
this.$emit('update:isAuthenticated', true); | ||
} | ||
}, | ||
computed: { | ||
...mapGetters({ t: 'i18n/t' }), | ||
CREATE(): string { | ||
return _CREATE; | ||
}, | ||
VIEW(): string { | ||
return _VIEW; | ||
}, | ||
isView():boolean { | ||
return this.mode === _VIEW; | ||
} | ||
}, | ||
methods: { | ||
async testProjectId(cb: (success: Boolean)=>{}) { | ||
const store = this.$store as Store<any>; | ||
try { | ||
await getGKEZones(store, this.credential, this.project, {}); | ||
this.$emit('update:isAuthenticated', true); | ||
// eslint-disable-next-line standard/no-callback-literal, node/no-callback-literal | ||
return cb(true); | ||
} catch (e) { | ||
this.$emit('error', e?.data || e); | ||
this.$emit('update:isAuthenticated', false); | ||
// eslint-disable-next-line standard/no-callback-literal, node/no-callback-literal | ||
return cb(false); | ||
} | ||
}, | ||
// gcp credentials include a project id - we can grab that and auto-fill to save users having to manually enter it | ||
// this only applies to new credentials because of the way credential data is stored | ||
parseNewCredential(e) { | ||
const authJson = e?.googlecredentialConfig?.authEncodedJson; | ||
if (authJson) { | ||
try { | ||
// eslint-disable-next-line camelcase | ||
const { project_id:projectId } = JSON.parse(authJson); | ||
if (projectId) { | ||
this.$emit('update:project', projectId); | ||
} | ||
} catch (e) { | ||
} | ||
} | ||
} | ||
}, | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div | ||
:class="{'showing-form': !credential}" | ||
class="credential-project" | ||
> | ||
<div | ||
v-show="!!credential" | ||
class="project mb-10" | ||
> | ||
<LabeledInput | ||
:disabled="isAuthenticated" | ||
:value="project" | ||
label-key="gke.project.label" | ||
required | ||
@input="$emit('update:project', $event)" | ||
/> | ||
</div> | ||
<div | ||
:class="{'view': isView}" | ||
class="select-credential-container mb-10" | ||
> | ||
<SelectCredential | ||
:value="credential" | ||
data-testid="crugke-select-credential" | ||
:mode="(isView|| isAuthenticated) ? VIEW : CREATE" | ||
provider="gcp" | ||
:default-on-cancel="true" | ||
:showing-form="!credential" | ||
class="select-credential" | ||
:cancel="()=>$emit('cancel-credential')" | ||
@input="$emit('update:credential', $event)" | ||
@credential-created="parseNewCredential" | ||
/> | ||
</div> | ||
<template v-if="!isView"> | ||
<div | ||
v-show="!!credential" | ||
class="auth-button-container mb-10" | ||
> | ||
<AsyncButton | ||
:disabled="!credential || !project || isAuthenticated" | ||
type="button" | ||
class="btn" | ||
mode="authenticate" | ||
@click="testProjectId" | ||
/> | ||
</div> | ||
</template> | ||
</div> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
.credential-project { | ||
display: flex; | ||
min-width: 150px; | ||
.project { | ||
flex-basis: 50%; | ||
flex-grow: 0; | ||
margin: 0 1.75% 0 0; | ||
} | ||
&.showing-form { | ||
flex-grow:1; | ||
flex-direction: column; | ||
&>.project { | ||
margin: 0; | ||
} | ||
&>.select-credential-container{ | ||
display:flex; | ||
flex-direction: column; | ||
flex-grow: 1; | ||
} | ||
} | ||
&>.select-credential-container{ | ||
flex-basis: 50%; | ||
margin: 0 1.75% 0 0; | ||
&.view{ | ||
margin: 0; | ||
} | ||
&>.select-credential{ | ||
flex-grow: 1; | ||
} | ||
} | ||
} | ||
.auth-button-container { | ||
align-content: center; | ||
min-width: 150px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
</style> |
Oops, something went wrong.