Skip to content

Commit b9a002e

Browse files
committed
refactor(features): use feature flags from pro
1 parent c96ab96 commit b9a002e

File tree

5 files changed

+28
-36
lines changed

5 files changed

+28
-36
lines changed

api/router.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bytes"
55
"embed"
66
"fmt"
7-
"github.com/semaphoreui/semaphore/pkg/features"
7+
proFeatures "github.com/semaphoreui/semaphore/pro/pkg/features"
88
"github.com/semaphoreui/semaphore/services/server"
99
task2 "github.com/semaphoreui/semaphore/services/tasks"
1010
"net/http"
@@ -605,7 +605,7 @@ func getSystemInfo(w http.ResponseWriter, r *http.Request) {
605605

606606
"auth_methods": authMethods,
607607

608-
"premium_features": features.GetFeatures(),
608+
"premium_features": proFeatures.GetFeatures(),
609609

610610
"git_client": util.Config.GitClientId,
611611

pkg/features/features_foss.go

Lines changed: 0 additions & 12 deletions
This file was deleted.

pkg/features/features_pro.go

Lines changed: 0 additions & 11 deletions
This file was deleted.

pro/pkg/features/features.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package features
22

33
func GetFeatures() map[string]bool {
4-
return make(map[string]bool)
4+
return map[string]bool{
5+
"project_runners": false,
6+
"terraform_backend": false,
7+
"task_summary": false,
8+
"secret_storages": false,
9+
}
510
}

web/src/components/EnvironmentForm.vue

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
ref="form"
44
lazy-validation
55
v-model="formValid"
6-
v-if="item != null"
6+
v-if="item != null && secretStorages != null"
77
class="pb-3"
88
>
99

@@ -57,10 +57,10 @@
5757
dense
5858
></v-text-field>
5959

60-
<v-row>
60+
<v-row v-if="isNew">
6161
<v-col>
6262
<v-autocomplete
63-
v-model="item.source_storage_id"
63+
v-model="item.secret_storage_id"
6464
:label="$t('Secret Storage (optional)')"
6565
:items="secretStorages"
6666
:disabled="formSaving"
@@ -72,11 +72,10 @@
7272
/>
7373
</v-col>
7474
<v-col>
75-
7675
<v-text-field
77-
v-model="item.source_storage_key"
78-
:label="$t('Source Key')"
79-
:disabled="formSaving || !item.source_storage_id"
76+
v-model="item.secret_storage_key_prefix"
77+
:label="$t('Source key prefix')"
78+
:disabled="formSaving || !item.secret_storage_id"
8079
outlined
8180
dense
8281
/>
@@ -442,9 +441,6 @@ export default {
442441
codemirror,
443442
},
444443
445-
created() {
446-
},
447-
448444
watch: {
449445
envEditorDialog(val) {
450446
this.$emit('maximize', {
@@ -516,6 +512,8 @@ export default {
516512
517513
extraVarsEditMode: 'json',
518514
envEditorDialog: false,
515+
516+
secretStorages: null,
519517
};
520518
},
521519
@@ -609,7 +607,19 @@ export default {
609607
this.item.secrets = secrets;
610608
},
611609
610+
async beforeLoadData() {
611+
[
612+
this.secretStorages,
613+
] = await Promise.all([
614+
this.loadProjectResources('secret_storages'),
615+
]);
616+
},
617+
612618
afterLoadData() {
619+
if (this.item) {
620+
return;
621+
}
622+
613623
this.json = JSON.stringify(JSON.parse(this.item?.json || '{}'), null, 2);
614624
615625
const json = JSON.parse(this.item?.json || '{}');

0 commit comments

Comments
 (0)