Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to quickly duplicate constraints/variants #754

Merged
merged 3 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ tasks:
- buf generate

clean:
desc: Rm built assets
desc: Remove built assets
cmds:
- go clean -i {{.SOURCE_FILES}}
- rm -rf dist/*
Expand All @@ -84,7 +84,7 @@ tasks:
COVERAGE_FILE: coverage.txt

dev:
desc: Start the server and ui in development modes
desc: Start the server and UI in development modes
cmds:
- modd
preconditions:
Expand All @@ -97,13 +97,13 @@ tasks:
- goimports -w .

lint:
desc: Run linters
desc: Run the linters
cmds:
- golangci-lint run 2>&1
- buf lint

test:
desc: Run all tests
desc: Run all the tests
cmds:
- go test {{.TEST_OPTS}} -covermode=atomic -count=1 -coverprofile={{.COVERAGE_FILE}} {{.SOURCE_FILES}} -run={{.TEST_PATTERN}} -timeout=30s {{.TEST_FLAGS}}
vars:
Expand Down
4 changes: 2 additions & 2 deletions modd.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
**/*.go !**/*_test.go {
daemon +sigterm: go run ./cmd/flipt/. --config ./config/local.yml --force-migrate
{
daemon: go run ./cmd/flipt/. --config ./config/local.yml --force-migrate
}
{
indir: ./ui
Expand Down
20 changes: 17 additions & 3 deletions ui/src/components/Flags/Flag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,30 @@
>
{{ props.row.attachment | limit }}
</b-table-column>
<b-table-column v-slot="props" field="" label="" width="110" centered>
<b-table-column v-slot="props" field="" label="" width="160" centered>
<a
class="button is-white"
@click.prevent="editVariant(props.index)"
>
<span class="icon is-small">
<i class="fas fa-pencil-alt" />
<i class="fas fa-pencil-alt" title="Edit" />
</span>
</a>
<a
class="button is-white"
@click.prevent="duplicateVariant(props.index)"
>
<span class="icon is-small">
<i class="far fa-clone" title="Duplicate" />
</span>
</a>
<a
class="button is-white"
@click.prevent="deleteVariant(props.index)"
>
<span class="icon is-small"> <i class="fas fa-times" /> </span>
<span class="icon is-small">
<i class="fas fa-times" title="Delete" />
</span>
</a>
</b-table-column>
</b-table>
Expand Down Expand Up @@ -462,6 +472,10 @@ export default {
this.dialogEditVariantVisible = true;
this.selectedVariant = cloneDeep(this.flag.variants[index]);
},
duplicateVariant(index) {
this.dialogAddVariantVisible = true;
this.newVariant = cloneDeep(this.flag.variants[index]);
},
cancelEditVariant() {
this.dialogEditVariantVisible = false;
this.selectedVariant = clone(DEFAULT_VARIANT);
Expand Down
20 changes: 17 additions & 3 deletions ui/src/components/Segments/Segment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,30 @@
<b-table-column v-slot="props" field="value" label="Value">
{{ props.row.value }}
</b-table-column>
<b-table-column v-slot="props" field="" label="" width="110" centered>
<b-table-column v-slot="props" field="" label="" width="160" centered>
<a
class="button is-white"
@click.prevent="editConstraint(props.index)"
>
<span class="icon is-small">
<i class="fas fa-pencil-alt" />
<i class="fas fa-pencil-alt" title="Edit" />
</span>
</a>
<a
class="button is-white"
@click.prevent="duplicateConstraint(props.index)"
>
<span class="icon is-small">
<i class="far fa-clone" title="Duplicate" />
</span>
</a>
<a
class="button is-white"
@click.prevent="deleteConstraint(props.index)"
>
<span class="icon is-small"> <i class="fas fa-times" /> </span>
<span class="icon is-small">
<i class="fas fa-times" title="Delete" />
</span>
</a>
</b-table-column>
</b-table>
Expand Down Expand Up @@ -612,6 +622,10 @@ export default {
this.dialogEditConstraintVisible = true;
this.selectedConstraint = cloneDeep(this.segment.constraints[index]);
},
duplicateConstraint(index) {
this.dialogAddConstraintVisible = true;
this.newConstraint = cloneDeep(this.segment.constraints[index]);
},
cancelEditConstraint() {
this.dialogEditConstraintVisible = false;
this.selectedConstraint = clone(DEFAULT_CONSTRAINT);
Expand Down