-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change: Make use of GMP command get_resource_names to load tag
resources. Show a loading indicator to the user when data is being loaded.
- Loading branch information
1 parent
db5576a
commit b5b233a
Showing
4 changed files
with
167 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* Copyright (C) 2023 Greenbone AG | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Affero General Public License | ||
* as published by the Free Software Foundation, either version 3 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import registerCommand from 'gmp/command'; | ||
|
||
import ResourceName from 'gmp/models/resourcename'; | ||
import EntitiesCommand from './entities'; | ||
|
||
export class ResourceNamesCommand extends EntitiesCommand { | ||
constructor(http) { | ||
super(http, 'resource_name', ResourceName); | ||
this.name = 'resource'; | ||
} | ||
|
||
getEntitiesResponse(root) { | ||
return root.get_resource_names.get_resource_names_response; | ||
} | ||
|
||
export(entities) { | ||
throw new Error('export not implemented in ' + this.constructor.name); | ||
} | ||
|
||
exportByIds(ids) { | ||
throw new Error('exportByIds not implemented in ' + this.constructor.name); | ||
} | ||
|
||
exportByFilter(filter) { | ||
throw new Error( | ||
'exportByFilter not implemented in ' + this.constructor.name, | ||
); | ||
} | ||
|
||
delete(entities, extraParams) { | ||
throw new Error('delete not implemented in ' + this.constructor.name); | ||
} | ||
|
||
deleteByIds(ids, extraParams = {}) { | ||
throw new Error('deleteByIds not implemented in ' + this.constructor.name); | ||
} | ||
|
||
deleteByFilter(filter, extraParams) { | ||
throw new Error( | ||
'deleteByFilter not implemented in ' + this.constructor.name, | ||
); | ||
} | ||
|
||
transformAggregates(response) { | ||
throw new Error( | ||
'transformAggregates not implemented in ' + this.constructor.name, | ||
); | ||
} | ||
|
||
getAggregates({ | ||
dataColumns = [], | ||
textColumns = [], | ||
sort = [], | ||
aggregateMode, | ||
maxGroups, | ||
subgroupColumn, | ||
...params | ||
} = {}) { | ||
throw new Error( | ||
'getAggregates not implemented in ' + this.constructor.name, | ||
); | ||
} | ||
} | ||
|
||
registerCommand('resourcenames', ResourceNamesCommand); | ||
|
||
// vim: set ts=2 sw=2 tw=80: |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* Copyright (C) 2023 Greenbone AG | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Affero General Public License | ||
* as published by the Free Software Foundation, either version 3 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import {isDefined} from 'gmp/utils/identity'; | ||
|
||
export class ResourceName { | ||
constructor({id, name}) { | ||
this.id = id; | ||
this.name = name; | ||
} | ||
|
||
static fromElement(element) { | ||
const {_id, name} = element; | ||
|
||
return new ResourceName({ | ||
id: isDefined(_id) ? _id : '', | ||
name: isDefined(name) ? name : '', | ||
}); | ||
} | ||
} | ||
|
||
export default ResourceName; |
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