Skip to content

Commit

Permalink
Merge branch 'release/1.11.x' into hll-backport-1.11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
mpalmi committed Jun 14, 2023
2 parents f051edc + 455b8b6 commit 4588aec
Show file tree
Hide file tree
Showing 11 changed files with 229 additions and 337 deletions.
144 changes: 6 additions & 138 deletions .release/ci.hcl
Expand Up @@ -29,145 +29,13 @@ event "build" {
}
}

event "upload-dev" {
event "prepare" {
depends = ["build"]
action "upload-dev" {
action "prepare" {
organization = "hashicorp"
repository = "crt-workflows-common"
workflow = "upload-dev"
depends = ["build"]
}

notification {
on = "fail"
}
}

event "quality-tests" {
depends = ["upload-dev"]
action "quality-tests" {
organization = "hashicorp"
repository = "crt-workflows-common"
workflow = "quality-tests"
}

notification {
on = "fail"
}
}

event "security-scan-binaries" {
depends = ["quality-tests"]
action "security-scan-binaries" {
organization = "hashicorp"
repository = "crt-workflows-common"
workflow = "security-scan-binaries"
config = "security-scan.hcl"
}

notification {
on = "fail"
}
}

event "security-scan-containers" {
depends = ["security-scan-binaries"]
action "security-scan-containers" {
organization = "hashicorp"
repository = "crt-workflows-common"
workflow = "security-scan-containers"
config = "security-scan.hcl"
}

notification {
on = "fail"
}
}

event "notarize-darwin-amd64" {
depends = ["security-scan-containers"]
action "notarize-darwin-amd64" {
organization = "hashicorp"
repository = "crt-workflows-common"
workflow = "notarize-darwin-amd64"
}

notification {
on = "fail"
}
}

event "notarize-darwin-arm64" {
depends = ["notarize-darwin-amd64"]
action "notarize-darwin-arm64" {
organization = "hashicorp"
repository = "crt-workflows-common"
workflow = "notarize-darwin-arm64"
}

notification {
on = "fail"
}
}

event "notarize-windows-386" {
depends = ["notarize-darwin-arm64"]
action "notarize-windows-386" {
organization = "hashicorp"
repository = "crt-workflows-common"
workflow = "notarize-windows-386"
}

notification {
on = "fail"
}
}

event "notarize-windows-amd64" {
depends = ["notarize-windows-386"]
action "notarize-windows-amd64" {
organization = "hashicorp"
repository = "crt-workflows-common"
workflow = "notarize-windows-amd64"
}

notification {
on = "fail"
}
}

event "sign" {
depends = ["notarize-windows-amd64"]
action "sign" {
organization = "hashicorp"
repository = "crt-workflows-common"
workflow = "sign"
}

notification {
on = "fail"
}
}

event "sign-linux-rpms" {
depends = ["sign"]
action "sign-linux-rpms" {
organization = "hashicorp"
repository = "crt-workflows-common"
workflow = "sign-linux-rpms"
}

notification {
on = "fail"
}
}

event "verify" {
depends = ["sign-linux-rpms"]
action "verify" {
organization = "hashicorp"
repository = "crt-workflows-common"
workflow = "verify"
repository = "crt-workflows-common"
workflow = "prepare"
depends = ["build"]
}

notification {
Expand All @@ -176,7 +44,7 @@ event "verify" {
}

event "enos-release-testing-oss" {
depends = ["verify"]
depends = ["prepare"]
action "enos-release-testing-oss" {
organization = "hashicorp"
repository = "vault"
Expand Down
3 changes: 3 additions & 0 deletions changelog/20125.txt
@@ -0,0 +1,3 @@
```release-note:improvement
ui: updates clients configuration edit form state based on census reporting configuration
```
28 changes: 14 additions & 14 deletions ui/app/components/clients/config.js
Expand Up @@ -18,9 +18,11 @@ import { task } from 'ember-concurrency';

export default class ConfigComponent extends Component {
@service router;

@tracked mode = 'show';
@tracked modalOpen = false;
error = null;
@tracked validations;
@tracked error = null;

get infoRows() {
return [
Expand All @@ -38,38 +40,36 @@ export default class ConfigComponent extends Component {
}

get modalTitle() {
let content = 'Turn usage tracking off?';
if (this.args.model && this.args.model.enabled === 'On') {
content = 'Turn usage tracking on?';
}
return content;
return `Turn usage tracking ${this.args.model.enabled.toLowerCase()}?`;
}

@(task(function* () {
try {
yield this.args.model.save();
this.router.transitionTo('vault.cluster.clients.config');
} catch (err) {
this.error = err.message;
return;
this.modalOpen = false;
}
this.router.transitionTo('vault.cluster.clients.config');
}).drop())
save;

@action
updateBooleanValue(attr, value) {
let valueToSet = value === true ? attr.options.trueValue : attr.options.falseValue;
this.args.model[attr.name] = valueToSet;
toggleEnabled(event) {
this.args.model.enabled = event.target.checked ? 'On' : 'Off';
}

@action
onSaveChanges(evt) {
evt.preventDefault();
const { isValid, state } = this.args.model.validate();
const changed = this.args.model.changedAttributes();
if (!changed.enabled) {
if (!isValid) {
this.validations = state;
} else if (changed.enabled) {
this.modalOpen = true;
} else {
this.save.perform();
return;
}
this.modalOpen = true;
}
}
4 changes: 3 additions & 1 deletion ui/app/decorators/model-validations.js
Expand Up @@ -103,9 +103,11 @@ export function withModelValidations(validations) {
: validator(get(this, key), options); // dot notation may be used to define key for nested property

if (!passedValidation) {
// message can also be a function
const validationMessage = typeof message === 'function' ? message(this) : message;
// consider setting a prop like validationErrors directly on the model
// for now return an errors object
state[key].errors.push(message);
state[key].errors.push(validationMessage);
if (isValid) {
isValid = false;
}
Expand Down
70 changes: 45 additions & 25 deletions ui/app/models/clients/config.js
@@ -1,30 +1,50 @@
import Model, { attr } from '@ember-data/model';
import { computed } from '@ember/object';
import attachCapabilities from 'vault/lib/attach-capabilities';
import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities';
import { expandAttributeMeta } from 'vault/utils/field-to-attrs';
import { apiPath } from 'vault/macros/lazy-capabilities';
import { withModelValidations } from 'vault/decorators/model-validations';

const M = Model.extend({
queriesAvailable: attr('boolean'),
retentionMonths: attr('number', {
const validations = {
retentionMonths: [
{
validator: (model) => parseInt(model.retentionMonths) >= model.minimumRetentionMonths,
message: (model) =>
`Retention period must be greater than or equal to ${model.minimumRetentionMonths}.`,
},
],
};

@withModelValidations(validations)
export default class ClientsConfigModel extends Model {
@attr('boolean') queriesAvailable; // true only if historical data exists, will be false if there is only current month data

@attr('number', {
label: 'Retention period',
subText: 'The number of months of activity logs to maintain for client tracking.',
}),
enabled: attr('string', {
editType: 'boolean',
trueValue: 'On',
falseValue: 'Off',
label: 'Enable usage data collection',
helpText:
'Enable or disable client tracking. Keep in mind that disabling tracking will delete the data for the current month.',
}),

configAttrs: computed(function () {
let keys = ['enabled', 'retentionMonths'];
return expandAttributeMeta(this, keys);
}),
});

export default attachCapabilities(M, {
configPath: apiPath`sys/internal/counters/config`,
});
})
retentionMonths;

@attr('number') minimumRetentionMonths;

@attr('string') enabled;

@attr('boolean') reportingEnabled;

@attr('date') billingStartTimestamp;

@lazyCapabilities(apiPath`sys/internal/counters/config`) configPath;

get canRead() {
return this.configPath.get('canRead') !== false;
}
get canEdit() {
return this.configPath.get('canUpdate') !== false;
}

_formFields = null;
get formFields() {
if (!this._formFields) {
this._formFields = expandAttributeMeta(this, ['enabled', 'retentionMonths']);
}
return this._formFields;
}
}

0 comments on commit 4588aec

Please sign in to comment.