Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Consult latest ruleset endpoint #110

Merged
merged 12 commits into from
May 2, 2019
79 changes: 69 additions & 10 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions store/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ type ListOptions struct {

// RulesetEntry holds a ruleset and its metadata.
type RulesetEntry struct {
Path string
Version string
Ruleset *regula.Ruleset
Signature *regula.Signature
Versions []string
Path string `json:"path"`
Version string `json:"version"`
Ruleset *regula.Ruleset `json:"rules"`
Signature *regula.Signature `json:"signature"`
Versions []string `json:"versions"`
}

// RulesetEntries holds a list of ruleset entries.
Expand Down
54 changes: 23 additions & 31 deletions ui/app/src/views/LatestRuleset/LatestRuleset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
<v-toolbar color="grey" dark>
<v-toolbar-title>Parameters</v-toolbar-title>
</v-toolbar>
<v-card class="height-card scroll">
<v-card class="height-card scroll"
v-if="typeof(ruleset.signature) != 'undefined'"
tealeg marked this conversation as resolved.
Show resolved Hide resolved
>
<v-card-text
v-for="param in ruleset.signature.params"
:key="param.name"
Expand All @@ -19,7 +21,9 @@
<v-toolbar color="grey" dark>
<v-toolbar-title>Return type</v-toolbar-title>
</v-toolbar>
<v-card class="height-card">
<v-card class="height-card"
v-if="typeof(ruleset.signature) != 'undefined'"
>
<v-card-text>{{ruleset.signature.returnType}}</v-card-text>
</v-card>
</v-flex>
Expand Down Expand Up @@ -49,8 +53,8 @@
</template>

<script>
// import axios from 'axios';
import { Ruleset, Rule, Signature, Param } from '../NewRuleset/ruleset';
import axios from 'axios';
// import { Ruleset, Rule, Signature, Param } from '../NewRuleset/ruleset';
import Rules from '../NewRuleset/Rules.vue';

export default {
Expand All @@ -64,34 +68,22 @@ export default {
},
},

data() {
return {
ruleset: new Ruleset({
path: this.path,
signature: new Signature('string', [
new Param('foo', 'string'),
new Param('bar', 'int64'),
new Param('baz', 'float64'),
new Param('baz1', 'float64'),
new Param('baz2', 'float64'),
new Param('baz3', 'float64'),
new Param('baz4', 'float64'),
]),
data: () => ({
ruleset: {},
}),

mounted() {
this.fetchRuleset();
},

rules: [
new Rule(
`(and
(eq 1 1)
(eq 2 2)
)`,
'wesh',
),
new Rule('#true', 'bien'),
],
version: 'abc123',
versions: ['def123', 'ghi123', 'xyz123'],
}),
};
methods: {
fetchRuleset() {
const uri = '/ui/i/rulesets/' + this.path;
return axios
.get(uri)
.then(({ data = {} }) => { this.ruleset = data; })
.catch(error => error);
},
},
};
</script>
Expand Down
Loading