Skip to content

Commit

Permalink
fix: debug console editor fix, tags , notes update fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurabag committed Oct 22, 2024
1 parent 736f60c commit 270a657
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 466 deletions.
445 changes: 0 additions & 445 deletions browser/flagr-ui/package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion browser/flagr-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4",
"@vue/cli-plugin-eslint": "^4",
"@vue/cli-service": "^4",
"eslint": "^6",
"eslint-plugin-vue": "^6",
Expand Down
28 changes: 23 additions & 5 deletions browser/flagr-ui/src/components/DebugConsole.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,20 @@
<Vue3JsonEditor
v-model="evalContext"
:show-btns="false"
ref="evalContextEditor"
mode="code"
:expandedOnStart="true"
class="json-editor"
@json-change="onJsonChange('evalContext', $event)"
></Vue3JsonEditor>
</el-col>
<el-col :span="12">
<Vue3JsonEditor
v-model="evalResult"
:show-btns="false"
ref="evalResultEditor"
mode="code"
:expandedOnStart="true"
class="json-editor"
@json-change="onJsonChange('evalResult', $event)"
></Vue3JsonEditor>
</el-col>
</el-row>
Expand Down Expand Up @@ -63,16 +67,20 @@
<Vue3JsonEditor
v-model="batchEvalContext"
:show-btns="false"
ref="batchEvalContextEditor"
mode="code"
:expandedOnStart="true"
class="json-editor"
@json-change="onJsonChange('batchEvalContext', $event)"
></Vue3JsonEditor>
</el-col>
<el-col :span="12">
<Vue3JsonEditor
v-model="batchEvalResult"
:show-btns="false"
ref="batchEvalResultEditor"
mode="code"
:expandedOnStart="true"
class="json-editor"
@json-change="onJsonChange('batchEvalResult', $event)"
></Vue3JsonEditor>
</el-col>
</el-row>
Expand Down Expand Up @@ -125,6 +133,17 @@ export default {
};
},
methods: {
onJsonChange(editorType, value) {
if(editorType === 'evalContext'){
this.evalContext = value;
} else if(editorType === 'evalResult'){
this.evalResult = value;
} else if(editorType === 'batchEvalContext'){
this.batchEvalContext = value;
} else if(editorType === 'batchEvalResult'){
this.batchEvalResult = value;
}
},
postEvaluation(evalContext) {
getAxiosFlagrInstance().post(`/evaluation`, evalContext).then(
response => {
Expand Down Expand Up @@ -152,7 +171,6 @@ export default {
Vue3JsonEditor
},
mounted() {
// console.log("testtt", this.$refs.smapp.innerText);
this.$refs.evalContextEditor?.targeteditor?.setMode("code");
this.$refs.evalResultEditor?.editor?.setMode("code");
this.$refs.batchEvalContextEditor?.editor?.setMode("code");
Expand Down
21 changes: 13 additions & 8 deletions browser/flagr-ui/src/components/Flag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,9 @@
</el-dialog>

<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ name: 'home' }">Home22 page</el-breadcrumb-item>
<el-breadcrumb-item :to="{ name: 'home' }">Home page</el-breadcrumb-item>
<el-breadcrumb-item>Flag ID: {{ $route.params.flagId }}</el-breadcrumb-item>
</el-breadcrumb>
{{ loaded }}
<div v-if="flag">
<el-tabs>
<el-tab-pane label="Config">
Expand Down Expand Up @@ -211,10 +210,10 @@
</el-button>
</h5>
</el-row>
<el-row>
<el-row v-if="loaded">
<MarkdownEditor
:showEditor="this.showMdEditor"
:markdown.sync="flag.notes"
:showEditor="showMdEditor"
v-model:markdown="flag.notes"
@save="putFlag(flag)"
/>
</el-row>
Expand Down Expand Up @@ -255,7 +254,7 @@
</el-card>
</el-card>

<el-card class="variants-container">
<el-card class="variants-container" v-if="loaded">
<template v-slot:header>
<div class="clearfix">
<h2>Variants</h2>
Expand Down Expand Up @@ -301,7 +300,9 @@
<Vue3JsonEditor
v-model="variant.attachment"
:showBtns="false"
:mode="'code'"
mode="code"
:expandedOnStart="true"
@json-change="onJsonChange(variant.id, $event)"
v-on:has-error="variant.attachmentValid = false"
v-on:input="variant.attachmentValid = true"
class="variant-attachment-content"
Expand Down Expand Up @@ -555,7 +556,7 @@
<div class="card--error" v-else>No segments created for this feature flag yet</div>
</el-card>
<!-- sdd -->
<debug-console :flag="this.flag"></debug-console>
<debug-console v-if="loaded" :flag="flag"></debug-console>
<el-card>
<template v-slot:header>
<div class="el-card-header">
Expand Down Expand Up @@ -723,6 +724,10 @@ export default {
}
},
methods: {
onJsonChange(variantKey, value) {
const variant = this.flag.variants.find(v => v.id === variantKey);
variant.attachment = value;
},
deleteFlag() {
const flagId = this.flagId;
getAxiosFlagrInstance().delete(`/flags/${this.flagId}`).then(() => {
Expand Down
1 change: 1 addition & 0 deletions browser/flagr-ui/src/components/FlagHistory.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<div>
<el-button size="small" @click="getFlagSnapshots" class="mb-4">Refresh</el-button>
<el-card v-for="diff in diffs" :key="diff.timestamp" class="snapshot-container">
<template v-slot:header>
<div class="el-card-header">
Expand Down
12 changes: 8 additions & 4 deletions browser/flagr-ui/src/components/Flags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<el-col :span="20" :offset="2">
<div class="flags-container container">
<el-breadcrumb separator="/" v-if="loaded">
<el-breadcrumb-item>Home444 page</el-breadcrumb-item>
<el-breadcrumb-item>Home page</el-breadcrumb-item>
</el-breadcrumb>

<spinner v-if="!loaded" />
Expand Down Expand Up @@ -184,9 +184,13 @@ export default {
created() {
getAxiosFlagrInstance().get(`/flags`).then(response => {
let flags = response.data;
this.loaded = true;
flags.reverse();
this.flags = flags;
if(typeof flags === 'string'){
logout();
} else {
this.loaded = true;
flags.reverse();
this.flags = flags;
}
}, handleErr.bind(this));
},
computed: {
Expand Down
2 changes: 1 addition & 1 deletion browser/flagr-ui/src/components/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<script>
import { logout } from '../utils/apiUtil';
import { getGoogleRedirectionLink } from '../utils/apiUtil';
import { mapState } from 'vuex';
import { mapState } from 'vuex';
export default {
methods: {
Expand Down
4 changes: 3 additions & 1 deletion browser/flagr-ui/src/components/MarkdownEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ export default {
},
},
watch: {},
mounted() {},
mounted() {
this.input = this.markdown;
},
};
</script>

Expand Down
2 changes: 1 addition & 1 deletion browser/flagr-ui/src/utils/apiUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export async function logout() {
try {
await getAxiosInstance().post(`api/v1/auth/logout`)
} catch (error) {
alert('Couldnot logout');
alert('logging you out');
} finally {
store.dispatch("reset")
if (typeof window !== "undefined") {
Expand Down

0 comments on commit 270a657

Please sign in to comment.