-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Preview tabs for workspaces (#172)
- Loading branch information
Showing
17 changed files
with
293 additions
and
1,141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,35 @@ | ||
'use strict' | ||
|
||
class Collection { | ||
constructor (api) { | ||
this.config = config | ||
this.infoUi = config.infoUi || {} | ||
this.assetUi = config.assetUi || {} | ||
this.grantUi = config.grantUi || {} | ||
this.stigUi = config.stignUi || {} | ||
async function addOrUpdateCollection( collectionId, collectionObj, options ) { | ||
try { | ||
let url, method | ||
if (collectionId) { | ||
url = `${STIGMAN.Env.apiBase}/collections/${collectionId}?elevate=${options.elevate}` | ||
method = 'PUT' | ||
} | ||
else { | ||
url = `${STIGMAN.Env.apiBase}/collections?elevate=${options.elevate}`, | ||
method = 'POST' | ||
} | ||
let result = await Ext.Ajax.requestPromise({ | ||
url: url, | ||
method: method, | ||
headers: { 'Content-Type': 'application/json;charset=utf-8' }, | ||
params: { | ||
projection: ['owners', 'statistics'] | ||
}, | ||
jsonData: collectionObj | ||
}) | ||
let apiCollection = JSON.parse(result.response.responseText) | ||
// Refresh the curUser global | ||
await SM.GetUserObject() | ||
|
||
let event = collectionId ? 'collectionchanged' : 'collectioncreated' | ||
SM.Dispatcher.fireEvent( event, apiCollection, options ) | ||
} | ||
|
||
|
||
async updateBackend(putData) { | ||
try { | ||
let result = await Ext.Ajax.requestPromise({ | ||
url: `${CMSAT.Env.apiBase}/collections/${this.config.collectionId}`, | ||
method: 'PUT', | ||
headers: { 'Content-Type': 'application/json;charset=utf-8' }, | ||
jsonData: putData | ||
}) | ||
this.config = JSON.parse(result.response.responseText) | ||
return result | ||
} | ||
catch (err) { | ||
throw (err) | ||
} | ||
} | ||
|
||
async deleteCollection() { | ||
try { | ||
let results = await Ext.Ajax.requestPromise({ | ||
url: `${CMSAT.Env.apiBase}/collections/${this.config.collectionId}`, | ||
method: 'DELETE' | ||
}) | ||
return results | ||
} | ||
catch (err) { | ||
throw (err) | ||
} | ||
} | ||
|
||
updateInfoUi () { | ||
this.infoUi.panel.update(this.config) | ||
catch (e) { | ||
alert (e.message) | ||
} | ||
|
||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.