Skip to content

Commit

Permalink
added the string cbor option to the build vue
Browse files Browse the repository at this point in the history
  • Loading branch information
linkodm1 committed May 17, 2024
1 parent 9fe1526 commit 1dc8640
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 15 deletions.
10 changes: 9 additions & 1 deletion anms-ui/public/app/components/management/agents/Agents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

<agents-manage-modal @close="showManageModal = false"
:showModal="showManageModal"
:agents="selectedAgents"></agents-manage-modal>
:agents="selectedAgents" :cbor="cborString"></agents-manage-modal>

<footer class="footer">
<p>Amp Version: {{ info }}</p>
Expand Down Expand Up @@ -133,9 +133,17 @@ export default {
showManageModal: false,
agentInfo: null,
selectAll: false,
cborString: undefined
};
},
props:{
cbor: {
type:String,
default:undefined
}
},
mounted() {
this.cborString = this.cbor;
const vm = this;
vm.reloadAgents();
api.methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</b-button>
</b-col>
<b-col cols="9">
<build @updateResult="updateResults($event)"></build>
<build :cbor="cbor" @updateResult="updateResults($event)"></build>
</b-col>
</b-row>
</div>
Expand Down Expand Up @@ -66,6 +66,10 @@ export default {
type: Array,
default: [],
},
cbor: {
type: String,
default: undefined
}
},
watch: {
showModal(newValue, _) {
Expand All @@ -82,7 +86,7 @@ export default {
this.$emit("close");
this.$refs['manageAgentModal'].hide();
this.ariCBOR = undefined;
this.ariString - undefined;
this.ariString = undefined;
},
updateResults(result) {
this.ariString = result;
Expand All @@ -96,11 +100,13 @@ export default {
this.transcoderLogId = response.data.id;
this.sendButtonText = "Transcoding ARI String";
this.queryTranscoderLog();
})
.catch((error) => {
console.error(error);
toastr.error(error.response.data);
});
},
queryTranscoderLog() {
api.methods
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<label>Actions:</label>
<label>ARIs:</label>
<div>
<b-form-group>
<v-select v-model="ariKey"
Expand All @@ -15,7 +15,7 @@
</v-select>
</b-form-group>

<label v-if="ac.length">Selected Actions:</label>
<label v-if="ac.length">Selected ARIs:</label>
<b-list-group>
<b-list-group-item v-for="(curr, index) in ac"
:key="index">
Expand Down
48 changes: 40 additions & 8 deletions anms-ui/public/app/components/management/builder/Build.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
<template>
<div>
<h5>ARI Builder</h5>
<v-select v-model="ariKey"
label="display"
:options="ARIs"></v-select>

<ParameterView v-if="ariKey"
:ariKey="ariKey"
:ACs="ARIs"
@updateResult="updateResults($event)"></ParameterView>
<center>
Input Style(CBOR Input/ARI Builder)<br>
<toggle-button id="tButton" v-model="stringMode" :labels="{ checked: 'String Input', unchecked: 'ARI Builder' }"
:width="100" />
</center>
<div>
<div class="wrapper-next">
<template v-if="stringMode">
<label>Enter String to translate:</label>
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="ari:0x0" v-model="cborString"
v-on:keyup.enter="handleCbor($event.target.value)" />
<div class="input-group-append">
<b-button variant="info" class="btn btn-outline-secondary" type="button" @click="handleCbor(cborString)">
SUBMIT
</b-button>
</div>
</div>
</template>
</div>
<template v-if="!stringMode">
<v-select v-model="ariKey" label="display" :options="ARIs" ></v-select>
<ParameterView v-if="ariKey" :ariKey="ariKey" :ACs="ARIs" @updateResult="updateResults($event)"></ParameterView>
</template>
</div>
</div>
</template>
<script>
Expand All @@ -22,19 +39,34 @@ export default {
vSelect,
ParameterView,
},
props:{
cbor: {
type: String,
default: undefined
}
},
data() {
return {
ariKey: undefined,
parameters: undefined,
finResultStr: undefined,
stringMode: false,
cborString: "",
}
},
mounted(){
this.cborString = this.cbor;
},
computed: {
...mapGetters("build", {
ARIs: "ARIs",
})
},
methods: {
handleCbor(inputString) {
this.finResultStr = inputString.trim()
this.$emit("updateResult", this.finResultStr);
},
updateResults: function (result) {
let head = result[0].value.includes("ari") ? "" : "ari:/";
this.finResultStr = head + result[0].value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ export default {
},
mounted() {
this.generateParameters();
this.$emit("updateResult", [{ type: "ARI", value: this.ariKey.display }]);
this.finResult = this.finResultBase;
},
methods: {
generateParameters() {
Expand Down Expand Up @@ -192,7 +195,7 @@ export default {
break;
}
});
if (this.ariKey.obj_metadata_id != null) {
this.finResultStr =
"ari:/IANA:" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,4 @@ export default {
.a {
vs-selected-color: #fff;
}
</style
</style>

0 comments on commit 1dc8640

Please sign in to comment.