Skip to content
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
1 change: 0 additions & 1 deletion cli/skx
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@ DISPATCH = { # {object : {verb : ([positional], [options], METHOD, URI, data-f
'delete' : (['backboneid'], [], 'DELETE', '/api/v1alpha1/backbones/${backboneid}', 'Result'),
'list' : ([], [], 'GET', '/api/v1alpha1/backbones', 'Table', 'Backbone Networks',
['id', 'name', ('stat', None, 'lifecycle'), 'failure', ('multitenant', 'YN')]),
'activate' : (['id'], [], 'PUT', '/api/v1alpha1/backbones/${id}/activate', 'Result'),
},

##
Expand Down
19 changes: 4 additions & 15 deletions components/compose-web-app/modules/backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function BuildBackboneTable() {
await BackboneDetail(item.id);
});
row.insertCell().appendChild(anchor);
row.insertCell().textContent = item.lifecycle.replace('partial', 'not-activated');
row.insertCell().textContent = item.lifecycle;
row.insertCell().textContent = item.failure || '';
}

Expand Down Expand Up @@ -128,16 +128,6 @@ async function BackboneDetail(bbid) {
}
fields.push(['Status:', status]);

if (backbone.lifecycle == 'partial') {
let activateButton = document.createElement('button');
activateButton.textContent = 'Activate';
activateButton.addEventListener('click', async () => {
let result = await fetch(`/api/v1alpha1/backbones/${bbid}/activate`, { method: 'PUT' });
await BackboneDetail(bbid);
});
fields.push(['', activateButton]);
}

let deleteButton = document.createElement('button');
deleteButton.textContent = 'Delete';
deleteButton.addEventListener('click', async () => {
Expand All @@ -162,11 +152,10 @@ async function BackboneDetail(bbid) {
path : `/api/v1alpha1/backbones/${bbid}`,
items : {
'lifecycle' : (attr) => {
const newval = attr.replace('partial', 'not-activated');
if (status.textContent != newval) {
status.textContent = newval;
if (status.textContent != attr) {
status.textContent = attr;
}
return newval == 'ready';
return attr == 'ready';
},
},
},
Expand Down
28 changes: 1 addition & 27 deletions components/management-controller/src/api-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const createBackbone = async function(req, res) {
const client = await ClientFromPool();
try {
await client.query("BEGIN");
const result = await client.query("INSERT INTO Backbones(Name, LifeCycle) VALUES ($1, 'partial') RETURNING Id", [norm.name]);
const result = await client.query("INSERT INTO Backbones(Name, LifeCycle) VALUES ($1, 'new') RETURNING Id", [norm.name]);
await client.query("COMMIT");

returnStatus = 201;
Expand Down Expand Up @@ -402,29 +402,6 @@ const updateBackboneLink = async function(req, res) {
return returnStatus;
}

const activateBackbone = async function(req, res) {
let returnStatus = 200;
const bid = req.params.bid;
const client = await ClientFromPool();
try {
await client.query("BEGIN");
if (!IsValidUuid(bid)) {
throw(Error('Backbone-Id is not a valid uuid'));
}

await client.query("UPDATE Backbones SET Lifecycle = 'new' WHERE Id = $1 and LifeCycle = 'partial'", [bid]);
await client.query("COMMIT");
res.status(returnStatus).end();
} catch (error) {
await client.query("ROLLBACK");
returnStatus = 400;
res.status(returnStatus).send(error.message);
} finally {
client.release();
}

return returnStatus;
}

const deleteBackbone = async function(req, res) {
let returnStatus = 204;
Expand Down Expand Up @@ -881,9 +858,6 @@ export async function Initialize(app, keycloak) {
.get(listBackbones) // READ
.delete(deleteBackbone); // DELETE

app.route(API_PREFIX + 'backbones/:bid/activate', keycloak.protect('realm:backbone-admin'))
.put(activateBackbone); // ACTIVATE

//========================================
// Backbone/Interior Sites
//========================================
Expand Down