-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/web-app-changes' into 'master'
root is now admin web app, changes for keys See merge request b650/Deep-Lynx!112
- Loading branch information
Showing
18 changed files
with
390 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<template> | ||
<v-dialog v-model="dialog" max-width="700px" @click:outside="errorMessage = ''; dialog = false; returnedKey = null"> | ||
<template v-slot:activator="{ on }"> | ||
<v-btn color="primary" dark class="mb-2" v-on="on">{{$t("createApiKey.createApiKey")}}</v-btn> | ||
</template> | ||
<v-card> | ||
<v-card-title> | ||
<span class="headline">{{$t("createApiKey.formTitle")}}</span> | ||
</v-card-title> | ||
|
||
<v-card-text> | ||
<error-banner :message="errorMessage"></error-banner> | ||
<v-alert type="success" v-if="returnedKey" class="multi-line"> | ||
<p>{{$t('createApiKey.successfullyCreated')}}</p> | ||
<p><strong>{{$t('createApiKey.key')}}</strong></p> | ||
<p>{{returnedKey.key}}</p> | ||
<p><strong>{{$t('createApiKey.secret')}}</strong></p> | ||
<p>{{returnedKey.secret_raw}}</p> | ||
</v-alert> | ||
<v-container> | ||
<v-row> | ||
<v-col :cols="12"> | ||
<p>{{$t('createApiKey.description')}}</p> | ||
</v-col> | ||
</v-row> | ||
</v-container> | ||
</v-card-text> | ||
|
||
<v-card-actions> | ||
<v-spacer></v-spacer> | ||
<v-btn color="blue darken-1" text @click="dialog = false; returnedKey = null" >{{$t("createApiKey.cancel")}}</v-btn> | ||
<v-btn color="blue darken-1" text @click="generateApiKey">{{$t("createApiKey.create")}}</v-btn> | ||
</v-card-actions> | ||
</v-card> | ||
</v-dialog> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import {Component, Vue} from "vue-property-decorator"; | ||
import {KeyPairT} from "@/api/types"; | ||
@Component | ||
export default class CreateApiKeyDialog extends Vue { | ||
errorMessage = "" | ||
dialog = false | ||
returnedKey: KeyPairT | null = null | ||
generateApiKey() { | ||
this.$client.generateKeyPairForUser() | ||
.then(key => { | ||
this.returnedKey = key | ||
}) | ||
.catch((e) => this.errorMessage = e) | ||
} | ||
} | ||
</script> |
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,68 @@ | ||
<template> | ||
<v-dialog v-model="dialog" @click:outside="dialog = false" max-width="60%"> | ||
<template v-slot:activator="{ on }"> | ||
<v-icon | ||
v-if="icon" | ||
small | ||
class="mr-2" | ||
v-on="on" | ||
>mdi-delete</v-icon> | ||
<v-btn v-if="!displayIcon" color="primary" dark class="mb-1" v-on="on">{{$t("deleteApiKey.deleteApiKey")}}</v-btn> | ||
</template> | ||
|
||
<v-card> | ||
<v-card-text> | ||
<v-container> | ||
<error-banner :message="errorMessage"></error-banner> | ||
<span class="headline">{{$t('deleteApiKey.deleteTitle')}}</span> | ||
<v-row> | ||
<v-col :cols="12"> | ||
<v-alert type="warning"> | ||
{{$t('deleteApiKey.deleteWarning')}} | ||
</v-alert> | ||
</v-col> | ||
</v-row> | ||
</v-container> | ||
</v-card-text> | ||
|
||
<v-card-actions> | ||
<v-spacer></v-spacer> | ||
<v-btn color="blue darken-1" text @click="dialog = false">{{$t("deleteApiKey.cancel")}}</v-btn> | ||
<v-btn color="red darken-1" text @click="deleteApiKey"> | ||
<span>{{$t("deleteApiKey.delete")}}</span> | ||
</v-btn> | ||
</v-card-actions> | ||
</v-card> | ||
</v-dialog> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import {Component, Prop, Vue} from 'vue-property-decorator' | ||
import {KeyPairT} from "@/api/types"; | ||
@Component | ||
export default class DeleteApiKeyDialog extends Vue { | ||
@Prop({required: true}) | ||
readonly keyPair!: KeyPairT | ||
@Prop({required: false, default: false}) | ||
readonly icon!: boolean | ||
errorMessage = "" | ||
dialog = false | ||
get displayIcon() { | ||
return this.icon | ||
} | ||
deleteApiKey() { | ||
this.$client.deleteKeyPairForUser(this.keyPair.key) | ||
.then(() => { | ||
this.dialog = false | ||
this.$emit('apiKeyDeleted') | ||
}) | ||
.catch(e => this.errorMessage = e) | ||
} | ||
} | ||
</script> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<template> | ||
<div> | ||
<error-banner :message="errorMessage"></error-banner> | ||
<v-data-table | ||
:headers="headers()" | ||
:items="keyPairs" | ||
class="elevation-1" | ||
> | ||
<template v-slot:top> | ||
<v-toolbar flat color="white"> | ||
<v-toolbar-title>{{$t('apiKeys.title')}}</v-toolbar-title> | ||
<v-divider | ||
class="mx-4" | ||
inset | ||
vertical | ||
></v-divider> | ||
<v-spacer></v-spacer> | ||
<create-api-key-dialog></create-api-key-dialog> | ||
</v-toolbar> | ||
</template> | ||
|
||
<template v-slot:[`item.actions`]="{ item }"> | ||
<delete-api-key-dialog :key-pair="item" :icon="true" @apiKeyDeleted="refreshKeys()"></delete-api-key-dialog> | ||
</template> | ||
</v-data-table> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import {Component, Prop, Vue} from 'vue-property-decorator' | ||
import {KeyPairT} from "@/api/types"; | ||
import CreateApiKeyDialog from "@/components/createApiKeyDialog.vue"; | ||
import DeleteApiKeyDialog from "@/components/deleteApiKeyDialog.vue"; | ||
@Component({components:{CreateApiKeyDialog, DeleteApiKeyDialog}}) | ||
export default class ApiKeys extends Vue { | ||
dialog= false | ||
select = "" | ||
keyPairs: KeyPairT[] = [] | ||
errorMessage = "" | ||
headers() { | ||
return [ | ||
{ text: this.$t('apiKeys.key'), value: 'key'}, | ||
{ text: this.$t('apiKeys.actions'), value: 'actions', sortable: false } | ||
] | ||
} | ||
mounted() { | ||
this.refreshKeys() | ||
} | ||
refreshKeys() { | ||
this.$client.listKeyPairsForUser() | ||
.then(keys => { | ||
this.keyPairs = keys | ||
}) | ||
.catch((e) => this.errorMessage = e) | ||
} | ||
copyID(id: string) { | ||
navigator.clipboard.writeText(id) | ||
} | ||
} | ||
</script> |
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
Oops, something went wrong.