Bulk operations dashboard: styles and bug fix (#21521)

Changes:
- Fixed button styles
- Fixed a bug that prevented deploying a profile/script to a team while
replacing the profile/script
This commit is contained in:
Eric 2024-08-22 23:10:47 -06:00 committed by GitHub
parent 7a8a4619fa
commit e43119cf76
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 58 additions and 31 deletions

View file

@ -89,7 +89,7 @@ module.exports = {
} else if (!newProfile && !profile.teams){// Undeployed profiles are stored in the app's database.
// console.log('editing an undeployed profile!');
profileContents = profile.profileContents;
filename = profile.name + profile.profileType;
filename = profile.name;
extension = profile.profileType;
}
// ╔═╗╔═╗╔═╗╦╔═╗╔╗╔ ╔═╗╦═╗╔═╗╔═╗╦╦ ╔═╗
@ -137,17 +137,19 @@ module.exports = {
});
}// After every added team
} else {
// If there is a new profile uploaded, we will need to delete the old profiles, and add the new profile.
for(let team of profile.teams) {
// console.log(`removing ${profile.name} from team id ${team.teamName}`);
await sails.helpers.http.sendHttpRequest.with({
method: 'DELETE',
baseUrl: sails.config.custom.fleetBaseUrl,
url: `/api/v1/fleet/configuration_profiles/${team.uuid}`,
headers: {
Authorization: `Bearer ${sails.config.custom.fleetApiToken}`,
}
});
if(profile.teams) {
// If there is a new profile uploaded, we will need to delete the old profiles, and add the new profile.
for(let team of profile.teams) {
// console.log(`removing ${profile.name} from team id ${team.teamName}`);
await sails.helpers.http.sendHttpRequest.with({
method: 'DELETE',
baseUrl: sails.config.custom.fleetBaseUrl,
url: `/api/v1/fleet/configuration_profiles/${team.uuid}`,
headers: {
Authorization: `Bearer ${sails.config.custom.fleetApiToken}`,
}
});
}
}
for(let teamApid of newTeamIds){
// console.log(`Adding ${profile.name} to team id ${teamApid}`);

View file

@ -122,15 +122,17 @@ module.exports = {
});
}
} else {
for(let scriptId of script.teams){
await sails.helpers.http.sendHttpRequest.with({
method: 'DELETE',
baseUrl: sails.config.custom.fleetBaseUrl,
url: `/api/v1/fleet/scripts/${scriptId.scriptFleetApid}`,
headers: {
Authorization: `Bearer ${sails.config.custom.fleetApiToken}`,
}
});
if(script.teams) {
for(let scriptId of script.teams){
await sails.helpers.http.sendHttpRequest.with({
method: 'DELETE',
baseUrl: sails.config.custom.fleetBaseUrl,
url: `/api/v1/fleet/scripts/${scriptId.scriptFleetApid}`,
headers: {
Authorization: `Bearer ${sails.config.custom.fleetApiToken}`,
}
});
}
}
for(let teamApid of newTeamIds){
// Build a request body for the team.

View file

@ -213,7 +213,18 @@
margin-right: 8px;
}
}
[purpose='delete-button'] {
border-radius: 6px;
background: #D66C7B;
border-color: #D66C7B;
color: #FFF;
}
[purpose='modal-button'] {
border-radius: 6px;
background: #6A67FE;
color: #FFF;
border-color: #6A67FE;
}
[purpose='modal-buttons'] {
[purpose='cancel-button'] {
color: @core-vibrant-blue;

View file

@ -197,6 +197,12 @@
border: 1px solid #dc3545;
}
}
[purpose='delete-button'] {
border-radius: 6px;
background: #D66C7B;
border-color: #D66C7B;
color: #FFF;
}
[purpose='file-upload'] {
color: @core-vibrant-blue;
display: flex;
@ -209,6 +215,12 @@
margin-right: 8px;
}
}
[purpose='modal-button'] {
border-radius: 6px;
background: #6A67FE;
color: #FFF;
border-color: #6A67FE;
}
[purpose='modal-buttons'] {
[purpose='cancel-button'] {
color: @core-vibrant-blue;

View file

@ -102,7 +102,7 @@
</div>
<div purpose="modal-buttons" class="d-flex flex-row justify-content-end align-items-center">
<cloud-error v-if="cloudError && cloudError !== 'payloadIdentifierDoesNotMatch'"></cloud-error>
<ajax-button :syncing.sync="syncing" type="submit">Save</ajax-button>
<ajax-button :syncing.sync="syncing" purpose="modal-button" type="submit">Save</ajax-button>
</div>
</ajax-form>
</div>
@ -119,8 +119,8 @@
<ajax-form :handle-submitting="handleSubmittingDeleteProfileForm" :syncing.sync="syncing" :cloud-error.sync="cloudError" :form-errors.sync="formErrors" :form-data="formData" :form-rules="editProfileFormRules" @submitted="submittedForm()">
<cloud-error v-if="cloudError"></cloud-error>
<div class="d-flex flex-row justify-content-end align-items-center">
<a class="text-danger mr-3" @click="closeModal()">Cancel</a>
<ajax-button class="btn btn-danger" :syncing.sync="syncing">Delete</ajax-button>
<a class="mr-3" style="color: #D66C7B; cursor: pointer;" @click="closeModal()">Cancel</a>
<ajax-button class="btn" purpose="delete-button" :syncing.sync="syncing">Delete</ajax-button>
</div>
</ajax-form>
</modal>
@ -145,7 +145,7 @@
<cloud-error v-if="cloudError"></cloud-error>
<div purpose="modal-buttons" class="d-flex flex-row justify-content-end align-items-center">
<a purpose="cancel-button" @click="closeModal()">Cancel</a>
<ajax-button :syncing.sync="syncing" type="submit">Add</ajax-button>
<ajax-button :syncing.sync="syncing" purpose="modal-button" :disabled="!formData.newProfile" type="submit">Add</ajax-button>
</div>
</ajax-form>
</div>

View file

@ -111,7 +111,7 @@
<cloud-error v-if="cloudError === 'scriptNameDoesNotMatch'">The new scripts file name identifier must match the old scripts file name.</cloud-error>
<cloud-error v-else-if="cloudError"></cloud-error>
<div purpose="modal-buttons" class="d-flex flex-row justify-content-end align-items-center">
<ajax-button :syncing.sync="syncing" type="submit">Save</ajax-button>
<ajax-button :syncing.sync="syncing" purpose="modal-button" type="submit">Save</ajax-button>
</div>
</ajax-form>
</div>
@ -124,13 +124,13 @@
<h3 class="mb-4">Delete script</h3>
<div class="pointer" @click="closeModal()">&times;</div>
</div>
<p>Delete this script from all teams.</p>
<p class="mb-2">Delete this script from all teams.</p>
<p>This will cancel the script from running.</p>
<ajax-form :handle-submitting="handleSubmittingDeleteScriptForm" :syncing.sync="syncing" :cloud-error.sync="cloudError" :form-errors.sync="formErrors" :form-data="formData" :form-rules="editScriptFormRules" @submitted="submittedForm()">
<cloud-error v-if="cloudError"></cloud-error>
<div class="d-flex flex-row justify-content-end align-items-center">
<a class="text-danger mr-3" @click="closeModal()">Cancel</a>
<ajax-button class="btn btn-danger" :syncing.sync="syncing">Delete</ajax-button>
<a class="mr-3" style="color: #D66C7B; cursor: pointer;" @click="closeModal()">Cancel</a>
<ajax-button class="btn" purpose="delete-button" :syncing.sync="syncing">Delete</ajax-button>
</div>
</ajax-form>
</modal>
@ -155,7 +155,7 @@
<cloud-error v-else-if="cloudError"></cloud-error>
<div purpose="modal-buttons" class="d-flex flex-row justify-content-end align-items-center">
<a purpose="cancel-button" @click="closeModal()">Cancel</a>
<ajax-button :syncing.sync="syncing" type="submit">Add</ajax-button>
<ajax-button :syncing.sync="syncing" purpose="modal-button" :disabled="!formData.newScript" type="submit">Add</ajax-button>
</div>
</ajax-form>
</div>